From owner-svn-src-all@freebsd.org Sun Jan 28 00:08:32 2018 Return-Path: Delivered-To: svn-src-all@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 BB168ECC841; Sun, 28 Jan 2018 00:08:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 220D1813B2; Sun, 28 Jan 2018 00:08:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id CA1FD3D17BE; Sun, 28 Jan 2018 11:08:20 +1100 (AEDT) Date: Sun, 28 Jan 2018 11:08:19 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: Conrad Meyer , Pedro Giffuni , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune In-Reply-To: <1517094539.1517.9.camel@freebsd.org> Message-ID: <20180128102559.X4216@besplex.bde.org> References: <201801271743.w0RHh9io022619@repo.freebsd.org> <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> <1517094539.1517.9.camel@freebsd.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DIX/22Fb c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=CcenBSfWVn6lpJRqZSMA:9 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 00:08:33 -0000 On Sat, 27 Jan 2018, Ian Lepore wrote: > On Sat, 2018-01-27 at 22:56 +0000, Conrad Meyer wrote: >> I don=FFt think dragonfly has anything to do with this?=A0=A0If you=FFre >> converting >> bool increments to setting true values in FreeBSD, use >> =B4true.=A1=A0=A0That=FFs all >> there is to it. > > style(9) emphasizes internal consistancy in several places. =A0The > uppercase TRUE/FALSE is currently the style within that code, so it > makes sense to stick with it. =A0If a (somewhat gratuitous) conversion to > the new style is made, it should be a separate commit just for that, > emphasizing that it changes just style and not functionality. fortune.c has already been churned and broken by gratuitous conversion to use bool. It used to use "#define bool short". It also defined its own TRUE and FALS= E as 1 and 0. This was almost correct. The bools were sometimes set bogusly to TRUE using the PDP-11 micro-optimization of incrementing them (this can overflow in theory, but in practice it is hard to have enough command line args to overflow even short variables by incrementing them by 1 per arg). The `Debug' variable was tri-state, but its type was misspelled bool and it was bogusly initialized to FALSE. This was changed in r242576 by including , removing the private definition of bool, and changing the definitions of TRUE and FALSE to true and false. This did no good, but exposed the brokenness of 'Debug' and created mounds of style bugs (spelling true and false as TRUE and FALSE, and requiring more magic for the PDP-11ism's to work). r242577 increased the style bugs by using true and false directly in new code. 'Debug' was fixed in r243036. This commit is to remove the PDP11-isms. Although they work even better with real bools than with shorts (incrementing a bool clamps it to 1, but incrementing a short always increments it unless it overflows), they are larger obfuscations with bools than with shorts and some compilers apparently warn about them. This commit preserves the old style of using TRUE and FALSE instead of true and false. style(9) only mildly discourages converting old code to use bool ("may be converted if it is reasonable to"). It says that the spellings true and false are preferred, but should only say that the are preferred in code that uses bool. Bruce From owner-svn-src-all@freebsd.org Sun Jan 28 00:26:06 2018 Return-Path: Delivered-To: svn-src-all@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 2C8F2ECD91B; Sun, 28 Jan 2018 00:26:06 +0000 (UTC) (envelope-from eadler@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 D64848200F; Sun, 28 Jan 2018 00:26:05 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 D139111F2B; Sun, 28 Jan 2018 00:26:05 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0S0Q5os021746; Sun, 28 Jan 2018 00:26:05 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S0Q578021745; Sun, 28 Jan 2018 00:26:05 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801280026.w0S0Q578021745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 28 Jan 2018 00:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328502 - stable/11/usr.bin/limits X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/limits X-SVN-Commit-Revision: 328502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 00:26:06 -0000 Author: eadler Date: Sun Jan 28 00:26:05 2018 New Revision: 328502 URL: https://svnweb.freebsd.org/changeset/base/328502 Log: MFC r328212: limits(1): fix always true condition Modified: stable/11/usr.bin/limits/limits.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/limits/limits.c ============================================================================== --- stable/11/usr.bin/limits/limits.c Sat Jan 27 23:40:41 2018 (r328501) +++ stable/11/usr.bin/limits/limits.c Sun Jan 28 00:26:05 2018 (r328502) @@ -509,7 +509,7 @@ main(int argc, char *argv[]) for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) { if (doall || num_limits == 0 || which_limits[rcswhich] != 0) { - if (which_limits[rcswhich] == ANY || which_limits[rcswhich]) + if (which_limits[rcswhich] == ANY) which_limits[rcswhich] = type; if (shellparm[shelltype].lprm[rcswhich].pfx) { if (shellparm[shelltype].both && limits[rcswhich].rlim_cur == limits[rcswhich].rlim_max) { From owner-svn-src-all@freebsd.org Sun Jan 28 00:27:52 2018 Return-Path: Delivered-To: svn-src-all@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 2A0F0ECDA6A; Sun, 28 Jan 2018 00:27:52 +0000 (UTC) (envelope-from eadler@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 CEDD682171; Sun, 28 Jan 2018 00:27:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C82A711F2D; Sun, 28 Jan 2018 00:27:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0S0RpfX021843; Sun, 28 Jan 2018 00:27:51 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S0RpP2021842; Sun, 28 Jan 2018 00:27:51 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801280027.w0S0RpP2021842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 28 Jan 2018 00:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328503 - stable/11/lib/libiconv_modules/ISO2022 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libiconv_modules/ISO2022 X-SVN-Commit-Revision: 328503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 00:27:52 -0000 Author: eadler Date: Sun Jan 28 00:27:51 2018 New Revision: 328503 URL: https://svnweb.freebsd.org/changeset/base/328503 Log: MFC r328222: iconv: adding missing break break is probably intended and correct, but has no correctness implications due to is94 => is96 Modified: stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c ============================================================================== --- stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c Sun Jan 28 00:26:05 2018 (r328502) +++ stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c Sun Jan 28 00:27:51 2018 (r328503) @@ -774,6 +774,7 @@ asis: case CS94: if (!(is94(string[0] & 0x7f))) goto asis; + break; case CS96: if (!(is96(string[0] & 0x7f))) goto asis; From owner-svn-src-all@freebsd.org Sun Jan 28 00:48:00 2018 Return-Path: Delivered-To: svn-src-all@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 5C626ECE8AB for ; Sun, 28 Jan 2018 00:48:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic303-37.consmr.mail.gq1.yahoo.com (sonic303-37.consmr.mail.gq1.yahoo.com [98.137.64.218]) (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 D914482BD2 for ; Sun, 28 Jan 2018 00:47:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517100478; bh=AWPF0i9iWL/UQxVh8OO9bU+hqEiP8A3VNKH2tnb2oi4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=IqEhrZMDHeptKzOdfW6JEZWHTft3Tpk03zmZfYAZEy3OEbxYQrSvrfOgiiAHMkGbL05Yktd9wGiSjdJNdUSF3ifGosGnRLlryde8YfJtnhKrTly07uDAUT+hLEmURgeG1gpiUa4C9xzdlrKYm+8wsjYCZFLD1mXleVVBy9fldtf6ZXzIQVh8ZQPurKLTbalc44dE9xFrIpPf9RHQrxKjtlGvOENOiYX9tutY21Nvlgh8MIgeIYFVvJ19JV5SHFdNPPSpB1OhTQLe7DG3jDxoT4K2Up+BukaC8B44jNpHnretBFwb/TB3byQmiqaKQEQIiMHdoralF/BdvR2xaHJVMg== X-YMail-OSG: CPfRl_gVM1mBJOYtZQsQBx_DIX44GoJN9sGtwul2VEZjowzOVRgaiqlzRijVMO1 Ux1vbz9maxlKMLlBdAZIpxi0tZ9sZA3RXIH9kdCVByuHaEZVQc4VGqp2NXiVTtw7v5x1JPE9mEUG dSSBafAigibM8lns350WSD2UHe5Y5asTErek6nvQUh8.6OhUKKNvBLXD6mA9evUr34XHNcKqAztK lFDXJKwBWWfIObu7nkySHoqdbg41vYVwtPOvMG_So_s1.EQ9lH_1UqdSdq9nPlMdstwDaYInmj.u .Ky0JWo9IVHnJQWcR1HbpBJhqgG_7WFFUy4UBkrfpogUup9NWMdVhjD2Rs5Quhz5YhZn9Gquv5Jf lza8_YdUteKkghvC0jVP_rByA8gTonVtUX5CheYgF3S83iN7SpGZlnvP87L21lryWN5o47pdz_6u dfWlVY6iK5gl4rPgTukO6wrOx9wARZUD9zaTsxVxIrvKFxgUEyewTbpljaClMeTN_bxcWRaYoorL ovnKHVeryMQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.gq1.yahoo.com with HTTP; Sun, 28 Jan 2018 00:47:58 +0000 Received: from smtp108.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([216.39.57.224]) by smtp412.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 78660072d3a45406ef0ce1c26ec7eb04; Sun, 28 Jan 2018 00:37:47 +0000 (UTC) Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune To: Ian Lepore , Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801271743.w0RHh9io022619@repo.freebsd.org> <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> <1517094539.1517.9.camel@freebsd.org> From: Pedro Giffuni Message-ID: <1ea5c2a1-c65c-09ef-558c-287657df4ba1@FreeBSD.org> Date: Sat, 27 Jan 2018 19:37:45 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1517094539.1517.9.camel@freebsd.org> Content-Type: text/plain; charset=iso-8859-13; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 00:48:00 -0000 On 01/27/18 18:08, Ian Lepore wrote: > On Sat, 2018-01-27 at 22:56 +0000, Conrad Meyer wrote: >> I don�t think dragonfly has anything to do with this?��If you�re >> converting >> bool increments to setting true values in FreeBSD, use >> �true.���That�s all >> there is to it. >> >> Best, >> Conrad > style(9) emphasizes internal consistancy in several places. �The > uppercase TRUE/FALSE is currently the style within that code, so it > makes sense to stick with it. �If a (somewhat gratuitous) conversion to > the new style is made, it should be a separate commit just for that, > emphasizing that it changes just style and not functionality. Indeed. I didn't want to mix FALSE with false and TRUE with true so I did the change as is to make the diff smaller and still have everything look consistent. Further cleanups (DragonFly already did it) should be done in a different commit. I personally don't feel it's something important though. Pedro. From owner-svn-src-all@freebsd.org Sun Jan 28 00:50:12 2018 Return-Path: Delivered-To: svn-src-all@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 459BEECEA07 for ; Sun, 28 Jan 2018 00:50:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-36.consmr.mail.gq1.yahoo.com (sonic302-36.consmr.mail.gq1.yahoo.com [98.137.68.162]) (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 C16B482D4C for ; Sun, 28 Jan 2018 00:50:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517100610; bh=P36D0DkgC2LqndVSYm4STDudviyLqsO7spJVCepvJhI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=J3RJsKSiRvscpm21v1mo7CGy+kU9KwNnUPhILJShzOUmZsylu8PYtUsqgsoQH7bLqhSZ0iOf8H7zwFSGsqjbil5p9ti6AQ029m4rqub+4mVWjhRNe6MEqDBHV+Wo5xm0Ia1sQhmhAcaRRGuSWC4119LUjwz9uL7AI7JBkRIie56VYGBQHCcWGIGi9b3Q1k8wxODdnwYsHxcSDJd1R/AhnnOgaPDZGLlyfLo8dQx8b2mdsLnKTTHqGhwc5vExgUJezpwVBzCI0VEkxWtH0SPU9hJNsrLODcf9GfMCOY0P/cNypPWo4fBUHMms/E0/vGruKhxD48AV1OJ3ciHIc7PP4Q== X-YMail-OSG: UcBmyo0VM1nmucI9exJVqET3QVSWO_X1hiWMgkw61vO1GdW2Y37HqTRVWOgQPfq Ex1y70V8fOvSBPUD0KHvGLjyKhdCX8NrVGa3MrrY8_.hJgW1UEUIh0Kxmehq4QO1KObfy9JAvYln zLmVmHrI5r__6aGYNbDAdagOIoyhMDFOoVKlQjrL31QizNNkAKupqvTrUO6kiN9BRwJFDL7AYqc5 668uXlcIgHHXKLapW_.BM_4Y2DexXacT1b9mnnF_GqwJrcsnborM73kgxxsYZElODnIHdxkKyHbE _ZqfrY5RunUDy8Nu9ewEmvXqHE8XMr_vMIefQKxWtCnL_nD6Psbhx_wNzB68HfxegI1622eF8tx7 7DsjViJZ_Y1XMgaIJfivRFp0ZtpI.jFx6FolBeJUmBO3sRG0Rz3vfJOwV2f5NEylMRHQuFnis7TW hr80iRQMND66yBulTHBQPjTD0OEnYbQAhxiFSTOR29gAV.24JDvXNTyhhQ918Qhb7nbffKcdMYBF l6bQ1PSY0qg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sun, 28 Jan 2018 00:50:10 +0000 Received: from smtp102.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([216.39.57.211]) by smtp409.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 9b32a739fd825fcb775a1f7b01996378; Sun, 28 Jan 2018 00:50:08 +0000 (UTC) Subject: Re: svn commit: r328492 - head/contrib/opie/libopie To: Bruce Evans , Dimitry Andric Cc: Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801272216.w0RMGJwo057492@repo.freebsd.org> <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> <20180128093811.G4029@besplex.bde.org> From: Pedro Giffuni Message-ID: <5c39c37d-8d0a-22e9-710b-2453e0dd4481@FreeBSD.org> Date: Sat, 27 Jan 2018 19:50:07 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180128093811.G4029@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 00:50:12 -0000 On 01/27/18 18:21, Bruce Evans wrote: > On Sat, 27 Jan 2018, Dimitry Andric wrote: > >> On 27 Jan 2018, at 23:20, Ed Schouten wrote: >>> >>> 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : >>>>        char host[sizeof(utmp.ut_host) + 1]; >>>>        insecure = 1; >>>> >>>> -       strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); >>>> -       host[sizeof(utmp.ut_host)] = 0; >>>> +       strncpy(host, utmp.ut_host, sizeof(host)); >>> >>> Wait... This may access utmp.ut_host one byte past the end and no >>> longer guarantees that host is null-terminated, right? > >> No, strncpy "copies at most len characters from src into dst".  However, > > No, the change breaks the length so 1 byte past the end is accessed > in implementations where ut_host is not guaranteed to be NUL terminated > and the current instance of ut_host is not NUL terminated. > The main change is in the sizeof(). Regularly you should use the size of destination not the source, and apparently GCC8 decided there was something to check there. >> if the length of the source is equal to or greater than len, the >> destination is *not* null terminated.  This is likely why the >> "host[sizeof(utmp.ut_host)] = 0;" statement was added. > > This is why that statement was there. > > This change is not even wrong under FreeBSD, since ut_host and several > other > fields are guaranteed to be NUL terminated in the FreeBSD implementation. > The code was correct and portable and the change just breaks its > portability. > The change was done for portability to GCC, or at least to fix a warning there. >> In any case, this is why strlcpy exists. :) > > Using strlcpy() in libopie would be another good unportabilization. > contrib/opie never uses strlc*() except in 1 place previously > unportabilized in r208586.  That at least fixed 2 bugs (2 related off > by 1 errors in the code intended to avoid buffer overruns, with the > result that buffer overruns were limited to 1 byte).  It moved the > style bugs by changing hacking on the source string to use of strlcpy(). > Looking in detail, upstream (which appears to have disappeared) does have the explicit NULL termination in our last import. For consistency and given that we already have a strlcpy in that code, we should use strlcpy() there. Every modern OS out there has strlcpy(3) and if not they can figure out what to do. Pedro. From owner-svn-src-all@freebsd.org Sun Jan 28 01:22:16 2018 Return-Path: Delivered-To: svn-src-all@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 91A09ED0852; Sun, 28 Jan 2018 01:22:16 +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 4786584309; Sun, 28 Jan 2018 01:22:16 +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 42925129B9; Sun, 28 Jan 2018 01:22:16 +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 w0S1MGoV051045; Sun, 28 Jan 2018 01:22:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S1MFHb051040; Sun, 28 Jan 2018 01:22:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801280122.w0S1MFHb051040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 28 Jan 2018 01:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328504 - in head/stand: efi/fdt fdt uboot/fdt X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: efi/fdt fdt uboot/fdt X-SVN-Commit-Revision: 328504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 01:22:16 -0000 Author: kevans Date: Sun Jan 28 01:22:15 2018 New Revision: 328504 URL: https://svnweb.freebsd.org/changeset/base/328504 Log: stand/fdt: Consolidate overlay handling a little further This should have been done as part of r327350, but due to lack of foresight it came later. In the different places we apply overlays, we duplicate the bits that check for fdt_overlays in the environment and supplement that with any other places we need to check for overlays to load. These "other places" will be loader specific and are not candidates for consolidation. Provide an fdt_load_dtb_overlays to capture the common logic, allow passing in an additional list of overlays to be loaded. This additional list of overlays is used in practice for ubldr to pull in any fdt_overlays passed to it from U-Boot environment, but it can be used for any other source of overlays. These additional overlays supplement loader.conf(5) fdt_overlays, rather than replace, so that we're not restricted to specifying overlays in only one place. This is a change from previous behavior where loader.conf(5) supplied fdt_overlays would cause us to ignore U-Boot environment, and this seems nonsensical- user should have sufficient control over both of these aspects, or lack of control for good reasons. A knob could be considered in the future to ignore U-Boot supplied overlays, but the supplemental treatment seems like a good start. Reviewed by: imp (earlier version), gonzo (earlier version) Differential Revision: https://reviews.freebsd.org/D13993 Modified: head/stand/efi/fdt/efi_fdt.c head/stand/fdt/fdt_loader_cmd.c head/stand/fdt/fdt_platform.h head/stand/uboot/fdt/uboot_fdt.c Modified: head/stand/efi/fdt/efi_fdt.c ============================================================================== --- head/stand/efi/fdt/efi_fdt.c Sun Jan 28 00:27:51 2018 (r328503) +++ head/stand/efi/fdt/efi_fdt.c Sun Jan 28 01:22:15 2018 (r328504) @@ -53,12 +53,7 @@ fdt_platform_load_dtb(void) return (1); printf("Using DTB provided by EFI at %p.\n", hdr); - s = getenv("fdt_overlays"); - if (s != NULL && *s != '\0') { - printf("Loading DTB overlays: '%s'\n", s); - fdt_load_dtb_overlays(s); - } - + fdt_load_dtb_overlays(NULL); return (0); } Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Sun Jan 28 00:27:51 2018 (r328503) +++ head/stand/fdt/fdt_loader_cmd.c Sun Jan 28 01:22:15 2018 (r328504) @@ -76,6 +76,7 @@ static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); static int fdt_cmd_nyi(int argc, char *argv[]); +static int fdt_load_dtb_overlays_string(const char * filenames); static int fdt_cmd_addr(int argc, char *argv[]); static int fdt_cmd_mkprop(int argc, char *argv[]); @@ -331,15 +332,15 @@ fdt_print_overlay_load_error(int err, const char *file } } -int -fdt_load_dtb_overlays(const char * filenames) +static int +fdt_load_dtb_overlays_string(const char * filenames) { char *names; char *name, *name_ext; char *comaptr; int err, namesz; - debugf("fdt_load_dtb_overlay(%s)\n", filenames); + debugf("fdt_load_dtb_overlays_string(%s)\n", filenames); names = strdup(filenames); if (names == NULL) @@ -829,6 +830,25 @@ fdt_fixup_stdout(const char *str) strlen((char *)&tmp) + 1); fdt_setprop(fdtp, no, "stdin", &tmp, strlen((char *)&tmp) + 1); + } +} + +void +fdt_load_dtb_overlays(const char *extras) +{ + const char *s; + + /* Any extra overlays supplied by pre-loader environment */ + if (extras != NULL && *extras != '\0') { + printf("Loading DTB overlays: '%s'\n", extras); + fdt_load_dtb_overlays_string(extras); + } + + /* Any overlays supplied by loader environment */ + s = getenv("fdt_overlays"); + if (s != NULL && *s != '\0') { + printf("Loading DTB overlays: '%s'\n", s); + fdt_load_dtb_overlays_string(s); } } Modified: head/stand/fdt/fdt_platform.h ============================================================================== --- head/stand/fdt/fdt_platform.h Sun Jan 28 00:27:51 2018 (r328503) +++ head/stand/fdt/fdt_platform.h Sun Jan 28 01:22:15 2018 (r328504) @@ -46,7 +46,7 @@ void fdt_fixup_stdout(const char *); void fdt_apply_overlays(void); int fdt_load_dtb_addr(struct fdt_header *); int fdt_load_dtb_file(const char *); -int fdt_load_dtb_overlays(const char *); +void fdt_load_dtb_overlays(const char *); int fdt_setup_fdtp(void); /* The platform library needs to implement these functions */ Modified: head/stand/uboot/fdt/uboot_fdt.c ============================================================================== --- head/stand/uboot/fdt/uboot_fdt.c Sun Jan 28 00:27:51 2018 (r328503) +++ head/stand/uboot/fdt/uboot_fdt.c Sun Jan 28 01:22:15 2018 (r328504) @@ -89,16 +89,8 @@ fdt_platform_load_dtb(void) } exit: - if (rv == 0) { - s = getenv("fdt_overlays"); - if (s == NULL) - s = ub_env_get("fdt_overlays"); - if (s != NULL && *s != '\0') { - printf("Loading DTB overlays: '%s'\n", s); - fdt_load_dtb_overlays(s); - } - } - + if (rv == 0) + fdt_load_dtb_overlays(ub_env_get("fdt_overlays")); return (rv); } From owner-svn-src-all@freebsd.org Sun Jan 28 01:42:47 2018 Return-Path: Delivered-To: svn-src-all@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 65A4CED12B6; Sun, 28 Jan 2018 01:42:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id D63B685058; Sun, 28 Jan 2018 01:42:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 26BBDD6E9A7; Sun, 28 Jan 2018 12:42:38 +1100 (AEDT) Date: Sun, 28 Jan 2018 12:42:37 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: Bruce Evans , Dimitry Andric , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328492 - head/contrib/opie/libopie In-Reply-To: <5c39c37d-8d0a-22e9-710b-2453e0dd4481@FreeBSD.org> Message-ID: <20180128121851.U4596@besplex.bde.org> References: <201801272216.w0RMGJwo057492@repo.freebsd.org> <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> <20180128093811.G4029@besplex.bde.org> <5c39c37d-8d0a-22e9-710b-2453e0dd4481@FreeBSD.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DIX/22Fb c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=JR47EUaj5dUosQkC4R8A:9 a=xtHLe4mNsMW_yGvb:21 a=3uVtrHTtWy3TCr6j:21 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 01:42:47 -0000 On Sat, 27 Jan 2018, Pedro Giffuni wrote: > On 01/27/18 18:21, Bruce Evans wrote: >> On Sat, 27 Jan 2018, Dimitry Andric wrote: >>=20 >>> On 27 Jan 2018, at 23:20, Ed Schouten wrote: >* [... context lost to corruption of spaces which makes it unreadable] >>>>=20 >>>> Wait... This may access utmp.ut_host one byte past the end and no >>>> longer guarantees that host is null-terminated, right? >>=20 >>> No, strncpy "copies at most len characters from src into dst".=C2=A0 Ho= wever, >>=20 >> No, the change breaks the length so 1 byte past the end is accessed >> in implementations where ut_host is not guaranteed to be NUL terminated >> and the current instance of ut_host is not NUL terminated. >>=20 > The main change is in the sizeof(). Regularly you should use the size of= =20 > destination not the source, and apparently GCC8 decided there was somethi= ng=20 > to check there. That is the main breakage. Using the size of the destination is very wrong= , since that size is intentionally 1 larger than the size of the source, to leave space for appending a NUL. > ... > Looking in detail, upstream (which appears to have disappeared) does have= the=20 > explicit NULL termination in our last import. For consistency and given t= hat=20 > we already have a strlcpy in that code, we should use strlcpy() there. Ev= ery=20 > modern OS out there has strlcpy(3) and if not they can figure out what to= do. strlcpy() still seems to be intentionally left out of glibc. Bruce From owner-svn-src-all@freebsd.org Sun Jan 28 02:26:11 2018 Return-Path: Delivered-To: svn-src-all@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 5418BED2F9F; Sun, 28 Jan 2018 02:26:11 +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 AECCA86949; Sun, 28 Jan 2018 02:26:10 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id fcfReIhEPS7BpfcfSenou8; Sat, 27 Jan 2018 19:26:03 -0700 X-Authority-Analysis: v=2.2 cv=NKylwwyg c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=RgaUWeydRksA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=mDrIFqkUxoSzuNa0Tf8A:9 a=CjuIK1q_8ugA: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 619E6504; Sat, 27 Jan 2018 18:26:00 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w0S2Px4S010114; Sat, 27 Jan 2018 18:25:59 -0800 (PST) (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 w0S2Px1G010111; Sat, 27 Jan 2018 18:25:59 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201801280225.w0S2Px1G010111@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 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mariusz Zaborski cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328474 - head/sys/contrib/libnv In-Reply-To: Message from Mariusz Zaborski of "Sat, 27 Jan 2018 22:56:58 +0100." <20180127215658.GA75080@jarvis> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 27 Jan 2018 18:25:59 -0800 X-CMAE-Envelope: MS4wfJ7gxLVponPZz9Gt5YiJACeD7VRGWhhuqy/rQWPbQBhIX7s5BW5v66l1u36K5Tb4zqAiG1HpozCIZLrEPl36hiVyhhb1vxxaSVLfG2nMUMGUy0VWULc9 zVeR/OxD+bj5wRjb6Unh0LMgWXdNwSdYrYSOapE7mQkZzZUHqdkyNotVnKySrijCbDjmr10aitFcWiNmuczhNEKla94IgCxDqFaxJVCu96/qVF+AqIBXby1X DqLG2hglEDHBUguyxtnDJ22nnaM2Rhvs3FzF94jNDe7Lo5XIHXEzvWG57xaefPcT X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 02:26:11 -0000 In message <20180127215658.GA75080@jarvis>, Mariusz Zaborski writes: > > > --ew6BAiZeqk4r7MaW > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > Content-Transfer-Encoding: quoted-printable > > On Sat, Jan 27, 2018 at 07:32:39AM -0800, Cy Schubert wrote: > > In message <201801271258.w0RCwMl0078832@repo.freebsd.org>, Mariusz Zabors= > ki=20 > > wri > > tes: > > > Author: oshogbo > > > Date: Sat Jan 27 12:58:21 2018 > > > New Revision: 328474 > > > URL: https://svnweb.freebsd.org/changeset/base/328474 > > > > > > Log: > > > Add SPDX tags for nv(9). > > > =20 > > > MFC after: 2 weeks > > > > > > Modified: > > > head/sys/contrib/libnv/cnvlist.c > > > head/sys/contrib/libnv/dnvlist.c > > > head/sys/contrib/libnv/nv_impl.h > > > head/sys/contrib/libnv/nvlist.c > > > head/sys/contrib/libnv/nvlist_impl.h > > > head/sys/contrib/libnv/nvpair.c > > > head/sys/contrib/libnv/nvpair_impl.h > > > > >=20 > > When was it decided to add SPDX to contrib? > The nv was development for and in FreeBSD. > First whole library was in lib/libnv. > Then the part which is also in the kernel was moved to sys/kern and sys/sys > directories. > The problem with that was that evrything in the sys/sys is instaled in > /usr/include and in the *_impl.h we have things that should not be accesibl= > e by > developers. > > This was the main reason of moving libnv to contrib file at the time. > If you have any other place where libnv can be kept I'm happy to move it. It's native to FreeBSD then and not an import through a vendor branch. That's what was led to understand. However this was not concern I had. As this is native FreeBSD code it should have SPDX tags. My concern about SPDX in contrib is MFV. I think we should encourage our upstream source providers to include SPDX tags in their code we import into the vendor branches. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Jan 28 02:27:55 2018 Return-Path: Delivered-To: svn-src-all@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 5FFDEED3056 for ; Sun, 28 Jan 2018 02:27:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic312-37.consmr.mail.ne1.yahoo.com (sonic312-37.consmr.mail.ne1.yahoo.com [66.163.191.218]) (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 E698786A70 for ; Sun, 28 Jan 2018 02:27:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517106468; bh=7Z+TCps5K8hK3gwfv0MAbDRVDroI6Eb4Ur5H9lwbFiI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=b+oEOkIRedvjuuGJM9SIuvmia87ZCpcysqKHGUquCpCJHufw6p2fjtcl+cQrktGtdkinRP2hcYr1GQQTv0NOSz2MbDYfnJkF/oD9DQHdtwr8LgaOB1GuG4nyR9JDGGJrmIB2LnWtrpPG9QRokNqkSKzdWVNEJi8RsiZIBiesp+rtfWgZnO62E8Z27StG+kHD/zQOqlwHp+nhjz3yX7oH7lRJzUD7SIZZcl6UmV5XjrJ9f7dmIcDPtg92rEFEVNE+Gr+EfGRv7ciZw4/FcQuDKoagwfef9rNSubyCti6mLxrQmwrdVURP/IZPcXWq3XfJgbdzNb0DJxtVmt/uNCrglg== X-YMail-OSG: 4lYgNnEVM1nDc1p56MOdLshD59bxcoYS0wLd1zskLBMv8djEKWRTdIpOeTmuefK F0cLcn5fq09nJnl0a3wgUw.heQCtW0SiBZq3VpD2gaJ5jfmSJmWn4TeXZyucT03Xt8QCJRL3jOdG a6J2efcLnTgdtf8HqF0WpnK.KdnDyhMlGBUKZo1WxFmSp._tfwUX53vwhOnTphdBzKk7PbumHPyI TZS1NK2vJUlv8K6fEmkMrURqO1H34cB9nZXwje3RpRwKO5_9X.eUg7T_Sm0wKt26ljcZSj7zzBSW Kk5LZZEuuF52GLX0qZ6638w_JzHiPwX8NCP1DZTKAaXEdPdmTqRsxLIZ5jYIsL8FSMz1UVxbfczl 2U36YnV9MoZNRgjEojIq83JX6qqpQ2YU4tlAOrZ8OP9btDIxSTwuxhtMYvFtPzoszV8TakHWsbRL UxAKtj2FAydUFhzy5FQXAr5LhedZ6DoPfub5mtyRHEOxpKC.rotUBHPzQa6Rn5qelQA202qSsr8J mhXTaY0TJHw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Sun, 28 Jan 2018 02:27:48 +0000 Received: from smtpgate105.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([216.155.193.135]) by smtp402.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 9ac1d834536b6f16cdb53c4b474e3854; Sun, 28 Jan 2018 02:27:45 +0000 (UTC) Subject: Re: svn commit: r328492 - head/contrib/opie/libopie To: Bruce Evans Cc: Dimitry Andric , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801272216.w0RMGJwo057492@repo.freebsd.org> <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> <20180128093811.G4029@besplex.bde.org> <5c39c37d-8d0a-22e9-710b-2453e0dd4481@FreeBSD.org> <20180128121851.U4596@besplex.bde.org> From: Pedro Giffuni Message-ID: <0e2f6c82-3036-29ef-bf09-15d4e5623020@FreeBSD.org> Date: Sat, 27 Jan 2018 21:27:46 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180128121851.U4596@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 02:27:55 -0000 On 01/27/18 20:42, Bruce Evans wrote: > On Sat, 27 Jan 2018, Pedro Giffuni wrote: > >> On 01/27/18 18:21, Bruce Evans wrote: >>> On Sat, 27 Jan 2018, Dimitry Andric wrote: >>> >>>> On 27 Jan 2018, at 23:20, Ed Schouten wrote: > >> * [... context lost to corruption of spaces which makes it unreadable] > >>>>> >>>>> Wait... This may access utmp.ut_host one byte past the end and no >>>>> longer guarantees that host is null-terminated, right? >>> >>>> No, strncpy "copies at most len characters from src into dst".  >>>> However, >>> >>> No, the change breaks the length so 1 byte past the end is accessed >>> in implementations where ut_host is not guaranteed to be NUL terminated >>> and the current instance of ut_host is not NUL terminated. >>> >> The main change is in the sizeof(). Regularly you should use the size >> of destination not the source, and apparently GCC8 decided there was >> something to check there. > > That is the main breakage.  Using the size of the destination is very > wrong, > since that size is intentionally 1 larger than the size of the source, to > leave space for appending a NUL. > I am considering reverting the change. Looking at other ways to get rid of the warning, please be patient. >> ... >> Looking in detail, upstream (which appears to have disappeared) does >> have the explicit NULL termination in our last import. For >> consistency and given that we already have a strlcpy in that code, we >> should use strlcpy() there. Every modern OS out there has strlcpy(3) >> and if not they can figure out what to do. > > strlcpy() still seems to be intentionally left out of glibc. > glibc is not portable. I understand some systems that carry glibc also carry libbsd, or they can still use musl: https://github.com/esmil/musl/blob/master/src/string/strlcpy.c Pedro. From owner-svn-src-all@freebsd.org Sun Jan 28 05:13:09 2018 Return-Path: Delivered-To: svn-src-all@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 80C93ED8FFE; Sun, 28 Jan 2018 05:13:09 +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 199536C067; Sun, 28 Jan 2018 05:13:09 +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 10F6915396; Sun, 28 Jan 2018 05:13:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0S5D8Yh066117; Sun, 28 Jan 2018 05:13:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S5D8HK066116; Sun, 28 Jan 2018 05:13:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801280513.w0S5D8HK066116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 28 Jan 2018 05:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328507 - head/sys/tools X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/tools X-SVN-Commit-Revision: 328507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 05:13:09 -0000 Author: imp Date: Sun Jan 28 05:13:08 2018 New Revision: 328507 URL: https://svnweb.freebsd.org/changeset/base/328507 Log: Avoid using \$. It's an unknown escape sequence. Some awks warn about that. Instead, simply remove the sequence entirely because we never commit the generated files. Modified: head/sys/tools/usbdevs2h.awk Modified: head/sys/tools/usbdevs2h.awk ============================================================================== --- head/sys/tools/usbdevs2h.awk Sun Jan 28 03:16:54 2018 (r328506) +++ head/sys/tools/usbdevs2h.awk Sun Jan 28 05:13:08 2018 (r328507) @@ -42,14 +42,6 @@ function usage() function header(file) { - if (os == "NetBSD") - printf("/*\t\$NetBSD\$\t*/\n\n") > file - else if (os == "FreeBSD") - printf("/* \$FreeBSD\$ */\n\n") > file - else if (os == "OpenBSD") - printf("/*\t\$OpenBSD\$\t*/\n\n") > file - else - printf("/* ??? */\n\n") > file printf("/*\n") > file printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ > file From owner-svn-src-all@freebsd.org Sun Jan 28 05:13:18 2018 Return-Path: Delivered-To: svn-src-all@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 2A25AED9004; Sun, 28 Jan 2018 05:13: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 C2B126C137; Sun, 28 Jan 2018 05:13: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 BBD5715397; Sun, 28 Jan 2018 05:13: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 w0S5DHZO066172; Sun, 28 Jan 2018 05:13:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S5DHxP066171; Sun, 28 Jan 2018 05:13:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801280513.w0S5DHxP066171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 28 Jan 2018 05:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328508 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 05:13:18 -0000 Author: imp Date: Sun Jan 28 05:13:17 2018 New Revision: 328508 URL: https://svnweb.freebsd.org/changeset/base/328508 Log: Add the DF_SUSPENDED flag to flags that are printed. Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Sun Jan 28 05:13:08 2018 (r328507) +++ head/sys/kern/subr_bus.c Sun Jan 28 05:13:17 2018 (r328508) @@ -5060,6 +5060,7 @@ print_device_short(device_t dev, int indent) (dev->flags&DF_WILDCARD? "wildcard,":""), (dev->flags&DF_DESCMALLOCED? "descmalloced,":""), (dev->flags&DF_REBID? "rebiddable,":""), + (dev->flags&DF_SUSPENDED? "suspended,":""), (dev->ivars? "":"no "), (dev->softc? "":"no "), dev->busy)); From owner-svn-src-all@freebsd.org Sun Jan 28 03:07:23 2018 Return-Path: Delivered-To: svn-src-all@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 88E00ED45B9; Sun, 28 Jan 2018 03:07:23 +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 3918168134; Sun, 28 Jan 2018 03:07: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 33DFE13D25; Sun, 28 Jan 2018 03:07: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 w0S37NnE002506; Sun, 28 Jan 2018 03:07:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S37Npl002505; Sun, 28 Jan 2018 03:07:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801280307.w0S37Npl002505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 28 Jan 2018 03:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328505 - head/stand/fdt X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/fdt X-SVN-Commit-Revision: 328505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 03:07:23 -0000 Author: kevans Date: Sun Jan 28 03:07:22 2018 New Revision: 328505 URL: https://svnweb.freebsd.org/changeset/base/328505 Log: stand/fdt: Check /compatible property on overlay if it exists Example overlays seen in other places use a compatible property on root node of an overlay to specify SOC compatibility. These don't get merged into base FDT as they're not part of a fragment, but it's expected that consumers of the overlay may want to check it. If /compatible on the overlay is missing, just apply it. This is the "I know what I'm doing" mode for those wanting to whip up a quick overlay and apply it. An overlay intended for distribution should include /compatible so as not to break a user's system. If /compatible on the overlay exists, honor it and cross-check it with /compatible on the base FDT. If /compatible on the base FDT is missing in this case, don't apply the overlay rather than risk breaking the system. Move the COPYOUT of overlay material to before we allocate space for next_fdtp so that we can avoid the allocation and copy into next_fdtp if we already know that the overlay can't apply. This gives way to the possibility of autoloading overlays found in /boot/overlays, since this provides a means of filtering out overlays not applicable to the current board. Reviewed by: gonzo MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D13969 Modified: head/stand/fdt/fdt_loader_cmd.c Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Sun Jan 28 01:22:15 2018 (r328504) +++ head/stand/fdt/fdt_loader_cmd.c Sun Jan 28 03:07:22 2018 (r328505) @@ -74,6 +74,7 @@ static vm_offset_t fdtp_va = 0; static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); +static int fdt_check_overlay_compatible(void *base_fdt, void *overlay_fdt); static int fdt_cmd_nyi(int argc, char *argv[]); static int fdt_load_dtb_overlays_string(const char * filenames); @@ -374,6 +375,62 @@ fdt_load_dtb_overlays_string(const char * filenames) return (0); } +/* + * fdt_check_overlay_compatible - check that the overlay_fdt is compatible with + * base_fdt before we attempt to apply it. It will need to re-calculate offsets + * in the base every time, rather than trying to cache them earlier in the + * process, because the overlay application process can/will invalidate a lot of + * offsets. + */ +static int +fdt_check_overlay_compatible(void *base_fdt, void *overlay_fdt) +{ + const char *compat; + int compat_len, ocompat_len; + int oroot_offset, root_offset; + int slidx, sllen; + + oroot_offset = fdt_path_offset(overlay_fdt, "/"); + if (oroot_offset < 0) + return (oroot_offset); + /* + * If /compatible in the overlay does not exist or if it is empty, then + * we're automatically compatible. We do this for the sake of rapid + * overlay development for overlays that aren't intended to be deployed. + * The user assumes the risk of using an overlay without /compatible. + */ + if (fdt_get_property(overlay_fdt, oroot_offset, "compatible", + &ocompat_len) == NULL || ocompat_len == 0) + return (0); + root_offset = fdt_path_offset(base_fdt, "/"); + if (root_offset < 0) + return (root_offset); + /* + * However, an empty or missing /compatible on the base is an error, + * because allowing this offers no advantages. + */ + if (fdt_get_property(base_fdt, root_offset, "compatible", + &compat_len) == NULL) + return (compat_len); + else if(compat_len == 0) + return (1); + + slidx = 0; + compat = fdt_stringlist_get(overlay_fdt, oroot_offset, "compatible", + slidx, &sllen); + while (compat != NULL) { + if (fdt_stringlist_search(base_fdt, root_offset, "compatible", + compat) >= 0) + return (0); + ++slidx; + compat = fdt_stringlist_get(overlay_fdt, oroot_offset, + "compatible", slidx, &sllen); + }; + + /* We've exhausted the overlay's /compatible property... no match */ + return (1); +} + void fdt_apply_overlays() { @@ -408,6 +465,13 @@ fdt_apply_overlays() current_fdtp = fdtp; current_fdtp_size = fdtp_size; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + COPYOUT(fp->f_addr, overlay, fp->f_size); + /* Check compatible first to avoid unnecessary allocation */ + rv = fdt_check_overlay_compatible(current_fdtp, overlay); + if (rv != 0) { + printf("DTB overlay '%s' not compatible\n", fp->f_name); + continue; + } printf("applying DTB overlay '%s'\n", fp->f_name); next_fdtp_size = current_fdtp_size + fp->f_size; next_fdtp = malloc(next_fdtp_size); @@ -425,7 +489,6 @@ fdt_apply_overlays() printf("failed to open base dtb into overlay base\n"); continue; } - COPYOUT(fp->f_addr, overlay, fp->f_size); /* Both overlay and new_fdtp may be modified in place */ rv = fdt_overlay_apply(next_fdtp, overlay); if (rv == 0) { From owner-svn-src-all@freebsd.org Sat Jan 27 21:51:25 2018 Return-Path: Delivered-To: svn-src-all@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 706A6EC4D49 for ; Sat, 27 Jan 2018 21:51:25 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 443B97B625 for ; Sat, 27 Jan 2018 21:51:24 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 2f88826c-03ac-11e8-b951-f99fef315fd9 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 outbound2.ore.mailhop.org (Halon) with ESMTPSA id 2f88826c-03ac-11e8-b951-f99fef315fd9; Sat, 27 Jan 2018 21:51:10 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w0RLpE7o003049; Sat, 27 Jan 2018 14:51:14 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1517089874.1517.5.camel@freebsd.org> Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules From: Ian Lepore To: rgrimes@freebsd.org, Emmanuel Vadot Cc: Adrian Chadd , Poul-Henning Kamp , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 27 Jan 2018 14:51:14 -0700 In-Reply-To: <201801272132.w0RLWMqi011256@pdx.rh.CN85.dnsmgr.net> References: <201801272132.w0RLWMqi011256@pdx.rh.CN85.dnsmgr.net> 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-Mailman-Approved-At: Sun, 28 Jan 2018 07:33:12 +0000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jan 2018 21:51:25 -0000 On Sat, 2018-01-27 at 13:32 -0800, Rodney W. Grimes wrote: > > > > On Sat, 27 Jan 2018 12:13:57 -0800 > > Adrian Chadd wrote: > > > > > > > > Hi, > > > > > > Find the middle ground. Don't dissuade the developer too much. > > This is what happened two years ago when I started hacking on the > > allwinner SoCs : > > > > - I asked what should be done for bringing a new board > > - andrew@ told me that we first need to switch to upstream dts and > > update drivers. > > - Guess what, I did that. > Great, thats good co-operatation and communications, sometimes though > it is not so smooth.The better we become at dealing with the not > so smooth the faster forward progress can be made. > > > > > > > > > Here's an example: > > > > > > Make the driver follow DTS, allow a tunable/kenv check for it to > > > override whether it needs to be in the DTS or not (the "keep phk happy > > > for now" compromise) and have it default to obeying the device tree. > > > > > > That way phk is kept happy and the defaults are the same as normal-ish > > > ARM /and/ you have a springboard to experiment with extending FDT > > > overlays at runtime for people who wish to do so. > > I don't care about keeping phk@ (or any other developer) happy, we > > have a standard, let's stick to it. > *sigh*Let me ask you if you do not care about keeping any other > developers happy, why should any of them be concerned about keeping > you happy?We need to always try to find middle ground and > co-operate in positive ways. > > On the "we have a standard" front, well when standards get in the way > of forward progress they are often side stepped.Maybe this standard > is not such a good standard and warts are going to form around it. I > have seen some discusssion at least on ways to improve the current > situation, hopefully someone takes them and runs with them. > > Others have pointed out they do not like the current model in that > it gets in the way of developement progress.I can see this point. > I can see phk's points, and I can see your points. > > IMHO if we shove the standard down our own throats we are in > effect cutting our hands off in the process, not somethig we > really want to do is it? > > > > > > > > > (I personally hate having to edit the dts/recompile/reboot for every > > > test hardware change; it makes breadboarding things up kinda > > > hilariously annoying.) > > Use overlays then. And if you don't want to reboot provide patch for > > loading overlays at runtime. > Are those the only solutions? Lots of nice platitudes, but the bottom line is that the commit violates the existing conventions in ways that make it the only such violator. The reason isn't "because it's the only way to make progress", the reason is "because I'm philosophically opposed to needing a reboot after making a one-time configuration change to how the hardware will be used." Hacks to move forward in the face of broken or missing functionality are something we have to live with, given how understaffed we are for correcting the deficiencies. Hacks to assuage someone's personal preferences or philosophy, IMO, should not be something we have to live with. -- Ian From owner-svn-src-all@freebsd.org Sun Jan 28 03:16:55 2018 Return-Path: Delivered-To: svn-src-all@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 40B24ED4A07; Sun, 28 Jan 2018 03:16:55 +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 DF12E68646; Sun, 28 Jan 2018 03:16:54 +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 D6F0213EF4; Sun, 28 Jan 2018 03:16:54 +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 w0S3GsBG007337; Sun, 28 Jan 2018 03:16:54 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S3Gs2s007336; Sun, 28 Jan 2018 03:16:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801280316.w0S3Gs2s007336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 28 Jan 2018 03:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328506 - head/contrib/opie/libopie X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/contrib/opie/libopie X-SVN-Commit-Revision: 328506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 03:16:55 -0000 Author: pfg Date: Sun Jan 28 03:16:54 2018 New Revision: 328506 URL: https://svnweb.freebsd.org/changeset/base/328506 Log: Revert r328492: "Fix gcc80 -Wsizeof-pointer-memaccess warning." The warning is bogus: GCC8 only looks at the size of the destination. We shouldn't be fixing imaginary problems, so perhaps its better to deal with this later on by disabling such warnings. Pointed out by: ed, bde Modified: head/contrib/opie/libopie/insecure.c Modified: head/contrib/opie/libopie/insecure.c ============================================================================== --- head/contrib/opie/libopie/insecure.c Sun Jan 28 03:07:22 2018 (r328505) +++ head/contrib/opie/libopie/insecure.c Sun Jan 28 03:16:54 2018 (r328506) @@ -135,7 +135,8 @@ int opieinsecure FUNCTION_NOARGS char host[sizeof(utmp.ut_host) + 1]; insecure = 1; - strncpy(host, utmp.ut_host, sizeof(host)); + strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); + host[sizeof(utmp.ut_host)] = 0; if (s = strchr(host, ':')) { int n = s - host; From owner-svn-src-all@freebsd.org Sat Jan 27 21:52:55 2018 Return-Path: Delivered-To: svn-src-all@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 B2A24EC4EE7; Sat, 27 Jan 2018 21:52:55 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DB4BA7BA11; Sat, 27 Jan 2018 21:52:54 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id a42fbab8; Sat, 27 Jan 2018 22:52:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=h/FQjmiLcDsEXCWzMNI4RebBzo8=; b=aT4jqE/ukNI7RETzGE9ptc+cRVhk IsGSwtwo1XRA+vJO3I7aornuR6c1JFoP+H1DCcCj5qlQkrpcVi3HwHbDD1M5CacD qCjvQqzk+Mt2XvwWq6dCC5ZQtF63EQ+8BLCeY9xzTYDTBNwORxX134Gl9HPYW+c+ T4J4L7Lyvueu4OM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=ezGHT+XlDzoF918bnBZa7C22RZSg+hpH2MH1wOE92en9XqXNnW9JrWdq XlSU1W6HxzxWHGwSg7h8qKxGBMx1nP9sk719LJHNH4EJ7zJbtJ8uwpXiP3WVBDAw InGYM1sbraGe9uIgY69gnpx6XugZGnyvIg8AdsSPFd/kymegZ8o= Received: from arcadia.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 608a6486 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sat, 27 Jan 2018 22:52:52 +0100 (CET) Date: Sat, 27 Jan 2018 22:52:51 +0100 From: Emmanuel Vadot To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , Adrian Chadd , Poul-Henning Kamp , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180127225251.5107a7a53c60bb5ca98ed55a@bidouilliste.com> In-Reply-To: <201801272132.w0RLWMqi011256@pdx.rh.CN85.dnsmgr.net> References: <20180127214840.dc033d582696ff7b51f6d7e6@bidouilliste.com> <201801272132.w0RLWMqi011256@pdx.rh.CN85.dnsmgr.net> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sun, 28 Jan 2018 07:33:28 +0000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jan 2018 21:52:56 -0000 On Sat, 27 Jan 2018 13:32:22 -0800 (PST) "Rodney W. Grimes" wrote: > > On Sat, 27 Jan 2018 12:13:57 -0800 > > Adrian Chadd wrote: > > > > > Hi, > > > > > > Find the middle ground. Don't dissuade the developer too much. > > > > This is what happened two years ago when I started hacking on the > > allwinner SoCs : > > > > - I asked what should be done for bringing a new board > > - andrew@ told me that we first need to switch to upstream dts and > > update drivers. > > - Guess what, I did that. > > Great, thats good co-operatation and communications, sometimes though > it is not so smooth. The better we become at dealing with the not > so smooth the faster forward progress can be made. > > > > Here's an example: > > > > > > Make the driver follow DTS, allow a tunable/kenv check for it to > > > override whether it needs to be in the DTS or not (the "keep phk happy > > > for now" compromise) and have it default to obeying the device tree. > > > > > > That way phk is kept happy and the defaults are the same as normal-ish > > > ARM /and/ you have a springboard to experiment with extending FDT > > > overlays at runtime for people who wish to do so. > > > > I don't care about keeping phk@ (or any other developer) happy, we > > have a standard, let's stick to it. > > *sigh* Let me ask you if you do not care about keeping any other > developers happy, why should any of them be concerned about keeping > you happy? We need to always try to find middle ground and > co-operate in positive ways. If my goal was making me happy, the Allwinner support would be very messy. The goal isn't to make me happy, the goal is to make driver standard (so developer are happy). > On the "we have a standard" front, well when standards get in the way > of forward progress they are often side stepped. Maybe this standard > is not such a good standard and warts are going to form around it. I > have seen some discusssion at least on ways to improve the current > situation, hopefully someone takes them and runs with them. Until a new standard is born we need to stick to the current one. > Others have pointed out they do not like the current model in that > it gets in the way of developement progress. I can see this point. > I can see phk's points, and I can see your points. Who are the "Others" ? > IMHO if we shove the standard down our own throats we are in > effect cutting our hands off in the process, not somethig we > really want to do is it? No. > > > (I personally hate having to edit the dts/recompile/reboot for every > > > test hardware change; it makes breadboarding things up kinda > > > hilariously annoying.) > > > > Use overlays then. And if you don't want to reboot provide patch for > > loading overlays at runtime. > > Are those the only solutions? > > > > -adrian > > Emmanuel Vadot > > -- > Rod Grimes rgrimes@freebsd.org -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Sun Jan 28 05:45:21 2018 Return-Path: Delivered-To: svn-src-all@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 61744ED9A81; Sun, 28 Jan 2018 05:45:21 +0000 (UTC) (envelope-from eadler@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 15B436CCB7; Sun, 28 Jan 2018 05:45:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 10B931589B; Sun, 28 Jan 2018 05:45:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0S5jKEB080670; Sun, 28 Jan 2018 05:45:20 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S5jKsl080669; Sun, 28 Jan 2018 05:45:20 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801280545.w0S5jKsl080669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 28 Jan 2018 05:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328509 - head/tools/tools X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/tools/tools X-SVN-Commit-Revision: 328509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 05:45:21 -0000 Author: eadler Date: Sun Jan 28 05:45:20 2018 New Revision: 328509 URL: https://svnweb.freebsd.org/changeset/base/328509 Log: tools: remove note about diffburst. Said tool was removed in 1999 in r51579 Modified: head/tools/tools/README Modified: head/tools/tools/README ============================================================================== --- head/tools/tools/README Sun Jan 28 05:13:17 2018 (r328508) +++ head/tools/tools/README Sun Jan 28 05:45:20 2018 (r328509) @@ -16,8 +16,6 @@ commitsdb A tool for reconstructing commit history usi crypto Test and exercise tools related to the crypto framework cxgbetool A tool for the cxgbe(4) driver. cxgbtool A tool for the cxgb(4) driver. -diffburst OBSOLETE: equivalent functionality is available via split -p. - For example: "split -p ^diff < patchfile". See split(1). drm Tools specific to the DRM/KMS device drivers. editing Editor modes and the like to help editing FreeBSD code. epfe Extract printing filter examples from printing.sgml. From owner-svn-src-all@freebsd.org Sun Jan 28 01:29:46 2018 Return-Path: Delivered-To: svn-src-all@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 3E3D6ED0C1D; Sun, 28 Jan 2018 01:29:46 +0000 (UTC) (envelope-from dexuan.bsd@gmail.com) Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::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 9F169846AD; Sun, 28 Jan 2018 01:29:45 +0000 (UTC) (envelope-from dexuan.bsd@gmail.com) Received: by mail-lf0-x243.google.com with SMTP id k19so5155304lfj.1; Sat, 27 Jan 2018 17:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+5JIVdQSmr9znF6qGa4gJ6RQUiItco1ZRBgAh4RC5iI=; b=duUt3ONBs/4GBb+N8Y7koKEQntIA8uQVa9SOz4wDJxbaeTl1orbhOrgR4kRt/xzstj elQqepMgb4ty//uqwhbpKMxg659ioXWsI0GXFNcByWjMKfNsLEAxU9GutbeoQ6qK8Uwl KBQBiTvoQd5MCUKn3pAs9bMPaCMusnT0BHJ4WIYuM0fu/z8Z6b4V1YZNLTcnoDZsrgnk wiCCW5dV/U3r1/tHuKi/zHRxUwI9DY3YT9UbTTqqSkwuVYV9V+eLLeXBqo9LduCUx2qW ZoJlz34ddpTjJjstUSPV3H9jiOrJlXjmm5oWP0BB/x+KwlQb3HTpziy4AwYml0vkWgcp nfqg== 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=+5JIVdQSmr9znF6qGa4gJ6RQUiItco1ZRBgAh4RC5iI=; b=lGucfHX3NnhgHkYeWEDfgZMCqUPvLGvn1FZvCE9XxwHDWDnZK4Axcnj6+m+WfP8jM/ GK4c8yqhG0jdXvKdVRtPwvPUL3eN15tWI5xukZIcds+T6EvaJDr89iQPAE3vySXPAJh4 56q7YMfQS+yj4GZhTTdB+KlfjLTAZUlLLLk+3iifWw2aLh44H7qP+Xh8rtWL7o0DjZXB azX5FP7u6B0/ArDrGvwMyS2DLkFP6y2GDJC/KyGjVUgpDAlieKL17HrtdWXukrUs/baT 936Xn3y93LJwQi0jcvay3glgD4hR15sWcKoD72qQ0lvnsDwNr9kiQVZuuoPaRvHV1+qV yGPg== X-Gm-Message-State: AKwxytdnMKTxtBZ+HpCj3HpUnrj2rAXK2MGWYVB6BOiU8M/3UQ57verf QzVZ3jIBcs3kPR269fALBYnRzUY9Y38Xu0kKHVY= X-Google-Smtp-Source: AH8x224YqCjfzJwnLCrRiTLdcgnWpbSVUfTZ4BWoYFwSgeya4D2A8wHbMUM/TeCJ1QupbBoRE0FgrtzYv/LQsPGf/T0= X-Received: by 10.25.56.77 with SMTP id d13mr11253830lfj.46.1517102984104; Sat, 27 Jan 2018 17:29:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.228.148 with HTTP; Sat, 27 Jan 2018 17:29:43 -0800 (PST) In-Reply-To: <20180127113348.GY55707@kib.kiev.ua> References: <201801191542.w0JFgY1Q070919@repo.freebsd.org> <20180127113348.GY55707@kib.kiev.ua> From: Dexuan-BSD Cui Date: Sat, 27 Jan 2018 17:29:43 -0800 Message-ID: Subject: Re: svn commit: r328166 - in head/sys: amd64/amd64 x86/include x86/x86 To: Konstantin Belousov Cc: Ed Maste , markj@freebsd.org, cem@freebsd.org, Mitchell Horne , gordon@freebsd.org, pho@freebsd.org, jeff@freebsd.org, jhb@freebsd.org, nullius@nym.zone, decui@microsoft.com, sephe@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Sun, 28 Jan 2018 12:36:36 +0000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 01:29:46 -0000 On Sat, Jan 27, 2018 at 3:33 AM, Konstantin Belousov wrote: > > On Sat, Jan 27, 2018 at 12:56:47AM -0800, Dexuan-BSD Cui wrote: > > Hi, > > Today I found the KPTI patch broke FreeBSD VM running on Hyper-V: the VM > > can't boot due to: > > > > vmbus0: cannot find free IDT vector > > > > Try r328468. Hi kib, It fixes the issue. Thanks for the quick help! -- Dexuan From owner-svn-src-all@freebsd.org Sun Jan 28 15:33:33 2018 Return-Path: Delivered-To: svn-src-all@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 99D88ECD301; Sun, 28 Jan 2018 15:33:33 +0000 (UTC) (envelope-from mmel@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 481DB82144; Sun, 28 Jan 2018 15:33:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4224E1B87E; Sun, 28 Jan 2018 15:33:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0SFXXr4076910; Sun, 28 Jan 2018 15:33:33 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SFXX1u076909; Sun, 28 Jan 2018 15:33:33 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801281533.w0SFXX1u076909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 28 Jan 2018 15:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328512 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 328512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 15:33:33 -0000 Author: mmel Date: Sun Jan 28 15:33:32 2018 New Revision: 328512 URL: https://svnweb.freebsd.org/changeset/base/328512 Log: Remove #endif forgotten in r328510. Pointy hat: mmel Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jan 28 15:20:45 2018 (r328511) +++ head/sys/arm64/arm64/pmap.c Sun Jan 28 15:33:32 2018 (r328512) @@ -3070,7 +3070,6 @@ validate: "pmap %p va 0x%#lx pte 0x%lx", __func__, pmap, va, new_l3); } -#endif } else { /* New mappig */ pmap_load_store(l3, new_l3); From owner-svn-src-all@freebsd.org Sun Jan 28 15:20:46 2018 Return-Path: Delivered-To: svn-src-all@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 15046ECC436; Sun, 28 Jan 2018 15:20:46 +0000 (UTC) (envelope-from mmel@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 BF6D681291; Sun, 28 Jan 2018 15:20:45 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 BA76A1B56D; Sun, 28 Jan 2018 15:20:45 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0SFKjMe067447; Sun, 28 Jan 2018 15:20:45 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SFKjQe067446; Sun, 28 Jan 2018 15:20:45 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801281520.w0SFKjQe067446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 28 Jan 2018 15:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328511 - head/sys/dev/extres/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/extres/clk X-SVN-Commit-Revision: 328511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 15:20:46 -0000 Author: mmel Date: Sun Jan 28 15:20:45 2018 New Revision: 328511 URL: https://svnweb.freebsd.org/changeset/base/328511 Log: diff --git a/sys/dev/extres/clk/clk.c b/sys/dev/extres/clk/clk.c index c6a1f466ceb..c3708a0ce27 100644 --- a/sys/dev/extres/clk/clk.c +++ b/sys/dev/extres/clk/clk.c @@ -642,10 +642,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx) if (clknode->parent_cnt == 0) return; if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) - panic("Invalid clock parent index\n"); + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); if (clknode->parents[idx] == NULL) - panic("%s: Attempt to set invalid parent %d for clock %s", + panic("%s: Invalid parent index %d for clock %s", __func__, idx, clknode->name); /* Remove me from old children list. */ @@ -674,8 +675,8 @@ clknode_init_parent_idx(struct clknode *clknode, int idx) if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt) || (clknode->parent_names[idx] == NULL)) - panic("%s: Invalid clock parent index: %d\n", __func__, idx); - + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); clknode->parent_idx = idx; } Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Sun Jan 28 15:02:49 2018 (r328510) +++ head/sys/dev/extres/clk/clk.c Sun Jan 28 15:20:45 2018 (r328511) @@ -642,10 +642,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx if (clknode->parent_cnt == 0) return; if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) - panic("Invalid clock parent index\n"); + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); if (clknode->parents[idx] == NULL) - panic("%s: Attempt to set invalid parent %d for clock %s", + panic("%s: Invalid parent index %d for clock %s", __func__, idx, clknode->name); /* Remove me from old children list. */ @@ -674,8 +675,8 @@ clknode_init_parent_idx(struct clknode *clknode, int i if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt) || (clknode->parent_names[idx] == NULL)) - panic("%s: Invalid clock parent index: %d\n", __func__, idx); - + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); clknode->parent_idx = idx; } From owner-svn-src-all@freebsd.org Sun Jan 28 15:02:50 2018 Return-Path: Delivered-To: svn-src-all@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 33DC8ECB2FB; Sun, 28 Jan 2018 15:02:50 +0000 (UTC) (envelope-from mmel@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 DDAF680534; Sun, 28 Jan 2018 15:02:49 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 D8AD01B3C1; Sun, 28 Jan 2018 15:02:49 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0SF2ncL062150; Sun, 28 Jan 2018 15:02:49 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SF2n0M062148; Sun, 28 Jan 2018 15:02:49 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801281502.w0SF2n0M062148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 28 Jan 2018 15:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328510 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 328510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 15:02:50 -0000 Author: mmel Date: Sun Jan 28 15:02:49 2018 New Revision: 328510 URL: https://svnweb.freebsd.org/changeset/base/328510 Log: Fix handling of I-cache sync operations - pmap_enter_object() can be used for mapping of executable pages, so it's necessary to handle I-cache synchronization within it. - Fix race in I-cache synchronization in pmap_enter(). The current code firstly maps given page to target VA and then do I-cache sync on it. This causes race, because this mapping become visible to other threads, before I-cache is synced. Do sync I-cache firstly (by using DMAP VA) and then map it to target VA. - ARM64 ARM permits implementation of aliased (AIVIVT, VIPT) I-cache, but we can use different that final VA for flushing it. So we should use full I-cache flush on affected platforms. For now, and as temporary solution, use full flush always. Modified: head/sys/arm64/arm64/cpufunc_asm.S head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/cpufunc_asm.S ============================================================================== --- head/sys/arm64/arm64/cpufunc_asm.S Sun Jan 28 05:45:20 2018 (r328509) +++ head/sys/arm64/arm64/cpufunc_asm.S Sun Jan 28 15:02:49 2018 (r328510) @@ -138,5 +138,12 @@ END(arm64_idcache_wbinv_range) * void arm64_icache_sync_range(vm_offset_t, vm_size_t) */ ENTRY(arm64_icache_sync_range) - cache_handle_range dcop = cvau, ic = 1, icop = ivau + /* + * XXX Temporary solution - I-cache flush should be range based for + * PIPT cache or IALLUIS for VIVT or VIPT caches + */ +/* cache_handle_range dcop = cvau, ic = 1, icop = ivau */ + cache_handle_range dcop = cvau + ic ialluis + dsb ish END(arm64_icache_sync_range) Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jan 28 05:45:20 2018 (r328509) +++ head/sys/arm64/arm64/pmap.c Sun Jan 28 15:02:49 2018 (r328510) @@ -2878,8 +2878,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v ("pmap_enter: Invalid page entry, va: 0x%lx", va)); KASSERT(lvl == 2, ("pmap_enter: Invalid level %d", lvl)); - - l3 = pmap_l2_to_l3(pde, va); } else { /* * If we get a level 2 pde it must point to a level 3 entry @@ -2923,6 +2921,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v case 1: /* Get the l2 pde to update */ pde = pmap_l1_to_l2(pde, va); + KASSERT(pde != NULL, ("...")); l3_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | @@ -2937,9 +2936,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v break; } } - l3 = pmap_l2_to_l3(pde, va); - pmap_invalidate_page(pmap, va); } + l3 = pmap_l2_to_l3(pde, va); havel3: om = NULL; @@ -3011,15 +3009,29 @@ havel3: vm_page_aflag_set(m, PGA_WRITEABLE); } - /* - * Update the L3 entry. - */ - if (orig_l3 != 0) { validate: - orig_l3 = pmap_load(l3); - opa = orig_l3 & ~ATTR_MASK; + /* + * Sync icache if exec permission and attribute VM_MEMATTR_WRITE_BACK + * is set. Do it now, before the mapping is stored and made + * valid for hardware table walk. If done later, then other can + * access this page before caches are properly synced. + * Don't do it for kernel memory which is mapped with exec + * permission even if the memory isn't going to hold executable + * code. The only time when icache sync is needed is after + * kernel module is loaded and the relocation info is processed. + * And it's done in elf_cpu_load_file(). + */ + if ((prot & VM_PROT_EXECUTE) && pmap != kernel_pmap && + m->md.pv_memattr == VM_MEMATTR_WRITE_BACK && + (opa != pa || (orig_l3 & ATTR_XN))) + cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); + /* + * 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); @@ -3035,24 +3047,35 @@ validate: TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) vm_page_aflag_clear(om, PGA_WRITEABLE); } - } else { + } else if ((orig_l3 & ~ATTR_AF) != (new_l3 & ~ATTR_AF)) { + /* same PA, different attributes */ pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); if (pmap_page_dirty(orig_l3) && (orig_l3 & ATTR_SW_MANAGED) != 0) vm_page_dirty(m); + } else { + /* + * orig_l3 == new_l3 + * This can happens if multiple threads simultaneously + * access not yet mapped page. This bad for performance + * since this can cause full demotion-NOP-promotion + * cycle. + * Another possible reasons are: + * - VM and pmap memory layout are diverged + * - tlb flush is missing somewhere and CPU doesn't see + * actual mapping. + */ + CTR4(KTR_PMAP, "%s: already mapped page - " + "pmap %p va 0x%#lx pte 0x%lx", + __func__, pmap, va, new_l3); } +#endif } else { + /* New mappig */ pmap_load_store(l3, new_l3); } - pmap_invalidate_page(pmap, va); - - if (pmap != pmap_kernel()) { - if (pmap == &curproc->p_vmspace->vm_pmap && - (prot & VM_PROT_EXECUTE) != 0) - cpu_icache_sync_range(va, PAGE_SIZE); - #if VM_NRESERVLEVEL > 0 if ((mpte == NULL || mpte->wire_count == NL3PG) && pmap_superpages_enabled() && @@ -3061,7 +3084,6 @@ validate: pmap_promote_l2(pmap, pde, va, &lock); } #endif - } if (lock != NULL) rw_wunlock(lock); @@ -3135,7 +3157,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v { struct spglist free; pd_entry_t *pde; - pt_entry_t *l2, *l3; + pt_entry_t *l2, *l3, l3_val; vm_paddr_t pa; int lvl; @@ -3232,19 +3254,26 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v */ pmap_resident_count_inc(pmap, 1); - pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_IDX(m->md.pv_memattr) | + pa = VM_PAGE_TO_PHYS(m); + l3_val = pa | ATTR_DEFAULT | ATTR_IDX(m->md.pv_memattr) | ATTR_AP(ATTR_AP_RO) | L3_PAGE; if ((prot & VM_PROT_EXECUTE) == 0 || m->md.pv_memattr == DEVICE_MEMORY) - pa |= ATTR_XN; + l3_val |= ATTR_XN; else if (va < VM_MAXUSER_ADDRESS) - pa |= ATTR_PXN; + l3_val |= ATTR_PXN; /* * Now validate mapping with RO protection */ if ((m->oflags & VPO_UNMANAGED) == 0) - pa |= ATTR_SW_MANAGED; - pmap_load_store(l3, pa); + l3_val |= ATTR_SW_MANAGED; + + /* Sync icache before the mapping is stored to PTE */ + if ((prot & VM_PROT_EXECUTE) && pmap != kernel_pmap && + m->md.pv_memattr == VM_MEMATTR_WRITE_BACK) + cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); + + pmap_load_store(l3, l3_val); pmap_invalidate_page(pmap, va); return (mpte); } From owner-svn-src-all@freebsd.org Sun Jan 28 16:10:41 2018 Return-Path: Delivered-To: svn-src-all@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 9D256ECFE76; Sun, 28 Jan 2018 16:10:41 +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 49FD483CC7; Sun, 28 Jan 2018 16:10:41 +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 44E721BD7E; Sun, 28 Jan 2018 16:10:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0SGAf3Q092662; Sun, 28 Jan 2018 16:10:41 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SGAfTd092661; Sun, 28 Jan 2018 16:10:41 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801281610.w0SGAfTd092661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 28 Jan 2018 16:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328513 - head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Commit-Revision: 328513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 16:10:41 -0000 Author: dim Date: Sun Jan 28 16:10:40 2018 New Revision: 328513 URL: https://svnweb.freebsd.org/changeset/base/328513 Log: Pull in r322245 from upstream clang trunk (by Craig Topper): [X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it does in the backend. Similarly, make -mno-fma and -mno-f16c imply -mno-avx512f. Withou this "-mno-sse -mavx512f" ends up with avx512f being enabled in the frontend but disabled in the backend. Reported by: pawel PR: 225488 Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp Sun Jan 28 15:33:32 2018 (r328512) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp Sun Jan 28 16:10:40 2018 (r328513) @@ -409,7 +409,7 @@ void X86TargetInfo::setSSELevel(llvm::StringMap if (Enabled) { switch (Level) { case AVX512F: - Features["avx512f"] = true; + Features["avx512f"] = Features["fma"] = Features["f16c"] = true; LLVM_FALLTHROUGH; case AVX2: Features["avx2"] = true; @@ -623,6 +623,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::String } else if (Name == "fma") { if (Enabled) setSSELevel(Features, AVX, Enabled); + else + setSSELevel(Features, AVX512F, Enabled); } else if (Name == "fma4") { setXOPLevel(Features, FMA4, Enabled); } else if (Name == "xop") { @@ -632,6 +634,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::String } else if (Name == "f16c") { if (Enabled) setSSELevel(Features, AVX, Enabled); + else + setSSELevel(Features, AVX512F, Enabled); } else if (Name == "sha") { if (Enabled) setSSELevel(Features, SSE2, Enabled); From owner-svn-src-all@freebsd.org Sun Jan 28 16:51:16 2018 Return-Path: Delivered-To: svn-src-all@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 5EE13ED2214; Sun, 28 Jan 2018 16:51:16 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id C23648570A; Sun, 28 Jan 2018 16:51:15 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.15.2/8.15.2) with ESMTP id w0SGMupF055172; Sun, 28 Jan 2018 10:22:56 -0600 (CST) (envelope-from mike@karels.net) Message-Id: <201801281622.w0SGMupF055172@mail.karels.net> To: Conrad Meyer cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Mike Karels Reply-to: mike@karels.net Subject: ps output line length (was: svn commit: r314685 - head/bin/ps) In-reply-to: Your message of Sat, 04 Mar 2017 22:38:10 +0000. <201703042238.v24McAD8008837@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <55170.1517156576.1@mail.karels.net> Content-Transfer-Encoding: quoted-printable Date: Sun, 28 Jan 2018 10:22:56 -0600 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 16:51:16 -0000 Recently, I was investigating an issue with top on -current while doing a "make buildworld", and ran "ps axu|more" for comparison. To my surprise= , I got only a few very long lines of output, containing full command lines for compiler runs. This quickly led me to the following commit, which I unfortunately missed at the time, along with the following discussion: > Author: cem > Date: Sat Mar 4 22:38:10 2017 > New Revision: 314685 > URL: https://svnweb.freebsd.org/changeset/base/314685 > Log: > ps(1): Only detect terminal width if stdout is a tty > = > If stdout isn't a tty, use unlimited width output rather than truncati= ng to > 79 characters. This is helpful for shell scripts or e.g., 'ps | grep = foo'. > = > This hardcoded width has some history: In The Beginning of History[0],= the > width of ps was hardcoded as 80 bytes. In 1985, Bloom@ added detectio= n > using TIOCGWINSZ on stdin.[1] In 1986, Kirk merged a change to check > stdout's window size instead. In 1990, the fallback checks to stderr = and > stdin's TIOCGWINSZ were added by Marc@, with the commit message "new > version."[2] > = > OS X Darwin has a very similar modification to ps(1), which simply set= s > UNLIMITED for all non-tty outputs.[3] I've chosen to respect COLUMNS > instead of behaving identically to Darwin here, but I don't feel stron= gly > about that. We could match OS X for parity if that is desired. > = > [0]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?annotate=3D1065 > [1]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=3D18105&r2=3D18106 > [2]: > https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=3D40675&r2=3D40674&path= rev=3D40675 > [3]: > https://opensource.apple.com/source/adv_cmds/adv_cmds-168/ps/ps.c.auto= .html > = > PR: 217159 > Reported by: Deepak Nagaraj > Modified: > head/bin/ps/ps.c > Modified: head/bin/ps/ps.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/bin/ps/ps.c Sat Mar 4 22:23:59 2017 (r314684) > +++ head/bin/ps/ps.c Sat Mar 4 22:38:10 2017 (r314685) > @@ -194,6 +194,8 @@ main(int argc, char *argv[]) > = > if ((cols =3D getenv("COLUMNS")) !=3D NULL && *cols !=3D '\0') > termwidth =3D atoi(cols); > + else if (!isatty(STDOUT_FILENO)) > + termwidth =3D UNLIMITED; > else if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) =3D=3D -1 && > ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) =3D=3D -1 && > ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) =3D=3D -1) || There were several following messages discussing this change, most notably one by Bruce Evans (https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3D55022+0+archive/2017/svn-= src-head/20170312.svn-src-head). I agree with his rational, and disagree with the change. It seems to me that the consensus was that the change was incorrect, although that might just be my opinion. However, I really think that the change needs to be reverted. The rationale for the original code was that, for interactive uses, the output line length should be the same for "ps ...", "ps ...|more", and "ps ... |grep". The -w option exists to make the line longer; there is no option to use the terminal size even if the output is redirected. Hence, the tests for stderr or stdin being a tty. This behavior has been in place since 1990, as noted, and no substantial rationale has been given for changing it other than "it doesn't matter if you use less with side-to-side scrolling." fwiw, I'm sure I discussed that code with Marc at the time. As was stated, scripts that want to use the full line should use -ww. Interactive users have long been used to using -w when they need longer output lines, e.g. to match patterns that don't occur within a screen's width. I propose reverting this change. = Mike From owner-svn-src-all@freebsd.org Sun Jan 28 17:25:50 2018 Return-Path: Delivered-To: svn-src-all@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 E4608ED3D75 for ; Sun, 28 Jan 2018 17:25:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (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 6570A86873 for ; Sun, 28 Jan 2018 17:25:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x234.google.com with SMTP id c16so5653508itc.5 for ; Sun, 28 Jan 2018 09:25:49 -0800 (PST) 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=TEwx8lRNXCvYsIMNgS6MKDCyZ6rYNB9T/XLMguMK4eY=; b=XedTGo80jkYGIb3oAHke9QidE7ZZKX8WB4U62VfimxzFdoslhA6o6E7JAHRoJeX29j h564ysXFocrikk9vGLMAg6IMQpgA6b5Iz02k9zmahyi6mqbIBIC65CQVdd+ChC7rZdoc kt4wJImkx4yjhjNg1Zx/K8Q+kfsyW1JPNxC3SyaDgeqYmOMYHeGS6pQpWCeQlJ1zwk6j vDrqT6NsFULbrjE4Bp9eCmi6Rz7XxrTJx/rD1+OF6yA7ZtHb0Mcfmy+D836OTRb44Wzl U1goIBJxmiP/6Xwo32xQt6m8D/1k8tunYDHVZChrZsV2jo0RuruHgaAACN7s+EoCrmCZ aVnA== 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=TEwx8lRNXCvYsIMNgS6MKDCyZ6rYNB9T/XLMguMK4eY=; b=K4o3s0AaVHyBYH53mOvVw2fXOb0hN8eiBhPMy55/SjL9o20eF6Vb72WzX7JUQ/9Wuq 8ZqQ46c6WMeHirHiyE0kHvopEKAOIBSwB0OmW09/e2WUg7D01ykcX0woANzsro6DazdI C3BMotd7ucTTMl55zhKnKSZLWDikG9GJNPWPaTdpCwMUy/1doTAsnWpRCeGwDLPiRt2P t74qTW/SXYgSr7RawcywX7DyFnk8afGIAXt/lgjy9bBfeEIyQlFpcwQiVQ+WMXVxsLra zLtCSmxO5Bz4Qpdg0akCdE9gsZ/35RzIwqxS/3sCVoSfiQGcF8OqoLyv6uf1uGZJr40v jaig== X-Gm-Message-State: AKwxytc+rEwdb+VdhcvnIemcrn/48bq99V2SCJZUj+VD/Xe12OZUzvvL lobcJPDjZuho/eJrafPY7ltfADeaMNxxUpu7ki9+/A== X-Google-Smtp-Source: AH8x225ULEzwa+2xxcXjM3Xvbx3zvxI++boPD9Fg8+Kodm9fS/cLpSPTpmGJYNo3rZR3DA0d3LIoJiHqPZnsowxbSrE= X-Received: by 10.36.146.196 with SMTP id l187mr25102316itd.115.1517160348597; Sun, 28 Jan 2018 09:25:48 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sun, 28 Jan 2018 09:25:47 -0800 (PST) X-Originating-IP: [2607:fb90:6ec9:766c:fdd8:b127:f55c:b56a] Received: by 10.79.201.67 with HTTP; Sun, 28 Jan 2018 09:25:47 -0800 (PST) In-Reply-To: <201801281622.w0SGMupF055172@mail.karels.net> References: <201703042238.v24McAD8008837@repo.freebsd.org> <201801281622.w0SGMupF055172@mail.karels.net> From: Warner Losh Date: Sun, 28 Jan 2018 10:25:47 -0700 X-Google-Sender-Auth: yz80A7AinFKxBpTHpN63lrYDBfA Message-ID: Subject: Re: ps output line length (was: svn commit: r314685 - head/bin/ps) To: Mike Karels Cc: "Conrad E. Meyer" , 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.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 17:25:50 -0000 On Jan 28, 2018 9:51 AM, "Mike Karels" wrote: Recently, I was investigating an issue with top on -current while doing a "make buildworld", and ran "ps axu|more" for comparison. To my surprise, I got only a few very long lines of output, containing full command lines for compiler runs. This quickly led me to the following commit, which I unfortunately missed at the time, along with the following discussion: > Author: cem > Date: Sat Mar 4 22:38:10 2017 > New Revision: 314685 > URL: https://svnweb.freebsd.org/changeset/base/314685 > Log: > ps(1): Only detect terminal width if stdout is a tty > > If stdout isn't a tty, use unlimited width output rather than truncating to > 79 characters. This is helpful for shell scripts or e.g., 'ps | grep foo'. > > This hardcoded width has some history: In The Beginning of History[0], the > width of ps was hardcoded as 80 bytes. In 1985, Bloom@ added detection > using TIOCGWINSZ on stdin.[1] In 1986, Kirk merged a change to check > stdout's window size instead. In 1990, the fallback checks to stderr and > stdin's TIOCGWINSZ were added by Marc@, with the commit message "new > version."[2] > > OS X Darwin has a very similar modification to ps(1), which simply sets > UNLIMITED for all non-tty outputs.[3] I've chosen to respect COLUMNS > instead of behaving identically to Darwin here, but I don't feel strongly > about that. We could match OS X for parity if that is desired. > > [0]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?annotate=1065 > [1]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=18105&r2=18106 > [2]: > https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=40675&r2= 40674&pathrev=40675 > [3]: > https://opensource.apple.com/source/adv_cmds/adv_cmds-168/ ps/ps.c.auto.html > > PR: 217159 > Reported by: Deepak Nagaraj > Modified: > head/bin/ps/ps.c > Modified: head/bin/ps/ps.c > ============================================================ ================== > --- head/bin/ps/ps.c Sat Mar 4 22:23:59 2017 (r314684) > +++ head/bin/ps/ps.c Sat Mar 4 22:38:10 2017 (r314685) > @@ -194,6 +194,8 @@ main(int argc, char *argv[]) > > if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0') > termwidth = atoi(cols); > + else if (!isatty(STDOUT_FILENO)) > + termwidth = UNLIMITED; > else if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && > ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && > ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) == -1) || There were several following messages discussing this change, most notably one by Bruce Evans (https://docs.freebsd.org/cgi/getmsg.cgi?fetch=55022+0+ archive/2017/svn-src-head/20170312.svn-src-head). I agree with his rational, and disagree with the change. It seems to me that the consensus was that the change was incorrect, although that might just be my opinion. However, I really think that the change needs to be reverted. The rationale for the original code was that, for interactive uses, the output line length should be the same for "ps ...", "ps ...|more", and "ps ... |grep". The -w option exists to make the line longer; there is no option to use the terminal size even if the output is redirected. Hence, the tests for stderr or stdin being a tty. This behavior has been in place since 1990, as noted, and no substantial rationale has been given for changing it other than "it doesn't matter if you use less with side-to-side scrolling." fwiw, I'm sure I discussed that code with Marc at the time. As was stated, scripts that want to use the full line should use -ww. Interactive users have long been used to using -w when they need longer output lines, e.g. to match patterns that don't occur within a screen's width. I propose reverting this change. I tend to agree, but auxww is hard coded into my fingers. Warner From owner-svn-src-all@freebsd.org Sun Jan 28 18:18:04 2018 Return-Path: Delivered-To: svn-src-all@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 1D858ED6C3A; Sun, 28 Jan 2018 18:18:04 +0000 (UTC) (envelope-from mav@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 C5DEB686B9; Sun, 28 Jan 2018 18:18:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCB721D239; Sun, 28 Jan 2018 18:18:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0SII3h3056681; Sun, 28 Jan 2018 18:18:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SII3fH056680; Sun, 28 Jan 2018 18:18:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801281818.w0SII3fH056680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 28 Jan 2018 18:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328514 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 328514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 18:18:04 -0000 Author: mav Date: Sun Jan 28 18:18:03 2018 New Revision: 328514 URL: https://svnweb.freebsd.org/changeset/base/328514 Log: Assume Always Running APIC Timer for AMD CPU families >= 0x12. Fallback to HPET may cause locks congestions on many-core systems. This change replicates Linux behavior. MFC after: 1 month Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Sun Jan 28 16:10:40 2018 (r328513) +++ head/sys/x86/x86/local_apic.c Sun Jan 28 18:18:03 2018 (r328514) @@ -526,6 +526,9 @@ native_lapic_init(vm_paddr_t addr) do_cpuid(0x06, regs); if ((regs[0] & CPUTPM1_ARAT) != 0) arat = 1; + } else if (cpu_vendor_id == CPU_VENDOR_AMD && + CPUID_TO_FAMILY(cpu_id) >= 0x12) { + arat = 1; } bzero(&lapic_et, sizeof(lapic_et)); lapic_et.et_name = "LAPIC"; From owner-svn-src-all@freebsd.org Sun Jan 28 18:35:02 2018 Return-Path: Delivered-To: svn-src-all@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 D64DDED8024; Sun, 28 Jan 2018 18:35:01 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E40EF69398; Sun, 28 Jan 2018 18:35:00 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 5487b4c9; Sun, 28 Jan 2018 18:34:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h= mime-version:content-type:content-transfer-encoding:date:from:to :cc:subject:in-reply-to:references:message-id; s=mail; bh=QjuWIT NZ4WqRyDj31+V9ALoeHvM=; b=IssP0+mC9W73RPoIOuOM7jKH2sKq+fq1lXDhX8 RgtNQ2pA9342DwoPGdBcqbAH4TcPHpNs1FWGUBsG6lDOvGjUppBPW9yN1knpetdn y5SucITtE+jWfzS0RV3dOq3UAWf1EEgUaG/6ochO+tEd9L0OrkChTuafNCAml4Hc 0gMqU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h= mime-version:content-type:content-transfer-encoding:date:from:to :cc:subject:in-reply-to:references:message-id; q=dns; s=mail; b= Ra23rHBRhFKoCRP3ygDtkSZT/zKXcdEnl9NXjYZkixK1Wyc8YCjH9tYzpO1o7A4w wxT/eo76EVvrwnsOb7VaZGZ5JoRbXAH3TWr6dUN+62k6AdQ1sU815qiuXNDw6Ax0 Sb9t94uHSHKafWuj18pO9i1MScNgqhla9f5chLjBk28= Received: from webmail.megadrive.org (www1.blih.net [212.83.177.180]) by mail.blih.net (OpenSMTPD) with ESMTP id 65c42984; Sun, 28 Jan 2018 18:34:59 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 28 Jan 2018 18:34:59 +0100 From: Emmanuel Vadot To: Poul-Henning Kamp Cc: Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Organization: Bidouilliste In-Reply-To: <72042.1517094867@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> Message-ID: <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> X-Sender: manu@bidouilliste.com User-Agent: Roundcube Webmail/1.1.1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 18:35:02 -0000 On 2018-01-28 00:14, Poul-Henning Kamp wrote: > -------- > In message <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com>, > Emmanuel Vadot writes: > >> - We have a commiter that commited something for his own need: he >> wanted to use the pwm on his rpi, coded a driver (this part is good) >> but feel that the standard we were using was crap and commited his >> work >> without talking with arm developper on what the proper way to do it >> was. > > First, as a general rule, I think you should leave it to me to > express what I think and feel, because you truly suck at it. Noted. > FDT may or may not be the right technology to use, I take no position > on that, because I am not the one doing all the work to implement > it, and I certainly don't propose to do the work to come up with > an alternative. > >> - Now we have a crappy driver in the tree. > > 1. Hardly our first Not a good reason > 2. "Crappy driver" is not pass/fail, we grade that on a curve. > > 3. You confuse "I don't like" with "crappy" On that case no. >> - We still have this driver that doesn't follow the standard we said >> we >> want to adhere to. > > And part of that decision, clearly explained for all who participated > in making it, was that we should time-warp back to FreeBSD 1.X where > hardware changes always required a reboot ? > > Right, I didn't think so... Sometimes it makes sense to reboot. > Maybe we *also* need to make some decisions about *how* we want > this FDT stuff to work for us in practice? > > My summary of the situation: > > Everybody I have communicated with over the last couple of months > have given me clear indication that nothing significant will happen > on the RPi platform, which people see as inferior and not worth > the/any effort. Mostly true yes. > I don't entirely agree about that, I think RPi is a platform we > as project ignore at our peril, so I have started to do a little > bit of an effort, as I find time and information for it. And we all thank you for that. > You keep yelling at me for not adhering to an entirely undocumented > design vision, which we don't even have a single compliant reference > platform for yet. Reference platform doesn't make much sense in the embedded world. Even if you take the JUNO hardware (ARMv8 reference design, which I think we support to some extent), we don't support the GPIO/Pinmuxing I think and even if we do it's different than the controller on RPI (Or any other SoC). Well more like same-same but different stuff. If you want a reference platform take the Allwinner code or IMX (I sometime look at the IMX code to check stuff because I know ian@ knows his stuff). > The stuff (clock manager, pin manager, runtime overlays) you are > upset about me not using, does not exist on the RPi platform in > FreeBSD at this point in time, which is why I don't use them. I'm not upset at you for not using, I'm "upset" at you for not wanting to make the effort to implement them. Some are hard, some are easy. > There is no documentation anywhere to be found, how to implement > these hypothetical pieces of code, which is why I don't implement > them. Yes and as I already say we all know that arm documentation sucks but it didn't prevent any of the other developer to implement stuff on other SoCs. > I am quite tempted to quote Gen. Patton on you and say "Lead me, > Follow me, or get out of my way", but that would be a bit too rude. > > Instead I will repeat what I have already said to you several times: > > The moment the correct infrastructure appears on the RPi platform, > if it ever does, I will change my driver to use that infrastructure. This is where I (and probably) other don't agree, this is backward. We must implement first proper pinctrl driver and clock management instead of introduce hacks. > Until then, you are wasting everybodys time pointing accusingly > into your book of unwritten rules. > > Poul-Henning What's funny though is that even with a pinctrl and clock management, we still don't have what is necessary to implement what you want (kldloading a driver and directly use pwm). For that we need overlays at runtime, pinmuxing at runtime and probably other things too. I think we are both adults (not sure for me or if I want to be one but let's pretend that I am), so let me ask you one more time to backout your commit and let's work together to extend arm support toward what you want to do. Thanks, -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Sun Jan 28 18:38:18 2018 Return-Path: Delivered-To: svn-src-all@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 30D4CED8453; Sun, 28 Jan 2018 18:38:18 +0000 (UTC) (envelope-from cognet@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 D1B7A696BD; Sun, 28 Jan 2018 18:38:17 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC3E31D5C1; Sun, 28 Jan 2018 18:38:17 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0SIcHdG066253; Sun, 28 Jan 2018 18:38:17 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SIcHIn066244; Sun, 28 Jan 2018 18:38:17 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201801281838.w0SIcHIn066244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sun, 28 Jan 2018 18:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328515 - in stable/11/sys: conf contrib/ck contrib/ck/include contrib/ck/include/gcc contrib/ck/include/gcc/aarch64 contrib/ck/include/gcc/arm contrib/ck/include/gcc/ppc64 contrib/ck/i... X-SVN-Group: stable-11 X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: in stable/11/sys: conf contrib/ck contrib/ck/include contrib/ck/include/gcc contrib/ck/include/gcc/aarch64 contrib/ck/include/gcc/arm contrib/ck/include/gcc/ppc64 contrib/ck/include/gcc/x86_64 contrib... X-SVN-Commit-Revision: 328515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 18:38:18 -0000 Author: cognet Date: Sun Jan 28 18:38:17 2018 New Revision: 328515 URL: https://svnweb.freebsd.org/changeset/base/328515 Log: MFC revisions r309268, r309260, r309264, r309266, r309267, r309270, r310846, r314435, r314564, r316665, r316691, r316702. Those import ConcurrencyKit in the FreeBSD kernel. A few people have showed interest in this being MFC'd, so here we go. Added: stable/11/sys/contrib/ck/ - copied from r309266, head/sys/contrib/ck/ stable/11/sys/contrib/ck/FREEBSD-Xlist - copied, changed from r309270, head/sys/contrib/ck/FREEBSD-Xlist stable/11/sys/contrib/ck/include/ck_md.h - copied, changed from r309267, head/sys/contrib/ck/include/ck_md.h stable/11/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h - copied unchanged from r310846, head/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h stable/11/sys/contrib/ck/include/gcc/aarch64/ck_pr_lse.h - copied unchanged from r310846, head/sys/contrib/ck/include/gcc/aarch64/ck_pr_lse.h stable/11/sys/contrib/ck/include/gcc/arm/ck_pr_armv4.h - copied unchanged from r309267, head/sys/contrib/ck/include/gcc/arm/ck_pr_armv4.h Deleted: stable/11/sys/contrib/ck/src/Makefile.in Modified: stable/11/sys/conf/files stable/11/sys/contrib/ck/include/ck_epoch.h stable/11/sys/contrib/ck/include/ck_pr.h stable/11/sys/contrib/ck/include/gcc/aarch64/ck_pr.h stable/11/sys/contrib/ck/include/gcc/arm/ck_pr.h stable/11/sys/contrib/ck/include/gcc/ck_pr.h stable/11/sys/contrib/ck/include/gcc/ppc64/ck_pr.h stable/11/sys/contrib/ck/include/gcc/x86_64/ck_pr.h stable/11/sys/contrib/ck/src/ck_epoch.c stable/11/sys/mips/mips/stdatomic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sun Jan 28 18:18:03 2018 (r328514) +++ stable/11/sys/conf/files Sun Jan 28 18:38:17 2018 (r328515) @@ -338,6 +338,17 @@ compat/freebsd32/freebsd32_ioctl.c optional compat_fre compat/freebsd32/freebsd32_misc.c optional compat_freebsd32 compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32 compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32 +contrib/ck/src/ck_array.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_barrier_centralized.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_barrier_combining.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_barrier_dissemination.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_barrier_mcs.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_barrier_tournament.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_epoch.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_hp.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_hs.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_ht.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" +contrib/ck/src/ck_rhs.c standard compile-with "${NORMAL_C} -I$S/contrib/ck/include" contrib/dev/acpica/common/ahids.c optional acpi acpi_debug contrib/dev/acpica/common/ahuuids.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbcmds.c optional acpi acpi_debug Copied and modified: stable/11/sys/contrib/ck/FREEBSD-Xlist (from r309270, head/sys/contrib/ck/FREEBSD-Xlist) ============================================================================== --- head/sys/contrib/ck/FREEBSD-Xlist Mon Nov 28 21:16:03 2016 (r309270, copy source) +++ stable/11/sys/contrib/ck/FREEBSD-Xlist Sun Jan 28 18:38:17 2018 (r328515) @@ -8,3 +8,4 @@ */regressions */tools */include/ck_md.h.in +*/src/Makefile.in Modified: stable/11/sys/contrib/ck/include/ck_epoch.h ============================================================================== --- head/sys/contrib/ck/include/ck_epoch.h Mon Nov 28 20:27:58 2016 (r309266) +++ stable/11/sys/contrib/ck/include/ck_epoch.h Sun Jan 28 18:38:17 2018 (r328515) @@ -83,6 +83,7 @@ struct ck_epoch_ref { }; struct ck_epoch_record { + ck_stack_entry_t record_next; struct ck_epoch *global; unsigned int state; unsigned int epoch; @@ -92,17 +93,16 @@ struct ck_epoch_record { } local CK_CC_CACHELINE; unsigned int n_pending; unsigned int n_peak; - unsigned long n_dispatch; + unsigned int n_dispatch; + void *ct; ck_stack_t pending[CK_EPOCH_LENGTH]; - ck_stack_entry_t record_next; } CK_CC_CACHELINE; typedef struct ck_epoch_record ck_epoch_record_t; struct ck_epoch { unsigned int epoch; - char pad[CK_MD_CACHELINE - sizeof(unsigned int)]; - ck_stack_t records; unsigned int n_free; + ck_stack_t records; }; typedef struct ck_epoch ck_epoch_t; @@ -110,8 +110,15 @@ typedef struct ck_epoch ck_epoch_t; * Internal functions. */ void _ck_epoch_addref(ck_epoch_record_t *, ck_epoch_section_t *); -void _ck_epoch_delref(ck_epoch_record_t *, ck_epoch_section_t *); +bool _ck_epoch_delref(ck_epoch_record_t *, ck_epoch_section_t *); +CK_CC_FORCE_INLINE static void * +ck_epoch_record_ct(const ck_epoch_record_t *record) +{ + + return ck_pr_load_ptr(&record->ct); +} + /* * Marks the beginning of an epoch-protected section. */ @@ -160,9 +167,10 @@ ck_epoch_begin(ck_epoch_record_t *record, ck_epoch_sec } /* - * Marks the end of an epoch-protected section. + * Marks the end of an epoch-protected section. Returns true if no more + * sections exist for the caller. */ -CK_CC_FORCE_INLINE static void +CK_CC_FORCE_INLINE static bool ck_epoch_end(ck_epoch_record_t *record, ck_epoch_section_t *section) { @@ -170,15 +178,19 @@ ck_epoch_end(ck_epoch_record_t *record, ck_epoch_secti ck_pr_store_uint(&record->active, record->active - 1); if (section != NULL) - _ck_epoch_delref(record, section); + return _ck_epoch_delref(record, section); - return; + return record->active == 0; } /* * Defers the execution of the function pointed to by the "cb" * argument until an epoch counter loop. This allows for a * non-blocking deferral. + * + * We can get away without a fence here due to the monotonic nature + * of the epoch counter. Worst case, this will result in some delays + * before object destruction. */ CK_CC_FORCE_INLINE static void ck_epoch_call(ck_epoch_record_t *record, @@ -195,13 +207,74 @@ ck_epoch_call(ck_epoch_record_t *record, return; } +/* + * Same as ck_epoch_call, but allows for records to be shared and is reentrant. + */ +CK_CC_FORCE_INLINE static void +ck_epoch_call_strict(ck_epoch_record_t *record, + ck_epoch_entry_t *entry, + ck_epoch_cb_t *function) +{ + struct ck_epoch *epoch = record->global; + unsigned int e = ck_pr_load_uint(&epoch->epoch); + unsigned int offset = e & (CK_EPOCH_LENGTH - 1); + + ck_pr_inc_uint(&record->n_pending); + entry->function = function; + + /* Store fence is implied by push operation. */ + ck_stack_push_upmc(&record->pending[offset], &entry->stack_entry); + return; +} + +/* + * This callback is used for synchronize_wait to allow for custom blocking + * behavior. + */ +typedef void ck_epoch_wait_cb_t(ck_epoch_t *, ck_epoch_record_t *, + void *); + +/* + * Return latest epoch value. This operation provides load ordering. + */ +CK_CC_FORCE_INLINE static unsigned int +ck_epoch_value(const ck_epoch_t *ep) +{ + + ck_pr_fence_load(); + return ck_pr_load_uint(&ep->epoch); +} + void ck_epoch_init(ck_epoch_t *); -ck_epoch_record_t *ck_epoch_recycle(ck_epoch_t *); -void ck_epoch_register(ck_epoch_t *, ck_epoch_record_t *); + +/* + * Attempts to recycle an unused epoch record. If one is successfully + * allocated, the record context pointer is also updated. + */ +ck_epoch_record_t *ck_epoch_recycle(ck_epoch_t *, void *); + +/* + * Registers an epoch record. An optional context pointer may be passed that + * is retrievable with ck_epoch_record_ct. + */ +void ck_epoch_register(ck_epoch_t *, ck_epoch_record_t *, void *); + +/* + * Marks a record as available for re-use by a subsequent recycle operation. + * Note that the record cannot be physically destroyed. + */ void ck_epoch_unregister(ck_epoch_record_t *); + bool ck_epoch_poll(ck_epoch_record_t *); void ck_epoch_synchronize(ck_epoch_record_t *); +void ck_epoch_synchronize_wait(ck_epoch_t *, ck_epoch_wait_cb_t *, void *); void ck_epoch_barrier(ck_epoch_record_t *); +void ck_epoch_barrier_wait(ck_epoch_record_t *, ck_epoch_wait_cb_t *, void *); + +/* + * Reclaim entries associated with a record. This is safe to call only on + * the caller's record or records that are using call_strict. + */ void ck_epoch_reclaim(ck_epoch_record_t *); #endif /* CK_EPOCH_H */ Copied and modified: stable/11/sys/contrib/ck/include/ck_md.h (from r309267, head/sys/contrib/ck/include/ck_md.h) ============================================================================== --- head/sys/contrib/ck/include/ck_md.h Mon Nov 28 20:33:30 2016 (r309267, copy source) +++ stable/11/sys/contrib/ck/include/ck_md.h Sun Jan 28 18:38:17 2018 (r328515) @@ -49,11 +49,15 @@ #define CK_MD_VMA_BITS_UNKNOWN #endif /* CK_MD_VMA_BITS_UNKNOWN */ +#ifndef CK_PR_DISABLE_DOUBLE +#define CK_PR_DISABLE_DOUBLE +#endif /* CK_PR_DISABLE_DOUBLE */ + #ifndef CK_MD_RMO #define CK_MD_RMO #endif /* CK_MD_RMO */ -#define CK_VERSION "0.5.2" +#define CK_VERSION "0.6.0" #define CK_GIT_SHA "" /* Modified: stable/11/sys/contrib/ck/include/ck_pr.h ============================================================================== --- head/sys/contrib/ck/include/ck_pr.h Mon Nov 28 20:27:58 2016 (r309266) +++ stable/11/sys/contrib/ck/include/ck_pr.h Sun Jan 28 18:38:17 2018 (r328515) @@ -46,7 +46,11 @@ #elif defined(__ppc__) #include "gcc/ppc/ck_pr.h" #elif defined(__arm__) +#if __ARM_ARCH >= 6 #include "gcc/arm/ck_pr.h" +#else +#include "gcc/arm/ck_pr_armv4.h" +#endif #elif defined(__aarch64__) #include "gcc/aarch64/ck_pr.h" #elif !defined(__GNUC__) @@ -169,7 +173,9 @@ ck_pr_rfo(const void *m) #define ck_pr_store_ptr(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), ptr) #define ck_pr_store_char(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), char) +#ifndef CK_PR_DISABLE_DOUBLE #define ck_pr_store_double(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), double) +#endif #define ck_pr_store_uint(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), uint) #define ck_pr_store_int(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), int) #define ck_pr_store_32(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 32) @@ -187,7 +193,9 @@ ck_pr_rfo(const void *m) #define CK_PR_LOAD_SAFE(SRC, TYPE) ck_pr_md_load_##TYPE((SRC)) #define ck_pr_load_char(SRC) CK_PR_LOAD_SAFE((SRC), char) +#ifndef CK_PR_DISABLE_DOUBLE #define ck_pr_load_double(SRC) CK_PR_LOAD_SAFE((SRC), double) +#endif #define ck_pr_load_uint(SRC) CK_PR_LOAD_SAFE((SRC), uint) #define ck_pr_load_int(SRC) CK_PR_LOAD_SAFE((SRC), int) #define ck_pr_load_32(SRC) CK_PR_LOAD_SAFE((SRC), 32) @@ -275,7 +283,8 @@ CK_PR_BIN_S(or, int, int, |) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_ADD_DOUBLE #define CK_F_PR_ADD_DOUBLE @@ -287,7 +296,7 @@ CK_PR_BIN_S(add, double, double, +) CK_PR_BIN_S(sub, double, double, -) #endif /* CK_F_PR_SUB_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -675,7 +684,8 @@ CK_PR_UNARY_Z_S(dec, int, int, -, 1) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_INC_DOUBLE #define CK_F_PR_INC_DOUBLE @@ -687,7 +697,7 @@ CK_PR_UNARY_S(inc, add, double, double) CK_PR_UNARY_S(dec, sub, double, double) #endif /* CK_F_PR_DEC_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -914,14 +924,15 @@ CK_PR_N_Z_S(int, int) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_NEG_DOUBLE #define CK_F_PR_NEG_DOUBLE CK_PR_N_S(neg, double, double, -) #endif /* CK_F_PR_NEG_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -1105,7 +1116,8 @@ CK_PR_FAS_S(int, int) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_FAA_DOUBLE #define CK_F_PR_FAA_DOUBLE @@ -1117,7 +1129,7 @@ CK_PR_FAA_S(double, double) CK_PR_FAS_S(double, double) #endif /* CK_F_PR_FAS_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) Modified: stable/11/sys/contrib/ck/include/gcc/aarch64/ck_pr.h ============================================================================== --- head/sys/contrib/ck/include/gcc/aarch64/ck_pr.h Mon Nov 28 20:27:58 2016 (r309266) +++ stable/11/sys/contrib/ck/include/gcc/aarch64/ck_pr.h Sun Jan 28 18:38:17 2018 (r328515) @@ -124,7 +124,9 @@ CK_PR_LOAD_S(uint, unsigned int, "ldr") CK_PR_LOAD_S(int, int, "ldr") CK_PR_LOAD_S(short, short, "ldrh") CK_PR_LOAD_S(char, char, "ldrb") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_LOAD_S_64(double, double, "ldr") +#endif #undef CK_PR_LOAD_S #undef CK_PR_LOAD_S_64 @@ -167,326 +169,59 @@ CK_PR_STORE_S(uint, unsigned int, "str") CK_PR_STORE_S(int, int, "str") CK_PR_STORE_S(short, short, "strh") CK_PR_STORE_S(char, char, "strb") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_STORE_S_64(double, double, "str") +#endif #undef CK_PR_STORE_S #undef CK_PR_STORE_S_64 #undef CK_PR_STORE #undef CK_PR_STORE_64 -CK_CC_INLINE static bool -ck_pr_cas_64_2_value(uint64_t target[2], uint64_t compare[2], uint64_t set[2], uint64_t value[2]) -{ - uint64_t tmp1, tmp2; - __asm__ __volatile__("1:" - "ldxp %0, %1, [%4];" - "mov %2, %0;" - "mov %3, %1;" - "eor %0, %0, %5;" - "eor %1, %1, %6;" - "orr %1, %0, %1;" - "mov %w0, #0;" - "cbnz %1, 2f;" - "stxp %w0, %7, %8, [%4];" - "cbnz %w0, 1b;" - "mov %w0, #1;" - "2:" - : "=&r" (tmp1), "=&r" (tmp2), "=&r" (value[0]), "=&r" (value[1]) - : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1])); +#ifdef CK_MD_LSE_ENABLE +#include "ck_pr_lse.h" +#else +#include "ck_pr_llsc.h" +#endif - return (tmp1); -} +/* + * ck_pr_neg_*() functions can only be implemented via LL/SC, as there are no + * LSE alternatives. + */ +#define CK_PR_NEG(N, M, T, W, R) \ + CK_CC_INLINE static void \ + ck_pr_neg_##N(M *target) \ + { \ + T previous = 0; \ + T tmp = 0; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + "neg %" R "0, %" R "0;" \ + "stxr" W " %w1, %" R "0, [%2];" \ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target) \ + : "memory", "cc"); \ + return; \ + } -CK_CC_INLINE static bool -ck_pr_cas_ptr_2_value(void *target, void *compare, void *set, void *value) -{ - return (ck_pr_cas_64_2_value(CK_CPP_CAST(uint64_t *, target), - CK_CPP_CAST(uint64_t *, compare), - CK_CPP_CAST(uint64_t *, set), - CK_CPP_CAST(uint64_t *, value))); -} +CK_PR_NEG(ptr, void, void *, "", "") +CK_PR_NEG(64, uint64_t, uint64_t, "", "") -CK_CC_INLINE static bool -ck_pr_cas_64_2(uint64_t target[2], uint64_t compare[2], uint64_t set[2]) -{ - uint64_t tmp1, tmp2; - __asm__ __volatile__("1:" - "ldxp %0, %1, [%2];" - "eor %0, %0, %3;" - "eor %1, %1, %4;" - "orr %1, %0, %1;" - "mov %w0, #0;" - "cbnz %1, 2f;" - "stxp %w0, %5, %6, [%2];" - "cbnz %w0, 1b;" - "mov %w0, #1;" - "2:" - : "=&r" (tmp1), "=&r" (tmp2) - : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1])); +#define CK_PR_NEG_S(S, T, W) \ + CK_PR_NEG(S, T, T, W, "w") \ - return (tmp1); -} -CK_CC_INLINE static bool -ck_pr_cas_ptr_2(void *target, void *compare, void *set) -{ - return (ck_pr_cas_64_2(CK_CPP_CAST(uint64_t *, target), - CK_CPP_CAST(uint64_t *, compare), - CK_CPP_CAST(uint64_t *, set))); -} +CK_PR_NEG_S(32, uint32_t, "") +CK_PR_NEG_S(uint, unsigned int, "") +CK_PR_NEG_S(int, int, "") +CK_PR_NEG_S(16, uint16_t, "h") +CK_PR_NEG_S(8, uint8_t, "b") +CK_PR_NEG_S(short, short, "h") +CK_PR_NEG_S(char, char, "b") - -#define CK_PR_CAS(N, M, T, W, R) \ - CK_CC_INLINE static bool \ - ck_pr_cas_##N##_value(M *target, T compare, T set, M *value) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];" \ - "cmp %" R "0, %" R "4;" \ - "b.ne 2f;" \ - "stxr" W " %w1, %" R "3, [%2];" \ - "cbnz %w1, 1b;" \ - "2:" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (set), \ - "r" (compare) \ - : "memory", "cc"); \ - *(T *)value = previous; \ - return (previous == compare); \ - } \ - CK_CC_INLINE static bool \ - ck_pr_cas_##N(M *target, T compare, T set) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__( \ - "1:" \ - "ldxr" W " %" R "0, [%2];" \ - "cmp %" R "0, %" R "4;" \ - "b.ne 2f;" \ - "stxr" W " %w1, %" R "3, [%2];" \ - "cbnz %w1, 1b;" \ - "2:" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (set), \ - "r" (compare) \ - : "memory", "cc"); \ - return (previous == compare); \ - } - -CK_PR_CAS(ptr, void, void *, "", "") - -#define CK_PR_CAS_S(N, M, W, R) CK_PR_CAS(N, M, M, W, R) -CK_PR_CAS_S(64, uint64_t, "", "") -CK_PR_CAS_S(double, double, "", "") -CK_PR_CAS_S(32, uint32_t, "", "w") -CK_PR_CAS_S(uint, unsigned int, "", "w") -CK_PR_CAS_S(int, int, "", "w") -CK_PR_CAS_S(16, uint16_t, "h", "w") -CK_PR_CAS_S(8, uint8_t, "b", "w") -CK_PR_CAS_S(short, short, "h", "w") -CK_PR_CAS_S(char, char, "b", "w") - - -#undef CK_PR_CAS_S -#undef CK_PR_CAS - -#define CK_PR_FAS(N, M, T, W, R) \ - CK_CC_INLINE static T \ - ck_pr_fas_##N(M *target, T v) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];" \ - "stxr" W " %w1, %" R "3, [%2];"\ - "cbnz %w1, 1b;" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (v) \ - : "memory", "cc"); \ - return (previous); \ - } - -CK_PR_FAS(64, uint64_t, uint64_t, "", "") -CK_PR_FAS(32, uint32_t, uint32_t, "", "w") -CK_PR_FAS(ptr, void, void *, "", "") -CK_PR_FAS(int, int, int, "", "w") -CK_PR_FAS(uint, unsigned int, unsigned int, "", "w") -CK_PR_FAS(16, uint16_t, uint16_t, "h", "w") -CK_PR_FAS(8, uint8_t, uint8_t, "b", "w") -CK_PR_FAS(short, short, short, "h", "w") -CK_PR_FAS(char, char, char, "b", "w") - - -#undef CK_PR_FAS - -#define CK_PR_UNARY(O, N, M, T, I, W, R) \ - CK_CC_INLINE static void \ - ck_pr_##O##_##N(M *target) \ - { \ - T previous = 0; \ - T tmp = 0; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];" \ - I ";" \ - "stxr" W " %w1, %" R "0, [%2];" \ - "cbnz %w1, 1b;" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target) \ - : "memory", "cc"); \ - return; \ - } - -CK_PR_UNARY(inc, ptr, void, void *, "add %0, %0, #1", "", "") -CK_PR_UNARY(dec, ptr, void, void *, "sub %0, %0, #1", "", "") -CK_PR_UNARY(not, ptr, void, void *, "mvn %0, %0", "", "") -CK_PR_UNARY(neg, ptr, void, void *, "neg %0, %0", "", "") -CK_PR_UNARY(inc, 64, uint64_t, uint64_t, "add %0, %0, #1", "", "") -CK_PR_UNARY(dec, 64, uint64_t, uint64_t, "sub %0, %0, #1", "", "") -CK_PR_UNARY(not, 64, uint64_t, uint64_t, "mvn %0, %0", "", "") -CK_PR_UNARY(neg, 64, uint64_t, uint64_t, "neg %0, %0", "", "") - -#define CK_PR_UNARY_S(S, T, W) \ - CK_PR_UNARY(inc, S, T, T, "add %w0, %w0, #1", W, "w") \ - CK_PR_UNARY(dec, S, T, T, "sub %w0, %w0, #1", W, "w") \ - CK_PR_UNARY(not, S, T, T, "mvn %w0, %w0", W, "w") \ - CK_PR_UNARY(neg, S, T, T, "neg %w0, %w0", W, "w") \ - -CK_PR_UNARY_S(32, uint32_t, "") -CK_PR_UNARY_S(uint, unsigned int, "") -CK_PR_UNARY_S(int, int, "") -CK_PR_UNARY_S(16, uint16_t, "h") -CK_PR_UNARY_S(8, uint8_t, "b") -CK_PR_UNARY_S(short, short, "h") -CK_PR_UNARY_S(char, char, "b") - -#undef CK_PR_UNARY_S -#undef CK_PR_UNARY - -#define CK_PR_BINARY(O, N, M, T, I, W, R) \ - CK_CC_INLINE static void \ - ck_pr_##O##_##N(M *target, T delta) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];"\ - I " %" R "0, %" R "0, %" R "3;" \ - "stxr" W " %w1, %" R "0, [%2];" \ - "cbnz %w1, 1b;" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (delta) \ - : "memory", "cc"); \ - return; \ - } - -CK_PR_BINARY(and, ptr, void, uintptr_t, "and", "", "") -CK_PR_BINARY(add, ptr, void, uintptr_t, "add", "", "") -CK_PR_BINARY(or, ptr, void, uintptr_t, "orr", "", "") -CK_PR_BINARY(sub, ptr, void, uintptr_t, "sub", "", "") -CK_PR_BINARY(xor, ptr, void, uintptr_t, "eor", "", "") -CK_PR_BINARY(and, 64, uint64_t, uint64_t, "and", "", "") -CK_PR_BINARY(add, 64, uint64_t, uint64_t, "add", "", "") -CK_PR_BINARY(or, 64, uint64_t, uint64_t, "orr", "", "") -CK_PR_BINARY(sub, 64, uint64_t, uint64_t, "sub", "", "") -CK_PR_BINARY(xor, 64, uint64_t, uint64_t, "eor", "", "") - -#define CK_PR_BINARY_S(S, T, W) \ - CK_PR_BINARY(and, S, T, T, "and", W, "w") \ - CK_PR_BINARY(add, S, T, T, "add", W, "w") \ - CK_PR_BINARY(or, S, T, T, "orr", W, "w") \ - CK_PR_BINARY(sub, S, T, T, "sub", W, "w") \ - CK_PR_BINARY(xor, S, T, T, "eor", W, "w") - -CK_PR_BINARY_S(32, uint32_t, "") -CK_PR_BINARY_S(uint, unsigned int, "") -CK_PR_BINARY_S(int, int, "") -CK_PR_BINARY_S(16, uint16_t, "h") -CK_PR_BINARY_S(8, uint8_t, "b") -CK_PR_BINARY_S(short, short, "h") -CK_PR_BINARY_S(char, char, "b") - -#undef CK_PR_BINARY_S -#undef CK_PR_BINARY - -CK_CC_INLINE static void * -ck_pr_faa_ptr(void *target, uintptr_t delta) -{ - uintptr_t previous, r, tmp; - - __asm__ __volatile__("1:" - "ldxr %0, [%3];" - "add %1, %4, %0;" - "stxr %w2, %1, [%3];" - "cbnz %w2, 1b;" - : "=&r" (previous), - "=&r" (r), - "=&r" (tmp) - : "r" (target), - "r" (delta) - : "memory", "cc"); - - return (void *)(previous); -} - -CK_CC_INLINE static uint64_t -ck_pr_faa_64(uint64_t *target, uint64_t delta) -{ - uint64_t previous, r, tmp; - - __asm__ __volatile__("1:" - "ldxr %0, [%3];" - "add %1, %4, %0;" - "stxr %w2, %1, [%3];" - "cbnz %w2, 1b;" - : "=&r" (previous), - "=&r" (r), - "=&r" (tmp) - : "r" (target), - "r" (delta) - : "memory", "cc"); - - return (previous); -} - -#define CK_PR_FAA(S, T, W) \ - CK_CC_INLINE static T \ - ck_pr_faa_##S(T *target, T delta) \ - { \ - T previous, r, tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %w0, [%3];" \ - "add %w1, %w4, %w0;" \ - "stxr" W " %w2, %w1, [%3];" \ - "cbnz %w2, 1b;" \ - : "=&r" (previous), \ - "=&r" (r), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (delta) \ - : "memory", "cc"); \ - return (previous); \ - } - -CK_PR_FAA(32, uint32_t, "") -CK_PR_FAA(uint, unsigned int, "") -CK_PR_FAA(int, int, "") -CK_PR_FAA(16, uint16_t, "h") -CK_PR_FAA(8, uint8_t, "b") -CK_PR_FAA(short, short, "h") -CK_PR_FAA(char, char, "b") - -#undef CK_PR_FAA +#undef CK_PR_NEG_S +#undef CK_PR_NEG #endif /* CK_PR_AARCH64_H */ Copied: stable/11/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h (from r310846, head/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h Sun Jan 28 18:38:17 2018 (r328515, copy of r310846, head/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h) @@ -0,0 +1,352 @@ +/* + * Copyright 2009-2016 Samy Al Bahra. + * Copyright 2013-2016 Olivier Houchard. + * 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. + */ + +#ifndef CK_PR_AARCH64_LLSC_H +#define CK_PR_AARCH64_LLSC_H + +#ifndef CK_PR_H +#error Do not include this file directly, use ck_pr.h +#endif + +CK_CC_INLINE static bool +ck_pr_cas_64_2_value(uint64_t target[2], uint64_t compare[2], uint64_t set[2], uint64_t value[2]) +{ + uint64_t tmp1, tmp2; + + __asm__ __volatile__("1:" + "ldxp %0, %1, [%4];" + "mov %2, %0;" + "mov %3, %1;" + "eor %0, %0, %5;" + "eor %1, %1, %6;" + "orr %1, %0, %1;" + "mov %w0, #0;" + "cbnz %1, 2f;" + "stxp %w0, %7, %8, [%4];" + "cbnz %w0, 1b;" + "mov %w0, #1;" + "2:" + : "=&r" (tmp1), "=&r" (tmp2), "=&r" (value[0]), "=&r" (value[1]) + : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1]) + : "cc", "memory"); + + return (tmp1); +} + +CK_CC_INLINE static bool +ck_pr_cas_ptr_2_value(void *target, void *compare, void *set, void *value) +{ + return (ck_pr_cas_64_2_value(CK_CPP_CAST(uint64_t *, target), + CK_CPP_CAST(uint64_t *, compare), + CK_CPP_CAST(uint64_t *, set), + CK_CPP_CAST(uint64_t *, value))); +} + +CK_CC_INLINE static bool +ck_pr_cas_64_2(uint64_t target[2], uint64_t compare[2], uint64_t set[2]) +{ + uint64_t tmp1, tmp2; + + __asm__ __volatile__("1:" + "ldxp %0, %1, [%2];" + "eor %0, %0, %3;" + "eor %1, %1, %4;" + "orr %1, %0, %1;" + "mov %w0, #0;" + "cbnz %1, 2f;" + "stxp %w0, %5, %6, [%2];" + "cbnz %w0, 1b;" + "mov %w0, #1;" + "2:" + : "=&r" (tmp1), "=&r" (tmp2) + : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1]) + : "cc", "memory"); + + return (tmp1); +} +CK_CC_INLINE static bool +ck_pr_cas_ptr_2(void *target, void *compare, void *set) +{ + return (ck_pr_cas_64_2(CK_CPP_CAST(uint64_t *, target), + CK_CPP_CAST(uint64_t *, compare), + CK_CPP_CAST(uint64_t *, set))); +} + + +#define CK_PR_CAS(N, M, T, W, R) \ + CK_CC_INLINE static bool \ + ck_pr_cas_##N##_value(M *target, T compare, T set, M *value) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + "cmp %" R "0, %" R "4;" \ + "b.ne 2f;" \ + "stxr" W " %w1, %" R "3, [%2];" \ + "cbnz %w1, 1b;" \ + "2:" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (set), \ + "r" (compare) \ + : "memory", "cc"); \ + *(T *)value = previous; \ + return (previous == compare); \ + } \ + CK_CC_INLINE static bool \ + ck_pr_cas_##N(M *target, T compare, T set) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__( \ + "1:" \ + "ldxr" W " %" R "0, [%2];" \ + "cmp %" R "0, %" R "4;" \ + "b.ne 2f;" \ + "stxr" W " %w1, %" R "3, [%2];" \ + "cbnz %w1, 1b;" \ + "2:" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (set), \ + "r" (compare) \ + : "memory", "cc"); \ + return (previous == compare); \ + } + +CK_PR_CAS(ptr, void, void *, "", "") + +#define CK_PR_CAS_S(N, M, W, R) CK_PR_CAS(N, M, M, W, R) +CK_PR_CAS_S(64, uint64_t, "", "") +#ifndef CK_PR_DISABLE_DOUBLE +CK_PR_CAS_S(double, double, "", "") +#endif +CK_PR_CAS_S(32, uint32_t, "", "w") +CK_PR_CAS_S(uint, unsigned int, "", "w") +CK_PR_CAS_S(int, int, "", "w") +CK_PR_CAS_S(16, uint16_t, "h", "w") +CK_PR_CAS_S(8, uint8_t, "b", "w") +CK_PR_CAS_S(short, short, "h", "w") +CK_PR_CAS_S(char, char, "b", "w") + + +#undef CK_PR_CAS_S +#undef CK_PR_CAS + +#define CK_PR_FAS(N, M, T, W, R) \ + CK_CC_INLINE static T \ + ck_pr_fas_##N(M *target, T v) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + "stxr" W " %w1, %" R "3, [%2];"\ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (v) \ + : "memory", "cc"); \ + return (previous); \ + } + +CK_PR_FAS(64, uint64_t, uint64_t, "", "") +CK_PR_FAS(32, uint32_t, uint32_t, "", "w") +CK_PR_FAS(ptr, void, void *, "", "") +CK_PR_FAS(int, int, int, "", "w") +CK_PR_FAS(uint, unsigned int, unsigned int, "", "w") +CK_PR_FAS(16, uint16_t, uint16_t, "h", "w") +CK_PR_FAS(8, uint8_t, uint8_t, "b", "w") +CK_PR_FAS(short, short, short, "h", "w") +CK_PR_FAS(char, char, char, "b", "w") + + +#undef CK_PR_FAS + +#define CK_PR_UNARY(O, N, M, T, I, W, R) \ + CK_CC_INLINE static void \ + ck_pr_##O##_##N(M *target) \ + { \ + T previous = 0; \ + T tmp = 0; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + I ";" \ + "stxr" W " %w1, %" R "0, [%2];" \ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target) \ + : "memory", "cc"); \ + return; \ + } + +CK_PR_UNARY(inc, ptr, void, void *, "add %0, %0, #1", "", "") +CK_PR_UNARY(dec, ptr, void, void *, "sub %0, %0, #1", "", "") +CK_PR_UNARY(not, ptr, void, void *, "mvn %0, %0", "", "") +CK_PR_UNARY(inc, 64, uint64_t, uint64_t, "add %0, %0, #1", "", "") +CK_PR_UNARY(dec, 64, uint64_t, uint64_t, "sub %0, %0, #1", "", "") +CK_PR_UNARY(not, 64, uint64_t, uint64_t, "mvn %0, %0", "", "") + +#define CK_PR_UNARY_S(S, T, W) \ + CK_PR_UNARY(inc, S, T, T, "add %w0, %w0, #1", W, "w") \ + CK_PR_UNARY(dec, S, T, T, "sub %w0, %w0, #1", W, "w") \ + CK_PR_UNARY(not, S, T, T, "mvn %w0, %w0", W, "w") \ + +CK_PR_UNARY_S(32, uint32_t, "") +CK_PR_UNARY_S(uint, unsigned int, "") +CK_PR_UNARY_S(int, int, "") +CK_PR_UNARY_S(16, uint16_t, "h") +CK_PR_UNARY_S(8, uint8_t, "b") +CK_PR_UNARY_S(short, short, "h") +CK_PR_UNARY_S(char, char, "b") + +#undef CK_PR_UNARY_S +#undef CK_PR_UNARY + +#define CK_PR_BINARY(O, N, M, T, I, W, R) \ + CK_CC_INLINE static void \ + ck_pr_##O##_##N(M *target, T delta) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];"\ + I " %" R "0, %" R "0, %" R "3;" \ + "stxr" W " %w1, %" R "0, [%2];" \ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (delta) \ + : "memory", "cc"); \ + return; \ + } + +CK_PR_BINARY(and, ptr, void, uintptr_t, "and", "", "") +CK_PR_BINARY(add, ptr, void, uintptr_t, "add", "", "") +CK_PR_BINARY(or, ptr, void, uintptr_t, "orr", "", "") +CK_PR_BINARY(sub, ptr, void, uintptr_t, "sub", "", "") +CK_PR_BINARY(xor, ptr, void, uintptr_t, "eor", "", "") +CK_PR_BINARY(and, 64, uint64_t, uint64_t, "and", "", "") +CK_PR_BINARY(add, 64, uint64_t, uint64_t, "add", "", "") +CK_PR_BINARY(or, 64, uint64_t, uint64_t, "orr", "", "") +CK_PR_BINARY(sub, 64, uint64_t, uint64_t, "sub", "", "") +CK_PR_BINARY(xor, 64, uint64_t, uint64_t, "eor", "", "") + +#define CK_PR_BINARY_S(S, T, W) \ + CK_PR_BINARY(and, S, T, T, "and", W, "w") \ + CK_PR_BINARY(add, S, T, T, "add", W, "w") \ + CK_PR_BINARY(or, S, T, T, "orr", W, "w") \ + CK_PR_BINARY(sub, S, T, T, "sub", W, "w") \ + CK_PR_BINARY(xor, S, T, T, "eor", W, "w") + +CK_PR_BINARY_S(32, uint32_t, "") +CK_PR_BINARY_S(uint, unsigned int, "") +CK_PR_BINARY_S(int, int, "") +CK_PR_BINARY_S(16, uint16_t, "h") +CK_PR_BINARY_S(8, uint8_t, "b") +CK_PR_BINARY_S(short, short, "h") +CK_PR_BINARY_S(char, char, "b") + +#undef CK_PR_BINARY_S +#undef CK_PR_BINARY + +CK_CC_INLINE static void * +ck_pr_faa_ptr(void *target, uintptr_t delta) +{ + uintptr_t previous, r, tmp; + + __asm__ __volatile__("1:" + "ldxr %0, [%3];" + "add %1, %4, %0;" + "stxr %w2, %1, [%3];" + "cbnz %w2, 1b;" + : "=&r" (previous), + "=&r" (r), + "=&r" (tmp) + : "r" (target), + "r" (delta) + : "memory", "cc"); + + return (void *)(previous); +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Jan 28 19:18:41 2018 Return-Path: Delivered-To: svn-src-all@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 D1A75EDA2D6; Sun, 28 Jan 2018 19:18:40 +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 852426AB1A; Sun, 28 Jan 2018 19:18:40 +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 67CFD1DC1F; Sun, 28 Jan 2018 19:18:40 +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 w0SJIeJg086092; Sun, 28 Jan 2018 19:18:40 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SJIexg086091; Sun, 28 Jan 2018 19:18:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801281918.w0SJIexg086091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 28 Jan 2018 19:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328516 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 328516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 19:18:41 -0000 Author: jhibbits Date: Sun Jan 28 19:18:40 2018 New Revision: 328516 URL: https://svnweb.freebsd.org/changeset/base/328516 Log: Consolidate trap instruction checks to a single function Summary: Rather than duplicating the checks for programmatic traps all over the code, put it all in one function. This helps to remove some of the #ifdefs between AIM and Book-E. Reviewed By: nwhitehorn Differential Revision: https://reviews.freebsd.org/D14082 Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Sun Jan 28 18:38:17 2018 (r328515) +++ head/sys/powerpc/powerpc/trap.c Sun Jan 28 19:18:40 2018 (r328516) @@ -183,6 +183,16 @@ trapname(u_int vector) return ("unknown"); } +static inline bool +frame_is_trap_inst(struct trapframe *frame) +{ +#ifdef AIM + return (frame->exc == EXC_PGM && frame->srr1 & EXC_PGM_TRAP); +#else + return (frame->exc == EXC_DEBUG || frame->cpu.booke.esr & ESR_PTR); +#endif +} + void trap(struct trapframe *frame) { @@ -323,11 +333,7 @@ trap(struct trapframe *frame) case EXC_PGM: /* Identify the trap reason */ -#ifdef AIM - if (frame->srr1 & EXC_PGM_TRAP) { -#else - if (frame->cpu.booke.esr & ESR_PTR) { -#endif + if (frame_is_trap_inst(frame)) { #ifdef KDTRACE_HOOKS inst = fuword32((const void *)frame->srr0); if (inst == 0x0FFFDDDD && @@ -371,11 +377,7 @@ trap(struct trapframe *frame) switch (type) { case EXC_PGM: #ifdef KDTRACE_HOOKS -#ifdef AIM - if (frame->srr1 & EXC_PGM_TRAP) { -#else - if (frame->cpu.booke.esr & ESR_PTR) { -#endif + if (frame_is_trap_inst(frame)) { if (*(uint32_t *)frame->srr0 == EXC_DTRACE) { if (dtrace_invop_jump_addr != NULL) { dtrace_invop_jump_addr(frame); @@ -886,13 +888,7 @@ db_trap_glue(struct trapframe *frame) if (!(frame->srr1 & PSL_PR) && (frame->exc == EXC_TRC || frame->exc == EXC_RUNMODETRC -#ifdef AIM - || (frame->exc == EXC_PGM - && (frame->srr1 & EXC_PGM_TRAP)) -#else - || (frame->exc == EXC_DEBUG) - || (frame->cpu.booke.esr & ESR_PTR) -#endif + || frame_is_trap_inst(frame) || frame->exc == EXC_BPT || frame->exc == EXC_DSI)) { int type = frame->exc; @@ -900,12 +896,7 @@ db_trap_glue(struct trapframe *frame) /* Ignore DTrace traps. */ if (*(uint32_t *)frame->srr0 == EXC_DTRACE) return (0); -#ifdef AIM - if (type == EXC_PGM && (frame->srr1 & EXC_PGM_TRAP)) { -#else - if (type == EXC_DEBUG || - (frame->cpu.booke.esr & ESR_PTR)) { -#endif + if (frame_is_trap_inst(frame)) { type = T_BREAKPOINT; } return (kdb_trap(type, 0, frame)); From owner-svn-src-all@freebsd.org Sun Jan 28 19:37:31 2018 Return-Path: Delivered-To: svn-src-all@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 86949EDB1EC; Sun, 28 Jan 2018 19:37:31 +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 3CBA66B611; Sun, 28 Jan 2018 19:37:31 +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 378501DF3D; Sun, 28 Jan 2018 19:37:31 +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 w0SJbUwv096055; Sun, 28 Jan 2018 19:37:30 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SJbU18096054; Sun, 28 Jan 2018 19:37:30 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801281937.w0SJbU18096054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 28 Jan 2018 19:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328517 - head/include X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/include X-SVN-Commit-Revision: 328517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 19:37:31 -0000 Author: pfg Date: Sun Jan 28 19:37:30 2018 New Revision: 328517 URL: https://svnweb.freebsd.org/changeset/base/328517 Log: Avoid implicit gcc nonnull attribute in vwarnx(). We removed the nonnull attributes from our headers long ago, but still __printflike() includes it implicitly. This will cause the NULL check to be optimized away in higher -O levels and it will also trigger a -Wnonnull-compare warning. Avoid warning with it in vwarnx(). Obtained from: DragonfLyBSD (git 6329e2f68af73662a1960240675e796ab586bcb1) Modified: head/include/err.h Modified: head/include/err.h ============================================================================== --- head/include/err.h Sun Jan 28 19:18:40 2018 (r328516) +++ head/include/err.h Sun Jan 28 19:37:30 2018 (r328517) @@ -60,7 +60,7 @@ void vwarn(const char *, __va_list) __printf0like(1, 0 void warnc(int, const char *, ...) __printf0like(2, 3); void vwarnc(int, const char *, __va_list) __printf0like(2, 0); void warnx(const char *, ...) __printflike(1, 2); -void vwarnx(const char *, __va_list) __printflike(1, 0); +void vwarnx(const char *, __va_list) __printf0like(1, 0); void err_set_file(void *); void err_set_exit(void (* _Nullable)(int)); __END_DECLS From owner-svn-src-all@freebsd.org Sun Jan 28 20:04:38 2018 Return-Path: Delivered-To: svn-src-all@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 9DBE4EDC397; Sun, 28 Jan 2018 20:04:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "anubis.delphij.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EBA76C326; Sun, 28 Jan 2018 20:04:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from Xins-MBP.ut.rhv.delphij.net (unknown [IPv6:2601:646:8882:37a:64cd:c34b:5964:b49d]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id C42041DAC5; Sun, 28 Jan 2018 12:04:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=anubis; t=1517169876; x=1517184276; bh=X3CAUMAnno2Rip02sT1exjrXjRqUM+0rPGz+6cwTbOk=; h=Reply-To:Subject:To:References:From:Date:In-Reply-To; b=x0fbWQ/SDbilwMj1eHHCiuLtYV+qYE3RLTZnljZhy3YRO5rjanUanQ4vDgZoz51XN 69IyeOAvsZX48Y4i72aYmfLiEFjAoDhMF+mF96pXmBpCqEBlOBDvQR8xP2uoAdABpz sj4Gl7Ik8J4YkjE7k6rbNoaHbdQy7s8oq77kDoLQ= Reply-To: d@delphij.net Subject: Re: svn commit: r328426 - in head: lib/libufs sbin/clri sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/newfs sbin/quotacheck stand/libsa sys/geom sys/geom/journal sys/geom/label sys/ufs/ffs usr.... To: Kirk McKusick , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801260058.w0Q0wXXP097695@repo.freebsd.org> From: Xin Li Message-ID: <42630780-fd60-3ce9-0689-42a12327dc44@delphij.net> Date: Sun, 28 Jan 2018 12:04:33 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801260058.w0Q0wXXP097695@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PdZ0xPbKLXfiWzEpjA2TViNWBWF9tFDZx" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 20:04:38 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --PdZ0xPbKLXfiWzEpjA2TViNWBWF9tFDZx Content-Type: multipart/mixed; boundary="6nfvBXYkS138xorlhoEM3CmSoTlKTeoVV"; protected-headers="v1" From: Xin Li Reply-To: d@delphij.net To: Kirk McKusick , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <42630780-fd60-3ce9-0689-42a12327dc44@delphij.net> Subject: Re: svn commit: r328426 - in head: lib/libufs sbin/clri sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/newfs sbin/quotacheck stand/libsa sys/geom sys/geom/journal sys/geom/label sys/ufs/ffs usr.... References: <201801260058.w0Q0wXXP097695@repo.freebsd.org> In-Reply-To: <201801260058.w0Q0wXXP097695@repo.freebsd.org> --6nfvBXYkS138xorlhoEM3CmSoTlKTeoVV Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi, Kirk, On 1/25/18 16:58, Kirk McKusick wrote: > Author: mckusick > Date: Fri Jan 26 00:58:32 2018 > New Revision: 328426 > URL: https://svnweb.freebsd.org/changeset/base/328426 >=20 > Log: > Refactoring of reading and writing of the UFS/FFS superblock. > Specifically reading is done if ffs_sbget() and writing is done > in ffs_sbput(). These functions are exported to libufs via the > sbget() and sbput() functions which then used in the various > filesystem utilities. This work is in preparation for adding > subperblock check hashes. > =20 > No functional change intended. > =20 > Reviewed by: kib >=20 > Modified: > head/sys/geom/label/g_label_ufs.c With this change, geom_label now depends on UFS. Could you please take a look at https://reviews.freebsd.org/D14092 ? Cheers, --6nfvBXYkS138xorlhoEM3CmSoTlKTeoVV-- --PdZ0xPbKLXfiWzEpjA2TViNWBWF9tFDZx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJabizUAAoJEJW2GBstM+nstl8P/ijoo/UjPZjxpbhwTNRrxX/0 WNyupGHwqh8g7CUGzVBPK+nidB86In4305A2M/ah6/uw1Y24GGh85xWAYuW6zhvi kStmwKAl/NHFhtNItSrX0zxvoB36t0QXbsg2TXGeGp29TpOncseWZIXXUk6kHVFE SyPOdmlMuunWWyPl9edp+xREKqhp6oBFx8lbu3dv6YSWy5XrgKN0aPpHATooXmK4 +Jhfnf3aYZoDTB7gSBEUwdc2FQMBVKzziCGOx1v/aOIn61S7i1WgDY1Cx9MXUWEU NiCyIpPM1kxArDMD2sMOFiNZmMKJPYuaK4ijDgQw6S6LwSlTvC9g7jNJz7psyGkJ Y9KSg6O/PWbaTRjDBU4mrSMWs2BAZNN1LX92AfiTXvOYnG9ojhKuxA52JRX43GUy oChB1OIClY30H51so0PoFomarTQYN0OTqdRtYlrKP3RppEpGBMRutOfgR+dRvnPh wnAcWyRWzdtKXReFS8ZkwLU+qJzDHEdUFcLc/ePCELWEZcDmqjBNDRfNNN0mvcEF I/B/cujNTvhow9Z5Ns8YKu6xm2k9mEhi2CcbLbFHqQYIASQdtXeFR0DYiI+/O0QX fOIPo5wzJhjuEgGRY6en4i3N0qoTOB4i/BN0kSXW1w63mot5OxMmdFg/I/tEPklg I8T3YrqCN8rmaXbWL3T4 =lmpg -----END PGP SIGNATURE----- --PdZ0xPbKLXfiWzEpjA2TViNWBWF9tFDZx-- From owner-svn-src-all@freebsd.org Sun Jan 28 20:35:49 2018 Return-Path: Delivered-To: svn-src-all@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 AD269EDDEC9; Sun, 28 Jan 2018 20:35: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 6334D6D858; Sun, 28 Jan 2018 20:35: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 595FE1E8F4; Sun, 28 Jan 2018 20:35: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 w0SKZnXi025564; Sun, 28 Jan 2018 20:35:49 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SKZnSF025563; Sun, 28 Jan 2018 20:35:49 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801282035.w0SKZnSF025563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 28 Jan 2018 20:35:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328518 - head/sys/powerpc/conf X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/conf X-SVN-Commit-Revision: 328518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 20:35:49 -0000 Author: jhibbits Date: Sun Jan 28 20:35:48 2018 New Revision: 328518 URL: https://svnweb.freebsd.org/changeset/base/328518 Log: Start building modules for QORIQ64 There's no reason not to build modules for 64-bit QorIQ devices. This config has evolved to be analogous to the AIM GENERIC64 kernel, so will grow to match it in more ways as well. Modified: head/sys/powerpc/conf/QORIQ64 Modified: head/sys/powerpc/conf/QORIQ64 ============================================================================== --- head/sys/powerpc/conf/QORIQ64 Sun Jan 28 19:37:30 2018 (r328517) +++ head/sys/powerpc/conf/QORIQ64 Sun Jan 28 20:35:48 2018 (r328518) @@ -15,7 +15,6 @@ include "dpaa/config.dpaa" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" -makeoptions NO_MODULES=yes options FPU_EMU From owner-svn-src-all@freebsd.org Sun Jan 28 21:01:22 2018 Return-Path: Delivered-To: svn-src-all@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 5B9FCEDEE59; Sun, 28 Jan 2018 21:01:22 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wr0-x232.google.com (mail-wr0-x232.google.com [IPv6:2a00:1450:400c:c0c::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB6726E43F; Sun, 28 Jan 2018 21:01:21 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wr0-x232.google.com with SMTP id w50so5094972wrc.2; Sun, 28 Jan 2018 13:01:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4sOzMgkPm3u83vN80WtCiTEBNJ76rSAD82+LuBu4YWI=; b=XC/Xj/9929mWQrcS5IBxW6CuSBqNizpLUpW7I7HJ++JOIu9eYoFJdlZIFbi41KQGL7 hVuIC+ka7VRXAUI6AcSOqOpIUmzc4UNDZ7y78E7YKy5VEWr8rELL0XILfRTWnkiEhGoy /Ve4378WlPdyAwR6ADEHPBMHeFx3hqV8bar4kY8nwq0VhWV5HLkohUM2MUWXa3U9wM59 vtcvP+q76Glb8xKsmKzgbAGHLfPxhvlX9K/L9/5wwnznnD3HOulQ1IP5DZIg4XipbQFB fTQvRm1u+pO2mxgE6hy5MsBuM1GJW4Xm2/WZpBPJrQDoYxOA9pgaXz87wUfqGdE9Sp6l 4mog== 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=4sOzMgkPm3u83vN80WtCiTEBNJ76rSAD82+LuBu4YWI=; b=SxfChVzQyJTDXDvshEdxrd0apW7tHToz4Xsk16kJdBk/bfWNq1LoVWPzDJx81glZPi 75EjhnZ2PZ/O4c5odL2nX1skapB90U+MzIyELWdr5H/NZdBYg/GpX0uCuW/5nFCE9X1q EYALhQMXQlc7igDv9/wkmzexAuID4JSzv+p15HGQHs5uLCYtjrZp5HvBvv3t2f68TQlf +CcMhDDtVNkL3iJ//Lm5WmGlHpwFpT45Grx/mG5l/CmooUpJks9rqeMDzn6b/d3PwrNa 9ABoWvIVPAhots77h2lGBj/D45iTfwq1AB+/8mUt3rzzJT+mznDxdPqZmmIA8CtzoncO d0Ww== X-Gm-Message-State: AKwxytcBWUx3e1KbNXTwkzdVT3cZJmMaUBX6vTqjPm/ueYX6oGCltVXF ejSNNWaQmATjTUcVpMthxmuOr6hbVh/ZRye7sbE= X-Google-Smtp-Source: AH8x224U51SLUtweHJjoNEguMR5EL02HuEEA1jkFeDeA8S21b01roWTJBmAaZPtLgqAPdkmyL3f4lQV3AKnFWc106AA= X-Received: by 10.223.198.198 with SMTP id c6mr16694316wrh.159.1517173280773; Sun, 28 Jan 2018 13:01:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.181.3 with HTTP; Sun, 28 Jan 2018 13:01:19 -0800 (PST) In-Reply-To: <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> From: Adrian Chadd Date: Sun, 28 Jan 2018 13:01:19 -0800 Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Emmanuel Vadot Cc: Poul-Henning Kamp , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 21:01:22 -0000 [snip] And this is the root bit that's missing - dynamic pinmux/pinctrl stuff at runtime. Warner's already said he's WIP'ing it and phk seems like a good test case for kicking those tyres, so it sounds like those tyres are about to be kicked. In the meantime, hacks allow people to make some progress, and as long as they're not on by default, it's okay. The challenge is finding the middle ground between "right" and "working". Some people are happy to do the legwork to do things right first; others are happy to do the end bits and then backfill the supporting infrastructure. Fun times, fun times! I'm just happy to see more RPI support. That platform still isn't dying. -adrian From owner-svn-src-all@freebsd.org Sun Jan 28 21:11:08 2018 Return-Path: Delivered-To: svn-src-all@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 E2FC2EDF553 for ; Sun, 28 Jan 2018 21:11:07 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::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 34B566EAD8 for ; Sun, 28 Jan 2018 21:11:07 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x236.google.com with SMTP id h129so828175ita.2 for ; Sun, 28 Jan 2018 13:11:07 -0800 (PST) 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=DPKQFeLTZdABNXoANKpzyE89Q6jdLJxeZXN0xKUprQQ=; b=Sw56yLw5wHKGwT8XacW+v4HSBiOKuTWiDNhctrdaSsv36tlGtrn7whwlPEhqtUQsbb Zw9Ybc8hWUhSh236mUnBvPiKy2+zHeXYFQuWacwBQYUx4tc+L1Yf2L4ou8R2I8EF0RAd Kl8Y4se5iY4Xe1+mTenI7sCXVNPk21IJtXgbQg5R3uQnUKBPbNDly9dppy5oX5WfBE/4 6kdIYEVGRco4TqmfIxN101+z//IXXubmrHQ2EzPiMzS45QSIfgLtQ0xU2A2ao9fe9tVY Ow0YW1HHharp5lPHZ/I/BMsu6nAY6RM3aHticfW5BxgHEgX/0DwNbrdFpZH+EUQOziGR uevg== 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=DPKQFeLTZdABNXoANKpzyE89Q6jdLJxeZXN0xKUprQQ=; b=DTmigpkonqF+SFX2xhutI1/W4f9ErinL24TJwKTYvJqYSipMl4lmhpbDnG5XdakjZp JQnwbdJUxS0IFg+QZ8mJ5lGmY7t8eOZfPNletvWFfY9EYXdCAf5A9q3ylYU7K1a326BY Dj4e83iZTz1piqZKAeDZ6zmw7VDWUjsfnquksDvGv/t2fxbfjBRvhmFDUvLsM0G+1qde mWPBhesKsD2jTpc/w/53EJSQRU5vzyDtH2CEV1TsISf2vy0CPKs7uAlRa5m3/kmVgkF4 rFy7xt+CcH0tjiy8OBaItQY81kxY53cVTbw9KiDCBFjIWGbhR9mac1hp2SR4Sr2Du76y EqBw== X-Gm-Message-State: AKwxytcjaVrc3y/CNF0R5+1IU0vAJT40j9rkd5UOmdzB1sJwyvg9oAFk v26RxaakXUePeBUq9XVutLi3ALagjsCnAYbM0KWpeA== X-Google-Smtp-Source: AH8x227VBaG07xEAs43lhZPR+MBh7XTtvxxo1trGoavAjKfXlLEqEFWgwkwtXAtMNY0uUdDNIIhOekeAY4JPuyeMcuE= X-Received: by 10.36.74.200 with SMTP id k191mr26233743itb.69.1517173866360; Sun, 28 Jan 2018 13:11:06 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sun, 28 Jan 2018 13:11:05 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> From: Warner Losh Date: Sun, 28 Jan 2018 14:11:05 -0700 X-Google-Sender-Auth: XWJbiozyd66xGjXFdx-85gmoyLs Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Adrian Chadd Cc: Emmanuel Vadot , Poul-Henning Kamp , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 21:11:08 -0000 On Sun, Jan 28, 2018 at 2:01 PM, Adrian Chadd wrote: > [snip] > > And this is the root bit that's missing - dynamic pinmux/pinctrl stuff > at runtime. > Well, you gotta walk before you can run. We don't even have static pinmx on rpi. Though someone else is working on that. > Warner's already said he's WIP'ing it and phk seems like a good test > case for kicking those tyres, so it sounds like those tyres are about > to be kicked. > > In the meantime, hacks allow people to make some progress, and as long > as they're not on by default, it's okay. The challenge is finding the > middle ground between "right" and "working". Some people are happy to > do the legwork to do things right first; others are happy to do the > end bits and then backfill the supporting infrastructure. > No. Such hacks are actively getting in the way. My WIP already breaks PHK's hacks (unintentionally, but discovered in hindsight) because they are outside the mainstream. I have 0 interest in preserving short-term hacks through the longer-term fixes, and while I'd rather not step on toes, I don't really feel bad in cases like this... However, my WiP is more about fixing some issues in NEWBUS / devctl and trying to have some order in the "Let's change 'disabled' it at runtime" with enough hooks so that we do more than just turn on the device driver for the device, but also integrate the new state into the dependencies, like pinmux/pinctl. We'll need that regardless of whether we need a quick hack to turn them on/off or we allow loading DTB overlays at runtime. Unlike x86 where you might have not attached fxp0 and just need to call fxp_attach() (basically) to make it work, in the embedded space, you'll have lots of unhappy campers if you don't also deal with the dependent power, clock and pin resources. > Fun times, fun times! I'm just happy to see more RPI support. That > platform still isn't dying. > Yea, otherwise we could kill armv6 completely. Warner From owner-svn-src-all@freebsd.org Sun Jan 28 21:21:18 2018 Return-Path: Delivered-To: svn-src-all@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 2AF24EDFC06 for ; Sun, 28 Jan 2018 21:21:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::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 A804A6F18F for ; Sun, 28 Jan 2018 21:21:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x236.google.com with SMTP id x128so6024639ite.0 for ; Sun, 28 Jan 2018 13:21:17 -0800 (PST) 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=2oa3yEGGm7zDUc+/KQZRJZvD4EfyjNCKHcTEoFH8WC8=; b=UysyVbLdPal48POoU+aMV7gLglkdw9zJf9Co3PC6mp6bE2e8wpbgHxNpGXjrRAIPZX pYc46H6w77jpu9D0xWgLliuKTR+qiaoN6/gLas6DPkFliioWwplU+8/HrZHW0zKwM8IQ 6KS6c0qjUGaR+ylUDxKVpDTnguDzywvvCSIpHP2exvcC95g4cGov1CGQu2a+QR2LK7Uq wvB/1qahMhuYWT0SDuoTdAoOaPlyJg9ZdSubW0X3Ll1UpyOssEpyht1UgbxpojOrTtLQ /z+Ov9I9Q3TVXypdgUvGvnt8+b9mTmMbVLWqY7U+52Q/zWjQepSRLI8aTOMQhK0bXdHC i0sQ== 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=2oa3yEGGm7zDUc+/KQZRJZvD4EfyjNCKHcTEoFH8WC8=; b=r3RGY+xyZmuAMhG9jMAB1Jb24YO0PsnYfl9ibBZS9XW3+CmXfA+RDS30RSsHO/SDvD mjQDEWkM8bMbZstv9deegIMSMJGnPyo2tXURT4qcjdE7SjgYtpPXYnKI2qplkOaBC+Es gxH9rEpHpz4c/T0JVJJpkmwFhcyFU8bJef5H/n/BLmP+ficGNAI1eMPljCJtTOUWlJPR q+M64Cu6TO7q87RcC0qSrzfWLpWNPwxgldeE106EuArn3XazIIO70cHaWU9vPIX+74vg AQnzre9/r4AyS9wN1shONP7raGdPUX+HvjYjW3YNUxRNAyO/Wat9gooGddirm7O/Vrrk UR6w== X-Gm-Message-State: AKwxyteIPgVZ+44QYOU4oXj8GgBcSZoSUYTMdh/eLWC5vZbBbI1fZBIN Wqw03S9Wn88sL1Ui9BOAy5tWbkYeVqCcEWJq3mbJDA== X-Google-Smtp-Source: AH8x225aKu/gP/k1vNzPF0mZfj2JsGt2mFV+uPEKMr2fEu0abi7LUsuFAjjLHcH6NY38Spw57bDKbL7B6wJKAm6om54= X-Received: by 10.36.104.210 with SMTP id v201mr23042988itb.64.1517174477031; Sun, 28 Jan 2018 13:21:17 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sun, 28 Jan 2018 13:21:16 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> From: Warner Losh Date: Sun, 28 Jan 2018 14:21:16 -0700 X-Google-Sender-Auth: xiUC-ub-Zjb1mMT26WZ8gm_ub6Y Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Emmanuel Vadot Cc: Poul-Henning Kamp , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 21:21:18 -0000 On Sun, Jan 28, 2018 at 10:34 AM, Emmanuel Vadot wrote: > On 2018-01-28 00:14, Poul-Henning Kamp wrote: > >> -------- >> In message <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com>, >> Emmanuel Vadot writes: >> >> - We have a commiter that commited something for his own need: he >>> wanted to use the pwm on his rpi, coded a driver (this part is good) >>> but feel that the standard we were using was crap and commited his work >>> without talking with arm developper on what the proper way to do it was. >>> >> I don't entirely agree about that, I think RPi is a platform we >> > as project ignore at our peril, so I have started to do a little >> bit of an effort, as I find time and information for it. >> > > And we all thank you for that. The problems with RPi aren't going to be solved with simple quick hacks. The port pre-dates our evolved views on using DTB, the upstream linux DTB and the need to have more complete pinmux / clock / power support. Each driver does it in an ad-hoc way now, meaning there's a lot of code in the drivers that needs to be burned down before we can stand up a replacement... Hopefully, these discussions will bear fruit in the near term. You keep yelling at me for not adhering to an entirely undocumented >> design vision, which we don't even have a single compliant reference >> platform for yet. >> > > Reference platform doesn't make much sense in the embedded world. > Even if you take the JUNO hardware (ARMv8 reference design, which I think > we support to some extent), we don't support the GPIO/Pinmuxing I think and > even if we do it's different than the controller on RPI (Or any other SoC). > Well more like same-same but different stuff. > If you want a reference platform take the Allwinner code or IMX (I > sometime look at the IMX code to check stuff because I know ian@ knows > his stuff). The embedded space is a high-context, fast moving space relative to x86. As such, there will always be a certain amount of undocumentedness. It requires closely working with the community of embedded developers in a way that we've not had to do in x86 world since the patch-kit / 1.x days. A long time ago, though, FreeBSD evolved a whole new VM w/o it having much of a published design. Newbus went to market w/o good docs published, yet everybody was expected to adopt it. The problems of documentation have largely been corrected after things were built. The evolution of the embedded space and how we can best support it with the minimal resources the project has is similar. While there's no over-arching design document, the broad outlines are there, and the interfaces we want to implement have published specs, even if they aren't all implemented yet. In an ideal world this would all be documented, published and anybody that shows up would know the next steps to take. I'd love for that to be the case here, but we don't have that today. Warner From owner-svn-src-all@freebsd.org Sun Jan 28 21:30:59 2018 Return-Path: Delivered-To: svn-src-all@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 E331AEE04B8; Sun, 28 Jan 2018 21:30:58 +0000 (UTC) (envelope-from nwhitehorn@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 375946F7D5; Sun, 28 Jan 2018 21:30:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 324D41F21A; Sun, 28 Jan 2018 21:30:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0SLUwce050361; Sun, 28 Jan 2018 21:30:58 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SLUwQZ050360; Sun, 28 Jan 2018 21:30:58 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201801282130.w0SLUwQZ050360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sun, 28 Jan 2018 21:30:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328519 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 328519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 21:30:59 -0000 Author: nwhitehorn Date: Sun Jan 28 21:30:57 2018 New Revision: 328519 URL: https://svnweb.freebsd.org/changeset/base/328519 Log: Remove some unused AIM register declarations that existed to support some CPUs we have never run on. As a side-effect, removes some #ifdef AIM/#else. Modified: head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sun Jan 28 20:35:48 2018 (r328518) +++ head/sys/powerpc/include/spr.h Sun Jan 28 21:30:57 2018 (r328519) @@ -667,19 +667,7 @@ #define PMC970N_CYCLES 0xf /* Processor cycles */ #define PMC970N_ICOMP 0x9 /* Instructions completed */ -#if defined(AIM) - -#define SPR_ESR 0x3d4 /* 4.. Exception Syndrome Register */ -#define ESR_MCI 0x80000000 /* Machine check - instruction */ -#define ESR_PIL 0x08000000 /* Program interrupt - illegal */ -#define ESR_PPR 0x04000000 /* Program interrupt - privileged */ -#define ESR_PTR 0x02000000 /* Program interrupt - trap */ -#define ESR_ST 0x01000000 /* Store operation */ -#define ESR_DST 0x00800000 /* Data storage interrupt - store fault */ -#define ESR_DIZ 0x00800000 /* Data/instruction storage interrupt - zone fault */ -#define ESR_U0F 0x00008000 /* Data storage interrupt - U0 fault */ - -#elif defined(BOOKE) +#if defined(BOOKE) #define SPR_MCARU 0x239 /* ..8 Machine Check Address register upper bits */ #define SPR_MCSR 0x23c /* ..8 Machine Check Syndrome register */ From owner-svn-src-all@freebsd.org Sun Jan 28 22:52:00 2018 Return-Path: Delivered-To: svn-src-all@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 22A51EC1916; Sun, 28 Jan 2018 22:52:00 +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 77462727C2; Sun, 28 Jan 2018 22:51:59 +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 3D38B27394; Sun, 28 Jan 2018 22:51:54 +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 w0SMpcm2013028 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 28 Jan 2018 22:51:38 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0SMpb5p013026; Sun, 28 Jan 2018 22:51:37 GMT (envelope-from phk) To: Emmanuel Vadot cc: Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13024.1517179897.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sun, 28 Jan 2018 22:51:37 +0000 Message-ID: <13025.1517179897@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 22:52:00 -0000 -------- In message <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org>, Emmanuel Vado= t writes: > Sometimes it makes sense to reboot. Yes, *sometimes* it does. But *always* demanding reboot makes no sense ever. > Reference platform doesn't make much sense in the embedded world. A reference platform which peple can look at to find out what the software architecture is supposed to be, in the near total absense of documentation for said software architecture makes a lot of sense. > I'm not upset at you for not using, I'm "upset" at you for not wanting = >to make the effort to implement them. Some are hard, some are easy. FreeBSD is a hobby for me these days, that implied a certain amount of enjoyment and limited time. Trying to guess what software architecture you want to be written, based on the non-existent documentation and with no reference-platform to look at, and then implementing it on a SOC where the hardware documentation spans the gamut from from missing over mangled to misleading, does not qualify as "enjoyment" for me and it certainly is not something I have time for. > What's funny though is that even with a pinctrl and clock management, = >we still don't have what is necessary to implement what you want = >(kldloading a driver and directly use pwm). For that we need overlays at = >runtime, pinmuxing at runtime and probably other things too. I'm amazed if those things are not already part of our ambition ? > This is where I (and probably) other don't agree, this is backward. > We must implement first proper pinctrl driver and clock management = > instead of introduce hacks. Who exactly are "We" ? You indicated that you are not going to do it. I can't because I don't know what it is that I am supposed to write. Nobody else seems to be inclined to do it either. So RPi as a platform is just in limbo forever ? And where does this "Spanish Inquisition" road end? Why are gpio and spi allowed to exist on the RPi platform? Or is your next demand going to be that they also be removed pending a hypothetical pinctrl driver ? > I think we are both adults (not sure for me or if I want to be one but = >let's pretend that I am), so let me ask you one more time to backout = >your commit and let's work together to extend arm support toward what = >you want to do. Empathetically NO! (But feel free to ask me again, if my driver ever in any way prevents you from committing your changes to the RPi platform.) Poul-Henning -- = 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-all@freebsd.org Sun Jan 28 23:00:02 2018 Return-Path: Delivered-To: svn-src-all@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 5271EEC210D; Sun, 28 Jan 2018 23:00:02 +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 D698C72B86; Sun, 28 Jan 2018 23:00:01 +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 5BE93273A6; Sun, 28 Jan 2018 23:00:00 +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 w0SN00td013230 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 28 Jan 2018 23:00:00 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0SMxxaM013213; Sun, 28 Jan 2018 22:59:59 GMT (envelope-from phk) To: Warner Losh cc: Adrian Chadd , Emmanuel Vadot , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13211.1517180399.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sun, 28 Jan 2018 22:59:59 +0000 Message-ID: <13212.1517180399@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 23:00:02 -0000 -------- In message , Warner Losh writes: >--001a1144c1d25e374c0563dc9147 >No. Such hacks are actively getting in the way. My WIP already breaks PHK= 's >hacks (unintentionally, but discovered in hindsight) because they are >outside the mainstream. I have 0 interest in preserving short-term hacks >through the longer-term fixes, = No worries, you do your stuff, and I'll unbreak my driver to follow the evolving infrastructure. No big deal. >> Fun times, fun times! I'm just happy to see more RPI support. That >> platform still isn't dying. > >Yea, otherwise we could kill armv6 completely. But it is only the original RPi is armv6, right ? I think we would be OK as long as we support RPi2 and RPi3. -- = 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-all@freebsd.org Sun Jan 28 23:58:23 2018 Return-Path: Delivered-To: svn-src-all@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 669E7EC58B6; Sun, 28 Jan 2018 23:58:23 +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 187057493F; Sun, 28 Jan 2018 23:58:23 +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 0D858208C0; Sun, 28 Jan 2018 23:58: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 w0SNwMjT024059; Sun, 28 Jan 2018 23:58:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0SNwMR5024058; Sun, 28 Jan 2018 23:58:22 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801282358.w0SNwMR5024058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 28 Jan 2018 23:58:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328520 - 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: 328520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 23:58:23 -0000 Author: imp Date: Sun Jan 28 23:58:22 2018 New Revision: 328520 URL: https://svnweb.freebsd.org/changeset/base/328520 Log: Out of an abundance of caution, NUL out the first byte in the PNP info. Modified: head/sys/dev/ofw/ofw_bus_subr.c Modified: head/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.c Sun Jan 28 21:30:57 2018 (r328519) +++ head/sys/dev/ofw/ofw_bus_subr.c Sun Jan 28 23:58:22 2018 (r328520) @@ -90,6 +90,7 @@ ofw_bus_gen_child_pnpinfo_str(device_t cbdev, device_t size_t buflen) { + *buf = '\0'; if (ofw_bus_get_name(child) != NULL) { strlcat(buf, "name=", buflen); strlcat(buf, ofw_bus_get_name(child), buflen); From owner-svn-src-all@freebsd.org Mon Jan 29 00:00:53 2018 Return-Path: Delivered-To: svn-src-all@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 C2843EC5C5E; Mon, 29 Jan 2018 00:00: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 7133E74B9C; Mon, 29 Jan 2018 00:00: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 6C2D3208E2; Mon, 29 Jan 2018 00:00: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 w0T00rr0024933; Mon, 29 Jan 2018 00:00:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T00rXm024930; Mon, 29 Jan 2018 00:00:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801290000.w0T00rXm024930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 29 Jan 2018 00:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328521 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 328521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 00:00:54 -0000 Author: imp Date: Mon Jan 29 00:00:52 2018 New Revision: 328521 URL: https://svnweb.freebsd.org/changeset/base/328521 Log: Use atomic load and stores to ensure that the compiler doesn't optimize away these loops. Change boolean to int to match what atomic API supplies. Remove wmb() since the atomic_store_rel() on status.done ensure the prior writes to status. It also fixes the fact that there wasn't a rmb() before reading done. This should also be more efficient since wmb() is fairly heavy weight. Sponsored by: Netflix Reviewed by: kib@, jim harris Differential Revision: https://reviews.freebsd.org/D14053 Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Sun Jan 28 23:58:22 2018 (r328520) +++ head/sys/dev/nvme/nvme.c Mon Jan 29 00:00:52 2018 (r328521) @@ -469,6 +469,5 @@ nvme_completion_poll_cb(void *arg, const struct nvme_c * the request passed or failed. */ memcpy(&status->cpl, cpl, sizeof(*cpl)); - wmb(); - status->done = TRUE; + atomic_store_rel_int(&status->done, 1); } Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Sun Jan 28 23:58:22 2018 (r328520) +++ head/sys/dev/nvme/nvme_ctrlr.c Mon Jan 29 00:00:52 2018 (r328521) @@ -404,10 +404,10 @@ nvme_ctrlr_identify(struct nvme_controller *ctrlr) { struct nvme_completion_poll_status status; - status.done = FALSE; + status.done = 0; nvme_ctrlr_cmd_identify_controller(ctrlr, &ctrlr->cdata, nvme_completion_poll_cb, &status); - while (status.done == FALSE) + while (!atomic_load_acq_int(&status.done)) pause("nvme", 1); if (nvme_completion_is_error(&status.cpl)) { nvme_printf(ctrlr, "nvme_identify_controller failed!\n"); @@ -431,10 +431,10 @@ nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrl struct nvme_completion_poll_status status; int cq_allocated, sq_allocated; - status.done = FALSE; + status.done = 0; nvme_ctrlr_cmd_set_num_queues(ctrlr, ctrlr->num_io_queues, nvme_completion_poll_cb, &status); - while (status.done == FALSE) + while (!atomic_load_acq_int(&status.done)) pause("nvme", 1); if (nvme_completion_is_error(&status.cpl)) { nvme_printf(ctrlr, "nvme_ctrlr_set_num_qpairs failed!\n"); @@ -470,20 +470,20 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr for (i = 0; i < ctrlr->num_io_queues; i++) { qpair = &ctrlr->ioq[i]; - status.done = FALSE; + status.done = 0; nvme_ctrlr_cmd_create_io_cq(ctrlr, qpair, qpair->vector, nvme_completion_poll_cb, &status); - while (status.done == FALSE) + while (!atomic_load_acq_int(&status.done)) pause("nvme", 1); if (nvme_completion_is_error(&status.cpl)) { nvme_printf(ctrlr, "nvme_create_io_cq failed!\n"); return (ENXIO); } - status.done = FALSE; + status.done = 0; nvme_ctrlr_cmd_create_io_sq(qpair->ctrlr, qpair, nvme_completion_poll_cb, &status); - while (status.done == FALSE) + while (!atomic_load_acq_int(&status.done)) pause("nvme", 1); if (nvme_completion_is_error(&status.cpl)) { nvme_printf(ctrlr, "nvme_create_io_sq failed!\n"); @@ -693,10 +693,10 @@ nvme_ctrlr_configure_aer(struct nvme_controller *ctrlr ctrlr->async_event_config.raw = 0xFF; ctrlr->async_event_config.bits.reserved = 0; - status.done = FALSE; + status.done = 0; nvme_ctrlr_cmd_get_feature(ctrlr, NVME_FEAT_TEMPERATURE_THRESHOLD, 0, NULL, 0, nvme_completion_poll_cb, &status); - while (status.done == FALSE) + while (!atomic_load_acq_int(&status.done)) pause("nvme", 1); if (nvme_completion_is_error(&status.cpl) || (status.cpl.cdw0 & 0xFFFF) == 0xFFFF || Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Sun Jan 28 23:58:22 2018 (r328520) +++ head/sys/dev/nvme/nvme_private.h Mon Jan 29 00:00:52 2018 (r328521) @@ -128,7 +128,7 @@ extern int32_t nvme_retry_count; struct nvme_completion_poll_status { struct nvme_completion cpl; - boolean_t done; + int done; }; #define NVME_REQUEST_VADDR 1 From owner-svn-src-all@freebsd.org Mon Jan 29 00:14:40 2018 Return-Path: Delivered-To: svn-src-all@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 249B7EC7133; Mon, 29 Jan 2018 00:14: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 C9B7375730; Mon, 29 Jan 2018 00:14: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 C4AC920BF5; Mon, 29 Jan 2018 00:14: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 w0T0EdE8033999; Mon, 29 Jan 2018 00:14:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T0EdVR033996; Mon, 29 Jan 2018 00:14:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801290014.w0T0EdVR033996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 29 Jan 2018 00:14:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328522 - in head/sys: conf kern sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: conf kern sys X-SVN-Commit-Revision: 328522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 00:14:40 -0000 Author: imp Date: Mon Jan 29 00:14:39 2018 New Revision: 328522 URL: https://svnweb.freebsd.org/changeset/base/328522 Log: Create deprecation management functions. gone_in(majar, msg); If we're running in FreeBSD major, tell the user this code may be deleted soon. If we're running in FreeBSD major - 1, the the user is deprecated and will be gone in major. Otherwise say nothing. gone_in_dev(dev, major, msg) Just like gone_in, except use device_printf. New tunable / sysctl debug.oboslete_panic: 0 - don't panic, 1 - panic in major or newer , 2 - panic in major - 1 or newer default: 0 if NO_OBSOLETE_CODE is defined, then both of these turn into compile time errors when building for major. Add options NO_OBSOLETE_CODE to kernel build system. This lets us tag code that's going away so users know it will be gone, as well as automatically manage things. Differential Review: https://reviews.freebsd.org/D13818 Modified: head/sys/conf/options head/sys/kern/subr_bus.c head/sys/sys/systm.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Jan 29 00:00:52 2018 (r328521) +++ head/sys/conf/options Mon Jan 29 00:14:39 2018 (r328522) @@ -177,6 +177,7 @@ NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h NO_ADAPTIVE_RWLOCKS NO_ADAPTIVE_SX NO_EVENTTIMERS opt_timer.h +NO_OBSOLETE_CODE opt_global.h NO_SYSCTL_DESCR opt_global.h NSWBUF_MIN opt_swap.h MBUF_PACKET_ZONE_DISABLE opt_global.h Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Mon Jan 29 00:00:52 2018 (r328521) +++ head/sys/kern/subr_bus.c Mon Jan 29 00:14:39 2018 (r328522) @@ -5605,6 +5605,56 @@ devctl2_init(void) UID_ROOT, GID_WHEEL, 0600, "devctl2"); } +/* + * APIs to manage deprecation and obsolescence. + */ +static int obsolete_panic = 0; +SYSCTL_INT(_debug, OID_AUTO, obsolete_panic, CTLFLAG_RWTUN, &obsolete_panic, 0, + "Bus debug level"); +/* 0 - don't panic, 1 - panic if already obsolete, 2 - panic if deprecated */ +static void +gone_panic(int major, int running, const char *msg) +{ + + switch (obsolete_panic) + { + case 0: + return; + case 1: + if (running < major) + return; + /* FALLTHROUGH */ + default: + panic("%s", msg); + } +} + +void +_gone_in(int major, const char *msg) +{ + + gone_panic(major, P_OSREL_MAJOR(__FreeBSD_version), msg); + if (P_OSREL_MAJOR(__FreeBSD_version) >= major) + printf("Obsolete code will removed soon: %s\n", msg); + else if (P_OSREL_MAJOR(__FreeBSD_version) + 1 == major) + printf("Deprecated code (to be removed in FreeBSD %d): %s\n", + major, msg); +} + +void +_gone_in_dev(device_t dev, int major, const char *msg) +{ + + gone_panic(major, P_OSREL_MAJOR(__FreeBSD_version), msg); + if (P_OSREL_MAJOR(__FreeBSD_version) >= major) + device_printf(dev, + "Obsolete code will removed soon: %s\n", msg); + else if (P_OSREL_MAJOR(__FreeBSD_version) + 1 == major) + device_printf(dev, + "Deprecated code (to be removed in FreeBSD %d): %s\n", + major, msg); +} + #ifdef DDB DB_SHOW_COMMAND(device, db_show_device) { Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Jan 29 00:00:52 2018 (r328521) +++ head/sys/sys/systm.h Mon Jan 29 00:14:39 2018 (r328522) @@ -464,6 +464,22 @@ void intr_prof_stack_use(struct thread *td, struct tra void counted_warning(unsigned *counter, const char *msg); +/* + * APIs to manage deprecation and obsolescence. + */ +struct device; +void _gone_in(int major, const char *msg); +void _gone_in_dev(struct device *dev, int major, const char *msg); +#ifdef NO_OBSOLETE_CODE +#define __gone_ok(m, msg) \ + _Static_assert(m < P_OSREL_MAJOR(__FreeBSD_version)), \ + "Obsolete code" msg); +#else +#define __gone_ok(m, msg) +#endif +#define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) +#define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) + __NULLABILITY_PRAGMA_POP #endif /* !_SYS_SYSTM_H_ */ From owner-svn-src-all@freebsd.org Mon Jan 29 00:14:48 2018 Return-Path: Delivered-To: svn-src-all@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 D001CEC716B; Mon, 29 Jan 2018 00:14: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 705637580A; Mon, 29 Jan 2018 00:14:47 +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 6AF0420BF6; Mon, 29 Jan 2018 00:14:47 +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 w0T0ElsZ034063; Mon, 29 Jan 2018 00:14:47 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T0Ek9d034052; Mon, 29 Jan 2018 00:14:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801290014.w0T0Ek9d034052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 29 Jan 2018 00:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328523 - in head/sys/dev: advansys aha aic buslogic dpt joy mse ncv nsp stg X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/dev: advansys aha aic buslogic dpt joy mse ncv nsp stg X-SVN-Commit-Revision: 328523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 00:14:48 -0000 Author: imp Date: Mon Jan 29 00:14:46 2018 New Revision: 328523 URL: https://svnweb.freebsd.org/changeset/base/328523 Log: Tag the current round of deprecated drivers. Differential Revision: https://reviews.freebsd.org/D13818 Modified: head/sys/dev/advansys/advansys.c head/sys/dev/advansys/adwcam.c head/sys/dev/aha/aha.c head/sys/dev/aic/aic.c head/sys/dev/buslogic/bt.c head/sys/dev/dpt/dpt_pci.c head/sys/dev/joy/joy.c head/sys/dev/mse/mse.c head/sys/dev/ncv/ncr53c500_pccard.c head/sys/dev/nsp/nsp_pccard.c head/sys/dev/stg/tmc18c30.c Modified: head/sys/dev/advansys/advansys.c ============================================================================== --- head/sys/dev/advansys/advansys.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/advansys/advansys.c Mon Jan 29 00:14:46 2018 (r328523) @@ -1399,6 +1399,8 @@ adv_attach(adv) csa.callback_arg = adv; xpt_action((union ccb *)&csa); mtx_unlock(&adv->lock); + gone_in_dev(adv->adv, 12, "adv(4) driver"); + return (0); } MODULE_DEPEND(adv, cam, 1, 1, 1); Modified: head/sys/dev/advansys/adwcam.c ============================================================================== --- head/sys/dev/advansys/adwcam.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/advansys/adwcam.c Mon Jan 29 00:14:46 2018 (r328523) @@ -1173,6 +1173,7 @@ adw_attach(struct adw_softc *adw) xpt_action((union ccb *)&csa); } + gone_in_dev(adv->adv, 12, "adw(4) driver"); fail: mtx_unlock(&adw->lock); return (error); Modified: head/sys/dev/aha/aha.c ============================================================================== --- head/sys/dev/aha/aha.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/aha/aha.c Mon Jan 29 00:14:46 2018 (r328523) @@ -620,6 +620,7 @@ aha_attach(struct aha_softc *aha) return (ENXIO); } mtx_unlock(&aha->lock); + gone_in_dev(aha->dev, 12, "aha(4) driver"); return (0); } Modified: head/sys/dev/aic/aic.c ============================================================================== --- head/sys/dev/aic/aic.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/aic/aic.c Mon Jan 29 00:14:46 2018 (r328523) @@ -1577,6 +1577,7 @@ aic_attach(struct aic_softc *aic) printf(", fast SCSI"); printf("\n"); mtx_unlock(&aic->lock); + gone_in_dev(aic->dev, 12, "aic(4) driver"); return (0); } Modified: head/sys/dev/buslogic/bt.c ============================================================================== --- head/sys/dev/buslogic/bt.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/buslogic/bt.c Mon Jan 29 00:14:46 2018 (r328523) @@ -905,6 +905,7 @@ bt_attach(device_t dev) device_printf(dev, "bus_setup_intr() failed: %d\n", error); return (error); } + gone_in_dev(dev, 12, "bt(4) driver"); return (0); } Modified: head/sys/dev/dpt/dpt_pci.c ============================================================================== --- head/sys/dev/dpt/dpt_pci.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/dpt/dpt_pci.c Mon Jan 29 00:14:46 2018 (r328523) @@ -157,6 +157,7 @@ dpt_pci_attach (device_t dev) error = ENXIO; goto bad; } + gone_in_dev(dev, 12, "dpt(4) driver"); return (error); Modified: head/sys/dev/joy/joy.c ============================================================================== --- head/sys/dev/joy/joy.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/joy/joy.c Mon Jan 29 00:14:46 2018 (r328523) @@ -110,6 +110,8 @@ joy_attach(device_t dev) joy->timeout[0] = joy->timeout[1] = 0; joy->d = make_dev(&joy_cdevsw, unit, 0, 0, 0600, "joy%d", unit); joy->d->si_drv1 = joy; + gone_in_dev(dev, 12, "joy(4) driver"); + return (0); } Modified: head/sys/dev/mse/mse.c ============================================================================== --- head/sys/dev/mse/mse.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/mse/mse.c Mon Jan 29 00:14:46 2018 (r328523) @@ -153,6 +153,8 @@ mse_common_attach(device_t dev) sc->sc_ndev = make_dev(&mse_cdevsw, 1, UID_ROOT, GID_WHEEL, 0600, "nmse%d", unit); sc->sc_ndev->si_drv1 = sc; + gone_in_dev(dev, 12, "mse(4) driver"); + return 0; } Modified: head/sys/dev/ncv/ncr53c500_pccard.c ============================================================================== --- head/sys/dev/ncv/ncr53c500_pccard.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/ncv/ncr53c500_pccard.c Mon Jan 29 00:14:46 2018 (r328523) @@ -263,6 +263,7 @@ ncv_pccard_attach(device_t dev) ncv_release_resource(dev); return(ENXIO); } + gone_in_dev(dev, 12, "ncv(4) driver"); return(0); } Modified: head/sys/dev/nsp/nsp_pccard.c ============================================================================== --- head/sys/dev/nsp/nsp_pccard.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/nsp/nsp_pccard.c Mon Jan 29 00:14:46 2018 (r328523) @@ -205,6 +205,7 @@ nsp_pccard_attach(device_t dev) nsp_release_resource(dev); return(ENXIO); } + gone_in_dev(dev, 12, "nsp(4) driver"); return(0); } Modified: head/sys/dev/stg/tmc18c30.c ============================================================================== --- head/sys/dev/stg/tmc18c30.c Mon Jan 29 00:14:39 2018 (r328522) +++ head/sys/dev/stg/tmc18c30.c Mon Jan 29 00:14:46 2018 (r328523) @@ -423,6 +423,7 @@ stgattachsubr(sc) (void) scsi_low_attach(slp, 0, STG_NTARGETS, STG_NLUNS, sizeof(struct stg_targ_info), 0); + gone_in(12, "stg(4) driver"); } /************************************************************** From owner-svn-src-all@freebsd.org Mon Jan 29 00:22:32 2018 Return-Path: Delivered-To: svn-src-all@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 81D76EC7A9F; Mon, 29 Jan 2018 00:22: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 3398075E19; Mon, 29 Jan 2018 00:22: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 2E83620D9F; Mon, 29 Jan 2018 00:22: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 w0T0MWX1038955; Mon, 29 Jan 2018 00:22:32 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T0MUL4038936; Mon, 29 Jan 2018 00:22:30 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801290022.w0T0MUL4038936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 29 Jan 2018 00:22:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328524 - in head/sys: amd64/amd64 dev/ata dev/atkbdc dev/sbni dev/sound/isa i386/i386 isa powerpc/mpc85xx sparc64/sparc64 x86/isa x86/pci x86/x86 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: amd64/amd64 dev/ata dev/atkbdc dev/sbni dev/sound/isa i386/i386 isa powerpc/mpc85xx sparc64/sparc64 x86/isa x86/pci x86/x86 X-SVN-Commit-Revision: 328524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 00:22:32 -0000 Author: imp Date: Mon Jan 29 00:22:30 2018 New Revision: 328524 URL: https://svnweb.freebsd.org/changeset/base/328524 Log: Add ISA PNP tables to ISA drivers. Fix a few incidental comments. ACPI ISA PBP tables not tagged, there's bigger issues with them. Modified: head/sys/amd64/amd64/fpu.c head/sys/dev/ata/ata-isa.c head/sys/dev/atkbdc/psm.c head/sys/dev/sbni/if_sbni_isa.c head/sys/dev/sound/isa/ess.c head/sys/dev/sound/isa/gusc.c head/sys/dev/sound/isa/mss.c head/sys/dev/sound/isa/sbc.c head/sys/i386/i386/npx.c head/sys/isa/vga_isa.c head/sys/powerpc/mpc85xx/atpic.c head/sys/sparc64/sparc64/rtc.c head/sys/x86/isa/atpic.c head/sys/x86/isa/atrtc.c head/sys/x86/isa/clock.c head/sys/x86/isa/isa_dma.c head/sys/x86/isa/orm.c head/sys/x86/pci/pci_bus.c head/sys/x86/x86/nexus.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/amd64/amd64/fpu.c Mon Jan 29 00:22:30 2018 (r328524) @@ -917,6 +917,7 @@ static driver_t fpupnp_driver = { static devclass_t fpupnp_devclass; DRIVER_MODULE(fpupnp, acpi, fpupnp_driver, fpupnp_devclass, 0, 0); +ISA_PNP_INFO(fpupnp_ids); #endif /* DEV_ISA */ static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", Modified: head/sys/dev/ata/ata-isa.c ============================================================================== --- head/sys/dev/ata/ata-isa.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/dev/ata/ata-isa.c Mon Jan 29 00:22:30 2018 (r328524) @@ -207,3 +207,4 @@ static driver_t ata_isa_driver = { DRIVER_MODULE(ata, isa, ata_isa_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); +ISA_PNP_INFO(ata_ids); Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/dev/atkbdc/psm.c Mon Jan 29 00:22:30 2018 (r328524) @@ -7186,5 +7186,5 @@ psmcpnp_attach(device_t dev) DRIVER_MODULE(psmcpnp, isa, psmcpnp_driver, psmcpnp_devclass, 0, 0); DRIVER_MODULE(psmcpnp, acpi, psmcpnp_driver, psmcpnp_devclass, 0, 0); - +ISA_PNP_INFO(psmcpnp_ids); #endif /* DEV_ISA */ Modified: head/sys/dev/sbni/if_sbni_isa.c ============================================================================== --- head/sys/dev/sbni/if_sbni_isa.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/dev/sbni/if_sbni_isa.c Mon Jan 29 00:22:30 2018 (r328524) @@ -166,3 +166,4 @@ sbni_attach_isa(device_t dev) DRIVER_MODULE(sbni, isa, sbni_isa_driver, sbni_isa_devclass, 0, 0); MODULE_DEPEND(sbni, isa, 1, 1, 1); +ISA_PNP_INFO(sbni_ids); Modified: head/sys/dev/sound/isa/ess.c ============================================================================== --- head/sys/dev/sound/isa/ess.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/dev/sound/isa/ess.c Mon Jan 29 00:22:30 2018 (r328524) @@ -1016,3 +1016,4 @@ static driver_t esscontrol_driver = { DRIVER_MODULE(esscontrol, isa, esscontrol_driver, esscontrol_devclass, 0, 0); DRIVER_MODULE(esscontrol, acpi, esscontrol_driver, esscontrol_devclass, 0, 0); +ISA_PNP_INFO(essc_ids); Modified: head/sys/dev/sound/isa/gusc.c ============================================================================== --- head/sys/dev/sound/isa/gusc.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/dev/sound/isa/gusc.c Mon Jan 29 00:22:30 2018 (r328524) @@ -673,5 +673,4 @@ DRIVER_MODULE(snd_gusc, isa, gusc_driver, gusc_devclas DRIVER_MODULE(snd_gusc, acpi, gusc_driver, gusc_devclass, 0, 0); MODULE_DEPEND(snd_gusc, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); MODULE_VERSION(snd_gusc, 1); - - +ISA_PNP_INFO(gusc_ids); Modified: head/sys/dev/sound/isa/mss.c ============================================================================== --- head/sys/dev/sound/isa/mss.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/dev/sound/isa/mss.c Mon Jan 29 00:22:30 2018 (r328524) @@ -2293,5 +2293,4 @@ static driver_t guspcm_driver = { DRIVER_MODULE(snd_guspcm, gusc, guspcm_driver, pcm_devclass, 0, 0); MODULE_DEPEND(snd_guspcm, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); MODULE_VERSION(snd_guspcm, 1); - - +ISA_PNP_INFO(pnpmss_ids); Modified: head/sys/dev/sound/isa/sbc.c ============================================================================== --- head/sys/dev/sound/isa/sbc.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/dev/sound/isa/sbc.c Mon Jan 29 00:22:30 2018 (r328524) @@ -750,3 +750,4 @@ DRIVER_MODULE(snd_sbc, isa, sbc_driver, sbc_devclass, DRIVER_MODULE(snd_sbc, acpi, sbc_driver, sbc_devclass, 0, 0); MODULE_DEPEND(snd_sbc, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); MODULE_VERSION(snd_sbc, 1); +ISA_PNP_INFO(sbc_ids); Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/i386/i386/npx.c Mon Jan 29 00:22:30 2018 (r328524) @@ -1277,6 +1277,7 @@ static devclass_t npxisa_devclass; DRIVER_MODULE(npxisa, isa, npxisa_driver, npxisa_devclass, 0, 0); DRIVER_MODULE(npxisa, acpi, npxisa_driver, npxisa_devclass, 0, 0); +ISA_PNP_INFO(npxisa_ids); #endif /* DEV_ISA */ static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", Modified: head/sys/isa/vga_isa.c ============================================================================== --- head/sys/isa/vga_isa.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/isa/vga_isa.c Mon Jan 29 00:22:30 2018 (r328524) @@ -61,6 +61,13 @@ __FBSDID("$FreeBSD$"); #include #include +#define VGA_ID 0x0009d041 /* PNP0900 */ + +static struct isa_pnp_id vga_ids[] = { + { VGA_ID, NULL }, /* PNP0900 */ + { 0, NULL }, +}; + static void vga_suspend(device_t dev) { @@ -175,7 +182,8 @@ isavga_probe(device_t dev) adp.va_io_base, adp.va_io_size); bus_set_resource(dev, SYS_RES_MEMORY, 0, adp.va_mem_base, adp.va_mem_size); - isa_set_vendorid(dev, PNP_EISAID("PNP0900")); + isa_set_vendorid(dev, VGA_ID); + isa_set_logicalid(dev, VGA_ID); #if 0 isa_set_port(dev, adp.va_io_base); isa_set_portsize(dev, adp.va_io_size); @@ -383,3 +391,4 @@ static driver_t vgapm_driver = { }; DRIVER_MODULE(vgapm, vgapci, vgapm_driver, vgapm_devclass, 0, 0); +ISA_PNP_INFO(vga_ids); Modified: head/sys/powerpc/mpc85xx/atpic.c ============================================================================== --- head/sys/powerpc/mpc85xx/atpic.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/powerpc/mpc85xx/atpic.c Mon Jan 29 00:22:30 2018 (r328524) @@ -112,13 +112,14 @@ static driver_t atpic_isa_driver = { static devclass_t atpic_devclass; -DRIVER_MODULE(atpic, isa, atpic_isa_driver, atpic_devclass, 0, 0); - static struct isa_pnp_id atpic_ids[] = { { 0x0000d041 /* PNP0000 */, "AT interrupt controller" }, { 0 } }; +DRIVER_MODULE(atpic, isa, atpic_isa_driver, atpic_devclass, 0, 0); +ISA_PNP_INFO(atpic_ids); + static __inline uint8_t atpic_read(struct atpic_softc *sc, int icu, int ofs) { @@ -363,4 +364,3 @@ atpic_ofw_translate_code(device_t dev, u_int irq, int *pol = INTR_POLARITY_CONFORM; } } - Modified: head/sys/sparc64/sparc64/rtc.c ============================================================================== --- head/sys/sparc64/sparc64/rtc.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/sparc64/sparc64/rtc.c Mon Jan 29 00:22:30 2018 (r328524) @@ -122,7 +122,13 @@ static driver_t rtc_isa_driver = { sizeof(struct mc146818_softc), }; +static struct isa_pnp_id rtc_isa_ids[] = { + { 0x000bd041, RTC_DESC }, /* PNP0B00 */ + { 0 } +}; + DRIVER_MODULE(rtc, isa, rtc_isa_driver, rtc_devclass, 0, 0); +ISA_PNP_INFO(rtc_isa_ids); #endif static u_int pc87317_getcent(device_t dev); @@ -145,11 +151,6 @@ rtc_ebus_probe(device_t dev) } #ifdef DEV_ISA -static struct isa_pnp_id rtc_isa_ids[] = { - { 0x000bd041, RTC_DESC }, /* PNP0B00 */ - { 0 } -}; - static int rtc_isa_probe(device_t dev) { Modified: head/sys/x86/isa/atpic.c ============================================================================== --- head/sys/x86/isa/atpic.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/x86/isa/atpic.c Mon Jan 29 00:22:30 2018 (r328524) @@ -565,6 +565,21 @@ atpic_attach(device_t dev) return (0); } +/* + * Return a bitmap of the current interrupt requests. This is 8259-specific + * and is only suitable for use at probe time. + */ +intrmask_t +isa_irq_pending(void) +{ + u_char irr1; + u_char irr2; + + irr1 = inb(IO_ICU1); + irr2 = inb(IO_ICU2); + return ((irr2 << 8) | irr1); +} + static device_method_t atpic_methods[] = { /* Device interface */ DEVMETHOD(device_probe, atpic_probe), @@ -586,19 +601,5 @@ static devclass_t atpic_devclass; DRIVER_MODULE(atpic, isa, atpic_driver, atpic_devclass, 0, 0); DRIVER_MODULE(atpic, acpi, atpic_driver, atpic_devclass, 0, 0); - -/* - * Return a bitmap of the current interrupt requests. This is 8259-specific - * and is only suitable for use at probe time. - */ -intrmask_t -isa_irq_pending(void) -{ - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); -} +ISA_PNP_INFO(atpic_ids); #endif /* DEV_ISA */ Modified: head/sys/x86/isa/atrtc.c ============================================================================== --- head/sys/x86/isa/atrtc.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/x86/isa/atrtc.c Mon Jan 29 00:22:30 2018 (r328524) @@ -415,6 +415,7 @@ static devclass_t atrtc_devclass; DRIVER_MODULE(atrtc, isa, atrtc_driver, atrtc_devclass, 0, 0); DRIVER_MODULE(atrtc, acpi, atrtc_driver, atrtc_devclass, 0, 0); +ISA_PNP_INFO(atrtc_ids); #include "opt_ddb.h" #ifdef DDB Modified: head/sys/x86/isa/clock.c ============================================================================== --- head/sys/x86/isa/clock.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/x86/isa/clock.c Mon Jan 29 00:22:30 2018 (r328524) @@ -667,5 +667,6 @@ static devclass_t attimer_devclass; DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0); DRIVER_MODULE(attimer, acpi, attimer_driver, attimer_devclass, 0, 0); +ISA_PNP_INFO(attimer_ids); #endif /* DEV_ISA */ Modified: head/sys/x86/isa/isa_dma.c ============================================================================== --- head/sys/x86/isa/isa_dma.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/x86/isa/isa_dma.c Mon Jan 29 00:22:30 2018 (r328524) @@ -612,3 +612,4 @@ static devclass_t atdma_devclass; DRIVER_MODULE(atdma, isa, atdma_driver, atdma_devclass, 0, 0); DRIVER_MODULE(atdma, acpi, atdma_driver, atdma_devclass, 0, 0); +ISA_PNP_INFO(atdma_ids); Modified: head/sys/x86/isa/orm.c ============================================================================== --- head/sys/x86/isa/orm.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/x86/isa/orm.c Mon Jan 29 00:22:30 2018 (r328524) @@ -188,3 +188,4 @@ static driver_t orm_driver = { static devclass_t orm_devclass; DRIVER_MODULE(orm, isa, orm_driver, orm_devclass, 0, 0); +ISA_PNP_INFO(orm_ids); Modified: head/sys/x86/pci/pci_bus.c ============================================================================== --- head/sys/x86/pci/pci_bus.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/x86/pci/pci_bus.c Mon Jan 29 00:22:30 2018 (r328524) @@ -683,8 +683,7 @@ DRIVER_MODULE(pcib, legacy, legacy_pcib_driver, hostb_ * ID is available and the PCI BIOS isn't, but for now we just * eat the PnP ID and do nothing else. * - * XXX we should silence this probe, as it will generally confuse - * people. + * we silence this probe, as it will generally confuse people. */ static struct isa_pnp_id pcibus_pnp_ids[] = { { 0x030ad041 /* PNP0A03 */, "PCI Bus" }, @@ -747,6 +746,7 @@ static devclass_t pcib_devclass; DEFINE_CLASS_1(pcib, pcibios_pcib_driver, pcibios_pcib_pci_methods, sizeof(struct pcib_softc), pcib_driver); DRIVER_MODULE(pcibios_pcib, pci, pcibios_pcib_driver, pcib_devclass, 0, 0); +ISA_PNP_INFO(pcibus_pnp_ids); static int pcibios_pcib_probe(device_t dev) Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Mon Jan 29 00:14:46 2018 (r328523) +++ head/sys/x86/x86/nexus.c Mon Jan 29 00:22:30 2018 (r328524) @@ -901,4 +901,5 @@ static driver_t sysresource_driver = { static devclass_t sysresource_devclass; DRIVER_MODULE(sysresource, isa, sysresource_driver, sysresource_devclass, 0, 0); +ISA_PNP_INFO(sysresource_ids); #endif /* DEV_ISA */ From owner-svn-src-all@freebsd.org Mon Jan 29 01:05:57 2018 Return-Path: Delivered-To: svn-src-all@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 CAF88ECA329; Mon, 29 Jan 2018 01:05:57 +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 7B3BA77819; Mon, 29 Jan 2018 01:05:57 +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 7239E213F4; Mon, 29 Jan 2018 01:05:57 +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 w0T15vD5058630; Mon, 29 Jan 2018 01:05:57 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T15vRR058629; Mon, 29 Jan 2018 01:05:57 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801290105.w0T15vRR058629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 29 Jan 2018 01:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328525 - head/contrib/tnftp/src X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/contrib/tnftp/src X-SVN-Commit-Revision: 328525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 01:05:58 -0000 Author: pfg Date: Mon Jan 29 01:05:57 2018 New Revision: 328525 URL: https://svnweb.freebsd.org/changeset/base/328525 Log: ftp(1): Use closefrom() instead of individual close()s. Use closefrom(3) instead of manually closing all file descriptors between 3 and 19. Obtained from: OpenBSD (CVS 1.80) Modified: head/contrib/tnftp/src/cmds.c Modified: head/contrib/tnftp/src/cmds.c ============================================================================== --- head/contrib/tnftp/src/cmds.c Mon Jan 29 00:22:30 2018 (r328524) +++ head/contrib/tnftp/src/cmds.c Mon Jan 29 01:05:57 2018 (r328525) @@ -1438,8 +1438,7 @@ shell(int argc, char *argv[]) } oldintr = xsignal(SIGINT, SIG_IGN); if ((pid = fork()) == 0) { - for (pid = 3; pid < 20; pid++) - (void)close(pid); + (void)closefrom(3); (void)xsignal(SIGINT, SIG_DFL); shellp = getenv("SHELL"); if (shellp == NULL) From owner-svn-src-all@freebsd.org Mon Jan 29 01:59:05 2018 Return-Path: Delivered-To: svn-src-all@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 915E0ECD028; Mon, 29 Jan 2018 01:59:05 +0000 (UTC) (envelope-from emaste@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 4691B7922B; Mon, 29 Jan 2018 01:59:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4186021BCF; Mon, 29 Jan 2018 01:59:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T1x5A5083540; Mon, 29 Jan 2018 01:59:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T1x5TN083539; Mon, 29 Jan 2018 01:59:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801290159.w0T1x5TN083539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 01:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328526 - head/sys/modules/linux64 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/modules/linux64 X-SVN-Commit-Revision: 328526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 01:59:05 -0000 Author: emaste Date: Mon Jan 29 01:59:04 2018 New Revision: 328526 URL: https://svnweb.freebsd.org/changeset/base/328526 Log: Correct MD patch in linux64 module Makefile Reviewed by: imp Sponsored by: Turing Robotic Industries Inc. Differential Revision: https://reviews.freebsd.org/D14061 Modified: head/sys/modules/linux64/Makefile Modified: head/sys/modules/linux64/Makefile ============================================================================== --- head/sys/modules/linux64/Makefile Mon Jan 29 01:05:57 2018 (r328525) +++ head/sys/modules/linux64/Makefile Mon Jan 29 01:59:04 2018 (r328526) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE_ARCH}/linux +.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux VDSO= linux_vdso @@ -31,7 +31,7 @@ linux_assym.h: linux_genassym.o linux_locore.o: linux_locore.s linux_assym.h ${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small \ -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc \ - -Wl,-T${SRCTOP}/sys/${MACHINE_CPUARCH}/linux/${VDSO}.lds.s \ + -Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s \ -Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib \ ${.IMPSRC} -o ${.TARGET} From owner-svn-src-all@freebsd.org Mon Jan 29 02:29:09 2018 Return-Path: Delivered-To: svn-src-all@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 A8099ECE59C; Mon, 29 Jan 2018 02:29:09 +0000 (UTC) (envelope-from lwhsu@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 4E02F7A029; Mon, 29 Jan 2018 02:29:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40D772209C; Mon, 29 Jan 2018 02:29:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T2T99v098116; Mon, 29 Jan 2018 02:29:09 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T2T9sO098115; Mon, 29 Jan 2018 02:29:09 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201801290229.w0T2T9sO098115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 29 Jan 2018 02:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328527 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 02:29:09 -0000 Author: lwhsu (ports committer) Date: Mon Jan 29 02:29:08 2018 New Revision: 328527 URL: https://svnweb.freebsd.org/changeset/base/328527 Log: Fix LINT build after r328508, add forgotten part in format string Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D14089 Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Mon Jan 29 01:59:04 2018 (r328526) +++ head/sys/kern/subr_bus.c Mon Jan 29 02:29:08 2018 (r328527) @@ -5051,7 +5051,7 @@ print_device_short(device_t dev, int indent) if (!dev) return; - indentprintf(("device %d: <%s> %sparent,%schildren,%s%s%s%s%s,%sivars,%ssoftc,busy=%d\n", + indentprintf(("device %d: <%s> %sparent,%schildren,%s%s%s%s%s%s,%sivars,%ssoftc,busy=%d\n", dev->unit, dev->desc, (dev->parent? "":"no "), (TAILQ_EMPTY(&dev->children)? "no ":""), From owner-svn-src-all@freebsd.org Mon Jan 29 03:24:03 2018 Return-Path: Delivered-To: svn-src-all@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 02D7AED13EB; Mon, 29 Jan 2018 03:24:03 +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 A42B27C4F8; Mon, 29 Jan 2018 03:24:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BFB222AC8; Mon, 29 Jan 2018 03:24:02 +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 w0T3O22w028866; Mon, 29 Jan 2018 03:24:02 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T3O2DN028864; Mon, 29 Jan 2018 03:24:02 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801290324.w0T3O2DN028864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 29 Jan 2018 03:24:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328528 - in head/sys/dev/usb: . quirk X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/dev/usb: . quirk X-SVN-Commit-Revision: 328528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 03:24:03 -0000 Author: ian Date: Mon Jan 29 03:24:02 2018 New Revision: 328528 URL: https://svnweb.freebsd.org/changeset/base/328528 Log: Add a NO_GETMAXLUN quirk for the JMicron JMS567 USB to SATA bridge, to prevent lengthy timeout pauses while probing/attaching drives. Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Mon Jan 29 02:29:08 2018 (r328527) +++ head/sys/dev/usb/quirk/usb_quirk.c Mon Jan 29 03:24:02 2018 (r328528) @@ -244,6 +244,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ + USB_QUIRK(JMICRON, JMS567, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Jan 29 02:29:08 2018 (r328527) +++ head/sys/dev/usb/usbdevs Mon Jan 29 03:24:02 2018 (r328528) @@ -2580,6 +2580,7 @@ product JATON EDA 0x5704 Ethernet product JETI SPC1201 0x04b2 FTDI compatible adapter /* JMicron products */ +product JMICRON JMS567 0x0567 USB to SATA 6.0Gb/s bridge product JMICRON JM20336 0x2336 USB to SATA Bridge product JMICRON JM20337 0x2338 USB to ATA/ATAPI Bridge From owner-svn-src-all@freebsd.org Mon Jan 29 04:04:53 2018 Return-Path: Delivered-To: svn-src-all@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 AC961ED2FBD; Mon, 29 Jan 2018 04:04:53 +0000 (UTC) (envelope-from lwhsu@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 5F89B7D923; Mon, 29 Jan 2018 04:04:53 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A8AE23136; Mon, 29 Jan 2018 04:04:53 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T44rvN048795; Mon, 29 Jan 2018 04:04:53 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T44rLA048793; Mon, 29 Jan 2018 04:04:53 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201801290404.w0T44rLA048793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 29 Jan 2018 04:04:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328529 - head/sys/dev/advansys X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/advansys X-SVN-Commit-Revision: 328529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 04:04:53 -0000 Author: lwhsu (ports committer) Date: Mon Jan 29 04:04:52 2018 New Revision: 328529 URL: https://svnweb.freebsd.org/changeset/base/328529 Log: Fix kernel build after r328523, correct variable names Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D14105 Modified: head/sys/dev/advansys/advansys.c head/sys/dev/advansys/adwcam.c Modified: head/sys/dev/advansys/advansys.c ============================================================================== --- head/sys/dev/advansys/advansys.c Mon Jan 29 03:24:02 2018 (r328528) +++ head/sys/dev/advansys/advansys.c Mon Jan 29 04:04:52 2018 (r328529) @@ -1399,7 +1399,7 @@ adv_attach(adv) csa.callback_arg = adv; xpt_action((union ccb *)&csa); mtx_unlock(&adv->lock); - gone_in_dev(adv->adv, 12, "adv(4) driver"); + gone_in_dev(adv->dev, 12, "adv(4) driver"); return (0); } Modified: head/sys/dev/advansys/adwcam.c ============================================================================== --- head/sys/dev/advansys/adwcam.c Mon Jan 29 03:24:02 2018 (r328528) +++ head/sys/dev/advansys/adwcam.c Mon Jan 29 04:04:52 2018 (r328529) @@ -1173,7 +1173,7 @@ adw_attach(struct adw_softc *adw) xpt_action((union ccb *)&csa); } - gone_in_dev(adv->adv, 12, "adw(4) driver"); + gone_in_dev(adw->device, 12, "adw(4) driver"); fail: mtx_unlock(&adw->lock); return (error); From owner-svn-src-all@freebsd.org Mon Jan 29 04:33:42 2018 Return-Path: Delivered-To: svn-src-all@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 A3CA9ED44A1; Mon, 29 Jan 2018 04:33:42 +0000 (UTC) (envelope-from nwhitehorn@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 53F4E7E6EE; Mon, 29 Jan 2018 04:33:42 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4DB6F235E3; Mon, 29 Jan 2018 04:33:42 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T4XgKD063848; Mon, 29 Jan 2018 04:33:42 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T4XfxJ063841; Mon, 29 Jan 2018 04:33:41 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201801290433.w0T4XfxJ063841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 29 Jan 2018 04:33:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328530 - in head/sys/powerpc: aim booke include powerpc X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: in head/sys/powerpc: aim booke include powerpc X-SVN-Commit-Revision: 328530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 04:33:42 -0000 Author: nwhitehorn Date: Mon Jan 29 04:33:41 2018 New Revision: 328530 URL: https://svnweb.freebsd.org/changeset/base/328530 Log: Remove hard-coded trap-handling logic involving the segmented memory model used with hashed page tables on AIM and place it into a new, modular pmap function called pmap_decode_kernel_ptr(). This function is the inverse of pmap_map_user_ptr(). With POWER9 radix tables, which mapping to use becomes more complex than just AIM/BOOKE and it is best to have it in the same place as pmap_map_user_ptr(). Reviewed by: jhibbits Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/pmap.h head/sys/powerpc/powerpc/mmu_if.m head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Mon Jan 29 04:04:52 2018 (r328529) +++ head/sys/powerpc/aim/mmu_oea.c Mon Jan 29 04:33:41 2018 (r328530) @@ -322,6 +322,8 @@ vm_offset_t moea_quick_enter_page(mmu_t mmu, vm_page_t void moea_quick_remove_page(mmu_t mmu, vm_offset_t addr); static int moea_map_user_ptr(mmu_t mmu, pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen); +static int moea_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, + int *is_user, vm_offset_t *decoded_addr); static mmu_method_t moea_methods[] = { @@ -374,6 +376,7 @@ static mmu_method_t moea_methods[] = { MMUMETHOD(mmu_scan_init, moea_scan_init), MMUMETHOD(mmu_dumpsys_map, moea_dumpsys_map), MMUMETHOD(mmu_map_user_ptr, moea_map_user_ptr), + MMUMETHOD(mmu_decode_kernel_ptr, moea_decode_kernel_ptr), { 0, 0 } }; @@ -1583,6 +1586,31 @@ moea_map_user_ptr(mmu_t mmu, pmap_t pm, volatile const (uintptr_t)uaddr >> ADDR_SR_SHFT; curthread->td_pcb->pcb_cpu.aim.usr_vsid = vsid; __asm __volatile("mtsr %0,%1; isync" :: "n"(USER_SR), "r"(vsid)); + + return (0); +} + +/* + * Figure out where a given kernel pointer (usually in a fault) points + * to from the VM's perspective, potentially remapping into userland's + * address space. + */ +static int +moea_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, int *is_user, + vm_offset_t *decoded_addr) +{ + vm_offset_t user_sr; + + if ((addr >> ADDR_SR_SHFT) == (USER_ADDR >> ADDR_SR_SHFT)) { + user_sr = curthread->td_pcb->pcb_cpu.aim.usr_segm; + addr &= ADDR_PIDX | ADDR_POFF; + addr |= user_sr << ADDR_SR_SHFT; + *decoded_addr = addr; + *is_user = 1; + } else { + *decoded_addr = addr; + *is_user = 0; + } return (0); } Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Jan 29 04:04:52 2018 (r328529) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Jan 29 04:33:41 2018 (r328530) @@ -288,6 +288,8 @@ vm_offset_t moea64_quick_enter_page(mmu_t mmu, vm_page void moea64_quick_remove_page(mmu_t mmu, vm_offset_t addr); static int moea64_map_user_ptr(mmu_t mmu, pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen); +static int moea64_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, + int *is_user, vm_offset_t *decoded_addr); static mmu_method_t moea64_methods[] = { @@ -339,6 +341,7 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_scan_init, moea64_scan_init), MMUMETHOD(mmu_dumpsys_map, moea64_dumpsys_map), MMUMETHOD(mmu_map_user_ptr, moea64_map_user_ptr), + MMUMETHOD(mmu_decode_kernel_ptr, moea64_decode_kernel_ptr), { 0, 0 } }; @@ -1905,6 +1908,31 @@ moea64_map_user_ptr(mmu_t mmu, pmap_t pm, volatile con #else __asm __volatile("mtsr %0,%1; isync" :: "n"(USER_SR), "r"(slbv)); #endif + + return (0); +} + +/* + * Figure out where a given kernel pointer (usually in a fault) points + * to from the VM's perspective, potentially remapping into userland's + * address space. + */ +static int +moea64_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, int *is_user, + vm_offset_t *decoded_addr) +{ + vm_offset_t user_sr; + + if ((addr >> ADDR_SR_SHFT) == (USER_ADDR >> ADDR_SR_SHFT)) { + user_sr = curthread->td_pcb->pcb_cpu.aim.usr_segm; + addr &= ADDR_PIDX | ADDR_POFF; + addr |= user_sr << ADDR_SR_SHFT; + *decoded_addr = addr; + *is_user = 1; + } else { + *decoded_addr = addr; + *is_user = 0; + } return (0); } Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Mon Jan 29 04:04:52 2018 (r328529) +++ head/sys/powerpc/booke/pmap.c Mon Jan 29 04:33:41 2018 (r328530) @@ -382,6 +382,8 @@ static int mmu_booke_change_attr(mmu_t mmu, vm_offset vm_size_t sz, vm_memattr_t mode); static int mmu_booke_map_user_ptr(mmu_t mmu, pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen); +static int mmu_booke_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, + int *is_user, vm_offset_t *decoded_addr); static mmu_method_t mmu_booke_methods[] = { @@ -436,6 +438,7 @@ static mmu_method_t mmu_booke_methods[] = { MMUMETHOD(mmu_unmapdev, mmu_booke_unmapdev), MMUMETHOD(mmu_change_attr, mmu_booke_change_attr), MMUMETHOD(mmu_map_user_ptr, mmu_booke_map_user_ptr), + MMUMETHOD(mmu_decode_kernel_ptr, mmu_booke_decode_kernel_ptr), /* dumpsys() support */ MMUMETHOD(mmu_dumpsys_map, mmu_booke_dumpsys_map), @@ -2288,6 +2291,25 @@ mmu_booke_map_user_ptr(mmu_t mmu, pmap_t pm, volatile if (klen) *klen = ulen; + return (0); +} + +/* + * Figure out where a given kernel pointer (usually in a fault) points + * to from the VM's perspective, potentially remapping into userland's + * address space. + */ +static int +mmu_booke_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, int *is_user, + vm_offset_t *decoded_addr) +{ + + if (addr < VM_MAXUSER_ADDRESS) + *is_user = 1; + else + *is_user = 0; + + *decoded_addr = addr; return (0); } Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Mon Jan 29 04:04:52 2018 (r328529) +++ head/sys/powerpc/include/pmap.h Mon Jan 29 04:33:41 2018 (r328530) @@ -262,6 +262,8 @@ void pmap_page_set_memattr(vm_page_t, vm_memattr_t); int pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t); int pmap_map_user_ptr(pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen); +int pmap_decode_kernel_ptr(vm_offset_t addr, int *is_user, + vm_offset_t *decoded_addr); void pmap_deactivate(struct thread *); vm_paddr_t pmap_kextract(vm_offset_t); int pmap_dev_direct_mapped(vm_paddr_t, vm_size_t); Modified: head/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- head/sys/powerpc/powerpc/mmu_if.m Mon Jan 29 04:04:52 2018 (r328529) +++ head/sys/powerpc/powerpc/mmu_if.m Mon Jan 29 04:33:41 2018 (r328530) @@ -840,6 +840,21 @@ METHOD int map_user_ptr { }; /** + * @brief Decode a kernel pointer, as visible to the current thread, + * by setting whether it corresponds to a user or kernel address and + * the address in the respective memory maps to which the address as + * seen in the kernel corresponds. This is essentially the inverse of + * MMU_MAP_USER_PTR() above and is used in kernel-space fault handling. + * Returns 0 on success or EFAULT if the address could not be mapped. + */ +METHOD int decode_kernel_ptr { + mmu_t _mmu; + vm_offset_t addr; + int *is_user; + vm_offset_t *decoded_addr; +}; + +/** * @brief Reverse-map a kernel virtual address * * @param _va kernel virtual address to reverse-map @@ -998,3 +1013,4 @@ METHOD int change_attr { vm_size_t _sz; vm_memattr_t _mode; } DEFAULT mmu_null_change_attr; + Modified: head/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- head/sys/powerpc/powerpc/pmap_dispatch.c Mon Jan 29 04:04:52 2018 (r328529) +++ head/sys/powerpc/powerpc/pmap_dispatch.c Mon Jan 29 04:33:41 2018 (r328530) @@ -520,6 +520,14 @@ pmap_map_user_ptr(pmap_t pm, volatile const void *uadd return (MMU_MAP_USER_PTR(mmu_obj, pm, uaddr, kaddr, ulen, klen)); } +int +pmap_decode_kernel_ptr(vm_offset_t addr, int *is_user, vm_offset_t *decoded) +{ + + CTR2(KTR_PMAP, "%s(%#jx)", __func__, (uintmax_t)addr); + return (MMU_DECODE_KERNEL_PTR(mmu_obj, addr, is_user, decoded)); +} + boolean_t pmap_dev_direct_mapped(vm_paddr_t pa, vm_size_t size) { Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Mon Jan 29 04:04:52 2018 (r328529) +++ head/sys/powerpc/powerpc/trap.c Mon Jan 29 04:33:41 2018 (r328530) @@ -393,7 +393,8 @@ trap(struct trapframe *frame) break; #if defined(__powerpc64__) && defined(AIM) case EXC_DSE: - if ((frame->dar & SEGMENT_MASK) == USER_ADDR) { + if (td->td_pcb->pcb_cpu.aim.usr_vsid != 0 && + (frame->dar & SEGMENT_MASK) == USER_ADDR) { __asm __volatile ("slbmte %0, %1" :: "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE)); @@ -731,10 +732,7 @@ trap_pfault(struct trapframe *frame, int user) struct proc *p; vm_map_t map; vm_prot_t ftype; - int rv; -#ifdef AIM - register_t user_sr; -#endif + int rv, is_user; td = curthread; p = td->td_proc; @@ -759,21 +757,14 @@ trap_pfault(struct trapframe *frame, int user) KASSERT(p->p_vmspace != NULL, ("trap_pfault: vmspace NULL")); map = &p->p_vmspace->vm_map; } else { -#ifdef BOOKE - if (eva < VM_MAXUSER_ADDRESS) { -#else - if ((eva >> ADDR_SR_SHFT) == (USER_ADDR >> ADDR_SR_SHFT)) { -#endif - map = &p->p_vmspace->vm_map; + rv = pmap_decode_kernel_ptr(eva, &is_user, &eva); + if (rv != 0) + return (SIGSEGV); -#ifdef AIM - user_sr = td->td_pcb->pcb_cpu.aim.usr_segm; - eva &= ADDR_PIDX | ADDR_POFF; - eva |= user_sr << ADDR_SR_SHFT; -#endif - } else { + if (is_user) + map = &p->p_vmspace->vm_map; + else map = kernel_map; - } } va = trunc_page(eva); From owner-svn-src-all@freebsd.org Mon Jan 29 04:38:12 2018 Return-Path: Delivered-To: svn-src-all@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 6FD75ED4735; Mon, 29 Jan 2018 04:38:12 +0000 (UTC) (envelope-from oshogbo@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 219417E8D2; Mon, 29 Jan 2018 04:38:12 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1BEFA235E5; Mon, 29 Jan 2018 04:38:12 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T4cBk2064082; Mon, 29 Jan 2018 04:38:11 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T4cBt4064080; Mon, 29 Jan 2018 04:38:11 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801290438.w0T4cBt4064080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 29 Jan 2018 04:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328531 - head/lib/libcasper/services/cap_syslog X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_syslog X-SVN-Commit-Revision: 328531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 04:38:12 -0000 Author: oshogbo Date: Mon Jan 29 04:38:11 2018 New Revision: 328531 URL: https://svnweb.freebsd.org/changeset/base/328531 Log: Document the syslog Casper service. Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14084 Added: head/lib/libcasper/services/cap_syslog/cap_syslog.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_syslog/Makefile Modified: head/lib/libcasper/services/cap_syslog/Makefile ============================================================================== --- head/lib/libcasper/services/cap_syslog/Makefile Mon Jan 29 04:33:41 2018 (r328530) +++ head/lib/libcasper/services/cap_syslog/Makefile Mon Jan 29 04:38:11 2018 (r328531) @@ -21,4 +21,13 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +MAN+= cap_syslog.3 + +MLINKS+= cap_syslog.3 libcap_syslog.3 +MLINKS+= cap_syslog.3 cap_syslog.3 +MLINKS+= cap_syslog.3 cap_vsyslog.3 +MLINKS+= cap_syslog.3 cap_openlog.3 +MLINKS+= cap_syslog.3 cap_closelog.3 +MLINKS+= cap_syslog.3 cap_setlogmask.3 + .include Added: head/lib/libcasper/services/cap_syslog/cap_syslog.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_syslog/cap_syslog.3 Mon Jan 29 04:38:11 2018 (r328531) @@ -0,0 +1,107 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" 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 AUTHORS 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 AUTHORS 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 January 28, 2018 +.Dt CAP_SYSLOG 3 +.Os +.Sh NAME +.Nm cap_syslog +.Nm cap_vsyslog +.Nm cap_openlog +.Nm cap_closelog +.Nm cap_setlogmask +.Nd "library for syslog in capability mode" +.Sh LIBRARY +.Lb libcap_syslog +.Sh SYNOPSIS +.In libcasper.h +.In casper/cap_syslog.h +.Ft void +.Fn cap_syslog "cap_channel_t *chan" "int pri" "const char *fmt" "..." +.Ft void +.Fn cap_vsyslog "cap_channel_t *chan" "int priority" "const char *fmt" "va_list ap" +.Ft void +.Fn cap_openlog "cap_channel_t *chan" "const char *ident" "int logopt" "int facility" +.Ft void +.Fn cap_closelog "cap_channel_t *chan" +.Ft int +.Fn cap_setlogmask "cap_channel_t *chan" "int maskpri" +.Sh DESCRIPTION +The functions +.Fn cap_syslog +.Fn cap_vsyslog +.Fn cap_openlog +.Fn cap_closelog +.Fn cap_setlogmask +are respectively equivalent to +.Xr syslog 3 , +.Xr vsyslog 3 , +.Xr openlog 3 , +.Xr closelog 3 , +.Xr setlogmask 3 +except that the connection to the +.Nm system.syslog +service needs to be provided. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.syslog +casper service to log messages. +.Bd -literal +cap_channel_t *capcas, *capsyslog; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.syslog service. */ +capsyslog = cap_service_open(capcas, "system.syslog"); +if (capsyslog == NULL) + err(1, "Unable to open system.syslog service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Let's log something. */ +cap_syslog(capsyslog, LOG_NOTICE, "System logs from capability mode."); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr closelog 3 , +.Xr err 3 , +.Xr nv 3 , +.Xr openlog 3 , +.Xr setlogmask 3 +.Xr syslog 3 , +.Xr vsyslog 3 , +.Xr capsicum 4 +.Sh AUTHORS +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org From owner-svn-src-all@freebsd.org Mon Jan 29 05:29:29 2018 Return-Path: Delivered-To: svn-src-all@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 8C341ED66BF; Mon, 29 Jan 2018 05:29:29 +0000 (UTC) (envelope-from oshogbo@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 3504D7FD65; Mon, 29 Jan 2018 05:29:29 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 279FF23DE5; Mon, 29 Jan 2018 05:29:29 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T5TSRx088714; Mon, 29 Jan 2018 05:29:28 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T5TSgg088713; Mon, 29 Jan 2018 05:29:28 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801290529.w0T5TSgg088713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 29 Jan 2018 05:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328532 - head/lib/libcasper/services/cap_syslog X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_syslog X-SVN-Commit-Revision: 328532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 05:29:29 -0000 Author: oshogbo Date: Mon Jan 29 05:29:28 2018 New Revision: 328532 URL: https://svnweb.freebsd.org/changeset/base/328532 Log: The name of the library is exactly the same like one of name the name of the functions. We should not create MLINKS for that one, because it's break a build. Submitted by: lwhsu@ Modified: head/lib/libcasper/services/cap_syslog/Makefile Modified: head/lib/libcasper/services/cap_syslog/Makefile ============================================================================== --- head/lib/libcasper/services/cap_syslog/Makefile Mon Jan 29 04:38:11 2018 (r328531) +++ head/lib/libcasper/services/cap_syslog/Makefile Mon Jan 29 05:29:28 2018 (r328532) @@ -24,7 +24,6 @@ CFLAGS+=-I${.CURDIR} MAN+= cap_syslog.3 MLINKS+= cap_syslog.3 libcap_syslog.3 -MLINKS+= cap_syslog.3 cap_syslog.3 MLINKS+= cap_syslog.3 cap_vsyslog.3 MLINKS+= cap_syslog.3 cap_openlog.3 MLINKS+= cap_syslog.3 cap_closelog.3 From owner-svn-src-all@freebsd.org Mon Jan 29 06:39:58 2018 Return-Path: Delivered-To: svn-src-all@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 CE96DED8E77; Mon, 29 Jan 2018 06:39:57 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66AC781990; Mon, 29 Jan 2018 06:39:57 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89 (FreeBSD)) (envelope-from ) id 1eg36f-000G92-1w; Sun, 28 Jan 2018 22:39:54 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id w0T6dpiM062063; Sun, 28 Jan 2018 22:39:51 -0800 (PST) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Sun, 28 Jan 2018 22:39:50 -0800 From: Oleksandr Tymoshenko To: Poul-Henning Kamp Cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-ID: <20180129063950.GA59901@bluezbox.com> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13025.1517179897@critter.freebsd.dk> X-Operating-System: FreeBSD/11.1-RELEASE-p4 (amd64) User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org>, Emmanuel Vadot writes: > > > Sometimes it makes sense to reboot. > > Yes, *somet [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 06:39:58 -0000 Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org>, Emmanuel Vadot writes: > > > Sometimes it makes sense to reboot. > > Yes, *sometimes* it does. > > But *always* demanding reboot makes no sense ever. > > > Reference platform doesn't make much sense in the embedded world. > > A reference platform which peple can look at to find out what the > software architecture is supposed to be, in the near total absense of > documentation for said software architecture makes a lot of sense. > > > I'm not upset at you for not using, I'm "upset" at you for not wanting > >to make the effort to implement them. Some are hard, some are easy. > > FreeBSD is a hobby for me these days, that implied a certain amount > of enjoyment and limited time. > > Trying to guess what software architecture you want to be written, > based on the non-existent documentation and with no reference-platform > to look at, and then implementing it on a SOC where the hardware > documentation spans the gamut from from missing over mangled to > misleading, does not qualify as "enjoyment" for me and it certainly > is not something I have time for. > > > What's funny though is that even with a pinctrl and clock management, > >we still don't have what is necessary to implement what you want > >(kldloading a driver and directly use pwm). For that we need overlays at > >runtime, pinmuxing at runtime and probably other things too. > > I'm amazed if those things are not already part of our ambition ? > > > This is where I (and probably) other don't agree, this is backward. > > We must implement first proper pinctrl driver and clock management > > instead of introduce hacks. > > Who exactly are "We" ? > > You indicated that you are not going to do it. > > I can't because I don't know what it is that I am supposed to write. > > Nobody else seems to be inclined to do it either. > > So RPi as a platform is just in limbo forever ? > > And where does this "Spanish Inquisition" road end? > > Why are gpio and spi allowed to exist on the RPi platform? Or is > your next demand going to be that they also be removed pending a > hypothetical pinctrl driver ? So to stear discussion away from heated emotional exchange and to the more practical side. As far as I understand there are three contentious points: pinctl, clock management, ignoring "status" property I2C and SPI drivers predate pinctl and proper FDT support. pin config part there is ugly as hell and should have been re-implemented long ago. Here is the patch that fixes these and PWM drivers: https://reviews.freebsd.org/D14104 I don't know enough about extres/clk framework but I know how to read code and where to look for references so I can document it. RPi3 DTS bindings might be not compatible with our implementation of extres/clk but I can check. Will it help you to fix clkman driver in foreseeable future? Ignoring value of ofw_bus_status_okay(dev) in probe method is wrong for number of reasons and pinctl and clocks were brought up as an example why "status" property is more than just attach/dont-attach flag. So there is strictly technical reason why it should be checked. Once this boilerplate code moves to simplebus bus probe method as I believe Warner proposed drivers will not be able to control this aspect any more. There is blessed way to enable drivers on FDT-based platforms: overlays. There is a bunch of precompiled blobs for RPi provided by vendor[1]. To enable PWM on specific pin you need to add following line to config.txt on boot partition: dtoverlay=pwm,pin=12,func=4 It's documented here[2]. With proposed pinctl patch your driver can work on any configurabe pin. We do not include these overlays in official snapshots and I think this should be fixed. This approach is not optimal but actual solution for dynamic device management is complex and requires multiple steps. There are some drivers in arm/broadcom/bcm2835 that ignore status value, they should be fixed too. Probably on other platforms too. I'll look into this to lead the way so to say. Summary: adding ofw_bus_status_okay check in probe method doesn't require any additional functionality, ignoring it is inconsistent with majority of FDT-based drivers' behavior. There is trivial way to enable PWM device in platform-conformant way. Will you please commit fix for this bug? All these best practices and guidelines are unwriteen, and they're not always implemented on older platforms. And it's the problem from which this situation has risen. They exist as an "oral tradition" among people who extencively work with FDT-based platforms and communicate in reviews or mailing list. There is no entry in MAINTAINERS, no official developer's guide to embedded systems, documentation exists mostly in a form of source code. May be it can be improved. Where should they be codified or documented (except man pages) to be authoritative source? Where would you look for such information before starting new driver with no prior experience in the area? [1] https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README [2] https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README#L1267 -- gonzo From owner-svn-src-all@freebsd.org Mon Jan 29 06:54:08 2018 Return-Path: Delivered-To: svn-src-all@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 86B8EED97C0 for ; Mon, 29 Jan 2018 06:54:08 +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 085CF8229E for ; Mon, 29 Jan 2018 06:54:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22f.google.com with SMTP id e1so8089912ita.0 for ; Sun, 28 Jan 2018 22:54:08 -0800 (PST) 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=lErqnTVGEGpBbHloF8EvX7o/3cLwmVnVdQmRzJMQSIM=; b=BxmIEWKqThPuVKOHG4KjHZYHlZr8dx4RRSZQdelNj/zOa8Fl1f6dcZaCkE1Sgz2lfg 0eRrSmlMJbmhpb2qtpe72bNeK+q2Erqfb0Fe7aBxK0h0uhK9xwcOgOsgWZWzm6z1F2us Dfk5bY/BHKX7zrQQaIR+0HtWPQKXzRyBd44auHOcSKS4zd6y4r9w4+uoQbneBD/OwpDM 1kbMmvR/awFEBLgnv9Yct6acYMTIYFct+A/TRk16+xGRbTebAhqulyZyv/ezvdpY7Ufy 41LHnFYl9kDJu82LcZhZKbqjp76wECEFkJhe3Z1RHJ05Sbw+HNl2HgKxRng2NPur7ee0 EvNA== 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=lErqnTVGEGpBbHloF8EvX7o/3cLwmVnVdQmRzJMQSIM=; b=np9gTZ9N4HaOONhb6UqC+EivCIKkSFsd5lyPv9BjsDprLz6+u4rhB4VtFlPbSg7RPI gyYfrHkU/yEmzahzN+SwHX0WH2NdRRpkzqqIX465vXC/Cze98X7pfReOBZ1Jjo3jatu0 GwGCPDc+rNYJdIAL7ZwuRNrLVObPoLg1cfWd5DKrr8kTuovLPsRqUfwLzi1QWt8KFLGK SaEUUJkIKIftAheOCvdLX+SOHDvk7Kw3u68Z+1VWcLnzLTP+tGEkFdKK0ZUm2gNS2sSN pc3vDz74kCtPSht3I5/dZghGXt3GQPFJxS4wB8NbJjFY2Ljs1k8po0wWMPuZYs7vguzh 3ogQ== X-Gm-Message-State: AKwxytfRafkddGGlFgxzUU9GLxgjigpPOuXoddQ2GldUwvMsBNkRyPAL 7zwtF71Vv2kC4jjHCCYpOK7NVmWLMSTjjoIKR7uOgQ== X-Google-Smtp-Source: AH8x227WYuLgE321IvFIExbU66JDs4s1svPBzIDGwbVc4bT2Ze88KMuTPC4F3VO+x2avp3wfUCO51QFt33QdtWms+QQ= X-Received: by 10.36.146.196 with SMTP id l187mr26846821itd.115.1517208847331; Sun, 28 Jan 2018 22:54:07 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sun, 28 Jan 2018 22:54:06 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <20180129063950.GA59901@bluezbox.com> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> From: Warner Losh Date: Sun, 28 Jan 2018 23:54:06 -0700 X-Google-Sender-Auth: oMRvkGxHB6s4WWIQBEnLKMDp-Zw Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Oleksandr Tymoshenko Cc: Poul-Henning Kamp , Emmanuel Vadot , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 06:54:08 -0000 On Sun, Jan 28, 2018 at 11:39 PM, Oleksandr Tymoshenko wrote: > > Ignoring value of ofw_bus_status_okay(dev) in probe method is > wrong for number of reasons and pinctl and clocks were brought up > as an example why "status" property is more than just > attach/dont-attach flag. So there is strictly technical reason > why it should be checked. Once this boilerplate code moves to > simplebus bus probe method as I believe Warner proposed drivers > will not be able to control this aspect any more. > I have patches that does exactly this. I have a few more that will allow drivers some control over the situation planned, but they require hammering out some things in newbus first, which I'll write up once I have something workable and it's been blessed by a couple people I've asked to give feedback. The writeup will just be the first round, not the final destination, btw. We need to work out several tricky issues that are interlocking to ensure that we can enable drivers selectively after boot time. That's tricky for a lot of reasons, but the tl;dr version is that embedded is different because you don't just enable a device, but all the dependencies which, unlike x86, are often 'non-linear' and possibly non-orthogonal to other devices (eg, you may either have A B and C enabled, or D E and F, but never any other combination, how do you transition from state to state sanely). It's a tricky ball of wax that we've neglected for too long. Warner From owner-svn-src-all@freebsd.org Mon Jan 29 08:10:04 2018 Return-Path: Delivered-To: svn-src-all@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 E3A72EDC660; Mon, 29 Jan 2018 08:10:03 +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 9659084459; Mon, 29 Jan 2018 08:10:03 +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 8CF222572E; Mon, 29 Jan 2018 08:10:03 +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 w0T8A38s068115; Mon, 29 Jan 2018 08:10:03 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T8A3fm068113; Mon, 29 Jan 2018 08:10:03 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801290810.w0T8A3fm068113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 29 Jan 2018 08:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328533 - in head/sys/powerpc: powernv powerpc X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys/powerpc: powernv powerpc X-SVN-Commit-Revision: 328533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 08:10:04 -0000 Author: wma Date: Mon Jan 29 08:10:03 2018 New Revision: 328533 URL: https://svnweb.freebsd.org/changeset/base/328533 Log: PPC64: cleanup APs startup routines Cleaning up AP startup routines. This is a mix of changes required to make PowerNV running and to modify the code to be more robust. Previously, some races were seen if more than 90CPUs were online. Authored by: Patryk Duda Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14026 Modified: head/sys/powerpc/powernv/platform_powernv.c head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 05:29:28 2018 (r328532) +++ head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 08:10:03 2018 (r328533) @@ -425,9 +425,21 @@ powernv_reset(platform_t platform) static void powernv_smp_ap_init(platform_t platform) { + register_t msr; + /* LPID must not be altered when PSL_DR or PSL_IR is set */ + msr = mfmsr(); + mtmsr(msr & ~(PSL_DR | PSL_IR)); + + isync(); /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ + mtspr(SPR_LPID, 0); + isync(); + + mtmsr(msr); + mtspr(SPR_LPCR, LPCR_LPES); + isync(); } static void Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Mon Jan 29 05:29:28 2018 (r328532) +++ head/sys/powerpc/powerpc/mp_machdep.c Mon Jan 29 08:10:03 2018 (r328533) @@ -94,6 +94,9 @@ machdep_ap_bootstrap(void) printf("SMP: AP CPU #%d launched\n", PCPU_GET(cpuid)); mtx_unlock_spin(&ap_boot_mtx); + while(smp_started == 0) + ; + /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -197,6 +200,7 @@ cpu_mp_unleash(void *dummy) { struct pcpu *pc; int cpus, timeout; + int ret; if (mp_ncpus <= 1) return; @@ -215,12 +219,12 @@ cpu_mp_unleash(void *dummy) printf("Waking up CPU %d (dev=%x)\n", pc->pc_cpuid, (int)pc->pc_hwref); - platform_smp_start_cpu(pc); - - timeout = 2000; /* wait 2sec for the AP */ - while (!pc->pc_awake && --timeout > 0) - DELAY(1000); - + ret = platform_smp_start_cpu(pc); + if (ret == 0) { + timeout = 2000; /* wait 2sec for the AP */ + while (!pc->pc_awake && --timeout > 0) + DELAY(1000); + } } else { pc->pc_awake = 1; } @@ -253,11 +257,12 @@ cpu_mp_unleash(void *dummy) mp_ncpus, cpus, smp_cpus); } + if (smp_cpus > 1) + atomic_store_rel_int(&smp_started, 1); + /* Let the APs get into the scheduler */ DELAY(10000); - /* XXX Atomic set operation? */ - smp_started = 1; } SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); From owner-svn-src-all@freebsd.org Mon Jan 29 09:15:39 2018 Return-Path: Delivered-To: svn-src-all@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 AA055EDF14D; Mon, 29 Jan 2018 09:15:39 +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 52BCF86802; Mon, 29 Jan 2018 09:15:39 +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 49B8426252; Mon, 29 Jan 2018 09:15:39 +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 w0T9FdqF003406; Mon, 29 Jan 2018 09:15:39 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T9Fctj003403; Mon, 29 Jan 2018 09:15:38 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801290915.w0T9Fctj003403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 29 Jan 2018 09:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328534 - in head/sys/powerpc: powernv pseries X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys/powerpc: powernv pseries X-SVN-Commit-Revision: 328534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:15:39 -0000 Author: wma Date: Mon Jan 29 09:15:38 2018 New Revision: 328534 URL: https://svnweb.freebsd.org/changeset/base/328534 Log: PPC64: use hwref instead of cpuid On CHRP and PowerNV, use the interrupt server number in the cpuref and pcpu hwref field instead of the device-tree phandle and make the CPU IDs reported to the scheduler dense and with the BSP at 0. Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14011 Modified: head/sys/powerpc/powernv/platform_powernv.c head/sys/powerpc/pseries/platform_chrp.c head/sys/powerpc/pseries/xics.c Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 08:10:03 2018 (r328533) +++ head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 09:15:38 2018 (r328534) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015 Nathan Whitehorn + * Copyright (c) 2017-2018 Semihalf * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,6 +74,7 @@ static struct cpu_group *powernv_smp_topo(platform_t p #endif static void powernv_reset(platform_t); static void powernv_cpu_idle(sbintime_t sbt); +static int powernv_cpuref_init(void); static platform_method_t powernv_methods[] = { PLATFORMMETHOD(platform_probe, powernv_probe), @@ -100,9 +102,13 @@ static platform_def_t powernv_platform = { 0 }; +static struct cpuref platform_cpuref[MAXCPU]; +static int platform_cpuref_cnt; +static int platform_cpuref_valid; + PLATFORM_DEF(powernv_platform); -static int powernv_boot_pir; +static uint64_t powernv_boot_pir; static int powernv_probe(platform_t plat) @@ -126,12 +132,20 @@ powernv_attach(platform_t plat) /* Ping OPAL again just to make sure */ opal_check(); +#if BYTE_ORDER == LITTLE_ENDIAN + opal_call(OPAL_REINIT_CPUS, 2 /* Little endian */); +#else + opal_call(OPAL_REINIT_CPUS, 1 /* Big endian */); +#endif + cpu_idle_hook = powernv_cpu_idle; powernv_boot_pir = mfspr(SPR_PIR); /* Init CPU bits */ powernv_smp_ap_init(plat); + powernv_cpuref_init(); + /* Set SLB count from device tree */ cpu = OF_peer(0); cpu = OF_child(cpu); @@ -219,147 +233,140 @@ powernv_mem_regions(platform_t plat, struct mem_region static u_long powernv_timebase_freq(platform_t plat, struct cpuref *cpuref) { - phandle_t phandle; + char buf[8]; + phandle_t cpu, dev, root; + int res; int32_t ticks = -1; - phandle = cpuref->cr_hwref; + root = OF_peer(0); + dev = OF_child(root); + while (dev != 0) { + res = OF_getprop(dev, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + dev = OF_peer(dev); + } - OF_getencprop(phandle, "timebase-frequency", &ticks, sizeof(ticks)); + for (cpu = OF_child(dev); cpu != 0; cpu = OF_peer(cpu)) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + } + if (cpu == 0) + return (512000000); + OF_getencprop(cpu, "timebase-frequency", &ticks, sizeof(ticks)); + if (ticks <= 0) panic("Unable to determine timebase frequency!"); return (ticks); + } static int -powernv_smp_first_cpu(platform_t plat, struct cpuref *cpuref) +powernv_cpuref_init(void) { - char buf[8]; - phandle_t cpu, dev, root; - int res, cpuid; + phandle_t cpu, dev; + char buf[32]; + int a, res, tmp_cpuref_cnt; + static struct cpuref tmp_cpuref[MAXCPU]; + cell_t interrupt_servers[32]; + uint64_t bsp; - root = OF_peer(0); + if (platform_cpuref_valid) + return (0); - dev = OF_child(root); + dev = OF_peer(0); + dev = OF_child(dev); while (dev != 0) { res = OF_getprop(dev, "name", buf, sizeof(buf)); if (res > 0 && strcmp(buf, "cpus") == 0) break; dev = OF_peer(dev); } - if (dev == 0) { - /* - * psim doesn't have a name property on the /cpus node, - * but it can be found directly - */ - dev = OF_finddevice("/cpus"); - if (dev == 0) - return (ENOENT); - } - cpu = OF_child(dev); - - while (cpu != 0) { + bsp = 0; + tmp_cpuref_cnt = 0; + for (cpu = OF_child(dev); cpu != 0; cpu = OF_peer(cpu)) { res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpu") == 0) - break; - cpu = OF_peer(cpu); - } - if (cpu == 0) - return (ENOENT); + if (res > 0 && strcmp(buf, "cpu") == 0) { + res = OF_getproplen(cpu, "ibm,ppc-interrupt-server#s"); + if (res > 0) { - cpuref->cr_hwref = cpu; - res = OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, - sizeof(cpuid)); - if (res <= 0) - res = OF_getencprop(cpu, "reg", &cpuid, sizeof(cpuid)); - if (res <= 0) - cpuid = 0; - cpuref->cr_cpuid = cpuid; - return (0); -} + OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", + interrupt_servers, res); -static int -powernv_smp_next_cpu(platform_t plat, struct cpuref *cpuref) -{ - char buf[8]; - phandle_t cpu; - int i, res, cpuid; + for (a = 0; a < res/sizeof(cell_t); a++) { + tmp_cpuref[tmp_cpuref_cnt].cr_hwref = interrupt_servers[a]; + tmp_cpuref[tmp_cpuref_cnt].cr_cpuid = tmp_cpuref_cnt; - /* Check for whether it should be the next thread */ - res = OF_getproplen(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s"); - if (res > 0) { - cell_t interrupt_servers[res/sizeof(cell_t)]; - OF_getencprop(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s", - interrupt_servers, res); - for (i = 0; i < res/sizeof(cell_t) - 1; i++) { - if (interrupt_servers[i] == cpuref->cr_cpuid) { - cpuref->cr_cpuid = interrupt_servers[i+1]; - return (0); + if (interrupt_servers[a] == (uint32_t)powernv_boot_pir) + bsp = tmp_cpuref_cnt; + + tmp_cpuref_cnt++; + } } } } - /* Next CPU core/package */ - cpu = OF_peer(cpuref->cr_hwref); - while (cpu != 0) { - res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpu") == 0) - break; - cpu = OF_peer(cpu); + /* Map IDs, so BSP has CPUID 0 regardless of hwref */ + for (a = bsp; a < tmp_cpuref_cnt; a++) { + platform_cpuref[platform_cpuref_cnt].cr_hwref = tmp_cpuref[a].cr_hwref; + platform_cpuref[platform_cpuref_cnt].cr_cpuid = platform_cpuref_cnt; + platform_cpuref_cnt++; } - if (cpu == 0) - return (ENOENT); + for (a = 0; a < bsp; a++) { + platform_cpuref[platform_cpuref_cnt].cr_hwref = tmp_cpuref[a].cr_hwref; + platform_cpuref[platform_cpuref_cnt].cr_cpuid = platform_cpuref_cnt; + platform_cpuref_cnt++; + } - cpuref->cr_hwref = cpu; - res = OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, - sizeof(cpuid)); - if (res <= 0) - res = OF_getencprop(cpu, "reg", &cpuid, sizeof(cpuid)); - if (res <= 0) - cpuid = 0; - cpuref->cr_cpuid = cpuid; + platform_cpuref_valid = 1; return (0); } static int -powernv_smp_get_bsp(platform_t plat, struct cpuref *cpuref) +powernv_smp_first_cpu(platform_t plat, struct cpuref *cpuref) { - phandle_t chosen; - int cpuid, res; - struct cpuref i; + if (platform_cpuref_valid == 0) + return (EINVAL); - chosen = OF_finddevice("/chosen"); - if (chosen == 0) - return (ENOENT); + cpuref->cr_cpuid = 0; + cpuref->cr_hwref = platform_cpuref[0].cr_hwref; - res = OF_getencprop(chosen, "fdtbootcpu", &cpuid, sizeof(cpuid)); - if (res < 0) - return (ENOENT); + return (0); +} - /* XXX: FDT from kexec lies sometimes. PIR seems not to. */ - if (cpuid == 0) - cpuid = powernv_boot_pir; +static int +powernv_smp_next_cpu(platform_t plat, struct cpuref *cpuref) +{ + int id; - cpuref->cr_cpuid = cpuid; + if (platform_cpuref_valid == 0) + return (EINVAL); - if (powernv_smp_first_cpu(plat, &i) != 0) + id = cpuref->cr_cpuid + 1; + if (id >= platform_cpuref_cnt) return (ENOENT); - cpuref->cr_hwref = i.cr_hwref; - do { - if (i.cr_cpuid == cpuid) { - cpuref->cr_hwref = i.cr_hwref; - break; - } - } while (powernv_smp_next_cpu(plat, &i) == 0); + cpuref->cr_cpuid = platform_cpuref[id].cr_cpuid; + cpuref->cr_hwref = platform_cpuref[id].cr_hwref; return (0); } +static int +powernv_smp_get_bsp(platform_t plat, struct cpuref *cpuref) +{ + + cpuref->cr_cpuid = platform_cpuref[0].cr_cpuid; + cpuref->cr_hwref = platform_cpuref[0].cr_hwref; + return (0); +} + #ifdef SMP static int powernv_smp_start_cpu(platform_t plat, struct pcpu *pc) @@ -369,10 +376,10 @@ powernv_smp_start_cpu(platform_t plat, struct pcpu *pc ap_pcpu = pc; powerpc_sync(); - result = opal_call(OPAL_START_CPU, pc->pc_cpuid, EXC_RST); + result = opal_call(OPAL_START_CPU, pc->pc_hwref, EXC_RST); if (result != OPAL_SUCCESS) { printf("OPAL error (%d): unable to start AP %d\n", - result, pc->pc_cpuid); + result, (int)pc->pc_hwref); return (ENXIO); } @@ -382,37 +389,49 @@ powernv_smp_start_cpu(platform_t plat, struct pcpu *pc static struct cpu_group * powernv_smp_topo(platform_t plat) { - struct pcpu *pc, *last_pc; - int i, ncores, ncpus; + char buf[8]; + phandle_t cpu, dev, root; + int res, nthreads; - ncores = ncpus = 0; - last_pc = NULL; - CPU_FOREACH(i) { - pc = pcpu_find(i); - if (pc == NULL) + root = OF_peer(0); + + dev = OF_child(root); + while (dev != 0) { + res = OF_getprop(dev, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + dev = OF_peer(dev); + } + + nthreads = 1; + for (cpu = OF_child(dev); cpu != 0; cpu = OF_peer(cpu)) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res <= 0 || strcmp(buf, "cpu") != 0) continue; - if (last_pc == NULL || pc->pc_hwref != last_pc->pc_hwref) - ncores++; - last_pc = pc; - ncpus++; + + res = OF_getproplen(cpu, "ibm,ppc-interrupt-server#s"); + + if (res >= 0) + nthreads = res / sizeof(cell_t); + else + nthreads = 1; + break; } - if (ncpus % ncores != 0) { + if (mp_ncpus % nthreads != 0) { printf("WARNING: Irregular SMP topology. Performance may be " - "suboptimal (%d CPUS, %d cores)\n", ncpus, ncores); + "suboptimal (%d threads, %d on first core)\n", + mp_ncpus, nthreads); return (smp_topo_none()); } /* Don't do anything fancier for non-threaded SMP */ - if (ncpus == ncores) + if (nthreads == 1) return (smp_topo_none()); -#ifdef NOTYET /* smp_topo_1level() fails with non-consecutive CPU IDs */ - return (smp_topo_1level(CG_SHARE_L1, ncpus / ncores, CG_FLAG_SMT)); -#else - return (smp_topo_none()); -#endif + return (smp_topo_1level(CG_SHARE_L1, nthreads, CG_FLAG_SMT)); } + #endif static void Modified: head/sys/powerpc/pseries/platform_chrp.c ============================================================================== --- head/sys/powerpc/pseries/platform_chrp.c Mon Jan 29 08:10:03 2018 (r328533) +++ head/sys/powerpc/pseries/platform_chrp.c Mon Jan 29 09:15:38 2018 (r328534) @@ -75,6 +75,7 @@ static int chrp_smp_first_cpu(platform_t, struct cpure static int chrp_smp_next_cpu(platform_t, struct cpuref *cpuref); static int chrp_smp_get_bsp(platform_t, struct cpuref *cpuref); static void chrp_smp_ap_init(platform_t); +static int chrp_cpuref_init(void); #ifdef SMP static int chrp_smp_start_cpu(platform_t, struct pcpu *cpu); static struct cpu_group *chrp_smp_topo(platform_t plat); @@ -85,6 +86,10 @@ static void chrp_reset(platform_t); static void phyp_cpu_idle(sbintime_t sbt); #endif +static struct cpuref platform_cpuref[MAXCPU]; +static int platform_cpuref_cnt; +static int platform_cpuref_valid; + static platform_method_t chrp_methods[] = { PLATFORMMETHOD(platform_probe, chrp_probe), PLATFORMMETHOD(platform_attach, chrp_attach), @@ -159,6 +164,7 @@ chrp_attach(platform_t plat) chrp_smp_ap_init(plat); } #endif + chrp_cpuref_init(); /* Some systems (e.g. QEMU) need Open Firmware to stand down */ ofw_quiesce(); @@ -295,92 +301,30 @@ chrp_timebase_freq(platform_t plat, struct cpuref *cpu static int chrp_smp_first_cpu(platform_t plat, struct cpuref *cpuref) { - char buf[8]; - phandle_t cpu, dev, root; - int res, cpuid; - root = OF_peer(0); + if (platform_cpuref_valid == 0) + return (EINVAL); - dev = OF_child(root); - while (dev != 0) { - res = OF_getprop(dev, "name", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpus") == 0) - break; - dev = OF_peer(dev); - } - if (dev == 0) { - /* - * psim doesn't have a name property on the /cpus node, - * but it can be found directly - */ - dev = OF_finddevice("/cpus"); - if (dev == 0) - return (ENOENT); - } + cpuref->cr_cpuid = 0; + cpuref->cr_hwref = platform_cpuref[0].cr_hwref; - cpu = OF_child(dev); - - while (cpu != 0) { - res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpu") == 0) - break; - cpu = OF_peer(cpu); - } - if (cpu == 0) - return (ENOENT); - - cpuref->cr_hwref = cpu; - res = OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, - sizeof(cpuid)); - if (res <= 0) - res = OF_getencprop(cpu, "reg", &cpuid, sizeof(cpuid)); - if (res <= 0) - cpuid = 0; - cpuref->cr_cpuid = cpuid; - return (0); } static int chrp_smp_next_cpu(platform_t plat, struct cpuref *cpuref) { - char buf[8]; - phandle_t cpu; - int i, res, cpuid; + int id; - /* Check for whether it should be the next thread */ - res = OF_getproplen(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s"); - if (res > 0) { - cell_t interrupt_servers[res/sizeof(cell_t)]; - OF_getencprop(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s", - interrupt_servers, res); - for (i = 0; i < res/sizeof(cell_t) - 1; i++) { - if (interrupt_servers[i] == cpuref->cr_cpuid) { - cpuref->cr_cpuid = interrupt_servers[i+1]; - return (0); - } - } - } + if (platform_cpuref_valid == 0) + return (EINVAL); - /* Next CPU core/package */ - cpu = OF_peer(cpuref->cr_hwref); - while (cpu != 0) { - res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpu") == 0) - break; - cpu = OF_peer(cpu); - } - if (cpu == 0) + id = cpuref->cr_cpuid + 1; + if (id >= platform_cpuref_cnt) return (ENOENT); - cpuref->cr_hwref = cpu; - res = OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, - sizeof(cpuid)); - if (res <= 0) - res = OF_getencprop(cpu, "reg", &cpuid, sizeof(cpuid)); - if (res <= 0) - cpuid = 0; - cpuref->cr_cpuid = cpuid; + cpuref->cr_cpuid = platform_cpuref[id].cr_cpuid; + cpuref->cr_hwref = platform_cpuref[id].cr_hwref; return (0); } @@ -388,33 +332,60 @@ chrp_smp_next_cpu(platform_t plat, struct cpuref *cpur static int chrp_smp_get_bsp(platform_t plat, struct cpuref *cpuref) { - ihandle_t inst; - phandle_t bsp, chosen; - int res, cpuid; - chosen = OF_finddevice("/chosen"); - if (chosen == 0) - return (ENXIO); + cpuref->cr_cpuid = platform_cpuref[0].cr_cpuid; + cpuref->cr_hwref = platform_cpuref[0].cr_hwref; + return (0); +} - res = OF_getencprop(chosen, "cpu", &inst, sizeof(inst)); - if (res < 0) - return (ENXIO); +static int +chrp_cpuref_init(void) +{ + phandle_t cpu, dev; + char buf[32]; + int a, res; + cell_t interrupt_servers[32]; + uint64_t bsp; - bsp = OF_instance_to_package(inst); + if (platform_cpuref_valid) + return (0); - /* Pick the primary thread. Can it be any other? */ - cpuref->cr_hwref = bsp; - res = OF_getencprop(bsp, "ibm,ppc-interrupt-server#s", &cpuid, - sizeof(cpuid)); - if (res <= 0) - res = OF_getencprop(bsp, "reg", &cpuid, sizeof(cpuid)); - if (res <= 0) - cpuid = 0; - cpuref->cr_cpuid = cpuid; + dev = OF_peer(0); + dev = OF_child(dev); + while (dev != 0) { + res = OF_getprop(dev, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + dev = OF_peer(dev); + } + bsp = 0; + for (cpu = OF_child(dev); cpu != 0; cpu = OF_peer(cpu)) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) { + res = OF_getproplen(cpu, "ibm,ppc-interrupt-server#s"); + if (res > 0) { + + + OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", + interrupt_servers, res); + + for (a = 0; a < res/sizeof(cell_t); a++) { + platform_cpuref[platform_cpuref_cnt].cr_hwref = interrupt_servers[a]; + platform_cpuref[platform_cpuref_cnt].cr_cpuid = platform_cpuref_cnt; + + platform_cpuref_cnt++; + } + } + } + } + + platform_cpuref_valid = 1; + return (0); } + #ifdef SMP static int chrp_smp_start_cpu(platform_t plat, struct pcpu *pc) @@ -438,7 +409,7 @@ chrp_smp_start_cpu(platform_t plat, struct pcpu *pc) ap_pcpu = pc; powerpc_sync(); - result = rtas_call_method(start_cpu, 3, 1, pc->pc_cpuid, EXC_RST, pc, + result = rtas_call_method(start_cpu, 3, 1, pc->pc_hwref, EXC_RST, pc, &err); if (result < 0 || err != 0) { printf("RTAS error (%d/%d): unable to start AP %d\n", @@ -514,8 +485,8 @@ chrp_smp_ap_init(platform_t platform) { if (!(mfmsr() & PSL_HV)) { /* Register VPA */ - phyp_hcall(H_REGISTER_VPA, 1UL, PCPU_GET(cpuid), - splpar_vpa[PCPU_GET(cpuid)]); + phyp_hcall(H_REGISTER_VPA, 1UL, PCPU_GET(hwref), + splpar_vpa[PCPU_GET(hwref)]); /* Set interrupt priority */ phyp_hcall(H_CPPR, 0xff); Modified: head/sys/powerpc/pseries/xics.c ============================================================================== --- head/sys/powerpc/pseries/xics.c Mon Jan 29 08:10:03 2018 (r328533) +++ head/sys/powerpc/pseries/xics.c Mon Jan 29 09:15:38 2018 (r328534) @@ -263,6 +263,10 @@ xicp_bind(device_t dev, u_int irq, cpuset_t cpumask) cell_t status, cpu; int ncpus, i, error; + /* Ignore IPIs */ + if (irq == MAX_XICP_IRQS) + return; + /* * This doesn't appear to actually support affinity groups, so pick a * random CPU. @@ -281,6 +285,8 @@ xicp_bind(device_t dev, u_int irq, cpuset_t cpumask) ncpus++; } + cpu = pcpu_find(cpu)->pc_hwref; + /* XXX: super inefficient */ for (i = 0; i < sc->nintvecs; i++) { if (sc->intvecs[i].irq == irq) { @@ -312,9 +318,9 @@ xicp_dispatch(device_t dev, struct trapframe *tf) #ifdef POWERNV if (mfmsr() & PSL_HV) { - regs = xicp_mem_for_cpu(PCPU_GET(cpuid)); + regs = xicp_mem_for_cpu(PCPU_GET(hwref)); KASSERT(regs != NULL, - ("Can't find regs for CPU %d", PCPU_GET(cpuid))); + ("Can't find regs for CPU %ld", (uintptr_t)PCPU_GET(hwref))); } #endif @@ -343,7 +349,7 @@ xicp_dispatch(device_t dev, struct trapframe *tf) if (regs) bus_write_1(regs, 12, 0xff); else - phyp_hcall(H_IPI, (uint64_t)(PCPU_GET(cpuid)), + phyp_hcall(H_IPI, (uint64_t)(PCPU_GET(hwref)), 0xff); } @@ -370,7 +376,7 @@ xicp_enable(device_t dev, u_int irq, u_int vector) ("Too many XICP interrupts")); /* Bind to this CPU to start: distrib. ID is last entry in gserver# */ - cpu = PCPU_GET(cpuid); + cpu = PCPU_GET(hwref); mtx_lock(&sc->sc_mtx); sc->intvecs[sc->nintvecs].irq = irq; @@ -411,7 +417,7 @@ xicp_eoi(device_t dev, u_int irq) #ifdef POWERNV if (mfmsr() & PSL_HV) - bus_write_4(xicp_mem_for_cpu(PCPU_GET(cpuid)), 4, xirr); + bus_write_4(xicp_mem_for_cpu(PCPU_GET(hwref)), 4, xirr); else #endif phyp_hcall(H_EOI, xirr); @@ -422,6 +428,8 @@ xicp_ipi(device_t dev, u_int cpu) { #ifdef POWERNV + cpu = pcpu_find(cpu)->pc_hwref; + if (mfmsr() & PSL_HV) bus_write_1(xicp_mem_for_cpu(cpu), 12, XICP_PRIORITY); else From owner-svn-src-all@freebsd.org Mon Jan 29 09:21:09 2018 Return-Path: Delivered-To: svn-src-all@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 25EABEDF483; Mon, 29 Jan 2018 09:21:09 +0000 (UTC) (envelope-from def@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 CA23886C71; Mon, 29 Jan 2018 09:21:08 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C4EB02637A; Mon, 29 Jan 2018 09:21:08 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T9L8xN003904; Mon, 29 Jan 2018 09:21:08 GMT (envelope-from def@FreeBSD.org) Received: (from def@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T9L8jO003903; Mon, 29 Jan 2018 09:21:08 GMT (envelope-from def@FreeBSD.org) Message-Id: <201801290921.w0T9L8jO003903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: def set sender to def@FreeBSD.org using -f From: Konrad Witaszczyk Date: Mon, 29 Jan 2018 09:21:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328535 - head/sbin/decryptcore X-SVN-Group: head X-SVN-Commit-Author: def X-SVN-Commit-Paths: head/sbin/decryptcore X-SVN-Commit-Revision: 328535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:21:09 -0000 Author: def Date: Mon Jan 29 09:21:08 2018 New Revision: 328535 URL: https://svnweb.freebsd.org/changeset/base/328535 Log: Fix misspelling of encryptedcore. PR: 223991 Submitted by: Trond Endrestol Approved by: pjd (mentor) Modified: head/sbin/decryptcore/decryptcore.8 Modified: head/sbin/decryptcore/decryptcore.8 ============================================================================== --- head/sbin/decryptcore/decryptcore.8 Mon Jan 29 09:15:38 2018 (r328534) +++ head/sbin/decryptcore/decryptcore.8 Mon Jan 29 09:21:08 2018 (r328535) @@ -96,7 +96,7 @@ Specify location of a private key file which will be u file. .It Fl k Ar keyfile Specify location of a dump key file. -.It Fl e Ar encrytpedcore +.It Fl e Ar encryptedcore Specify location of an encrypted core. .It Fl c Ar core Specify location of a resulting decrypted core dump. From owner-svn-src-all@freebsd.org Mon Jan 29 09:24:30 2018 Return-Path: Delivered-To: svn-src-all@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 290AEEDF7A6; Mon, 29 Jan 2018 09:24:30 +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 CF5668704A; Mon, 29 Jan 2018 09:24:29 +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 C5D5F263E9; Mon, 29 Jan 2018 09:24:29 +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 w0T9OTb2008414; Mon, 29 Jan 2018 09:24:29 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T9OSix008403; Mon, 29 Jan 2018 09:24:28 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801290924.w0T9OSix008403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 29 Jan 2018 09:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328536 - in head/stand: common powerpc/kboot X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/stand: common powerpc/kboot X-SVN-Commit-Revision: 328536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:24:30 -0000 Author: wma Date: Mon Jan 29 09:24:28 2018 New Revision: 328536 URL: https://svnweb.freebsd.org/changeset/base/328536 Log: loader: support for mixed-endianness ELF/loader and POWER8 On POWER8 with current petitpoot, the loader.kboot might be run as little-endian application. The FreeBSD kernel is always big-endian, so the load_elf_* routines must be aware of proper endianness of all fields. Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D12422 Modified: head/stand/common/bootstrap.h head/stand/common/load_elf.c head/stand/powerpc/kboot/conf.c head/stand/powerpc/kboot/host_syscall.S head/stand/powerpc/kboot/host_syscall.h head/stand/powerpc/kboot/hostdisk.c head/stand/powerpc/kboot/kerneltramp.S head/stand/powerpc/kboot/main.c head/stand/powerpc/kboot/metadata.c head/stand/powerpc/kboot/ppc64_elf_freebsd.c Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/common/bootstrap.h Mon Jan 29 09:24:28 2018 (r328536) @@ -315,6 +315,9 @@ struct arch_switch /* Probe ZFS pool(s), if needed. */ void (*arch_zfs_probe)(void); + + /* For kexec-type loaders, get ksegment structure */ + void (*arch_kexec_kseg_get)(int *nseg, void **kseg); }; extern struct arch_switch archsw; Modified: head/stand/common/load_elf.c ============================================================================== --- head/stand/common/load_elf.c Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/common/load_elf.c Mon Jan 29 09:24:28 2018 (r328536) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -118,15 +119,72 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) err = EFTYPE; goto error; } + if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || /* Layout ? */ ehdr->e_ident[EI_DATA] != ELF_TARG_DATA || - ehdr->e_ident[EI_VERSION] != EV_CURRENT || /* Version ? */ - ehdr->e_version != EV_CURRENT || - ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ + ehdr->e_ident[EI_VERSION] != EV_CURRENT) /* Version ? */ { err = EFTYPE; goto error; } + /* + * Fixup ELF endianness. + * + * The Xhdr structure was loaded using block read call to + * optimize file accesses. It might happen, that the endianness + * of the system memory is different that endianness of + * the ELF header. + * Swap fields here to guarantee that Xhdr always contain + * valid data regardless of architecture. + */ + if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { + ehdr->e_type = be16toh(ehdr->e_type); + ehdr->e_machine = be16toh(ehdr->e_machine); + ehdr->e_version = be32toh(ehdr->e_version); + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { + ehdr->e_entry = be64toh(ehdr->e_entry); + ehdr->e_phoff = be64toh(ehdr->e_phoff); + ehdr->e_shoff = be64toh(ehdr->e_shoff); + } else { + ehdr->e_entry = be32toh(ehdr->e_entry); + ehdr->e_phoff = be32toh(ehdr->e_phoff); + ehdr->e_shoff = be32toh(ehdr->e_shoff); + } + ehdr->e_flags = be32toh(ehdr->e_flags); + ehdr->e_ehsize = be16toh(ehdr->e_ehsize); + ehdr->e_phentsize = be16toh(ehdr->e_phentsize); + ehdr->e_phnum = be16toh(ehdr->e_phnum); + ehdr->e_shentsize = be16toh(ehdr->e_shentsize); + ehdr->e_shnum = be16toh(ehdr->e_shnum); + ehdr->e_shstrndx = be16toh(ehdr->e_shstrndx); + + } else { + ehdr->e_type = le16toh(ehdr->e_type); + ehdr->e_machine = le16toh(ehdr->e_machine); + ehdr->e_version = le32toh(ehdr->e_version); + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { + ehdr->e_entry = le64toh(ehdr->e_entry); + ehdr->e_phoff = le64toh(ehdr->e_phoff); + ehdr->e_shoff = le64toh(ehdr->e_shoff); + } else { + ehdr->e_entry = le32toh(ehdr->e_entry); + ehdr->e_phoff = le32toh(ehdr->e_phoff); + ehdr->e_shoff = le32toh(ehdr->e_shoff); + } + ehdr->e_flags = le32toh(ehdr->e_flags); + ehdr->e_ehsize = le16toh(ehdr->e_ehsize); + ehdr->e_phentsize = le16toh(ehdr->e_phentsize); + ehdr->e_phnum = le16toh(ehdr->e_phnum); + ehdr->e_shentsize = le16toh(ehdr->e_shentsize); + ehdr->e_shnum = le16toh(ehdr->e_shnum); + ehdr->e_shstrndx = le16toh(ehdr->e_shstrndx); + } + + if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ + err = EFTYPE; + goto error; + } + return (0); error: @@ -317,6 +375,15 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ u_int fpcopy; Elf_Sym sym; Elf_Addr p_start, p_end; +#if __ELF_WORD_SIZE == 64 + uint64_t scr_ssym; + uint64_t scr_esym; + uint64_t scr; +#else + uint32_t scr_ssym; + uint32_t scr_esym; + uint32_t scr; +#endif dp = NULL; shdr = NULL; @@ -391,6 +458,54 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); for (i = 0; i < ehdr->e_phnum; i++) { + /* + * Fixup ELF endianness. + * + * The Xhdr structure was loaded using block read call to + * optimize file accesses. It might happen, that the endianness + * of the system memory is different that endianness of + * the ELF header. + * Swap fields here to guarantee that Xhdr always contain + * valid data regardless of architecture. + */ + if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { + phdr[i].p_type = be32toh(phdr[i].p_type); + phdr[i].p_flags = be32toh(phdr[i].p_flags); + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { + phdr[i].p_offset = be64toh(phdr[i].p_offset); + phdr[i].p_vaddr = be64toh(phdr[i].p_vaddr); + phdr[i].p_paddr = be64toh(phdr[i].p_paddr); + phdr[i].p_filesz = be64toh(phdr[i].p_filesz); + phdr[i].p_memsz = be64toh(phdr[i].p_memsz); + phdr[i].p_align = be64toh(phdr[i].p_align); + } else { + phdr[i].p_offset = be32toh(phdr[i].p_offset); + phdr[i].p_vaddr = be32toh(phdr[i].p_vaddr); + phdr[i].p_paddr = be32toh(phdr[i].p_paddr); + phdr[i].p_filesz = be32toh(phdr[i].p_filesz); + phdr[i].p_memsz = be32toh(phdr[i].p_memsz); + phdr[i].p_align = be32toh(phdr[i].p_align); + } + } else { + phdr[i].p_type = le32toh(phdr[i].p_type); + phdr[i].p_flags = le32toh(phdr[i].p_flags); + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { + phdr[i].p_offset = le64toh(phdr[i].p_offset); + phdr[i].p_vaddr = le64toh(phdr[i].p_vaddr); + phdr[i].p_paddr = le64toh(phdr[i].p_paddr); + phdr[i].p_filesz = le64toh(phdr[i].p_filesz); + phdr[i].p_memsz = le64toh(phdr[i].p_memsz); + phdr[i].p_align = le64toh(phdr[i].p_align); + } else { + phdr[i].p_offset = le32toh(phdr[i].p_offset); + phdr[i].p_vaddr = le32toh(phdr[i].p_vaddr); + phdr[i].p_paddr = le32toh(phdr[i].p_paddr); + phdr[i].p_filesz = le32toh(phdr[i].p_filesz); + phdr[i].p_memsz = le32toh(phdr[i].p_memsz); + phdr[i].p_align = le32toh(phdr[i].p_align); + } + } + /* We want to load PT_LOAD segments only.. */ if (phdr[i].p_type != PT_LOAD) continue; @@ -465,6 +580,60 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ "_loadimage: failed to read section headers"); goto nosyms; } + + /* + * Fixup ELF endianness. + * + * The Xhdr structure was loaded using block read call to + * optimize file accesses. It might happen, that the endianness + * of the system memory is different that endianness of + * the ELF header. + * Swap fields here to guarantee that Xhdr always contain + * valid data regardless of architecture. + */ + for (i = 0; i < ehdr->e_shnum; i++) { + if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { + shdr[i].sh_name = be32toh(shdr[i].sh_name); + shdr[i].sh_type = be32toh(shdr[i].sh_type); + shdr[i].sh_link = be32toh(shdr[i].sh_link); + shdr[i].sh_info = be32toh(shdr[i].sh_info); + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { + shdr[i].sh_flags = be64toh(shdr[i].sh_flags); + shdr[i].sh_addr = be64toh(shdr[i].sh_addr); + shdr[i].sh_offset = be64toh(shdr[i].sh_offset); + shdr[i].sh_size = be64toh(shdr[i].sh_size); + shdr[i].sh_addralign = be64toh(shdr[i].sh_addralign); + shdr[i].sh_entsize = be64toh(shdr[i].sh_entsize); + } else { + shdr[i].sh_flags = be32toh(shdr[i].sh_flags); + shdr[i].sh_addr = be32toh(shdr[i].sh_addr); + shdr[i].sh_offset = be32toh(shdr[i].sh_offset); + shdr[i].sh_size = be32toh(shdr[i].sh_size); + shdr[i].sh_addralign = be32toh(shdr[i].sh_addralign); + shdr[i].sh_entsize = be32toh(shdr[i].sh_entsize); + } + } else { + shdr[i].sh_name = le32toh(shdr[i].sh_name); + shdr[i].sh_type = le32toh(shdr[i].sh_type); + shdr[i].sh_link = le32toh(shdr[i].sh_link); + shdr[i].sh_info = le32toh(shdr[i].sh_info); + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { + shdr[i].sh_flags = le64toh(shdr[i].sh_flags); + shdr[i].sh_addr = le64toh(shdr[i].sh_addr); + shdr[i].sh_offset = le64toh(shdr[i].sh_offset); + shdr[i].sh_size = le64toh(shdr[i].sh_size); + shdr[i].sh_addralign = le64toh(shdr[i].sh_addralign); + shdr[i].sh_entsize = le64toh(shdr[i].sh_entsize); + } else { + shdr[i].sh_flags = le32toh(shdr[i].sh_flags); + shdr[i].sh_addr = le32toh(shdr[i].sh_addr); + shdr[i].sh_offset = le32toh(shdr[i].sh_offset); + shdr[i].sh_size = le32toh(shdr[i].sh_size); + shdr[i].sh_addralign = le32toh(shdr[i].sh_addralign); + shdr[i].sh_entsize = le32toh(shdr[i].sh_entsize); + } + } + } file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); /* @@ -540,10 +709,16 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ break; } #endif - size = shdr[i].sh_size; - archsw.arch_copyin(&size, lastaddr, sizeof(size)); - lastaddr += sizeof(size); +#if defined(__powerpc__) + #if __ELF_WORD_SIZE == 64 + scr = htobe64(size); + #else + scr = htobe32(size); + #endif +#endif + archsw.arch_copyin(&scr, lastaddr, sizeof(scr)); + lastaddr += sizeof(scr); #ifdef ELF_VERBOSE printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, @@ -582,8 +757,22 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ printf("]"); #endif - file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); - file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); +#if defined(__powerpc__) + /* On PowerPC we always need to provide BE data to the kernel */ + #if __ELF_WORD_SIZE == 64 + scr_ssym = htobe64((uint64_t)ssym); + scr_esym = htobe64((uint64_t)esym); + #else + scr_ssym = htobe32((uint32_t)ssym); + scr_esym = htobe32((uint32_t)esym); + #endif +#else + scr_ssym = ssym; + scr_esym = esym; +#endif + + file_addmetadata(fp, MODINFOMD_SSYM, sizeof(scr_ssym), &scr_ssym); + file_addmetadata(fp, MODINFOMD_ESYM, sizeof(scr_esym), &scr_esym); nosyms: printf("\n"); Modified: head/stand/powerpc/kboot/conf.c ============================================================================== --- head/stand/powerpc/kboot/conf.c Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/conf.c Mon Jan 29 09:24:28 2018 (r328536) @@ -78,6 +78,7 @@ struct fs_ops *file_system[] = { #if defined(LOADER_BZIP2_SUPPORT) &bzipfs_fsops, #endif + &dosfs_fsops, NULL }; Modified: head/stand/powerpc/kboot/host_syscall.S ============================================================================== --- head/stand/powerpc/kboot/host_syscall.S Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/host_syscall.S Mon Jan 29 09:24:28 2018 (r328536) @@ -14,7 +14,6 @@ ENTRY(host_read) li %r3, 0 blr - ENTRY(host_write) li %r0, 4 # SYS_write sc @@ -28,6 +27,11 @@ ENTRY(host_seek) sc blr +ENTRY(host_llseek) + li %r0, 140 # SYS_llseek + sc + blr + ENTRY(host_open) li %r0, 5 # SYS_open sc @@ -44,6 +48,11 @@ ENTRY(host_close) ENTRY(host_mmap) li %r0, 90 # SYS_mmap + sc + blr + +ENTRY(host_uname) + li %r0, 122 # SYS_uname sc blr Modified: head/stand/powerpc/kboot/host_syscall.h ============================================================================== --- head/stand/powerpc/kboot/host_syscall.h Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/host_syscall.h Mon Jan 29 09:24:28 2018 (r328536) @@ -34,9 +34,18 @@ ssize_t host_read(int fd, void *buf, size_t nbyte); ssize_t host_write(int fd, const void *buf, size_t nbyte); ssize_t host_seek(int fd, int64_t offset, int whence); int host_open(const char *path, int flags, int mode); +ssize_t host_llseek(int fd, int32_t offset_high, int32_t offset_lo, uint64_t *result, int whence); int host_close(int fd); void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, int); #define host_getmem(size) host_mmap(0, size, 3 /* RW */, 0x22 /* ANON */, -1, 0); +struct old_utsname { + char sysname[65]; + char nodename[65]; + char release[65]; + char version[65]; + char machine[65]; +}; +int host_uname(struct old_utsname *); struct host_timeval { int tv_sec; int tv_usec; @@ -44,8 +53,8 @@ struct host_timeval { int host_gettimeofday(struct host_timeval *a, void *b); int host_select(int nfds, long *readfds, long *writefds, long *exceptfds, struct host_timeval *timeout); -int kexec_load(vm_offset_t start, int nsegs, void *segs); -int host_reboot(int, int, int, void *); +int kexec_load(uint32_t start, int nsegs, uint32_t segs); +int host_reboot(int, int, int, uint32_t); int host_getdents(int fd, void *dirp, int count); #endif Modified: head/stand/powerpc/kboot/hostdisk.c ============================================================================== --- head/stand/powerpc/kboot/hostdisk.c Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/hostdisk.c Mon Jan 29 09:24:28 2018 (r328536) @@ -64,10 +64,14 @@ hostdisk_strategy(void *devdata, int flag, daddr_t dbl struct devdesc *desc = devdata; daddr_t pos; int n; - + uint64_t res; + uint32_t posl, posh; + pos = dblk * 512; - if (host_seek(desc->d_unit, pos, 0) < 0) { + posl = pos & 0xffffffff; + posh = (pos >> 32) & 0xffffffff; + if (host_llseek(desc->d_unit, posh, posl, &res, 0) < 0) { printf("Seek error\n"); return (EIO); } Modified: head/stand/powerpc/kboot/kerneltramp.S ============================================================================== --- head/stand/powerpc/kboot/kerneltramp.S Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/kerneltramp.S Mon Jan 29 09:24:28 2018 (r328536) @@ -20,6 +20,18 @@ CNAME(kerneltramp): bl 2f .space 24 /* branch address, r3-r7 */ +/* + * MUST BE IN SYNC WITH: + * struct trampoline_data { + * uint32_t kernel_entry; + * uint32_t dtb; + * uint32_t phys_mem_offset; + * uint32_t of_entry; + * uint32_t mdp; + * uint32_t mdp_size; + * }; + */ + . = kerneltramp + 0x40 /* AP spinlock */ .long 0 @@ -36,18 +48,53 @@ CNAME(kerneltramp): sync ba 0x100 -2: /* Continuation of kerneltramp */ +2: /* Continuation of kerneltramp */ mflr %r8 mtlr %r9 - lwz %r3,0(%r8) - mtctr %r3 + + mfmsr %r10 + andi. %r10, %r10, 1 /* test MSR_LE */ + bne little_endian + +/* We're starting in BE */ +big_endian: lwz %r3,4(%r8) lwz %r4,8(%r8) lwz %r5,12(%r8) lwz %r6,16(%r8) lwz %r7,20(%r8) + + lwz %r10, 0(%r8) + mtctr %r10 bctr - + +/* We're starting in LE */ +little_endian: + + /* Entries are BE, swap them during load. */ + li %r10, 4 + lwbrx %r3, %r8, %r10 + li %r10, 8 + lwbrx %r4, %r8, %r10 + li %r10, 12 + lwbrx %r5, %r8, %r10 + li %r10, 16 + lwbrx %r6, %r8, %r10 + li %r10, 20 + lwbrx %r7, %r8, %r10 + + /* Clear MSR_LE flag to enter the BE world */ + mfmsr %r10 + clrrdi %r10, %r10, 1 + mtsrr1 %r10 + + /* Entry is at 0(%r8) */ + li %r10, 0 + lwbrx %r10, %r8, %r10 + mtsrr0 %r10 + + rfid + endkerneltramp: .data Modified: head/stand/powerpc/kboot/main.c ============================================================================== --- head/stand/powerpc/kboot/main.c Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/main.c Mon Jan 29 09:24:28 2018 (r328536) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -35,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "host_syscall.h" + struct arch_switch archsw; extern void *_end; @@ -47,9 +49,170 @@ ssize_t kboot_readin(const int fd, vm_offset_t dest, c int kboot_autoload(void); uint64_t kboot_loadaddr(u_int type, void *data, uint64_t addr); int kboot_setcurrdev(struct env_var *ev, int flags, const void *value); +static void kboot_kseg_get(int *nseg, void **ptr); extern int command_fdt_internal(int argc, char *argv[]); +struct region_desc { + uint64_t start; + uint64_t end; +}; + +static uint64_t +kboot_get_phys_load_segment(void) +{ + int fd; + uint64_t entry[2]; + static uint64_t load_segment = ~(0UL); + uint64_t val_64; + uint32_t val_32; + struct region_desc rsvd_reg[32]; + int rsvd_reg_cnt = 0; + int ret, a, b; + uint64_t start, end; + + if (load_segment == ~(0UL)) { + + /* Default load address is 0x00000000 */ + load_segment = 0UL; + + /* Read reserved regions */ + fd = host_open("/proc/device-tree/reserved-ranges", O_RDONLY, 0); + if (fd >= 0) { + while (host_read(fd, &entry[0], sizeof(entry)) == sizeof(entry)) { + rsvd_reg[rsvd_reg_cnt].start = be64toh(entry[0]); + rsvd_reg[rsvd_reg_cnt].end = + be64toh(entry[1]) + rsvd_reg[rsvd_reg_cnt].start - 1; + rsvd_reg_cnt++; + } + host_close(fd); + } + /* Read where the kernel ends */ + fd = host_open("/proc/device-tree/chosen/linux,kernel-end", O_RDONLY, 0); + if (fd >= 0) { + ret = host_read(fd, &val_64, sizeof(val_64)); + + if (ret == sizeof(uint64_t)) { + rsvd_reg[rsvd_reg_cnt].start = 0; + rsvd_reg[rsvd_reg_cnt].end = be64toh(val_64) - 1; + } else { + memcpy(&val_32, &val_64, sizeof(val_32)); + rsvd_reg[rsvd_reg_cnt].start = 0; + rsvd_reg[rsvd_reg_cnt].end = be32toh(val_32) - 1; + } + rsvd_reg_cnt++; + + host_close(fd); + } + /* Read memory size (SOCKET0 only) */ + fd = host_open("/proc/device-tree/memory@0/reg", O_RDONLY, 0); + if (fd < 0) + fd = host_open("/proc/device-tree/memory/reg", O_RDONLY, 0); + if (fd >= 0) { + ret = host_read(fd, &entry, sizeof(entry)); + + /* Memory range in start:length format */ + entry[0] = be64toh(entry[0]); + entry[1] = be64toh(entry[1]); + + /* Reserve everything what is before start */ + if (entry[0] != 0) { + rsvd_reg[rsvd_reg_cnt].start = 0; + rsvd_reg[rsvd_reg_cnt].end = entry[0] - 1; + rsvd_reg_cnt++; + } + /* Reserve everything what is after end */ + if (entry[1] != 0xffffffffffffffffUL) { + rsvd_reg[rsvd_reg_cnt].start = entry[0] + entry[1]; + rsvd_reg[rsvd_reg_cnt].end = 0xffffffffffffffffUL; + rsvd_reg_cnt++; + } + + host_close(fd); + } + + /* Sort entries in ascending order (bubble) */ + for (a = rsvd_reg_cnt - 1; a > 0; a--) { + for (b = 0; b < a; b++) { + if (rsvd_reg[b].start > rsvd_reg[b + 1].start) { + struct region_desc tmp; + tmp = rsvd_reg[b]; + rsvd_reg[b] = rsvd_reg[b + 1]; + rsvd_reg[b + 1] = tmp; + } + } + } + + /* Join overlapping/adjacent regions */ + for (a = 0; a < rsvd_reg_cnt - 1; ) { + + if ((rsvd_reg[a + 1].start >= rsvd_reg[a].start) && + ((rsvd_reg[a + 1].start - 1) <= rsvd_reg[a].end)) { + /* We have overlapping/adjacent regions! */ + rsvd_reg[a].end = + MAX(rsvd_reg[a].end, rsvd_reg[a + a].end); + + for (b = a + 1; b < rsvd_reg_cnt - 1; b++) + rsvd_reg[b] = rsvd_reg[b + 1]; + rsvd_reg_cnt--; + } else + a++; + } + + /* Find the first free region */ + if (rsvd_reg_cnt > 0) { + start = 0; + end = rsvd_reg[0].start; + for (a = 0; a < rsvd_reg_cnt - 1; a++) { + if ((start >= rsvd_reg[a].start) && + (start <= rsvd_reg[a].end)) { + start = rsvd_reg[a].end + 1; + end = rsvd_reg[a + 1].start; + } else + break; + } + + if (start != end) { + uint64_t align = 64UL*1024UL*1024UL; + + /* Align both to 64MB boundary */ + start = (start + align - 1UL) & ~(align - 1UL); + end = ((end + 1UL) & ~(align - 1UL)) - 1UL; + + if (start < end) + load_segment = start; + } + } + } + + return (load_segment); +} + +uint8_t +kboot_get_kernel_machine_bits(void) +{ + static uint8_t bits = 0; + struct old_utsname utsname; + int ret; + + if (bits == 0) { + /* Default is 32-bit kernel */ + bits = 32; + + /* Try to get system type */ + memset(&utsname, 0, sizeof(utsname)); + ret = host_uname(&utsname); + if (ret == 0) { + if (strcmp(utsname.machine, "ppc64") == 0) + bits = 64; + else if (strcmp(utsname.machine, "ppc64le") == 0) + bits = 64; + } + } + + return (bits); +} + int kboot_getdev(void **vdev, const char *devspec, const char **path) { @@ -94,7 +257,7 @@ main(int argc, const char **argv) { void *heapbase; const size_t heapsize = 15*1024*1024; - const char *bootdev = argv[1]; + const char *bootdev; /* * Set the heap to one page after the end of the loader. @@ -107,6 +270,12 @@ main(int argc, const char **argv) */ cons_probe(); + /* Choose bootdev if provided */ + if (argc > 1) + bootdev = argv[1]; + else + bootdev = ""; + printf("Boot device: %s\n", bootdev); archsw.arch_getdev = kboot_getdev; @@ -115,6 +284,7 @@ main(int argc, const char **argv) archsw.arch_readin = kboot_readin; archsw.arch_autoload = kboot_autoload; archsw.arch_loadaddr = kboot_loadaddr; + archsw.arch_kexec_kseg_get = kboot_kseg_get; printf("\n%s", bootprog_info); @@ -181,7 +351,7 @@ static ssize_t get_phys_buffer(vm_offset_t dest, const size_t len, void **buf) { int i = 0; - const size_t segsize = 2*1024*1024; + const size_t segsize = 4*1024*1024; for (i = 0; i < nkexec_segments; i++) { if (dest >= (vm_offset_t)loaded_segments[i].mem && @@ -194,6 +364,7 @@ get_phys_buffer(vm_offset_t dest, const size_t len, vo loaded_segments[nkexec_segments].bufsz = segsize; loaded_segments[nkexec_segments].mem = (void *)rounddown2(dest,segsize); loaded_segments[nkexec_segments].memsz = segsize; + i = nkexec_segments; nkexec_segments++; @@ -283,17 +454,32 @@ kboot_autoload(void) uint64_t kboot_loadaddr(u_int type, void *data, uint64_t addr) { - /* - * Need to stay out of the way of Linux. /chosen/linux,kernel-end does - * a better job here, but use a fixed offset for now. - */ if (type == LOAD_ELF) addr = roundup(addr, PAGE_SIZE); else - addr += 64*1024*1024; /* Stay out of the way of Linux */ + addr += kboot_get_phys_load_segment(); return (addr); +} + +static void +kboot_kseg_get(int *nseg, void **ptr) +{ +#if 0 + int a; + + for (a = 0; a < nkexec_segments; a++) { + printf("kseg_get: %jx %jx %jx %jx\n", + (uintmax_t)loaded_segments[a].buf, + (uintmax_t)loaded_segments[a].bufsz, + (uintmax_t)loaded_segments[a].mem, + (uintmax_t)loaded_segments[a].memsz); + } +#endif + + *nseg = nkexec_segments; + *ptr = &loaded_segments[0]; } void Modified: head/stand/powerpc/kboot/metadata.c ============================================================================== --- head/stand/powerpc/kboot/metadata.c Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/metadata.c Mon Jan 29 09:24:28 2018 (r328536) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -157,7 +158,7 @@ md_copyenv(vm_offset_t addr) static int align; #define COPY32(v, a, c) { \ - u_int32_t x = (v); \ + u_int32_t x = htobe32(v); \ if (c) \ archsw.arch_copyin(&x, a, sizeof(x)); \ a += sizeof(x); \ @@ -254,11 +255,12 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs vm_offset_t fdtp; vm_offset_t size; uint64_t scratch64; + uint32_t scratch32; char *rootdevname; int howto; align = kern64 ? 8 : 4; - howto = md_getboothowto(args); + howto = htobe32(md_getboothowto(args)); /* * Allow the environment variable 'rootdev' to override the supplied device @@ -300,16 +302,19 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs panic("can't find kernel file"); file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); if (kern64) { - scratch64 = envp; + scratch64 = htobe64(envp); file_addmetadata(kfp, MODINFOMD_ENVP, sizeof scratch64, &scratch64); - scratch64 = fdtp; + scratch64 = htobe64(fdtp); file_addmetadata(kfp, MODINFOMD_DTBP, sizeof scratch64, &scratch64); - scratch64 = kernend; + scratch64 = htobe64(kernend); file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof scratch64, &scratch64); } else { - file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp); - file_addmetadata(kfp, MODINFOMD_DTBP, sizeof fdtp, &fdtp); - file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); + scratch32 = htobe32(envp); + file_addmetadata(kfp, MODINFOMD_ENVP, sizeof scratch32, &scratch32); + scratch32 = htobe32(fdtp); + file_addmetadata(kfp, MODINFOMD_DTBP, sizeof scratch32, &scratch32); + scratch32 = htobe32(kernend); + file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof scratch32, &scratch32); } *modulep = addr; @@ -318,7 +323,7 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs md = file_findmetadata(kfp, MODINFOMD_KERNEND); if (kern64) { - scratch64 = kernend; + scratch64 = htobe64(kernend); bcopy(&scratch64, md->md_data, sizeof scratch64); } else { bcopy(&kernend, md->md_data, sizeof kernend); Modified: head/stand/powerpc/kboot/ppc64_elf_freebsd.c ============================================================================== --- head/stand/powerpc/kboot/ppc64_elf_freebsd.c Mon Jan 29 09:21:08 2018 (r328535) +++ head/stand/powerpc/kboot/ppc64_elf_freebsd.c Mon Jan 29 09:24:28 2018 (r328536) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #define __ELF_WORD_SIZE 64 #include +#include #include #include @@ -43,9 +44,16 @@ __FBSDID("$FreeBSD$"); extern char end[]; extern void *kerneltramp; extern size_t szkerneltramp; -extern int nkexec_segments; -extern void * loaded_segments; +struct trampoline_data { + uint32_t kernel_entry; + uint32_t dtb; + uint32_t phys_mem_offset; + uint32_t of_entry; + uint32_t mdp; + uint32_t mdp_size; +}; + vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb); int @@ -70,53 +78,90 @@ ppc64_elf_exec(struct preloaded_file *fp) int error; uint32_t *trampoline; uint64_t entry; - vm_offset_t trampolinebase; + uint64_t trampolinebase; + struct trampoline_data *trampoline_data; + int nseg; + void *kseg; if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) { return(EFTYPE); } e = (Elf_Ehdr *)&fmp->md_data; - /* Figure out where to put it */ + /* + * Figure out where to put it. + * + * Linux does not allow to do kexec_load into + * any part of memory. Ask arch_loadaddr to + * resolve the first available chunk of physical + * memory where loading is possible (load_addr). + * + * Memory organization is shown below. + * It is assumed, that text segment offset of + * kernel ELF (KERNPHYSADDR) is non-zero, + * which is true for PPC/PPC64 architectures, + * where default is 0x100000. + * + * load_addr: trampoline code + * load_addr + KERNPHYSADDR: kernel text segment + */ trampolinebase = archsw.arch_loadaddr(LOAD_RAW, NULL, 0); - + printf("Load address at %#jx\n", (uintmax_t)trampolinebase); + printf("Relocation offset is %#jx\n", (uintmax_t)elf64_relocation_offset); + /* Set up loader trampoline */ trampoline = malloc(szkerneltramp); memcpy(trampoline, &kerneltramp, szkerneltramp); + /* Parse function descriptor for ELFv1 kernels */ if ((e->e_flags & 3) == 2) entry = e->e_entry; - else + else { archsw.arch_copyout(e->e_entry + elf64_relocation_offset, &entry, 8); - trampoline[2] = entry + elf64_relocation_offset; - trampoline[4] = 0; /* Phys. mem offset */ - trampoline[5] = 0; /* OF entry point */ + entry = be64toh(entry); + } + /* + * Placeholder for trampoline data is at trampolinebase + 0x08 + * CAUTION: all data must be Big Endian + */ + trampoline_data = (void*)&trampoline[2]; + trampoline_data->kernel_entry = htobe32(entry + elf64_relocation_offset); + trampoline_data->phys_mem_offset = htobe32(0); + trampoline_data->of_entry = htobe32(0); + if ((error = md_load64(fp->f_args, &mdp, &dtb)) != 0) return (error); - trampoline[3] = dtb; - trampoline[6] = mdp; - trampoline[7] = 0xfb5d104d; - printf("Kernel entry at %#jx (%#x) ...\n", e->e_entry, trampoline[2]); - printf("DTB at %#x, mdp at %#x\n", dtb, mdp); + trampoline_data->dtb = htobe32(dtb); + trampoline_data->mdp = htobe32(mdp); + trampoline_data->mdp_size = htobe32(0xfb5d104d); + printf("Kernel entry at %#jx (%#x) ...\n", + entry, be32toh(trampoline_data->kernel_entry)); + printf("DTB at %#x, mdp at %#x\n", + be32toh(trampoline_data->dtb), be32toh(trampoline_data->mdp)); + dev_cleanup(); archsw.arch_copyin(trampoline, trampolinebase, szkerneltramp); free(trampoline); - error = kexec_load(trampolinebase, nkexec_segments, &loaded_segments); + if (archsw.arch_kexec_kseg_get == NULL) + panic("architecture did not provide kexec segment mapping"); + archsw.arch_kexec_kseg_get(&nseg, &kseg); + + error = kexec_load(trampolinebase, nseg, (uintptr_t)kseg); if (error != 0) panic("kexec_load returned error: %d", error); + error = host_reboot(0xfee1dead, 672274793, - 0x45584543 /* LINUX_REBOOT_CMD_KEXEC */, NULL); + 0x45584543 /* LINUX_REBOOT_CMD_KEXEC */, (uintptr_t)NULL); if (error != 0) panic("reboot returned error: %d", error); - while (1) {} - panic("exec returned"); + while (1) {} } struct file_format ppc_elf64 = From owner-svn-src-all@freebsd.org Mon Jan 29 09:27:03 2018 Return-Path: Delivered-To: svn-src-all@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 19813EDF953; Mon, 29 Jan 2018 09:27:03 +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 A936F872F5; Mon, 29 Jan 2018 09:27:02 +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 89F62263F2; Mon, 29 Jan 2018 09:27:02 +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 w0T9R2CK008703; Mon, 29 Jan 2018 09:27:02 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T9R2ot008700; Mon, 29 Jan 2018 09:27:02 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801290927.w0T9R2ot008700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 29 Jan 2018 09:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328537 - in head/sys/powerpc: aim powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys/powerpc: aim powernv X-SVN-Commit-Revision: 328537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:27:03 -0000 Author: wma Date: Mon Jan 29 09:27:02 2018 New Revision: 328537 URL: https://svnweb.freebsd.org/changeset/base/328537 Log: PowerNV: move LPCR and LPID altering to cpudep_ap_early_bootstrap It turns out that under some circumstances we can get DSI or DSE before we set LPCR and LPID so we should set it as early as possible. Authored by: Patryk Duda Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Modified: head/sys/powerpc/aim/mp_cpudep.c head/sys/powerpc/powernv/platform_powernv.c Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Mon Jan 29 09:24:28 2018 (r328536) +++ head/sys/powerpc/aim/mp_cpudep.c Mon Jan 29 09:27:02 2018 (r328537) @@ -64,9 +64,6 @@ cpudep_ap_early_bootstrap(void) register_t reg; #endif - __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); - powerpc_sync(); - switch (mfpvr() >> 16) { case IBM970: case IBM970FX: @@ -86,7 +83,20 @@ cpudep_ap_early_bootstrap(void) #endif powerpc_sync(); break; + case IBMPOWER8: + case IBMPOWER8E: + isync(); + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ + mtspr(SPR_LPID, 0); + isync(); + + mtspr(SPR_LPCR, LPCR_LPES); + isync(); + break; } + + __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); + powerpc_sync(); } uintptr_t Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 09:24:28 2018 (r328536) +++ head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 09:27:02 2018 (r328537) @@ -128,6 +128,7 @@ powernv_attach(platform_t plat) pcell_t prop; phandle_t cpu; int res, len, node, idx; + register_t msr; /* Ping OPAL again just to make sure */ opal_check(); @@ -141,6 +142,19 @@ powernv_attach(platform_t plat) cpu_idle_hook = powernv_cpu_idle; powernv_boot_pir = mfspr(SPR_PIR); + /* LPID must not be altered when PSL_DR or PSL_IR is set */ + msr = mfmsr(); + mtmsr(msr & ~(PSL_DR | PSL_IR)); + + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ + mtspr(SPR_LPID, 0); + isync(); + + mtmsr(msr); + + mtspr(SPR_LPCR, LPCR_LPES); + isync(); + /* Init CPU bits */ powernv_smp_ap_init(plat); @@ -444,21 +458,6 @@ powernv_reset(platform_t platform) static void powernv_smp_ap_init(platform_t platform) { - register_t msr; - - /* LPID must not be altered when PSL_DR or PSL_IR is set */ - msr = mfmsr(); - mtmsr(msr & ~(PSL_DR | PSL_IR)); - - isync(); - /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ - mtspr(SPR_LPID, 0); - isync(); - - mtmsr(msr); - - mtspr(SPR_LPCR, LPCR_LPES); - isync(); } static void From owner-svn-src-all@freebsd.org Mon Jan 29 09:27:33 2018 Return-Path: Delivered-To: svn-src-all@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 476E4EDF9DC; Mon, 29 Jan 2018 09:27:33 +0000 (UTC) (envelope-from oshogbo@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 EEF1A874E5; Mon, 29 Jan 2018 09:27:32 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E9F75263F4; Mon, 29 Jan 2018 09:27:32 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T9RWUN008887; Mon, 29 Jan 2018 09:27:32 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T9RWQV008886; Mon, 29 Jan 2018 09:27:32 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801290927.w0T9RWQV008886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 29 Jan 2018 09:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328538 - head/sbin/decryptcore X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sbin/decryptcore X-SVN-Commit-Revision: 328538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:27:33 -0000 Author: oshogbo Date: Mon Jan 29 09:27:32 2018 New Revision: 328538 URL: https://svnweb.freebsd.org/changeset/base/328538 Log: Bump date after r328535. Submitted by: def@ Modified: head/sbin/decryptcore/decryptcore.8 Modified: head/sbin/decryptcore/decryptcore.8 ============================================================================== --- head/sbin/decryptcore/decryptcore.8 Mon Jan 29 09:27:02 2018 (r328537) +++ head/sbin/decryptcore/decryptcore.8 Mon Jan 29 09:27:32 2018 (r328538) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 9, 2017 +.Dd January 29, 2018 .Dt DECRYPTCORE 8 .Os .Sh NAME From owner-svn-src-all@freebsd.org Mon Jan 29 09:51:25 2018 Return-Path: Delivered-To: svn-src-all@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 28E6DEE0A76; Mon, 29 Jan 2018 09:51:25 +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 B0EC8682F0; Mon, 29 Jan 2018 09:51:24 +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 ECC1B2737A; Mon, 29 Jan 2018 09:51: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 w0T9p0wl032565 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 29 Jan 2018 09:51:00 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0T9owK9032564; Mon, 29 Jan 2018 09:50:58 GMT (envelope-from phk) To: Warner Losh cc: Oleksandr Tymoshenko , Emmanuel Vadot , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32562.1517219458.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 29 Jan 2018 09:50:58 +0000 Message-ID: <32563.1517219458@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:51:25 -0000 -------- In message , Warner Losh writes: >That's tricky for a lot of reasons, but the tl;dr version is that >embedded is different because you don't just enable a device, but all the >dependencies which, unlike x86, are often 'non-linear' and possibly >non-orthogonal to other devices (eg, you may either have A B and C enable= d, >or D E and F, but never any other combination, how do you transition from >state to state sanely). I have no problems if we deal with the most obscure cases by saying "Too complicated for runtime-reconf, please reboot", and there are indeed hardware out there where that is required for various reason. But trival (and popular) cases "should just work". >It's a tricky ball of wax that we've neglected for too long. Indeed, and thanks for doing so. -- = 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-all@freebsd.org Mon Jan 29 09:56:07 2018 Return-Path: Delivered-To: svn-src-all@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 9B49BEE0CDA; Mon, 29 Jan 2018 09:56:07 +0000 (UTC) (envelope-from jason.harmening@gmail.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 2DDD3685AA; Mon, 29 Jan 2018 09:56:07 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id w14so8637229itc.3; Mon, 29 Jan 2018 01:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=X7436XTZEUH0skOXPVqhRSTuPQxMmkLlJixFm1tw4yM=; b=vHKibJxPm1DKnUxw6ixthVaQvSTrjJJNSLkU1NYB1LiCtN1MH93cGunWiaQ8BdCX7Z ZgsmHOzbX/rQ/eaCTQxmglEYM1eF5Acs3X7YjwcXGCxxA+YmMNJ9KusKJIy+PJBiUoTu 9YAUgKj6Mav4lvvxnawWFuYZssG1c10z+OnC4B82H9XiTF0JOk97ijlKMGIhbPjcuX84 5sSagrKzEPm1x4gbm6SAuMr6DZGlGAVanARPBrvIhkyzzWWqPPCfXqSOvU8WkWLfcv1D hFNtvDRsN55SbP7KxT7JsjguWojK7PsdSopOSvd7GgBz+Vjo56o3+VJJ9biIkPQEkCbt b25w== 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=X7436XTZEUH0skOXPVqhRSTuPQxMmkLlJixFm1tw4yM=; b=qi0hwE/HSVOih9vMMJ4rA5ZQ8iOxn1XD5p4qMqFqOJpSV/pww7OGmQBv0qIkZ+LwBz ngVaJJEIrr5DVaJA9SNaaY0IvTkBD75CYqKTa1p/EE1IdRerZOfC6XuUZiaRXq7EYtnM 19N6YPwNoMOs4HzAMl+05SHPGxfptH5HemYI+L0Ak1il2b1lHVu0SjTeaUtTd6ixoUPu /dF2pzcK6GzTHEl8YI2D6bbifp1CLl1AATHR0TFe10uJ55wpvHYILRzv836BuvvrwD98 elkZPEOK76RxAusu+RbgLfZu5YcC7+3iPlZUABhBwd+7aiQqDyJRx91PaZijayn14zUK Nh8w== X-Gm-Message-State: AKwxytccpLXn8avGSAf2Y7YJIIIALH5iC0+6svzkzu3to9CTyLR2/jSO bWWFTvJOuEAG9DNGx23fjPsjZz0= X-Google-Smtp-Source: AH8x225NR/GwHCcQwANA9Pdn84+NWRa+UtgcmWxNjaNVm/w2xcXkjtYnKiLh1ZqUK7AbDFMkropIvA== X-Received: by 10.36.14.76 with SMTP id 73mr25518699ite.43.1517219766388; Mon, 29 Jan 2018 01:56:06 -0800 (PST) Received: from [192.168.1.3] (c-67-188-30-11.hsd1.ca.comcast.net. [67.188.30.11]) by smtp.googlemail.com with ESMTPSA id x82sm5982364itb.36.2018.01.29.01.56.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 01:56:05 -0800 (PST) Subject: Re: svn commit: r328489 - head/sys/conf To: "O. Hartmann" , David Wolfskill Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801272013.w0RKDaMU098200@repo.freebsd.org> <20180127214755.3c59661e@thor.intern.walstatt.dynvpn.de> From: Jason Harmening Message-ID: <98501f75-1a1b-9221-c52d-24415230a886@gmail.com> Date: Mon, 29 Jan 2018 02:10:04 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180127214755.3c59661e@thor.intern.walstatt.dynvpn.de> Content-Type: multipart/mixed; boundary="------------FA187B7F511EB9BDEF4EE648" Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:56:07 -0000 This is a multi-part message in MIME format. --------------FA187B7F511EB9BDEF4EE648 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > > This happens now if PORTS_MODULE=x11/nvidia-driver is defined in /etc/src.conf: > > [...] > --- kernel-install --- > mkdir -p /boot/kernel > install -p -m 555 -o root -g wheel kernel /boot/kernel/ > --- ports-install --- > Variable OBJTOP is recursive. > > make[8]: stopped > in /usr/obj/usr/src/amd64.amd64/sys/FY/usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-387.34/src/nvidia > *** Error code 2 > > Stop. > make[7]: stopped > in /usr/obj/usr/src/amd64.amd64/sys/THOR/usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-387.34/src > *** Error code 1 > David sent me logs of the failing case; thanks David! The failure happens when buildkernel and installkernel are run separately instead of all-up, e.g. 'make kernel'. The installkernel step is leaving MK_AUTO_OBJ=no in the env passed to the port build. It looks like at least one of the install stages of nvidia-driver needs to generate temporary output, which leads to confusion when the port isn't built as though it's an in-tree component. Can you guys try out the attached patch? --------------FA187B7F511EB9BDEF4EE648 Content-Type: text/plain; charset=UTF-8; name="patch_auto_obj" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="patch_auto_obj" SW5kZXg6IHN5cy9jb25mL2tlcm4ucG9zdC5tawo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvY29u Zi9rZXJuLnBvc3QubWsJKHJldmlzaW9uIDMyODQ4OSkKKysrIHN5cy9jb25mL2tlcm4ucG9z dC5tawkod29ya2luZyBjb3B5KQpAQCAtNzAsNyArNzAsOCBAQAogCS11IENYWCBcCiAJLXUg Q1BQIFwKIAktdSBNQUtFU1lTUEFUSCBcCi0JTUFLRUZMQUdTPSIke01BS0VGTEFHUzpNKjp0 VzpTL14tbSAvLW1fL2c6Uy8gLW0gLyAtbV8vZzp0dzpOLW1fKn0iIFwKKwlNS19BVVRPX09C Sj15ZXMgXAorCU1BS0VGTEFHUz0iJHtNQUtFRkxBR1M6TSo6dFc6Uy9eLW0gLy1tXy9nOlMv IC1tIC8gLW1fL2c6dHc6Ti1tXyo6Tk1LX0FVVE9fT0JKPSp9IiBcCiAJU1lTRElSPSR7U1lT RElSfSBcCiAJUEFUSD0ke1BBVEh9OiR7TE9DQUxCQVNFfS9iaW46JHtMT0NBTEJBU0V9L3Ni aW4gXAogCVNSQ19CQVNFPSR7U1JDX0JBU0V9IFwK --------------FA187B7F511EB9BDEF4EE648-- From owner-svn-src-all@freebsd.org Mon Jan 29 10:19:15 2018 Return-Path: Delivered-To: svn-src-all@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 DE100EE1A29; Mon, 29 Jan 2018 10:19:15 +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 8FB1269035; Mon, 29 Jan 2018 10:19:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8620626BFB; Mon, 29 Jan 2018 10:19:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TAJFVB036173; Mon, 29 Jan 2018 10:19:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TAJFfY036172; Mon, 29 Jan 2018 10:19:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801291019.w0TAJFfY036172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 29 Jan 2018 10:19:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328539 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 328539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 10:19:16 -0000 Author: kib Date: Mon Jan 29 10:19:15 2018 New Revision: 328539 URL: https://svnweb.freebsd.org/changeset/base/328539 Log: MFC r328264: Fix compat32 for sysctl net.PF_ROUTE...NET_RT_IFLISTL. Modified: stable/11/sys/net/rtsock.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/rtsock.c ============================================================================== --- stable/11/sys/net/rtsock.c Mon Jan 29 09:27:32 2018 (r328538) +++ stable/11/sys/net/rtsock.c Mon Jan 29 10:19:15 2018 (r328539) @@ -110,6 +110,12 @@ struct ifa_msghdrl32 { int32_t ifam_metric; struct if_data ifam_data; }; + +#define SA_SIZE32(sa) \ + ( (((struct sockaddr *)(sa))->sa_len == 0) ? \ + sizeof(int) : \ + 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(int) - 1) ) ) + #endif /* COMPAT_FREEBSD32 */ MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables"); @@ -1114,6 +1120,9 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo struct sockaddr_storage ss; struct sockaddr_in6 *sin6; #endif +#ifdef COMPAT_FREEBSD32 + bool compat32 = false; +#endif switch (type) { @@ -1121,9 +1130,10 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo case RTM_NEWADDR: if (w != NULL && w->w_op == NET_RT_IFLISTL) { #ifdef COMPAT_FREEBSD32 - if (w->w_req->flags & SCTL_MASK32) + if (w->w_req->flags & SCTL_MASK32) { len = sizeof(struct ifa_msghdrl32); - else + compat32 = true; + } else #endif len = sizeof(struct ifa_msghdrl); } else @@ -1137,6 +1147,7 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo len = sizeof(struct if_msghdrl32); else len = sizeof(struct if_msghdr32); + compat32 = true; break; } #endif @@ -1167,7 +1178,12 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo if ((sa = rtinfo->rti_info[i]) == NULL) continue; rtinfo->rti_addrs |= (1 << i); - dlen = SA_SIZE(sa); +#ifdef COMPAT_FREEBSD32 + if (compat32) + dlen = SA_SIZE32(sa); + else +#endif + dlen = SA_SIZE(sa); if (cp != NULL && buflen >= dlen) { #ifdef INET6 if (V_deembed_scopeid && sa->sa_family == AF_INET6) { From owner-svn-src-all@freebsd.org Mon Jan 29 10:25:52 2018 Return-Path: Delivered-To: svn-src-all@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 46941EE1E0B; Mon, 29 Jan 2018 10:25:52 +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 B37E0694B5; Mon, 29 Jan 2018 10:25:51 +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 8B579273B1; Mon, 29 Jan 2018 10:25:49 +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 w0TAPYEh032795 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 29 Jan 2018 10:25:34 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0TAPYeT032794; Mon, 29 Jan 2018 10:25:34 GMT (envelope-from phk) To: Oleksandr Tymoshenko cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180129063950.GA59901@bluezbox.com> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32792.1517221533.1@critter.freebsd.dk> Date: Mon, 29 Jan 2018 10:25:34 +0000 Message-ID: <32793.1517221534@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 10:25:52 -0000 -------- In message <20180129063950.GA59901@bluezbox.com>, Oleksandr Tymoshenko writes: >PWM drivers: https://reviews.freebsd.org/D14104 I'll test this in my next timeslot. >We do not include these >overlays in official snapshots and I think this should be fixed. That's one of the details I ran into: The DTS for the DTB in the RaspBSD.org images is not in our tree. Even if they are vendor-supplied, should they be in our tree for reasons of completeness/documentation/reproducible builds etc. ? >Summary: adding ofw_bus_status_okay check in probe method doesn't >require any additional functionality, ignoring it is inconsistent >with majority of FDT-based drivers' behavior. There is trivial >way to enable PWM device in platform-conformant way. Will you >please commit fix for this bug? I prefer an architectural discussion about how we *want* this to work in the long run first. My input: If I pick a RPI[23] out of the box, download a FreeBSD image, put the card in and play around, I should be able to put a LED in a breadboard and configure a line for PWM or attach an I2C or SPI device without reboot between every single experiment. If I mount any kind of "cape" board, requiring a reboot is a perfectly reasonable requirement (not to mention it being sane ESD procedure.) That may indicate an overall model where we distinguish between "overlays loaded at boottime" and "no overlays loaded at boot time" and behave more liberally in the second case. Or maybe we just need a well hidden but powerful switch that lets people say "God, Root, What difference?" The crucial point is that we gain no friends or favours by enforcing needless cumbersome procedures, like reboots, just because there may some times be dangers without it, because very often the dangerous things people want to do is getting their job done or develop and improve FreeBSD. I kindly point you to the wisdom of Kernighans "There is no escape" critique of PASCAL. (Service message to the non-ancient developers: That this bit of advice came from the bloke who had read Kernighan and therefore implemented "kern.geom.debugflags=0x10" to defeat the consistency protections in his new-fangled GEOM subsystem, even if it was dangerous - and he never once regretted it.) >All these best practices and guidelines are unwriteen, and >they're not always implemented on older platforms. And it's the >problem from which this situation has risen. With the added cherry on top that RPi is a horrible platform which nobody loves - except thousands of teachers, students, hackers and other potential FreeBSD recruits. Poul-Henning -- 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-all@freebsd.org Mon Jan 29 10:33:56 2018 Return-Path: Delivered-To: svn-src-all@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 829B4EE236D; Mon, 29 Jan 2018 10:33:56 +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 35FCC699BA; Mon, 29 Jan 2018 10:33:56 +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 309AE26F11; Mon, 29 Jan 2018 10:33:56 +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 w0TAXuPv047400; Mon, 29 Jan 2018 10:33:56 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TAXuLY047399; Mon, 29 Jan 2018 10:33:56 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201801291033.w0TAXuLY047399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 29 Jan 2018 10:33:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328540 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 328540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 10:33:56 -0000 Author: ae Date: Mon Jan 29 10:33:55 2018 New Revision: 328540 URL: https://svnweb.freebsd.org/changeset/base/328540 Log: Assign IPv6 link-local address to loopback interfaces whith unit > 0. When an interface has IFF_LOOPBACK flag in6_ifattach() tries to assing IPv6 loopback address to this interface. It uses in6ifa_ifpwithaddr() to check, that interface doesn't already have given address and then uses in6_ifattach_loopback(). If in6_ifattach_loopback() fails, it just exits and thus skips assignment of IPv6 LLA. Fix this using in6ifa_ifwithaddr() function. If IPv6 loopback address is already assigned in the system, do not call in6_ifattach_loopback(). PR: 138678 MFC after: 3 weeks Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Mon Jan 29 10:19:15 2018 (r328539) +++ head/sys/netinet6/in6_ifattach.c Mon Jan 29 10:33:55 2018 (r328540) @@ -690,7 +690,6 @@ void in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) { struct in6_ifaddr *ia; - struct in6_addr in6; if (ifp->if_afdata[AF_INET6] == NULL) return; @@ -723,18 +722,16 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) /* * assign loopback address for loopback interface. - * XXX multiple loopback interface case. */ if ((ifp->if_flags & IFF_LOOPBACK) != 0) { - struct ifaddr *ifa; - - in6 = in6addr_loopback; - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &in6); - if (ifa == NULL) { - if (in6_ifattach_loopback(ifp) != 0) - return; - } else - ifa_free(ifa); + /* + * check that loopback address doesn't exist yet. + */ + ia = in6ifa_ifwithaddr(&in6addr_loopback, 0); + if (ia == NULL) + in6_ifattach_loopback(ifp); + else + ifa_free(&ia->ia_ifa); } /* @@ -742,18 +739,10 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) */ if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { - int error; - ia = in6ifa_ifpforlinklocal(ifp, 0); - if (ia == NULL) { - error = in6_ifattach_linklocal(ifp, altifp); -#if 0 - if (error) - log(LOG_NOTICE, "in6_ifattach_linklocal: " - "failed to add a link-local addr to %s\n", - if_name(ifp)); -#endif - } else + if (ia == NULL) + in6_ifattach_linklocal(ifp, altifp); + else ifa_free(&ia->ia_ifa); } From owner-svn-src-all@freebsd.org Mon Jan 29 11:03:30 2018 Return-Path: Delivered-To: svn-src-all@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 7EFA3EE3533; Mon, 29 Jan 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 2DD826A8BC; Mon, 29 Jan 2018 11:03:30 +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 28E00273D5; Mon, 29 Jan 2018 11:03:30 +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 w0TB3UTW065138; Mon, 29 Jan 2018 11:03:30 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TB3U2q065137; Mon, 29 Jan 2018 11:03:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201801291103.w0TB3U2q065137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 29 Jan 2018 11:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328541 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 328541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 11:03:30 -0000 Author: ae Date: Mon Jan 29 11:03:29 2018 New Revision: 328541 URL: https://svnweb.freebsd.org/changeset/base/328541 Log: Do not skip scope zone violation check, when mbuf has M_FASTFWD_OURS flag. When mbuf has M_FASTFWD_OURS flag, this means that a destination address is our local, but we still need to pass scope zone violation check, because protocol level expects that IPv6 link-local addresses have embedded scope zone indexes. This should fix the problem, when ipfw is used to forward packets to local address and source address of a packet is IPv6 LLA. Reported by: sbruno MFC after: 3 weeks Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Mon Jan 29 10:33:55 2018 (r328540) +++ head/sys/netinet6/ip6_input.c Mon Jan 29 11:03:29 2018 (r328541) @@ -573,10 +573,8 @@ ip6_input(struct mbuf *m) /* * Firewall changed destination to local. */ - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; ip6 = mtod(m, struct ip6_hdr *); - goto hbhcheck; + goto passin; } /* @@ -737,10 +735,8 @@ ip6_input(struct mbuf *m) if ((m = ip6_tryforward(m)) == NULL) return; if (m->m_flags & M_FASTFWD_OURS) { - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; ip6 = mtod(m, struct ip6_hdr *); - goto hbhcheck; + goto passin; } } #if defined(IPSEC) || defined(IPSEC_SUPPORT) @@ -771,13 +767,7 @@ ip6_input(struct mbuf *m) return; ip6 = mtod(m, struct ip6_hdr *); srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst); - - if (m->m_flags & M_FASTFWD_OURS) { - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; - goto hbhcheck; - } - if ((m->m_flags & M_IP6_NEXTHOP) && + if ((m->m_flags & (M_IP6_NEXTHOP | M_FASTFWD_OURS)) == M_IP6_NEXTHOP && m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) { /* * Directly ship the packet on. This allows forwarding @@ -807,6 +797,11 @@ passin: in6_setscope(&ip6->ip6_dst, rcvif, NULL)) { IP6STAT_INC(ip6s_badscope); goto bad; + } + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ours = 1; + goto hbhcheck; } /* * Multicast check. Assume packet is for us to avoid From owner-svn-src-all@freebsd.org Mon Jan 29 11:07:04 2018 Return-Path: Delivered-To: svn-src-all@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 0FBB5EE389E; Mon, 29 Jan 2018 11:07:04 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E1F16ABAB; Mon, 29 Jan 2018 11:07:03 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward100j.mail.yandex.net (Yandex) with ESMTP id D7F815D81AA2; Mon, 29 Jan 2018 14:07:00 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id NeKXpaNeND-7008hecJ; Mon, 29 Jan 2018 14:07:00 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1517224020; bh=DIPhgRIoiURRqu+RSWGS6UbXDc/HIH4T5+Qvwwz2cwU=; h=Subject:From:To:References:Message-ID:Date:In-Reply-To; b=pvhB1S4shGXiBpkw/DDH4G7IqTqkafF7gAI7DMQ8ARAAaAx8UIGJPEkZBI2ezVJfR FN4Wpnw2rBbIclVyHQ0UlVeHGJy1uYYzO5XzBp/PlzdnefNdnzT4cAnhWBTV2CY2Yt jd8lFKdFX5qnF8viA5zBLAuUWNtFf0S/8z4QJEBU= Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id kSIWTqwagJ-70US5Q76; Mon, 29 Jan 2018 14:07:00 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1517224020; bh=DIPhgRIoiURRqu+RSWGS6UbXDc/HIH4T5+Qvwwz2cwU=; h=Subject:From:To:References:Message-ID:Date:In-Reply-To; b=pvhB1S4shGXiBpkw/DDH4G7IqTqkafF7gAI7DMQ8ARAAaAx8UIGJPEkZBI2ezVJfR FN4Wpnw2rBbIclVyHQ0UlVeHGJy1uYYzO5XzBp/PlzdnefNdnzT4cAnhWBTV2CY2Yt jd8lFKdFX5qnF8viA5zBLAuUWNtFf0S/8z4QJEBU= Authentication-Results: smtp1o.mail.yandex.net; dkim=pass header.i=@yandex.ru Subject: Re: svn commit: r328541 - head/sys/netinet6 From: "Andrey V. Elsukov" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801291103.w0TB3U2q065137@repo.freebsd.org> Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Message-ID: Date: Mon, 29 Jan 2018 14:06:20 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201801291103.w0TB3U2q065137@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WgZ5Nnv9NnMwVWXjyYMzcnNI0YRosAHea" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 11:07:04 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WgZ5Nnv9NnMwVWXjyYMzcnNI0YRosAHea Content-Type: multipart/mixed; boundary="Vow5lVdxhR1XE6SesbdK9oMvOQP7OGQLQ"; protected-headers="v1" From: "Andrey V. Elsukov" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r328541 - head/sys/netinet6 References: <201801291103.w0TB3U2q065137@repo.freebsd.org> In-Reply-To: <201801291103.w0TB3U2q065137@repo.freebsd.org> --Vow5lVdxhR1XE6SesbdK9oMvOQP7OGQLQ Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 29.01.2018 14:03, Andrey V. Elsukov wrote: > Log: > Do not skip scope zone violation check, when mbuf has M_FASTFWD_OURS = flag. > =20 > When mbuf has M_FASTFWD_OURS flag, this means that a destination addr= ess > is our local, but we still need to pass scope zone violation check, > because protocol level expects that IPv6 link-local addresses have > embedded scope zone indexes. This should fix the problem, when ipfw i= s > used to forward packets to local address and source address of a pack= et > is IPv6 LLA. > =20 > Reported by: sbruno Sorry, I thought about another problem when wrote this line, should be asomers@. --=20 WBR, Andrey V. Elsukov --Vow5lVdxhR1XE6SesbdK9oMvOQP7OGQLQ-- --WgZ5Nnv9NnMwVWXjyYMzcnNI0YRosAHea Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlpvACwACgkQAcXqBBDI oXrViQgAgEvvK2FhFpGkP7Ejp+DoPrj4XS7j+MmJJgfXpToruuQGmwIW/DmQOb8r TgZZKw9DEZq+KiN584LqasPLN6eP626U5IxmI8RO+jTZU7uF9msj3v4muKUgvM1z Nfr84mOHjwMowNeswaoIXXYosSNGc5SVPb2KP2bDs+WOyOu2QktBVrI6ujL4bsm/ ui8Juvv1x0d5TuD1d7VJxBDRNoSu/iJ+J12KRsTpdJSk7w9y7w1iKzYixvAClosG 8oZrlq5SgdXyV+1XOVMrqRC4kBzIM4Ov9HGuMxgC9XAu3icHgNaX7k7di1WgkuII Qva1Z63uxNKeYI15E3xNlsOhOUGvrg== =gka4 -----END PGP SIGNATURE----- --WgZ5Nnv9NnMwVWXjyYMzcnNI0YRosAHea-- From owner-svn-src-all@freebsd.org Mon Jan 29 13:00:31 2018 Return-Path: Delivered-To: svn-src-all@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 8E7D9EC5796; Mon, 29 Jan 2018 13:00:31 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from mx.catwhisker.org (mx.catwhisker.org [198.144.209.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2BA67181D; Mon, 29 Jan 2018 13:00:30 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (localhost [127.0.0.1]) by albert.catwhisker.org (8.15.2/8.15.2) with ESMTP id w0TD0MUh015232; Mon, 29 Jan 2018 13:00:22 GMT (envelope-from david@albert.catwhisker.org) Received: (from david@localhost) by albert.catwhisker.org (8.15.2/8.15.2/Submit) id w0TD0Mtp015231; Mon, 29 Jan 2018 05:00:22 -0800 (PST) (envelope-from david) Date: Mon, 29 Jan 2018 05:00:22 -0800 From: David Wolfskill To: Jason Harmening Cc: "O. Hartmann" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328489 - head/sys/conf Message-ID: <20180129130022.GT1125@albert.catwhisker.org> References: <201801272013.w0RKDaMU098200@repo.freebsd.org> <20180127214755.3c59661e@thor.intern.walstatt.dynvpn.de> <98501f75-1a1b-9221-c52d-24415230a886@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bAwSoJxbKYwy34Oe" Content-Disposition: inline In-Reply-To: <98501f75-1a1b-9221-c52d-24415230a886@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:00:31 -0000 --bAwSoJxbKYwy34Oe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 29, 2018 at 02:10:04AM -0800, Jason Harmening wrote: > >=20 > > This happens now if PORTS_MODULE=3Dx11/nvidia-driver is defined in /etc= /src.conf: > >=20 > > [...] > > --- kernel-install --- > > mkdir -p /boot/kernel > > install -p -m 555 -o root -g wheel kernel /boot/kernel/ > > --- ports-install --- > > Variable OBJTOP is recursive. > >=20 > > make[8]: stopped > ... >=20 > David sent me logs of the failing case; thanks David! Happy to help! :-) > The failure happens when buildkernel and installkernel are run=20 > separately instead of all-up, e.g. 'make kernel'. The installkernel=20 > step is leaving MK_AUTO_OBJ=3Dno in the env passed to the port build. It= =20 > looks like at least one of the install stages of nvidia-driver needs to= =20 > generate temporary output, which leads to confusion when the port isn't= =20 > built as though it's an in-tree component. >=20 > Can you guys try out the attached patch? I tried it both on my build machine (which does not use kernel modules =66rom ports, and thus did not exhibit the problem -- but I thought that verifying that the patch did not break that case worth checking) and on my laptop (which did exhibit the problem). It worked in both cases with no issues for me. Thanks! :-) Peace, david --=20 David H. Wolfskill david@catwhisker.org "unfortunately, no trust!=E2=80=9D -- well, of course! You reap what you s= ow. See http://www.catwhisker.org/~david/publickey.gpg for my public key. --bAwSoJxbKYwy34Oe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEEzLfO+ReoAfQwZNd7FTnMQKBJ7hcFAlpvGuZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEND QjdDRUY5MTdBODAxRjQzMDY0RDc3QjE1MzlDQzQwQTA0OUVFMTcACgkQFTnMQKBJ 7heZ7QgAsyi5myq2vhU7CZ6c1BrTeyOUMXXvtiiS/CIWoTxwrGVLHDFDCVxn0O9s CfTPxETnyV4kdM6r0mZeGMMMvQTcEPb2iJx1n1lsYshaJ6FrEeobGKdyCAvOVS6r TRUuRsFM6SNoY5BdOOwolmQzVbWCi1TrFRWEwsA1inkY8ndhqM4u9iZDZqmeQoql jNPYx4dEvR1lNXOnJ8CzS7QlNe4JE5rvSvJGmHW4KTotRBcYTwLj10UwQhVLAnxe R9Ez6qfCGlJEHlRywA2bF5MAVi8GhncH4r+o6J4h8gf3SqdZvxOHMAZV8YZkPNzM ewSiZi5qHBRUy+CJpQYf1zzJ8deGPg== =9LA2 -----END PGP SIGNATURE----- --bAwSoJxbKYwy34Oe-- From owner-svn-src-all@freebsd.org Mon Jan 29 13:27:45 2018 Return-Path: Delivered-To: svn-src-all@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 1D3C1EC70CA; Mon, 29 Jan 2018 13:27:45 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD80F72C10; Mon, 29 Jan 2018 13:27:44 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89 (FreeBSD)) (envelope-from ) id 1eg9TG-000Hnm-Md; Mon, 29 Jan 2018 05:27:41 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id w0TDRaoP068433; Mon, 29 Jan 2018 05:27:36 -0800 (PST) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Mon, 29 Jan 2018 05:27:36 -0800 From: Oleksandr Tymoshenko To: Poul-Henning Kamp Cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-ID: <20180129132736.GA66330@bluezbox.com> References: <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32793.1517221534@critter.freebsd.dk> X-Operating-System: FreeBSD/11.1-RELEASE-p4 (amd64) User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <20180129063950.GA59901@bluezbox.com>, Oleksandr Tymoshenko writes: > > >PWM drivers: https://reviews.freebsd.org/D14104 > > I'll [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:27:45 -0000 Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <20180129063950.GA59901@bluezbox.com>, Oleksandr Tymoshenko writes: > > >PWM drivers: https://reviews.freebsd.org/D14104 > > I'll test this in my next timeslot. > > >We do not include these > >overlays in official snapshots and I think this should be fixed. > > That's one of the details I ran into: The DTS for the DTB > in the RaspBSD.org images is not in our tree. > > Even if they are vendor-supplied, should they be in our tree for > reasons of completeness/documentation/reproducible builds etc. ? The answer is: it's complicated. There is no single source of truth. Raspberry Pi's DTS in vendor tree is different from the one in mainline Linux and therefore ours (we lag a bit behind mainline Linux). As far as I know Nvidia is the same. DTS world is a mess and that's why people spend so much energy communicating between vendors, mainline Linux and FreeBSD to get this stuff standartized and to reduce chaos. Also FDT should be supplied by vendor by definition. Closest thing to FDT in beige box world is ACPI tables. It's just unfortunate state of affairs that standard is in constant flux and Linux monopolized distribution rights. > >Summary: adding ofw_bus_status_okay check in probe method doesn't > >require any additional functionality, ignoring it is inconsistent > >with majority of FDT-based drivers' behavior. There is trivial > >way to enable PWM device in platform-conformant way. Will you > >please commit fix for this bug? > > I prefer an architectural discussion about how we *want* this to > work in the long run first. > > My input: > > If I pick a RPI[23] out of the box, download a FreeBSD image, > put the card in and play around, I should be able to put a > LED in a breadboard and configure a line for PWM or attach > an I2C or SPI device without reboot between every single > experiment. No problem. We include pwm.dtbo in our snapshot and config.txt. We have PWM running out of the box. Problem solved, no need for any hacks. I'll gladly work with Glen and Brad to get this functionality in snapshots/builds. > If I mount any kind of "cape" board, requiring a reboot is > a perfectly reasonable requirement (not to mention it being > sane ESD procedure.) > > That may indicate an overall model where we distinguish between > "overlays loaded at boottime" and "no overlays loaded at > boot time" and behave more liberally in the second case. > > Or maybe we just need a well hidden but powerful switch that > lets people say "God, Root, What difference?" > > The crucial point is that we gain no friends or favours by enforcing > needless cumbersome procedures, like reboots, just because there > may some times be dangers without it, because very often the dangerous > things people want to do is getting their job done or develop > and improve FreeBSD. > > I kindly point you to the wisdom of Kernighans "There is no > escape" critique of PASCAL. > > (Service message to the non-ancient developers: That this bit of > advice came from the bloke who had read Kernighan and therefore > implemented "kern.geom.debugflags=0x10" to defeat the consistency > protections in his new-fangled GEOM subsystem, even if it was > dangerous - and he never once regretted it.) Design discussion on dynamic overlays is welcome. FreeBSD/arm can use more hands, brains, and set of fresh eyes. It's non-trivial topic and I am really glad someone is working on it. I gave up year ago. But committing bad hack and then requesting design discussion is a hostage situation and not a dialog. Raspberry Pi and other hobbyist ARM boards are basically Lego. They can be turned into multiple things and that's their selling point. They're hackers' toys. You approach them as a box product and you approach them from the wrong angle. If you want box product built with Lego, concentrate on how blocks are put together, not on how joints work. It looks to me like you apply your experience from x86 world and look at FDT-based platforms as a smaller and weirder PCs. They're not, they're completely different breed. They're not even embedded systems with ad-hoc hardware info from 10 years ago, they're order of magnitude more complex. With all due respect the fact that we're having this discussion or that I have to explain FDT/DTS files origins is an indicator of how little you understand current situation in hobbyist embedded world or embedded FreeBSD for that matters. I've been working on this stuff for last 5 years on and off, lately mostly off and I know I am behind all the latest developments. "Don't ignore status property unless you really, really, really have to" is not even a discussion point, it's a common knowledge that comes from years of people's work across multiple ARM platforms. It wasn't common knowledge 5 years ago but it is now. So to summarize: - Please revert PWM probe method to standard driver behavior - I'll work with Glen and Brad to get PWM working out of the box on snapshots and RaspBSD builds. > >All these best practices and guidelines are unwriteen, and > >they're not always implemented on older platforms. And it's the > >problem from which this situation has risen. > > With the added cherry on top that RPi is a horrible platform which > nobody loves - except thousands of teachers, students, hackers and > other potential FreeBSD recruits. You ignored my question: what would be authoritative source for this kind of info? World is not perfect, FreeBSD/arm support is not perfect. We have limited resources. Where we should apply them to guide new contributors? You also ignored my question about clkman fix. Provided you have all the documentation you need and no external obstacles would you be up to converting clkman to extres/clk framework in foreseeable future? -- gonzo From owner-svn-src-all@freebsd.org Mon Jan 29 13:45:52 2018 Return-Path: Delivered-To: svn-src-all@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 46D0AEC8120; Mon, 29 Jan 2018 13:45:52 +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 C3F4E739D9; Mon, 29 Jan 2018 13:45:51 +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 5953927395; Mon, 29 Jan 2018 13:45:48 +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 w0TDjWkg033454 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 29 Jan 2018 13:45:32 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0TDjVcN033453; Mon, 29 Jan 2018 13:45:31 GMT (envelope-from phk) To: Oleksandr Tymoshenko cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180129132736.GA66330@bluezbox.com> From: "Poul-Henning Kamp" References: <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <33451.1517233531.1@critter.freebsd.dk> Date: Mon, 29 Jan 2018 13:45:31 +0000 Message-ID: <33452.1517233531@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:45:52 -0000 -------- In message <20180129132736.GA66330@bluezbox.com>, Oleksandr Tymoshenko writes: >> If I pick a RPI[23] out of the box, download a FreeBSD image, >> put the card in and play around, I should be able to put a >> LED in a breadboard and configure a line for PWM or attach >> an I2C or SPI device without reboot between every single >> experiment. > >No problem. We include pwm.dtbo in our snapshot and config.txt. >We have PWM running out of the box. Problem solved, no need for >any hacks. I'll gladly work with Glen and Brad to get this >functionality in snapshots/builds. You seem to have skipped the bit about "without reboot" ? >Raspberry Pi and other hobbyist ARM boards are basically Lego. >They can be turned into multiple things and that's their selling >point. They're hackers' toys. That's *exactly* why I want us to support them better. >You ignored my question: what would be authoritative source for this >kind of info? World is not perfect, FreeBSD/arm support is not perfect. >We have limited resources. Where we should apply them to guide >new contributors? At the very least have some place to point developers for a resonably up-to-date idea of what the FDT related architecture in FreeBSD is. Either documentation or source code (preferably with a bit of contextual comments) on our chosen reference platform. (Source code on ref-platform is probably more robust, as there is a better chance that it will be kept current.) >You also ignored my question about clkman fix. Provided you have >all the documentation you need [...] I don't. The information for the PWM case was based on an affine transform of information for the GPIO clock some shrewed guesses and finally in-lab measurement of what actually transpired when I frobbed registers. But more importantly, I have no idea what servies *a* clock manager offers, through which apis and to what clients and at what level of abstraction and flexibility ? -- 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-all@freebsd.org Mon Jan 29 13:48:16 2018 Return-Path: Delivered-To: svn-src-all@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 661CBEC82B5; Mon, 29 Jan 2018 13:48:16 +0000 (UTC) (envelope-from emaste@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 181DE73B7C; Mon, 29 Jan 2018 13:48:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E4C8DED; Mon, 29 Jan 2018 13:48:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDmFMa062724; Mon, 29 Jan 2018 13:48:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDmFgu062723; Mon, 29 Jan 2018 13:48:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291348.w0TDmFgu062723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328542 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:48:16 -0000 Author: emaste Date: Mon Jan 29 13:48:15 2018 New Revision: 328542 URL: https://svnweb.freebsd.org/changeset/base/328542 Log: lld: Use lookup instead of find. NFC, just simpler. Obtained from: LLVM r323395 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 11:03:29 2018 (r328541) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:48:15 2018 (r328542) @@ -617,9 +617,8 @@ MemoryRegion *LinkerScript::findMemoryRegion(OutputSec // If a memory region name was specified in the output section command, // then try to find that region first. if (!Sec->MemoryRegionName.empty()) { - auto It = MemoryRegions.find(Sec->MemoryRegionName); - if (It != MemoryRegions.end()) - return It->second; + if (MemoryRegion *M = MemoryRegions.lookup(Sec->MemoryRegionName)) + return M; error("memory region '" + Sec->MemoryRegionName + "' not declared"); return nullptr; } From owner-svn-src-all@freebsd.org Mon Jan 29 13:49:10 2018 Return-Path: Delivered-To: svn-src-all@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 D14E4EC8366; Mon, 29 Jan 2018 13:49:10 +0000 (UTC) (envelope-from emaste@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 83B0B73CC9; Mon, 29 Jan 2018 13:49:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65CE8DEE; Mon, 29 Jan 2018 13:49:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDnApx062805; Mon, 29 Jan 2018 13:49:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDnAuN062803; Mon, 29 Jan 2018 13:49:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291349.w0TDnAuN062803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:49:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328543 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:49:11 -0000 Author: emaste Date: Mon Jan 29 13:49:10 2018 New Revision: 328543 URL: https://svnweb.freebsd.org/changeset/base/328543 Log: lld: Only lookup LMARegion once. NFC. This is similar to how we handle MemRegion. Obtained from: LLVM r323396 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp head/contrib/llvm/tools/lld/ELF/OutputSections.h Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:48:15 2018 (r328542) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:49:10 2018 (r328543) @@ -661,13 +661,9 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; }; } - if (!Sec->LMARegionName.empty()) { - if (MemoryRegion *MR = MemoryRegions.lookup(Sec->LMARegionName)) { - uint64_t Offset = MR->Origin - Dot; - Ctx->LMAOffset = [=] { return Offset; }; - } else { - error("memory region '" + Sec->LMARegionName + "' not declared"); - } + if (MemoryRegion *MR = Sec->LMARegion) { + uint64_t Offset = MR->Origin - Dot; + Ctx->LMAOffset = [=] { return Offset; }; } // If neither AT nor AT> is specified for an allocatable section, the linker @@ -796,6 +792,12 @@ void LinkerScript::adjustSectionsAfterSorting() { if (auto *Sec = dyn_cast(Base)) { if (!Sec->Live) continue; + if (!Sec->LMARegionName.empty()) { + if (MemoryRegion *M = MemoryRegions.lookup(Sec->LMARegionName)) + Sec->LMARegion = M; + else + error("memory region '" + Sec->LMARegionName + "' not declared"); + } Sec->MemRegion = findMemoryRegion(Sec); // Handle align (e.g. ".foo : ALIGN(16) { ... }"). if (Sec->AlignExpr) Modified: head/contrib/llvm/tools/lld/ELF/OutputSections.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/OutputSections.h Mon Jan 29 13:48:15 2018 (r328542) +++ head/contrib/llvm/tools/lld/ELF/OutputSections.h Mon Jan 29 13:49:10 2018 (r328543) @@ -89,6 +89,7 @@ class OutputSection final : public BaseCommand, public // The following members are normally only used in linker scripts. MemoryRegion *MemRegion = nullptr; + MemoryRegion *LMARegion = nullptr; Expr AddrExpr; Expr AlignExpr; Expr LMAExpr; From owner-svn-src-all@freebsd.org Mon Jan 29 13:50:29 2018 Return-Path: Delivered-To: svn-src-all@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 954ECEC8494; Mon, 29 Jan 2018 13:50:29 +0000 (UTC) (envelope-from emaste@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 3BDF773E34; Mon, 29 Jan 2018 13:50:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32813DF2; Mon, 29 Jan 2018 13:50:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDoTWR062927; Mon, 29 Jan 2018 13:50:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDoSNe062924; Mon, 29 Jan 2018 13:50:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291350.w0TDoSNe062924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328544 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:50:29 -0000 Author: emaste Date: Mon Jan 29 13:50:28 2018 New Revision: 328544 URL: https://svnweb.freebsd.org/changeset/base/328544 Log: lld: Remove MemRegionOffset. NFC. We can just use a member variable in MemoryRegion. Obtained from: LLVM r323399 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp head/contrib/llvm/tools/lld/ELF/LinkerScript.h head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:49:10 2018 (r328543) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:50:28 2018 (r328544) @@ -590,7 +590,7 @@ void LinkerScript::output(InputSection *S) { // If there is a memory region associated with this input section, then // place the section in that region and update the region index. if (Ctx->MemRegion) { - uint64_t &CurOffset = Ctx->MemRegionOffset[Ctx->MemRegion]; + uint64_t &CurOffset = Ctx->MemRegion->CurPos; CurOffset += Pos - Before; uint64_t CurSize = CurOffset - Ctx->MemRegion->Origin; if (CurSize > Ctx->MemRegion->Length) { @@ -652,7 +652,7 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Ctx->MemRegion = Sec->MemRegion; if (Ctx->MemRegion) - Dot = Ctx->MemRegionOffset[Ctx->MemRegion]; + Dot = Ctx->MemRegion->CurPos; switchTo(Sec); @@ -693,7 +693,7 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Cmd->Offset = Dot - Ctx->OutSec->Addr; Dot += Cmd->Size; if (Ctx->MemRegion) - Ctx->MemRegionOffset[Ctx->MemRegion] += Cmd->Size; + Ctx->MemRegion->CurPos += Cmd->Size; Ctx->OutSec->Size = Dot - Ctx->OutSec->Addr; continue; } @@ -888,8 +888,8 @@ void LinkerScript::allocateHeaders(std::vectorMemoryRegions) { - const MemoryRegion *MR = MRI.second; - MemRegionOffset[MR] = MR->Origin; + MemoryRegion *MR = MRI.second; + MR->CurPos = MR->Origin; } } Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:49:10 2018 (r328543) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:50:28 2018 (r328544) @@ -118,11 +118,17 @@ enum class ConstraintKind { NoConstraint, ReadOnly, Re // target memory. Instances of the struct are created by parsing the // MEMORY command. struct MemoryRegion { + MemoryRegion(StringRef Name, uint64_t Origin, uint64_t Length, uint32_t Flags, + uint32_t NegFlags) + : Name(Name), Origin(Origin), Length(Length), Flags(Flags), + NegFlags(NegFlags) {} + std::string Name; uint64_t Origin; uint64_t Length; uint32_t Flags; uint32_t NegFlags; + uint64_t CurPos = 0; }; // This struct represents one section match pattern in SECTIONS() command. @@ -200,7 +206,6 @@ class LinkerScript final { uint64_t ThreadBssOffset = 0; OutputSection *OutSec = nullptr; MemoryRegion *MemRegion = nullptr; - llvm::DenseMap MemRegionOffset; std::function LMAOffset; }; Modified: head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Mon Jan 29 13:49:10 2018 (r328543) +++ head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Mon Jan 29 13:50:28 2018 (r328544) @@ -1293,8 +1293,8 @@ void ScriptParser::readMemory() { // Add the memory region to the region map. if (Script->MemoryRegions.count(Name)) setError("region '" + Name + "' already defined"); - MemoryRegion *MR = make(); - *MR = {Name, Origin, Length, Flags, NegFlags}; + MemoryRegion *MR = + make(Name, Origin, Length, Flags, NegFlags); Script->MemoryRegions[Name] = MR; } } From owner-svn-src-all@freebsd.org Mon Jan 29 13:51:13 2018 Return-Path: Delivered-To: svn-src-all@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 C7E27EC8670; Mon, 29 Jan 2018 13:51:13 +0000 (UTC) (envelope-from emaste@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 70851741C6; Mon, 29 Jan 2018 13:51:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B6AAF16; Mon, 29 Jan 2018 13:51:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDpDwi064647; Mon, 29 Jan 2018 13:51:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDpDmJ064645; Mon, 29 Jan 2018 13:51:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291351.w0TDpDmJ064645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:51:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328545 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:51:14 -0000 Author: emaste Date: Mon Jan 29 13:51:13 2018 New Revision: 328545 URL: https://svnweb.freebsd.org/changeset/base/328545 Log: lld: Simplify. NFC. Obtained from: LLVM r323440 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp head/contrib/llvm/tools/lld/ELF/LinkerScript.h Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:50:28 2018 (r328544) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:51:13 2018 (r328545) @@ -656,22 +656,18 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { switchTo(Sec); - if (Sec->LMAExpr) { - uint64_t D = Dot; - Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; }; - } + if (Sec->LMAExpr) + Ctx->LMAOffset = Sec->LMAExpr().getValue() - Dot; - if (MemoryRegion *MR = Sec->LMARegion) { - uint64_t Offset = MR->Origin - Dot; - Ctx->LMAOffset = [=] { return Offset; }; - } + if (MemoryRegion *MR = Sec->LMARegion) + Ctx->LMAOffset = MR->Origin - Dot; // If neither AT nor AT> is specified for an allocatable section, the linker // will set the LMA such that the difference between VMA and LMA for the // section is the same as the preceding output section in the same region // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html if (Ctx->LMAOffset) - Ctx->OutSec->LMAOffset = Ctx->LMAOffset(); + Ctx->OutSec->LMAOffset = Ctx->LMAOffset; // The Size previously denoted how many InputSections had been added to this // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:50:28 2018 (r328544) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:51:13 2018 (r328545) @@ -206,7 +206,7 @@ class LinkerScript final { uint64_t ThreadBssOffset = 0; OutputSection *OutSec = nullptr; MemoryRegion *MemRegion = nullptr; - std::function LMAOffset; + uint64_t LMAOffset = 0; }; llvm::DenseMap NameToOutputSection; From owner-svn-src-all@freebsd.org Mon Jan 29 13:52:43 2018 Return-Path: Delivered-To: svn-src-all@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 16D6EEC875A; Mon, 29 Jan 2018 13:52:43 +0000 (UTC) (envelope-from emaste@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 C12A37441D; Mon, 29 Jan 2018 13:52:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC270F7D; Mon, 29 Jan 2018 13:52:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDqg7q067596; Mon, 29 Jan 2018 13:52:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDqgIu067593; Mon, 29 Jan 2018 13:52:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291352.w0TDqgIu067593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328546 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:52:43 -0000 Author: emaste Date: Mon Jan 29 13:52:42 2018 New Revision: 328546 URL: https://svnweb.freebsd.org/changeset/base/328546 Log: lld: Improve LMARegion handling. This fixes the crash reported at [LLVM] PR36083. The issue is that we were trying to put all the sections in the same PT_LOAD and crashing trying to write past the end of the file. This also adds accounting for used space in LMARegion, without it all 3 PT_LOADs would have the same physical address. Obtained from: LLVM r323449 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp head/contrib/llvm/tools/lld/ELF/LinkerScript.h head/contrib/llvm/tools/lld/ELF/Writer.cpp Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:51:13 2018 (r328545) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:52:42 2018 (r328546) @@ -589,6 +589,10 @@ void LinkerScript::output(InputSection *S) { // If there is a memory region associated with this input section, then // place the section in that region and update the region index. + if (Ctx->LMARegion) + Ctx->LMARegion->CurPos += Pos - Before; + // FIXME: should we also produce overflow errors for LMARegion? + if (Ctx->MemRegion) { uint64_t &CurOffset = Ctx->MemRegion->CurPos; CurOffset += Pos - Before; @@ -651,6 +655,7 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { setDot(Sec->AddrExpr, Sec->Location, false); Ctx->MemRegion = Sec->MemRegion; + Ctx->LMARegion = Sec->LMARegion; if (Ctx->MemRegion) Dot = Ctx->MemRegion->CurPos; @@ -660,7 +665,7 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Ctx->LMAOffset = Sec->LMAExpr().getValue() - Dot; if (MemoryRegion *MR = Sec->LMARegion) - Ctx->LMAOffset = MR->Origin - Dot; + Ctx->LMAOffset = MR->CurPos - Dot; // If neither AT nor AT> is specified for an allocatable section, the linker // will set the LMA such that the difference between VMA and LMA for the @@ -690,6 +695,8 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Dot += Cmd->Size; if (Ctx->MemRegion) Ctx->MemRegion->CurPos += Cmd->Size; + if (Ctx->LMARegion) + Ctx->LMARegion->CurPos += Cmd->Size; Ctx->OutSec->Size = Dot - Ctx->OutSec->Addr; continue; } Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:51:13 2018 (r328545) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.h Mon Jan 29 13:52:42 2018 (r328546) @@ -206,6 +206,7 @@ class LinkerScript final { uint64_t ThreadBssOffset = 0; OutputSection *OutSec = nullptr; MemoryRegion *MemRegion = nullptr; + MemoryRegion *LMARegion = nullptr; uint64_t LMAOffset = 0; }; Modified: head/contrib/llvm/tools/lld/ELF/Writer.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Writer.cpp Mon Jan 29 13:51:13 2018 (r328545) +++ head/contrib/llvm/tools/lld/ELF/Writer.cpp Mon Jan 29 13:52:42 2018 (r328546) @@ -1626,7 +1626,8 @@ template std::vector Writer< // different flags or is loaded at a discontiguous address using AT linker // script command. uint64_t NewFlags = computeFlags(Sec->getPhdrFlags()); - if (Sec->LMAExpr || Flags != NewFlags) { + if (Sec->LMAExpr || Sec->MemRegion != Load->FirstSec->MemRegion || + Flags != NewFlags) { Load = AddHdr(PT_LOAD, NewFlags); Flags = NewFlags; } From owner-svn-src-all@freebsd.org Mon Jan 29 13:54:53 2018 Return-Path: Delivered-To: svn-src-all@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 E88D2EC88C7; Mon, 29 Jan 2018 13:54:52 +0000 (UTC) (envelope-from emaste@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 94F2F745A6; Mon, 29 Jan 2018 13:54:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B2FFF7E; Mon, 29 Jan 2018 13:54:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDsqDR067709; Mon, 29 Jan 2018 13:54:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDsqbc067706; Mon, 29 Jan 2018 13:54:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291354.w0TDsqbc067706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:54:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328547 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:54:53 -0000 Author: emaste Date: Mon Jan 29 13:54:51 2018 New Revision: 328547 URL: https://svnweb.freebsd.org/changeset/base/328547 Log: lld: Move LMAOffset from the OutputSection to the PhdrEntry. NFC. If two sections are in the same PT_LOAD, their relatives offsets, virtual address and physical addresses are all the same. [Rafael] initially wanted to have a single global LMAOffset, on the assumption that every ELF file was in practiced loaded contiguously in both physical and virtual memory. Unfortunately that is not the case. The linux kernel has: LOAD 0x200000 0xffffffff81000000 0x0000000001000000 0xced000 0xced000 R E 0x200000 LOAD 0x1000000 0xffffffff81e00000 0x0000000001e00000 0x15f000 0x15f000 RW 0x200000 LOAD 0x1200000 0x0000000000000000 0x0000000001f5f000 0x01b198 0x01b198 RW 0x200000 LOAD 0x137b000 0xffffffff81f7b000 0x0000000001f7b000 0x116000 0x1ec000 RWE 0x200000 The delta for all but the third PT_LOAD is the same: 0xffffffff80000000. [Rafael] thinks the 3rd one is a hack for implementing per cpu data, but we can't break that. Obtained from: LLVM r323456 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp head/contrib/llvm/tools/lld/ELF/OutputSections.h head/contrib/llvm/tools/lld/ELF/Writer.h Modified: head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:52:42 2018 (r328546) +++ head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp Mon Jan 29 13:54:51 2018 (r328547) @@ -671,8 +671,8 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { // will set the LMA such that the difference between VMA and LMA for the // section is the same as the preceding output section in the same region // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html - if (Ctx->LMAOffset) - Ctx->OutSec->LMAOffset = Ctx->LMAOffset; + if (PhdrEntry *L = Ctx->OutSec->PtLoad) + L->LMAOffset = Ctx->LMAOffset; // The Size previously denoted how many InputSections had been added to this // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to Modified: head/contrib/llvm/tools/lld/ELF/OutputSections.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/OutputSections.h Mon Jan 29 13:52:42 2018 (r328546) +++ head/contrib/llvm/tools/lld/ELF/OutputSections.h Mon Jan 29 13:54:51 2018 (r328547) @@ -49,7 +49,7 @@ class OutputSection final : public BaseCommand, public static bool classof(const BaseCommand *C); - uint64_t getLMA() const { return Addr + LMAOffset; } + uint64_t getLMA() const { return PtLoad ? Addr + PtLoad->LMAOffset : Addr; } template void writeHeaderTo(typename ELFT::Shdr *SHdr); unsigned SectionIndex; @@ -78,7 +78,6 @@ class OutputSection final : public BaseCommand, public // The following fields correspond to Elf_Shdr members. uint64_t Offset = 0; - uint64_t LMAOffset = 0; uint64_t Addr = 0; uint32_t ShName = 0; Modified: head/contrib/llvm/tools/lld/ELF/Writer.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Writer.h Mon Jan 29 13:52:42 2018 (r328546) +++ head/contrib/llvm/tools/lld/ELF/Writer.h Mon Jan 29 13:54:51 2018 (r328547) @@ -44,6 +44,7 @@ struct PhdrEntry { OutputSection *FirstSec = nullptr; OutputSection *LastSec = nullptr; bool HasLMA = false; + uint64_t LMAOffset = 0; }; void addReservedSymbols(); From owner-svn-src-all@freebsd.org Mon Jan 29 13:55:51 2018 Return-Path: Delivered-To: svn-src-all@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 EBF0EEC8986; Mon, 29 Jan 2018 13:55:50 +0000 (UTC) (envelope-from emaste@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 9E04A74707; Mon, 29 Jan 2018 13:55:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98D8BF7F; Mon, 29 Jan 2018 13:55:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TDtou2067821; Mon, 29 Jan 2018 13:55:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TDtoRB067819; Mon, 29 Jan 2018 13:55:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801291355.w0TDtoRB067819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jan 2018 13:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328548 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 13:55:51 -0000 Author: emaste Date: Mon Jan 29 13:55:50 2018 New Revision: 328548 URL: https://svnweb.freebsd.org/changeset/base/328548 Log: lld: Put the header in the first PT_LOAD even if that PT_LOAD has a LMAExpr The root problem is that we were creating a PT_LOAD just for the header. That was technically valid, but inconvenient: we should not be making the ELF discontinuous. The solution is to allow a section with LMAExpr to be added to a PT_LOAD if that PT_LOAD doesn't already have a LMAExpr. LLVM PR: 36017 Obtained from: LLVM r323625 by Rafael Espindola Modified: head/contrib/llvm/tools/lld/ELF/Writer.cpp head/contrib/llvm/tools/lld/ELF/Writer.h Modified: head/contrib/llvm/tools/lld/ELF/Writer.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Writer.cpp Mon Jan 29 13:54:51 2018 (r328547) +++ head/contrib/llvm/tools/lld/ELF/Writer.cpp Mon Jan 29 13:55:50 2018 (r328548) @@ -822,6 +822,8 @@ void PhdrEntry::add(OutputSection *Sec) { p_align = std::max(p_align, Sec->Alignment); if (p_type == PT_LOAD) Sec->PtLoad = this; + if (Sec->LMAExpr) + ASectionHasLMA = true; } // The beginning and the ending of .rel[a].plt section are marked @@ -1626,8 +1628,9 @@ template std::vector Writer< // different flags or is loaded at a discontiguous address using AT linker // script command. uint64_t NewFlags = computeFlags(Sec->getPhdrFlags()); - if (Sec->LMAExpr || Sec->MemRegion != Load->FirstSec->MemRegion || - Flags != NewFlags) { + if ((Sec->LMAExpr && Load->ASectionHasLMA) || + Sec->MemRegion != Load->FirstSec->MemRegion || Flags != NewFlags) { + Load = AddHdr(PT_LOAD, NewFlags); Flags = NewFlags; } Modified: head/contrib/llvm/tools/lld/ELF/Writer.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Writer.h Mon Jan 29 13:54:51 2018 (r328547) +++ head/contrib/llvm/tools/lld/ELF/Writer.h Mon Jan 29 13:55:50 2018 (r328548) @@ -44,6 +44,11 @@ struct PhdrEntry { OutputSection *FirstSec = nullptr; OutputSection *LastSec = nullptr; bool HasLMA = false; + + // True if any of the sections in this program header as a LMA specified via + // linker script: AT(addr). + bool ASectionHasLMA = false; + uint64_t LMAOffset = 0; }; From owner-svn-src-all@freebsd.org Mon Jan 29 14:00:34 2018 Return-Path: Delivered-To: svn-src-all@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 91243EC8CE1; Mon, 29 Jan 2018 14:00:34 +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 4411674A3D; Mon, 29 Jan 2018 14:00:34 +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 3E334F87; Mon, 29 Jan 2018 14:00:34 +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 w0TE0YJK069615; Mon, 29 Jan 2018 14:00:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TE0YdF069597; Mon, 29 Jan 2018 14:00:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801291400.w0TE0YdF069597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 29 Jan 2018 14:00:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328549 - head/lib/libregex/tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libregex/tests X-SVN-Commit-Revision: 328549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 14:00:34 -0000 Author: kevans Date: Mon Jan 29 14:00:33 2018 New Revision: 328549 URL: https://svnweb.freebsd.org/changeset/base/328549 Log: libregex: Mark gnuext test as an expected fail The test was added prematurely as a goal to reach with the GNU extension functionality, but the functionality has not yet been introduced. Mark it as an expected fail until that point. Modified: head/lib/libregex/tests/libregex_test.sh Modified: head/lib/libregex/tests/libregex_test.sh ============================================================================== --- head/lib/libregex/tests/libregex_test.sh Mon Jan 29 13:55:50 2018 (r328548) +++ head/lib/libregex/tests/libregex_test.sh Mon Jan 29 14:00:33 2018 (r328549) @@ -29,6 +29,10 @@ check() { local dataname="${1}"; shift + if [ "${dataname}" == "gnuext" ]; then + atf_expect_fail "GNU extensions are not currently implemented" + fi + prog="$(atf_get_srcdir)/h_regex" data="$(atf_get_srcdir)/data/${dataname}.in" From owner-svn-src-all@freebsd.org Mon Jan 29 14:15:45 2018 Return-Path: Delivered-To: svn-src-all@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 2D916EC96D5; Mon, 29 Jan 2018 14:15:45 +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 CB112754DF; Mon, 29 Jan 2018 14:15:44 +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 C18C112C9; Mon, 29 Jan 2018 14:15:44 +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 w0TEFiYv078097; Mon, 29 Jan 2018 14:15:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TEFi6r078096; Mon, 29 Jan 2018 14:15:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801291415.w0TEFi6r078096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 29 Jan 2018 14:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328550 - head/usr.bin/awk X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/awk X-SVN-Commit-Revision: 328550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 14:15:45 -0000 Author: kevans Date: Mon Jan 29 14:15:44 2018 New Revision: 328550 URL: https://svnweb.freebsd.org/changeset/base/328550 Log: awk(1): Don't install tests at all Tests were disconnected so that running `make check` in usr.bin/awk did not have any effect, but CI runs use installed tests. Fully disconnect tests/ from the build for the time being as a short term solutio Reported by: lwhsu Modified: head/usr.bin/awk/Makefile Modified: head/usr.bin/awk/Makefile ============================================================================== --- head/usr.bin/awk/Makefile Mon Jan 29 14:00:33 2018 (r328549) +++ head/usr.bin/awk/Makefile Mon Jan 29 14:15:44 2018 (r328550) @@ -32,6 +32,6 @@ maketab: ytab.h maketab.c ${BUILD_TOOLS_META} # awk needs some work before we can connect these tests to the build #HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests +#SUBDIR.${MK_TESTS}+= tests .include From owner-svn-src-all@freebsd.org Mon Jan 29 14:23:45 2018 Return-Path: Delivered-To: svn-src-all@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 B9552EC9D99; Mon, 29 Jan 2018 14:23:45 +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 6798575C55; Mon, 29 Jan 2018 14:23:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6280B1458; Mon, 29 Jan 2018 14:23:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TENj4l083138; Mon, 29 Jan 2018 14:23:45 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TENj8G083137; Mon, 29 Jan 2018 14:23:45 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801291423.w0TENj8G083137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 29 Jan 2018 14:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328551 - head/usr.sbin/pppctl X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.sbin/pppctl X-SVN-Commit-Revision: 328551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 14:23:45 -0000 Author: pfg Date: Mon Jan 29 14:23:44 2018 New Revision: 328551 URL: https://svnweb.freebsd.org/changeset/base/328551 Log: pppctl88) Avoid strcpy() copies on overlapping string. This may lead to unpredicatable behaviour on different platforms or C library implementations. Use an intermediate variable. Obtained from: DragonFlyBSD (git a861a526) Modified: head/usr.sbin/pppctl/pppctl.c Modified: head/usr.sbin/pppctl/pppctl.c ============================================================================== --- head/usr.sbin/pppctl/pppctl.c Mon Jan 29 14:15:44 2018 (r328550) +++ head/usr.sbin/pppctl/pppctl.c Mon Jan 29 14:23:44 2018 (r328551) @@ -121,6 +121,7 @@ static int Receive(int fd, int display) { static char Buffer[LINELEN]; + char temp[sizeof(Buffer)]; struct timeval t; int Result; char *last; @@ -185,7 +186,8 @@ Receive(int fd, int display) else flush = last - Buffer + 1; write(STDOUT_FILENO, Buffer, flush); - strcpy(Buffer, Buffer + flush); + strcpy(temp, Buffer + flush); + strcpy(Buffer, temp); len -= flush; } if ((Result = select(fd + 1, &f, NULL, NULL, &t)) <= 0) { From owner-svn-src-all@freebsd.org Mon Jan 29 15:57:27 2018 Return-Path: Delivered-To: svn-src-all@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 61625ECE5F9; Mon, 29 Jan 2018 15:57:27 +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 ED7C979475; Mon, 29 Jan 2018 15:57:26 +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 w0TFkOdo026834 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 29 Jan 2018 07:46:25 -0800 Subject: Re: svn commit: r328537 - in head/sys/powerpc: aim powernv To: Wojciech Macek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801290927.w0T9R2ot008700@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <2b1dc9be-493e-57fb-d012-0af52dc7475b@freebsd.org> Date: Mon, 29 Jan 2018 07:46:24 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201801290927.w0T9R2ot008700@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVbjZug4D12jF1IimEMHH9o/EA3m/zn95biE67yapnIfhbVFyaOd7ZClHeJgp6NOwiDOfsrStUh+CwIGBmwaAhs2yN+7d+jCssE= X-Sonic-ID: C;qKhmjwsF6BGbNNzcXaHR5A== M;8mb5jwsF6BGbNNzcXaHR5A== X-Spam-Flag: No X-Sonic-Spam-Details: 1.6/5.0 by cerberusd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 15:57:27 -0000 Can you explain why this is necessary? Both functions are run in the same context and this way of doing things breaks important abstraction barriers. Since it also breaks booting on pHyp systems, I would appreciate it if you could revert this pending review. -Nathan On 01/29/18 01:27, Wojciech Macek wrote: > Author: wma > Date: Mon Jan 29 09:27:02 2018 > New Revision: 328537 > URL: https://svnweb.freebsd.org/changeset/base/328537 > > Log: > PowerNV: move LPCR and LPID altering to cpudep_ap_early_bootstrap > > It turns out that under some circumstances we can get DSI or DSE before we set > LPCR and LPID so we should set it as early as possible. > > Authored by: Patryk Duda > Submitted by: Wojciech Macek > Obtained from: Semihalf > Sponsored by: IBM, QCM Technologies > > Modified: > head/sys/powerpc/aim/mp_cpudep.c > head/sys/powerpc/powernv/platform_powernv.c > > Modified: head/sys/powerpc/aim/mp_cpudep.c > ============================================================================== > --- head/sys/powerpc/aim/mp_cpudep.c Mon Jan 29 09:24:28 2018 (r328536) > +++ head/sys/powerpc/aim/mp_cpudep.c Mon Jan 29 09:27:02 2018 (r328537) > @@ -64,9 +64,6 @@ cpudep_ap_early_bootstrap(void) > register_t reg; > #endif > > - __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); > - powerpc_sync(); > - > switch (mfpvr() >> 16) { > case IBM970: > case IBM970FX: > @@ -86,7 +83,20 @@ cpudep_ap_early_bootstrap(void) > #endif > powerpc_sync(); > break; > + case IBMPOWER8: > + case IBMPOWER8E: > + isync(); > + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ > + mtspr(SPR_LPID, 0); > + isync(); > + > + mtspr(SPR_LPCR, LPCR_LPES); > + isync(); > + break; > } > + > + __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); > + powerpc_sync(); > } > > uintptr_t > > Modified: head/sys/powerpc/powernv/platform_powernv.c > ============================================================================== > --- head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 09:24:28 2018 (r328536) > +++ head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 09:27:02 2018 (r328537) > @@ -128,6 +128,7 @@ powernv_attach(platform_t plat) > pcell_t prop; > phandle_t cpu; > int res, len, node, idx; > + register_t msr; > > /* Ping OPAL again just to make sure */ > opal_check(); > @@ -141,6 +142,19 @@ powernv_attach(platform_t plat) > cpu_idle_hook = powernv_cpu_idle; > powernv_boot_pir = mfspr(SPR_PIR); > > + /* LPID must not be altered when PSL_DR or PSL_IR is set */ > + msr = mfmsr(); > + mtmsr(msr & ~(PSL_DR | PSL_IR)); > + > + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ > + mtspr(SPR_LPID, 0); > + isync(); > + > + mtmsr(msr); > + > + mtspr(SPR_LPCR, LPCR_LPES); > + isync(); > + > /* Init CPU bits */ > powernv_smp_ap_init(plat); > > @@ -444,21 +458,6 @@ powernv_reset(platform_t platform) > static void > powernv_smp_ap_init(platform_t platform) > { > - register_t msr; > - > - /* LPID must not be altered when PSL_DR or PSL_IR is set */ > - msr = mfmsr(); > - mtmsr(msr & ~(PSL_DR | PSL_IR)); > - > - isync(); > - /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ > - mtspr(SPR_LPID, 0); > - isync(); > - > - mtmsr(msr); > - > - mtspr(SPR_LPCR, LPCR_LPES); > - isync(); > } > > static void > From owner-svn-src-all@freebsd.org Mon Jan 29 16:12:27 2018 Return-Path: Delivered-To: svn-src-all@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 6DE43ECF59B; Mon, 29 Jan 2018 16:12:27 +0000 (UTC) (envelope-from vangyzen@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 20C0279F87; Mon, 29 Jan 2018 16:12:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1BAC82617; Mon, 29 Jan 2018 16:12:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TGCQ4F037521; Mon, 29 Jan 2018 16:12:26 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TGCQ7A037520; Mon, 29 Jan 2018 16:12:26 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201801291612.w0TGCQ7A037520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 29 Jan 2018 16:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328552 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 328552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 16:12:27 -0000 Author: vangyzen Date: Mon Jan 29 16:12:26 2018 New Revision: 328552 URL: https://svnweb.freebsd.org/changeset/base/328552 Log: ND6: Set the correct state for new neighbor cache entries Restore state 6. Many of the UNH tests end up exercising this state, where we have a new neighbor cache entry and a new link-layer entry is being created for it. The link-layer address is currently unknown so the initial state of the "llentry" should remain initialized to ND6_LLINFO_NOSTATE so that the ND code will send a solicitation. Setting this to ND6_LLINFO_STALE implies that the link-level entry is valid and can be used (but needs to be refreshed via the Neighbor Unreachability state machine). https://forums.freebsd.org/threads/64287/ Submitted by: Farrell Woods Reviewed by: mjoras, dab, ae MFC after: 1 week Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D14059 Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Jan 29 14:23:44 2018 (r328551) +++ head/sys/netinet6/nd6.c Mon Jan 29 16:12:26 2018 (r328552) @@ -2032,10 +2032,11 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *f if (ln_tmp == NULL) { /* No existing lle, mark as new entry (6,7) */ is_newentry = 1; - nd6_llinfo_setstate(ln, ND6_LLINFO_STALE); - if (lladdr != NULL) /* (7) */ + if (lladdr != NULL) { /* (7) */ + nd6_llinfo_setstate(ln, ND6_LLINFO_STALE); EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); + } } else { lltable_free_entry(LLTABLE6(ifp), ln); ln = ln_tmp; From owner-svn-src-all@freebsd.org Mon Jan 29 17:32:31 2018 Return-Path: Delivered-To: svn-src-all@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 085E0ED383D; Mon, 29 Jan 2018 17:32:31 +0000 (UTC) (envelope-from benno@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 B06B67CF4E; Mon, 29 Jan 2018 17:32:30 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AB61332D5; Mon, 29 Jan 2018 17:32:30 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0THWUbO077052; Mon, 29 Jan 2018 17:32:30 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0THWUhR077049; Mon, 29 Jan 2018 17:32:30 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201801291732.w0THWUhR077049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Mon, 29 Jan 2018 17:32:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328553 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 328553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 17:32:31 -0000 Author: benno Date: Mon Jan 29 17:32:30 2018 New Revision: 328553 URL: https://svnweb.freebsd.org/changeset/base/328553 Log: Remove some duplicated sys/conf/files* entries. net80211/ieee80211_ageq.c was present twice in sys/conf/files so leave the correctly sorted one. dev/wpi/if_wpi.c was present in sys/conf/files as well as sys/conf/files.amd64 and sys/conf/files.i386 so prefer the sys/conf/files entry. Reviewed by: allanjude, rstone Modified: head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jan 29 16:12:26 2018 (r328552) +++ head/sys/conf/files Mon Jan 29 17:32:30 2018 (r328553) @@ -4114,7 +4114,6 @@ net/vnet.c optional vimage net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl net80211/ieee80211_action.c optional wlan -net80211/ieee80211_ageq.c optional wlan net80211/ieee80211_adhoc.c optional wlan \ compile-with "${NORMAL_C} -Wno-unused-function" net80211/ieee80211_ageq.c optional wlan Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Mon Jan 29 16:12:26 2018 (r328552) +++ head/sys/conf/files.amd64 Mon Jan 29 17:32:30 2018 (r328553) @@ -473,7 +473,6 @@ dev/uart/uart_cpu_x86.c optional uart dev/viawd/viawd.c optional viawd dev/vmware/vmxnet3/if_vmx.c optional vmx dev/wbwd/wbwd.c optional wbwd -dev/wpi/if_wpi.c optional wpi dev/xen/pci/xen_acpi_pci.c optional xenhvm dev/xen/pci/xen_pci.c optional xenhvm dev/isci/isci.c optional isci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Mon Jan 29 16:12:26 2018 (r328552) +++ head/sys/conf/files.i386 Mon Jan 29 17:32:30 2018 (r328553) @@ -328,7 +328,6 @@ dev/acpica/acpi_hpet.c optional acpi dev/acpica/acpi_timer.c optional acpi dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd -dev/wpi/if_wpi.c optional wpi dev/isci/isci.c optional isci dev/isci/isci_controller.c optional isci dev/isci/isci_domain.c optional isci From owner-svn-src-all@freebsd.org Mon Jan 29 18:07:15 2018 Return-Path: Delivered-To: svn-src-all@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 6AB74ED548E; Mon, 29 Jan 2018 18:07: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 1BC6A7E527; Mon, 29 Jan 2018 18:07: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 16AF53C0F; Mon, 29 Jan 2018 18:07: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 w0TI7ECI092155; Mon, 29 Jan 2018 18:07:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TI7EVD092154; Mon, 29 Jan 2018 18:07:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801291807.w0TI7EVD092154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 29 Jan 2018 18:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328554 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 328554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:07:15 -0000 Author: imp Date: Mon Jan 29 18:07:14 2018 New Revision: 328554 URL: https://svnweb.freebsd.org/changeset/base/328554 Log: Do the book-keeping on release before we release the reference. The periph was going away on final release, and then returning and we started dancing in free memory. Sponsored by: Netflix Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Jan 29 17:32:30 2018 (r328553) +++ head/sys/cam/scsi/scsi_da.c Mon Jan 29 18:07:14 2018 (r328554) @@ -1549,12 +1549,12 @@ da_periph_unhold(struct cam_periph *periph, da_ref_tok struct da_softc *softc = periph->softc; token_sanity(token); - cam_periph_unhold(periph); DA_PERIPH_PRINT(periph, "Unholding device %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) panic("Unholding %d with cnt = %d", token, cnt); + cam_periph_unhold(periph); } static inline int @@ -1583,12 +1583,12 @@ da_periph_release(struct cam_periph *periph, da_ref_to struct da_softc *softc = periph->softc; token_sanity(token); - cam_periph_release(periph); DA_PERIPH_PRINT(periph, "releasing device %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) panic("Releasing %d with cnt = %d", token, cnt); + cam_periph_release(periph); } static inline void @@ -1598,12 +1598,12 @@ da_periph_release_locked(struct cam_periph *periph, da struct da_softc *softc = periph->softc; token_sanity(token); - cam_periph_release_locked(periph); DA_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) panic("Unholding %d with cnt = %d", token, cnt); + cam_periph_release_locked(periph); } #define cam_periph_hold POISON From owner-svn-src-all@freebsd.org Mon Jan 29 18:09:40 2018 Return-Path: Delivered-To: svn-src-all@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 12685ED56BC; Mon, 29 Jan 2018 18:09:40 +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 937DB7E745; Mon, 29 Jan 2018 18:09:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 95CCC10A7DB; Mon, 29 Jan 2018 13:09:38 -0500 (EST) From: John Baldwin To: mike@karels.net Cc: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: ps output line length (was: svn commit: r314685 - head/bin/ps) Date: Mon, 29 Jan 2018 10:08:23 -0800 Message-ID: <1737766.RPl9Duc0sC@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201801281622.w0SGMupF055172@mail.karels.net> References: <201801281622.w0SGMupF055172@mail.karels.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 29 Jan 2018 13:09:38 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:09:40 -0000 On Sunday, January 28, 2018 10:22:56 AM Mike Karels wrote: > Recently, I was investigating an issue with top on -current while doing > a "make buildworld", and ran "ps axu|more" for comparison. To my surprise, > I got only a few very long lines of output, containing full command lines > for compiler runs. This quickly led me to the following commit, which > I unfortunately missed at the time, along with the following discussion: > > > Author: cem > > Date: Sat Mar 4 22:38:10 2017 > > New Revision: 314685 > > URL: https://svnweb.freebsd.org/changeset/base/314685 > > > Log: > > ps(1): Only detect terminal width if stdout is a tty > > > > If stdout isn't a tty, use unlimited width output rather than truncating to > > 79 characters. This is helpful for shell scripts or e.g., 'ps | grep foo'. > > > > This hardcoded width has some history: In The Beginning of History[0], the > > width of ps was hardcoded as 80 bytes. In 1985, Bloom@ added detection > > using TIOCGWINSZ on stdin.[1] In 1986, Kirk merged a change to check > > stdout's window size instead. In 1990, the fallback checks to stderr and > > stdin's TIOCGWINSZ were added by Marc@, with the commit message "new > > version."[2] > > > > OS X Darwin has a very similar modification to ps(1), which simply sets > > UNLIMITED for all non-tty outputs.[3] I've chosen to respect COLUMNS > > instead of behaving identically to Darwin here, but I don't feel strongly > > about that. We could match OS X for parity if that is desired. > > > > [0]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?annotate=1065 > > [1]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=18105&r2=18106 > > [2]: > > https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=40675&r2=40674&pathrev=40675 > > [3]: > > https://opensource.apple.com/source/adv_cmds/adv_cmds-168/ps/ps.c.auto.html > > > > PR: 217159 > > Reported by: Deepak Nagaraj > > > Modified: > > head/bin/ps/ps.c > > > Modified: head/bin/ps/ps.c > > ============================================================================== > > --- head/bin/ps/ps.c Sat Mar 4 22:23:59 2017 (r314684) > > +++ head/bin/ps/ps.c Sat Mar 4 22:38:10 2017 (r314685) > > @@ -194,6 +194,8 @@ main(int argc, char *argv[]) > > > > if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0') > > termwidth = atoi(cols); > > + else if (!isatty(STDOUT_FILENO)) > > + termwidth = UNLIMITED; > > else if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && > > ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && > > ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) == -1) || > > There were several following messages discussing this change, most notably > one by Bruce Evans > (https://docs.freebsd.org/cgi/getmsg.cgi?fetch=55022+0+archive/2017/svn-src-head/20170312.svn-src-head). > I agree with his rational, and disagree with the change. It seems to me > that the consensus was that the change was incorrect, although that might > just be my opinion. However, I really think that the change needs to be > reverted. > > The rationale for the original code was that, for interactive uses, the > output line length should be the same for "ps ...", "ps ...|more", and > "ps ... |grep". The -w option exists to make the line longer; there is > no option to use the terminal size even if the output is redirected. > Hence, the tests for stderr or stdin being a tty. This behavior has > been in place since 1990, as noted, and no substantial rationale has > been given for changing it other than "it doesn't matter if you use > less with side-to-side scrolling." fwiw, I'm sure I discussed that > code with Marc at the time. > > As was stated, scripts that want to use the full line should use -ww. > Interactive users have long been used to using -w when they need longer > output lines, e.g. to match patterns that don't occur within a screen's > width. > > I propose reverting this change. I do feel like I've always assumed I needed -ww if I wanted long lines to be deterministic. This feels like it breaks interactive 'ps | grep foo' on a desktop with lots of long command lines (e.g. with KDE or the like) as you lose the single-line output of the original interactive 'ps'. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Jan 29 18:09:47 2018 Return-Path: Delivered-To: svn-src-all@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 EEB4BED56F4; Mon, 29 Jan 2018 18:09:46 +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 A68E97E832; Mon, 29 Jan 2018 18:09:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 05BF110A87D; Mon, 29 Jan 2018 13:09:40 -0500 (EST) From: John Baldwin To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328511 - head/sys/dev/extres/clk Date: Mon, 29 Jan 2018 09:46:02 -0800 Message-ID: <4499401.WAFztV9qgp@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201801281520.w0SFKjQe067446@repo.freebsd.org> References: <201801281520.w0SFKjQe067446@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 29 Jan 2018 13:09:40 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:09:47 -0000 On Sunday, January 28, 2018 03:20:45 PM Michal Meloun wrote: > Author: mmel > Date: Sun Jan 28 15:20:45 2018 > New Revision: 328511 > URL: https://svnweb.freebsd.org/changeset/base/328511 > > Log: > diff --git a/sys/dev/extres/clk/clk.c b/sys/dev/extres/clk/clk.c > index c6a1f466ceb..c3708a0ce27 100644 > --- a/sys/dev/extres/clk/clk.c > +++ b/sys/dev/extres/clk/clk.c > @@ -642,10 +642,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx) > if (clknode->parent_cnt == 0) > return; > if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) > - panic("Invalid clock parent index\n"); > + panic("%s: Invalid parent index %d for clock %s", > + __func__, idx, clknode->name); > > if (clknode->parents[idx] == NULL) > - panic("%s: Attempt to set invalid parent %d for clock %s", > + panic("%s: Invalid parent index %d for clock %s", > __func__, idx, clknode->name); > > /* Remove me from old children list. */ > @@ -674,8 +675,8 @@ clknode_init_parent_idx(struct clknode *clknode, int idx) > if ((idx == CLKNODE_IDX_NONE) || > (idx >= clknode->parent_cnt) || > (clknode->parent_names[idx] == NULL)) > - panic("%s: Invalid clock parent index: %d\n", __func__, idx); > - > + panic("%s: Invalid parent index %d for clock %s", > + __func__, idx, clknode->name); > clknode->parent_idx = idx; > } > > Modified: > head/sys/dev/extres/clk/clk.c Can you revert and recommit this with a proper log message? -- John Baldwin From owner-svn-src-all@freebsd.org Mon Jan 29 18:11:28 2018 Return-Path: Delivered-To: svn-src-all@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 EDD07ED58CF; Mon, 29 Jan 2018 18:11:27 +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 9D42D7EB08; Mon, 29 Jan 2018 18:11:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9805E3C7C; Mon, 29 Jan 2018 18:11:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TIBRMP095941; Mon, 29 Jan 2018 18:11:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TIBRdA095939; Mon, 29 Jan 2018 18:11:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801291811.w0TIBRdA095939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 29 Jan 2018 18:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r328555 - in stable: 10/contrib/llvm/tools/clang/include/clang/Basic 10/contrib/llvm/tools/clang/lib/Sema 9/contrib/llvm/tools/clang/include/clang/Basic 9/contrib/llvm/tools/clang/lib/Sema X-SVN-Group: stable-9 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/contrib/llvm/tools/clang/include/clang/Basic 10/contrib/llvm/tools/clang/lib/Sema 9/contrib/llvm/tools/clang/include/clang/Basic 9/contrib/llvm/tools/clang/lib/Sema X-SVN-Commit-Revision: 328555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:11:28 -0000 Author: dim Date: Mon Jan 29 18:11:27 2018 New Revision: 328555 URL: https://svnweb.freebsd.org/changeset/base/328555 Log: Pull in r217197 from upstream clang trunk (by Richard Smith): PR20844: If we fail to list-initialize a reference, map to the referenced type before retrying the initialization to produce diagnostics. Otherwise, we may fail to produce any diagnostics, and silently produce invalid AST in a -Asserts build. Also add a note to this codepath to make it more clear why we were trying to create a temporary. This should fix assertions when parsing some forms of incomplete list intializers. Direct commit to stable/9 and stable/10, since stable/11 and head already have this upstream fix. Reported by: ajcbowhill@gmail.com PR: 202665 Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td stable/9/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Changes in other areas also in this revision: Modified: stable/10/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td stable/10/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Mon Jan 29 18:07:14 2018 (r328554) +++ stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Mon Jan 29 18:11:27 2018 (r328555) @@ -1419,6 +1419,9 @@ def warn_uninit_byref_blockvar_captured_by_block : War InGroup, DefaultIgnore; def note_block_var_fixit_add_initialization : Note< "maybe you meant to use __block %0">; +def note_in_reference_temporary_list_initializer : Note< + "in initialization of temporary of type %0 created to " + "list-initialize this reference">; def note_var_fixit_add_initialization : Note< "initialize the variable %0 to silence this warning">; def note_uninit_fixit_remove_cond : Note< Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Mon Jan 29 18:07:14 2018 (r328554) +++ stable/9/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Mon Jan 29 18:11:27 2018 (r328555) @@ -6309,6 +6309,19 @@ static void diagnoseListInit(Sema &S, const Initialize return diagnoseListInit(S, HiddenArray, InitList); } + if (DestType->isReferenceType()) { + // A list-initialization failure for a reference means that we tried to + // create a temporary of the inner type (per [dcl.init.list]p3.6) and the + // inner initialization failed. + QualType T = DestType->getAs()->getPointeeType(); + diagnoseListInit(S, InitializedEntity::InitializeTemporary(T), InitList); + SourceLocation Loc = InitList->getLocStart(); + if (auto *D = Entity.getDecl()) + Loc = D->getLocation(); + S.Diag(Loc, diag::note_in_reference_temporary_list_initializer) << T; + return; + } + InitListChecker DiagnoseInitList(S, Entity, InitList, DestType, /*VerifyOnly=*/false); assert(DiagnoseInitList.HadError() && From owner-svn-src-all@freebsd.org Mon Jan 29 18:11:28 2018 Return-Path: Delivered-To: svn-src-all@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 46CC9ED58D2; Mon, 29 Jan 2018 18:11:28 +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 EBFC27EB09; Mon, 29 Jan 2018 18:11:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6E263C7D; Mon, 29 Jan 2018 18:11:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TIBRnN095948; Mon, 29 Jan 2018 18:11:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TIBRdX095946; Mon, 29 Jan 2018 18:11:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801291811.w0TIBRdX095946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 29 Jan 2018 18:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328555 - in stable: 10/contrib/llvm/tools/clang/include/clang/Basic 10/contrib/llvm/tools/clang/lib/Sema 9/contrib/llvm/tools/clang/include/clang/Basic 9/contrib/llvm/tools/clang/lib/Sema X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/contrib/llvm/tools/clang/include/clang/Basic 10/contrib/llvm/tools/clang/lib/Sema 9/contrib/llvm/tools/clang/include/clang/Basic 9/contrib/llvm/tools/clang/lib/Sema X-SVN-Commit-Revision: 328555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:11:28 -0000 Author: dim Date: Mon Jan 29 18:11:27 2018 New Revision: 328555 URL: https://svnweb.freebsd.org/changeset/base/328555 Log: Pull in r217197 from upstream clang trunk (by Richard Smith): PR20844: If we fail to list-initialize a reference, map to the referenced type before retrying the initialization to produce diagnostics. Otherwise, we may fail to produce any diagnostics, and silently produce invalid AST in a -Asserts build. Also add a note to this codepath to make it more clear why we were trying to create a temporary. This should fix assertions when parsing some forms of incomplete list intializers. Direct commit to stable/9 and stable/10, since stable/11 and head already have this upstream fix. Reported by: ajcbowhill@gmail.com PR: 202665 Modified: stable/10/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td stable/10/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Changes in other areas also in this revision: Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td stable/9/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Modified: stable/10/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- stable/10/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Mon Jan 29 18:07:14 2018 (r328554) +++ stable/10/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Mon Jan 29 18:11:27 2018 (r328555) @@ -1419,6 +1419,9 @@ def warn_uninit_byref_blockvar_captured_by_block : War InGroup, DefaultIgnore; def note_block_var_fixit_add_initialization : Note< "maybe you meant to use __block %0">; +def note_in_reference_temporary_list_initializer : Note< + "in initialization of temporary of type %0 created to " + "list-initialize this reference">; def note_var_fixit_add_initialization : Note< "initialize the variable %0 to silence this warning">; def note_uninit_fixit_remove_cond : Note< Modified: stable/10/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Mon Jan 29 18:07:14 2018 (r328554) +++ stable/10/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Mon Jan 29 18:11:27 2018 (r328555) @@ -6309,6 +6309,19 @@ static void diagnoseListInit(Sema &S, const Initialize return diagnoseListInit(S, HiddenArray, InitList); } + if (DestType->isReferenceType()) { + // A list-initialization failure for a reference means that we tried to + // create a temporary of the inner type (per [dcl.init.list]p3.6) and the + // inner initialization failed. + QualType T = DestType->getAs()->getPointeeType(); + diagnoseListInit(S, InitializedEntity::InitializeTemporary(T), InitList); + SourceLocation Loc = InitList->getLocStart(); + if (auto *D = Entity.getDecl()) + Loc = D->getLocation(); + S.Diag(Loc, diag::note_in_reference_temporary_list_initializer) << T; + return; + } + InitListChecker DiagnoseInitList(S, Entity, InitList, DestType, /*VerifyOnly=*/false); assert(DiagnoseInitList.HadError() && From owner-svn-src-all@freebsd.org Mon Jan 29 18:13:00 2018 Return-Path: Delivered-To: svn-src-all@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 8274EED5BF0; Mon, 29 Jan 2018 18:13:00 +0000 (UTC) (envelope-from jkim@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 37BED7EFC9; Mon, 29 Jan 2018 18:13:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 328B43DD6; Mon, 29 Jan 2018 18:13:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TICx5J096937; Mon, 29 Jan 2018 18:12:59 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TICxre096936; Mon, 29 Jan 2018 18:12:59 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201801291812.w0TICxre096936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 29 Jan 2018 18:12:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328556 - stable/11/crypto/openssl/ssl X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: stable/11/crypto/openssl/ssl X-SVN-Commit-Revision: 328556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:13:00 -0000 Author: jkim Date: Mon Jan 29 18:12:59 2018 New Revision: 328556 URL: https://svnweb.freebsd.org/changeset/base/328556 Log: MFC: r328419 Add declaration of SSL_get_selected_srtp_profile() for OpenSSL. Differential Revision: https://reviews.freebsd.org/D10525 Modified: stable/11/crypto/openssl/ssl/srtp.h Directory Properties: stable/11/ (props changed) Modified: stable/11/crypto/openssl/ssl/srtp.h ============================================================================== --- stable/11/crypto/openssl/ssl/srtp.h Mon Jan 29 18:11:27 2018 (r328555) +++ stable/11/crypto/openssl/ssl/srtp.h Mon Jan 29 18:12:59 2018 (r328556) @@ -136,6 +136,7 @@ int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const ch int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles); STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); +SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); # endif From owner-svn-src-all@freebsd.org Mon Jan 29 18:21:51 2018 Return-Path: Delivered-To: svn-src-all@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 E8C30ED6310; Mon, 29 Jan 2018 18:21:50 +0000 (UTC) (envelope-from jkim@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 979737F4E2; Mon, 29 Jan 2018 18:21:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 927883F46; Mon, 29 Jan 2018 18:21:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TILon5099438; Mon, 29 Jan 2018 18:21:50 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TILoNl099437; Mon, 29 Jan 2018 18:21:50 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201801291821.w0TILoNl099437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 29 Jan 2018 18:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328557 - stable/10/crypto/openssl/ssl X-SVN-Group: stable-10 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: stable/10/crypto/openssl/ssl X-SVN-Commit-Revision: 328557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:21:51 -0000 Author: jkim Date: Mon Jan 29 18:21:50 2018 New Revision: 328557 URL: https://svnweb.freebsd.org/changeset/base/328557 Log: Revert a local change and sync. with head. No functional change. Note this is a direct commit because head has OpenSSL 1.0.2. Modified: stable/10/crypto/openssl/ssl/srtp.h Modified: stable/10/crypto/openssl/ssl/srtp.h ============================================================================== --- stable/10/crypto/openssl/ssl/srtp.h Mon Jan 29 18:12:59 2018 (r328556) +++ stable/10/crypto/openssl/ssl/srtp.h Mon Jan 29 18:21:50 2018 (r328557) @@ -134,9 +134,9 @@ extern "C" { int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles); -SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); +SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); # endif From owner-svn-src-all@freebsd.org Mon Jan 29 18:50:46 2018 Return-Path: Delivered-To: svn-src-all@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 88B2FED7A43; Mon, 29 Jan 2018 18:50:46 +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 37FE6808C8; Mon, 29 Jan 2018 18:50:46 +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 32FE0432C; Mon, 29 Jan 2018 18:50:46 +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 w0TIok2v012927; Mon, 29 Jan 2018 18:50:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TIokMn012926; Mon, 29 Jan 2018 18:50:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801291850.w0TIokMn012926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 29 Jan 2018 18:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328559 - head/contrib/netbsd-tests/usr.bin/grep X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/contrib/netbsd-tests/usr.bin/grep X-SVN-Commit-Revision: 328559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 18:50:46 -0000 Author: kevans Date: Mon Jan 29 18:50:45 2018 New Revision: 328559 URL: https://svnweb.freebsd.org/changeset/base/328559 Log: Remove t_grep:mmap_eof_not_eol test The test was marked as an expected failure in r320414 after r319971's import of a newer jemalloc removed an essential feature (opt.redzone) for reproducing the behavior it was testing. Since then, no way has been found or demonstrated to reliably test the behavior, so remove the test. PR: 220309 Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Mon Jan 29 18:49:28 2018 (r328558) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Mon Jan 29 18:50:45 2018 (r328559) @@ -646,30 +646,6 @@ mmap_body() atf_check -s exit:1 grep --mmap -e "Z" test1 } -atf_test_case mmap_eof_not_eol -mmap_eof_not_eol_head() -{ - atf_set "descr" "Check --mmap flag handling of encountering EOF without EOL (PR 165471, 219402)" -} -mmap_eof_not_eol_body() -{ - grep_type - if [ $? -eq $GREP_TYPE_GNU ]; then - atf_expect_fail "gnu grep from ports has no --mmap option" - fi - - atf_expect_fail "relies on jemalloc feature no longer available; needs to be rewritten - bug 220309" - - printf "ABC" > test1 - jot -b " " -s "" 4096 >> test2 - - atf_check -s exit:0 -o inline:"B\n" grep --mmap -oe "B" test1 - # Dependency on jemalloc(3) to detect buffer overflow, otherwise this - # unreliably produces a SIGSEGV or SIGBUS - atf_check -s exit:0 -o not-empty \ - env MALLOC_CONF="redzone:true" grep --mmap -e " " test2 -} - atf_test_case matchall matchall_head() { @@ -779,7 +755,6 @@ atf_init_test_cases() atf_add_test_case binary_flags atf_add_test_case badcontext atf_add_test_case mmap - atf_add_test_case mmap_eof_not_eol atf_add_test_case matchall atf_add_test_case fgrep_multipattern atf_add_test_case fgrep_icase From owner-svn-src-all@freebsd.org Mon Jan 29 19:14:16 2018 Return-Path: Delivered-To: svn-src-all@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 69657ED8C24; Mon, 29 Jan 2018 19:14:16 +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 1804B818DF; Mon, 29 Jan 2018 19:14:16 +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 1289A47FA; Mon, 29 Jan 2018 19:14:16 +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 w0TJEFKi027742; Mon, 29 Jan 2018 19:14:15 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TJEFlm027734; Mon, 29 Jan 2018 19:14:15 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201801291914.w0TJEFlm027734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 29 Jan 2018 19:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328560 - in head/sys: amd64/linux amd64/linux32 compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/ibcs2 i386/linux kern X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/ibcs2 i386/linux kern X-SVN-Commit-Revision: 328560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 19:14:16 -0000 Author: bdrewery Date: Mon Jan 29 19:14:15 2018 New Revision: 328560 URL: https://svnweb.freebsd.org/changeset/base/328560 Log: Don't use an .OBJDIR for 'make sysent'. Reported by: emaste, jhb Sponsored by: Dell EMC Modified: head/sys/amd64/linux/Makefile head/sys/amd64/linux32/Makefile head/sys/compat/cloudabi32/Makefile head/sys/compat/cloudabi64/Makefile head/sys/compat/freebsd32/Makefile head/sys/i386/ibcs2/Makefile head/sys/i386/linux/Makefile head/sys/kern/Makefile Modified: head/sys/amd64/linux/Makefile ============================================================================== --- head/sys/amd64/linux/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/amd64/linux/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -2,6 +2,9 @@ # # $FreeBSD$ +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} + all: @echo "make sysent only" Modified: head/sys/amd64/linux32/Makefile ============================================================================== --- head/sys/amd64/linux32/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/amd64/linux32/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -2,6 +2,9 @@ # # $FreeBSD$ +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} + all: @echo "make sysent only" Modified: head/sys/compat/cloudabi32/Makefile ============================================================================== --- head/sys/compat/cloudabi32/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/compat/cloudabi32/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -1,5 +1,8 @@ # $FreeBSD$ +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} + all: @echo "make sysent only" Modified: head/sys/compat/cloudabi64/Makefile ============================================================================== --- head/sys/compat/cloudabi64/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/compat/cloudabi64/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -1,5 +1,8 @@ # $FreeBSD$ +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} + all: @echo "make sysent only" Modified: head/sys/compat/freebsd32/Makefile ============================================================================== --- head/sys/compat/freebsd32/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/compat/freebsd32/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -2,6 +2,9 @@ # # $FreeBSD$ +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} + all: @echo "make sysent only" Modified: head/sys/i386/ibcs2/Makefile ============================================================================== --- head/sys/i386/ibcs2/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/i386/ibcs2/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -2,6 +2,9 @@ # # $FreeBSD$ +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} + all: @echo "make sysent, isc_sysent or xenix_sysent only" Modified: head/sys/i386/linux/Makefile ============================================================================== --- head/sys/i386/linux/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/i386/linux/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -2,6 +2,9 @@ # # $FreeBSD$ +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} + all: @echo "make sysent only" Modified: head/sys/kern/Makefile ============================================================================== --- head/sys/kern/Makefile Mon Jan 29 18:50:45 2018 (r328559) +++ head/sys/kern/Makefile Mon Jan 29 19:14:15 2018 (r328560) @@ -1,7 +1,10 @@ # @(#)Makefile 8.2 (Berkeley) 3/21/94 # $FreeBSD$ - +# # Makefile for init_sysent + +# Don't use an OBJDIR +.OBJDIR: ${.CURDIR} all: @echo "make sysent only" From owner-svn-src-all@freebsd.org Mon Jan 29 19:46:41 2018 Return-Path: Delivered-To: svn-src-all@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 589BBEDAAA8; Mon, 29 Jan 2018 19:46:41 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id DD32E82FA6; Mon, 29 Jan 2018 19:46:40 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id CCE9B5646E; Mon, 29 Jan 2018 13:46:39 -0600 (CST) Subject: Re: ps output line length (was: svn commit: r314685 - head/bin/ps) To: John Baldwin , mike@karels.net Cc: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801281622.w0SGMupF055172@mail.karels.net> <1737766.RPl9Duc0sC@ralph.baldwin.cx> From: Eric van Gyzen Message-ID: Date: Mon, 29 Jan 2018 13:46:35 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1737766.RPl9Duc0sC@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 19:46:41 -0000 On 01/29/2018 12:08, John Baldwin wrote: > On Sunday, January 28, 2018 10:22:56 AM Mike Karels wrote: >> Recently, I was investigating an issue with top on -current while doing >> a "make buildworld", and ran "ps axu|more" for comparison. To my surprise, >> I got only a few very long lines of output, containing full command lines >> for compiler runs. This quickly led me to the following commit, which >> I unfortunately missed at the time, along with the following discussion: >> >>> Author: cem >>> Date: Sat Mar 4 22:38:10 2017 >>> New Revision: 314685 >>> URL: https://svnweb.freebsd.org/changeset/base/314685 >> >>> Log: >>> ps(1): Only detect terminal width if stdout is a tty >>> >>> If stdout isn't a tty, use unlimited width output rather than truncating to >>> 79 characters. This is helpful for shell scripts or e.g., 'ps | grep foo'. >>> >>> This hardcoded width has some history: In The Beginning of History[0], the >>> width of ps was hardcoded as 80 bytes. In 1985, Bloom@ added detection >>> using TIOCGWINSZ on stdin.[1] In 1986, Kirk merged a change to check >>> stdout's window size instead. In 1990, the fallback checks to stderr and >>> stdin's TIOCGWINSZ were added by Marc@, with the commit message "new >>> version."[2] >>> >>> OS X Darwin has a very similar modification to ps(1), which simply sets >>> UNLIMITED for all non-tty outputs.[3] I've chosen to respect COLUMNS >>> instead of behaving identically to Darwin here, but I don't feel strongly >>> about that. We could match OS X for parity if that is desired. >>> >>> [0]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?annotate=1065 >>> [1]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=18105&r2=18106 >>> [2]: >>> https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=40675&r2=40674&pathrev=40675 >>> [3]: >>> https://opensource.apple.com/source/adv_cmds/adv_cmds-168/ps/ps.c.auto.html >>> >>> PR: 217159 >>> Reported by: Deepak Nagaraj >> >>> Modified: >>> head/bin/ps/ps.c >> >>> Modified: head/bin/ps/ps.c >>> ============================================================================== >>> --- head/bin/ps/ps.c Sat Mar 4 22:23:59 2017 (r314684) >>> +++ head/bin/ps/ps.c Sat Mar 4 22:38:10 2017 (r314685) >>> @@ -194,6 +194,8 @@ main(int argc, char *argv[]) >>> >>> if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0') >>> termwidth = atoi(cols); >>> + else if (!isatty(STDOUT_FILENO)) >>> + termwidth = UNLIMITED; >>> else if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && >>> ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && >>> ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) == -1) || >> >> There were several following messages discussing this change, most notably >> one by Bruce Evans >> (https://docs.freebsd.org/cgi/getmsg.cgi?fetch=55022+0+archive/2017/svn-src-head/20170312.svn-src-head). >> I agree with his rational, and disagree with the change. It seems to me >> that the consensus was that the change was incorrect, although that might >> just be my opinion. However, I really think that the change needs to be >> reverted. >> >> The rationale for the original code was that, for interactive uses, the >> output line length should be the same for "ps ...", "ps ...|more", and >> "ps ... |grep". The -w option exists to make the line longer; there is >> no option to use the terminal size even if the output is redirected. >> Hence, the tests for stderr or stdin being a tty. This behavior has >> been in place since 1990, as noted, and no substantial rationale has >> been given for changing it other than "it doesn't matter if you use >> less with side-to-side scrolling." fwiw, I'm sure I discussed that >> code with Marc at the time. >> >> As was stated, scripts that want to use the full line should use -ww. >> Interactive users have long been used to using -w when they need longer >> output lines, e.g. to match patterns that don't occur within a screen's >> width. >> >> I propose reverting this change. > > I do feel like I've always assumed I needed -ww if I wanted long lines to > be deterministic. This feels like it breaks interactive 'ps | grep foo' > on a desktop with lots of long command lines (e.g. with KDE or the like) > as you lose the single-line output of the original interactive 'ps'. In case this thread needs another "me too": me too. Eric From owner-svn-src-all@freebsd.org Mon Jan 29 21:54:14 2018 Return-Path: Delivered-To: svn-src-all@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 4D2C5EE0EE3; Mon, 29 Jan 2018 21:54:14 +0000 (UTC) (envelope-from fsu@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 002FF689D4; Mon, 29 Jan 2018 21:54:13 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 EF2ED6215; Mon, 29 Jan 2018 21:54:13 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TLsDX3008819; Mon, 29 Jan 2018 21:54:13 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TLsDsR008816; Mon, 29 Jan 2018 21:54:13 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201801292154.w0TLsDsR008816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Mon, 29 Jan 2018 21:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328564 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 328564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 21:54:14 -0000 Author: fsu Date: Mon Jan 29 21:54:13 2018 New Revision: 328564 URL: https://svnweb.freebsd.org/changeset/base/328564 Log: Add flex_bg/meta_bg features RW support. Reviewed by: pfg MFC after: 6 months Differential Revision: https://reviews.freebsd.org/D13964 Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Mon Jan 29 21:16:56 2018 (r328563) +++ head/sys/fs/ext2fs/ext2_alloc.c Mon Jan 29 21:54:13 2018 (r328564) @@ -755,49 +755,68 @@ ext2_hashalloc(struct inode *ip, int cg, long pref, in } static unsigned long -ext2_cg_num_gdb(struct m_ext2fs *fs, int cg) +ext2_cg_number_gdb_nometa(struct m_ext2fs *fs, int cg) { - int gd_per_block, metagroup, first, last; - gd_per_block = fs->e2fs_bsize / sizeof(struct ext2_gd); - metagroup = cg / gd_per_block; - first = metagroup * gd_per_block; - last = first + gd_per_block - 1; + if (!ext2_cg_has_sb(fs, cg)) + return (0); - if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || - metagroup < fs->e2fs->e3fs_first_meta_bg) { - if (!ext2_cg_has_sb(fs, cg)) - return (0); - if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG)) - return (fs->e2fs->e3fs_first_meta_bg); - return (fs->e2fs_gdbcount); - } + if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG)) + return (fs->e2fs->e3fs_first_meta_bg); + return ((fs->e2fs_gcount + EXT2_DESCS_PER_BLOCK(fs) - 1) / + EXT2_DESCS_PER_BLOCK(fs)); +} + +static unsigned long +ext2_cg_number_gdb_meta(struct m_ext2fs *fs, int cg) +{ + unsigned long metagroup; + int first, last; + + metagroup = cg / EXT2_DESCS_PER_BLOCK(fs); + first = metagroup * EXT2_DESCS_PER_BLOCK(fs); + last = first + EXT2_DESCS_PER_BLOCK(fs) - 1; + if (cg == first || cg == first + 1 || cg == last) return (1); + return (0); +} +static unsigned long +ext2_cg_number_gdb(struct m_ext2fs *fs, int cg) +{ + unsigned long first_meta_bg, metagroup; + + first_meta_bg = fs->e2fs->e3fs_first_meta_bg; + metagroup = cg / EXT2_DESCS_PER_BLOCK(fs); + + if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || + metagroup < first_meta_bg) + return (ext2_cg_number_gdb_nometa(fs, cg)); + + return ext2_cg_number_gdb_meta(fs, cg); } static int -ext2_num_base_meta_blocks(struct m_ext2fs *fs, int cg) +ext2_number_base_meta_blocks(struct m_ext2fs *fs, int cg) { - int num, gd_per_block; + int number; - gd_per_block = fs->e2fs_bsize / sizeof(struct ext2_gd); - num = ext2_cg_has_sb(fs, cg); + number = ext2_cg_has_sb(fs, cg); if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || - cg < fs->e2fs->e3fs_first_meta_bg * gd_per_block) { - if (num) { - num += ext2_cg_num_gdb(fs, cg); - num += fs->e2fs->e2fs_reserved_ngdb; + cg < fs->e2fs->e3fs_first_meta_bg * EXT2_DESCS_PER_BLOCK(fs)) { + if (number) { + number += ext2_cg_number_gdb(fs, cg); + number += fs->e2fs->e2fs_reserved_ngdb; } } else { - num += ext2_cg_num_gdb(fs, cg); + number += ext2_cg_number_gdb(fs, cg); } - - return (num); + + return (number); } static void @@ -815,6 +834,20 @@ ext2_mark_bitmap_end(int start_bit, int end_bit, char } static int +ext2_get_group_number(struct m_ext2fs *fs, e4fs_daddr_t block) +{ + + return ((block - fs->e2fs->e2fs_first_dblock) / fs->e2fs_bsize); +} + +static int +ext2_block_in_group(struct m_ext2fs *fs, e4fs_daddr_t block, int cg) +{ + + return ((ext2_get_group_number(fs, block) == cg) ? 1 : 0); +} + +static int ext2_cg_block_bitmap_init(struct m_ext2fs *fs, int cg, struct buf *bp) { int bit, bit_max, inodes_per_block; @@ -825,7 +858,7 @@ ext2_cg_block_bitmap_init(struct m_ext2fs *fs, int cg, memset(bp->b_data, 0, fs->e2fs_bsize); - bit_max = ext2_num_base_meta_blocks(fs, cg); + bit_max = ext2_number_base_meta_blocks(fs, cg); if ((bit_max >> 3) >= fs->e2fs_bsize) return (EINVAL); @@ -837,12 +870,12 @@ ext2_cg_block_bitmap_init(struct m_ext2fs *fs, int cg, /* Set bits for block and inode bitmaps, and inode table. */ tmp = e2fs_gd_get_b_bitmap(&fs->e2fs_gd[cg]); if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_FLEX_BG) || - cg == dtogd(fs, tmp)) + ext2_block_in_group(fs, tmp, cg)) setbit(bp->b_data, tmp - start); tmp = e2fs_gd_get_i_bitmap(&fs->e2fs_gd[cg]); if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_FLEX_BG) || - cg == dtogd(fs, tmp)) + ext2_block_in_group(fs, tmp, cg)) setbit(bp->b_data, tmp - start); tmp = e2fs_gd_get_i_tables(&fs->e2fs_gd[cg]); @@ -850,7 +883,7 @@ ext2_cg_block_bitmap_init(struct m_ext2fs *fs, int cg, while( tmp < e2fs_gd_get_i_tables(&fs->e2fs_gd[cg]) + fs->e2fs->e2fs_ipg / inodes_per_block ) { if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_FLEX_BG) || - cg == dtogd(fs, tmp)) + ext2_block_in_group(fs, tmp, cg)) setbit(bp->b_data, tmp - start); tmp++; } Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Mon Jan 29 21:16:56 2018 (r328563) +++ head/sys/fs/ext2fs/ext2_vfsops.c Mon Jan 29 21:54:13 2018 (r328564) @@ -154,7 +154,8 @@ ext2_mount(struct mount *mp) if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; error = ext2_flushfiles(mp, flags, td); - if (error == 0 && fs->e2fs_wasvalid && ext2_cgupdate(ump, MNT_WAIT) == 0) { + if (error == 0 && fs->e2fs_wasvalid && + ext2_cgupdate(ump, MNT_WAIT) == 0) { fs->e2fs->e2fs_state |= E2FS_ISCLEAN; ext2_sbupdate(ump, MNT_WAIT); } @@ -318,6 +319,36 @@ ext2_check_sb_compat(struct ext2fs *es, struct cdev *d return (0); } +static e4fs_daddr_t +cg_location(struct m_ext2fs *fs, int number) +{ + int cg, descpb, logical_sb, has_super = 0; + + /* + * Adjust logical superblock block number. + * Godmar thinks: if the blocksize is greater than 1024, then + * the superblock is logically part of block zero. + */ + logical_sb = fs->e2fs_bsize > SBSIZE ? 0 : 1; + + if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || + number < fs->e2fs->e3fs_first_meta_bg) + return (logical_sb + number + 1); + + if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_64BIT)) + descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); + else + descpb = fs->e2fs_bsize / E2FS_REV0_GD_SIZE; + + cg = descpb * number; + + if (ext2_cg_has_sb(fs, cg)) + has_super = 1; + + return (has_super + cg * (e4fs_daddr_t)EXT2_BLOCKS_PER_GROUP(fs) + + fs->e2fs->e2fs_first_dblock); +} + /* * This computes the fields of the m_ext2fs structure from the * data in the ext2fs structure read in. @@ -328,7 +359,6 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es { int g_count = 0, error; int i, j; - int logic_sb_block = 1; /* XXX for now */ struct buf *bp; uint32_t e2fs_descpb, e2fs_gdbcount_alloc; @@ -385,6 +415,12 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es es->e3fs_desc_size); return (EINVAL); } + /* Check for group size */ + if (fs->e2fs_bpg != fs->e2fs_bsize * 8) { + printf("ext2fs: non-standard group size unsupported %d\n", + fs->e2fs_bpg); + return (EINVAL); + } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs_ipg / fs->e2fs_ipb; @@ -405,16 +441,9 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es fs->e2fs_contigdirs = malloc(fs->e2fs_gcount * sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK | M_ZERO); - /* - * Adjust logic_sb_block. - * Godmar thinks: if the blocksize is greater than 1024, then - * the superblock is logically part of block zero. - */ - if (fs->e2fs_bsize > SBSIZE) - logic_sb_block = 0; for (i = 0; i < fs->e2fs_gdbcount; i++) { error = bread(devvp, - fsbtodb(fs, logic_sb_block + i + 1), + fsbtodb(fs, cg_location(fs, i)), fs->e2fs_bsize, NOCRED, &bp); if (error) { free(fs->e2fs_contigdirs, M_EXT2MNT); @@ -1151,8 +1180,8 @@ ext2_cgupdate(struct ext2mount *mp, int waitfor) for (i = 0; i < fs->e2fs_gdbcount; i++) { bp = getblk(mp->um_devvp, fsbtodb(fs, - fs->e2fs->e2fs_first_dblock + - 1 /* superblock */ + i), fs->e2fs_bsize, 0, 0, 0); + cg_location(fs, i)), + fs->e2fs_bsize, 0, 0, 0); if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_64BIT)) { memcpy(bp->b_data, &fs->e2fs_gd[ i * fs->e2fs_bsize / sizeof(struct ext2_gd)], Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Mon Jan 29 21:16:56 2018 (r328563) +++ head/sys/fs/ext2fs/ext2fs.h Mon Jan 29 21:54:13 2018 (r328564) @@ -334,12 +334,12 @@ static const struct ext2_feature incompat[] = { EXT2F_ROCOMPAT_HUGE_FILE | \ EXT2F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP (EXT2F_INCOMPAT_FTYPE | \ + EXT2F_INCOMPAT_META_BG | \ EXT2F_INCOMPAT_EXTENTS | \ EXT2F_INCOMPAT_64BIT | \ - EXT2F_INCOMPAT_CSUM_SEED) -#define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_RECOVER | \ EXT2F_INCOMPAT_FLEX_BG | \ - EXT2F_INCOMPAT_META_BG ) + EXT2F_INCOMPAT_CSUM_SEED) +#define EXT4F_RO_INCOMPAT_SUPP EXT2F_INCOMPAT_RECOVER /* Assume that user mode programs are passing in an ext2fs superblock, not * a kernel struct super_block. This will allow us to call the feature-test @@ -423,5 +423,8 @@ struct ext2_gd { * Macro-instructions used to manage group descriptors */ #define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->e2fs_bpg) +#define EXT2_DESCS_PER_BLOCK(s) (EXT2_HAS_INCOMPAT_FEATURE((s), \ + EXT2F_INCOMPAT_64BIT) ? ((s)->e2fs_bsize / sizeof(struct ext2_gd)) : \ + ((s)->e2fs_bsize / E2FS_REV0_GD_SIZE)) #endif /* !_FS_EXT2FS_EXT2FS_H_ */ From owner-svn-src-all@freebsd.org Mon Jan 29 22:15:47 2018 Return-Path: Delivered-To: svn-src-all@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 43E4DEE1E8D; Mon, 29 Jan 2018 22:15:47 +0000 (UTC) (envelope-from fsu@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 EAACF699CB; Mon, 29 Jan 2018 22:15:46 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E1AF86555; Mon, 29 Jan 2018 22:15:46 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TMFkrG019837; Mon, 29 Jan 2018 22:15:46 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TMFkjB019836; Mon, 29 Jan 2018 22:15:46 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201801292215.w0TMFkjB019836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Mon, 29 Jan 2018 22:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328566 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 328566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 22:15:47 -0000 Author: fsu Date: Mon Jan 29 22:15:46 2018 New Revision: 328566 URL: https://svnweb.freebsd.org/changeset/base/328566 Log: Fix mistake in case of zeroed inode check. Reported by: pho MFC after: 6 months Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode_cnv.c Mon Jan 29 22:03:01 2018 (r328565) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Mon Jan 29 22:15:46 2018 (r328566) @@ -90,8 +90,10 @@ ext2_print_inode(struct inode *in) int ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) { + struct m_ext2fs *fs; const static struct ext2fs_dinode ei_zero; + fs = ip->i_e2fs; ip->i_nlink = ei->e2di_nlink; /* * Godmar thinks - if the link count is zero, then the inode is @@ -135,7 +137,8 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) memcpy(ip->i_data, ei->e2di_blocks, sizeof(ei->e2di_blocks)); - if (memcmp(ei, &ei_zero, sizeof(struct ext2fs_dinode))) + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_METADATA_CKSUM) && + memcmp(ei, &ei_zero, EXT2_INODE_SIZE(fs))) return (ext2_ei_csum_verify(ip, ei)); return (0); From owner-svn-src-all@freebsd.org Mon Jan 29 22:36:02 2018 Return-Path: Delivered-To: svn-src-all@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 2C0BAEE2A3A; Mon, 29 Jan 2018 22:36:02 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "canit.localdomain", Issuer "canit.localdomain" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C7AB46A5AF; Mon, 29 Jan 2018 22:36:01 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from smtp-auth1.server.rpi.edu (route.canit.rpi.edu [128.113.2.231]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id w0TMZqEN027050 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Jan 2018 17:35:53 -0500 Received: from smtp-auth1.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth1.server.rpi.edu (Postfix) with ESMTP id D0BD8580DE; Mon, 29 Jan 2018 17:35:52 -0500 (EST) Received: from [172.16.67.1] (gilead-qc124.netel.rpi.edu [128.113.124.17]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: drosih) by smtp-auth1.server.rpi.edu (Postfix) with ESMTPSA id B3312580DC; Mon, 29 Jan 2018 17:35:52 -0500 (EST) From: "Garance A Drosehn" To: "Mike Karels" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: ps output line length (was: svn commit: r314685 - head/bin/ps) Date: Mon, 29 Jan 2018 17:35:52 -0500 X-Mailer: MailMate (1.10r5443) Message-ID: In-Reply-To: <201801281622.w0SGMupF055172@mail.karels.net> References: <201801281622.w0SGMupF055172@mail.karels.net> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 02V4mzRlf X-CanIt-Geo: ip=128.113.124.17; country=US; region=New York; city=Troy; latitude=42.7495; longitude=-73.5951; http://maps.google.com/maps?q=42.7495,-73.5951&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 22:36:02 -0000 On 28 Jan 2018, at 11:22, Mike Karels wrote: > The rationale for the original code was that, for interactive uses, the > output line length should be the same for "ps ...", "ps ...|more", and > "ps ... |grep". The -w option exists to make the line longer; there is > no option to use the terminal size even if the output is redirected. > Hence, the tests for stderr or stdin being a tty. This behavior has > been in place since 1990, as noted, and no substantial rationale has > been given for changing it other than "it doesn't matter if you use > less with side-to-side scrolling." fwiw, I'm sure I discussed that > code with Marc at the time. > > As was stated, scripts that want to use the full line should use -ww. > Interactive users have long been used to using -w when they need longer > output lines, e.g. to match patterns that don't occur within a screen's > width. > > I propose reverting this change. I do have several scripts which work on the output of 'ps', and none of my scripts would have noticed this change because they include -ww and they also set 'local COLUMNS=180' and export the value of COLUMNS. It also looks like the change from March 2017 is only in -current, and has not been MFC-ed into 11.x-stable. So reverting the change seems reasonable to me. I will note that the behavior of 'ps' on linux seems to match what the change does. If you 'ps axu' the output is the width of your terminal, and if you 'ps axu | grep something' then the output width seems to be infinity (or at least it's somewhere over 2500 characters). I have not checked how 'ps' acts on the other BSD's. -- Garance Alistair Drosehn = drosih@rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA From owner-svn-src-all@freebsd.org Mon Jan 29 22:38:24 2018 Return-Path: Delivered-To: svn-src-all@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 59E85EE2B73; Mon, 29 Jan 2018 22:38:24 +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 0F26D6A76A; Mon, 29 Jan 2018 22:38:24 +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 049AA6886; Mon, 29 Jan 2018 22:38:24 +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 w0TMcN44029972; Mon, 29 Jan 2018 22:38:23 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TMcNL4029971; Mon, 29 Jan 2018 22:38:23 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801292238.w0TMcNL4029971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 29 Jan 2018 22:38:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328567 - head/lib/libedit X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libedit X-SVN-Commit-Revision: 328567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 22:38:24 -0000 Author: pfg Date: Mon Jan 29 22:38:23 2018 New Revision: 328567 URL: https://svnweb.freebsd.org/changeset/base/328567 Log: libedit: sort the Makefile in line with NetBSD's version. NetBSD's libedit has been been cleaned-up considerably so the non--widecharacter version is no longer an option. Re -sorting the Makefile should make it easier for some brave soul trying to update it. No functional change intended. MFC after: 5 days Modified: head/lib/libedit/Makefile Modified: head/lib/libedit/Makefile ============================================================================== --- head/lib/libedit/Makefile Mon Jan 29 22:15:46 2018 (r328566) +++ head/lib/libedit/Makefile Mon Jan 29 22:38:23 2018 (r328567) @@ -3,18 +3,19 @@ # $FreeBSD$ PACKAGE=clibs -LIB= edit + SHLIB_MAJOR= 7 SHLIBDIR?= /lib WARNS?= 3 +LIB= edit +LIBADD= ncursesw + OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \ hist.c keymacro.c map.c chartype.c \ parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c -LIBADD= ncursesw - MAN= editline.3 editrc.5 MLINKS= editline.3 el_deletestr.3 editline.3 el_end.3 editline.3 el_init.3 \ @@ -28,25 +29,26 @@ MLINKS= editline.3 el_deletestr.3 editline.3 el_end.3 editline.3 tok_line.3 editline.3 tok_str.3 # For speed and debugging -#SRCS= ${OSRCS} +#SRCS= ${OSRCS} readline.c tokenizer.c history.c # For protection -SRCS= editline.c -SRCS+= tokenizer.c history.c readline.c +SRCS= editline.c readline.c tokenizer.c history.c SRCS+= common.h emacs.h fcns.h help.h vi.h -CLEANFILES+= common.h editline.c emacs.h fcns.c fcns.h help.c help.h vi.h -INCS= histedit.h - +# Widechar SRCS+= tokenizern.c historyn.c CLEANFILES+= tokenizern.c historyn.c + +INCS= histedit.h + +CLEANFILES+= common.h editline.c emacs.h fcns.c fcns.h help.c help.h vi.h CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR #CFLAGS+= -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH #CFLAGS+= -DDEBUG_PASTE -DDEBUG_EDIT -SUBDIR= edit/readline - AHDR= vi.h emacs.h common.h ASRC= ${.CURDIR}/vi.c ${.CURDIR}/emacs.c ${.CURDIR}/common.c + +SUBDIR= edit/readline .for hdr in vi emacs common ${hdr}.h: ${hdr}.c makelist From owner-svn-src-all@freebsd.org Mon Jan 29 23:43:05 2018 Return-Path: Delivered-To: svn-src-all@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 42847EB78F6; Mon, 29 Jan 2018 23:43:05 +0000 (UTC) (envelope-from jhb@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 E48A06D281; Mon, 29 Jan 2018 23:43:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6FA673B4; Mon, 29 Jan 2018 23:43:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TNh4P8064630; Mon, 29 Jan 2018 23:43:04 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TNh4kg064629; Mon, 29 Jan 2018 23:43:04 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801292343.w0TNh4kg064629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 29 Jan 2018 23:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328571 - in stable: 10/sys/kern 11/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/kern 11/sys/kern X-SVN-Commit-Revision: 328571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 23:43:05 -0000 Author: jhb Date: Mon Jan 29 23:43:04 2018 New Revision: 328571 URL: https://svnweb.freebsd.org/changeset/base/328571 Log: MFC 327561: Report offset relative to the backing object for kinfo_vmentry structures. For the pathname reported in kinfo_vmentry structures (kve_path), the sysctl handlers walk the object chain to find the bottom-most VM object. This permits a COW mapping of a file with dirty pages to report the pathname of the originally mapped file. Do the same for the object offset (kve_offset) computing a cumulative offset during the same object walk so that the reported offset is relative to the reported pathname. Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset rather than the raw offset of the VM map entry. Note also that this does not affect procstat -v output (even structured output) since that output does not include the kve_offset field. Sponsored by: DARPA / AFRL Modified: stable/10/sys/kern/kern_proc.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/kern_proc.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/kern/kern_proc.c ============================================================================== --- stable/10/sys/kern/kern_proc.c Mon Jan 29 23:36:05 2018 (r328570) +++ stable/10/sys/kern/kern_proc.c Mon Jan 29 23:43:04 2018 (r328571) @@ -2061,8 +2061,10 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) } for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { - if (tobj != obj) + if (tobj != obj) { VM_OBJECT_RLOCK(tobj); + kve->kve_offset += tobj->backing_object_offset; + } if (lobj != obj) VM_OBJECT_RUNLOCK(lobj); lobj = tobj; @@ -2070,7 +2072,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) kve->kve_start = (void*)entry->start; kve->kve_end = (void*)entry->end; - kve->kve_offset = (off_t)entry->offset; + kve->kve_offset += (off_t)entry->offset; if (entry->protection & VM_PROT_READ) kve->kve_protection |= KVME_PROT_READ; @@ -2284,6 +2286,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { VM_OBJECT_RLOCK(tobj); + kve->kve_offset += tobj->backing_object_offset; lobj = tobj; } if (obj->backing_object == NULL) @@ -2302,7 +2305,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s kve->kve_start = entry->start; kve->kve_end = entry->end; - kve->kve_offset = entry->offset; + kve->kve_offset += entry->offset; if (entry->protection & VM_PROT_READ) kve->kve_protection |= KVME_PROT_READ; From owner-svn-src-all@freebsd.org Mon Jan 29 23:43:05 2018 Return-Path: Delivered-To: svn-src-all@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 595B7EB78F7; Mon, 29 Jan 2018 23:43:05 +0000 (UTC) (envelope-from jhb@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 0B29A6D282; Mon, 29 Jan 2018 23:43:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1D7B73B5; Mon, 29 Jan 2018 23:43:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0TNh4qc064636; Mon, 29 Jan 2018 23:43:04 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0TNh44C064635; Mon, 29 Jan 2018 23:43:04 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801292343.w0TNh44C064635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 29 Jan 2018 23:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328571 - in stable: 10/sys/kern 11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/kern 11/sys/kern X-SVN-Commit-Revision: 328571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 23:43:05 -0000 Author: jhb Date: Mon Jan 29 23:43:04 2018 New Revision: 328571 URL: https://svnweb.freebsd.org/changeset/base/328571 Log: MFC 327561: Report offset relative to the backing object for kinfo_vmentry structures. For the pathname reported in kinfo_vmentry structures (kve_path), the sysctl handlers walk the object chain to find the bottom-most VM object. This permits a COW mapping of a file with dirty pages to report the pathname of the originally mapped file. Do the same for the object offset (kve_offset) computing a cumulative offset during the same object walk so that the reported offset is relative to the reported pathname. Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset rather than the raw offset of the VM map entry. Note also that this does not affect procstat -v output (even structured output) since that output does not include the kve_offset field. Sponsored by: DARPA / AFRL Modified: stable/11/sys/kern/kern_proc.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/kern/kern_proc.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/kern/kern_proc.c ============================================================================== --- stable/11/sys/kern/kern_proc.c Mon Jan 29 23:36:05 2018 (r328570) +++ stable/11/sys/kern/kern_proc.c Mon Jan 29 23:43:04 2018 (r328571) @@ -2138,8 +2138,10 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) } for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { - if (tobj != obj) + if (tobj != obj) { VM_OBJECT_RLOCK(tobj); + kve->kve_offset += tobj->backing_object_offset; + } if (lobj != obj) VM_OBJECT_RUNLOCK(lobj); lobj = tobj; @@ -2147,7 +2149,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) kve->kve_start = (void*)entry->start; kve->kve_end = (void*)entry->end; - kve->kve_offset = (off_t)entry->offset; + kve->kve_offset += (off_t)entry->offset; if (entry->protection & VM_PROT_READ) kve->kve_protection |= KVME_PROT_READ; @@ -2367,6 +2369,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { VM_OBJECT_RLOCK(tobj); + kve->kve_offset += tobj->backing_object_offset; lobj = tobj; } if (obj->backing_object == NULL) @@ -2387,7 +2390,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s kve->kve_start = entry->start; kve->kve_end = entry->end; - kve->kve_offset = entry->offset; + kve->kve_offset += entry->offset; if (entry->protection & VM_PROT_READ) kve->kve_protection |= KVME_PROT_READ; From owner-svn-src-all@freebsd.org Tue Jan 30 00:10:01 2018 Return-Path: Delivered-To: svn-src-all@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 5ADD8EC318C; Tue, 30 Jan 2018 00:10:01 +0000 (UTC) (envelope-from jhb@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 102966E1F4; Tue, 30 Jan 2018 00:10:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF807707; Tue, 30 Jan 2018 00:10:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U0A0tD074982; Tue, 30 Jan 2018 00:10:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U0A061074981; Tue, 30 Jan 2018 00:10:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801300010.w0U0A061074981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Jan 2018 00:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328575 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 00:10:01 -0000 Author: jhb Date: Tue Jan 30 00:10:00 2018 New Revision: 328575 URL: https://svnweb.freebsd.org/changeset/base/328575 Log: MFC 327752: Add a counter to track in-flight AIO requests using unmapped I/O. Sponsored by: Chelsio Communications Modified: stable/11/sys/kern/vfs_aio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_aio.c ============================================================================== --- stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:01:16 2018 (r328574) +++ stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:10:00 2018 (r328575) @@ -148,6 +148,11 @@ static int num_buf_aio = 0; SYSCTL_INT(_vfs_aio, OID_AUTO, num_buf_aio, CTLFLAG_RD, &num_buf_aio, 0, "Number of aio requests presently handled by the buf subsystem"); +static int num_unmapped_aio = 0; +SYSCTL_INT(_vfs_aio, OID_AUTO, num_unmapped_aio, CTLFLAG_RD, &num_unmapped_aio, + 0, + "Number of aio requests presently handled by unmapped I/O buffers"); + /* Number of async I/O processes in the process of being started */ /* XXX This should be local to aio_aqueue() */ static int num_aio_resv_start = 0; @@ -1305,6 +1310,7 @@ aio_qphysio(struct proc *p, struct kaiocb *job) bp->bio_ma_offset = poff; bp->bio_data = unmapped_buf; bp->bio_flags |= BIO_UNMAPPED; + atomic_add_int(&num_unmapped_aio, 1); } /* Perform transfer. */ @@ -2367,7 +2373,8 @@ aio_physwakeup(struct bio *bp) AIO_LOCK(ki); ki->kaio_buffer_count--; AIO_UNLOCK(ki); - } + } else + atomic_subtract_int(&num_unmapped_aio, 1); vm_page_unhold_pages(job->pages, job->npages); bp = job->bp; From owner-svn-src-all@freebsd.org Tue Jan 30 00:24:04 2018 Return-Path: Delivered-To: svn-src-all@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 E1DB6EC3DFB; Tue, 30 Jan 2018 00:24:03 +0000 (UTC) (envelope-from jhb@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 94E966ED58; Tue, 30 Jan 2018 00:24:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FC067A46; Tue, 30 Jan 2018 00:24:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U0O3bi084861; Tue, 30 Jan 2018 00:24:03 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U0O3aj084860; Tue, 30 Jan 2018 00:24:03 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801300024.w0U0O3aj084860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Jan 2018 00:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328579 - stable/11/usr.sbin/newsyslog X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/usr.sbin/newsyslog X-SVN-Commit-Revision: 328579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 00:24:04 -0000 Author: jhb Date: Tue Jan 30 00:24:03 2018 New Revision: 328579 URL: https://svnweb.freebsd.org/changeset/base/328579 Log: MFC 328035: Sort the list of flags in newsyslog.conf entries. Move the 'X' entry into its sorted location in the list of flags just above 'Z'. Modified: stable/11/usr.sbin/newsyslog/newsyslog.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/newsyslog/newsyslog.conf.5 ============================================================================== --- stable/11/usr.sbin/newsyslog/newsyslog.conf.5 Tue Jan 30 00:22:53 2018 (r328578) +++ stable/11/usr.sbin/newsyslog/newsyslog.conf.5 Tue Jan 30 00:24:03 2018 (r328579) @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd May 19, 2017 +.Dd January 15, 2018 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -297,12 +297,6 @@ indicates that should attempt to save disk space by compressing the rotated log file using .Xr bzip2 1 . -.It Cm X -indicates that -.Xr newsyslog 8 -should attempt to save disk space by compressing the rotated -log file using -.Xr xz 1 . .It Cm N indicates that there is no process which needs to be signaled when this log file is rotated. @@ -324,6 +318,12 @@ indicates that the file specified by will contain the ID for a process group instead of a process. This option also requires that the first line in that file be a negative value to distinguish it from a process ID. +.It Cm X +indicates that +.Xr newsyslog 8 +should attempt to save disk space by compressing the rotated +log file using +.Xr xz 1 . .It Cm Z indicates that .Xr newsyslog 8 From owner-svn-src-all@freebsd.org Tue Jan 30 00:38:25 2018 Return-Path: Delivered-To: svn-src-all@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 3C296EC49AF; Tue, 30 Jan 2018 00:38:25 +0000 (UTC) (envelope-from jhb@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 E39C46F530; Tue, 30 Jan 2018 00:38:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE8537BD8; Tue, 30 Jan 2018 00:38:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U0cO2m089942; Tue, 30 Jan 2018 00:38:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U0cO6E089941; Tue, 30 Jan 2018 00:38:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801300038.w0U0cO6E089941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Jan 2018 00:38:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328580 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 00:38:25 -0000 Author: jhb Date: Tue Jan 30 00:38:24 2018 New Revision: 328580 URL: https://svnweb.freebsd.org/changeset/base/328580 Log: MFC 327753: Simplify some logic by merging an if test with a subsequent switch. Specifically, in aio_queue_file() the code was doing this: if (opcode == LIO_SYNC) { ... } switch (opcode) { ... case LIO_SYNC: ... } This moves the body of the if statement into the LIO_SYNC case of the switch statement. Sponsored by: Chelsio Communications Modified: stable/11/sys/kern/vfs_aio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_aio.c ============================================================================== --- stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:24:03 2018 (r328579) +++ stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:38:24 2018 (r328580) @@ -1738,7 +1738,13 @@ queueit: return (EOPNOTSUPP); } - if (opcode == LIO_SYNC) { + switch (job->uaiocb.aio_lio_opcode) { + case LIO_READ: + case LIO_WRITE: + aio_schedule(job, aio_process_rw); + error = 0; + break; + case LIO_SYNC: AIO_LOCK(ki); TAILQ_FOREACH(job2, &ki->kaio_jobqueue, plist) { if (job2->fd_file == job->fd_file && @@ -1760,15 +1766,6 @@ queueit: return (0); } AIO_UNLOCK(ki); - } - - switch (opcode) { - case LIO_READ: - case LIO_WRITE: - aio_schedule(job, aio_process_rw); - error = 0; - break; - case LIO_SYNC: aio_schedule(job, aio_process_sync); error = 0; break; From owner-svn-src-all@freebsd.org Tue Jan 30 00:41:55 2018 Return-Path: Delivered-To: svn-src-all@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 217A0EC4E3B; Tue, 30 Jan 2018 00:41:55 +0000 (UTC) (envelope-from jhb@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 CBADB6F94C; Tue, 30 Jan 2018 00:41:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C65177D30; Tue, 30 Jan 2018 00:41:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U0fsKf094455; Tue, 30 Jan 2018 00:41:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U0fs4R094454; Tue, 30 Jan 2018 00:41:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801300041.w0U0fs4R094454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Jan 2018 00:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328581 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 00:41:55 -0000 Author: jhb Date: Tue Jan 30 00:41:54 2018 New Revision: 328581 URL: https://svnweb.freebsd.org/changeset/base/328581 Log: MFC 327755: Allow the fast-path for disk AIO requests to fail requests. - If aio_qphysio() returns a non-zero error code, fail the request rather than queueing it to the AIO kproc pool to be retried via the slow path. Currently this means that if vm_fault_quick_hold_pages() reports an error, EFAULT is returned from the fast-path rather than retrying the request in the slow path where it will still fail with EFAULT. - If aio_qphysio() wishes to use the fast path for a device that doesn't support unmapped I/O but there are already the maximum number of such requests in flight, fail with EAGAIN as we do for other AIO resource limits rather than queueing the request to the AIO kproc pool. - Move the opcode check for aio_qphysio() out of the caller and into aio_qphysio() to simplify some logic and remove two goto's while here. It also uses a whitelist (only supported for LIO_READ / LIO_WRITE) rather than a blacklist (skipped for LIO_SYNC). PR: 217261 Sponsored by: Chelsio Communications Modified: stable/11/sys/kern/vfs_aio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_aio.c ============================================================================== --- stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:38:24 2018 (r328580) +++ stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:41:54 2018 (r328581) @@ -1228,6 +1228,9 @@ aio_qphysio(struct proc *p, struct kaiocb *job) cb = &job->uaiocb; fp = job->fd_file; + if (!(cb->aio_lio_opcode == LIO_WRITE || + cb->aio_lio_opcode == LIO_READ)) + return (-1); if (fp == NULL || fp->f_type != DTYPE_VNODE) return (-1); @@ -1268,7 +1271,7 @@ aio_qphysio(struct proc *p, struct kaiocb *job) goto unref; } if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) { - error = -1; + error = EAGAIN; goto unref; } @@ -1701,28 +1704,14 @@ aio_queue_file(struct file *fp, struct kaiocb *job) struct kaiocb *job2; struct vnode *vp; struct mount *mp; - int error, opcode; + int error; bool safe; lj = job->lio; ki = job->userproc->p_aioinfo; - opcode = job->uaiocb.aio_lio_opcode; - if (opcode == LIO_SYNC) - goto queueit; - - if ((error = aio_qphysio(job->userproc, job)) == 0) - goto done; -#if 0 - /* - * XXX: This means qphysio() failed with EFAULT. The current - * behavior is to retry the operation via fo_read/fo_write. - * Wouldn't it be better to just complete the request with an - * error here? - */ - if (error > 0) - goto done; -#endif -queueit: + error = aio_qphysio(job->userproc, job); + if (error >= 0) + return (error); safe = false; if (fp->f_type == DTYPE_VNODE) { vp = fp->f_vnode; @@ -1772,7 +1761,6 @@ queueit: default: error = EINVAL; } -done: return (error); } From owner-svn-src-all@freebsd.org Tue Jan 30 00:52:23 2018 Return-Path: Delivered-To: svn-src-all@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 ED696EC564D; Tue, 30 Jan 2018 00:52:22 +0000 (UTC) (envelope-from jhb@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 9B6DF6FEDC; Tue, 30 Jan 2018 00:52:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 965FF7EE8; Tue, 30 Jan 2018 00:52:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U0qMn7099438; Tue, 30 Jan 2018 00:52:22 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U0qMbi099437; Tue, 30 Jan 2018 00:52:22 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801300052.w0U0qMbi099437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Jan 2018 00:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328582 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 00:52:23 -0000 Author: jhb Date: Tue Jan 30 00:52:22 2018 New Revision: 328582 URL: https://svnweb.freebsd.org/changeset/base/328582 Log: MFC 327792: Don't store shadow copies of per-process AIO limits. Previously the AIO subsystem would save a snapshot of the currently configured per-process limits the first time a process used AIO. The process would continue to use the snapshotted limits ignoring any changes to the global limits during the rest of its lifetime. This change removes the snapshotted values and changes the AIO code to always check the global values which can be toggled at runtime. This means an administrator can now change the effective limits of existing processes. This is more consistent with how other limits configured via sysctl work in FreeBSD. Sponsored by: Chelsio Communications Modified: stable/11/sys/kern/vfs_aio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_aio.c ============================================================================== --- stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:41:54 2018 (r328581) +++ stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:52:22 2018 (r328582) @@ -164,16 +164,16 @@ SYSCTL_INT(_vfs_aio, OID_AUTO, aiod_lifetime, CTLFLAG_ static int max_aio_per_proc = MAX_AIO_PER_PROC; SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_per_proc, CTLFLAG_RW, &max_aio_per_proc, 0, - "Maximum active aio requests per process (stored in the process)"); + "Maximum active aio requests per process"); static int max_aio_queue_per_proc = MAX_AIO_QUEUE_PER_PROC; SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_queue_per_proc, CTLFLAG_RW, &max_aio_queue_per_proc, 0, - "Maximum queued aio requests per process (stored in the process)"); + "Maximum queued aio requests per process"); static int max_buf_aio = MAX_BUF_AIO; SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, - "Maximum buf aio requests per process (stored in the process)"); + "Maximum buf aio requests per process"); /* * Though redundant with vfs.aio.max_aio_queue_per_proc, POSIX requires @@ -266,11 +266,8 @@ struct aioliojob { struct kaioinfo { struct mtx kaio_mtx; /* the lock to protect this struct */ int kaio_flags; /* (a) per process kaio flags */ - int kaio_maxactive_count; /* (*) maximum number of AIOs */ int kaio_active_count; /* (c) number of currently used AIOs */ - int kaio_qallowed_count; /* (*) maxiumu size of AIO queue */ int kaio_count; /* (a) size of AIO queue */ - int kaio_ballowed_count; /* (*) maximum number of buffers */ int kaio_buffer_count; /* (a) number of physio buffers */ TAILQ_HEAD(,kaiocb) kaio_all; /* (a) all AIOs in a process */ TAILQ_HEAD(,kaiocb) kaio_done; /* (a) done queue for process */ @@ -443,11 +440,8 @@ aio_init_aioinfo(struct proc *p) ki = uma_zalloc(kaio_zone, M_WAITOK); mtx_init(&ki->kaio_mtx, "aiomtx", NULL, MTX_DEF | MTX_NEW); ki->kaio_flags = 0; - ki->kaio_maxactive_count = max_aio_per_proc; ki->kaio_active_count = 0; - ki->kaio_qallowed_count = max_aio_queue_per_proc; ki->kaio_count = 0; - ki->kaio_ballowed_count = max_buf_aio; ki->kaio_buffer_count = 0; TAILQ_INIT(&ki->kaio_all); TAILQ_INIT(&ki->kaio_done); @@ -706,7 +700,7 @@ restart: userp = job->userproc; ki = userp->p_aioinfo; - if (ki->kaio_active_count < ki->kaio_maxactive_count) { + if (ki->kaio_active_count < max_aio_per_proc) { TAILQ_REMOVE(&aio_jobs, job, list); if (!aio_clear_cancel_function(job)) goto restart; @@ -1270,7 +1264,7 @@ aio_qphysio(struct proc *p, struct kaiocb *job) error = -1; goto unref; } - if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) { + if (ki->kaio_buffer_count >= max_buf_aio) { error = EAGAIN; goto unref; } @@ -1479,7 +1473,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, stru ops->store_kernelinfo(ujob, -1); if (num_queue_count >= max_queue_count || - ki->kaio_count >= ki->kaio_qallowed_count) { + ki->kaio_count >= max_aio_queue_per_proc) { ops->store_error(ujob, EAGAIN); return (EAGAIN); } @@ -1776,8 +1770,7 @@ aio_kick_nowait(struct proc *userp) aiop->aioprocflags &= ~AIOP_FREE; wakeup(aiop->aioproc); } else if (num_aio_resv_start + num_aio_procs < max_aio_procs && - ki->kaio_active_count + num_aio_resv_start < - ki->kaio_maxactive_count) { + ki->kaio_active_count + num_aio_resv_start < max_aio_per_proc) { taskqueue_enqueue(taskqueue_aiod_kick, &ki->kaio_task); } } @@ -1796,8 +1789,7 @@ retryproc: aiop->aioprocflags &= ~AIOP_FREE; wakeup(aiop->aioproc); } else if (num_aio_resv_start + num_aio_procs < max_aio_procs && - ki->kaio_active_count + num_aio_resv_start < - ki->kaio_maxactive_count) { + ki->kaio_active_count + num_aio_resv_start < max_aio_per_proc) { num_aio_resv_start++; mtx_unlock(&aio_job_mtx); error = aio_newproc(&num_aio_resv_start); From owner-svn-src-all@freebsd.org Tue Jan 30 01:13:06 2018 Return-Path: Delivered-To: svn-src-all@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 A8C2DEC70D6; Tue, 30 Jan 2018 01:13:06 +0000 (UTC) (envelope-from emaste@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 5C446718B6; Tue, 30 Jan 2018 01:13:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5716010292; Tue, 30 Jan 2018 01:13:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U1D68Q011821; Tue, 30 Jan 2018 01:13:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U1D6KW011820; Tue, 30 Jan 2018 01:13:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801300113.w0U1D6KW011820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 Jan 2018 01:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328583 - stable/11/lib/libcxxrt X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/lib/libcxxrt X-SVN-Commit-Revision: 328583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 01:13:06 -0000 Author: emaste Date: Tue Jan 30 01:13:06 2018 New Revision: 328583 URL: https://svnweb.freebsd.org/changeset/base/328583 Log: MFC r328305: libcxxrt: Move mangled symbols out of extern "C++" in Version.map r260553 added a number of mangled C++ symbols to Version.map inside of an existing `extern "C++"` block. ld.bfd 2.17.50 treats `extern "C++"` permissively and will match both mangled and demangled symbols against the strings in the version map block. ld.lld interprets `extern "C++"` strictly, and matches only demangled symbols. I believe lld's behaviour is correct. Contemporary versions of ld.bfd also behave as lld does, so move the mangled symbols out of the `extern "C++"` block. PR: 225128, 185663 Sponsored by: The FreeBSD Foundation Modified: stable/11/lib/libcxxrt/Version.map Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libcxxrt/Version.map ============================================================================== --- stable/11/lib/libcxxrt/Version.map Tue Jan 30 00:52:22 2018 (r328582) +++ stable/11/lib/libcxxrt/Version.map Tue Jan 30 01:13:06 2018 (r328583) @@ -112,19 +112,6 @@ CXXABI_1.3 { "typeinfo for void"; "typeinfo for wchar_t const*"; "typeinfo for wchar_t"; - # C++11 typeinfo not understood by our linker - # std::nullptr_t - _ZTIDn;_ZTIPDn;_ZTIPKDn; - # char16_t - _ZTIDi;_ZTIPDi;_ZTIPKDi; - # char32_t - _ZTIDs;_ZTIPDs;_ZTIPKDs; - # IEEE 754r decimal floating point - _ZTIDd;_ZTIPDd;_ZTIPKDd; - _ZTIDe;_ZTIPDe;_ZTIPKDe; - _ZTIDf;_ZTIPDf;_ZTIPKDf; - # IEEE 754r half-precision floating point - _ZTIDh;_ZTIPDh;_ZTIPKDh; "typeinfo for bool*"; "typeinfo for wchar_t*"; @@ -209,19 +196,6 @@ CXXABI_1.3 { "typeinfo name for void*"; "typeinfo name for unsigned int*"; "typeinfo name for float*"; - # C++11 typeinfo name not understood by our linker - # std::nullptr_t - _ZTSDn;_ZTSPDn;_ZTSPKDn; - # char16_t - _ZTSDi;_ZTSPDi;_ZTSPKDi; - # char32_t - _ZTSDs;_ZTSPDs;_ZTSPKDs; - # IEEE 754r decimal floating point - _ZTSDd;_ZTSPDd;_ZTSPKDd; - _ZTSDe;_ZTSPDe;_ZTSPKDe; - _ZTSDf;_ZTSPDf;_ZTSPKDf; - # IEEE 754r half-precision floating point - _ZTSDh;_ZTSPDh;_ZTSPKDh; "typeinfo name for __cxxabiv1::__array_type_info"; "typeinfo name for __cxxabiv1::__class_type_info"; @@ -242,9 +216,35 @@ CXXABI_1.3 { "pathscale::set_terminate(void (*)())"; "pathscale::set_unexpected(void (*)())"; "pathscale::set_use_thread_local_handlers(bool)"; + }; + # C++11 typeinfo not understood by ld.bfd 2.17.50 + # std::nullptr_t + _ZTIDn;_ZTIPDn;_ZTIPKDn; + # char16_t + _ZTIDi;_ZTIPDi;_ZTIPKDi; + # char32_t + _ZTIDs;_ZTIPDs;_ZTIPKDs; + # IEEE 754r decimal floating point + _ZTIDd;_ZTIPDd;_ZTIPKDd; + _ZTIDe;_ZTIPDe;_ZTIPKDe; + _ZTIDf;_ZTIPDf;_ZTIPKDf; + # IEEE 754r half-precision floating point + _ZTIDh;_ZTIPDh;_ZTIPKDh; - }; + # C++11 typeinfo name not understood by ld.bfd 2.17.50 + # std::nullptr_t + _ZTSDn;_ZTSPDn;_ZTSPKDn; + # char16_t + _ZTSDi;_ZTSPDi;_ZTSPKDi; + # char32_t + _ZTSDs;_ZTSPDs;_ZTSPKDs; + # IEEE 754r decimal floating point + _ZTSDd;_ZTSPDd;_ZTSPKDd; + _ZTSDe;_ZTSPDe;_ZTSPKDe; + _ZTSDf;_ZTSPDf;_ZTSPKDf; + # IEEE 754r half-precision floating point + _ZTSDh;_ZTSPDh;_ZTSPKDh; local: *; From owner-svn-src-all@freebsd.org Tue Jan 30 02:51:01 2018 Return-Path: Delivered-To: svn-src-all@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 9A840ED022A; Tue, 30 Jan 2018 02:51:01 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C95E76156; Tue, 30 Jan 2018 02:51:00 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89 (FreeBSD)) (envelope-from ) id 1egM0Y-000Ki2-R6; Mon, 29 Jan 2018 18:50:52 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id w0U2omFX079609; Mon, 29 Jan 2018 18:50:48 -0800 (PST) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Mon, 29 Jan 2018 18:50:48 -0800 From: Oleksandr Tymoshenko To: Poul-Henning Kamp Cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-ID: <20180130025048.GA76676@bluezbox.com> References: <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> <33452.1517233531@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33452.1517233531@critter.freebsd.dk> X-Operating-System: FreeBSD/11.1-RELEASE-p4 (amd64) User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <20180129132736.GA66330@bluezbox.com>, Oleksandr Tymoshenko writes: > > >> If I pick a RPI[23] out of the box, download a FreeBSD [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 02:51:01 -0000 Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <20180129132736.GA66330@bluezbox.com>, Oleksandr Tymoshenko writes: > > >> If I pick a RPI[23] out of the box, download a FreeBSD image, > >> put the card in and play around, I should be able to put a > >> LED in a breadboard and configure a line for PWM or attach > >> an I2C or SPI device without reboot between every single > >> experiment. > > > >No problem. We include pwm.dtbo in our snapshot and config.txt. > >We have PWM running out of the box. Problem solved, no need for > >any hacks. I'll gladly work with Glen and Brad to get this > >functionality in snapshots/builds. > > You seem to have skipped the bit about "without reboot" ? No I haven't. config.txt is parsed by VC firmware on boot time and pwm.dtbo is applied even before boot loader kicks in. When kernel starts pwm node has pinctl information ready and status property is set to "okay". So if you download next available image, flash and boot it and run kldload bcm2835_pwm it will give you working PWM device out of the box without reboot. It's end-user experience you described. This approach works well with soon to be added pinctl and does not require ofw_bus_status_okay hack. Please commit a fix for it. > >Raspberry Pi and other hobbyist ARM boards are basically Lego. > >They can be turned into multiple things and that's their selling > >point. They're hackers' toys. > > That's *exactly* why I want us to support them better. > > >You ignored my question: what would be authoritative source for this > >kind of info? World is not perfect, FreeBSD/arm support is not perfect. > >We have limited resources. Where we should apply them to guide > >new contributors? > > At the very least have some place to point developers for a > resonably up-to-date idea of what the FDT related architecture > in FreeBSD is. Fair point. It can be chapter in Handbook. > Either documentation or source code (preferably with a bit of > contextual comments) on our chosen reference platform. (Source > code on ref-platform is probably more robust, as there is a > better chance that it will be kept current.) I don't think we have designated reference platform at the moment, but it's a good idea to have one. Pi's platform is too weird to be reference. TI's AM335x or iMX would be a good candidate I think They are complex enough to illustrate all the concepts yet not super complex. There is probably some bugs there from the dawn of FDT era but thery can be cleaned out. Nvidia's SoCs are not very accessible. And I don't have any knowledge about how complex Allwinner codebase is. > >You also ignored my question about clkman fix. Provided you have > >all the documentation you need [...] > > I don't. The information for the PWM case was based on an affine > transform of information for the GPIO clock some shrewed guesses > and finally in-lab measurement of what actually transpired when I > frobbed registers. > > But more importantly, I have no idea what servies *a* clock > manager offers, through which apis and to what clients and > at what level of abstraction and flexibility ? Wrong wording on my side. It should have been: "if somebody put together all required documentation on clk framework would you be up to fix clkmgr driver?" Doesn't matter now, mmel@ volunteered to look into this. -- gonzo From owner-svn-src-all@freebsd.org Tue Jan 30 03:31:41 2018 Return-Path: Delivered-To: svn-src-all@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 4E24BED2CAD; Tue, 30 Jan 2018 03:31:41 +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 F41AD77CA0; Tue, 30 Jan 2018 03:31:40 +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 EF3B811B19; Tue, 30 Jan 2018 03:31:40 +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 w0U3VecB080751; Tue, 30 Jan 2018 03:31:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U3Vejl080750; Tue, 30 Jan 2018 03:31:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801300331.w0U3Vejl080750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 30 Jan 2018 03:31:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328584 - head/stand/fdt X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/fdt X-SVN-Commit-Revision: 328584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 03:31:41 -0000 Author: kevans Date: Tue Jan 30 03:31:40 2018 New Revision: 328584 URL: https://svnweb.freebsd.org/changeset/base/328584 Log: stand/fdt: Remove unused write-only new_fdtp, correct comment MFC after: 3 days Modified: head/stand/fdt/fdt_loader_cmd.c Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Tue Jan 30 01:13:06 2018 (r328583) +++ head/stand/fdt/fdt_loader_cmd.c Tue Jan 30 03:31:40 2018 (r328584) @@ -438,7 +438,6 @@ fdt_apply_overlays() size_t max_overlay_size, next_fdtp_size; size_t current_fdtp_size; void *current_fdtp; - void *new_fdtp; void *next_fdtp; void *overlay; int rv; @@ -446,7 +445,6 @@ fdt_apply_overlays() if ((fdtp == NULL) || (fdtp_size == 0)) return; - new_fdtp = NULL; max_overlay_size = 0; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { if (max_overlay_size < fp->f_size) @@ -489,7 +487,7 @@ fdt_apply_overlays() printf("failed to open base dtb into overlay base\n"); continue; } - /* Both overlay and new_fdtp may be modified in place */ + /* Both overlay and next_fdtp may be modified in place */ rv = fdt_overlay_apply(next_fdtp, overlay); if (rv == 0) { /* Rotate next -> current */ From owner-svn-src-all@freebsd.org Tue Jan 30 04:05:04 2018 Return-Path: Delivered-To: svn-src-all@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 9E58DED4C50; Tue, 30 Jan 2018 04:05:04 +0000 (UTC) (envelope-from mmel@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 5152778F9E; Tue, 30 Jan 2018 04:05:04 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4C4D512173; Tue, 30 Jan 2018 04:05:04 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U4540c096584; Tue, 30 Jan 2018 04:05:04 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U4541W096583; Tue, 30 Jan 2018 04:05:04 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801300405.w0U4541W096583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 30 Jan 2018 04:05:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328585 - head/sys/dev/extres/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/extres/clk X-SVN-Commit-Revision: 328585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 04:05:04 -0000 Author: mmel Date: Tue Jan 30 04:05:03 2018 New Revision: 328585 URL: https://svnweb.freebsd.org/changeset/base/328585 Log: Revert r328511, it was committed with .diff instead of .txt as commit log. Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Tue Jan 30 03:31:40 2018 (r328584) +++ head/sys/dev/extres/clk/clk.c Tue Jan 30 04:05:03 2018 (r328585) @@ -642,11 +642,10 @@ clknode_adjust_parent(struct clknode *clknode, int idx if (clknode->parent_cnt == 0) return; if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) - panic("%s: Invalid parent index %d for clock %s", - __func__, idx, clknode->name); + panic("Invalid clock parent index\n"); if (clknode->parents[idx] == NULL) - panic("%s: Invalid parent index %d for clock %s", + panic("%s: Attempt to set invalid parent %d for clock %s", __func__, idx, clknode->name); /* Remove me from old children list. */ @@ -675,8 +674,8 @@ clknode_init_parent_idx(struct clknode *clknode, int i if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt) || (clknode->parent_names[idx] == NULL)) - panic("%s: Invalid parent index %d for clock %s", - __func__, idx, clknode->name); + panic("%s: Invalid clock parent index: %d\n", __func__, idx); + clknode->parent_idx = idx; } From owner-svn-src-all@freebsd.org Tue Jan 30 04:06:30 2018 Return-Path: Delivered-To: svn-src-all@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 C4D49ED4EB8; Tue, 30 Jan 2018 04:06:30 +0000 (UTC) (envelope-from mmel@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 73AF5791E6; Tue, 30 Jan 2018 04:06:30 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6EC191217D; Tue, 30 Jan 2018 04:06:30 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U46UcO096673; Tue, 30 Jan 2018 04:06:30 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U46UBj096672; Tue, 30 Jan 2018 04:06:30 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801300406.w0U46UBj096672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 30 Jan 2018 04:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328586 - head/sys/dev/extres/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/extres/clk X-SVN-Commit-Revision: 328586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 04:06:30 -0000 Author: mmel Date: Tue Jan 30 04:06:30 2018 New Revision: 328586 URL: https://svnweb.freebsd.org/changeset/base/328586 Log: Use more verbose panic messages. MFC after: 2 weeks Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Tue Jan 30 04:05:03 2018 (r328585) +++ head/sys/dev/extres/clk/clk.c Tue Jan 30 04:06:30 2018 (r328586) @@ -642,10 +642,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx if (clknode->parent_cnt == 0) return; if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) - panic("Invalid clock parent index\n"); + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); if (clknode->parents[idx] == NULL) - panic("%s: Attempt to set invalid parent %d for clock %s", + panic("%s: Invalid parent index %d for clock %s", __func__, idx, clknode->name); /* Remove me from old children list. */ @@ -674,8 +675,8 @@ clknode_init_parent_idx(struct clknode *clknode, int i if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt) || (clknode->parent_names[idx] == NULL)) - panic("%s: Invalid clock parent index: %d\n", __func__, idx); - + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); clknode->parent_idx = idx; } From owner-svn-src-all@freebsd.org Tue Jan 30 04:13:00 2018 Return-Path: Delivered-To: svn-src-all@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 01D88ED5A02; Tue, 30 Jan 2018 04:13:00 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wr0-x236.google.com (mail-wr0-x236.google.com [IPv6:2a00:1450:400c:c0c::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 661E6799C7; Tue, 30 Jan 2018 04:12:59 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wr0-x236.google.com with SMTP id a1so9570102wri.5; Mon, 29 Jan 2018 20:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=oRTtHKYsFezbxf36nWIVdWetR7bkI9ZYUjQIMbsvTVQ=; b=a416ejMbxT+/uI9zidRiVpxzZ2fGc26WyAKn/K9iHr3L/6rE5XOOV62vc+CtG8ivGo JyRqNpc4m+JoL8vZLooVYPvd1cj+6hk6qLVTFJjrxyrHjYvKOVZ2RlaRjeGMjKEr67TV f+gGi/1jFFEYa+W8wv8gCdtDoN3iFQKxo8VryLlSDXXqtug6Z3tOCCMZI7xEa7aHpq/f X5v1zYK0KqY6dHAAKt6UJO8fm5bCXPxWZTtmuqW9tPOdW5x9dsfdCVZyWQZv9vkYdUo7 v5CgZ4DQBHTa7/saVJvMXLgWnsdxPqOOP73STRS5cYHWsblCoWJScW6vh+z679QTP4Cq 1Caw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=oRTtHKYsFezbxf36nWIVdWetR7bkI9ZYUjQIMbsvTVQ=; b=WTtTwlYpfzl3Zr6bggPEZLmjCswabt1maYZhx1kWPUNVeL4RICv56zSYLJ35e2ABsA QBzrrBwP/vXrXBpR7ElnwEaWgr6vbZMG4JAeClQ1LoSuSeOLDEulYJaT3j+Glwhig/lV n+2+sRyu9kFYDbAktTJh3cJZ/pYidw50nn/UfhMVV+zOF94KMFCt3xw+J+ofKAmTpLjn 7JlCT1ISGYXK/QMiF7BMSkJbibahySzsrIjAMg6t3EfYFnEVrJ+mZXKFaj9gcEG45kBw MLUGnHf3IfrUTsrGaIHR425cI9OJ9KHyYMVzKxZKRywatqOeb7i/37d12t/SZ6QGyvmA 6PFA== X-Gm-Message-State: AKwxyte5JvZU5RdQ8KkWA5zQB2PXJtnheH26cv2/XLc4fryGl2+7zOTq n7ckxyZNhsL//wEc8mZWf5plODy9 X-Google-Smtp-Source: AH8x2278OaCS2YVSV/OipaUNTsHoMGwJlacNMKPKqow55vAP7rJgh6dPnIUusfU60MtbGWO36A0uKQ== X-Received: by 10.223.196.78 with SMTP id a14mr4672914wrg.251.1517285578071; Mon, 29 Jan 2018 20:12:58 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id m191sm9837330wma.42.2018.01.29.20.12.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 20:12:57 -0800 (PST) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r328511 - head/sys/dev/extres/clk To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801281520.w0SFKjQe067446@repo.freebsd.org> <4499401.WAFztV9qgp@ralph.baldwin.cx> Message-ID: Date: Tue, 30 Jan 2018 05:12:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <4499401.WAFztV9qgp@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 04:13:00 -0000 On 29.01.2018 18:46, John Baldwin wrote: > On Sunday, January 28, 2018 03:20:45 PM Michal Meloun wrote: >> Author: mmel >> Date: Sun Jan 28 15:20:45 2018 >> New Revision: 328511 >> URL: https://svnweb.freebsd.org/changeset/base/328511 >> >> Log: >> diff --git a/sys/dev/extres/clk/clk.c b/sys/dev/extres/clk/clk.c >> index c6a1f466ceb..c3708a0ce27 100644 >> --- a/sys/dev/extres/clk/clk.c >> +++ b/sys/dev/extres/clk/clk.c >> @@ -642,10 +642,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx) >> if (clknode->parent_cnt == 0) >> return; >> if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) >> - panic("Invalid clock parent index\n"); >> + panic("%s: Invalid parent index %d for clock %s", >> + __func__, idx, clknode->name); >> >> if (clknode->parents[idx] == NULL) >> - panic("%s: Attempt to set invalid parent %d for clock %s", >> + panic("%s: Invalid parent index %d for clock %s", >> __func__, idx, clknode->name); >> >> /* Remove me from old children list. */ >> @@ -674,8 +675,8 @@ clknode_init_parent_idx(struct clknode *clknode, int idx) >> if ((idx == CLKNODE_IDX_NONE) || >> (idx >= clknode->parent_cnt) || >> (clknode->parent_names[idx] == NULL)) >> - panic("%s: Invalid clock parent index: %d\n", __func__, idx); >> - >> + panic("%s: Invalid parent index %d for clock %s", >> + __func__, idx, clknode->name); >> clknode->parent_idx = idx; >> } >> >> Modified: >> head/sys/dev/extres/clk/clk.c > Can you revert and recommit this with a proper log message? > Done in  r328586. I'm sorry, 'svn commit --file ../clk.diff' is very close to 'svn commit --file ../clk.log'. Michal From owner-svn-src-all@freebsd.org Tue Jan 30 04:50:24 2018 Return-Path: Delivered-To: svn-src-all@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 B0A1BED7B0D; Tue, 30 Jan 2018 04:50:24 +0000 (UTC) (envelope-from eadler@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 5F0277AD72; Tue, 30 Jan 2018 04:50:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 594F51285C; Tue, 30 Jan 2018 04:50:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0U4oOxX016722; Tue, 30 Jan 2018 04:50:24 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U4oO0G016720; Tue, 30 Jan 2018 04:50:24 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801300450.w0U4oO0G016720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 30 Jan 2018 04:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328587 - stable/11/usr.sbin/newsyslog X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.sbin/newsyslog X-SVN-Commit-Revision: 328587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 04:50:24 -0000 Author: eadler Date: Tue Jan 30 04:50:23 2018 New Revision: 328587 URL: https://svnweb.freebsd.org/changeset/base/328587 Log: MFC r327451: newsyslog: implement 'p' flag Implement the 'p' flag for newsyslog from NetBSD. This flag results in the first log file for a given file to not be compressed. While here, don't change file attributes during a no-op run PR: 162798 Modified: stable/11/usr.sbin/newsyslog/newsyslog.c stable/11/usr.sbin/newsyslog/newsyslog.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/11/usr.sbin/newsyslog/newsyslog.c Tue Jan 30 04:06:30 2018 (r328586) +++ stable/11/usr.sbin/newsyslog/newsyslog.c Tue Jan 30 04:50:23 2018 (r328587) @@ -127,6 +127,7 @@ __FBSDID("$FreeBSD$"); #define CE_CREATE 0x0100 /* Create the log file if it does not exist. */ #define CE_NODUMP 0x0200 /* Set 'nodump' on newly created log file. */ #define CE_PID2CMD 0x0400 /* Replace PID file with a shell command.*/ +#define CE_PLAIN0 0x0800 /* Do not compress zero'th history file */ #define CE_RFC5424 0x0800 /* Use RFC5424 format rotation message */ @@ -1300,6 +1301,9 @@ no_trimat: case 'n': working->flags |= CE_NOSIGNAL; break; + case 'p': + working->flags |= CE_PLAIN0; + break; case 'r': working->flags |= CE_PID2CMD; break; @@ -1322,7 +1326,6 @@ no_trimat: break; case 'f': /* Used by OpenBSD for "CE_FOLLOW" */ case 'm': /* Used by OpenBSD for "CE_MONITOR" */ - case 'p': /* Used by NetBSD for "CE_PLAIN0" */ default: errx(1, "illegal flag in config file -- %c", *q); @@ -1827,8 +1830,18 @@ do_rotate(const struct conf_entry *ent) else { /* XXX - Ought to be checking for failure! */ (void)rename(zfile1, zfile2); + change_attrs(zfile2, ent); + if (ent->compress && !strlen(logfile_suffix)) { + /* compress old rotation */ + struct zipwork_entry zwork; + + memset(&zwork, 0, sizeof(zwork)); + zwork.zw_conf = ent; + zwork.zw_fsize = sizefile(zfile2); + strcpy(zwork.zw_fname, zfile2); + do_zipwork(&zwork); + } } - change_attrs(zfile2, ent); } if (ent->numlogs > 0) { @@ -1877,12 +1890,15 @@ do_rotate(const struct conf_entry *ent) if (ent->pid_cmd_file != NULL) swork = save_sigwork(ent); if (ent->numlogs > 0 && ent->compress > COMPRESS_NONE) { - /* - * The zipwork_entry will include a pointer to this - * conf_entry, so the conf_entry should not be freed. - */ - free_or_keep = KEEP_ENT; - save_zipwork(ent, swork, ent->fsize, file1); + if (!(ent->flags & CE_PLAIN0) || + strcmp(&file1[strlen(file1) - 2], ".0") != 0) { + /* + * The zipwork_entry will include a pointer to this + * conf_entry, so the conf_entry should not be freed. + */ + free_or_keep = KEEP_ENT; + save_zipwork(ent, swork, ent->fsize, file1); + } } return (free_or_keep); Modified: stable/11/usr.sbin/newsyslog/newsyslog.conf.5 ============================================================================== --- stable/11/usr.sbin/newsyslog/newsyslog.conf.5 Tue Jan 30 04:06:30 2018 (r328586) +++ stable/11/usr.sbin/newsyslog/newsyslog.conf.5 Tue Jan 30 04:50:23 2018 (r328587) @@ -300,6 +300,8 @@ log file using .It Cm N indicates that there is no process which needs to be signaled when this log file is rotated. +.It Cm p +indicates that the zero-th rotated file should not be compressed. .It Cm R if this flag is set the .Xr newsyslog 8 From owner-svn-src-all@freebsd.org Tue Jan 30 05:23:35 2018 Return-Path: Delivered-To: svn-src-all@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 E2C49ED9D10; Tue, 30 Jan 2018 05:23:34 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::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 558427C28B; Tue, 30 Jan 2018 05:23:34 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x243.google.com with SMTP id t79so13427550lfe.3; Mon, 29 Jan 2018 21:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qcK8EbV40ZqR2zTuYTxWOMEVG0P4bfDslXkQDtjueTo=; b=SJS8aQr5iabF+hp2toVG8XCOAotRkXYgWzxbG0Fo3R6xOALk8chG9/cXJhrVBzcJz6 QtXcmya9KFxSmvXGj49X5UsCPCgSJbutgjRo0+GX9ZZoV117Y9fBZzWBeVwn1FSLVH2l OD2COU1As9EY10XhrY+Mb01AQ0cfW72FO77LdfmiSS4zcBgggVeRlhj7bgaq3YfjRORm x39y3fTLIZ3R243NE96pK3NkH5H1jBq6JDQSObWR4MvChSEI5X3x0lazt19MpnHeo3aZ W2yFPaSnN+sXNxjdV0fE44ZxSt3XSuX4kyd2TSv62kwrLQ9EM7a2OrxqvQsTEnDQR+qb Ei8A== 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=qcK8EbV40ZqR2zTuYTxWOMEVG0P4bfDslXkQDtjueTo=; b=TQX8R1+ZFBeEBnxTsUtzvQeZ78zIB7hH4l4sdiu+RLIWHFkgQTqgUL5gUuvsO7Z/iy cdZ1O97CWs/b5M/QF9bdoc/FMGptF+ZqYQb8hTKP7rpd1phblWUHdLEzWs4hS1BfQkXk BZerCifNk6IAE6p5xCj8Tjj//AVICMeBJjSDFuuTDxmPsCJJyVVwsNVghJtloK3fz5B0 mX7t1X9FGfVkQiVBcXZOplPGqlV5U4eaWg/YT13ycNvRLywy3y60CHdnbYuW5hNYooKb 9igtscI69a/wRMMHMPaEaOnJNq8zmixJUjm4S/fDuu5Eqop0qjlT3AOqyyLQRnvYXeHf tT/Q== X-Gm-Message-State: AKwxytep99sAte+Gc08IOWCzUEceZhTHLj2luIsbvZLFX4YYWOXbYh4W yfvUte6e0JLc5U1AHzS3aa0sf5dFTF6rHyCQwK4= X-Google-Smtp-Source: AH8x227C3gNqUkCygahLZ3XMHFoU19IKC2+PeCtUyxjTksYkPkMMTtGo3RvoQ9x+l36DV2MSI1h7d9IZzEZDsJLQerM= X-Received: by 10.25.225.215 with SMTP id l84mr14690046lfk.110.1517289812575; Mon, 29 Jan 2018 21:23:32 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.87.131 with HTTP; Mon, 29 Jan 2018 21:23:31 -0800 (PST) In-Reply-To: <201709081508.v88F8IaB085346@repo.freebsd.org> References: <201709081508.v88F8IaB085346@repo.freebsd.org> From: Alan Somers Date: Mon, 29 Jan 2018 22:23:31 -0700 X-Google-Sender-Auth: jVRbv7H8JCZDtEGqFH6vYa7nv3g Message-ID: Subject: Re: svn commit: r323314 - in head/sbin/geom: class/virstor misc To: Conrad Meyer 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.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 05:23:35 -0000 On Fri, Sep 8, 2017 at 9:08 AM, Conrad Meyer wrote: > Author: cem > Date: Fri Sep 8 15:08:17 2017 > New Revision: 323314 > URL: https://svnweb.freebsd.org/changeset/base/323314 > > Log: > Audit userspace geom code for leaking memory to disk > > Any geom class using g_metadata_store, as well as geom_virstor which > duplicated g_metadata_store internally, would dump sectorsize - mdsize > bytes > of userspace memory following the metadata block stored. This is most or > all > geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, > gmultipath, > graid3, gshsec, gstripe, and geom_virstor). > > PR: 222077 (comment #3) > Reported by: Maxim Khitrov > Reviewed by: des > Security: yes > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D12269 > > Modified: > head/sbin/geom/class/virstor/geom_virstor.c > head/sbin/geom/misc/subr.c > The problem is real, but the change doesn't completely fix the problem. The problem is that classes don't use g_metadata_store the way you assumed. Instead of the size argument indicating the useful portion of the label, most if not all classes use it to indicate the size of their buffer, and they pass in a buffer that hasn't been bzero()ed. Fixing this bug will require changes to each class. For example, geom_label.c creates a 512B buffer, initializes the first 44 bytes, then calls g_metadata_store with size=512. I'll work on a fix tomorrow. -Alan From owner-svn-src-all@freebsd.org Tue Jan 30 08:31:38 2018 Return-Path: Delivered-To: svn-src-all@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 AF367EE2370; Tue, 30 Jan 2018 08:31:38 +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 48AAA81C88; Tue, 30 Jan 2018 08:31:37 +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 C9629273C6; Tue, 30 Jan 2018 08:31:31 +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 w0U8VGjN090454 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Jan 2018 08:31:16 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0U8VEoh090453; Tue, 30 Jan 2018 08:31:14 GMT (envelope-from phk) To: Oleksandr Tymoshenko cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180130025048.GA76676@bluezbox.com> From: "Poul-Henning Kamp" References: <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> <33452.1517233531@critter.freebsd.dk> <20180130025048.GA76676@bluezbox.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <90451.1517301074.1@critter.freebsd.dk> Date: Tue, 30 Jan 2018 08:31:14 +0000 Message-ID: <90452.1517301074@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 08:31:38 -0000 -------- In message <20180130025048.GA76676@bluezbox.com>, Oleksandr Tymoshenko writes: >> You seem to have skipped the bit about "without reboot" ? > >No I haven't. config.txt is parsed by VC firmware on boot time >and pwm.dtbo is applied even before boot loader kicks in. When >kernel starts pwm node has pinctl information ready and status >property is set to "okay". So if you download next available image, >flash and boot it and run kldload bcm2835_pwm it will give you >working PWM device out of the box without reboot. But only if you add pwm.dtbo to config.txt and reboot, because I see nothing indicating that we will put it there in the release images we (may start to) produce ? >I don't think we have designated reference platform at the moment, >but it's a good idea to have one. Pi's platform is too weird to >be reference. TI's AM335x or iMX would be a good candidate I think >They are complex enough to illustrate all the concepts yet not super >complex. I fully agree that RPi should *not* be our reference platform. -- 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-all@freebsd.org Tue Jan 30 09:04:43 2018 Return-Path: Delivered-To: svn-src-all@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 9F4C3EE388A for ; Tue, 30 Jan 2018 09:04:43 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-qt0-x234.google.com (mail-qt0-x234.google.com [IPv6:2607:f8b0:400d:c0d::234]) (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 3EF7082E9D for ; Tue, 30 Jan 2018 09:04:43 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-qt0-x234.google.com with SMTP id s39so16279394qth.7 for ; Tue, 30 Jan 2018 01:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aT0y3Z0Mgi8Mo5zgpQDnjKKtcAAXaTrUhN38QWrf3/U=; b=MT+Byhy+KpD6oKKhTZfIQ6+hdLxJjG6BW6CME2HSUrOPBYlwDqcT8nrHwh1B10NDtu cFKjKFDvOWg2D7ucdwitR4tQE01rEcYMNP999YRCW4HNj0ST4i2HDd4xi/3L2ZsdcNFS KoUzG1pTktiEcfki0fOIDErRHbhZiZZcL7Zk677ydDvWH8qcjeEaPzelxrwF+jzxElcg 2eB38l3l1Dz3cNoXEzImphN3C4ACdl5YUImd5oOT3KY9NLWd0o7wlf3v6Rs7sLYR5C/g DvszZI+lJoBu7VbxqVP7KIJ9ggt5D0Xh5vnC6y0kfTX0Rnj5iC4UbpwdLyI+zgo6nd4V Py6A== 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=aT0y3Z0Mgi8Mo5zgpQDnjKKtcAAXaTrUhN38QWrf3/U=; b=qI68DvhGdhmSb2xttjosQIdOfE8vkuUtlBSS4pp2n7LJNqnPsffBz85Mz1jSjOaZTt lvERiqtSYPPttF1t7U8IcTRhf8I0n6Lx8o2oI0OwKyrg9Vc6KWbArZa7NYs74wC4IYo3 A/jDFox38Qj3Rjt8zZHGFweY4uzJeOf5jCeziQDFjNWZIZQMFACwR8ENggq68UjmhvkJ e4oxfy8Fs4jvi0hlNSw5KZqdsSqQel89jdqBcLoFRotjaz3dLQZy+nTrFBYMD3DjbF6d 6t+gxRR43I+NHf71gXkeNS7hEYnad6FaPuAQJrNnhchqKAl9jWLxaXVWxomkMyc5q4jC IKsQ== X-Gm-Message-State: AKwxytdCFLsXHRs+MErT5w3KNoIGUj8G+n3BxmO/kJSeO/UB7lkpGpkz egiSvkIM0Pywp/2jdDQ7+zzqHt5Mn01sZ8ExocPAgA== X-Google-Smtp-Source: AH8x227c4V9cMEblKqQa3AuW146iR8asSzK9akEPtJCK9oH8bKPyEEds2gKi3ya8L2rOqTgAQqrRIU5E/dRSEvWQ2/w= X-Received: by 10.237.50.99 with SMTP id y90mr44629768qtd.274.1517303082847; Tue, 30 Jan 2018 01:04:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.42.122 with HTTP; Tue, 30 Jan 2018 01:04:22 -0800 (PST) In-Reply-To: <2b1dc9be-493e-57fb-d012-0af52dc7475b@freebsd.org> References: <201801290927.w0T9R2ot008700@repo.freebsd.org> <2b1dc9be-493e-57fb-d012-0af52dc7475b@freebsd.org> From: Wojciech Macek Date: Tue, 30 Jan 2018 10:04:22 +0100 Message-ID: Subject: Re: svn commit: r328537 - in head/sys/powerpc: aim powernv To: Nathan Whitehorn Cc: 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.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 09:04:43 -0000 The LPCR register must be set very early. The best is to do it in cpudep_bootstrap as this is the first function being run on the AP after start. As soon as the AP completes pmap_cpu_bootstrap, we must guarantee that DSI exceptions are working fine. We can't do this with LPCR set incorrectly, this it contains a base addres of an exception table. The code from powernv_smp_ap_init was moved to attach, as we don't set LPCR twice during AP startup - it's not an error of course, but I like to have this in one place only. I can revert this patch if you insist, but to fix non-powernv boards we can just add "if (mfmsr() & PSL_HV)" check to early_bootstrap. What do you think? Regards, Wojtek 2018-01-29 16:46 GMT+01:00 Nathan Whitehorn : > Can you explain why this is necessary? Both functions are run in the same > context and this way of doing things breaks important abstraction barriers. > > Since it also breaks booting on pHyp systems, I would appreciate it if you > could revert this pending review. > -Nathan > > > On 01/29/18 01:27, Wojciech Macek wrote: > >> Author: wma >> Date: Mon Jan 29 09:27:02 2018 >> New Revision: 328537 >> URL: https://svnweb.freebsd.org/changeset/base/328537 >> >> Log: >> PowerNV: move LPCR and LPID altering to cpudep_ap_early_bootstrap >> It turns out that under some circumstances we can get DSI or DSE >> before we set >> LPCR and LPID so we should set it as early as possible. >> Authored by: Patryk Duda >> Submitted by: Wojciech Macek >> Obtained from: Semihalf >> Sponsored by: IBM, QCM Technologies >> >> Modified: >> head/sys/powerpc/aim/mp_cpudep.c >> head/sys/powerpc/powernv/platform_powernv.c >> >> Modified: head/sys/powerpc/aim/mp_cpudep.c >> ============================================================ >> ================== >> --- head/sys/powerpc/aim/mp_cpudep.c Mon Jan 29 09:24:28 2018 >> (r328536) >> +++ head/sys/powerpc/aim/mp_cpudep.c Mon Jan 29 09:27:02 2018 >> (r328537) >> @@ -64,9 +64,6 @@ cpudep_ap_early_bootstrap(void) >> register_t reg; >> #endif >> - __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); >> - powerpc_sync(); >> - >> switch (mfpvr() >> 16) { >> case IBM970: >> case IBM970FX: >> @@ -86,7 +83,20 @@ cpudep_ap_early_bootstrap(void) >> #endif >> powerpc_sync(); >> break; >> + case IBMPOWER8: >> + case IBMPOWER8E: >> + isync(); >> + /* Direct interrupts to SRR instead of HSRR and reset >> LPCR otherwise */ >> + mtspr(SPR_LPID, 0); >> + isync(); >> + >> + mtspr(SPR_LPCR, LPCR_LPES); >> + isync(); >> + break; >> } >> + >> + __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); >> + powerpc_sync(); >> } >> uintptr_t >> >> Modified: head/sys/powerpc/powernv/platform_powernv.c >> ============================================================ >> ================== >> --- head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 09:24:28 >> 2018 (r328536) >> +++ head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 09:27:02 >> 2018 (r328537) >> @@ -128,6 +128,7 @@ powernv_attach(platform_t plat) >> pcell_t prop; >> phandle_t cpu; >> int res, len, node, idx; >> + register_t msr; >> /* Ping OPAL again just to make sure */ >> opal_check(); >> @@ -141,6 +142,19 @@ powernv_attach(platform_t plat) >> cpu_idle_hook = powernv_cpu_idle; >> powernv_boot_pir = mfspr(SPR_PIR); >> + /* LPID must not be altered when PSL_DR or PSL_IR is set */ >> + msr = mfmsr(); >> + mtmsr(msr & ~(PSL_DR | PSL_IR)); >> + >> + /* Direct interrupts to SRR instead of HSRR and reset LPCR >> otherwise */ >> + mtspr(SPR_LPID, 0); >> + isync(); >> + >> + mtmsr(msr); >> + >> + mtspr(SPR_LPCR, LPCR_LPES); >> + isync(); >> + >> /* Init CPU bits */ >> powernv_smp_ap_init(plat); >> @@ -444,21 +458,6 @@ powernv_reset(platform_t platform) >> static void >> powernv_smp_ap_init(platform_t platform) >> { >> - register_t msr; >> - >> - /* LPID must not be altered when PSL_DR or PSL_IR is set */ >> - msr = mfmsr(); >> - mtmsr(msr & ~(PSL_DR | PSL_IR)); >> - >> - isync(); >> - /* Direct interrupts to SRR instead of HSRR and reset LPCR >> otherwise */ >> - mtspr(SPR_LPID, 0); >> - isync(); >> - >> - mtmsr(msr); >> - >> - mtspr(SPR_LPCR, LPCR_LPES); >> - isync(); >> } >> static void >> >> > From owner-svn-src-all@freebsd.org Tue Jan 30 09:42:58 2018 Return-Path: Delivered-To: svn-src-all@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 1842FEE5074; Tue, 30 Jan 2018 09:42:58 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A84C48448E; Tue, 30 Jan 2018 09:42:57 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89 (FreeBSD)) (envelope-from ) id 1egSRJ-000MEt-B6; Tue, 30 Jan 2018 01:42:54 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id w0U9gpLC085490; Tue, 30 Jan 2018 01:42:51 -0800 (PST) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Tue, 30 Jan 2018 01:42:51 -0800 From: Oleksandr Tymoshenko To: Poul-Henning Kamp Cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-ID: <20180130094251.GA85100@bluezbox.com> References: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> <33452.1517233531@critter.freebsd.dk> <20180130025048.GA76676@bluezbox.com> <90452.1517301074@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <90452.1517301074@critter.freebsd.dk> X-Operating-System: FreeBSD/11.1-RELEASE-p4 (amd64) User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <20180130025048.GA76676@bluezbox.com>, Oleksandr Tymoshenko writes: > > >> You seem to have skipped the bit about "without reboot" [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 09:42:58 -0000 Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > -------- > In message <20180130025048.GA76676@bluezbox.com>, Oleksandr Tymoshenko writes: > > >> You seem to have skipped the bit about "without reboot" ? > > > >No I haven't. config.txt is parsed by VC firmware on boot time > >and pwm.dtbo is applied even before boot loader kicks in. When > >kernel starts pwm node has pinctl information ready and status > >property is set to "okay". So if you download next available image, > >flash and boot it and run kldload bcm2835_pwm it will give you > >working PWM device out of the box without reboot. > > But only if you add pwm.dtbo to config.txt and reboot, because > I see nothing indicating that we will put it there in the > release images we (may start to) produce ? No. We're going to add them in our release image. That's what I meant by "working with Glen and Brad". Glen as release engineer built all those scripts that prepare SoC images. He works closely with FreeBSD/ARM community and although I can't speak for him I hope he won't object to the change that introduces new feature and doesn't violate POLA. We already install two overlays that are required to get reasonable boot-time defaults. PI3 release image config is here: http://svn.freebsd.org/base/head/release/arm64/RPI3.conf Adding pwm.dtbo is one-line change. Adding line to config.txt is one more line. RaspBSD is volunteer project by Brad Davis so it's completely up to him whether to enable PWM by default or not. He knows his userbase best. All one can do is to make a case and present it to Brad. -- gonzo From owner-svn-src-all@freebsd.org Tue Jan 30 09:48:16 2018 Return-Path: Delivered-To: svn-src-all@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 63E82EE5388; Tue, 30 Jan 2018 09:48:16 +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 F1444846FD; Tue, 30 Jan 2018 09:48:15 +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 ADDBC2737A; Tue, 30 Jan 2018 09:48:13 +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 w0U9lwEo064383 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Jan 2018 09:47:58 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0U9lvue064382; Tue, 30 Jan 2018 09:47:57 GMT (envelope-from phk) To: Oleksandr Tymoshenko cc: Emmanuel Vadot , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180130094251.GA85100@bluezbox.com> From: "Poul-Henning Kamp" References: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> <33452.1517233531@critter.freebsd.dk> <20180130025048.GA76676@bluezbox.com> <90452.1517301074@critter.freebsd.dk> <20180130094251.GA85100@bluezbox.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <64380.1517305677.1@critter.freebsd.dk> Date: Tue, 30 Jan 2018 09:47:57 +0000 Message-ID: <64381.1517305677@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 09:48:16 -0000 -------- In message <20180130094251.GA85100@bluezbox.com>, Oleksandr Tymoshenko writes: >Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: >> But only if you add pwm.dtbo to config.txt and reboot, because >> I see nothing indicating that we will put it there in the >> release images we (may start to) produce ? > >No. We're going to add them in our release image. That's what >I meant by "working with Glen and Brad". Ok, that was a bit more understated than I could decode. (My understanding until now was that you would have to do that by hand if you wanted to use PWM.) If the pwm overlay is going to be loaded by default, then I have no objection to removing the ignore-disable hack. -- 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-all@freebsd.org Tue Jan 30 09:58:22 2018 Return-Path: Delivered-To: svn-src-all@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 441BBEE5955; Tue, 30 Jan 2018 09:58:22 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5861384C40; Tue, 30 Jan 2018 09:58:20 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id b5a0a85d; Tue, 30 Jan 2018 10:58:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=RGWEixocSmazC45zhjdYR8PQDEs=; b=edjzeS9wm5LcRpAEszJ+lKheTMIQ I9M0q+oBQ7xOLTeU4Vgb7h+Mk2VGjl0PSW4e8sbEpolbI7VVNOgCtvvs9ulgnuS1 6kPn+vcbFmxywmIDPNteltminYqbB10ls5A+aoM1k1Ebx3rXvHsSDqUM+QiIZSP0 CtXrUHPO0C3dgng= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=WWd06qkU4Ngh+5HkHl7f/QwhC9T3Nsz0lCxljS7IO7+AdeK9RGLhxX+Q zJIGlX4JrtEuK13iKr033EN3xxMRnQ20K5MgXQ6ceyTFVdGyptW/rFux4W9qG9j9 mwlc9PfgtzgWp1B3bFjrGwBH0hqGWtuS+5v0CjW6cEz0H1uwSsk= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 5e9fc08e TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 30 Jan 2018 10:58:12 +0100 (CET) Date: Tue, 30 Jan 2018 10:58:12 +0100 From: Emmanuel Vadot To: "Poul-Henning Kamp" Cc: Oleksandr Tymoshenko , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180130105812.d1de09e0d4ac88934d776c71@bidouilliste.com> In-Reply-To: <64381.1517305677@critter.freebsd.dk> References: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> <33452.1517233531@critter.freebsd.dk> <20180130025048.GA76676@bluezbox.com> <90452.1517301074@critter.freebsd.dk> <20180130094251.GA85100@bluezbox.com> <64381.1517305677@critter.freebsd.dk> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 09:58:22 -0000 On Tue, 30 Jan 2018 09:47:57 +0000 "Poul-Henning Kamp" wrote: > -------- > In message <20180130094251.GA85100@bluezbox.com>, Oleksandr Tymoshenko writes: > >Poul-Henning Kamp (phk@phk.freebsd.dk) wrote: > > >> But only if you add pwm.dtbo to config.txt and reboot, because > >> I see nothing indicating that we will put it there in the > >> release images we (may start to) produce ? > > > >No. We're going to add them in our release image. That's what > >I meant by "working with Glen and Brad". > > Ok, that was a bit more understated than I could decode. > > (My understanding until now was that you would have to do > that by hand if you wanted to use PWM.) > > If the pwm overlay is going to be loaded by default, then I > have no objection to removing the ignore-disable hack. I don't think that we want to load it by default as it would mean that some GPIO are now unusable as they are pwm pins now. If I understood gonzo correctly we will install it by default and if someone want to use pwm he just need to add it in /boot/msdos/config.txt to the list of overlays loaded by the rpi firmware. > -- > 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. -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Jan 30 09:59:53 2018 Return-Path: Delivered-To: svn-src-all@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 7424FEE5A77; Tue, 30 Jan 2018 09:59:53 +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 2996D84E00; Tue, 30 Jan 2018 09:59:53 +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 2420C15B05; Tue, 30 Jan 2018 09:59:53 +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 w0U9xrKs069767; Tue, 30 Jan 2018 09:59:53 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0U9xq91069764; Tue, 30 Jan 2018 09:59:52 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201801300959.w0U9xq91069764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 30 Jan 2018 09:59:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328588 - head/usr.bin/nfsstat X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.bin/nfsstat X-SVN-Commit-Revision: 328588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 09:59:53 -0000 Author: manu Date: Tue Jan 30 09:59:52 2018 New Revision: 328588 URL: https://svnweb.freebsd.org/changeset/base/328588 Log: nfsstat: Add libxo output Add libxo output support Merge exp41_intpr and exp_intpr function. The only difference is to print NFSV4.1 operations in exp41, add a third arguement to control that. printtitle was set to 1 and don't have a switch, add a -q options to control it. Reviewed by: bapt Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D14012 Modified: head/usr.bin/nfsstat/Makefile head/usr.bin/nfsstat/nfsstat.1 head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/Makefile ============================================================================== --- head/usr.bin/nfsstat/Makefile Tue Jan 30 04:50:23 2018 (r328587) +++ head/usr.bin/nfsstat/Makefile Tue Jan 30 09:59:52 2018 (r328588) @@ -4,6 +4,6 @@ PROG= nfsstat CFLAGS+=-DNFS -LIBADD+= devstat +LIBADD+= devstat xo .include Modified: head/usr.bin/nfsstat/nfsstat.1 ============================================================================== --- head/usr.bin/nfsstat/nfsstat.1 Tue Jan 30 04:50:23 2018 (r328587) +++ head/usr.bin/nfsstat/nfsstat.1 Tue Jan 30 09:59:52 2018 (r328588) @@ -28,7 +28,7 @@ .\" From: @(#)nfsstat.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd November 23, 2016 +.Dd January 22, 2018 .Dt NFSSTAT 1 .Os .Sh NAME @@ -38,6 +38,7 @@ statistics .Sh SYNOPSIS .Nm +.Op Fl -libxo .Op Fl cdEemszW .Op Fl M Ar core .Op Fl N Ar system @@ -124,6 +125,15 @@ activity for both the client and server at second intervals. .It Fl z Reset statistics after displaying them. +.It Fl q +Do not print header +.It Fl -libxo +Generate output via +.Xr libxo 3 +in a selection of different human and machine readable formats. +See +.Xr xo_parse_args 3 +for details on command line arguments. .El .Sh FILES .Bl -tag -width ".Pa /boot/kernel/kernel" -compact Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Tue Jan 30 04:50:23 2018 (r328587) +++ head/usr.bin/nfsstat/nfsstat.c Tue Jan 30 09:59:52 2018 (r328588) @@ -101,6 +101,8 @@ static const char rcsid[] = #include #include +#include + static int widemode = 0; static int zflag = 0; static int printtitle = 1; @@ -112,8 +114,7 @@ static void printhdr(int, int, int); static void usage(void); static char *sperc1(int, int); static char *sperc2(int, int); -static void exp_intpr(int, int); -static void exp41_intpr(int, int); +static void exp_intpr(int, int, int); static void exp_sidewaysintpr(u_int, int, int, int); static void compute_new_stats(struct nfsstatsv1 *cur_stats, struct nfsstatsv1 *prev_stats, int curop, long double etime, @@ -140,6 +141,8 @@ static struct stattypes statstruct[] = { #define STAT_TYPE_TO_NFS(stat_type) statstruct[stat_type].nfs_type +#define NFSSTAT_XO_VERSION "1" + int main(int argc, char **argv) { @@ -156,7 +159,14 @@ main(int argc, char **argv) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "cdEesWM:mN:w:z")) != -1) + + argc = xo_parse_args(argc, argv); + if (argc < 0) + exit(1); + + xo_set_version(NFSSTAT_XO_VERSION); + + while ((ch = getopt(argc, argv, "cdEesWM:mN:w:zq")) != -1) switch(ch) { case 'M': memf = optarg; @@ -211,14 +221,17 @@ main(int argc, char **argv) break; case 'E': if (extra_output != 0) - errx(1, "-e and -E are mutually exclusive"); + xo_err(1, "-e and -E are mutually exclusive"); extra_output = 2; break; case 'e': if (extra_output != 0) - errx(1, "-e and -E are mutually exclusive"); + xo_err(1, "-e and -E are mutually exclusive"); extra_output = 1; break; + case 'q': + printtitle = 0; + break; case '?': default: usage(); @@ -238,19 +251,21 @@ main(int argc, char **argv) } #endif if (modfind("nfscommon") < 0) - errx(1, "NFS client/server not loaded"); + xo_err(1, "NFS client/server not loaded"); if (interval) { exp_sidewaysintpr(interval, clientOnly, serverOnly, newStats); } else { - if (extra_output == 2) - exp41_intpr(clientOnly, serverOnly); - else if (extra_output == 1) - exp_intpr(clientOnly, serverOnly); + xo_open_container("nfsstat"); + if (extra_output != 0) + exp_intpr(clientOnly, serverOnly, extra_output - 1); else intpr(clientOnly, serverOnly); + xo_close_container("nfsstat"); } + + xo_finish(); exit(0); } @@ -271,14 +286,24 @@ intpr(int clientOnly, int serverOnly) } ext_nfsstats.vers = NFSSTATS_V1; if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0) - err(1, "Can't get stats"); + xo_err(1, "Can't get stats"); if (clientOnly) { - printf("Client Info:\n"); - printf("Rpc Counts:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Getattr", "Setattr", "Lookup", "Readlink", "Read", - "Write", "Create", "Remove"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", + xo_open_container("clientstats"); + + if (printtitle) + xo_emit("{T:Client Info:\n"); + + xo_open_container("operations"); + xo_emit("{T:Rpc Counts:}\n"); + + xo_emit("{T:Getattr/%13.13s}{T:Setattr/%13.13s}" + "{T:Lookup/%13.13s}{T:Readlink/%13.13s}" + "{T:Read/%13.13s}{T:Write/%13.13s}" + "{T:Create/%13.13s}{T:Remove/%13.13s}\n"); + xo_emit("{:getattr/%13ju}{:setattr/%13ju}" + "{:lookup/%13ju}{:readlink/%13ju}" + "{:read/%13ju}{:write/%13ju}" + "{:create/%13ju}{:remove/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOOKUP], @@ -287,125 +312,188 @@ intpr(int clientOnly, int serverOnly) (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITE], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATE], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_REMOVE]); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Rename", "Link", "Symlink", "Mkdir", "Rmdir", - "Readdir", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS]); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit"); - printf("%9ju %9ju %9ju %9ju %9ju\n", + + xo_emit("{T:Rename/%13.13s}{T:Link/%13.13s}" + "{T:Symlink/%13.13s}{T:Mkdir/%13.13s}" + "{T:Rmdir/%13.13s}{T:Readdir/%13.13s}" + "{T:RdirPlus/%13.13s}{T:Access/%13.13s}\n"); + xo_emit("{:rename/%13ju}{:link/%13ju}" + "{:symlink/%13ju}{:mkdir/%13ju}" + "{:rmdir/%13ju}{:readdir/%13ju}" + "{:rdirplus/%13ju}{:access/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS]); + + xo_emit("{T:Mknod/%13.13s}{T:Fsstat/%13.13s}" + "{T:Fsinfo/%13.13s}{T:PathConf/%13.13s}" + "{T:Commit/%13.13s}\n"); + xo_emit("{:mknod/%13ju}{:fsstat/%13ju}" + "{:fsinfo/%13ju}{:pathconf/%13ju}" + "{:commit/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKNOD], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSSTAT], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSINFO], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PATHCONF], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMIT]); - printf("Rpc Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "TimedOut", "Invalid", "X Replies", "Retries", - "Requests"); - printf("%9ju %9ju %9ju %9ju %9ju\n", + + xo_close_container("operations"); + + xo_open_container("rpcs"); + xo_emit("{T:Rpc Info:}\n"); + + xo_emit("{T:TimedOut/%13.13s}{T:Invalid/%13.13s}" + "{T:X Replies/%13.13s}{T:Retries/%13.13s}" + "{T:Requests/%13.13s}\n"); + xo_emit("{:timedout/%13ju}{:invalid/%13ju}" + "{:xreplies/%13ju}{:retries/%13ju}" + "{:requests/%13ju}\n", (uintmax_t)ext_nfsstats.rpctimeouts, (uintmax_t)ext_nfsstats.rpcinvalid, (uintmax_t)ext_nfsstats.rpcunexpected, (uintmax_t)ext_nfsstats.rpcretries, (uintmax_t)ext_nfsstats.rpcrequests); - printf("Cache Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s", - "Attr Hits", "Misses", "Lkup Hits", "Misses"); - printf(" %9.9s %9.9s %9.9s %9.9s\n", - "BioR Hits", "Misses", "BioW Hits", "Misses"); - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)ext_nfsstats.attrcache_hits, - (uintmax_t)ext_nfsstats.attrcache_misses, - (uintmax_t)ext_nfsstats.lookupcache_hits, - (uintmax_t)ext_nfsstats.lookupcache_misses); - printf(" %9ju %9ju %9ju %9ju\n", - (uintmax_t)(ext_nfsstats.biocache_reads - - ext_nfsstats.read_bios), - (uintmax_t)ext_nfsstats.read_bios, - (uintmax_t)(ext_nfsstats.biocache_writes - - ext_nfsstats.write_bios), - (uintmax_t)ext_nfsstats.write_bios); - printf("%9.9s %9.9s %9.9s %9.9s", - "BioRLHits", "Misses", "BioD Hits", "Misses"); - printf(" %9.9s %9.9s %9.9s %9.9s\n", "DirE Hits", "Misses", "Accs Hits", "Misses"); - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)(ext_nfsstats.biocache_readlinks - - ext_nfsstats.readlink_bios), - (uintmax_t)ext_nfsstats.readlink_bios, - (uintmax_t)(ext_nfsstats.biocache_readdirs - - ext_nfsstats.readdir_bios), - (uintmax_t)ext_nfsstats.readdir_bios); - printf(" %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.direofcache_hits, - (uintmax_t)ext_nfsstats.direofcache_misses, - (uintmax_t)ext_nfsstats.accesscache_hits, - (uintmax_t)ext_nfsstats.accesscache_misses); + xo_close_container("rpcs"); + + xo_open_container("cache"); + xo_emit("{T:Cache Info:}\n"); + + xo_emit("{T:Attr Hits/%13.13s}{T:Attr Misses/%13.13s}" + "{T:Lkup Hits/%13.13s}{T:Lkup Misses/%13.13s}" + "{T:BioR Hits/%13.13s}{T:BioR Misses/%13.13s}" + "{T:BioW Hits/%13.13s}{T:BioW Misses/%13.13s}\n"); + xo_emit("{:attrhits/%13ju}{:attrmisses/%13ju}" + "{:lkuphits/%13ju}{:lkupmisses/%13ju}" + "{:biorhits/%13ju}{:biormisses/%13ju}" + "{:biowhits/%13ju}{:biowmisses/%13ju}\n", + (uintmax_t)ext_nfsstats.attrcache_hits, + (uintmax_t)ext_nfsstats.attrcache_misses, + (uintmax_t)ext_nfsstats.lookupcache_hits, + (uintmax_t)ext_nfsstats.lookupcache_misses, + (uintmax_t)(ext_nfsstats.biocache_reads - + ext_nfsstats.read_bios), + (uintmax_t)ext_nfsstats.read_bios, + (uintmax_t)(ext_nfsstats.biocache_writes - + ext_nfsstats.write_bios), + (uintmax_t)ext_nfsstats.write_bios); + + xo_emit("{T:BioRL Hits/%13.13s}{T:BioRL Misses/%13.13s}" + "{T:BioD Hits/%13.13s}{T:BioD Misses/%13.13s}" + "{T:DirE Hits/%13.13s}{T:DirE Misses/%13.13s}" + "{T:Accs Hits/%13.13s}{T:Accs Misses/%13.13s}\n"); + xo_emit("{:biosrlhits/%13ju}{:biorlmisses/%13ju}" + "{:biodhits/%13ju}{:biodmisses/%13ju}" + "{:direhits/%13ju}{:diremisses/%13ju}" + "{:accshits/%13ju}{:accsmisses/%13ju}\n", + (uintmax_t)(ext_nfsstats.biocache_readlinks - + ext_nfsstats.readlink_bios), + (uintmax_t)ext_nfsstats.readlink_bios, + (uintmax_t)(ext_nfsstats.biocache_readdirs - + ext_nfsstats.readdir_bios), + (uintmax_t)ext_nfsstats.readdir_bios, + (uintmax_t)ext_nfsstats.direofcache_hits, + (uintmax_t)ext_nfsstats.direofcache_misses, + (uintmax_t)ext_nfsstats.accesscache_hits, + (uintmax_t)ext_nfsstats.accesscache_misses); + + xo_close_container("cache"); + + xo_close_container("clientstats"); } if (serverOnly) { - printf("\nServer Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Getattr", "Setattr", "Lookup", "Readlink", "Read", - "Write", "Create", "Remove"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READ], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CREATE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Rename", "Link", "Symlink", "Mkdir", "Rmdir", - "Readdir", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENAME], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit"); - printf("%9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT]); - printf("Server Ret-Failed\n"); - printf("%17ju\n", (uintmax_t)ext_nfsstats.srvrpc_errs); - printf("Server Faults\n"); - printf("%13ju\n", (uintmax_t)ext_nfsstats.srv_errs); - printf("Server Cache Stats:\n"); - printf("%9.9s %9.9s %9.9s %9.9s\n", - "Inprog", "Idem", "Non-idem", "Misses"); - printf("%9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvcache_inproghits, - (uintmax_t)ext_nfsstats.srvcache_idemdonehits, - (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, - (uintmax_t)ext_nfsstats.srvcache_misses); - printf("Server Write Gathering:\n"); - printf("%9.9s %9.9s %9.9s\n", - "WriteOps", "WriteRPC", "Opsaved"); + xo_open_container("serverstats"); + + xo_emit("{T:Server Info:}\n"); + xo_open_container("operations"); + + xo_emit("{T:Getattr/%13.13s}{T:Setattr/%13.13s}" + "{T:Lookup/%13.13s}{T:Readlink/%13.13s}" + "{T:Read/%13.13s}{T:Write/%13.13s}" + "{T:Create/%13.13s}{T:Remove/%13.13s}\n"); + xo_emit("{:getattr/%13ju}{:setattr/%13ju}" + "{:lookup/%13ju}{:readlink/%13ju}" + "{:read/%13ju}{:write/%13ju}" + "{:create/%13ju}{:remove/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READLINK], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READ], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CREATE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]); + + xo_emit("{T:Rename/%13.13s}{T:Link/%13.13s}" + "{T:Symlink/%13.13s}{T:Mkdir/%13.13s}" + "{T:Rmdir/%13.13s}{T:Readdir/%13.13s}" + "{T:RdirPlus/%13.13s}{T:Access/%13.13s}\n"); + xo_emit("{:rename/%13ju}{:link/%13ju}" + "{:symlink/%13ju}{:mkdir/%13ju}" + "{:rmdir/%13ju}{:readdir/%13ju}" + "{:rdirplus/%13ju}{:access/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENAME], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LINK], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]); + + xo_emit("{T:Mknod/%13.13s}{T:Fsstat/%13.13s}" + "{T:Fsinfo/%13.13s}{T:PathConf/%13.13s}" + "{T:Commit/%13.13s}\n"); + xo_emit("{:mknod/%13ju}{:fsstat/%13ju}" + "{:fsinfo/%13ju}{:pathconf/%13ju}" + "{:commit/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT]); + + xo_close_container("operations"); + + xo_open_container("server"); + xo_emit("{T:Server Re-Failed:}\n"); + xo_emit("{T:retfailed/%17ju}\n", (uintmax_t)ext_nfsstats.srvrpc_errs); + + xo_emit("{T:Server Faults:}\n"); + xo_emit("{T:faults/%13ju}\n", (uintmax_t)ext_nfsstats.srv_errs); + + xo_emit("{T:Server Write Gathering:/%13.13s}\n"); + + xo_emit("{T:WriteOps/%13.13s}{T:WriteRPC/%13.13s}" + "{T:Opsaved/%13.13s}\n"); + xo_emit("{:writeops/%13ju}{:writerpc/%13ju}" + "{:opsaved/%13ju}\n", /* * The new client doesn't do write gathering. It was * only useful for NFSv2. */ - printf("%9ju %9ju %9d\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], 0); + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], 0); + + xo_close_container("server"); + + xo_open_container("cache"); + xo_emit("{T:Server Cache Stats:/%13.13s}\n"); + xo_emit("{T:Inprog/%13.13s}{T:Idem/%13.13s}" + "{T:Non-Idem/%13.13s}{T:Misses/%13.13s}\n"); + xo_emit("{:inprog/%13ju}{:idem/%13ju}" + "{:nonidem/%13ju}{:misses/%13ju}\n", + (uintmax_t)ext_nfsstats.srvcache_inproghits, + (uintmax_t)ext_nfsstats.srvcache_idemdonehits, + (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, + (uintmax_t)ext_nfsstats.srvcache_misses); + xo_close_container("cache"); + + xo_close_container("serverstats"); } } @@ -550,270 +638,16 @@ compute_new_stats(struct nfsstatsv1 *cur_stats, } /* - * Print a description of the nfs stats for the experimental client/server. - */ -static void -exp_intpr(int clientOnly, int serverOnly) -{ - int nfssvc_flag; - - nfssvc_flag = NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT; - if (zflag != 0) { - if (clientOnly != 0) - nfssvc_flag |= NFSSVC_ZEROCLTSTATS; - if (serverOnly != 0) - nfssvc_flag |= NFSSVC_ZEROSRVSTATS; - } - ext_nfsstats.vers = NFSSTATS_V1; - if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0) - err(1, "Can't get stats"); - if (clientOnly != 0) { - if (printtitle) { - printf("Client Info:\n"); - printf("Rpc Counts:\n"); - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Getattr", "Setattr", "Lookup", "Readlink", - "Read", "Write", "Create", "Remove"); - } - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETATTR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETATTR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOOKUP], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READLINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READ], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITE], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATE], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_REMOVE]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Rename", "Link", "Symlink", "Mkdir", "Rmdir", - "Readdir", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Mknod", "Fsstat", "Fsinfo", "PathConf", - "Commit", "SetClId", "SetClIdCf", "Lock"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKNOD], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSSTAT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSINFO], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PATHCONF], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMIT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTID], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTIDCFRM], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCK]); - if (printtitle) - printf("%9.9s %9.9s %9.9s %9.9s\n", - "LockT", "LockU", "Open", "OpenCfr"); - printf("%9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKU], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPEN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "OpenOwner", "Opens", "LockOwner", - "Locks", "Delegs", "LocalOwn", - "LocalOpen", "LocalLOwn"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.clopenowners, - (uintmax_t)ext_nfsstats.clopens, - (uintmax_t)ext_nfsstats.cllockowners, - (uintmax_t)ext_nfsstats.cllocks, - (uintmax_t)ext_nfsstats.cldelegates, - (uintmax_t)ext_nfsstats.cllocalopenowners, - (uintmax_t)ext_nfsstats.cllocalopens, - (uintmax_t)ext_nfsstats.cllocallockowners); - if (printtitle) - printf("%9.9s\n", "LocalLock"); - printf("%9ju\n", (uintmax_t)ext_nfsstats.cllocallocks); - if (printtitle) { - printf("Rpc Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "TimedOut", "Invalid", "X Replies", "Retries", - "Requests"); - } - printf("%9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpctimeouts, - (uintmax_t)ext_nfsstats.rpcinvalid, - (uintmax_t)ext_nfsstats.rpcunexpected, - (uintmax_t)ext_nfsstats.rpcretries, - (uintmax_t)ext_nfsstats.rpcrequests); - if (printtitle) { - printf("Cache Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s", - "Attr Hits", "Misses", "Lkup Hits", "Misses"); - printf(" %9.9s %9.9s %9.9s %9.9s\n", - "BioR Hits", "Misses", "BioW Hits", "Misses"); - } - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)ext_nfsstats.attrcache_hits, - (uintmax_t)ext_nfsstats.attrcache_misses, - (uintmax_t)ext_nfsstats.lookupcache_hits, - (uintmax_t)ext_nfsstats.lookupcache_misses); - printf(" %9ju %9ju %9ju %9ju\n", - (uintmax_t)(ext_nfsstats.biocache_reads - - ext_nfsstats.read_bios), - (uintmax_t)ext_nfsstats.read_bios, - (uintmax_t)(ext_nfsstats.biocache_writes - - ext_nfsstats.write_bios), - (uintmax_t)ext_nfsstats.write_bios); - if (printtitle) { - printf("%9.9s %9.9s %9.9s %9.9s", - "BioRLHits", "Misses", "BioD Hits", "Misses"); - printf(" %9.9s %9.9s\n", "DirE Hits", "Misses"); - } - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)(ext_nfsstats.biocache_readlinks - - ext_nfsstats.readlink_bios), - (uintmax_t)ext_nfsstats.readlink_bios, - (uintmax_t)(ext_nfsstats.biocache_readdirs - - ext_nfsstats.readdir_bios), - (uintmax_t)ext_nfsstats.readdir_bios); - printf(" %9ju %9ju\n", - (uintmax_t)ext_nfsstats.direofcache_hits, - (uintmax_t)ext_nfsstats.direofcache_misses); - } - if (serverOnly != 0) { - if (printtitle) { - printf("\nServer Info:\n"); - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Getattr", "Setattr", "Lookup", "Readlink", - "Read", "Write", "Create", "Remove"); - } - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READ], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_V3CREATE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Rename", "Link", "Symlink", "Mkdir", "Rmdir", - "Readdir", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENAME], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Mknod", "Fsstat", "Fsinfo", "PathConf", - "Commit", "LookupP", "SetClId", "SetClIdCf"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUPP], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTID], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTIDCFRM]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Open", "OpenAttr", "OpenDwnGr", "OpenCfrm", - "DelePurge", "DeleRet", "GetFH", "Lock"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPEN], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPENATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPENDOWNGRADE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPENCONFIRM], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_DELEGPURGE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_DELEGRETURN], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOCK]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "LockT", "LockU", "Close", "Verify", "NVerify", - "PutFH", "PutPubFH", "PutRootFH"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOCKT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOCKU], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CLOSE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_VERIFY], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_NVERIFY], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PUTFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PUTPUBFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PUTROOTFH]); - if (printtitle) - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Renew", "RestoreFH", "SaveFH", "Secinfo", - "RelLckOwn", "V4Create"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENEW], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RESTOREFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SAVEFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SECINFO], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RELEASELCKOWN], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CREATE]); - if (printtitle) { - printf("Server:\n"); - printf("%9.9s %9.9s %9.9s\n", - "Retfailed", "Faults", "Clients"); - } - printf("%9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srv_errs, - (uintmax_t)ext_nfsstats.srvrpc_errs, - (uintmax_t)ext_nfsstats.srvclients); - if (printtitle) - printf("%9.9s %9.9s %9.9s %9.9s %9.9s \n", - "OpenOwner", "Opens", "LockOwner", - "Locks", "Delegs"); - printf("%9ju %9ju %9ju %9ju %9ju \n", - (uintmax_t)ext_nfsstats.srvopenowners, - (uintmax_t)ext_nfsstats.srvopens, - (uintmax_t)ext_nfsstats.srvlockowners, - (uintmax_t)ext_nfsstats.srvlocks, - (uintmax_t)ext_nfsstats.srvdelegates); - if (printtitle) { - printf("Server Cache Stats:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Inprog", "Idem", "Non-idem", "Misses", - "CacheSize", "TCPPeak"); - } - printf("%9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvcache_inproghits, - (uintmax_t)ext_nfsstats.srvcache_idemdonehits, - (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, - (uintmax_t)ext_nfsstats.srvcache_misses, - (uintmax_t)ext_nfsstats.srvcache_size, - (uintmax_t)ext_nfsstats.srvcache_tcppeak); - } -} - -/* * Print a description of the nfs stats for the client/server, * including NFSv4.1. */ static void -exp41_intpr(int clientOnly, int serverOnly) +exp_intpr(int clientOnly, int serverOnly, int nfs41) { int nfssvc_flag; + xo_open_container("nfsv4"); + nfssvc_flag = NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT; if (zflag != 0) { if (clientOnly != 0) @@ -823,349 +657,387 @@ exp41_intpr(int clientOnly, int serverOnly) } ext_nfsstats.vers = NFSSTATS_V1; if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0) - err(1, "Can't get stats"); + xo_err(1, "Can't get stats"); if (clientOnly != 0) { + xo_open_container("clientstats"); + + xo_open_container("operations"); if (printtitle) { - printf("Client Info:\n"); - printf("RPC Counts:\n"); - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Getattr", "Setattr", "Lookup", "Readlink", "Read", - "Write"); + xo_emit("{T:Client Info:}\n"); + xo_emit("{T:RPC Counts:}\n"); } - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:Getattr/%13.13s}{T:Setattr/%13.13s}" + "{T:Lookup/%13.13s}{T:Readlink/%13.13s}" + "{T:Read/%13.13s}{T:Write/%13.13s}\n"); + xo_emit("{:getattr/%13ju}{:setattr/%13ju}{:lookup/%13ju}" + "{:readlink/%13ju}{:read/%13ju}{:write/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOOKUP], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READLINK], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READ], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITE]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Create", "Remove", "Rename", "Link", "Symlink", - "Mkdir"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:Create/%13.13s}{T:Remove/%13.13s}" + "{T:Rename/%13.13s}{T:Link/%13.13s}" + "{T:Symlink/%13.13s}{T:Mkdir/%13.13s}\n"); + xo_emit("{:create/%13ju}{:remove/%13ju}{:rename/%13ju}" + "{:link/%13ju}{:symlink/%13ju}{:mkdir/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATE], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_REMOVE], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Rmdir", "Readdir", "RdirPlus", "Access", "Mknod", - "Fsstat"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:Rmdir/%13.13s}{T:Readdir/%13.13s}" + "{T:RdirPlus/%13.13s}{T:Access/%13.13s}" + "{T:Mknod/%13.13s}{T:Fsstat/%13.13s}\n"); + xo_emit("{:rmdir/%13ju}{:readdir/%13ju}{:rdirplus/%13ju}" + "{:access/%13ju}{:mknod/%13ju}{:fsstat/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKNOD], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSSTAT]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Fsinfo", "PathConf", "Commit", "SetClId", - "SetClIdCf", "Lock"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:FSinfo/%13.13s}{T:pathConf/%13.13s}" + "{T:Commit/%13.13s}{T:SetClId/%13.13s}" + "{T:SetClIdCf/%13.13s}{T:Lock/%13.13s}\n"); + xo_emit("{:fsinfo/%13ju}{:pathconf/%13ju}{:commit/%13ju}" + "{:setclientid/%13ju}{:setclientidcf/%13ju}{:lock/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSINFO], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PATHCONF], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMIT], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTID], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTIDCFRM], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCK]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "LockT", "LockU", "Open", "OpenCfr", "OpenDownGr", - "Close"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:LockT/%13.13s}{T:LockU/%13.13s}" + "{T:Open/%13.13s}{T:OpenCfr/%13.13s}\n"); + xo_emit("{:lockt/%13ju}{:locku/%13ju}" + "{:open/%13ju}{:opencfr/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKT], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKU], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPEN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENDOWNGRADE], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CLOSE]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "RelLckOwn", "FreeStateID", "PutRootFH", "DelegRet", - "GetACL", "SetACL"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RELEASELCKOWN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FREESTATEID], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PUTROOTFH], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DELEGRETURN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETACL], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETACL]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "ExchangeID", "CreateSess", "DestroySess", - "DestroyClId", "LayoutGet", "GetDevInfo"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_EXCHANGEID], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATESESSION], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYSESSION], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYCLIENT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTGET], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETDEVICEINFO]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "LayoutCommit", "LayoutReturn", "ReclaimCompl", - "ReadDataS", "WriteDataS", "CommitDataS"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTCOMMIT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTRETURN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RECLAIMCOMPL], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITEDS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMITDS]); - if (printtitle) - printf( - "%12.12s %12.12s\n", - "OpenLayout", "CreateLayout"); - printf("%12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENLAYGET], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATELAYGET]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "OpenOwner", "Opens", "LockOwner", "Locks", - "Delegs", "LocalOwn"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM]); + + if (nfs41) { + xo_open_container("nfsv41"); + + xo_emit("{T:OpenDownGr/%13.13s}{T:Close/%13.13s}\n"); + xo_emit("{:opendowngr/%13ju}{:close/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENDOWNGRADE], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CLOSE]); + + xo_emit("{T:RelLckOwn/%13.13s}{T:FreeStateID/%13.13s}" + "{T:PutRootFH/%13.13s}{T:DelegRet/%13.13s}" + "{T:GetAcl/%13.13s}{T:SetAcl/%13.13s}\n"); + xo_emit("{:rellckown/%13ju}{:freestateid/%13ju}" + "{:getacl/%13ju}{:delegret/%13ju}" + "{:getacl/%13ju}{:setacl/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RELEASELCKOWN], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FREESTATEID], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PUTROOTFH], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DELEGRETURN], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETACL], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETACL]); + + xo_emit("{T:ExchangeId/%13.13s}{T:CreateSess/%13.13s}" + "{T:DestroySess/%13.13s}{T:DestroyClId/%13.13s}" + "{T:LayoutGet/%13.13s}{T:GetDevInfo/%13.13s}\n"); + xo_emit("{:exchangeid/%13ju}{:createsess/%13ju}" + "{:destroysess/%13ju}{:destroyclid/%13ju}" + "{:layoutget/%13ju}{:getdevinfo/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_EXCHANGEID], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATESESSION], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYSESSION], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYCLIENT], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTGET], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETDEVICEINFO]); + + xo_emit("{T:LayoutCommit/%13.13s}{T:LayoutReturn/%13.13s}" + "{T:ReclaimCompl/%13.13s}{T:ReadDataS/%13.13s}" + "{T:WriteDataS/%13.13s}{T:CommitDataS/%13.13s}\n"); + xo_emit("{:layoutcomit/%13ju}{:layoutreturn/%13ju}" + "{:reclaimcompl/%13ju}{:readdatas/%13ju}" + "{:writedatas/%13ju}{:commitdatas/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTCOMMIT], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTRETURN], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RECLAIMCOMPL], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDS], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITEDS], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMITDS]); + + xo_emit("{T:OpenLayout/%13.13s}{T:CreateLayout/%13.13s}\n"); + xo_emit("{:openlayout/%13ju}{:createlayout/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENLAYGET], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATELAYGET]); + + xo_close_container("nfsv41"); + } + xo_close_container("operations"); + + xo_open_container("client"); + xo_emit("{T:OpenOwner/%13.13s}{T:Opens/%13.13s}" + "{T:LockOwner/%13.13s}{T:Locks/%13.13s}" + "{T:Delegs/%13.13s}{T:LocalOwn/%13.13s}\n"); + xo_emit("{:openowner/%13ju}{:opens/%13ju}" + "{:lockowner/%13ju}{:locks/%13ju}" + "{:delegs/%13ju}{:localown/%13ju}\n", (uintmax_t)ext_nfsstats.clopenowners, (uintmax_t)ext_nfsstats.clopens, (uintmax_t)ext_nfsstats.cllockowners, (uintmax_t)ext_nfsstats.cllocks, (uintmax_t)ext_nfsstats.cldelegates, (uintmax_t)ext_nfsstats.cllocalopenowners); - if (printtitle) - printf("%12.12s %12.12s %12.12s\n", - "LocalOpen", "LocalLOwn", "LocalLock"); - printf("%12ju %12ju %12ju\n", + + xo_emit("{T:LocalOpen/%13.13s}{T:LocalLown/%13.13s}" + "{T:LocalLock\n"); + xo_emit("{:localopen/%13ju}{:locallown/%13ju}" + "{:locallock/%13ju}\n", (uintmax_t)ext_nfsstats.cllocalopens, (uintmax_t)ext_nfsstats.cllocallockowners, (uintmax_t)ext_nfsstats.cllocallocks); - if (printtitle) { - printf("Rpc Info:\n"); - printf("%12.12s %12.12s %12.12s %12.12s %12.12s\n", - "TimedOut", "Invalid", "X Replies", "Retries", - "Requests"); - } - printf("%12ju %12ju %12ju %12ju %12ju\n", + xo_close_container("client"); + + xo_open_container("rpc"); + if (printtitle) + xo_emit("{T:Rpc Info:}\n"); + xo_emit("{T:TimedOut/%13.13s}{T:Invalid/%13.13s}" + "{T:X Replies/%13.13s}{T:Retries/%13.13s}" + "{T:Requests/%13.13s}\n"); + xo_emit("{:timedout/%13ju}{:invalid/%13ju}" + "{:xreplies/%13ju}{:retries/%13ju}" + "{:requests/%13ju}\n", (uintmax_t)ext_nfsstats.rpctimeouts, (uintmax_t)ext_nfsstats.rpcinvalid, (uintmax_t)ext_nfsstats.rpcunexpected, (uintmax_t)ext_nfsstats.rpcretries, (uintmax_t)ext_nfsstats.rpcrequests); - if (printtitle) { - printf("Cache Info:\n"); - printf("%12.12s %12.12s %12.12s %12.12s\n", - "Attr Hits", "Misses", "Lkup Hits", "Misses"); - } - printf("%12ju %12ju %12ju %12ju\n", + xo_close_container("rpc"); + + xo_open_container("cache"); + if (printtitle) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jan 30 10:08:12 2018 Return-Path: Delivered-To: svn-src-all@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 C098EEE5FC3; Tue, 30 Jan 2018 10:08:12 +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 640B38535E; Tue, 30 Jan 2018 10:08:12 +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 501A115CA2; Tue, 30 Jan 2018 10:08:12 +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 w0UA8CM6074437; Tue, 30 Jan 2018 10:08:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UA8CYd074436; Tue, 30 Jan 2018 10:08:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801301008.w0UA8CYd074436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 30 Jan 2018 10:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328589 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 328589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 10:08:13 -0000 Author: trasz Date: Tue Jan 30 10:08:11 2018 New Revision: 328589 URL: https://svnweb.freebsd.org/changeset/base/328589 Log: Make the handler routine for the hw.usb.template sysctl trigger the USB host to reprobe the bus by switching the USB pull up resistors off and back on. In other words - when FreeBSD is configured as a USB device, changing the sysctl will be immediately noticed by the machine it's connected to. Reviewed by: hselasky@ MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Tue Jan 30 09:59:52 2018 (r328588) +++ head/sys/dev/usb/usb_device.c Tue Jan 30 10:08:11 2018 (r328589) @@ -87,6 +87,7 @@ /* function prototypes */ +static int sysctl_hw_usb_template(SYSCTL_HANDLER_ARGS); static void usb_init_endpoint(struct usb_device *, uint8_t, struct usb_endpoint_descriptor *, struct usb_endpoint_ss_comp_descriptor *, @@ -120,8 +121,137 @@ int usb_template = USB_TEMPLATE; int usb_template; #endif -SYSCTL_INT(_hw_usb, OID_AUTO, template, CTLFLAG_RWTUN, - &usb_template, 0, "Selected USB device side template"); +SYSCTL_PROC(_hw_usb, OID_AUTO, template, + CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + NULL, 0, sysctl_hw_usb_template, + "I", "Selected USB device side template"); + +/*------------------------------------------------------------------------* + * usb_trigger_reprobe_on_off + * + * This function sets the pull up resistors for all ports currently + * operating in device mode either on (when on_not_off is 1), or off + * (when it's 0). + *------------------------------------------------------------------------*/ +static void +usb_trigger_reprobe_on_off(int on_not_off) +{ + struct usb_port_status ps; + struct usb_bus *bus; + struct usb_device *udev; + usb_error_t err; + int do_unlock, max; + + max = devclass_get_maxunit(usb_devclass_ptr); + while (max >= 0) { + mtx_lock(&usb_ref_lock); + bus = devclass_get_softc(usb_devclass_ptr, max); + max--; + + if (bus == NULL || bus->devices == NULL || + bus->devices[USB_ROOT_HUB_ADDR] == NULL) { + mtx_unlock(&usb_ref_lock); + continue; + } + + udev = bus->devices[USB_ROOT_HUB_ADDR]; + + if (udev->refcount == USB_DEV_REF_MAX) { + mtx_unlock(&usb_ref_lock); + continue; + } + + udev->refcount++; + mtx_unlock(&usb_ref_lock); + + do_unlock = usbd_enum_lock(udev); + if (do_unlock > 1) { + do_unlock = 0; + goto next; + } + + err = usbd_req_get_port_status(udev, NULL, &ps, 1); + if (err != 0) { + DPRINTF("usbd_req_get_port_status() " + "failed: %s\n", usbd_errstr(err)); + goto next; + } + + if ((UGETW(ps.wPortStatus) & UPS_PORT_MODE_DEVICE) == 0) + goto next; + + if (on_not_off) { + err = usbd_req_set_port_feature(udev, NULL, 1, + UHF_PORT_POWER); + if (err != 0) { + DPRINTF("usbd_req_set_port_feature() " + "failed: %s\n", usbd_errstr(err)); + } + } else { + err = usbd_req_clear_port_feature(udev, NULL, 1, + UHF_PORT_POWER); + if (err != 0) { + DPRINTF("usbd_req_clear_port_feature() " + "failed: %s\n", usbd_errstr(err)); + } + } + +next: + mtx_lock(&usb_ref_lock); + if (do_unlock) + usbd_enum_unlock(udev); + if (--(udev->refcount) == 0) + cv_broadcast(&udev->ref_cv); + mtx_unlock(&usb_ref_lock); + } +} + +/*------------------------------------------------------------------------* + * usb_trigger_reprobe_all + * + * This function toggles the pull up resistors for all ports currently + * operating in device mode, causing the host machine to reenumerate them. + *------------------------------------------------------------------------*/ +static void +usb_trigger_reprobe_all(void) +{ + + /* + * Set the pull up resistors off for all ports in device mode. + */ + usb_trigger_reprobe_on_off(0); + + /* + * According to the DWC OTG spec this must be at least 3ms. + */ + usb_pause_mtx(NULL, USB_MS_TO_TICKS(USB_POWER_DOWN_TIME)); + + /* + * Set the pull up resistors back on. + */ + usb_trigger_reprobe_on_off(1); +} + +static int +sysctl_hw_usb_template(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = usb_template; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL || usb_template == val) + return (error); + + usb_template = val; + + if (usb_template < 0) { + usb_trigger_reprobe_on_off(0); + } else { + usb_trigger_reprobe_all(); + } + + return (0); +} /* English is default language */ From owner-svn-src-all@freebsd.org Tue Jan 30 10:10:03 2018 Return-Path: Delivered-To: svn-src-all@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 6AE9BEB717F; Tue, 30 Jan 2018 10:10:03 +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 1E34C856AF; Tue, 30 Jan 2018 10:10:03 +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 1928B15CA7; Tue, 30 Jan 2018 10:10:03 +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 w0UAA27k074572; Tue, 30 Jan 2018 10:10:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UAA2nk074571; Tue, 30 Jan 2018 10:10:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801301010.w0UAA2nk074571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 30 Jan 2018 10:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328590 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 328590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 10:10:03 -0000 Author: trasz Date: Tue Jan 30 10:10:02 2018 New Revision: 328590 URL: https://svnweb.freebsd.org/changeset/base/328590 Log: Document the new hw.usb.template behaviour. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/usb_template.4 Modified: head/share/man/man4/usb_template.4 ============================================================================== --- head/share/man/man4/usb_template.4 Tue Jan 30 10:08:11 2018 (r328589) +++ head/share/man/man4/usb_template.4 Tue Jan 30 10:10:02 2018 (r328590) @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 8, 2016 +.Dd January 30, 2018 .Dt USB_TEMPLATE 4 .Os . @@ -66,9 +66,11 @@ or by using the .Xr usbconfig 8 .Cm set_template subcommand. -The sysctl values can be changed at any time, but will not -have any effect until the USB device has been re-enumerated. -. +Changing the +.Va hw.usb.template +sysctl triggers reenumeration by the USB host; changes to other sysctls +may not be visible to the host until reenumeration is performed. +.Pp Available templates are: .Bl -column -offset 3n "Value" .It Em Value Ta Em Description @@ -93,6 +95,7 @@ tunables: .Bl -tag -width indent .It Va hw.usb.template Currently selected template. +Set to -1 to make the device disappear from the USB host point of view. .It Va hw.usb.templates.N Configuration for template number .Va N . From owner-svn-src-all@freebsd.org Tue Jan 30 10:15:50 2018 Return-Path: Delivered-To: svn-src-all@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 E6ED9EB76AC; Tue, 30 Jan 2018 10:15:49 +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 81A2885B54; Tue, 30 Jan 2018 10:15:49 +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 3E54527396; Tue, 30 Jan 2018 10:15:42 +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 w0UAFQTo005766 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Jan 2018 10:15:26 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0UAFQln005765; Tue, 30 Jan 2018 10:15:26 GMT (envelope-from phk) To: Emmanuel Vadot cc: Oleksandr Tymoshenko , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180130105812.d1de09e0d4ac88934d776c71@bidouilliste.com> From: "Poul-Henning Kamp" References: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> <33452.1517233531@critter.freebsd.dk> <20180130025048.GA76676@bluezbox.com> <90452.1517301074@critter.freebsd.dk> <20180130094251.GA85100@bluezbox.com> <64381.1517305677@critter.freebsd.dk> <20180130105812.d1de09e0d4ac88934d776c71@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5763.1517307326.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Tue, 30 Jan 2018 10:15:26 +0000 Message-ID: <5764.1517307326@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 10:15:50 -0000 -------- In message <20180130105812.d1de09e0d4ac88934d776c71@bidouilliste.com>, Emm= anuel Vadot writes: >On Tue, 30 Jan 2018 09:47:57 +0000 > I don't think that we want to load it by default as it would mean that >some GPIO are now unusable as they are pwm pins now. So the essential architectural question seems to be: Can we load the pwm overlay by default, but still use the PWM-pins for something else until/if the pwm driver is kldloaded ? If not, we're right back to FreeBSD 1.x semantics again. -- = 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-all@freebsd.org Tue Jan 30 10:22:39 2018 Return-Path: Delivered-To: svn-src-all@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 3C721EB7C13; Tue, 30 Jan 2018 10:22:39 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6766986066; Tue, 30 Jan 2018 10:22:38 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 5d63ed4e; Tue, 30 Jan 2018 11:22:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=TUxUziclsbRTZTCLe6lgZav/7Zc=; b=TRW4cXvCuVB+efCtrUWGBVprAhCv rzHt2sAgpetCQ3nZ3XY0rtCeAqiqqeK3AHCpijzmo2nCdOhcXFP8wFImnh1Xd9uP 8KPCs+TtDZzkjozLRcjLvWxnc8lxV6EkFPqx2w4AEa1rd9v2Hg8OAp5sxmGvNee5 ums+PE8mN/QZI7M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=gj5EcAPMWX+UbVccrmzpMQhxqoHybP3HOvf2CoEDGXMi86bMqbd1PNwb v6yi2nYMRHAWhGGDOuAiESzQahMEtkksmCKQu3APNn4Y+hM+4BmlisURicF1q8lb lvLFPAU59VYe48AjWSk6jmmb4SHu6Xs8ipAAWF68Y8m21UKTHDA= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 73cbf5af TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 30 Jan 2018 11:22:36 +0100 (CET) Date: Tue, 30 Jan 2018 11:22:33 +0100 From: Emmanuel Vadot To: "Poul-Henning Kamp" Cc: Oleksandr Tymoshenko , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180130112233.ff840e66af9d52a00ab748bc@bidouilliste.com> In-Reply-To: <5764.1517307326@critter.freebsd.dk> References: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org> <13025.1517179897@critter.freebsd.dk> <20180129063950.GA59901@bluezbox.com> <32793.1517221534@critter.freebsd.dk> <20180129132736.GA66330@bluezbox.com> <33452.1517233531@critter.freebsd.dk> <20180130025048.GA76676@bluezbox.com> <90452.1517301074@critter.freebsd.dk> <20180130094251.GA85100@bluezbox.com> <64381.1517305677@critter.freebsd.dk> <20180130105812.d1de09e0d4ac88934d776c71@bidouilliste.com> <5764.1517307326@critter.freebsd.dk> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 10:22:39 -0000 On Tue, 30 Jan 2018 10:15:26 +0000 "Poul-Henning Kamp" wrote: > -------- > In message <20180130105812.d1de09e0d4ac88934d776c71@bidouilliste.com>, Emmanuel > Vadot writes: > >On Tue, 30 Jan 2018 09:47:57 +0000 > > > I don't think that we want to load it by default as it would mean that > >some GPIO are now unusable as they are pwm pins now. > > So the essential architectural question seems to be: > > Can we load the pwm overlay by default, but still use the > PWM-pins for something else until/if the pwm driver is kldloaded ? I guess that with gpioctl(1) one could turn back the pins as gpios and use them, but if one do that loading the pwm driver will not turn them back to the pwm function. The objection I have to load automatically the pwm overlay on RPI is why should we do it for this subsystem on this board and not for any other subsystem on any other board ? > If not, we're right back to FreeBSD 1.x semantics again. > > -- > 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. -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Jan 30 12:38:07 2018 Return-Path: Delivered-To: svn-src-all@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 09357EC7BE4; Tue, 30 Jan 2018 12:38:07 +0000 (UTC) (envelope-from hselasky@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 ADD4B6AA76; Tue, 30 Jan 2018 12:38:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A840D1750A; Tue, 30 Jan 2018 12:38:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UCc6mC049001; Tue, 30 Jan 2018 12:38:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UCc6Pf049000; Tue, 30 Jan 2018 12:38:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801301238.w0UCc6Pf049000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 30 Jan 2018 12:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328591 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 328591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 12:38:07 -0000 Author: hselasky Date: Tue Jan 30 12:38:06 2018 New Revision: 328591 URL: https://svnweb.freebsd.org/changeset/base/328591 Log: Move the mlx5 core device pointer first in the mlx5en priv. This help simplify checks to recognize own network devices when using mlx5ib. This patch fixes an issues where mlx5ib fails to recognize mceX network devices for use with RoCE. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Tue Jan 30 10:10:02 2018 (r328590) +++ head/sys/dev/mlx5/mlx5_en/en.h Tue Jan 30 12:38:06 2018 (r328591) @@ -661,6 +661,8 @@ struct mlx5e_clbr_point { }; struct mlx5e_priv { + struct mlx5_core_dev *mdev; /* must be first */ + /* priv data path fields - start */ int order_base_2_num_channels; int queue_mapping_channel_mask; @@ -698,7 +700,6 @@ struct mlx5e_priv { struct work_struct set_rx_mode_work; MLX5_DECLARE_DOORBELL_LOCK(doorbell_lock) - struct mlx5_core_dev *mdev; struct ifnet *ifp; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_ifnet; From owner-svn-src-all@freebsd.org Tue Jan 30 15:53:11 2018 Return-Path: Delivered-To: svn-src-all@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 D4411ED22D1; Tue, 30 Jan 2018 15:53:10 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (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 2D9E17318F; Tue, 30 Jan 2018 15:53:09 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id w0UFqtYK002799 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 30 Jan 2018 07:52:57 -0800 Subject: Re: svn commit: r328537 - in head/sys/powerpc: aim powernv To: Wojciech Macek Cc: Wojciech Macek , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Patryk Duda References: <201801290927.w0T9R2ot008700@repo.freebsd.org> <2b1dc9be-493e-57fb-d012-0af52dc7475b@freebsd.org> From: Nathan Whitehorn Message-ID: <1aeae6a0-dcc6-0c67-7ce0-30aadb02dc72@freebsd.org> Date: Tue, 30 Jan 2018 07:52:55 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVZnH4f/7MuLS1F3N4qQcK8vHl+Sfu8hOkERX7n8tDFtbYnZn8C0l/r9la3Me6c6X900xbplHaDKkAkZRWQ1Lp4rpirFtFsfi48= X-Sonic-ID: C;oNkso9UF6BGjUxtCsE207w== M;7GIppNUF6BGjUxtCsE207w== X-Spam-Flag: No X-Sonic-Spam-Details: 1.6/5.0 by cerberusd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 15:53:11 -0000 On 01/30/18 01:04, Wojciech Macek wrote: > The LPCR register must be set very early. The best is to do it in > cpudep_bootstrap as this is the first function being run on the AP > after start. > As soon as the AP completes pmap_cpu_bootstrap, we must guarantee that > DSI exceptions are working fine. We can't do this with LPCR set > incorrectly, this it contains a base addres of an exception table. Hmm, yes. I had forgotten this ran after pmap_cpu_bootstrap(). Thanks for the explanation! > The code from powernv_smp_ap_init was moved to attach, as we don't set > LPCR twice during AP startup - it's not an error of course, but I like > to have this in one place only. > > I can revert this patch if you insist, but to fix non-powernv boards > we can just add "if (mfmsr() & PSL_HV)" check to early_bootstrap. What > do you think? Let's just add the PSL_HV check. We could add another platform_early() method, but I don't see much point in it here. -Nathan > > Regards, > Wojtek > > 2018-01-29 16:46 GMT+01:00 Nathan Whitehorn >: > > Can you explain why this is necessary? Both functions are run in > the same context and this way of doing things breaks important > abstraction barriers. > > Since it also breaks booting on pHyp systems, I would appreciate > it if you could revert this pending review. > -Nathan > > > On 01/29/18 01:27, Wojciech Macek wrote: > > Author: wma > Date: Mon Jan 29 09:27:02 2018 > New Revision: 328537 > URL: https://svnweb.freebsd.org/changeset/base/328537 > > > Log: >    PowerNV: move LPCR and LPID altering to > cpudep_ap_early_bootstrap >       It turns out that under some circumstances we can get > DSI or DSE before we set >    LPCR and LPID so we should set it as early as possible. >       Authored by:           Patryk Duda > >    Submitted by:          Wojciech Macek > >    Obtained from:         Semihalf >    Sponsored by:          IBM, QCM Technologies > > Modified: >    head/sys/powerpc/aim/mp_cpudep.c >    head/sys/powerpc/powernv/platform_powernv.c > > Modified: head/sys/powerpc/aim/mp_cpudep.c > ============================================================================== > --- head/sys/powerpc/aim/mp_cpudep.c    Mon Jan 29 09:24:28 > 2018        (r328536) > +++ head/sys/powerpc/aim/mp_cpudep.c    Mon Jan 29 09:27:02 > 2018        (r328537) > @@ -64,9 +64,6 @@ cpudep_ap_early_bootstrap(void) >         register_t reg; >   #endif >   -     __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); > -       powerpc_sync(); > - >         switch (mfpvr() >> 16) { >         case IBM970: >         case IBM970FX: > @@ -86,7 +83,20 @@ cpudep_ap_early_bootstrap(void) >   #endif >                 powerpc_sync(); >                 break; > +       case IBMPOWER8: > +       case IBMPOWER8E: > +               isync(); > +               /* Direct interrupts to SRR instead of HSRR > and reset LPCR otherwise */ > +               mtspr(SPR_LPID, 0); > +               isync(); > + > +               mtspr(SPR_LPCR, LPCR_LPES); > +               isync(); > +               break; >         } > + > +       __asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu)); > +       powerpc_sync(); >   } >     uintptr_t > > Modified: head/sys/powerpc/powernv/platform_powernv.c > ============================================================================== > --- head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 > 09:24:28 2018        (r328536) > +++ head/sys/powerpc/powernv/platform_powernv.c Mon Jan 29 > 09:27:02 2018        (r328537) > @@ -128,6 +128,7 @@ powernv_attach(platform_t plat) >         pcell_t prop; >         phandle_t cpu; >         int res, len, node, idx; > +       register_t msr; >         /* Ping OPAL again just to make sure */ >         opal_check(); > @@ -141,6 +142,19 @@ powernv_attach(platform_t plat) >         cpu_idle_hook = powernv_cpu_idle; >         powernv_boot_pir = mfspr(SPR_PIR); >   +     /* LPID must not be altered when PSL_DR or PSL_IR is > set */ > +       msr = mfmsr(); > +       mtmsr(msr & ~(PSL_DR | PSL_IR)); > + > +       /* Direct interrupts to SRR instead of HSRR and reset > LPCR otherwise */ > +       mtspr(SPR_LPID, 0); > +       isync(); > + > +       mtmsr(msr); > + > +       mtspr(SPR_LPCR, LPCR_LPES); > +       isync(); > + >         /* Init CPU bits */ >         powernv_smp_ap_init(plat); >   @@ -444,21 +458,6 @@ powernv_reset(platform_t platform) >   static void >   powernv_smp_ap_init(platform_t platform) >   { > -       register_t msr; > - > -       /* LPID must not be altered when PSL_DR or PSL_IR is > set */ > -       msr = mfmsr(); > -       mtmsr(msr & ~(PSL_DR | PSL_IR)); > - > -       isync(); > -       /* Direct interrupts to SRR instead of HSRR and reset > LPCR otherwise */ > -       mtspr(SPR_LPID, 0); > -       isync(); > - > -       mtmsr(msr); > - > -       mtspr(SPR_LPCR, LPCR_LPES); > -       isync(); >   } >     static void > > > From owner-svn-src-all@freebsd.org Tue Jan 30 16:34:57 2018 Return-Path: Delivered-To: svn-src-all@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 25E01ED428D; Tue, 30 Jan 2018 16:34:57 +0000 (UTC) (envelope-from swills@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 C822E74BD3; Tue, 30 Jan 2018 16:34:56 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C30AA19B65; Tue, 30 Jan 2018 16:34:56 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UGYuRA070902; Tue, 30 Jan 2018 16:34:56 GMT (envelope-from swills@FreeBSD.org) Received: (from swills@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UGYur2070901; Tue, 30 Jan 2018 16:34:56 GMT (envelope-from swills@FreeBSD.org) Message-Id: <201801301634.w0UGYur2070901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: swills set sender to swills@FreeBSD.org using -f From: Steve Wills Date: Tue, 30 Jan 2018 16:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328593 - head/release/scripts X-SVN-Group: head X-SVN-Commit-Author: swills X-SVN-Commit-Paths: head/release/scripts X-SVN-Commit-Revision: 328593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 16:34:57 -0000 Author: swills (ports committer) Date: Tue Jan 30 16:34:56 2018 New Revision: 328593 URL: https://svnweb.freebsd.org/changeset/base/328593 Log: Change installer default to not install ports tree Reviewed by: gjb, dteske, allanjude, bdrewery, mat Approved by: gjb Differential Revision: https://reviews.freebsd.org/D14064 Modified: head/release/scripts/make-manifest.sh Modified: head/release/scripts/make-manifest.sh ============================================================================== --- head/release/scripts/make-manifest.sh Tue Jan 30 16:24:15 2018 (r328592) +++ head/release/scripts/make-manifest.sh Tue Jan 30 16:34:56 2018 (r328593) @@ -32,6 +32,7 @@ desc_tests="${tests}" default_doc=off default_src=off +default_ports=off default_tests=off default_base_dbg=off default_lib32_dbg=off From owner-svn-src-all@freebsd.org Tue Jan 30 16:41:39 2018 Return-Path: Delivered-To: svn-src-all@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 2ACE4ED4B15; Tue, 30 Jan 2018 16:41:39 +0000 (UTC) (envelope-from emaste@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 CA8E375470; Tue, 30 Jan 2018 16:41:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C45B219BCC; Tue, 30 Jan 2018 16:41:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UGfcKS073357; Tue, 30 Jan 2018 16:41:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UGfcG6073352; Tue, 30 Jan 2018 16:41:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801301641.w0UGfcG6073352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 Jan 2018 16:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328594 - in head/contrib/llvm: include/llvm/MC lib/MC X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/contrib/llvm: include/llvm/MC lib/MC X-SVN-Commit-Revision: 328594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 16:41:39 -0000 Author: emaste Date: Tue Jan 30 16:41:38 2018 New Revision: 328594 URL: https://svnweb.freebsd.org/changeset/base/328594 Log: Pull in r322108 from upstream llvm trunk (by Rafael Espíndola): Make one of the emitFill methods non virtual. NFC. This is just preparatory work to fix [LLVM] PR35858. Modified: head/contrib/llvm/include/llvm/MC/MCObjectStreamer.h head/contrib/llvm/include/llvm/MC/MCStreamer.h head/contrib/llvm/lib/MC/MCAsmStreamer.cpp head/contrib/llvm/lib/MC/MCObjectStreamer.cpp head/contrib/llvm/lib/MC/MCStreamer.cpp Modified: head/contrib/llvm/include/llvm/MC/MCObjectStreamer.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCObjectStreamer.h Tue Jan 30 16:34:56 2018 (r328593) +++ head/contrib/llvm/include/llvm/MC/MCObjectStreamer.h Tue Jan 30 16:41:38 2018 (r328594) @@ -161,7 +161,6 @@ class MCObjectStreamer : public MCStreamer { (public) bool EmitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc) override; using MCStreamer::emitFill; - void emitFill(uint64_t NumBytes, uint8_t FillValue) override; void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc = SMLoc()) override; void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr, Modified: head/contrib/llvm/include/llvm/MC/MCStreamer.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCStreamer.h Tue Jan 30 16:34:56 2018 (r328593) +++ head/contrib/llvm/include/llvm/MC/MCStreamer.h Tue Jan 30 16:41:38 2018 (r328594) @@ -662,7 +662,7 @@ class MCStreamer { (public) /// \brief Emit NumBytes bytes worth of the value specified by FillValue. /// This implements directives such as '.space'. - virtual void emitFill(uint64_t NumBytes, uint8_t FillValue); + void emitFill(uint64_t NumBytes, uint8_t FillValue); /// \brief Emit \p Size bytes worth of the value specified by \p FillValue. /// Modified: head/contrib/llvm/lib/MC/MCAsmStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCAsmStreamer.cpp Tue Jan 30 16:34:56 2018 (r328593) +++ head/contrib/llvm/lib/MC/MCAsmStreamer.cpp Tue Jan 30 16:41:38 2018 (r328594) @@ -192,9 +192,6 @@ class MCAsmStreamer final : public MCStreamer { (publi void EmitGPRel32Value(const MCExpr *Value) override; - - void emitFill(uint64_t NumBytes, uint8_t FillValue) override; - void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc = SMLoc()) override; @@ -965,17 +962,12 @@ void MCAsmStreamer::EmitGPRel32Value(const MCExpr *Val EmitEOL(); } -/// emitFill - Emit NumBytes bytes worth of the value specified by -/// FillValue. This implements directives such as '.space'. -void MCAsmStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - if (NumBytes == 0) return; - - const MCExpr *E = MCConstantExpr::create(NumBytes, getContext()); - emitFill(*E, FillValue); -} - void MCAsmStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) { + int64_t IntNumBytes; + if (NumBytes.evaluateAsAbsolute(IntNumBytes) && IntNumBytes == 0) + return; + if (const char *ZeroDirective = MAI->getZeroDirective()) { // FIXME: Emit location directives OS << ZeroDirective; Modified: head/contrib/llvm/lib/MC/MCObjectStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCObjectStreamer.cpp Tue Jan 30 16:34:56 2018 (r328593) +++ head/contrib/llvm/lib/MC/MCObjectStreamer.cpp Tue Jan 30 16:41:38 2018 (r328594) @@ -577,11 +577,6 @@ bool MCObjectStreamer::EmitRelocDirective(const MCExpr return false; } -void MCObjectStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - assert(getCurrentSectionOnly() && "need a section"); - insert(new MCFillFragment(FillValue, NumBytes)); -} - void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) { MCDataFragment *DF = getOrCreateDataFragment(); @@ -593,12 +588,13 @@ void MCObjectStreamer::emitFill(const MCExpr &NumBytes return; } - if (IntNumBytes <= 0) { + if (IntNumBytes < 0) { getContext().reportError(Loc, "invalid number of bytes"); return; } - emitFill(IntNumBytes, FillValue); + assert(getCurrentSectionOnly() && "need a section"); + insert(new MCFillFragment(FillValue, IntNumBytes)); } void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size, Modified: head/contrib/llvm/lib/MC/MCStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCStreamer.cpp Tue Jan 30 16:34:56 2018 (r328593) +++ head/contrib/llvm/lib/MC/MCStreamer.cpp Tue Jan 30 16:41:38 2018 (r328594) @@ -184,8 +184,7 @@ void MCStreamer::EmitGPRel32Value(const MCExpr *Value) /// Emit NumBytes bytes worth of the value specified by FillValue. /// This implements directives such as '.space'. void MCStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - for (uint64_t i = 0, e = NumBytes; i != e; ++i) - EmitIntValue(FillValue, 1); + emitFill(*MCConstantExpr::create(NumBytes, getContext()), FillValue); } void MCStreamer::emitFill(uint64_t NumValues, int64_t Size, int64_t Expr) { From owner-svn-src-all@freebsd.org Tue Jan 30 16:42:09 2018 Return-Path: Delivered-To: svn-src-all@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 707A1ED4BDE; Tue, 30 Jan 2018 16:42:09 +0000 (UTC) (envelope-from emaste@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 257C575620; Tue, 30 Jan 2018 16:42:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2071C19BF1; Tue, 30 Jan 2018 16:42:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UGg9Gc074881; Tue, 30 Jan 2018 16:42:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UGg8KU074879; Tue, 30 Jan 2018 16:42:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801301642.w0UGg8KU074879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 Jan 2018 16:42:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328595 - head/contrib/llvm/lib/MC X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/lib/MC X-SVN-Commit-Revision: 328595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 16:42:09 -0000 Author: emaste Date: Tue Jan 30 16:42:08 2018 New Revision: 328595 URL: https://svnweb.freebsd.org/changeset/base/328595 Log: Pull in r322123 from upstream llvm trunk (by Rafael Espíndola): Don't create MCFillFragment directly. Instead use higher level APIs that take care of most bookkeeping. Modified: head/contrib/llvm/lib/MC/MCMachOStreamer.cpp head/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp Modified: head/contrib/llvm/lib/MC/MCMachOStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCMachOStreamer.cpp Tue Jan 30 16:41:38 2018 (r328594) +++ head/contrib/llvm/lib/MC/MCMachOStreamer.cpp Tue Jan 30 16:42:08 2018 (r328595) @@ -411,29 +411,19 @@ void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol * void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) { - getAssembler().registerSection(*Section); - - // The symbol may not be present, which only creates the section. - if (!Symbol) - return; - // On darwin all virtual sections have zerofill type. assert(Section->isVirtualSection() && "Section does not have zerofill type!"); - assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); + PushSection(); + SwitchSection(Section); - getAssembler().registerSymbol(*Symbol); - - // Emit an align fragment if necessary. - if (ByteAlignment != 1) - new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section); - - MCFragment *F = new MCFillFragment(0, Size, Section); - Symbol->setFragment(F); - - // Update the maximum alignment on the zero fill section if necessary. - if (ByteAlignment > Section->getAlignment()) - Section->setAlignment(ByteAlignment); + // The symbol may not be present, which only creates the section. + if (Symbol) { + EmitValueToAlignment(ByteAlignment, 0, 1, 0); + EmitLabel(Symbol); + EmitZeros(Size); + } + PopSection(); } // This should always be called with the thread local bss section. Like the Modified: head/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp Tue Jan 30 16:41:38 2018 (r328594) +++ head/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp Tue Jan 30 16:42:08 2018 (r328595) @@ -257,20 +257,13 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol auto *Symbol = cast(S); MCSection *Section = getContext().getObjectFileInfo()->getBSSSection(); - getAssembler().registerSection(*Section); - if (Section->getAlignment() < ByteAlignment) - Section->setAlignment(ByteAlignment); - - getAssembler().registerSymbol(*Symbol); + PushSection(); + SwitchSection(Section); + EmitValueToAlignment(ByteAlignment, 0, 1, 0); + EmitLabel(Symbol); Symbol->setExternal(false); - - if (ByteAlignment != 1) - new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0, - ByteAlignment, Section); - - MCFillFragment *Fragment = new MCFillFragment( - /*Value=*/0, Size, Section); - Symbol->setFragment(Fragment); + EmitZeros(Size); + PopSection(); } void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, From owner-svn-src-all@freebsd.org Tue Jan 30 16:43:22 2018 Return-Path: Delivered-To: svn-src-all@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 D56F4ED4EA7; Tue, 30 Jan 2018 16:43:21 +0000 (UTC) (envelope-from emaste@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 87BFA75840; Tue, 30 Jan 2018 16:43:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82A7819D08; Tue, 30 Jan 2018 16:43:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UGhLn2075655; Tue, 30 Jan 2018 16:43:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UGhKR6075651; Tue, 30 Jan 2018 16:43:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801301643.w0UGhKR6075651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 Jan 2018 16:43:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328596 - in head/contrib/llvm: include/llvm/MC lib/MC X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/contrib/llvm: include/llvm/MC lib/MC X-SVN-Commit-Revision: 328596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 16:43:22 -0000 Author: emaste Date: Tue Jan 30 16:43:20 2018 New Revision: 328596 URL: https://svnweb.freebsd.org/changeset/base/328596 Log: Pull in r322131 from upstream llvm trunk (by Rafael Espíndola): Use a MCExpr for the size of MCFillFragment. This allows the size to be found during ralaxation. This fixes [LLVM] pr35858. Requested by: royger Modified: head/contrib/llvm/include/llvm/MC/MCFragment.h head/contrib/llvm/lib/MC/MCAssembler.cpp head/contrib/llvm/lib/MC/MCObjectStreamer.cpp head/contrib/llvm/lib/MC/WasmObjectWriter.cpp Modified: head/contrib/llvm/include/llvm/MC/MCFragment.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCFragment.h Tue Jan 30 16:42:08 2018 (r328595) +++ head/contrib/llvm/include/llvm/MC/MCFragment.h Tue Jan 30 16:43:20 2018 (r328596) @@ -422,14 +422,21 @@ class MCFillFragment : public MCFragment { uint8_t Value; /// The number of bytes to insert. - uint64_t Size; + const MCExpr &Size; + /// Source location of the directive that this fragment was created for. + SMLoc Loc; + public: - MCFillFragment(uint8_t Value, uint64_t Size, MCSection *Sec = nullptr) - : MCFragment(FT_Fill, false, 0, Sec), Value(Value), Size(Size) {} + MCFillFragment(uint8_t Value, const MCExpr &Size, SMLoc Loc, + MCSection *Sec = nullptr) + : MCFragment(FT_Fill, false, 0, Sec), Value(Value), Size(Size), Loc(Loc) { + } uint8_t getValue() const { return Value; } - uint64_t getSize() const { return Size; } + const MCExpr &getSize() const { return Size; } + + SMLoc getLoc() const { return Loc; } static bool classof(const MCFragment *F) { return F->getKind() == MCFragment::FT_Fill; Modified: head/contrib/llvm/lib/MC/MCAssembler.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCAssembler.cpp Tue Jan 30 16:42:08 2018 (r328595) +++ head/contrib/llvm/lib/MC/MCAssembler.cpp Tue Jan 30 16:43:20 2018 (r328596) @@ -281,8 +281,18 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmL return cast(F).getContents().size(); case MCFragment::FT_CompactEncodedInst: return cast(F).getContents().size(); - case MCFragment::FT_Fill: - return cast(F).getSize(); + case MCFragment::FT_Fill: { + auto &FF = cast(F); + int64_t Size = 0; + if (!FF.getSize().evaluateAsAbsolute(Size, Layout)) + getContext().reportError(FF.getLoc(), + "expected assembly-time absolute expression"); + if (Size < 0) { + getContext().reportError(FF.getLoc(), "invalid number of bytes"); + return 0; + } + return Size; + } case MCFragment::FT_LEB: return cast(F).getContents().size(); @@ -540,7 +550,7 @@ static void writeFragment(const MCAssembler &Asm, cons for (unsigned I = 1; I < MaxChunkSize; ++I) Data[I] = Data[0]; - uint64_t Size = FF.getSize(); + uint64_t Size = FragmentSize; for (unsigned ChunkSize = MaxChunkSize; ChunkSize; ChunkSize /= 2) { StringRef Ref(Data, ChunkSize); for (uint64_t I = 0, E = Size / ChunkSize; I != E; ++I) Modified: head/contrib/llvm/lib/MC/MCObjectStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCObjectStreamer.cpp Tue Jan 30 16:42:08 2018 (r328595) +++ head/contrib/llvm/lib/MC/MCObjectStreamer.cpp Tue Jan 30 16:43:20 2018 (r328596) @@ -582,19 +582,8 @@ void MCObjectStreamer::emitFill(const MCExpr &NumBytes MCDataFragment *DF = getOrCreateDataFragment(); flushPendingLabels(DF, DF->getContents().size()); - int64_t IntNumBytes; - if (!NumBytes.evaluateAsAbsolute(IntNumBytes, getAssembler())) { - getContext().reportError(Loc, "expected absolute expression"); - return; - } - - if (IntNumBytes < 0) { - getContext().reportError(Loc, "invalid number of bytes"); - return; - } - assert(getCurrentSectionOnly() && "need a section"); - insert(new MCFillFragment(FillValue, IntNumBytes)); + insert(new MCFillFragment(FillValue, NumBytes, Loc)); } void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size, Modified: head/contrib/llvm/lib/MC/WasmObjectWriter.cpp ============================================================================== --- head/contrib/llvm/lib/MC/WasmObjectWriter.cpp Tue Jan 30 16:42:08 2018 (r328595) +++ head/contrib/llvm/lib/MC/WasmObjectWriter.cpp Tue Jan 30 16:43:20 2018 (r328596) @@ -528,7 +528,10 @@ static void addData(SmallVectorImpl &DataBytes, Align->getMaxBytesToEmit()); DataBytes.resize(Size, Value); } else if (auto *Fill = dyn_cast(&Frag)) { - DataBytes.insert(DataBytes.end(), Fill->getSize(), Fill->getValue()); + int64_t Size; + if (!Fill->getSize().evaluateAsAbsolute(Size)) + llvm_unreachable("The fill should be an assembler constant"); + DataBytes.insert(DataBytes.end(), Size, Fill->getValue()); } else { const auto &DataFrag = cast(Frag); const SmallVectorImpl &Contents = DataFrag.getContents(); From owner-svn-src-all@freebsd.org Tue Jan 30 18:13:03 2018 Return-Path: Delivered-To: svn-src-all@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 2AAD0ED9C51; Tue, 30 Jan 2018 18:13:03 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (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 AD24B79B75; Tue, 30 Jan 2018 18:13:02 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from helicon.physics.ucla.edu (helicon.physics.ucla.edu [169.232.156.253]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id w0UICxNW014536 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 30 Jan 2018 10:13:00 -0800 Subject: Re: svn commit: r328593 - head/release/scripts To: Steve Wills , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801301634.w0UGYur2070901@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <239eb049-ae34-781f-a2c8-0d47cf545e72@freebsd.org> Date: Tue, 30 Jan 2018 10:12:59 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801301634.w0UGYur2070901@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVbKVYHmP/Kd72Gpax5MP5EWlOaOsEZroz3bKDzzbPOA6ADpJzqI/IEgu2eQGgA/O4pLoivmQxLE78zRUlkym9pv3HjyztCUsyM= X-Sonic-ID: C;0BpdNOkF6BG5uxtCsE207w== M;6laYNOkF6BG5uxtCsE207w== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 18:13:03 -0000 Do we even want to include the ports tree on install media? Extracting ports from some out-of-date tarball doesn't seem to match best practices for ports and it takes up quite a lot of space. -Nathan On 01/30/18 08:34, Steve Wills wrote: > Author: swills (ports committer) > Date: Tue Jan 30 16:34:56 2018 > New Revision: 328593 > URL: https://svnweb.freebsd.org/changeset/base/328593 > > Log: > Change installer default to not install ports tree > > Reviewed by: gjb, dteske, allanjude, bdrewery, mat > Approved by: gjb > Differential Revision: https://reviews.freebsd.org/D14064 > > Modified: > head/release/scripts/make-manifest.sh > > Modified: head/release/scripts/make-manifest.sh > ============================================================================== > --- head/release/scripts/make-manifest.sh Tue Jan 30 16:24:15 2018 (r328592) > +++ head/release/scripts/make-manifest.sh Tue Jan 30 16:34:56 2018 (r328593) > @@ -32,6 +32,7 @@ desc_tests="${tests}" > > default_doc=off > default_src=off > +default_ports=off > default_tests=off > default_base_dbg=off > default_lib32_dbg=off > From owner-svn-src-all@freebsd.org Tue Jan 30 18:28:48 2018 Return-Path: Delivered-To: svn-src-all@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 E2C15EDAA58; Tue, 30 Jan 2018 18:28:47 +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 6741F7A618; Tue, 30 Jan 2018 18:28:46 +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 w0UIScGd026084; Tue, 30 Jan 2018 10:28:38 -0800 (PST) (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 w0UIScsT026083; Tue, 30 Jan 2018 10:28:38 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801301828.w0UIScsT026083@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r328593 - head/release/scripts In-Reply-To: <239eb049-ae34-781f-a2c8-0d47cf545e72@freebsd.org> To: Nathan Whitehorn Date: Tue, 30 Jan 2018 10:28:38 -0800 (PST) CC: Steve Wills , 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-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 18:28:48 -0000 > Do we even want to include the ports tree on install media? Extracting > ports from some out-of-date tarball doesn't seem to match best practices > for ports and it takes up quite a lot of space. > -Nathan Yes, you want to ship a known working known building and tested ports tree with the release, as there is no tag to pull this specific tree out of svn. I suppose it might be ok top stop putting it in the .iso's, but this tarball should remain avaliable with the distrubtion file sets on the ftp server. You may consider it "out of date" I consider it "known to build" and "probably working binaries". > On 01/30/18 08:34, Steve Wills wrote: > > Author: swills (ports committer) > > Date: Tue Jan 30 16:34:56 2018 > > New Revision: 328593 > > URL: https://svnweb.freebsd.org/changeset/base/328593 > > > > Log: > > Change installer default to not install ports tree > > > > Reviewed by: gjb, dteske, allanjude, bdrewery, mat > > Approved by: gjb > > Differential Revision: https://reviews.freebsd.org/D14064 > > > > Modified: > > head/release/scripts/make-manifest.sh > > > > Modified: head/release/scripts/make-manifest.sh > > ============================================================================== > > --- head/release/scripts/make-manifest.sh Tue Jan 30 16:24:15 2018 (r328592) > > +++ head/release/scripts/make-manifest.sh Tue Jan 30 16:34:56 2018 (r328593) > > @@ -32,6 +32,7 @@ desc_tests="${tests}" > > > > default_doc=off > > default_src=off > > +default_ports=off > > default_tests=off > > default_base_dbg=off > > default_lib32_dbg=off > > > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Jan 30 18:29:38 2018 Return-Path: Delivered-To: svn-src-all@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 9F600EDAAF9; Tue, 30 Jan 2018 18:29:38 +0000 (UTC) (envelope-from emaste@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 51E6F7A772; Tue, 30 Jan 2018 18:29:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CEF71AD51; Tue, 30 Jan 2018 18:29:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UITctH028031; Tue, 30 Jan 2018 18:29:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UITcRI028030; Tue, 30 Jan 2018 18:29:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801301829.w0UITcRI028030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 Jan 2018 18:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328598 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 18:29:38 -0000 Author: emaste Date: Tue Jan 30 18:29:38 2018 New Revision: 328598 URL: https://svnweb.freebsd.org/changeset/base/328598 Log: makesyscalls: permit a range of syscall numbers for UNIMPL Some ABIs have large gaps in syscall numbers. Allow gaps to be filled as ranges of UNIMPL, with an entry like: 248-1023 AUE_NULL UNIMPL unimplemented Reviewed by: jhb, gnn Sponsored by: Turing Robotic Industries Inc. Differential Revision: https://reviews.freebsd.org/D14122 Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Tue Jan 30 17:20:28 2018 (r328597) +++ head/sys/kern/makesyscalls.sh Tue Jan 30 18:29:38 2018 (r328598) @@ -254,13 +254,6 @@ sed -e ' print > systraceret next } - syscall != $1 { - printf "%s: line %d: syscall number out of sync at %d\n", - infile, NR, syscall - printf "line is:\n" - print - exit 1 - } # Returns true if the type "name" is the first flag in the type field function type(name, flags, n) { n = split($3, flags, /\|/) @@ -274,6 +267,29 @@ sed -e ' return 1 return 0 } + { + n = split($1, syscall_range, /-/) + if (n == 1) { + syscall_range[2] = syscall_range[1] + } else if (n == 2) { + if (!type("UNIMPL")) { + printf "%s: line %d: range permitted only with UNIMPL\n", + infile, NR + exit 1 + } + } else { + printf "%s: line %d: invalid syscall number or range %s\n", + infile, NR, $1 + exit 1 + } + } + syscall != syscall_range[1] { + printf "%s: line %d: syscall number out of sync at %d\n", + infile, NR, syscall + printf "line is:\n" + print + exit 1 + } function align_sysent_comment(column) { printf("\t") > sysent column = column + 8 - column % 8 @@ -614,11 +630,13 @@ sed -e ' next } type("UNIMPL") { - printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n", - syscall, comment) > sysent - printf("\t\"#%d\",\t\t\t/* %d = %s */\n", - syscall, syscall, comment) > sysnames - syscall++ + while (syscall <= syscall_range[2]) { + printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n", + syscall, comment) > sysent + printf("\t\"#%d\",\t\t\t/* %d = %s */\n", + syscall, syscall, comment) > sysnames + syscall++ + } next } { From owner-svn-src-all@freebsd.org Tue Jan 30 19:16:39 2018 Return-Path: Delivered-To: svn-src-all@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 47858EDD15B; Tue, 30 Jan 2018 19:16:39 +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 D91487C75E; Tue, 30 Jan 2018 19:16:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C52081B5D0; Tue, 30 Jan 2018 19:16:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UJGcBg054368; Tue, 30 Jan 2018 19:16:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UJGc18054366; Tue, 30 Jan 2018 19:16:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801301916.w0UJGc18054366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 30 Jan 2018 19:16:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328599 - stable/11/usr.sbin/service X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.sbin/service X-SVN-Commit-Revision: 328599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 19:16:39 -0000 Author: kevans Date: Tue Jan 30 19:16:38 2018 New Revision: 328599 URL: https://svnweb.freebsd.org/changeset/base/328599 Log: MFC r328032,r328060,r328243: service(8): Support services in jails MFC r328032: service(8): Add support for interfacing with services in jails Provide a -j option that can take a jail name or id. If -j is specified, check that the jail exists and proxy the service request through to service(8) in the jail. This allows for cleaner workflows when updating services in a jail, turning the following: pkg -j dns upgrade jexec dns service named restart into: pkg -j dns upgrade service -j dns named restart MFC r328060: service(8): Reset OPTIND properly now that we parse args twice r328032 introduced a second round of argument parsing to proxy the request through to a jail as needed, but failed to reset OPTIND before getting to the second round of parsing to allow other flags to be set. MFC r328243: usr.sbin/service: Fix -j to not be order dependant The introduced -j option is highly dependant on the ordering of arguments, and it exhibited broken behavior in some other circumstances. Fix these issues, and simplify the feature by removing the unneessary double parsing of options. PR: 223325 Modified: stable/11/usr.sbin/service/service.8 stable/11/usr.sbin/service/service.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/service/service.8 ============================================================================== --- stable/11/usr.sbin/service/service.8 Tue Jan 30 18:29:38 2018 (r328598) +++ stable/11/usr.sbin/service/service.8 Tue Jan 30 19:16:38 2018 (r328599) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2012 +.Dd January 15, 2018 .Dt SERVICE 8 .Os .Sh NAME @@ -32,13 +32,17 @@ .Nd "control (start/stop/etc.) or list system services" .Sh SYNOPSIS .Nm +.Op Fl j Ao jail name or id Ac .Fl e .Nm +.Op Fl j Ao jail name or id Ac .Fl R .Nm +.Op Fl j Ao jail name or id Ac .Op Fl v .Fl l | r .Nm +.Op Fl j Ao jail name or id Ac .Op Fl v .Ar start|stop|etc. .Sh DESCRIPTION @@ -54,6 +58,8 @@ the scripts using various criteria. .Pp The options are as follows: .Bl -tag -width F1 +.It Fl j Ao jail name or id Ac +Perform the given actions under the named jail. .It Fl e List services that are enabled. The list of scripts to check is compiled using @@ -107,6 +113,7 @@ The following are examples of typical usage of the command: .Pp .Dl "service named status" +.Dl "service -j dns named status" .Dl "service -rv" .Pp The following programmable completion entry can be use in Modified: stable/11/usr.sbin/service/service.sh ============================================================================== --- stable/11/usr.sbin/service/service.sh Tue Jan 30 18:29:38 2018 (r328598) +++ stable/11/usr.sbin/service/service.sh Tue Jan 30 19:16:38 2018 (r328599) @@ -32,12 +32,13 @@ load_rc_config 'XXX' usage () { echo '' echo 'Usage:' - echo "${0##*/} -e" - echo "${0##*/} -R" - echo "${0##*/} [-v] -l | -r" - echo "${0##*/} [-v] start|stop|etc." + echo "${0##*/} [-j ] -e" + echo "${0##*/} [-j ] -R" + echo "${0##*/} [-j ] [-v] -l | -r" + echo "${0##*/} [-j ] [-v] start|stop|etc." echo "${0##*/} -h" echo '' + echo "-j Perform actions within the named jail" echo '-e Show services that are enabled' echo "-R Stop and start enabled $local_startup services" echo "-l List all scripts in /etc/rc.d and $local_startup" @@ -46,8 +47,9 @@ usage () { echo '' } -while getopts 'ehlrRv' COMMAND_LINE_ARGUMENT ; do +while getopts 'j:ehlrRv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in + j) JAIL="${OPTARG}" ;; e) ENABLED=eopt ;; h) usage ; exit 0 ;; l) LIST=lopt ;; @@ -58,6 +60,22 @@ while getopts 'ehlrRv' COMMAND_LINE_ARGUMENT ; do esac done shift $(( $OPTIND - 1 )) + +if [ -n "${JAIL}" ]; then + # We need to rebuild the command line before passing it on. + # We do not send the -j argument into the jail. + args="" + [ -n "${ENABLED}" ] && args="${args} -e" + [ -n "${LIST}" ] && args="${args} -l" + [ -n "${RCORDER}" ] && args="${args} -r" + [ -n "${RESTART}" ] && args="${args} -R" + [ -n "${VERBOSE}" ] && args="${args} -v" + + # Call jexec(8) with the rebuild args and any positional args that + # were left in $@ + /usr/sbin/jexec -l "${JAIL}" /usr/sbin/service $args "$@" + exit $? +fi if [ -n "$RESTART" ]; then skip="-s nostart" From owner-svn-src-all@freebsd.org Tue Jan 30 19:21:00 2018 Return-Path: Delivered-To: svn-src-all@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 213D0EDD483; Tue, 30 Jan 2018 19:21:00 +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 C70177C9D7; Tue, 30 Jan 2018 19:20:59 +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 C1F7A1B600; Tue, 30 Jan 2018 19:20:59 +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 w0UJKxub055288; Tue, 30 Jan 2018 19:20:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UJKxIG055286; Tue, 30 Jan 2018 19:20:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801301920.w0UJKxIG055286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 30 Jan 2018 19:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328600 - in stable/11/etc: . mtree X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/etc: . mtree X-SVN-Commit-Revision: 328600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 19:21:00 -0000 Author: kevans Date: Tue Jan 30 19:20:59 2018 New Revision: 328600 URL: https://svnweb.freebsd.org/changeset/base/328600 Log: MFC r328287: Add /boot/overlays to runtime pkg, fix distrib-dirs METALOG /boot/overlays was recently added without belonging to a package. It's only used by bootloaders at the moment, so add it to the 'runtime' package to get added with ubldr and friends. Fix distrib-dirs METALOG generation while we're here. History elsewhere seems to indicate that bapt@ fixed this to pull in all attributes from mtrees while generating the METALOG. This fix got clobbered somewhere later, so restore it. Modified: stable/11/etc/Makefile stable/11/etc/mtree/BSD.root.dist Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/Makefile ============================================================================== --- stable/11/etc/Makefile Tue Jan 30 19:16:38 2018 (r328599) +++ stable/11/etc/Makefile Tue Jan 30 19:20:59 2018 (r328600) @@ -388,10 +388,10 @@ distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY d=${DISTBASE}$$d; \ shift; \ test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ - ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \ + ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ "sed s#^\.#.$$d# | ${METALOG.add}" ; \ ${MTREE_FILTER} $$m | \ - ${MTREE_CMD:N-W} -C -K uname,gname | sed s#^\.#.$$d# | \ + ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ ${METALOG.add} ; \ done; true .endif Modified: stable/11/etc/mtree/BSD.root.dist ============================================================================== --- stable/11/etc/mtree/BSD.root.dist Tue Jan 30 19:16:38 2018 (r328599) +++ stable/11/etc/mtree/BSD.root.dist Tue Jan 30 19:20:59 2018 (r328600) @@ -18,7 +18,7 @@ .. modules .. - overlays + overlays tags=package=runtime .. zfs .. From owner-svn-src-all@freebsd.org Tue Jan 30 19:31:38 2018 Return-Path: Delivered-To: svn-src-all@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 4B437EDDE7D; Tue, 30 Jan 2018 19:31: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 F29B27D0F2; Tue, 30 Jan 2018 19:31: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 D496D1B8F3; Tue, 30 Jan 2018 19:31: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 w0UJVb9h063284; Tue, 30 Jan 2018 19:31:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UJVb0k063283; Tue, 30 Jan 2018 19:31:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801301931.w0UJVb0k063283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 30 Jan 2018 19:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328601 - stable/11/sys/boot/fdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/boot/fdt X-SVN-Commit-Revision: 328601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 19:31:38 -0000 Author: kevans Date: Tue Jan 30 19:31:37 2018 New Revision: 328601 URL: https://svnweb.freebsd.org/changeset/base/328601 Log: MFC r328293: stand/fdt: Fallback to `name` + .dtbo if we fail to load `name` [This is a direct commit to stable/11 due to path restructuring in -HEAD; diffs have been applied to their old locations] This behavior also matches a Linux-ism by allowing fdt_overlays to specify names of overlays without an extension, e.g. fdt-overlays="sunxi-h3-h5-emac" If we fail to load the file given by a name in fdt_overlays, try again with ".dtbo" appended to it. This still allows overlays to lack .dtbo extension if user prefers it and just adds a fallback cushion. Future work could move this from a hard-coded ".dtbo" to a loader.conf(5) configuration option. Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Tue Jan 30 19:20:59 2018 (r328600) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Tue Jan 30 19:31:37 2018 (r328601) @@ -73,6 +73,7 @@ static size_t fdtp_size = 0; static vm_offset_t fdtp_va = 0; static int fdt_load_dtb(vm_offset_t va); +static void fdt_print_overlay_load_error(int err, const char *filename); static int fdt_cmd_nyi(int argc, char *argv[]); @@ -285,36 +286,57 @@ fdt_load_dtb_overlay(const char * filename) debugf("fdt_load_dtb_overlay(%s)\n", filename); - /* Attempt to load and validate a new dtb from a file. */ - if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) { - printf("failed to load file '%s'\n", filename); - return (1); - } + /* Attempt to load and validate a new dtb from a file. FDT_ERR_NOTFOUND + * is normally a libfdt error code, but libfdt would actually return + * -FDT_ERR_NOTFOUND. We re-purpose the error code here to convey a + * similar meaning: the file itself was not found, which can still be + * considered an error dealing with FDT pieces. + */ + if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) + return (FDT_ERR_NOTFOUND); COPYOUT(bfp->f_addr, &header, sizeof(header)); err = fdt_check_header(&header); if (err < 0) { file_discard(bfp); - if (err == -FDT_ERR_BADVERSION) - printf("incompatible blob version: %d, should be: %d\n", - fdt_version(fdtp), FDT_LAST_SUPPORTED_VERSION); - - else - printf("error validating blob: %s\n", - fdt_strerror(err)); - return (1); + return (err); } return (0); } +static void +fdt_print_overlay_load_error(int err, const char *filename) +{ + + switch (err) { + case FDT_ERR_NOTFOUND: + printf("%s: failed to load file\n", filename); + break; + case -FDT_ERR_BADVERSION: + printf("%s: incompatible blob version: %d, should be: %d\n", + filename, fdt_version(fdtp), + FDT_LAST_SUPPORTED_VERSION); + break; + default: + /* libfdt errs are negative */ + if (err < 0) + printf("%s: error validating blob: %s\n", + filename, fdt_strerror(err)); + else + printf("%s: unknown load error\n", filename); + break; + } +} + int fdt_load_dtb_overlays(const char * filenames) { char *names; - char *name; + char *name, *name_ext; char *comaptr; + int err, namesz; debugf("fdt_load_dtb_overlay(%s)\n", filenames); @@ -326,7 +348,23 @@ fdt_load_dtb_overlays(const char * filenames) comaptr = strchr(name, ','); if (comaptr) *comaptr = '\0'; - fdt_load_dtb_overlay(name); + err = fdt_load_dtb_overlay(name); + if (err == FDT_ERR_NOTFOUND) { + /* Allocate enough to append ".dtbo" */ + namesz = strlen(name) + 6; + name_ext = malloc(namesz); + if (name_ext == NULL) { + fdt_print_overlay_load_error(err, name); + name = comaptr + 1; + continue; + } + snprintf(name_ext, namesz, "%s.dtbo", name); + err = fdt_load_dtb_overlay(name_ext); + free(name_ext); + } + /* Catch error with either initial load or fallback load */ + if (err != 0) + fdt_print_overlay_load_error(err, name); name = comaptr + 1; } while(comaptr); From owner-svn-src-all@freebsd.org Tue Jan 30 19:34:59 2018 Return-Path: Delivered-To: svn-src-all@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 684FDEDE094; Tue, 30 Jan 2018 19:34:59 +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 173BF7D471; Tue, 30 Jan 2018 19:34:59 +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 EC34E1B94B; Tue, 30 Jan 2018 19:34:58 +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 w0UJYwHe064350; Tue, 30 Jan 2018 19:34:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UJYww7064349; Tue, 30 Jan 2018 19:34:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801301934.w0UJYww7064349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 30 Jan 2018 19:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328602 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 328602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 19:34:59 -0000 Author: kevans Date: Tue Jan 30 19:34:58 2018 New Revision: 328602 URL: https://svnweb.freebsd.org/changeset/base/328602 Log: Record only merge of r328293 r328293 was MFC'd effectively via direct commit as r328601; record the mergeinfo for it. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Tue Jan 30 20:00:13 2018 Return-Path: Delivered-To: svn-src-all@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 9FE65EDF47E; Tue, 30 Jan 2018 20:00:13 +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 51FE67E4FC; Tue, 30 Jan 2018 20:00:13 +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 4D1171BCA4; Tue, 30 Jan 2018 20:00:13 +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 w0UK0Dk9074654; Tue, 30 Jan 2018 20:00:13 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UK0Dcc074653; Tue, 30 Jan 2018 20:00:13 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201801302000.w0UK0Dcc074653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 30 Jan 2018 20:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328603 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 328603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 20:00:13 -0000 Author: sbruno Date: Tue Jan 30 20:00:12 2018 New Revision: 328603 URL: https://svnweb.freebsd.org/changeset/base/328603 Log: Add missing non-POWERPC case to give the scr value something non-zero. This fixes the instant reboot of netbooting after r328536 on x86 systems. Reviewed by: peter Sponsored by: Limelight Networks Modified: head/stand/common/load_elf.c Modified: head/stand/common/load_elf.c ============================================================================== --- head/stand/common/load_elf.c Tue Jan 30 19:34:58 2018 (r328602) +++ head/stand/common/load_elf.c Tue Jan 30 20:00:12 2018 (r328603) @@ -716,6 +716,8 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ #else scr = htobe32(size); #endif +#else + scr = size; #endif archsw.arch_copyin(&scr, lastaddr, sizeof(scr)); lastaddr += sizeof(scr); From owner-svn-src-all@freebsd.org Tue Jan 30 20:49:50 2018 Return-Path: Delivered-To: svn-src-all@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 154CDEE21EE; Tue, 30 Jan 2018 20:49:50 +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 BEDCE80AED; Tue, 30 Jan 2018 20:49:49 +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 B9C741C4A0; Tue, 30 Jan 2018 20:49:49 +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 w0UKnnr5099617; Tue, 30 Jan 2018 20:49:49 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UKnn70099614; Tue, 30 Jan 2018 20:49:49 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201801302049.w0UKnn70099614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Tue, 30 Jan 2018 20:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328604 - stable/11/sbin/fsck_ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/11/sbin/fsck_ffs X-SVN-Commit-Revision: 328604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 20:49:50 -0000 Author: dab Date: Tue Jan 30 20:49:49 2018 New Revision: 328604 URL: https://svnweb.freebsd.org/changeset/base/328604 Log: MFC r328013: Exit fsck_ffs with non-zero status when file system is not repaired. When the fsck_ffs program cannot fully repair a file system, it will output the message PLEASE RERUN FSCK. However, it does not exit with a non-zero status in this case (contradicting the man page claim that it "exits with 0 on success, and >0 if an error occurs." The fsck rc-script (when running "fsck -y") tests the status from fsck (which passes along the exit status from fsck_ffs) and issues a "stop_boot" if the status fails. However, this is not effective since fsck_ffs can return zero even on (some) errors. Effectively, it is left to a later step in the boot process when the file systems are mounted to detect the still-unclean file system and stop the boot. This change modifies fsck_ffs so that when it cannot fully repair the file system and issues the PLEASE RERUN FSCK message it also exits with a non-zero status. While here, the fsck_ffs man page has also been updated to document the failing exit status codes used by fsck_ffs. Previously, only exit status 7 was documented. Some of these exit statuses are tested for in the fsck rc-script, so they are clearly depended upon and deserve documentation. PR: 211485 Sponsored by: Dell EMC Modified: stable/11/sbin/fsck_ffs/fsck.h stable/11/sbin/fsck_ffs/fsck_ffs.8 stable/11/sbin/fsck_ffs/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/11/sbin/fsck_ffs/fsck.h Tue Jan 30 20:00:12 2018 (r328603) +++ stable/11/sbin/fsck_ffs/fsck.h Tue Jan 30 20:49:49 2018 (r328604) @@ -362,6 +362,7 @@ extern struct ufs2_dinode ufs2_zino; #define FOUND 0x10 #define EEXIT 8 /* Standard error exit. */ +#define ERERUN 16 /* fsck needs to be re-run. */ #define ERESTART -1 int flushentry(void); Modified: stable/11/sbin/fsck_ffs/fsck_ffs.8 ============================================================================== --- stable/11/sbin/fsck_ffs/fsck_ffs.8 Tue Jan 30 20:00:12 2018 (r328603) +++ stable/11/sbin/fsck_ffs/fsck_ffs.8 Tue Jan 30 20:49:49 2018 (r328604) @@ -29,7 +29,7 @@ .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 14, 2017 +.Dd January 13, 2018 .Dt FSCK_FFS 8 .Os .Sh NAME @@ -376,11 +376,43 @@ contains default list of file systems to check. .Sh EXIT STATUS .Ex -std .Pp -If the option +Specific non-zero exit status values used are: +.Bl -tag -width indent +.It 1 +Usage error (missing or invalid command arguments). +.It 2 +The +.Fl p +option was used and a +.Dv SIGQUIT +was received, indicating that the system should be returned to single +user mode after the file system check. +.It 3 +The file system superblock cannot be read. +This could indicate that the file system device does not exist or is not yet +ready. +.It 4 +A mounted file system was modified; the system should be rebooted. +.It 5 +The +.Fl B +option was used and soft updates are not enabled on the file system. +.It 6 +The +.Fl B +option was used and the kernel lacks needed support. +.It 7 +The .Fl F -is used, +option was used and the file system is clean. +.It 8 +General error exit. +.It 16 +The file system could not be completely repaired. +The file system may be able to be repaired by running .Nm -exits 7 if the file system is clean. +on the file system again. +.El .Sh DIAGNOSTICS The diagnostics produced by .Nm Modified: stable/11/sbin/fsck_ffs/main.c ============================================================================== --- stable/11/sbin/fsck_ffs/main.c Tue Jan 30 20:00:12 2018 (r328603) +++ stable/11/sbin/fsck_ffs/main.c Tue Jan 30 20:49:49 2018 (r328604) @@ -80,6 +80,7 @@ main(int argc, char *argv[]) int ch; struct rlimit rlimit; struct itimerval itimerval; + int fsret; int ret = 0; sync(); @@ -194,8 +195,9 @@ main(int argc, char *argv[]) (void)setrlimit(RLIMIT_DATA, &rlimit); } while (argc > 0) { - if (checkfilesys(*argv) == ERESTART) + if ((fsret = checkfilesys(*argv)) == ERESTART) continue; + ret |= fsret; argc--; argv++; } @@ -583,7 +585,7 @@ checkfilesys(char *filesys) sync(); return (4); } - return (0); + return (rerun ? ERERUN : 0); } static int From owner-svn-src-all@freebsd.org Tue Jan 30 21:25:43 2018 Return-Path: Delivered-To: svn-src-all@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 A682AEE433E; Tue, 30 Jan 2018 21:25: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 57DAD8251F; Tue, 30 Jan 2018 21:25: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 5268A1CB38; Tue, 30 Jan 2018 21:25: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 w0ULPhxs019593; Tue, 30 Jan 2018 21:25:43 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ULPhRN019592; Tue, 30 Jan 2018 21:25:43 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801302125.w0ULPhRN019592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 30 Jan 2018 21:25:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328605 - head/cddl/usr.sbin/zfsd X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/cddl/usr.sbin/zfsd X-SVN-Commit-Revision: 328605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 21:25:43 -0000 Author: asomers Date: Tue Jan 30 21:25:43 2018 New Revision: 328605 URL: https://svnweb.freebsd.org/changeset/base/328605 Log: zfsd: Don't spare a vdev that's being replaced If a zfs pool contains a replacing vdev (either created manually by "zpool replace" or by zfsd(8) via autoreplace by physical path) and then new spares get added to the pool, zfsd shouldn't use one to replace the drive that is already being replaced. That's a waste of resources that just slows down the rebuild. PR: 225547 MFC after: 3 weeks Sponsored by: Spectra Logic Corp Modified: head/cddl/usr.sbin/zfsd/case_file.cc Modified: head/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/case_file.cc Tue Jan 30 20:49:49 2018 (r328604) +++ head/cddl/usr.sbin/zfsd/case_file.cc Tue Jan 30 21:25:43 2018 (r328605) @@ -442,10 +442,38 @@ CaseFile::ReEvaluate(const ZfsEvent &event) return (consumed || closed); } +/* Find a Vdev containing the vdev with the given GUID */ +static nvlist_t* +find_parent(nvlist_t *pool_config, nvlist_t *config, DevdCtl::Guid child_guid) +{ + nvlist_t **vdevChildren; + int error; + unsigned ch, numChildren; + error = nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_CHILDREN, + &vdevChildren, &numChildren); + + if (error != 0 || numChildren == 0) + return (NULL); + + for (ch = 0; ch < numChildren; ch++) { + nvlist *result; + Vdev vdev(pool_config, vdevChildren[ch]); + + if (vdev.GUID() == child_guid) + return (config); + + result = find_parent(pool_config, vdevChildren[ch], child_guid); + if (result != NULL) + return (result); + } + + return (NULL); +} + bool CaseFile::ActivateSpare() { - nvlist_t *config, *nvroot; + nvlist_t *config, *nvroot, *parent_config; nvlist_t **spares; char *devPath, *vdev_type; const char *poolname; @@ -472,6 +500,22 @@ CaseFile::ActivateSpare() { "tree for pool %s", poolname); return (false); } + + parent_config = find_parent(config, nvroot, m_vdevGUID); + if (parent_config != NULL) { + char *parent_type; + + /* + * Don't activate spares for members of a "replacing" vdev. + * They're already dealt with. Sparing them will just drag out + * the resilver process. + */ + error = nvlist_lookup_string(parent_config, + ZPOOL_CONFIG_TYPE, &parent_type); + if (error == 0 && strcmp(parent_type, VDEV_TYPE_REPLACING) == 0) + return (false); + } + nspares = 0; nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES, &spares, &nspares); From owner-svn-src-all@freebsd.org Tue Jan 30 23:01:38 2018 Return-Path: Delivered-To: svn-src-all@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 332FDEC65B8; Tue, 30 Jan 2018 23:01:38 +0000 (UTC) (envelope-from jhb@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 DA5618682A; Tue, 30 Jan 2018 23:01:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D547A1DB3C; Tue, 30 Jan 2018 23:01:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UN1bDj066591; Tue, 30 Jan 2018 23:01:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UN1bdg066588; Tue, 30 Jan 2018 23:01:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801302301.w0UN1bdg066588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Jan 2018 23:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328608 - in head/sys: dev/cxgbe/tom netinet X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: dev/cxgbe/tom netinet X-SVN-Commit-Revision: 328608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 23:01:38 -0000 Author: jhb Date: Tue Jan 30 23:01:37 2018 New Revision: 328608 URL: https://svnweb.freebsd.org/changeset/base/328608 Log: Export tcp_always_keepalive for use by the Chelsio TOM module. This used to work by accident with ld.bfd even though always_keepalive was marked as static. LLD honors static more correctly, so export this variable properly (including moving it into the tcp_* namespace). Reviewed by: bz, emaste MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14129 Modified: head/sys/dev/cxgbe/tom/t4_tom.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_timer.h Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 30 21:34:34 2018 (r328607) +++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 30 23:01:37 2018 (r328608) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #define TCPSTATES #include +#include #include #include @@ -545,8 +546,6 @@ select_rcv_wscale(void) return (wscale); } -extern int always_keepalive; - /* * socket so could be a listening socket too. */ @@ -565,7 +564,7 @@ calc_opt0(struct socket *so, struct vi_info *vi, struc if (so != NULL) { struct inpcb *inp = sotoinpcb(so); struct tcpcb *tp = intotcpcb(inp); - int keepalive = always_keepalive || + int keepalive = tcp_always_keepalive || so_options_get(so) & SO_KEEPALIVE; opt0 |= V_NAGLE((tp->t_flags & TF_NODELAY) == 0); Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Tue Jan 30 21:34:34 2018 (r328607) +++ head/sys/netinet/tcp_timer.c Tue Jan 30 23:01:37 2018 (r328608) @@ -118,9 +118,9 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_slop, CTLT &tcp_rexmit_slop, 0, sysctl_msec_to_ticks, "I", "Retransmission Timer Slop"); -static int always_keepalive = 1; +int tcp_always_keepalive = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive, CTLFLAG_RW, - &always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections"); + &tcp_always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections"); int tcp_fast_finwait2_recycle = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, fast_finwait2_recycle, CTLFLAG_RW, @@ -471,7 +471,8 @@ tcp_timer_keep(void *xtp) TCPSTAT_INC(tcps_keeptimeo); if (tp->t_state < TCPS_ESTABLISHED) goto dropit; - if ((always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) && + if ((tcp_always_keepalive || + inp->inp_socket->so_options & SO_KEEPALIVE) && tp->t_state <= TCPS_CLOSING) { if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp)) goto dropit; Modified: head/sys/netinet/tcp_timer.h ============================================================================== --- head/sys/netinet/tcp_timer.h Tue Jan 30 21:34:34 2018 (r328607) +++ head/sys/netinet/tcp_timer.h Tue Jan 30 23:01:37 2018 (r328608) @@ -197,6 +197,7 @@ extern int tcp_ttl; /* time to live for TCP segs */ extern int tcp_backoff[]; extern int tcp_syn_backoff[]; +extern int tcp_always_keepalive; extern int tcp_finwait2_timeout; extern int tcp_fast_finwait2_recycle; From owner-svn-src-all@freebsd.org Tue Jan 30 23:20:42 2018 Return-Path: Delivered-To: svn-src-all@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 623D5EC7B29; Tue, 30 Jan 2018 23:20:42 +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 189CA8737E; Tue, 30 Jan 2018 23:20:42 +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 12FBE1DD46; Tue, 30 Jan 2018 23:20:42 +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 w0UNKflK077310; Tue, 30 Jan 2018 23:20:41 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UNKfdI077309; Tue, 30 Jan 2018 23:20:41 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201801302320.w0UNKfdI077309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 30 Jan 2018 23:20:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r328609 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 328609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 23:20:42 -0000 Author: gonzo Date: Tue Jan 30 23:20:41 2018 New Revision: 328609 URL: https://svnweb.freebsd.org/changeset/base/328609 Log: Release Vladimir Kondratyev from mentorship Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Tue Jan 30 23:01:37 2018 (r328608) +++ svnadmin/conf/mentors Tue Jan 30 23:20:41 2018 (r328609) @@ -28,4 +28,3 @@ peterj jhb Co-mentor: grog rgrimes grehan slm ken Co-mentor: scottl, ambrisko wosch cem -wulf gonzo Co-mentor: bapt From owner-svn-src-all@freebsd.org Tue Jan 30 23:29:27 2018 Return-Path: Delivered-To: svn-src-all@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 BE8B4EC81D1; Tue, 30 Jan 2018 23:29:27 +0000 (UTC) (envelope-from jhb@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 70E5A87936; Tue, 30 Jan 2018 23:29:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 678941DECA; Tue, 30 Jan 2018 23:29:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0UNTRgU080139; Tue, 30 Jan 2018 23:29:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0UNTRHn080138; Tue, 30 Jan 2018 23:29:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801302329.w0UNTRHn080138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Jan 2018 23:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328610 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 328610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 23:29:27 -0000 Author: jhb Date: Tue Jan 30 23:29:27 2018 New Revision: 328610 URL: https://svnweb.freebsd.org/changeset/base/328610 Log: Ensure 'name' is not NULL before passing to strcmp(). This avoids a nested page fault when obtaining a stack trace in DDB if the address from the first frame does not resolve to a known symbol. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/amd64/amd64/db_trace.c Modified: head/sys/amd64/amd64/db_trace.c ============================================================================== --- head/sys/amd64/amd64/db_trace.c Tue Jan 30 23:20:41 2018 (r328609) +++ head/sys/amd64/amd64/db_trace.c Tue Jan 30 23:29:27 2018 (r328610) @@ -336,7 +336,8 @@ db_backtrace(struct thread *td, struct trapframe *tf, /* Probably an assembler symbol. */ actframe = (void *)(tf->tf_rsp - 8); } - } else if (strcmp(name, "fork_trampoline") == 0) { + } else if (name != NULL && + strcmp(name, "fork_trampoline") == 0) { /* * Don't try to walk back on a stack for a * process that hasn't actually been run yet. From owner-svn-src-all@freebsd.org Wed Jan 31 01:04:37 2018 Return-Path: Delivered-To: svn-src-all@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 76D32ECE264; Wed, 31 Jan 2018 01:04:37 +0000 (UTC) (envelope-from mav@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 2CC1F6B303; Wed, 31 Jan 2018 01:04:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 274181EED9; Wed, 31 Jan 2018 01:04:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0V14b6u029310; Wed, 31 Jan 2018 01:04:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V14bxn029309; Wed, 31 Jan 2018 01:04:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801310104.w0V14bxn029309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 31 Jan 2018 01:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328611 - head/sys/dev/ntb X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ntb X-SVN-Commit-Revision: 328611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 01:04:37 -0000 Author: mav Date: Wed Jan 31 01:04:36 2018 New Revision: 328611 URL: https://svnweb.freebsd.org/changeset/base/328611 Log: Try to preallocate receive memory early. We may not have enough contiguous memory later, when NTB connection get established. It is quite likely that NTB windows are symmetric and this allocation remain, but even if not, we will just reallocate it later. MFC after: 2 weeks Modified: head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Tue Jan 30 23:29:27 2018 (r328610) +++ head/sys/dev/ntb/ntb_transport.c Wed Jan 31 01:04:36 2018 (r328611) @@ -332,7 +332,7 @@ ntb_transport_attach(device_t dev) struct ntb_transport_child **cpp = &nt->child; struct ntb_transport_child *nc; struct ntb_transport_mw *mw; - uint64_t db_bitmap; + uint64_t db_bitmap, size; int rc, i, db_count, spad_count, qp, qpu, qpo, qpt; char cfg[128] = ""; char buf[32]; @@ -383,6 +383,17 @@ ntb_transport_attach(device_t dev) rc = ntb_mw_set_wc(dev, i, VM_MEMATTR_WRITE_COMBINING); if (rc) ntb_printf(0, "Unable to set mw%d caching\n", i); + + /* + * Try to preallocate receive memory early, since there may + * be not enough contiguous memory later. It is quite likely + * that NTB windows are symmetric and this allocation remain, + * but even if not, we will just reallocate it later. + */ + size = mw->phys_size; + if (max_mw_size != 0 && size > max_mw_size) + size = max_mw_size; + ntb_set_mw(nt, i, size); } qpu = 0; From owner-svn-src-all@freebsd.org Wed Jan 31 02:02:01 2018 Return-Path: Delivered-To: svn-src-all@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 A05DFED165B; Wed, 31 Jan 2018 02:02:01 +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 50D186D2B9; Wed, 31 Jan 2018 02:02:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 672C110A7DB; Tue, 30 Jan 2018 21:02:00 -0500 (EST) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328610 - head/sys/amd64/amd64 Date: Tue, 30 Jan 2018 18:01:42 -0800 Message-ID: <3195814.6PcFLP86qD@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201801302329.w0UNTRHn080138@repo.freebsd.org> References: <201801302329.w0UNTRHn080138@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 30 Jan 2018 21:02:00 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 02:02:01 -0000 On Tuesday, January 30, 2018 11:29:27 PM John Baldwin wrote: > Author: jhb > Date: Tue Jan 30 23:29:27 2018 > New Revision: 328610 > URL: https://svnweb.freebsd.org/changeset/base/328610 > > Log: > Ensure 'name' is not NULL before passing to strcmp(). > > This avoids a nested page fault when obtaining a stack trace in DDB if > the address from the first frame does not resolve to a known symbol. > > MFC after: 1 week > Sponsored by: Chelsio Communications This appears to be fallout from lld? After fixing this, the stack trace for my next panic shows no symbols for functions in the kernel, only functions in kernel modules: KDB: stack backtrace: ??() at 0xffffffff803c372b/frame 0xfffffe0093632750 ??() at 0xffffffff80a07539/frame 0xfffffe0093632800 ??() at 0xffffffff809cc14c/frame 0xfffffe0093632860 ??() at 0xffffffff809cc203/frame 0xfffffe00936328c0 do_rx_tls_cmp() at do_rx_tls_cmp+0x1d3/frame 0xfffffe0093632910 service_iq() at service_iq+0x380/frame 0xfffffe00936329b0 t4_intr() at t4_intr+0x2e/frame 0xfffffe00936329d0 ??() at 0xffffffff80993f1f/frame 0xfffffe0093632a10 ??() at 0xffffffff80994716/frame 0xfffffe0093632a30 ??() at 0xffffffff809945cb/frame 0xfffffe0093632a70 ??() at 0xffffffff809912f3/frame 0xfffffe0093632ab0 ??() at 0xffffffff80e1de8e KDB: enter: panic I don't spot anything obvious comparing readelf of an older kernel with the LLD kernel, but I also haven't tried debugging this further. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Jan 31 03:05:15 2018 Return-Path: Delivered-To: svn-src-all@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 EC06CED4838; Wed, 31 Jan 2018 03:05: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 9C4D16F55B; Wed, 31 Jan 2018 03:05: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 9722F202D5; Wed, 31 Jan 2018 03:05: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 w0V35EfG090572; Wed, 31 Jan 2018 03:05:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V35EU4090569; Wed, 31 Jan 2018 03:05:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801310305.w0V35EU4090569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Jan 2018 03:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328612 - head/lib/libc/stdlib X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libc/stdlib X-SVN-Commit-Revision: 328612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 03:05:15 -0000 Author: imp Date: Wed Jan 31 03:05:14 2018 New Revision: 328612 URL: https://svnweb.freebsd.org/changeset/base/328612 Log: Move strtold wrapper from strtol.c to its own strtold.c. This code was written by theraven@ (David Chisnall) entirely, there's no original Berkeley code left here so just copy his copyright over. Added: head/lib/libc/stdlib/strtold.c (contents, props changed) Modified: head/lib/libc/stdlib/Makefile.inc head/lib/libc/stdlib/strtol.c Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Wed Jan 31 01:04:36 2018 (r328611) +++ head/lib/libc/stdlib/Makefile.inc Wed Jan 31 03:05:14 2018 (r328612) @@ -15,7 +15,7 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof. radixsort.c rand.c \ random.c reallocarray.c reallocf.c realpath.c remque.c \ set_constraint_handler_s.c strfmon.c strtoimax.c \ - strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ + strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c # Work around an issue on case-insensitive file systems. Modified: head/lib/libc/stdlib/strtol.c ============================================================================== --- head/lib/libc/stdlib/strtol.c Wed Jan 31 01:04:36 2018 (r328611) +++ head/lib/libc/stdlib/strtol.c Wed Jan 31 03:05:14 2018 (r328612) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include "xlocale_private.h" - /* * Convert a string to a long integer. * @@ -152,9 +151,4 @@ long strtol(const char * __restrict nptr, char ** __restrict endptr, int base) { return strtol_l(nptr, endptr, base, __get_locale()); -} -long double -strtold(const char * __restrict nptr, char ** __restrict endptr) -{ - return strtold_l(nptr, endptr, __get_locale()); } Added: head/lib/libc/stdlib/strtold.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/strtold.c Wed Jan 31 03:05:14 2018 (r328612) @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2011 The FreeBSD Foundation + * All rights reserved. + * Portions of this software were developed by David Chisnall + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "xlocale_private.h" + +long double +strtold(const char * __restrict nptr, char ** __restrict endptr) +{ + + return strtold_l(nptr, endptr, __get_locale()); +} From owner-svn-src-all@freebsd.org Wed Jan 31 04:29:01 2018 Return-Path: Delivered-To: svn-src-all@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 674DAED8AE3; Wed, 31 Jan 2018 04:29:01 +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 1A48A71EA9; Wed, 31 Jan 2018 04:29: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 153022102E; Wed, 31 Jan 2018 04:29: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 w0V4T0VW030167; Wed, 31 Jan 2018 04:29:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V4T0hu030165; Wed, 31 Jan 2018 04:29:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801310429.w0V4T0hu030165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Jan 2018 04:29:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328613 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 04:29:01 -0000 Author: imp Date: Wed Jan 31 04:29:00 2018 New Revision: 328613 URL: https://svnweb.freebsd.org/changeset/base/328613 Log: Kill copies of strtol and strtoul. Use the ones that are in libc, since they suffice. Create xlocale_private.h which provides the most minimal locale implementation we can get away with. Add strtoll and strtoull from libc. Added: head/stand/libsa/xlocale_private.h (contents, props changed) Deleted: head/stand/libsa/strtol.c head/stand/libsa/strtoul.c Modified: head/stand/libsa/Makefile Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Wed Jan 31 03:05:14 2018 (r328612) +++ head/stand/libsa/Makefile Wed Jan 31 04:29:00 2018 (r328613) @@ -20,7 +20,7 @@ NO_PIC= # standalone components and stuff we have modified locally SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd.c environment.c getopt.c gets.c \ - globals.c pager.c panic.c printf.c strdup.c strerror.c strtol.c strtoul.c \ + globals.c pager.c panic.c printf.c strdup.c strerror.c \ random.c sbrk.c twiddle.c zalloc.c zalloc_malloc.c # private (pruned) versions of libc string functions @@ -40,7 +40,7 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ # stdlib functions from libc .PATH: ${LIBC_SRC}/stdlib -SRCS+= abs.c +SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC_SRC}/arm/gen Added: head/stand/libsa/xlocale_private.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/libsa/xlocale_private.h Wed Jan 31 04:29:00 2018 (r328613) @@ -0,0 +1,36 @@ +/*- + * 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. + * 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 STAND_XLOCALE_PRIVATE_H +#define STAND_XLOCALE_PRIVATE_H 1 + +typedef int locale_t; +#define FIX_LOCALE(x) +#define isspace_l(c, l) isspace(c) +#define __get_locale() 0 + +#endif /* STAND_XLOCALE_PRIVATE_H */ From owner-svn-src-all@freebsd.org Wed Jan 31 04:29:09 2018 Return-Path: Delivered-To: svn-src-all@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 74F3DED8B0F; Wed, 31 Jan 2018 04:29:09 +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 23DE571F32; Wed, 31 Jan 2018 04:29: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 353202102F; Wed, 31 Jan 2018 04:29: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 w0V4T61O030223; Wed, 31 Jan 2018 04:29:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V4T63q030222; Wed, 31 Jan 2018 04:29:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801310429.w0V4T63q030222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Jan 2018 04:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328614 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 04:29:09 -0000 Author: imp Date: Wed Jan 31 04:29:05 2018 New Revision: 328614 URL: https://svnweb.freebsd.org/changeset/base/328614 Log: Move libstand.3 to libsa.3. Update libsa.3 to include functions recently added. More are likely missing. Added: head/stand/libsa/libsa.3 (contents, props changed) - copied, changed from r328613, head/stand/libsa/libstand.3 Deleted: head/stand/libsa/libstand.3 Copied and modified: head/stand/libsa/libsa.3 (from r328613, head/stand/libsa/libstand.3) ============================================================================== --- head/stand/libsa/libstand.3 Wed Jan 31 04:29:00 2018 (r328613, copy source) +++ head/stand/libsa/libsa.3 Wed Jan 31 04:29:05 2018 (r328614) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 6, 2004 +.Dd February 1, 2018 .Dt LIBSTAND 3 .Os .Sh NAME @@ -161,6 +161,10 @@ may be used to prevent a variable being unset. .Bl -hang -width 10n .It Xo .Ft int +.Fn abs "int i" +.Xc +.It Xo +.Ft int .Fn getopt "int argc" "char * const *argv" "const char *optstring" .Xc .It Xo @@ -168,6 +172,18 @@ may be used to prevent a variable being unset. .Fn strtol "const char *nptr" "char **endptr" "int base" .Xc .It Xo +.Ft long long +.Fn strtoll "const char *nptr" "char **endptr" "int base" +.Xc +.It Xo +.Ft long +.Fn strtoul "const char *nptr" "char **endptr" "int base" +.Xc +.It Xo +.Ft long long +.Fn strtoull "const char *nptr" "char **endptr" "int base" +.Xc +.It Xo .Ft void .Fn srandom "unsigned int seed" .Xc @@ -350,6 +366,22 @@ ptr, .Xc .It Xo .Ft int +.Fn isalnum "int c" +.Xc +.It Xo +.Ft int +.Fn iscntrl "int c" +.Xc +.It Xo +.Ft int +.Fn isgraph "int c" +.Xc +.It Xo +.Ft int +.Fn ispunct "int c" +.Xc +.It Xo +.Ft int .Fn toupper "int c" .Xc .It Xo @@ -581,6 +613,14 @@ Close the device allocated for .Fa of . The device driver itself will already have been called for the close; this call should clean up any allocation made by devopen only. +.It Xo +.Ft void +.Fn abort +.Xc +.Pp +Calls +.Fn panic +with a fixed string. .It Xo .Ft void .Fn panic "const char *msg" "..." From owner-svn-src-all@freebsd.org Wed Jan 31 05:07:43 2018 Return-Path: Delivered-To: svn-src-all@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 D26D9EDA7D7; Wed, 31 Jan 2018 05:07:43 +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 8298E734E9; Wed, 31 Jan 2018 05:07:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D86821739; Wed, 31 Jan 2018 05:07: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 w0V57hnH050009; Wed, 31 Jan 2018 05:07:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V57hje050008; Wed, 31 Jan 2018 05:07:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801310507.w0V57hje050008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Jan 2018 05:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328615 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 05:07:44 -0000 Author: imp Date: Wed Jan 31 05:07:43 2018 New Revision: 328615 URL: https://svnweb.freebsd.org/changeset/base/328615 Log: Update stand.h for changes for strto*l Move prototypes to proper section now that we don't have modified versions of strtol and strtoul in libsa. Add prototypes for new strtoll and strtoull. Use prototypes copied from stdlib.h instead of the old hand-rolled ones. (I forgot to move this file form my lua branch in r328613) Modified: head/stand/libsa/stand.h Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Wed Jan 31 04:29:05 2018 (r328614) +++ head/stand/libsa/stand.h Wed Jan 31 05:07:43 2018 (r328615) @@ -295,8 +295,6 @@ extern void srandom(unsigned int); extern long random(void); /* imports from stdlib, locally modified */ -extern long strtol(const char *, char **, int); -extern unsigned long strtoul(const char *, char **, int); extern char *optarg; /* getopt(3) external variables */ extern int optind, opterr, optopt, optreset; extern int getopt(int, char * const [], const char *); @@ -349,6 +347,10 @@ extern ev_unsethook_t env_nounset; /* refuse unset op /* stdlib.h routines */ extern int abs(int a); extern void abort(void) __dead2; +extern long strtol(const char * __restrict, char ** __restrict, int); +extern long long strtoll(const char * __restrict, char ** __restrict, int); +extern unsigned long strtoul(const char * __restrict, char ** __restrict, int); +extern unsigned long long strtoull(const char * __restrict, char ** __restrict, int); /* BCD conversions (undocumented) */ extern u_char const bcd2bin_data[]; From owner-svn-src-all@freebsd.org Wed Jan 31 06:42:01 2018 Return-Path: Delivered-To: svn-src-all@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 9EA5CEDE36C; Wed, 31 Jan 2018 06:42:01 +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 51FD476013; Wed, 31 Jan 2018 06:42:01 +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 4D0DD226A1; Wed, 31 Jan 2018 06:42:01 +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 w0V6g1rp099108; Wed, 31 Jan 2018 06:42:01 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V6g1Am099107; Wed, 31 Jan 2018 06:42:01 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801310642.w0V6g1Am099107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 31 Jan 2018 06:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328616 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 328616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 06:42:01 -0000 Author: wma Date: Wed Jan 31 06:42:01 2018 New Revision: 328616 URL: https://svnweb.freebsd.org/changeset/base/328616 Log: PowerNV: fix compilation on non-NV platforms Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Modified: head/sys/powerpc/aim/mp_cpudep.c Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Wed Jan 31 05:07:43 2018 (r328615) +++ head/sys/powerpc/aim/mp_cpudep.c Wed Jan 31 06:42:01 2018 (r328616) @@ -85,13 +85,15 @@ cpudep_ap_early_bootstrap(void) break; case IBMPOWER8: case IBMPOWER8E: - isync(); - /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ - mtspr(SPR_LPID, 0); - isync(); + if (mfmsr() & PSL_HV) { + isync(); + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ + mtspr(SPR_LPID, 0); + isync(); - mtspr(SPR_LPCR, LPCR_LPES); - isync(); + mtspr(SPR_LPCR, LPCR_LPES); + isync(); + } break; } From owner-svn-src-all@freebsd.org Wed Jan 31 07:20:35 2018 Return-Path: Delivered-To: svn-src-all@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 2ED06EDFAEA; Wed, 31 Jan 2018 07:20:35 +0000 (UTC) (envelope-from adrian@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 D3BD67706D; Wed, 31 Jan 2018 07:20:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA69A22C98; Wed, 31 Jan 2018 07:20:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0V7KYQJ014449; Wed, 31 Jan 2018 07:20:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V7KYtw014448; Wed, 31 Jan 2018 07:20:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201801310720.w0V7KYtw014448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 31 Jan 2018 07:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328617 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/etherswitch/arswitch X-SVN-Commit-Revision: 328617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 07:20:35 -0000 Author: adrian Date: Wed Jan 31 07:20:34 2018 New Revision: 328617 URL: https://svnweb.freebsd.org/changeset/base/328617 Log: [arswitch] add a new debug section for upcoming address table management. Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchvar.h Wed Jan 31 06:42:01 2018 (r328616) +++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Wed Jan 31 07:20:34 2018 (r328617) @@ -97,6 +97,8 @@ struct arswitch_softc { /* ATU functions */ int (* arswitch_atu_flush) (struct arswitch_softc *); + int (* arswitch_atu_flush_port) (struct arswitch_softc *, int); + int (* arswitch_atu_learn_default) (struct arswitch_softc *); /* VLAN functions */ int (* arswitch_port_vlan_setup) (struct arswitch_softc *, @@ -151,6 +153,7 @@ struct arswitch_softc { #define ARSWITCH_DBG_PHYIO 0x00000004 #define ARSWITCH_DBG_POLL 0x00000008 #define ARSWITCH_DBG_VLAN 0x00000010 +#define ARSWITCH_DBG_ATU 0x00000020 #define ARSWITCH_DBG_ANY 0xffffffff #if 1 From owner-svn-src-all@freebsd.org Wed Jan 31 07:36:52 2018 Return-Path: Delivered-To: svn-src-all@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 855C6EE06E9; Wed, 31 Jan 2018 07:36:52 +0000 (UTC) (envelope-from adrian@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 360EA77B9A; Wed, 31 Jan 2018 07:36:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3094422FCD; Wed, 31 Jan 2018 07:36:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0V7aq7g024232; Wed, 31 Jan 2018 07:36:52 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V7aq3M024231; Wed, 31 Jan 2018 07:36:52 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201801310736.w0V7aq3M024231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 31 Jan 2018 07:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328618 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/etherswitch/arswitch X-SVN-Commit-Revision: 328618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 07:36:52 -0000 Author: adrian Date: Wed Jan 31 07:36:51 2018 New Revision: 328618 URL: https://svnweb.freebsd.org/changeset/base/328618 Log: [arswitch] Fix ATU flushing on AR8216/AR8316 and most of the later chips. The switch hardware requires this bit to be set in order to kick start the actual ATU update. This was being masked on some chips by the learning programming (what to do when a MAC address moves, hash table collision, etc) which is currently inconsistent between chips. Tested: * AR9344 SoC (AR7240 style switch internal) Modified: head/sys/dev/etherswitch/arswitch/arswitch.c Modified: head/sys/dev/etherswitch/arswitch/arswitch.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch.c Wed Jan 31 07:20:34 2018 (r328617) +++ head/sys/dev/etherswitch/arswitch/arswitch.c Wed Jan 31 07:36:51 2018 (r328618) @@ -305,7 +305,7 @@ ar8xxx_atu_flush(struct arswitch_softc *sc) if (!ret) arswitch_writereg(sc->sc_dev, AR8216_REG_ATU, - AR8216_ATU_OP_FLUSH); + AR8216_ATU_OP_FLUSH | AR8216_ATU_ACTIVE); return (ret); } From owner-svn-src-all@freebsd.org Wed Jan 31 07:37:34 2018 Return-Path: Delivered-To: svn-src-all@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 9A619EE0768; Wed, 31 Jan 2018 07:37:34 +0000 (UTC) (envelope-from adrian@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 43AE777CBB; Wed, 31 Jan 2018 07:37:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E6BA22FCE; Wed, 31 Jan 2018 07:37:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0V7bY8m024298; Wed, 31 Jan 2018 07:37:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V7bYqB024297; Wed, 31 Jan 2018 07:37:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201801310737.w0V7bYqB024297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 31 Jan 2018 07:37:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328619 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/etherswitch/arswitch X-SVN-Commit-Revision: 328619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 07:37:34 -0000 Author: adrian Date: Wed Jan 31 07:37:33 2018 New Revision: 328619 URL: https://svnweb.freebsd.org/changeset/base/328619 Log: [arswitch] Fix ATU programming on the AR8327 switch. Doing a flush actually requires setting this bit. Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8327.c Wed Jan 31 07:36:51 2018 (r328618) +++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c Wed Jan 31 07:37:33 2018 (r328619) @@ -1054,7 +1054,7 @@ ar8327_atu_flush(struct arswitch_softc *sc) if (!ret) arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_FUNC, - AR8327_ATU_FUNC_OP_FLUSH); + AR8327_ATU_FUNC_OP_FLUSH | AR8327_ATU_FUNC_BUSY); return (ret); } From owner-svn-src-all@freebsd.org Wed Jan 31 09:24:49 2018 Return-Path: Delivered-To: svn-src-all@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 BE61FEE4F5E; Wed, 31 Jan 2018 09:24:49 +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 6D9487B443; Wed, 31 Jan 2018 09:24:49 +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 4BE2124189; Wed, 31 Jan 2018 09:24:49 +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 w0V9Onrs078264; Wed, 31 Jan 2018 09:24:49 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V9Onqn078263; Wed, 31 Jan 2018 09:24:49 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201801310924.w0V9Onqn078263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 31 Jan 2018 09:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328620 - stable/11/sys/netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netipsec X-SVN-Commit-Revision: 328620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 09:24:50 -0000 Author: ae Date: Wed Jan 31 09:24:48 2018 New Revision: 328620 URL: https://svnweb.freebsd.org/changeset/base/328620 Log: MFC r328350: Merge revision 1.35 from NetBSD: fix pointer/offset mistakes in handling of IPv4 options Reported by: Maxime Villard MFC r328352: Adopt revision 1.76 and 1.77 from NetBSD: Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely crash the kernel with a single packet. In this loop we need to increment 'ad' by two, because the length field of the option header does not count the size of the option header itself. If the length is zero, then 'count' is incremented by zero, and there's an infinite loop. Beyond that, this code was written with the assumption that since the IPv6 packet already went through the generic IPv6 option parser, several fields are guaranteed to be valid; but this assumption does not hold because of the missing '+2', and there's as a result a triggerable buffer overflow (write zeros after the end of the mbuf, potentially to the next mbuf in memory since it's a pool). Add the missing '+2', this place will be reinforced in separate commits. Reported by: Maxime Villard Modified: stable/11/sys/netipsec/xform_ah.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/xform_ah.c ============================================================================== --- stable/11/sys/netipsec/xform_ah.c Wed Jan 31 07:37:33 2018 (r328619) +++ stable/11/sys/netipsec/xform_ah.c Wed Jan 31 09:24:48 2018 (r328620) @@ -264,7 +264,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk #ifdef INET6 struct ip6_ext *ip6e; struct ip6_hdr ip6; - int alloc, len, ad; + int ad, alloc, nxt, noff; #endif /* INET6 */ switch (proto) { @@ -293,7 +293,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk else ip->ip_off = htons(0); - ptr = mtod(m, unsigned char *) + sizeof(struct ip); + ptr = mtod(m, unsigned char *); /* IPv4 option processing */ for (off = sizeof(struct ip); off < skip;) { @@ -374,7 +374,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk /* Zeroize all other options. */ count = ptr[off + 1]; - bcopy(ipseczeroes, ptr, count); + bcopy(ipseczeroes, ptr + off, count); off += count; break; } @@ -447,61 +447,44 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk } else break; - off = ip6.ip6_nxt & 0xff; /* Next header type. */ + nxt = ip6.ip6_nxt & 0xff; /* Next header type. */ - for (len = 0; len < skip - sizeof(struct ip6_hdr);) - switch (off) { + for (off = 0; off < skip - sizeof(struct ip6_hdr);) + switch (nxt) { case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: - ip6e = (struct ip6_ext *) (ptr + len); + ip6e = (struct ip6_ext *)(ptr + off); + noff = off + ((ip6e->ip6e_len + 1) << 3); + /* Sanity check. */ + if (noff > skip - sizeof(struct ip6_hdr)) + goto error6; + /* - * Process the mutable/immutable - * options -- borrows heavily from the - * KAME code. + * Zero out mutable options. */ - for (count = len + sizeof(struct ip6_ext); - count < len + ((ip6e->ip6e_len + 1) << 3);) { + for (count = off + sizeof(struct ip6_ext); + count < noff;) { if (ptr[count] == IP6OPT_PAD1) { count++; continue; /* Skip padding. */ } - /* Sanity check. */ - if (count > len + - ((ip6e->ip6e_len + 1) << 3)) { - m_freem(m); + ad = ptr[count + 1] + 2; + if (count + ad > noff) + goto error6; - /* Free, if we allocated. */ - if (alloc) - free(ptr, M_XDATA); - return EINVAL; - } - - ad = ptr[count + 1]; - - /* If mutable option, zeroize. */ if (ptr[count] & IP6OPT_MUTABLE) - bcopy(ipseczeroes, ptr + count, - ptr[count + 1]); - + memset(ptr + count, 0, ad); count += ad; - - /* Sanity check. */ - if (count > - skip - sizeof(struct ip6_hdr)) { - m_freem(m); - - /* Free, if we allocated. */ - if (alloc) - free(ptr, M_XDATA); - return EINVAL; - } } + if (count != noff) + goto error6; + /* Advance. */ - len += ((ip6e->ip6e_len + 1) << 3); - off = ip6e->ip6e_nxt; + off += ((ip6e->ip6e_len + 1) << 3); + nxt = ip6e->ip6e_nxt; break; case IPPROTO_ROUTING: @@ -509,14 +492,15 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk * Always include routing headers in * computation. */ - ip6e = (struct ip6_ext *) (ptr + len); - len += ((ip6e->ip6e_len + 1) << 3); - off = ip6e->ip6e_nxt; + ip6e = (struct ip6_ext *) (ptr + off); + off += ((ip6e->ip6e_len + 1) << 3); + nxt = ip6e->ip6e_nxt; break; default: DPRINTF(("%s: unexpected IPv6 header type %d", __func__, off)); +error6: if (alloc) free(ptr, M_XDATA); m_freem(m); From owner-svn-src-all@freebsd.org Wed Jan 31 09:26:29 2018 Return-Path: Delivered-To: svn-src-all@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 96A08EE5094; Wed, 31 Jan 2018 09:26:29 +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 4CB147B5DB; Wed, 31 Jan 2018 09:26: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 4348A2418A; Wed, 31 Jan 2018 09:26: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 w0V9QTKS078387; Wed, 31 Jan 2018 09:26:29 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0V9QTxJ078386; Wed, 31 Jan 2018 09:26:29 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201801310926.w0V9QTxJ078386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 31 Jan 2018 09:26:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328621 - stable/10/sys/netipsec X-SVN-Group: stable-10 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/10/sys/netipsec X-SVN-Commit-Revision: 328621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 09:26:29 -0000 Author: ae Date: Wed Jan 31 09:26:28 2018 New Revision: 328621 URL: https://svnweb.freebsd.org/changeset/base/328621 Log: MFC r328350: Merge revision 1.35 from NetBSD: fix pointer/offset mistakes in handling of IPv4 options Reported by: Maxime Villard MFC r328352: Adopt revision 1.76 and 1.77 from NetBSD: Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely crash the kernel with a single packet. In this loop we need to increment 'ad' by two, because the length field of the option header does not count the size of the option header itself. If the length is zero, then 'count' is incremented by zero, and there's an infinite loop. Beyond that, this code was written with the assumption that since the IPv6 packet already went through the generic IPv6 option parser, several fields are guaranteed to be valid; but this assumption does not hold because of the missing '+2', and there's as a result a triggerable buffer overflow (write zeros after the end of the mbuf, potentially to the next mbuf in memory since it's a pool). Add the missing '+2', this place will be reinforced in separate commits. Reported by: Maxime Villard Modified: stable/10/sys/netipsec/xform_ah.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netipsec/xform_ah.c ============================================================================== --- stable/10/sys/netipsec/xform_ah.c Wed Jan 31 09:24:48 2018 (r328620) +++ stable/10/sys/netipsec/xform_ah.c Wed Jan 31 09:26:28 2018 (r328621) @@ -285,7 +285,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk #ifdef INET6 struct ip6_ext *ip6e; struct ip6_hdr ip6; - int alloc, len, ad; + int ad, alloc, nxt, noff; #endif /* INET6 */ switch (proto) { @@ -314,7 +314,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk else ip->ip_off = htons(0); - ptr = mtod(m, unsigned char *) + sizeof(struct ip); + ptr = mtod(m, unsigned char *); /* IPv4 option processing */ for (off = sizeof(struct ip); off < skip;) { @@ -395,7 +395,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk /* Zeroize all other options. */ count = ptr[off + 1]; - bcopy(ipseczeroes, ptr, count); + bcopy(ipseczeroes, ptr + off, count); off += count; break; } @@ -468,61 +468,44 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk } else break; - off = ip6.ip6_nxt & 0xff; /* Next header type. */ + nxt = ip6.ip6_nxt & 0xff; /* Next header type. */ - for (len = 0; len < skip - sizeof(struct ip6_hdr);) - switch (off) { + for (off = 0; off < skip - sizeof(struct ip6_hdr);) + switch (nxt) { case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: - ip6e = (struct ip6_ext *) (ptr + len); + ip6e = (struct ip6_ext *)(ptr + off); + noff = off + ((ip6e->ip6e_len + 1) << 3); + /* Sanity check. */ + if (noff > skip - sizeof(struct ip6_hdr)) + goto error6; + /* - * Process the mutable/immutable - * options -- borrows heavily from the - * KAME code. + * Zero out mutable options. */ - for (count = len + sizeof(struct ip6_ext); - count < len + ((ip6e->ip6e_len + 1) << 3);) { + for (count = off + sizeof(struct ip6_ext); + count < noff;) { if (ptr[count] == IP6OPT_PAD1) { count++; continue; /* Skip padding. */ } - /* Sanity check. */ - if (count > len + - ((ip6e->ip6e_len + 1) << 3)) { - m_freem(m); + ad = ptr[count + 1] + 2; + if (count + ad > noff) + goto error6; - /* Free, if we allocated. */ - if (alloc) - free(ptr, M_XDATA); - return EINVAL; - } - - ad = ptr[count + 1]; - - /* If mutable option, zeroize. */ if (ptr[count] & IP6OPT_MUTABLE) - bcopy(ipseczeroes, ptr + count, - ptr[count + 1]); - + memset(ptr + count, 0, ad); count += ad; - - /* Sanity check. */ - if (count > - skip - sizeof(struct ip6_hdr)) { - m_freem(m); - - /* Free, if we allocated. */ - if (alloc) - free(ptr, M_XDATA); - return EINVAL; - } } + if (count != noff) + goto error6; + /* Advance. */ - len += ((ip6e->ip6e_len + 1) << 3); - off = ip6e->ip6e_nxt; + off += ((ip6e->ip6e_len + 1) << 3); + nxt = ip6e->ip6e_nxt; break; case IPPROTO_ROUTING: @@ -530,14 +513,15 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk * Always include routing headers in * computation. */ - ip6e = (struct ip6_ext *) (ptr + len); - len += ((ip6e->ip6e_len + 1) << 3); - off = ip6e->ip6e_nxt; + ip6e = (struct ip6_ext *) (ptr + off); + off += ((ip6e->ip6e_len + 1) << 3); + nxt = ip6e->ip6e_nxt; break; default: DPRINTF(("%s: unexpected IPv6 header type %d", __func__, off)); +error6: if (alloc) free(ptr, M_XDATA); m_freem(m); From owner-svn-src-all@freebsd.org Wed Jan 31 11:14:26 2018 Return-Path: Delivered-To: svn-src-all@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 BEEFAEC403C; Wed, 31 Jan 2018 11:14:26 +0000 (UTC) (envelope-from avg@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 6BD6F7EF7F; Wed, 31 Jan 2018 11:14:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F18D25362; Wed, 31 Jan 2018 11:14:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VBEQ2n032191; Wed, 31 Jan 2018 11:14:26 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VBEQi2032190; Wed, 31 Jan 2018 11:14:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201801311114.w0VBEQi2032190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 31 Jan 2018 11:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328622 - head/sys/amd64/vmm/amd X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/amd64/vmm/amd X-SVN-Commit-Revision: 328622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 11:14:27 -0000 Author: avg Date: Wed Jan 31 11:14:26 2018 New Revision: 328622 URL: https://svnweb.freebsd.org/changeset/base/328622 Log: vmm/svm: post LAPIC interrupts using event injection, not virtual interrupts The virtual interrupt method uses V_IRQ, V_INTR_PRIO, and V_INTR_VECTOR fields of VMCB to inject a virtual interrupt into a guest VM. This method has many advantages over the direct event injection as it offloads all decisions of whether and when the interrupt can be delivered to the guest. But with a purely software emulated vAPIC the advantage is also a problem. The problem is that the hypervisor does not have any precise control over when the interrupt is actually delivered to the guest (or a notification about that). Because of that the hypervisor cannot update the interrupt vector in IRR and ISR in the same way as real hardware would. The hypervisor becomes aware that the interrupt is being serviced only upon the first VMEXIT after the interrupt is delivered. This creates a window between the actual interrupt delivery and the update of IRR and ISR. That means that IRR and ISR might not be correctly set up to the point of the end-of-interrupt signal. The described deviation has been observed to cause an interrupt loss in the following scenario. vCPU0 posts an inter-processor interrupt to vCPU1. The interrupt is injected as a virtual interrupt by the hypervisor. The interrupt is delivered to a guest and an interrupt handler is invoked. The handler performs a requested action and acknowledges the request by modifying a global variable. So far, there is no VMEXIT and the hypervisor is unaware of the events. Then, vCPU0 notices the acknowledgment and sends another IPI with the same vector. The IPI gets collapsed into the previous IPI in the IRR of vCPU1. Only after that a VMEXIT of vCPU1 occurs. At that time the vector is cleared in the IRR and is set in the ISR. vCPU1 has vAPIC state as if the second IPI has never been sent. The scenario is impossible on the real hardware because IRR and ISR are updated just before the interrupt handler gets started. I saw several possibilities of fixing the problem. One is to intercept the virtual interrupt delivery to update IRR and ISR at the right moment. The other is to deliver the LAPIC interrupts using the event injection, same as legacy interrupts. I opted to use the latter approach for several reasons. It's equivalent to what VMM/Intel does (in !VMX case). It appears to be what VirtualBox and KVM do. The code is already there (to support legacy interrupts). Another possibility was to use a special intermediate state for a vector after it is injected using a virtual interrupt and before it is known whether it was accepted or is still pending. That approach was implemented in https://reviews.freebsd.org/D13828 That method is more complex and does not have any clear advantage. Please see sections 15.20 and 15.21.4 of "AMD64 Architecture Programmer's Manual Volume 2: System Programming" (publication 24593, revision 3.29) for comparison between event injection and virtual interrupt injection. PR: 215972 Reported by: ajschot@hotmail.com, grehan Tested by: anish, grehan, Nils Beyer Reviewed by: anish, grehan MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13780 Modified: head/sys/amd64/vmm/amd/svm.c Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Wed Jan 31 09:26:28 2018 (r328621) +++ head/sys/amd64/vmm/amd/svm.c Wed Jan 31 11:14:26 2018 (r328622) @@ -933,7 +933,6 @@ svm_update_virqinfo(struct svm_softc *sc, int vcpu) struct vm *vm; struct vlapic *vlapic; struct vmcb_ctrl *ctrl; - int pending; vm = sc->vm; vlapic = vm_lapic(vm, vcpu); @@ -942,20 +941,9 @@ svm_update_virqinfo(struct svm_softc *sc, int vcpu) /* Update %cr8 in the emulated vlapic */ vlapic_set_cr8(vlapic, ctrl->v_tpr); - /* - * If V_IRQ indicates that the interrupt injection attempted on then - * last VMRUN was successful then update the vlapic accordingly. - */ - if (ctrl->v_intr_vector != 0) { - pending = ctrl->v_irq; - KASSERT(ctrl->v_intr_vector >= 16, ("%s: invalid " - "v_intr_vector %d", __func__, ctrl->v_intr_vector)); - KASSERT(!ctrl->v_ign_tpr, ("%s: invalid v_ign_tpr", __func__)); - VCPU_CTR2(vm, vcpu, "v_intr_vector %d %s", ctrl->v_intr_vector, - pending ? "pending" : "accepted"); - if (!pending) - vlapic_intr_accepted(vlapic, ctrl->v_intr_vector); - } + /* Virtual interrupt injection is not used. */ + KASSERT(ctrl->v_intr_vector == 0, ("%s: invalid " + "v_intr_vector %d", __func__, ctrl->v_intr_vector)); } static void @@ -1024,12 +1012,7 @@ disable_intr_window_exiting(struct svm_softc *sc, int return; } -#ifdef KTR - if (ctrl->v_intr_vector == 0) - VCPU_CTR0(sc->vm, vcpu, "Disable intr window exiting"); - else - VCPU_CTR0(sc->vm, vcpu, "Clearing V_IRQ interrupt injection"); -#endif + VCPU_CTR0(sc->vm, vcpu, "Disable intr window exiting"); ctrl->v_irq = 0; ctrl->v_intr_vector = 0; svm_set_dirty(sc, vcpu, VMCB_CACHE_TPR); @@ -1574,14 +1557,14 @@ svm_inj_interrupts(struct svm_softc *sc, int vcpu, str struct vmcb_state *state; struct svm_vcpu *vcpustate; uint8_t v_tpr; - int vector, need_intr_window, pending_apic_vector; + int vector, need_intr_window; + int extint_pending; state = svm_get_vmcb_state(sc, vcpu); ctrl = svm_get_vmcb_ctrl(sc, vcpu); vcpustate = svm_get_vcpu(sc, vcpu); need_intr_window = 0; - pending_apic_vector = 0; if (vcpustate->nextrip != state->rip) { ctrl->intr_shadow = 0; @@ -1651,40 +1634,19 @@ svm_inj_interrupts(struct svm_softc *sc, int vcpu, str } } - if (!vm_extint_pending(sc->vm, vcpu)) { - /* - * APIC interrupts are delivered using the V_IRQ offload. - * - * The primary benefit is that the hypervisor doesn't need to - * deal with the various conditions that inhibit interrupts. - * It also means that TPR changes via CR8 will be handled - * without any hypervisor involvement. - * - * Note that the APIC vector must remain pending in the vIRR - * until it is confirmed that it was delivered to the guest. - * This can be confirmed based on the value of V_IRQ at the - * next #VMEXIT (1 = pending, 0 = delivered). - * - * Also note that it is possible that another higher priority - * vector can become pending before this vector is delivered - * to the guest. This is alright because vcpu_notify_event() - * will send an IPI and force the vcpu to trap back into the - * hypervisor. The higher priority vector will be injected on - * the next VMRUN. - */ - if (vlapic_pending_intr(vlapic, &vector)) { - KASSERT(vector >= 16 && vector <= 255, - ("invalid vector %d from local APIC", vector)); - pending_apic_vector = vector; - } - goto done; + extint_pending = vm_extint_pending(sc->vm, vcpu); + if (!extint_pending) { + if (!vlapic_pending_intr(vlapic, &vector)) + goto done; + KASSERT(vector >= 16 && vector <= 255, + ("invalid vector %d from local APIC", vector)); + } else { + /* Ask the legacy pic for a vector to inject */ + vatpic_pending_intr(sc->vm, &vector); + KASSERT(vector >= 0 && vector <= 255, + ("invalid vector %d from INTR", vector)); } - /* Ask the legacy pic for a vector to inject */ - vatpic_pending_intr(sc->vm, &vector); - KASSERT(vector >= 0 && vector <= 255, ("invalid vector %d from INTR", - vector)); - /* * If the guest has disabled interrupts or is in an interrupt shadow * then we cannot inject the pending interrupt. @@ -1710,14 +1672,14 @@ svm_inj_interrupts(struct svm_softc *sc, int vcpu, str goto done; } - /* - * Legacy PIC interrupts are delivered via the event injection - * mechanism. - */ svm_eventinject(sc, vcpu, VMCB_EVENTINJ_TYPE_INTR, vector, 0, false); - vm_extint_clear(sc->vm, vcpu); - vatpic_intr_accepted(sc->vm, vector); + if (!extint_pending) { + vlapic_intr_accepted(vlapic, vector); + } else { + vm_extint_clear(sc->vm, vcpu); + vatpic_intr_accepted(sc->vm, vector); + } /* * Force a VM-exit as soon as the vcpu is ready to accept another @@ -1747,21 +1709,7 @@ done: svm_set_dirty(sc, vcpu, VMCB_CACHE_TPR); } - if (pending_apic_vector) { - /* - * If an APIC vector is being injected then interrupt window - * exiting is not possible on this VMRUN. - */ - KASSERT(!need_intr_window, ("intr_window exiting impossible")); - VCPU_CTR1(sc->vm, vcpu, "Injecting vector %d using V_IRQ", - pending_apic_vector); - - ctrl->v_irq = 1; - ctrl->v_ign_tpr = 0; - ctrl->v_intr_vector = pending_apic_vector; - ctrl->v_intr_prio = pending_apic_vector >> 4; - svm_set_dirty(sc, vcpu, VMCB_CACHE_TPR); - } else if (need_intr_window) { + if (need_intr_window) { /* * We use V_IRQ in conjunction with the VINTR intercept to * trap into the hypervisor as soon as a virtual interrupt From owner-svn-src-all@freebsd.org Wed Jan 31 13:40:37 2018 Return-Path: Delivered-To: svn-src-all@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 2FE4FECBDA4; Wed, 31 Jan 2018 13:40:37 +0000 (UTC) (envelope-from hselasky@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 D4EAD8427C; Wed, 31 Jan 2018 13:40:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCCD326A8C; Wed, 31 Jan 2018 13:40:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VDeaQL001844; Wed, 31 Jan 2018 13:40:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VDea8o001843; Wed, 31 Jan 2018 13:40:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801311340.w0VDea8o001843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 31 Jan 2018 13:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328623 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 328623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 13:40:37 -0000 Author: hselasky Date: Wed Jan 31 13:40:36 2018 New Revision: 328623 URL: https://svnweb.freebsd.org/changeset/base/328623 Log: Properly implement the cond_resched() function macro in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sched.h Wed Jan 31 11:14:26 2018 (r328622) +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Wed Jan 31 13:40:36 2018 (r328623) @@ -110,7 +110,7 @@ put_task_struct(struct task_struct *task) linux_free_current(task); } -#define cond_resched() if (!cold) sched_relinquish(curthread) +#define cond_resched() do { if (!cold) sched_relinquish(curthread); } while (0) #define yield() kern_yield(PRI_UNCHANGED) #define sched_yield() sched_relinquish(curthread) From owner-svn-src-all@freebsd.org Wed Jan 31 14:25:43 2018 Return-Path: Delivered-To: svn-src-all@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 25C9EECE42F; Wed, 31 Jan 2018 14:25:43 +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 C81AB86051; Wed, 31 Jan 2018 14:25:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE62E2717A; Wed, 31 Jan 2018 14:25:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VEPgsi026073; Wed, 31 Jan 2018 14:25:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VEPgNY026072; Wed, 31 Jan 2018 14:25:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801311425.w0VEPgNY026072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 31 Jan 2018 14:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328624 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 328624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:25:43 -0000 Author: kib Date: Wed Jan 31 14:25:42 2018 New Revision: 328624 URL: https://svnweb.freebsd.org/changeset/base/328624 Log: Do not enable PTI when IA32_ARCH_CAP_RDCL_NO bit is set. Intel document 336996-001 claims that this will be the way to inform about Meltdown correction. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Wed Jan 31 13:40:36 2018 (r328623) +++ head/sys/x86/x86/identcpu.c Wed Jan 31 14:25:42 2018 (r328624) @@ -1614,7 +1614,8 @@ pti_get_default(void) if (strcmp(cpu_vendor, AMD_VENDOR_ID) == 0) return (0); - + if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_RDCL_NO) != 0) + return (0); return (1); } From owner-svn-src-all@freebsd.org Wed Jan 31 14:36:29 2018 Return-Path: Delivered-To: svn-src-all@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 5AC61ECEC1A; Wed, 31 Jan 2018 14:36:29 +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 040EF86743; Wed, 31 Jan 2018 14:36:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8EC32731B; Wed, 31 Jan 2018 14:36:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VEaSi2030853; Wed, 31 Jan 2018 14:36:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VEaRrZ030839; Wed, 31 Jan 2018 14:36:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801311436.w0VEaRrZ030839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 31 Jan 2018 14:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 X-SVN-Commit-Revision: 328625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:36:29 -0000 Author: kib Date: Wed Jan 31 14:36:27 2018 New Revision: 328625 URL: https://svnweb.freebsd.org/changeset/base/328625 Log: IBRS support, AKA Spectre hardware mitigation. It is coded according to the Intel document 336996-001, reading of the patches posted on lkml, and some additional consultations with Intel. For existing processors, you need a microcode update which adds IBRS CPU features, and to manually enable it by setting the tunable/sysctl hw.ibrs_disable to 0. Current status can be checked in sysctl hw.ibrs_active. The mitigation might be inactive if the CPU feature is not patched in, or if CPU reports that IBRS use is not required, by IA32_ARCH_CAP_IBRS_ALL bit. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14029 Modified: head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/initcpu.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/support.S head/sys/amd64/ia32/ia32_exception.S head/sys/amd64/include/md_var.h head/sys/amd64/include/pcpu.h head/sys/dev/cpuctl/cpuctl.c head/sys/i386/i386/support.s head/sys/x86/include/specialreg.h head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/exception.S Wed Jan 31 14:36:27 2018 (r328625) @@ -171,21 +171,22 @@ X\l: alltraps: movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz alltraps_segs /* already running with kernel GS.base */ + jz 1f /* already running with kernel GS.base */ swapgs movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) -alltraps_segs: - SAVE_SEGS - testl $PSL_I,TF_RFLAGS(%rsp) - jz alltraps_pushregs_no_rdi - sti -alltraps_pushregs_no_rdi: +1: SAVE_SEGS movq %rdx,TF_RDX(%rsp) movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + testb $SEL_RPL_MASK,TF_CS(%rsp) + jz 2f + call handle_ibrs_entry +2: testl $PSL_I,TF_RFLAGS(%rsp) + jz alltraps_pushregs_no_rax + sti alltraps_pushregs_no_rax: movq %rsi,TF_RSI(%rsp) - movq %rcx,TF_RCX(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) movq %rbx,TF_RBX(%rsp) @@ -243,13 +244,18 @@ calltrap: alltraps_noen: movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz alltraps_noen_segs /* already running with kernel GS.base */ + jz 1f /* already running with kernel GS.base */ swapgs movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) -alltraps_noen_segs: - SAVE_SEGS - jmp alltraps_pushregs_no_rdi +1: SAVE_SEGS + movq %rdx,TF_RDX(%rsp) + movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + testb $SEL_RPL_MASK,TF_CS(%rsp) + jz alltraps_pushregs_no_rax + call handle_ibrs_entry + jmp alltraps_pushregs_no_rax IDTVEC(dblfault) subq $TF_ERR,%rsp @@ -301,12 +307,14 @@ IDTVEC(page_pti) movq %rdi,TF_RDI(%rsp) movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) jmp page_u IDTVEC(page) subq $TF_ERR,%rsp movq %rdi,TF_RDI(%rsp) /* free up GP registers */ movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz page_cr2 /* already running with kernel GS.base */ swapgs @@ -314,6 +322,7 @@ page_u: movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) movq PCPU(SAVED_UCR3),%rax movq %rax,PCB_SAVED_UCR3(%rdi) + call handle_ibrs_entry page_cr2: movq %cr2,%rdi /* preserve %cr2 before .. */ movq %rdi,TF_ADDR(%rsp) /* enabling interrupts. */ @@ -371,6 +380,7 @@ prot_addrf: movq %rdi,TF_RDI(%rsp) /* free up a GP register */ movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) leaq doreti_iret(%rip),%rdi @@ -396,7 +406,8 @@ prot_addrf: 3: cmpw $KUG32SEL,TF_GS(%rsp) jne 4f movq %rdx,PCB_GSBASE(%rdi) -4: orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ +4: call handle_ibrs_entry + orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) @@ -440,7 +451,9 @@ fast_syscall_common: movq %r11,TF_RSP(%rsp) /* user stack pointer */ movq PCPU(SCRATCH_RAX),%rax movq %rax,TF_RAX(%rsp) /* syscall number */ + movq %rdx,TF_RDX(%rsp) /* arg 3 */ SAVE_SEGS + call handle_ibrs_entry movq PCPU(CURPCB),%r11 andl $~PCB_FULL_IRET,PCB_FLAGS(%r11) sti @@ -449,7 +462,6 @@ fast_syscall_common: movq $2,TF_ERR(%rsp) movq %rdi,TF_RDI(%rsp) /* arg 1 */ movq %rsi,TF_RSI(%rsp) /* arg 2 */ - movq %rdx,TF_RDX(%rsp) /* arg 3 */ movq %r10,TF_RCX(%rsp) /* arg 4 */ movq %r8,TF_R8(%rsp) /* arg 5 */ movq %r9,TF_R9(%rsp) /* arg 6 */ @@ -475,6 +487,7 @@ fast_syscall_common: movq PCPU(CURTHREAD),%rax testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) jne 3f + call handle_ibrs_exit /* Restore preserved registers. */ MEXITCOUNT movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ @@ -561,8 +574,8 @@ IDTVEC(nmi) testb $SEL_RPL_MASK,TF_CS(%rsp) jnz nmi_fromuserspace /* - * We've interrupted the kernel. Preserve GS.base in %r12 - * and %cr3 in %r13. + * We've interrupted the kernel. Preserve GS.base in %r12, + * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. */ movl $MSR_GSBASE,%ecx rdmsr @@ -577,8 +590,14 @@ IDTVEC(nmi) movq %cr3,%r13 movq PCPU(KCR3),%rax cmpq $~0,%rax - je nmi_calltrap + je 1f movq %rax,%cr3 +1: testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je nmi_calltrap + movl $MSR_IA32_SPEC_CTRL,%ecx + rdmsr + movl %eax,%r14d + call handle_ibrs_entry jmp nmi_calltrap nmi_fromuserspace: incl %ebx @@ -588,7 +607,8 @@ nmi_fromuserspace: cmpq $~0,%rax je 1f movq %rax,%cr3 -1: movq PCPU(CURPCB),%rdi +1: call handle_ibrs_entry + movq PCPU(CURPCB),%rdi testq %rdi,%rdi jz 3f orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) @@ -683,9 +703,18 @@ nocallchain: testl %ebx,%ebx /* %ebx == 0 => return to userland */ jnz doreti_exit /* + * Restore speculation control MSR, if preserved. + */ + testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je 1f + movl %r14d,%eax + xorl %edx,%edx + movl $MSR_IA32_SPEC_CTRL,%ecx + wrmsr + /* * Put back the preserved MSR_GSBASE value. */ - movl $MSR_GSBASE,%ecx +1: movl $MSR_GSBASE,%ecx movq %r12,%rdx movl %edx,%eax shrq $32,%rdx @@ -743,8 +772,8 @@ IDTVEC(mchk) testb $SEL_RPL_MASK,TF_CS(%rsp) jnz mchk_fromuserspace /* - * We've interrupted the kernel. Preserve GS.base in %r12 - * and %cr3 in %r13. + * We've interrupted the kernel. Preserve GS.base in %r12, + * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. */ movl $MSR_GSBASE,%ecx rdmsr @@ -759,8 +788,14 @@ IDTVEC(mchk) movq %cr3,%r13 movq PCPU(KCR3),%rax cmpq $~0,%rax - je mchk_calltrap + je 1f movq %rax,%cr3 +1: testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je mchk_calltrap + movl $MSR_IA32_SPEC_CTRL,%ecx + rdmsr + movl %eax,%r14d + call handle_ibrs_entry jmp mchk_calltrap mchk_fromuserspace: incl %ebx @@ -770,7 +805,7 @@ mchk_fromuserspace: cmpq $~0,%rax je 1f movq %rax,%cr3 -1: +1: call handle_ibrs_entry /* Note: this label is also used by ddb and gdb: */ mchk_calltrap: FAKE_MCOUNT(TF_RIP(%rsp)) @@ -780,9 +815,18 @@ mchk_calltrap: testl %ebx,%ebx /* %ebx == 0 => return to userland */ jnz doreti_exit /* + * Restore speculation control MSR, if preserved. + */ + testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je 1f + movl %r14d,%eax + xorl %edx,%edx + movl $MSR_IA32_SPEC_CTRL,%ecx + wrmsr + /* * Put back the preserved MSR_GSBASE value. */ - movl $MSR_GSBASE,%ecx +1: movl $MSR_GSBASE,%ecx movq %r12,%rdx movl %edx,%eax shrq $32,%rdx @@ -960,6 +1004,7 @@ ld_regs: testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 2f /* keep running with kernel GS.base */ cli + call handle_ibrs_exit_rs cmpb $0,pti je 1f pushq %rdx @@ -1011,6 +1056,10 @@ set_segs: .globl doreti_iret_fault doreti_iret_fault: subq $TF_RIP,%rsp /* space including tf_err, tf_trapno */ + movq %rax,TF_RAX(%rsp) + movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) + call handle_ibrs_entry testb $SEL_RPL_MASK,TF_CS(%rsp) jz 1f sti @@ -1019,11 +1068,8 @@ doreti_iret_fault: movl $TF_HASSEGS,TF_FLAGS(%rsp) movq %rdi,TF_RDI(%rsp) movq %rsi,TF_RSI(%rsp) - movq %rdx,TF_RDX(%rsp) - movq %rcx,TF_RCX(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) - movq %rax,TF_RAX(%rsp) movq %rbx,TF_RBX(%rsp) movq %rbp,TF_RBP(%rsp) movq %r10,TF_R10(%rsp) Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/genassym.c Wed Jan 31 14:36:27 2018 (r328625) @@ -228,6 +228,7 @@ ASSYM(PC_UCR3, offsetof(struct pcpu, pc_ucr3)); ASSYM(PC_SAVED_UCR3, offsetof(struct pcpu, pc_saved_ucr3)); ASSYM(PC_PTI_STACK, offsetof(struct pcpu, pc_pti_stack)); ASSYM(PC_PTI_STACK_SZ, PC_PTI_STACK_SZ); +ASSYM(PC_IBPB_SET, offsetof(struct pcpu, pc_ibpb_set)); ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); ASSYM(LA_ISR, LAPIC_ISR0 * LAPIC_MEM_MUL); Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/initcpu.c Wed Jan 31 14:36:27 2018 (r328625) @@ -223,6 +223,7 @@ initializecpu(void) wrmsr(MSR_EFER, msr); pg_nx = PG_NX; } + hw_ibrs_recalculate(); switch (cpu_vendor_id) { case CPU_VENDOR_AMD: init_amd(); Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/machdep.c Wed Jan 31 14:36:27 2018 (r328625) @@ -1826,6 +1826,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) #endif thread0.td_critnest = 0; + TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); + TSEXIT(); /* Location of kernel stack for locore */ Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/support.S Wed Jan 31 14:36:27 2018 (r328625) @@ -33,6 +33,7 @@ #include "opt_ddb.h" #include +#include #include #include "assym.s" @@ -850,3 +851,67 @@ ENTRY(pmap_pti_pcid_invlrng) movq %rsi,%cr3 /* back to kernel */ popfq retq + + .altmacro + .macro ibrs_seq_label l +handle_ibrs_\l: + .endm + .macro ibrs_call_label l + call handle_ibrs_\l + .endm + .macro ibrs_seq count + ll=1 + .rept \count + ibrs_call_label %(ll) + nop + ibrs_seq_label %(ll) + addq $8,%rsp + ll=ll+1 + .endr + .endm + +/* all callers already saved %rax, %rdx, and %rcx */ +ENTRY(handle_ibrs_entry) + cmpb $0,hw_ibrs_active(%rip) + je 1f + movl $MSR_IA32_SPEC_CTRL,%ecx + movl $IA32_SPEC_CTRL_IBRS,%eax + movl $IA32_SPEC_CTRL_IBRS>>32,%edx + wrmsr + movb $1,PCPU(IBPB_SET) + testl $CPUID_STDEXT_SMEP,cpu_stdext_feature(%rip) + jne 1f + ibrs_seq 32 +1: ret +END(handle_ibrs_entry) + +ENTRY(handle_ibrs_exit) + cmpb $0,PCPU(IBPB_SET) + je 1f + movl $MSR_IA32_SPEC_CTRL,%ecx + xorl %eax,%eax + xorl %edx,%edx + wrmsr + movb $0,PCPU(IBPB_SET) +1: ret +END(handle_ibrs_exit) + +/* registers-neutral version, but needs stack */ +ENTRY(handle_ibrs_exit_rs) + cmpb $0,PCPU(IBPB_SET) + je 1f + pushq %rax + pushq %rdx + pushq %rcx + movl $MSR_IA32_SPEC_CTRL,%ecx + xorl %eax,%eax + xorl %edx,%edx + wrmsr + popq %rcx + popq %rdx + popq %rax + movb $0,PCPU(IBPB_SET) +1: ret +END(handle_ibrs_exit_rs) + + .noaltmacro Modified: head/sys/amd64/ia32/ia32_exception.S ============================================================================== --- head/sys/amd64/ia32/ia32_exception.S Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/ia32/ia32_exception.S Wed Jan 31 14:36:27 2018 (r328625) @@ -53,13 +53,14 @@ int0x80_syscall_common: movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) SAVE_SEGS - sti - movq %rsi,TF_RSI(%rsp) + movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) movq %rcx,TF_RCX(%rsp) + call handle_ibrs_entry + sti + movq %rsi,TF_RSI(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) - movq %rax,TF_RAX(%rsp) movq %rbx,TF_RBX(%rsp) movq %rbp,TF_RBP(%rsp) movq %r10,TF_R10(%rsp) Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/include/md_var.h Wed Jan 31 14:36:27 2018 (r328625) @@ -38,6 +38,7 @@ extern uint64_t *vm_page_dump; extern int hw_lower_amd64_sharedpage; +extern int hw_ibrs_disable; /* * The file "conf/ldscript.amd64" defines the symbol "kernphys". Its Modified: head/sys/amd64/include/pcpu.h ============================================================================== --- head/sys/amd64/include/pcpu.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/include/pcpu.h Wed Jan 31 14:36:27 2018 (r328625) @@ -74,7 +74,8 @@ uint32_t pc_pcid_next; \ uint32_t pc_pcid_gen; \ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ - char __pad[224] /* be divisor of PAGE_SIZE \ + uint32_t pc_ibpb_set; \ + char __pad[216] /* be divisor of PAGE_SIZE \ after cache alignment */ #define PC_DBREG_CMD_NONE 0 Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/dev/cpuctl/cpuctl.c Wed Jan 31 14:36:27 2018 (r328625) @@ -527,6 +527,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td set_cpu(cpu, td); identify_cpu1(); identify_cpu2(); + hw_ibrs_recalculate(); restore_cpu(oldcpu, is_bound, td); printcpuinfo(); return (0); Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/i386/i386/support.s Wed Jan 31 14:36:27 2018 (r328625) @@ -827,3 +827,11 @@ msr_onfault: movl $0,PCB_ONFAULT(%ecx) movl $EFAULT,%eax ret + +ENTRY(handle_ibrs_entry) + ret +END(handle_ibrs_entry) + +ENTRY(handle_ibrs_exit) + ret +END(handle_ibrs_exit) Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/x86/include/specialreg.h Wed Jan 31 14:36:27 2018 (r328625) @@ -697,6 +697,10 @@ #define IA32_MISC_EN_xTPRD 0x0000000000800000ULL #define IA32_MISC_EN_XDD 0x0000000400000000ULL +/* + * IA32_SPEC_CTRL and IA32_PRED_CMD MSRs are described in the Intel' + * document 336996-001 Speculative Execution Side Channel Mitigations. + */ /* MSR IA32_SPEC_CTRL */ #define IA32_SPEC_CTRL_IBRS 0x0000000000000001ULL #define IA32_SPEC_CTRL_STIBP 0x0000000000000002ULL Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/x86/include/x86_var.h Wed Jan 31 14:36:27 2018 (r328625) @@ -131,6 +131,9 @@ bool fix_cpuid(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); int is_physical_memory(vm_paddr_t addr); int isa_nmi(int cd); +void handle_ibrs_entry(void); +void handle_ibrs_exit(void); +void hw_ibrs_recalculate(void); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); void nmi_handle_intr(u_int type, struct trapframe *frame); Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/x86/x86/cpu_machdep.c Wed Jan 31 14:36:27 2018 (r328625) @@ -142,6 +142,12 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint) int *state; /* + * A comment in Linux patch claims that 'CPUs run faster with + * speculation protection disabled. All CPU threads in a core + * must disable speculation protection for it to be + * disabled. Disable it while we are idle so the other + * hyperthread can run fast.' + * * XXXKIB. Software coordination mode should be supported, * but all Intel CPUs provide hardware coordination. */ @@ -150,9 +156,11 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint) KASSERT(*state == STATE_SLEEPING, ("cpu_mwait_cx: wrong monitorbuf state")); *state = STATE_MWAIT; + handle_ibrs_entry(); cpu_monitor(state, 0, 0); if (*state == STATE_MWAIT) cpu_mwait(MWAIT_INTRBREAK, mwait_hint); + handle_ibrs_exit(); /* * We should exit on any event that interrupts mwait, because @@ -569,3 +577,47 @@ nmi_handle_intr(u_int type, struct trapframe *frame) nmi_call_kdb(PCPU_GET(cpuid), type, frame); #endif } + +int hw_ibrs_active; +int hw_ibrs_disable = 1; + +SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0, + "IBRS active"); + +void +hw_ibrs_recalculate(void) +{ + uint64_t v; + + if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_IBRS_ALL) != 0) { + if (hw_ibrs_disable) { + v= rdmsr(MSR_IA32_SPEC_CTRL); + v &= ~IA32_SPEC_CTRL_IBRS; + wrmsr(MSR_IA32_SPEC_CTRL, v); + } else { + v= rdmsr(MSR_IA32_SPEC_CTRL); + v |= IA32_SPEC_CTRL_IBRS; + wrmsr(MSR_IA32_SPEC_CTRL, v); + } + return; + } + hw_ibrs_active = (cpu_stdext_feature3 & CPUID_STDEXT3_IBPB) != 0 && + !hw_ibrs_disable; +} + +static int +hw_ibrs_disable_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = hw_ibrs_disable; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + hw_ibrs_disable = val != 0; + hw_ibrs_recalculate(); + return (0); +} +SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | CTLFLAG_RWTUN | + CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I", + "Disable IBRS"); From owner-svn-src-all@freebsd.org Wed Jan 31 14:44:52 2018 Return-Path: Delivered-To: svn-src-all@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 A97EEECF2C4; Wed, 31 Jan 2018 14:44:52 +0000 (UTC) (envelope-from avg@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 5631B86C5E; Wed, 31 Jan 2018 14:44:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32935274B0; Wed, 31 Jan 2018 14:44:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VEiqI4036128; Wed, 31 Jan 2018 14:44:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VEiqTV036127; Wed, 31 Jan 2018 14:44:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201801311444.w0VEiqTV036127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 31 Jan 2018 14:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328626 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:44:52 -0000 Author: avg Date: Wed Jan 31 14:44:51 2018 New Revision: 328626 URL: https://svnweb.freebsd.org/changeset/base/328626 Log: zfs_rezget: drop cached pages before doing anything else We did that in the case of success to prevent the use of stale cached data, but it makes even less sense to keep the cached data when we fail. Ideally, we should call vgone() on the vnode in the case of zfs_rezget failure, but the current lock order prevents us from doing that. The change also rearranges the order of unlinked check and the size change check. While there, add missing SET_ERROR in one of the error paths. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Jan 31 14:36:27 2018 (r328625) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Jan 31 14:44:51 2018 (r328626) @@ -1250,6 +1250,16 @@ zfs_rezget(znode_t *zp) int count = 0; uint64_t gen; + /* + * Remove cached pages before reloading the znode, so that they are not + * lingering after we run into any error. Ideally, we should vgone() + * the vnode in case of error, but currently we cannot do that + * because of the LOR between the vnode lock and z_teardown_lock. + * So, instead, we have to "doom" the znode in the illumos style. + */ + vp = ZTOV(zp); + vn_pages_remove(vp, 0, 0); + ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num); mutex_enter(&zp->z_acl_lock); @@ -1329,18 +1339,12 @@ zfs_rezget(znode_t *zp) * (e.g. via a look-up). The old vnode and znode will be * recycled when the last vnode reference is dropped. */ - vp = ZTOV(zp); if (vp->v_type != IFTOVT((mode_t)zp->z_mode)) { zfs_znode_dmu_fini(zp); ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); - return (EIO); + return (SET_ERROR(EIO)); } - zp->z_blksz = doi.doi_data_block_size; - vn_pages_remove(vp, 0, 0); - if (zp->z_size != size) - vnode_pager_setsize(vp, zp->z_size); - /* * If the file has zero links, then it has been unlinked on the send * side and it must be in the received unlinked set. @@ -1351,8 +1355,15 @@ zfs_rezget(znode_t *zp) * when the unlinked set gets processed. */ zp->z_unlinked = (zp->z_links == 0); - if (zp->z_unlinked) + if (zp->z_unlinked) { zfs_znode_dmu_fini(zp); + ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); + return (0); + } + + zp->z_blksz = doi.doi_data_block_size; + if (zp->z_size != size) + vnode_pager_setsize(vp, zp->z_size); ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); From owner-svn-src-all@freebsd.org Wed Jan 31 14:52:51 2018 Return-Path: Delivered-To: svn-src-all@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 26D63ECF7FA; Wed, 31 Jan 2018 14:52:51 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (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 B91B787115; Wed, 31 Jan 2018 14:52:50 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp003.me.com by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P3F00G00AY2CN00@mr11p00im-asmtp003.me.com>; Wed, 31 Jan 2018 14:52:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1517410368; bh=Flkmgj6SuB+Tb1WDxy2f3NGPpWeIbyxSxtjQTS8d4PM=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=RPd+J0hIxz8WjHq4VxyM2PCNqpMGXJd5FUj/kztIt+1LjOetnLCcJEr18gGt9eteu bMdgZmY9kvZ13Kf2WIXSSkxGcq0SkQRQqpT9KKoK5JOjXcOettLzpPWpavnlkYbt2j oJvZ50khS5hmKdTfsrs9f/NH5o/QDCSXHOtefintEDUc50DiWj0AZawZ7XUR/cukVm uotv6iJHbRYXUBiMOJ72uP0uzf4hzlK1MCbqINB0CPHCMvwUV6Z+UyEQ3Kru2FL5gE rb3DKth5Q7tlUzaG6/yP7R58o2H/fqQDjkoV7DvQT7obZcKkCA/HW3wSX/aaU2YDPR YwpTzS1EUX7ow== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P3F0001ADBWPW20@mr11p00im-asmtp003.me.com>; Wed, 31 Jan 2018 14:52:47 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-31_07:,, 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-1801310195 User-Agent: Microsoft-MacOutlook/10.9.0.180116 Date: Wed, 31 Jan 2018 06:52:43 -0800 Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 From: Ravi Pokala To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: Thread-topic: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 References: <201801311436.w0VEaRrZ030839@repo.freebsd.org> In-reply-to: <201801311436.w0VEaRrZ030839@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:52:51 -0000 Thanks Kostik! Quick question: IBRS stands for...? For that matter, in the previous change= , what does RDCL_NO stand for too? -Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Konstantin Belousov <= kib@FreeBSD.org> Date: 2018-01-31, Wednesday at 06:36 To: , , Subject: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/in= clude dev/cpuctl i386/i386 x86/include x86/x86 Author: kib Date: Wed Jan 31 14:36:27 2018 New Revision: 328625 URL: https://svnweb.freebsd.org/changeset/base/328625 Log: IBRS support, AKA Spectre hardware mitigation. =20 It is coded according to the Intel document 336996-001, reading of the patches posted on lkml, and some additional consultations with Intel. =20 For existing processors, you need a microcode update which adds IBRS CPU features, and to manually enable it by setting the tunable/sysctl hw.ibrs_disable to 0. Current status can be checked in sysctl hw.ibrs_active. The mitigation might be inactive if the CPU feature is not patched in, or if CPU reports that IBRS use is not required, by IA32_ARCH_CAP_IBRS_ALL bit. =20 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14029 Modified: head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/initcpu.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/support.S head/sys/amd64/ia32/ia32_exception.S head/sys/amd64/include/md_var.h head/sys/amd64/include/pcpu.h head/sys/dev/cpuctl/cpuctl.c head/sys/i386/i386/support.s head/sys/x86/include/specialreg.h head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c Modified: head/sys/amd64/amd64/exception.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/amd64/amd64/exception.S Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/exception.S Wed Jan 31 14:36:27 2018 (r328625) @@ -171,21 +171,22 @@ X\l: alltraps: movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz alltraps_segs /* already running with kernel GS.base */ + jz 1f /* already running with kernel GS.base */ swapgs movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) -alltraps_segs: - SAVE_SEGS - testl $PSL_I,TF_RFLAGS(%rsp) - jz alltraps_pushregs_no_rdi - sti -alltraps_pushregs_no_rdi: +1: SAVE_SEGS movq %rdx,TF_RDX(%rsp) movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + testb $SEL_RPL_MASK,TF_CS(%rsp) + jz 2f + call handle_ibrs_entry +2: testl $PSL_I,TF_RFLAGS(%rsp) + jz alltraps_pushregs_no_rax + sti alltraps_pushregs_no_rax: movq %rsi,TF_RSI(%rsp) - movq %rcx,TF_RCX(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) movq %rbx,TF_RBX(%rsp) @@ -243,13 +244,18 @@ calltrap: alltraps_noen: movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz alltraps_noen_segs /* already running with kernel GS.base */ + jz 1f /* already running with kernel GS.base */ swapgs movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) -alltraps_noen_segs: - SAVE_SEGS - jmp alltraps_pushregs_no_rdi +1: SAVE_SEGS + movq %rdx,TF_RDX(%rsp) + movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + testb $SEL_RPL_MASK,TF_CS(%rsp) + jz alltraps_pushregs_no_rax + call handle_ibrs_entry + jmp alltraps_pushregs_no_rax =20 IDTVEC(dblfault) subq $TF_ERR,%rsp @@ -301,12 +307,14 @@ IDTVEC(page_pti) movq %rdi,TF_RDI(%rsp) movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) jmp page_u IDTVEC(page) subq $TF_ERR,%rsp movq %rdi,TF_RDI(%rsp) /* free up GP registers */ movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz page_cr2 /* already running with kernel GS.base */ swapgs @@ -314,6 +322,7 @@ page_u: movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) movq PCPU(SAVED_UCR3),%rax movq %rax,PCB_SAVED_UCR3(%rdi) + call handle_ibrs_entry page_cr2: movq %cr2,%rdi /* preserve %cr2 before .. */ movq %rdi,TF_ADDR(%rsp) /* enabling interrupts. */ @@ -371,6 +380,7 @@ prot_addrf: movq %rdi,TF_RDI(%rsp) /* free up a GP register */ movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) leaq doreti_iret(%rip),%rdi @@ -396,7 +406,8 @@ prot_addrf: 3: cmpw $KUG32SEL,TF_GS(%rsp) jne 4f movq %rdx,PCB_GSBASE(%rdi) -4: orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ +4: call handle_ibrs_entry + orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) @@ -440,7 +451,9 @@ fast_syscall_common: movq %r11,TF_RSP(%rsp) /* user stack pointer */ movq PCPU(SCRATCH_RAX),%rax movq %rax,TF_RAX(%rsp) /* syscall number */ + movq %rdx,TF_RDX(%rsp) /* arg 3 */ SAVE_SEGS + call handle_ibrs_entry movq PCPU(CURPCB),%r11 andl $~PCB_FULL_IRET,PCB_FLAGS(%r11) sti @@ -449,7 +462,6 @@ fast_syscall_common: movq $2,TF_ERR(%rsp) movq %rdi,TF_RDI(%rsp) /* arg 1 */ movq %rsi,TF_RSI(%rsp) /* arg 2 */ - movq %rdx,TF_RDX(%rsp) /* arg 3 */ movq %r10,TF_RCX(%rsp) /* arg 4 */ movq %r8,TF_R8(%rsp) /* arg 5 */ movq %r9,TF_R9(%rsp) /* arg 6 */ @@ -475,6 +487,7 @@ fast_syscall_common: movq PCPU(CURTHREAD),%rax testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) jne 3f + call handle_ibrs_exit /* Restore preserved registers. */ MEXITCOUNT movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ @@ -561,8 +574,8 @@ IDTVEC(nmi) testb $SEL_RPL_MASK,TF_CS(%rsp) jnz nmi_fromuserspace /* - * We've interrupted the kernel. Preserve GS.base in %r12 - * and %cr3 in %r13. + * We've interrupted the kernel. Preserve GS.base in %r12, + * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. */ movl $MSR_GSBASE,%ecx rdmsr @@ -577,8 +590,14 @@ IDTVEC(nmi) movq %cr3,%r13 movq PCPU(KCR3),%rax cmpq $~0,%rax - je nmi_calltrap + je 1f movq %rax,%cr3 +1: testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je nmi_calltrap + movl $MSR_IA32_SPEC_CTRL,%ecx + rdmsr + movl %eax,%r14d + call handle_ibrs_entry jmp nmi_calltrap nmi_fromuserspace: incl %ebx @@ -588,7 +607,8 @@ nmi_fromuserspace: cmpq $~0,%rax je 1f movq %rax,%cr3 -1: movq PCPU(CURPCB),%rdi +1: call handle_ibrs_entry + movq PCPU(CURPCB),%rdi testq %rdi,%rdi jz 3f orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) @@ -683,9 +703,18 @@ nocallchain: testl %ebx,%ebx /* %ebx =3D=3D 0 =3D> return to userland */ jnz doreti_exit /* + * Restore speculation control MSR, if preserved. + */ + testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je 1f + movl %r14d,%eax + xorl %edx,%edx + movl $MSR_IA32_SPEC_CTRL,%ecx + wrmsr + /* * Put back the preserved MSR_GSBASE value. */ - movl $MSR_GSBASE,%ecx +1: movl $MSR_GSBASE,%ecx movq %r12,%rdx movl %edx,%eax shrq $32,%rdx @@ -743,8 +772,8 @@ IDTVEC(mchk) testb $SEL_RPL_MASK,TF_CS(%rsp) jnz mchk_fromuserspace /* - * We've interrupted the kernel. Preserve GS.base in %r12 - * and %cr3 in %r13. + * We've interrupted the kernel. Preserve GS.base in %r12, + * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. */ movl $MSR_GSBASE,%ecx rdmsr @@ -759,8 +788,14 @@ IDTVEC(mchk) movq %cr3,%r13 movq PCPU(KCR3),%rax cmpq $~0,%rax - je mchk_calltrap + je 1f movq %rax,%cr3 +1: testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je mchk_calltrap + movl $MSR_IA32_SPEC_CTRL,%ecx + rdmsr + movl %eax,%r14d + call handle_ibrs_entry jmp mchk_calltrap mchk_fromuserspace: incl %ebx @@ -770,7 +805,7 @@ mchk_fromuserspace: cmpq $~0,%rax je 1f movq %rax,%cr3 -1: +1: call handle_ibrs_entry /* Note: this label is also used by ddb and gdb: */ mchk_calltrap: FAKE_MCOUNT(TF_RIP(%rsp)) @@ -780,9 +815,18 @@ mchk_calltrap: testl %ebx,%ebx /* %ebx =3D=3D 0 =3D> return to userland */ jnz doreti_exit /* + * Restore speculation control MSR, if preserved. + */ + testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je 1f + movl %r14d,%eax + xorl %edx,%edx + movl $MSR_IA32_SPEC_CTRL,%ecx + wrmsr + /* * Put back the preserved MSR_GSBASE value. */ - movl $MSR_GSBASE,%ecx +1: movl $MSR_GSBASE,%ecx movq %r12,%rdx movl %edx,%eax shrq $32,%rdx @@ -960,6 +1004,7 @@ ld_regs: testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 2f /* keep running with kernel GS.base */ cli + call handle_ibrs_exit_rs cmpb $0,pti je 1f pushq %rdx @@ -1011,6 +1056,10 @@ set_segs: .globl doreti_iret_fault doreti_iret_fault: subq $TF_RIP,%rsp /* space including tf_err, tf_trapno */ + movq %rax,TF_RAX(%rsp) + movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) + call handle_ibrs_entry testb $SEL_RPL_MASK,TF_CS(%rsp) jz 1f sti @@ -1019,11 +1068,8 @@ doreti_iret_fault: movl $TF_HASSEGS,TF_FLAGS(%rsp) movq %rdi,TF_RDI(%rsp) movq %rsi,TF_RSI(%rsp) - movq %rdx,TF_RDX(%rsp) - movq %rcx,TF_RCX(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) - movq %rax,TF_RAX(%rsp) movq %rbx,TF_RBX(%rsp) movq %rbp,TF_RBP(%rsp) movq %r10,TF_R10(%rsp) Modified: head/sys/amd64/amd64/genassym.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/amd64/amd64/genassym.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/genassym.c Wed Jan 31 14:36:27 2018 (r328625) @@ -228,6 +228,7 @@ ASSYM(PC_UCR3, offsetof(struct pcpu, pc_ucr3)); ASSYM(PC_SAVED_UCR3, offsetof(struct pcpu, pc_saved_ucr3)); ASSYM(PC_PTI_STACK, offsetof(struct pcpu, pc_pti_stack)); ASSYM(PC_PTI_STACK_SZ, PC_PTI_STACK_SZ); +ASSYM(PC_IBPB_SET, offsetof(struct pcpu, pc_ibpb_set)); =20 ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); ASSYM(LA_ISR, LAPIC_ISR0 * LAPIC_MEM_MUL); Modified: head/sys/amd64/amd64/initcpu.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/amd64/amd64/initcpu.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/initcpu.c Wed Jan 31 14:36:27 2018 (r328625) @@ -223,6 +223,7 @@ initializecpu(void) wrmsr(MSR_EFER, msr); pg_nx =3D PG_NX; } + hw_ibrs_recalculate(); switch (cpu_vendor_id) { case CPU_VENDOR_AMD: init_amd(); Modified: head/sys/amd64/amd64/machdep.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/amd64/amd64/machdep.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/machdep.c Wed Jan 31 14:36:27 2018 (r328625) @@ -1826,6 +1826,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) #endif thread0.td_critnest =3D 0; =20 + TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); + TSEXIT(); =20 /* Location of kernel stack for locore */ Modified: head/sys/amd64/amd64/support.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/amd64/amd64/support.S Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/amd64/support.S Wed Jan 31 14:36:27 2018 (r328625) @@ -33,6 +33,7 @@ #include "opt_ddb.h" =20 #include +#include #include =20 #include "assym.s" @@ -850,3 +851,67 @@ ENTRY(pmap_pti_pcid_invlrng) movq %rsi,%cr3 /* back to kernel */ popfq retq + + .altmacro + .macro ibrs_seq_label l +handle_ibrs_\l: + .endm + .macro ibrs_call_label l + call handle_ibrs_\l + .endm + .macro ibrs_seq count + ll=3D1 + .rept \count + ibrs_call_label %(ll) + nop + ibrs_seq_label %(ll) + addq $8,%rsp + ll=3Dll+1 + .endr + .endm + +/* all callers already saved %rax, %rdx, and %rcx */ +ENTRY(handle_ibrs_entry) + cmpb $0,hw_ibrs_active(%rip) + je 1f + movl $MSR_IA32_SPEC_CTRL,%ecx + movl $IA32_SPEC_CTRL_IBRS,%eax + movl $IA32_SPEC_CTRL_IBRS>>32,%edx + wrmsr + movb $1,PCPU(IBPB_SET) + testl $CPUID_STDEXT_SMEP,cpu_stdext_feature(%rip) + jne 1f + ibrs_seq 32 +1: ret +END(handle_ibrs_entry) + +ENTRY(handle_ibrs_exit) + cmpb $0,PCPU(IBPB_SET) + je 1f + movl $MSR_IA32_SPEC_CTRL,%ecx + xorl %eax,%eax + xorl %edx,%edx + wrmsr + movb $0,PCPU(IBPB_SET) +1: ret +END(handle_ibrs_exit) + +/* registers-neutral version, but needs stack */ +ENTRY(handle_ibrs_exit_rs) + cmpb $0,PCPU(IBPB_SET) + je 1f + pushq %rax + pushq %rdx + pushq %rcx + movl $MSR_IA32_SPEC_CTRL,%ecx + xorl %eax,%eax + xorl %edx,%edx + wrmsr + popq %rcx + popq %rdx + popq %rax + movb $0,PCPU(IBPB_SET) +1: ret +END(handle_ibrs_exit_rs) + + .noaltmacro Modified: head/sys/amd64/ia32/ia32_exception.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/amd64/ia32/ia32_exception.S Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/ia32/ia32_exception.S Wed Jan 31 14:36:27 2018 (r328625) @@ -53,13 +53,14 @@ int0x80_syscall_common: movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) SAVE_SEGS - sti - movq %rsi,TF_RSI(%rsp) + movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) movq %rcx,TF_RCX(%rsp) + call handle_ibrs_entry + sti + movq %rsi,TF_RSI(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) - movq %rax,TF_RAX(%rsp) movq %rbx,TF_RBX(%rsp) movq %rbp,TF_RBP(%rsp) movq %r10,TF_R10(%rsp) Modified: head/sys/amd64/include/md_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/sys/amd64/include/md_var.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/include/md_var.h Wed Jan 31 14:36:27 2018 (r328625) @@ -38,6 +38,7 @@ =20 extern uint64_t *vm_page_dump; extern int hw_lower_amd64_sharedpage; +extern int hw_ibrs_disable; =20 /* * The file "conf/ldscript.amd64" defines the symbol "kernphys". Its Modified: head/sys/amd64/include/pcpu.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/sys/amd64/include/pcpu.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/amd64/include/pcpu.h Wed Jan 31 14:36:27 2018 (r328625) @@ -74,7 +74,8 @@ uint32_t pc_pcid_next; \ uint32_t pc_pcid_gen; \ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ - char __pad[224] /* be divisor of PAGE_SIZE \ + uint32_t pc_ibpb_set; \ + char __pad[216] /* be divisor of PAGE_SIZE \ after cache alignment */ =20 #define PC_DBREG_CMD_NONE 0 Modified: head/sys/dev/cpuctl/cpuctl.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/cpuctl/cpuctl.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/dev/cpuctl/cpuctl.c Wed Jan 31 14:36:27 2018 (r328625) @@ -527,6 +527,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td set_cpu(cpu, td); identify_cpu1(); identify_cpu2(); + hw_ibrs_recalculate(); restore_cpu(oldcpu, is_bound, td); printcpuinfo(); return (0); Modified: head/sys/i386/i386/support.s =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/i386/i386/support.s Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/i386/i386/support.s Wed Jan 31 14:36:27 2018 (r328625) @@ -827,3 +827,11 @@ msr_onfault: movl $0,PCB_ONFAULT(%ecx) movl $EFAULT,%eax ret + +ENTRY(handle_ibrs_entry) + ret +END(handle_ibrs_entry) + +ENTRY(handle_ibrs_exit) + ret +END(handle_ibrs_exit) Modified: head/sys/x86/include/specialreg.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/sys/x86/include/specialreg.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/x86/include/specialreg.h Wed Jan 31 14:36:27 2018 (r328625) @@ -697,6 +697,10 @@ #define IA32_MISC_EN_xTPRD 0x0000000000800000ULL #define IA32_MISC_EN_XDD 0x0000000400000000ULL =20 +/* + * IA32_SPEC_CTRL and IA32_PRED_CMD MSRs are described in the Intel' + * document 336996-001 Speculative Execution Side Channel Mitigations. + */ /* MSR IA32_SPEC_CTRL */ #define IA32_SPEC_CTRL_IBRS 0x0000000000000001ULL #define IA32_SPEC_CTRL_STIBP 0x0000000000000002ULL Modified: head/sys/x86/include/x86_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/sys/x86/include/x86_var.h Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/x86/include/x86_var.h Wed Jan 31 14:36:27 2018 (r328625) @@ -131,6 +131,9 @@ bool fix_cpuid(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); int is_physical_memory(vm_paddr_t addr); int isa_nmi(int cd); +void handle_ibrs_entry(void); +void handle_ibrs_exit(void); +void hw_ibrs_recalculate(void); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); void nmi_handle_intr(u_int type, struct trapframe *frame); Modified: head/sys/x86/x86/cpu_machdep.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/x86/x86/cpu_machdep.c Wed Jan 31 14:25:42 2018 (r328624) +++ head/sys/x86/x86/cpu_machdep.c Wed Jan 31 14:36:27 2018 (r328625) @@ -142,6 +142,12 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint) int *state; =20 /* + * A comment in Linux patch claims that 'CPUs run faster with + * speculation protection disabled. All CPU threads in a core + * must disable speculation protection for it to be + * disabled. Disable it while we are idle so the other + * hyperthread can run fast.' + * * XXXKIB. Software coordination mode should be supported, * but all Intel CPUs provide hardware coordination. */ @@ -150,9 +156,11 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint) KASSERT(*state =3D=3D STATE_SLEEPING, ("cpu_mwait_cx: wrong monitorbuf state")); *state =3D STATE_MWAIT; + handle_ibrs_entry(); cpu_monitor(state, 0, 0); if (*state =3D=3D STATE_MWAIT) cpu_mwait(MWAIT_INTRBREAK, mwait_hint); + handle_ibrs_exit(); =20 /* * We should exit on any event that interrupts mwait, because @@ -569,3 +577,47 @@ nmi_handle_intr(u_int type, struct trapframe *frame) nmi_call_kdb(PCPU_GET(cpuid), type, frame); #endif } + +int hw_ibrs_active; +int hw_ibrs_disable =3D 1; + +SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0, + "IBRS active"); + +void +hw_ibrs_recalculate(void) +{ + uint64_t v; + + if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_IBRS_ALL) !=3D 0) { + if (hw_ibrs_disable) { + v=3D rdmsr(MSR_IA32_SPEC_CTRL); + v &=3D ~IA32_SPEC_CTRL_IBRS; + wrmsr(MSR_IA32_SPEC_CTRL, v); + } else { + v=3D rdmsr(MSR_IA32_SPEC_CTRL); + v |=3D IA32_SPEC_CTRL_IBRS; + wrmsr(MSR_IA32_SPEC_CTRL, v); + } + return; + } + hw_ibrs_active =3D (cpu_stdext_feature3 & CPUID_STDEXT3_IBPB) !=3D 0 && + !hw_ibrs_disable; +} + +static int +hw_ibrs_disable_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val =3D hw_ibrs_disable; + error =3D sysctl_handle_int(oidp, &val, 0, req); + if (error !=3D 0 || req->newptr =3D=3D NULL) + return (error); + hw_ibrs_disable =3D val !=3D 0; + hw_ibrs_recalculate(); + return (0); +} +SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | CTLFLAG_RWTUN | + CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I= ", + "Disable IBRS"); From owner-svn-src-all@freebsd.org Wed Jan 31 14:56:29 2018 Return-Path: Delivered-To: svn-src-all@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 C8D11ECFAE6; Wed, 31 Jan 2018 14:56:29 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 537498734A; Wed, 31 Jan 2018 14:56:29 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 651DF25D385E; Wed, 31 Jan 2018 14:56:27 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id B4085D1F835; Wed, 31 Jan 2018 14:56:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id zGzNSg4DIG4A; Wed, 31 Jan 2018 14:56:25 +0000 (UTC) Received: from [10.248.101.31] (fresh-ayiya.sbone.de [IPv6:fde9:577b:c1a9:f001::2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 33913D1F834; Wed, 31 Jan 2018 14:56:25 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Konstantin Belousov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 Date: Wed, 31 Jan 2018 14:56:24 +0000 X-Mailer: MailMate (2.0BETAr6103) Message-ID: In-Reply-To: <201801311436.w0VEaRrZ030839@repo.freebsd.org> References: <201801311436.w0VEaRrZ030839@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:56:30 -0000 On 31 Jan 2018, at 14:36, Konstantin Belousov wrote: > Author: kib > Date: Wed Jan 31 14:36:27 2018 > New Revision: 328625 > URL: https://svnweb.freebsd.org/changeset/base/328625 > > Log: > IBRS support, AKA Spectre hardware mitigation. > For existing processors, you need a microcode update which adds IBRS > CPU features, and to manually enable it by setting the > tunable/sysctl > hw.ibrs_disable to 0. Current status can be checked in sysctl > hw.ibrs_active. The mitigation might be inactive if the CPU feature Can you change the tunable/sysctl to hw.ibrs_enable[d] (and toggle the default setting along). I find it highly confusing to have two different sysctls “disable” and “active” and a lot of people (and cultures) have trouble with the double negative. Also the “enable[d]” variant seems to be pre-dominant in the kernel. Also can we spell IBRS in the sysctl description as “Indirect Branch Restricted Speculation (IBRS)”? Thanks /bz From owner-svn-src-all@freebsd.org Wed Jan 31 15:02:16 2018 Return-Path: Delivered-To: svn-src-all@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 5DC42ED0035; Wed, 31 Jan 2018 15:02:16 +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 9F4EA87816; Wed, 31 Jan 2018 15:02:15 +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 w0VF24Rv047710 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 31 Jan 2018 17:02:07 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0VF24Rv047710 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0VF24BZ047709; Wed, 31 Jan 2018 17:02:04 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 31 Jan 2018 17:02:04 +0200 From: Konstantin Belousov To: Ravi Pokala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 Message-ID: <20180131150204.GQ97752@kib.kiev.ua> References: <201801311436.w0VEaRrZ030839@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:02:16 -0000 On Wed, Jan 31, 2018 at 06:52:43AM -0800, Ravi Pokala wrote: > Thanks Kostik! > > Quick question: IBRS stands for...? For that matter, in the previous change, what does RDCL_NO stand for too? Indirect Branch Restricted Speculation Rogue Data Cache Load. Read (or at least skim over) the Intel paper I referenced in the commit message. > > -Ravi (rpokala@) > > ???-----Original Message----- > From: on behalf of Konstantin Belousov > Date: 2018-01-31, Wednesday at 06:36 > To: , , > Subject: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 > > Author: kib > Date: Wed Jan 31 14:36:27 2018 > New Revision: 328625 > URL: https://svnweb.freebsd.org/changeset/base/328625 > > Log: > IBRS support, AKA Spectre hardware mitigation. > > It is coded according to the Intel document 336996-001, reading of the > patches posted on lkml, and some additional consultations with Intel. > > For existing processors, you need a microcode update which adds IBRS > CPU features, and to manually enable it by setting the tunable/sysctl > hw.ibrs_disable to 0. Current status can be checked in sysctl > hw.ibrs_active. The mitigation might be inactive if the CPU feature > is not patched in, or if CPU reports that IBRS use is not required, by > IA32_ARCH_CAP_IBRS_ALL bit. > > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D14029 > > Modified: > head/sys/amd64/amd64/exception.S > head/sys/amd64/amd64/genassym.c > head/sys/amd64/amd64/initcpu.c > head/sys/amd64/amd64/machdep.c > head/sys/amd64/amd64/support.S > head/sys/amd64/ia32/ia32_exception.S > head/sys/amd64/include/md_var.h > head/sys/amd64/include/pcpu.h > head/sys/dev/cpuctl/cpuctl.c > head/sys/i386/i386/support.s > head/sys/x86/include/specialreg.h > head/sys/x86/include/x86_var.h > head/sys/x86/x86/cpu_machdep.c > > Modified: head/sys/amd64/amd64/exception.S > ============================================================================== > --- head/sys/amd64/amd64/exception.S Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/amd64/exception.S Wed Jan 31 14:36:27 2018 (r328625) > @@ -171,21 +171,22 @@ X\l: > alltraps: > movq %rdi,TF_RDI(%rsp) > testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ > - jz alltraps_segs /* already running with kernel GS.base */ > + jz 1f /* already running with kernel GS.base */ > swapgs > movq PCPU(CURPCB),%rdi > andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) > -alltraps_segs: > - SAVE_SEGS > - testl $PSL_I,TF_RFLAGS(%rsp) > - jz alltraps_pushregs_no_rdi > - sti > -alltraps_pushregs_no_rdi: > +1: SAVE_SEGS > movq %rdx,TF_RDX(%rsp) > movq %rax,TF_RAX(%rsp) > + movq %rcx,TF_RCX(%rsp) > + testb $SEL_RPL_MASK,TF_CS(%rsp) > + jz 2f > + call handle_ibrs_entry > +2: testl $PSL_I,TF_RFLAGS(%rsp) > + jz alltraps_pushregs_no_rax > + sti > alltraps_pushregs_no_rax: > movq %rsi,TF_RSI(%rsp) > - movq %rcx,TF_RCX(%rsp) > movq %r8,TF_R8(%rsp) > movq %r9,TF_R9(%rsp) > movq %rbx,TF_RBX(%rsp) > @@ -243,13 +244,18 @@ calltrap: > alltraps_noen: > movq %rdi,TF_RDI(%rsp) > testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ > - jz alltraps_noen_segs /* already running with kernel GS.base */ > + jz 1f /* already running with kernel GS.base */ > swapgs > movq PCPU(CURPCB),%rdi > andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) > -alltraps_noen_segs: > - SAVE_SEGS > - jmp alltraps_pushregs_no_rdi > +1: SAVE_SEGS > + movq %rdx,TF_RDX(%rsp) > + movq %rax,TF_RAX(%rsp) > + movq %rcx,TF_RCX(%rsp) > + testb $SEL_RPL_MASK,TF_CS(%rsp) > + jz alltraps_pushregs_no_rax > + call handle_ibrs_entry > + jmp alltraps_pushregs_no_rax > > IDTVEC(dblfault) > subq $TF_ERR,%rsp > @@ -301,12 +307,14 @@ IDTVEC(page_pti) > movq %rdi,TF_RDI(%rsp) > movq %rax,TF_RAX(%rsp) > movq %rdx,TF_RDX(%rsp) > + movq %rcx,TF_RCX(%rsp) > jmp page_u > IDTVEC(page) > subq $TF_ERR,%rsp > movq %rdi,TF_RDI(%rsp) /* free up GP registers */ > movq %rax,TF_RAX(%rsp) > movq %rdx,TF_RDX(%rsp) > + movq %rcx,TF_RCX(%rsp) > testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ > jz page_cr2 /* already running with kernel GS.base */ > swapgs > @@ -314,6 +322,7 @@ page_u: movq PCPU(CURPCB),%rdi > andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) > movq PCPU(SAVED_UCR3),%rax > movq %rax,PCB_SAVED_UCR3(%rdi) > + call handle_ibrs_entry > page_cr2: > movq %cr2,%rdi /* preserve %cr2 before .. */ > movq %rdi,TF_ADDR(%rsp) /* enabling interrupts. */ > @@ -371,6 +380,7 @@ prot_addrf: > movq %rdi,TF_RDI(%rsp) /* free up a GP register */ > movq %rax,TF_RAX(%rsp) > movq %rdx,TF_RDX(%rsp) > + movq %rcx,TF_RCX(%rsp) > movw %fs,TF_FS(%rsp) > movw %gs,TF_GS(%rsp) > leaq doreti_iret(%rip),%rdi > @@ -396,7 +406,8 @@ prot_addrf: > 3: cmpw $KUG32SEL,TF_GS(%rsp) > jne 4f > movq %rdx,PCB_GSBASE(%rdi) > -4: orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ > +4: call handle_ibrs_entry > + orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ > movw %es,TF_ES(%rsp) > movw %ds,TF_DS(%rsp) > testl $PSL_I,TF_RFLAGS(%rsp) > @@ -440,7 +451,9 @@ fast_syscall_common: > movq %r11,TF_RSP(%rsp) /* user stack pointer */ > movq PCPU(SCRATCH_RAX),%rax > movq %rax,TF_RAX(%rsp) /* syscall number */ > + movq %rdx,TF_RDX(%rsp) /* arg 3 */ > SAVE_SEGS > + call handle_ibrs_entry > movq PCPU(CURPCB),%r11 > andl $~PCB_FULL_IRET,PCB_FLAGS(%r11) > sti > @@ -449,7 +462,6 @@ fast_syscall_common: > movq $2,TF_ERR(%rsp) > movq %rdi,TF_RDI(%rsp) /* arg 1 */ > movq %rsi,TF_RSI(%rsp) /* arg 2 */ > - movq %rdx,TF_RDX(%rsp) /* arg 3 */ > movq %r10,TF_RCX(%rsp) /* arg 4 */ > movq %r8,TF_R8(%rsp) /* arg 5 */ > movq %r9,TF_R9(%rsp) /* arg 6 */ > @@ -475,6 +487,7 @@ fast_syscall_common: > movq PCPU(CURTHREAD),%rax > testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) > jne 3f > + call handle_ibrs_exit > /* Restore preserved registers. */ > MEXITCOUNT > movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ > @@ -561,8 +574,8 @@ IDTVEC(nmi) > testb $SEL_RPL_MASK,TF_CS(%rsp) > jnz nmi_fromuserspace > /* > - * We've interrupted the kernel. Preserve GS.base in %r12 > - * and %cr3 in %r13. > + * We've interrupted the kernel. Preserve GS.base in %r12, > + * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. > */ > movl $MSR_GSBASE,%ecx > rdmsr > @@ -577,8 +590,14 @@ IDTVEC(nmi) > movq %cr3,%r13 > movq PCPU(KCR3),%rax > cmpq $~0,%rax > - je nmi_calltrap > + je 1f > movq %rax,%cr3 > +1: testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) > + je nmi_calltrap > + movl $MSR_IA32_SPEC_CTRL,%ecx > + rdmsr > + movl %eax,%r14d > + call handle_ibrs_entry > jmp nmi_calltrap > nmi_fromuserspace: > incl %ebx > @@ -588,7 +607,8 @@ nmi_fromuserspace: > cmpq $~0,%rax > je 1f > movq %rax,%cr3 > -1: movq PCPU(CURPCB),%rdi > +1: call handle_ibrs_entry > + movq PCPU(CURPCB),%rdi > testq %rdi,%rdi > jz 3f > orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) > @@ -683,9 +703,18 @@ nocallchain: > testl %ebx,%ebx /* %ebx == 0 => return to userland */ > jnz doreti_exit > /* > + * Restore speculation control MSR, if preserved. > + */ > + testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) > + je 1f > + movl %r14d,%eax > + xorl %edx,%edx > + movl $MSR_IA32_SPEC_CTRL,%ecx > + wrmsr > + /* > * Put back the preserved MSR_GSBASE value. > */ > - movl $MSR_GSBASE,%ecx > +1: movl $MSR_GSBASE,%ecx > movq %r12,%rdx > movl %edx,%eax > shrq $32,%rdx > @@ -743,8 +772,8 @@ IDTVEC(mchk) > testb $SEL_RPL_MASK,TF_CS(%rsp) > jnz mchk_fromuserspace > /* > - * We've interrupted the kernel. Preserve GS.base in %r12 > - * and %cr3 in %r13. > + * We've interrupted the kernel. Preserve GS.base in %r12, > + * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. > */ > movl $MSR_GSBASE,%ecx > rdmsr > @@ -759,8 +788,14 @@ IDTVEC(mchk) > movq %cr3,%r13 > movq PCPU(KCR3),%rax > cmpq $~0,%rax > - je mchk_calltrap > + je 1f > movq %rax,%cr3 > +1: testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) > + je mchk_calltrap > + movl $MSR_IA32_SPEC_CTRL,%ecx > + rdmsr > + movl %eax,%r14d > + call handle_ibrs_entry > jmp mchk_calltrap > mchk_fromuserspace: > incl %ebx > @@ -770,7 +805,7 @@ mchk_fromuserspace: > cmpq $~0,%rax > je 1f > movq %rax,%cr3 > -1: > +1: call handle_ibrs_entry > /* Note: this label is also used by ddb and gdb: */ > mchk_calltrap: > FAKE_MCOUNT(TF_RIP(%rsp)) > @@ -780,9 +815,18 @@ mchk_calltrap: > testl %ebx,%ebx /* %ebx == 0 => return to userland */ > jnz doreti_exit > /* > + * Restore speculation control MSR, if preserved. > + */ > + testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) > + je 1f > + movl %r14d,%eax > + xorl %edx,%edx > + movl $MSR_IA32_SPEC_CTRL,%ecx > + wrmsr > + /* > * Put back the preserved MSR_GSBASE value. > */ > - movl $MSR_GSBASE,%ecx > +1: movl $MSR_GSBASE,%ecx > movq %r12,%rdx > movl %edx,%eax > shrq $32,%rdx > @@ -960,6 +1004,7 @@ ld_regs: > testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ > jz 2f /* keep running with kernel GS.base */ > cli > + call handle_ibrs_exit_rs > cmpb $0,pti > je 1f > pushq %rdx > @@ -1011,6 +1056,10 @@ set_segs: > .globl doreti_iret_fault > doreti_iret_fault: > subq $TF_RIP,%rsp /* space including tf_err, tf_trapno */ > + movq %rax,TF_RAX(%rsp) > + movq %rdx,TF_RDX(%rsp) > + movq %rcx,TF_RCX(%rsp) > + call handle_ibrs_entry > testb $SEL_RPL_MASK,TF_CS(%rsp) > jz 1f > sti > @@ -1019,11 +1068,8 @@ doreti_iret_fault: > movl $TF_HASSEGS,TF_FLAGS(%rsp) > movq %rdi,TF_RDI(%rsp) > movq %rsi,TF_RSI(%rsp) > - movq %rdx,TF_RDX(%rsp) > - movq %rcx,TF_RCX(%rsp) > movq %r8,TF_R8(%rsp) > movq %r9,TF_R9(%rsp) > - movq %rax,TF_RAX(%rsp) > movq %rbx,TF_RBX(%rsp) > movq %rbp,TF_RBP(%rsp) > movq %r10,TF_R10(%rsp) > > Modified: head/sys/amd64/amd64/genassym.c > ============================================================================== > --- head/sys/amd64/amd64/genassym.c Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/amd64/genassym.c Wed Jan 31 14:36:27 2018 (r328625) > @@ -228,6 +228,7 @@ ASSYM(PC_UCR3, offsetof(struct pcpu, pc_ucr3)); > ASSYM(PC_SAVED_UCR3, offsetof(struct pcpu, pc_saved_ucr3)); > ASSYM(PC_PTI_STACK, offsetof(struct pcpu, pc_pti_stack)); > ASSYM(PC_PTI_STACK_SZ, PC_PTI_STACK_SZ); > +ASSYM(PC_IBPB_SET, offsetof(struct pcpu, pc_ibpb_set)); > > ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); > ASSYM(LA_ISR, LAPIC_ISR0 * LAPIC_MEM_MUL); > > Modified: head/sys/amd64/amd64/initcpu.c > ============================================================================== > --- head/sys/amd64/amd64/initcpu.c Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/amd64/initcpu.c Wed Jan 31 14:36:27 2018 (r328625) > @@ -223,6 +223,7 @@ initializecpu(void) > wrmsr(MSR_EFER, msr); > pg_nx = PG_NX; > } > + hw_ibrs_recalculate(); > switch (cpu_vendor_id) { > case CPU_VENDOR_AMD: > init_amd(); > > Modified: head/sys/amd64/amd64/machdep.c > ============================================================================== > --- head/sys/amd64/amd64/machdep.c Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/amd64/machdep.c Wed Jan 31 14:36:27 2018 (r328625) > @@ -1826,6 +1826,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > #endif > thread0.td_critnest = 0; > > + TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); > + > TSEXIT(); > > /* Location of kernel stack for locore */ > > Modified: head/sys/amd64/amd64/support.S > ============================================================================== > --- head/sys/amd64/amd64/support.S Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/amd64/support.S Wed Jan 31 14:36:27 2018 (r328625) > @@ -33,6 +33,7 @@ > #include "opt_ddb.h" > > #include > +#include > #include > > #include "assym.s" > @@ -850,3 +851,67 @@ ENTRY(pmap_pti_pcid_invlrng) > movq %rsi,%cr3 /* back to kernel */ > popfq > retq > + > + .altmacro > + .macro ibrs_seq_label l > +handle_ibrs_\l: > + .endm > + .macro ibrs_call_label l > + call handle_ibrs_\l > + .endm > + .macro ibrs_seq count > + ll=1 > + .rept \count > + ibrs_call_label %(ll) > + nop > + ibrs_seq_label %(ll) > + addq $8,%rsp > + ll=ll+1 > + .endr > + .endm > + > +/* all callers already saved %rax, %rdx, and %rcx */ > +ENTRY(handle_ibrs_entry) > + cmpb $0,hw_ibrs_active(%rip) > + je 1f > + movl $MSR_IA32_SPEC_CTRL,%ecx > + movl $IA32_SPEC_CTRL_IBRS,%eax > + movl $IA32_SPEC_CTRL_IBRS>>32,%edx > + wrmsr > + movb $1,PCPU(IBPB_SET) > + testl $CPUID_STDEXT_SMEP,cpu_stdext_feature(%rip) > + jne 1f > + ibrs_seq 32 > +1: ret > +END(handle_ibrs_entry) > + > +ENTRY(handle_ibrs_exit) > + cmpb $0,PCPU(IBPB_SET) > + je 1f > + movl $MSR_IA32_SPEC_CTRL,%ecx > + xorl %eax,%eax > + xorl %edx,%edx > + wrmsr > + movb $0,PCPU(IBPB_SET) > +1: ret > +END(handle_ibrs_exit) > + > +/* registers-neutral version, but needs stack */ > +ENTRY(handle_ibrs_exit_rs) > + cmpb $0,PCPU(IBPB_SET) > + je 1f > + pushq %rax > + pushq %rdx > + pushq %rcx > + movl $MSR_IA32_SPEC_CTRL,%ecx > + xorl %eax,%eax > + xorl %edx,%edx > + wrmsr > + popq %rcx > + popq %rdx > + popq %rax > + movb $0,PCPU(IBPB_SET) > +1: ret > +END(handle_ibrs_exit_rs) > + > + .noaltmacro > > Modified: head/sys/amd64/ia32/ia32_exception.S > ============================================================================== > --- head/sys/amd64/ia32/ia32_exception.S Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/ia32/ia32_exception.S Wed Jan 31 14:36:27 2018 (r328625) > @@ -53,13 +53,14 @@ int0x80_syscall_common: > movq PCPU(CURPCB),%rdi > andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) > SAVE_SEGS > - sti > - movq %rsi,TF_RSI(%rsp) > + movq %rax,TF_RAX(%rsp) > movq %rdx,TF_RDX(%rsp) > movq %rcx,TF_RCX(%rsp) > + call handle_ibrs_entry > + sti > + movq %rsi,TF_RSI(%rsp) > movq %r8,TF_R8(%rsp) > movq %r9,TF_R9(%rsp) > - movq %rax,TF_RAX(%rsp) > movq %rbx,TF_RBX(%rsp) > movq %rbp,TF_RBP(%rsp) > movq %r10,TF_R10(%rsp) > > Modified: head/sys/amd64/include/md_var.h > ============================================================================== > --- head/sys/amd64/include/md_var.h Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/include/md_var.h Wed Jan 31 14:36:27 2018 (r328625) > @@ -38,6 +38,7 @@ > > extern uint64_t *vm_page_dump; > extern int hw_lower_amd64_sharedpage; > +extern int hw_ibrs_disable; > > /* > * The file "conf/ldscript.amd64" defines the symbol "kernphys". Its > > Modified: head/sys/amd64/include/pcpu.h > ============================================================================== > --- head/sys/amd64/include/pcpu.h Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/amd64/include/pcpu.h Wed Jan 31 14:36:27 2018 (r328625) > @@ -74,7 +74,8 @@ > uint32_t pc_pcid_next; \ > uint32_t pc_pcid_gen; \ > uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ > - char __pad[224] /* be divisor of PAGE_SIZE \ > + uint32_t pc_ibpb_set; \ > + char __pad[216] /* be divisor of PAGE_SIZE \ > after cache alignment */ > > #define PC_DBREG_CMD_NONE 0 > > Modified: head/sys/dev/cpuctl/cpuctl.c > ============================================================================== > --- head/sys/dev/cpuctl/cpuctl.c Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/dev/cpuctl/cpuctl.c Wed Jan 31 14:36:27 2018 (r328625) > @@ -527,6 +527,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td > set_cpu(cpu, td); > identify_cpu1(); > identify_cpu2(); > + hw_ibrs_recalculate(); > restore_cpu(oldcpu, is_bound, td); > printcpuinfo(); > return (0); > > Modified: head/sys/i386/i386/support.s > ============================================================================== > --- head/sys/i386/i386/support.s Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/i386/i386/support.s Wed Jan 31 14:36:27 2018 (r328625) > @@ -827,3 +827,11 @@ msr_onfault: > movl $0,PCB_ONFAULT(%ecx) > movl $EFAULT,%eax > ret > + > +ENTRY(handle_ibrs_entry) > + ret > +END(handle_ibrs_entry) > + > +ENTRY(handle_ibrs_exit) > + ret > +END(handle_ibrs_exit) > > Modified: head/sys/x86/include/specialreg.h > ============================================================================== > --- head/sys/x86/include/specialreg.h Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/x86/include/specialreg.h Wed Jan 31 14:36:27 2018 (r328625) > @@ -697,6 +697,10 @@ > #define IA32_MISC_EN_xTPRD 0x0000000000800000ULL > #define IA32_MISC_EN_XDD 0x0000000400000000ULL > > +/* > + * IA32_SPEC_CTRL and IA32_PRED_CMD MSRs are described in the Intel' > + * document 336996-001 Speculative Execution Side Channel Mitigations. > + */ > /* MSR IA32_SPEC_CTRL */ > #define IA32_SPEC_CTRL_IBRS 0x0000000000000001ULL > #define IA32_SPEC_CTRL_STIBP 0x0000000000000002ULL > > Modified: head/sys/x86/include/x86_var.h > ============================================================================== > --- head/sys/x86/include/x86_var.h Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/x86/include/x86_var.h Wed Jan 31 14:36:27 2018 (r328625) > @@ -131,6 +131,9 @@ bool fix_cpuid(void); > void fillw(int /*u_short*/ pat, void *base, size_t cnt); > int is_physical_memory(vm_paddr_t addr); > int isa_nmi(int cd); > +void handle_ibrs_entry(void); > +void handle_ibrs_exit(void); > +void hw_ibrs_recalculate(void); > void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); > void nmi_call_kdb_smp(u_int type, struct trapframe *frame); > void nmi_handle_intr(u_int type, struct trapframe *frame); > > Modified: head/sys/x86/x86/cpu_machdep.c > ============================================================================== > --- head/sys/x86/x86/cpu_machdep.c Wed Jan 31 14:25:42 2018 (r328624) > +++ head/sys/x86/x86/cpu_machdep.c Wed Jan 31 14:36:27 2018 (r328625) > @@ -142,6 +142,12 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint) > int *state; > > /* > + * A comment in Linux patch claims that 'CPUs run faster with > + * speculation protection disabled. All CPU threads in a core > + * must disable speculation protection for it to be > + * disabled. Disable it while we are idle so the other > + * hyperthread can run fast.' > + * > * XXXKIB. Software coordination mode should be supported, > * but all Intel CPUs provide hardware coordination. > */ > @@ -150,9 +156,11 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint) > KASSERT(*state == STATE_SLEEPING, > ("cpu_mwait_cx: wrong monitorbuf state")); > *state = STATE_MWAIT; > + handle_ibrs_entry(); > cpu_monitor(state, 0, 0); > if (*state == STATE_MWAIT) > cpu_mwait(MWAIT_INTRBREAK, mwait_hint); > + handle_ibrs_exit(); > > /* > * We should exit on any event that interrupts mwait, because > @@ -569,3 +577,47 @@ nmi_handle_intr(u_int type, struct trapframe *frame) > nmi_call_kdb(PCPU_GET(cpuid), type, frame); > #endif > } > + > +int hw_ibrs_active; > +int hw_ibrs_disable = 1; > + > +SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0, > + "IBRS active"); > + > +void > +hw_ibrs_recalculate(void) > +{ > + uint64_t v; > + > + if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_IBRS_ALL) != 0) { > + if (hw_ibrs_disable) { > + v= rdmsr(MSR_IA32_SPEC_CTRL); > + v &= ~IA32_SPEC_CTRL_IBRS; > + wrmsr(MSR_IA32_SPEC_CTRL, v); > + } else { > + v= rdmsr(MSR_IA32_SPEC_CTRL); > + v |= IA32_SPEC_CTRL_IBRS; > + wrmsr(MSR_IA32_SPEC_CTRL, v); > + } > + return; > + } > + hw_ibrs_active = (cpu_stdext_feature3 & CPUID_STDEXT3_IBPB) != 0 && > + !hw_ibrs_disable; > +} > + > +static int > +hw_ibrs_disable_handler(SYSCTL_HANDLER_ARGS) > +{ > + int error, val; > + > + val = hw_ibrs_disable; > + error = sysctl_handle_int(oidp, &val, 0, req); > + if (error != 0 || req->newptr == NULL) > + return (error); > + hw_ibrs_disable = val != 0; > + hw_ibrs_recalculate(); > + return (0); > +} > +SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | CTLFLAG_RWTUN | > + CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I", > + "Disable IBRS"); > > > > From owner-svn-src-all@freebsd.org Wed Jan 31 15:07:53 2018 Return-Path: Delivered-To: svn-src-all@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 CFE36ED037D; Wed, 31 Jan 2018 15:07:53 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp004.me.com (mr11p00im-asmtp004.me.com [17.110.69.135]) (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 7134787A7C; Wed, 31 Jan 2018 15:07:53 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp004.me.com by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P3F00B00DUSZ700@mr11p00im-asmtp004.me.com>; Wed, 31 Jan 2018 15:07:44 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1517411264; bh=eHWghtrWgLl+xmNrp2jgl9VDvNHZrn7YVdCdEcSsj0k=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=pKHWBf024h6efO63Rh9MHDn5UR2MJyfMKqt3++hHN0Fnyea2a+H8uaXb15qenf0dv MPHttioe9aqXE5vamDgAKCbtPDrJUeGoT1nJYeQckJJByC1BFocFFo/+cYYek/Rv7A q2ZFdjVRMnLhAsU1Vn7XvontNjPA2ifCeefPjnwlOGCfGzf8nWD/6zlGMwoCtQhtiQ +MG5ZwCfYR+MZZgbuXO7OlValap9hfv6B48x7u+rnA4YUIMwbcACygMdcT6YOZOEkf WEFx3yq0KoKoJXRZKohdxnFMYveW94PBKgTmsxsyxUZrBsBlQlAIJuDFDHCaMFhVCW zb43JQn9hgPJw== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P3F00FHYE0SPG00@mr11p00im-asmtp004.me.com>; Wed, 31 Jan 2018 15:07:42 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-31_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801310197 User-Agent: Microsoft-MacOutlook/10.9.0.180116 Date: Wed, 31 Jan 2018 07:07:40 -0800 Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 From: Ravi Pokala To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <13FA8F78-4647-47A1-99FA-05793EF44E50@mac.com> Thread-topic: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 References: <201801311436.w0VEaRrZ030839@repo.freebsd.org> <20180131150204.GQ97752@kib.kiev.ua> In-reply-to: <20180131150204.GQ97752@kib.kiev.ua> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:07:54 -0000 -----Original Message----- From: on behalf of Konstantin Belousov Date: 2018-01-31, Wednesday at 07:02 To: Ravi Pokala Cc: , , Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 > On Wed, Jan 31, 2018 at 06:52:43AM -0800, Ravi Pokala wrote: > >> Thanks Kostik! >> >> Quick question: IBRS stands for...? For that matter, in the previous change, what does RDCL_NO stand for too? > > Indirect Branch Restricted Speculation > Rogue Data Cache Load. > > Read (or at least skim over) the Intel paper I referenced in the commit message. Certainly. That said, it's nice to spell out un-familiar acronyms the first time they're used. :-) Thanks again, Ravi (rpokala@) From owner-svn-src-all@freebsd.org Wed Jan 31 15:08:47 2018 Return-Path: Delivered-To: svn-src-all@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 1A478ED0469 for ; Wed, 31 Jan 2018 15:08:47 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9437287BDF for ; Wed, 31 Jan 2018 15:08:46 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-wm0-x232.google.com with SMTP id f71so8848884wmf.0 for ; Wed, 31 Jan 2018 07:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sLwBJUsnHg+FsJP1Wlti0bEvvQKck5Wvb3bw9VmRCCA=; b=LJaNqP0iB1A+cxDSe4m3k1v7cTpdzrK8nbSFtAyJKGF//8lRn0HOPlYLvZyt4ZVtx3 3MHAzGLLfe85vKfVQjJWlBXNZZJOjzkd8+/ZWROCg8PEzlDgic5hbbC8TSKuvwzLG3Zg OOV4AWPbM85vlLlMzur7rQzQr47EqhMwnj5gYwe5mSeIVqh1dovax/oNA+gr9odzJ7jt g0b0UZeV962PWnrfbNfsKOXzYeMfhP8VlpKY9i4IP87obQ6L7pFAG4z81iwLYpBfR0Ze HFMrvqmhOATiBg9h3tAFu/RnvbQR0qpO+ky0HyCXnmvIiItnG1P29VI030RJ1ETkxqGE tP4A== 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=sLwBJUsnHg+FsJP1Wlti0bEvvQKck5Wvb3bw9VmRCCA=; b=sWQTDw79NkukCBHvMERE+OTgrYDv6o4/1Ty6oEojaHGzzAR3Tvt1KCc+7ejFwAz0KH DL/ZDiZ2q1l1pgqpcBqBMBymLDWpOxIvzQ9K8uK/9ILqgtxPVDDKLBntS/cp3IaDnaC7 JCqjM39S0HpS+3QTFBg6S8oRt1RdYSF8knau8JxNZX/5hq4znuHAq2hq1QtWm/o514dk W/Svsi+T7ZtJ1XRkISB6ij0PwXpL/+BxuSLIGykVONOtwAZd1tzOVoQxOpw8ZIoPe8uq uTwVfkPXrOTMqDXQh5y+0EB5X2LU7bewF7YxrwTQJbrqvLukd8B89yslQdxNuH8Scnc7 iF5w== X-Gm-Message-State: AKwxytdkVixzrAorkWfW7qiVmeBSQThh9aYoEkNaRr1ENjVy9bprh8oA /LvT3KGOKu7ndjJM7iAkK465u/DAO9Q= X-Google-Smtp-Source: AH8x226XTyzVfztusqjuqLxxuEVTMbdY8bD4k+H/zgGkWdBXhtBPjM4+p+CgI+7OPqWT2BB7t2bZqQ== X-Received: by 10.80.135.156 with SMTP id a28mr5715914eda.51.1517411325312; Wed, 31 Jan 2018 07:08:45 -0800 (PST) Received: from mutt-hbsd (exit1.ipredator.se. [197.231.221.211]) by smtp.gmail.com with ESMTPSA id z49sm9153451edd.93.2018.01.31.07.08.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jan 2018 07:08:44 -0800 (PST) Date: Wed, 31 Jan 2018 10:08:30 -0500 From: Shawn Webb To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 Message-ID: <20180131150830.xjovkkavh44kkegv@mutt-hbsd> References: <201801311436.w0VEaRrZ030839@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="okxnasalwif4s3f7" Content-Disposition: inline In-Reply-To: <201801311436.w0VEaRrZ030839@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/20171215 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:08:47 -0000 --okxnasalwif4s3f7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 31, 2018 at 02:36:27PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Wed Jan 31 14:36:27 2018 > New Revision: 328625 > URL: https://svnweb.freebsd.org/changeset/base/328625 >=20 > Log: > IBRS support, AKA Spectre hardware mitigation. > =20 > It is coded according to the Intel document 336996-001, reading of the > patches posted on lkml, and some additional consultations with Intel. > =20 > For existing processors, you need a microcode update which adds IBRS > CPU features, and to manually enable it by setting the tunable/sysctl > hw.ibrs_disable to 0. Current status can be checked in sysctl > hw.ibrs_active. The mitigation might be inactive if the CPU feature > is not patched in, or if CPU reports that IBRS use is not required, by > IA32_ARCH_CAP_IBRS_ALL bit. > =20 > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D14029 Hey Kostik, Thank you very much for your work on this. I'm curious why you disable IBPB for userland. Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --okxnasalwif4s3f7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAlpx2+oACgkQaoRlj1JF bu5ayQ//WhBuFx+pvL212qCVpw5/wjFxN+cSizCXu1vBieNPGwTDlXm659GUtcD+ DBCFcKd92gQTnVGzgnNviuIZ67o5kdKl/DEhAdqKbPNKtiLZUGkFVyzq4aVVoqnZ gD2TLLIAeAoBWtejujvXF+T6dX7zybWYWgpDTVqYPY05s6dW9ui32Lo1KOrpznrR /SjhDRz2tiM3CxPyiTwTIdzOXFlkkNc9qYWwIfgV4rKPB+UdiOWpwrgmYBXZn+Sw kS/sbexo/rsyn9iCkwoKAJyo34YZHNqHu/5c3SdDn7/NsD/gmV7EZ85zxVXVT57E GJ++WgG53SLoMTDbWZW8YrrYUZFy+vNBoYVUQvNgULIVkUJbwetXw28PoLGaDwBD zaA79T95SUGlsV36p4qCpFnUQ4pzPVxukydISBHxJ2MA+ecarwGyTRYktK2BTpJe BAlkcyRt2NYxp8lo7KQ/SGS60M7LSEwAoJGl2ZYf2DO8KfFg1g/Pgnt3NsvyWkQy IINDDw96nNpV+8vv+BlfLs0hv582MTCVToBJ/Hkm2C1RCkrdULsWZpR73Nysk3D8 +o+38fTZ5ZeqvDyUeSgEfYfZt00QYSApUVUUFA8W1MQbXFnuDso3/ptmNUaPXwBJ aOvtA/0rkplFUFMDFy8fD48NH9rtTd8kCK01hhLzi0aAYnN+3+o= =Go35 -----END PGP SIGNATURE----- --okxnasalwif4s3f7-- From owner-svn-src-all@freebsd.org Wed Jan 31 15:18:00 2018 Return-Path: Delivered-To: svn-src-all@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 DA154ED0B5F; Wed, 31 Jan 2018 15:18:00 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (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 6B22A6820E; Wed, 31 Jan 2018 15:18:00 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id w0VFHuhZ002660 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 31 Jan 2018 07:17:57 -0800 Subject: Re: svn commit: r328616 - head/sys/powerpc/aim To: Wojciech Macek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801310642.w0V6g1Am099107@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <61ee6038-9a49-5e9d-f916-8c36d69976a3@freebsd.org> Date: Wed, 31 Jan 2018 07:17:56 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201801310642.w0V6g1Am099107@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVaZ6CX5PWRUSqJPQS/SplsGTeBBeDmo4y+UTNqUNQKpYgVe/atO+KTs7xwpl9I5Lw47S41reYVdT8z6bfZ5BWYZchqV84Rz+mM= X-Sonic-ID: C;drZA6pkG6BG1tRtCsE207w== M;PmWc6pkG6BG1tRtCsE207w== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:18:01 -0000 Thanks! Since PSL_HV is only defined on powerpc64, you also need some #ifdef here or the ppc32 kernel build will break. Also, the comment is longer than 80 characters. -Nathan On 01/30/18 22:42, Wojciech Macek wrote: > Author: wma > Date: Wed Jan 31 06:42:01 2018 > New Revision: 328616 > URL: https://svnweb.freebsd.org/changeset/base/328616 > > Log: > PowerNV: fix compilation on non-NV platforms > > Submitted by: Wojciech Macek > Obtained from: Semihalf > Sponsored by: IBM, QCM Technologies > > Modified: > head/sys/powerpc/aim/mp_cpudep.c > > Modified: head/sys/powerpc/aim/mp_cpudep.c > ============================================================================== > --- head/sys/powerpc/aim/mp_cpudep.c Wed Jan 31 05:07:43 2018 (r328615) > +++ head/sys/powerpc/aim/mp_cpudep.c Wed Jan 31 06:42:01 2018 (r328616) > @@ -85,13 +85,15 @@ cpudep_ap_early_bootstrap(void) > break; > case IBMPOWER8: > case IBMPOWER8E: > - isync(); > - /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ > - mtspr(SPR_LPID, 0); > - isync(); > + if (mfmsr() & PSL_HV) { > + isync(); > + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ > + mtspr(SPR_LPID, 0); > + isync(); > > - mtspr(SPR_LPCR, LPCR_LPES); > - isync(); > + mtspr(SPR_LPCR, LPCR_LPES); > + isync(); > + } > break; > } > > From owner-svn-src-all@freebsd.org Wed Jan 31 15:20:52 2018 Return-Path: Delivered-To: svn-src-all@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 0F63AED0E17; Wed, 31 Jan 2018 15:20:52 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::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 7F255684AE; Wed, 31 Jan 2018 15:20:51 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x22e.google.com with SMTP id g1so8882994wmg.2; Wed, 31 Jan 2018 07:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=RhXOZTbqLssNXnmFO5Y9UcKPdSTji5OBiwtafs/DOTI=; b=fJRPdUFtq2D2ldDB3xoXgbHYVWeB7ftdFuV3GDT9peXZpR/TwkXpMTomSVVTPz9gD6 iZ7oGS7wUbbgX4hQx1E2JTfh37RSFhpkm1+rD8jZ++lT0pplfYwJMLwsoHmX0TWqSuZc Khvmainx9+rQeNiHLP5invM8hdAcK684z9uQyMUyAOancr86S6qjwAsQhma6RTXIxDwZ H+mRnpv5znwdCaZ1RMTvNB0IIy5Y7NqRVWe5iwiKU33+pJ2NTFlYMQex8Grrqa9x3/TZ 8kS6ItLee0894HRMQvH9vnIHAUE6nkG01FPdhgplKwXLG0A/BxqR4Opy81Z4ozMvhDE9 yKCA== 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 :mime-version:content-disposition:user-agent; bh=RhXOZTbqLssNXnmFO5Y9UcKPdSTji5OBiwtafs/DOTI=; b=lYEcsf/8hRBJdkVLXbO3Q2CdwjE/p6g07huGFZMYR95+QSkajufqkW2Dc124+Idv1m u2//P4bQgMRMRwbO1uqtHH5HzH0WI2Aoj3VLZ6dwJeCILvO/1sAICiykpTHHIZcsXOj1 yzuI/anJReKt2tHji/k1bAWBPz+FzGYEkybOChtWqULHDzBPxK4CaMr0UYp+dP+r2Hxf UkR9MTrF4D9CIvvxmgxLjmhlbmGZYpSn6KfaBoBJxhXkeiKSJOCj9TZ/YrTL4aX6l7Ax 9t0KTO7Cct8q92vpgt9pKCAsts6EiIqyOvmIGR5gTkIEQzH4RZnO9Yys06pHVWskcyxq LrCQ== X-Gm-Message-State: AKwxytcVkn5dtGFs1A6LSSy7aiaxlw/Sx5Ulbia9CyFsxR1Ow14lF13u ygp1xUZxMki5gYhMMerDAWpJXA== X-Google-Smtp-Source: AH8x226bTzr9oFPmF6tADbJhwzThxvdYP+5u1Yo/sIBlI5DNCANLCpWX63vZx8UTbL/ZIRE6Y/hTVw== X-Received: by 10.80.154.6 with SMTP id o6mr13247327edb.146.1517412050136; Wed, 31 Jan 2018 07:20:50 -0800 (PST) Received: from localhost (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id b12sm9241358eda.81.2018.01.31.07.20.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 07:20:49 -0800 (PST) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Wed, 31 Jan 2018 15:20:46 +0000 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Wojciech Macek Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328536 - in head/stand: common powerpc/kboot Message-ID: <20180131151823.fwigjbd5uubhshpj@MacBook-Pro-de-Roger.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20171208 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:20:52 -0000 On Mon, Jan 29, 2018 at 09:24:28AM +0000, Wojciech Macek wrote: > Modified: head/stand/common/load_elf.c > ============================================================================== > --- head/stand/common/load_elf.c Mon Jan 29 09:21:08 2018 (r328535) > +++ head/stand/common/load_elf.c Mon Jan 29 09:24:28 2018 (r328536) > @@ -29,6 +29,7 @@ > __FBSDID("$FreeBSD$"); > > #include > +#include > #include > #include > #include > @@ -118,15 +119,72 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) > err = EFTYPE; > goto error; > } > + > if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || /* Layout ? */ > ehdr->e_ident[EI_DATA] != ELF_TARG_DATA || So here you force EI_DATA == ELF_TARG_DATA in order to continue... > - ehdr->e_ident[EI_VERSION] != EV_CURRENT || /* Version ? */ > - ehdr->e_version != EV_CURRENT || > - ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ > + ehdr->e_ident[EI_VERSION] != EV_CURRENT) /* Version ? */ { > err = EFTYPE; > goto error; > } > > + /* > + * Fixup ELF endianness. > + * > + * The Xhdr structure was loaded using block read call to > + * optimize file accesses. It might happen, that the endianness > + * of the system memory is different that endianness of > + * the ELF header. > + * Swap fields here to guarantee that Xhdr always contain > + * valid data regardless of architecture. > + */ > + if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { > + ehdr->e_type = be16toh(ehdr->e_type); ... yet here you check for EI_DATA == ELFDATA2MSB which AFAICT it's not possible given the check above, so the following if branch is dead code. > + ehdr->e_machine = be16toh(ehdr->e_machine); > + ehdr->e_version = be32toh(ehdr->e_version); > + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { > + ehdr->e_entry = be64toh(ehdr->e_entry); > + ehdr->e_phoff = be64toh(ehdr->e_phoff); > + ehdr->e_shoff = be64toh(ehdr->e_shoff); > + } else { > + ehdr->e_entry = be32toh(ehdr->e_entry); > + ehdr->e_phoff = be32toh(ehdr->e_phoff); > + ehdr->e_shoff = be32toh(ehdr->e_shoff); > + } > + ehdr->e_flags = be32toh(ehdr->e_flags); > + ehdr->e_ehsize = be16toh(ehdr->e_ehsize); > + ehdr->e_phentsize = be16toh(ehdr->e_phentsize); > + ehdr->e_phnum = be16toh(ehdr->e_phnum); > + ehdr->e_shentsize = be16toh(ehdr->e_shentsize); > + ehdr->e_shnum = be16toh(ehdr->e_shnum); > + ehdr->e_shstrndx = be16toh(ehdr->e_shstrndx); > + > + } else { > + ehdr->e_type = le16toh(ehdr->e_type); > + ehdr->e_machine = le16toh(ehdr->e_machine); > + ehdr->e_version = le32toh(ehdr->e_version); > + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { > + ehdr->e_entry = le64toh(ehdr->e_entry); > + ehdr->e_phoff = le64toh(ehdr->e_phoff); > + ehdr->e_shoff = le64toh(ehdr->e_shoff); > + } else { > + ehdr->e_entry = le32toh(ehdr->e_entry); > + ehdr->e_phoff = le32toh(ehdr->e_phoff); > + ehdr->e_shoff = le32toh(ehdr->e_shoff); > + } > + ehdr->e_flags = le32toh(ehdr->e_flags); > + ehdr->e_ehsize = le16toh(ehdr->e_ehsize); > + ehdr->e_phentsize = le16toh(ehdr->e_phentsize); > + ehdr->e_phnum = le16toh(ehdr->e_phnum); > + ehdr->e_shentsize = le16toh(ehdr->e_shentsize); > + ehdr->e_shnum = le16toh(ehdr->e_shnum); > + ehdr->e_shstrndx = le16toh(ehdr->e_shstrndx); > + } I think this chunk (and all the similar ones below) should be put on a macro in order to avoid such big chunks of code repetition. It's also fairly easy to forget to change one of the branches in the future. Roger. From owner-svn-src-all@freebsd.org Wed Jan 31 15:23:56 2018 Return-Path: Delivered-To: svn-src-all@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 CF2D1ED1478; Wed, 31 Jan 2018 15:23:56 +0000 (UTC) (envelope-from prvs=56287adec=roger.pau@citrix.com) Received: from SMTP.EU.CITRIX.COM (smtp.eu.citrix.com [185.25.65.24]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (Client CN "mail.citrix.com", Issuer "DigiCert SHA2 Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA46368991; Wed, 31 Jan 2018 15:23:55 +0000 (UTC) (envelope-from prvs=56287adec=roger.pau@citrix.com) X-IronPort-AV: E=Sophos;i="5.46,440,1511827200"; d="scan'208";a="66995469" Date: Wed, 31 Jan 2018 15:09:55 +0000 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Wojciech Macek CC: , , Subject: Re: svn commit: r328536 - in head/stand: common powerpc/kboot Message-ID: <20180131150955.trc5tkkykgxuwf4f@MacBook-Pro-de-Roger.local> References: <201801290924.w0T9OSix008403@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <201801290924.w0T9OSix008403@repo.freebsd.org> User-Agent: NeoMutt/20171208 X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:23:57 -0000 On Mon, Jan 29, 2018 at 09:24:28AM +0000, Wojciech Macek wrote: > Modified: head/stand/common/load_elf.c > ============================================================================== > --- head/stand/common/load_elf.c Mon Jan 29 09:21:08 2018 (r328535) > +++ head/stand/common/load_elf.c Mon Jan 29 09:24:28 2018 (r328536) > @@ -29,6 +29,7 @@ > __FBSDID("$FreeBSD$"); > > #include > +#include > #include > #include > #include > @@ -118,15 +119,72 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) > err = EFTYPE; > goto error; > } > + > if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || /* Layout ? */ > ehdr->e_ident[EI_DATA] != ELF_TARG_DATA || So here you force EI_DATA == ELF_TARG_DATA in order to continue... > - ehdr->e_ident[EI_VERSION] != EV_CURRENT || /* Version ? */ > - ehdr->e_version != EV_CURRENT || > - ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ > + ehdr->e_ident[EI_VERSION] != EV_CURRENT) /* Version ? */ { > err = EFTYPE; > goto error; > } > > + /* > + * Fixup ELF endianness. > + * > + * The Xhdr structure was loaded using block read call to > + * optimize file accesses. It might happen, that the endianness > + * of the system memory is different that endianness of > + * the ELF header. > + * Swap fields here to guarantee that Xhdr always contain > + * valid data regardless of architecture. > + */ > + if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { > + ehdr->e_type = be16toh(ehdr->e_type); ... yet here you check for EI_DATA == ELFDATA2MSB which AFAICT it's not possible given the check above, so the following if branch is dead code. > + ehdr->e_machine = be16toh(ehdr->e_machine); > + ehdr->e_version = be32toh(ehdr->e_version); > + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { > + ehdr->e_entry = be64toh(ehdr->e_entry); > + ehdr->e_phoff = be64toh(ehdr->e_phoff); > + ehdr->e_shoff = be64toh(ehdr->e_shoff); > + } else { > + ehdr->e_entry = be32toh(ehdr->e_entry); > + ehdr->e_phoff = be32toh(ehdr->e_phoff); > + ehdr->e_shoff = be32toh(ehdr->e_shoff); > + } > + ehdr->e_flags = be32toh(ehdr->e_flags); > + ehdr->e_ehsize = be16toh(ehdr->e_ehsize); > + ehdr->e_phentsize = be16toh(ehdr->e_phentsize); > + ehdr->e_phnum = be16toh(ehdr->e_phnum); > + ehdr->e_shentsize = be16toh(ehdr->e_shentsize); > + ehdr->e_shnum = be16toh(ehdr->e_shnum); > + ehdr->e_shstrndx = be16toh(ehdr->e_shstrndx); > + > + } else { > + ehdr->e_type = le16toh(ehdr->e_type); > + ehdr->e_machine = le16toh(ehdr->e_machine); > + ehdr->e_version = le32toh(ehdr->e_version); > + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { > + ehdr->e_entry = le64toh(ehdr->e_entry); > + ehdr->e_phoff = le64toh(ehdr->e_phoff); > + ehdr->e_shoff = le64toh(ehdr->e_shoff); > + } else { > + ehdr->e_entry = le32toh(ehdr->e_entry); > + ehdr->e_phoff = le32toh(ehdr->e_phoff); > + ehdr->e_shoff = le32toh(ehdr->e_shoff); > + } > + ehdr->e_flags = le32toh(ehdr->e_flags); > + ehdr->e_ehsize = le16toh(ehdr->e_ehsize); > + ehdr->e_phentsize = le16toh(ehdr->e_phentsize); > + ehdr->e_phnum = le16toh(ehdr->e_phnum); > + ehdr->e_shentsize = le16toh(ehdr->e_shentsize); > + ehdr->e_shnum = le16toh(ehdr->e_shnum); > + ehdr->e_shstrndx = le16toh(ehdr->e_shstrndx); > + } I think this chunk (and all the similar ones below) should be put on a macro in order to avoid such big chunks of code repetition. It's also fairly easy to forget to change one of the branches in the future. Roger. From owner-svn-src-all@freebsd.org Wed Jan 31 15:31:58 2018 Return-Path: Delivered-To: svn-src-all@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 A45E3ED1B13; Wed, 31 Jan 2018 15:31:58 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com [IPv6:2607:f8b0:4001:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 343E668E6B; Wed, 31 Jan 2018 15:31:58 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x22a.google.com with SMTP id l17so15618539ioc.3; Wed, 31 Jan 2018 07:31:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PzaRmh/ixucfF8aaT7iS+qb0nnxgenqcDs5/LKr14CQ=; b=dppO1OSZkh3kvLOtrIk6sHnaSG+gH7tm6FMSQtKdukgEXH1Z2i+mUjJaPKhJcZI7Cx EiENEHH4lkHt+exmfIi4NDIWiDrNhWu8gh+f7pEg++c4041SyavETYq6guHIjP0pokwx sNqnThekHJ9GfvTp6EM+I69YoIHhyarlgXwayMRSWIBt6fIl/rkabBWPUtnJ9YNcoyw7 9r6GDpmiSKfSDgtdgFOjpztMJlgLwDaVx2k9NIg1MHai/sux40G/VQooqmJF6KmuYK6F 1eAlUnVZkUfMXQQJ1GC2gisInLVk5QKqGBOxPKcpBOfDoCtf3lWlLEuBPsDvy5ynwXiG hy5Q== 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=PzaRmh/ixucfF8aaT7iS+qb0nnxgenqcDs5/LKr14CQ=; b=UhpLc9bCWA+idvj1CGDAmscUPHqQoSkVBEi555eNb0djFWFv1lYw6l21CO35so6DZ0 qTiXcdZL7GZMZbkE1rJ/kQFjLZ/jZmSzyhxDddNBtFIStBh6uTAtFXUNXn6e9E6ShpBX VPiUBOcjeouHnJoH8yG5MoOkczfogMgfj2n1Soy8EMAWjH1527oV0ULL0mdBB8LmaL1L +PEZKjtAwvEwmheV+Bm/5D5bt57N/sKUvccw3msoUVaDhJ+uicuo6KSbiQs3j2ufDJHo tfp43ndDfkZyq63E4TgNeCL+9LItlf41kitrQU+XgQ5j5YNayU0ibpMa3Huj/7wyjw+p yySQ== X-Gm-Message-State: AKwxytfJFhC6a86nlFmSkIVKpJcRSVsOQFA/+ydCR0lxdhzTXhUKcgz5 lfE5jU9a4xsH/1wjbnxVuY96TloMOo4pp5b6rVkKaw== X-Google-Smtp-Source: AH8x225h/J4Y/4nlv5poHm1QlpUeKBGAX8VI6rSpKu1ZTSZ0jAt1qdDiY4+QC0d4B7bfSoRTIfGSz4gdtr8QX+7Es+M= X-Received: by 10.107.107.1 with SMTP id g1mr33693515ioc.63.1517412717455; Wed, 31 Jan 2018 07:31:57 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.152.9 with HTTP; Wed, 31 Jan 2018 07:31:36 -0800 (PST) In-Reply-To: <3195814.6PcFLP86qD@ralph.baldwin.cx> References: <201801302329.w0UNTRHn080138@repo.freebsd.org> <3195814.6PcFLP86qD@ralph.baldwin.cx> From: Ed Maste Date: Wed, 31 Jan 2018 10:31:36 -0500 X-Google-Sender-Auth: wqJm6-nRg95ZhmoKOt5LQT7jdtI Message-ID: Subject: Re: svn commit: r328610 - head/sys/amd64/amd64 To: John Baldwin , Wojciech Macek Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:31:58 -0000 On 30 January 2018 at 21:01, John Baldwin wrote: > On Tuesday, January 30, 2018 11:29:27 PM John Baldwin wrote: >> Author: jhb >> Date: Tue Jan 30 23:29:27 2018 >> New Revision: 328610 >> URL: https://svnweb.freebsd.org/changeset/base/328610 >> >> Log: >> Ensure 'name' is not NULL before passing to strcmp(). >> >> This avoids a nested page fault when obtaining a stack trace in DDB if >> the address from the first frame does not resolve to a known symbol. >> >> MFC after: 1 week >> Sponsored by: Chelsio Communications > > This appears to be fallout from lld? After fixing this, the stack trace > for my next panic shows no symbols for functions in the kernel, only > functions in kernel modules: It's fallout from loader changes in r328536. I reverted r328536 (and r328603) locally and stack traces are fixed. From owner-svn-src-all@freebsd.org Wed Jan 31 16:14:09 2018 Return-Path: Delivered-To: svn-src-all@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 ECD4AED43CB; Wed, 31 Jan 2018 16:14:08 +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 8F3286BA29; Wed, 31 Jan 2018 16:14:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id A432310A8BA; Wed, 31 Jan 2018 11:14:07 -0500 (EST) From: John Baldwin To: Ed Maste Cc: Wojciech Macek , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328610 - head/sys/amd64/amd64 Date: Wed, 31 Jan 2018 08:14:03 -0800 Message-ID: <3114578.qyyx4qh6ii@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201801302329.w0UNTRHn080138@repo.freebsd.org> <3195814.6PcFLP86qD@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 31 Jan 2018 11:14:07 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 16:14:09 -0000 On Wednesday, January 31, 2018 10:31:36 AM Ed Maste wrote: > On 30 January 2018 at 21:01, John Baldwin wrote: > > On Tuesday, January 30, 2018 11:29:27 PM John Baldwin wrote: > >> Author: jhb > >> Date: Tue Jan 30 23:29:27 2018 > >> New Revision: 328610 > >> URL: https://svnweb.freebsd.org/changeset/base/328610 > >> > >> Log: > >> Ensure 'name' is not NULL before passing to strcmp(). > >> > >> This avoids a nested page fault when obtaining a stack trace in DDB if > >> the address from the first frame does not resolve to a known symbol. > >> > >> MFC after: 1 week > >> Sponsored by: Chelsio Communications > > > > This appears to be fallout from lld? After fixing this, the stack trace > > for my next panic shows no symbols for functions in the kernel, only > > functions in kernel modules: > > It's fallout from loader changes in r328536. I reverted r328536 (and > r328603) locally and stack traces are fixed. Ouch. I'll try to look at this later today unless someone else beats me to it. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Jan 31 16:45:03 2018 Return-Path: Delivered-To: svn-src-all@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 D3893ED6223; Wed, 31 Jan 2018 16:45:03 +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 4AC046DCEA; Wed, 31 Jan 2018 16:45:03 +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 w0VGitWK070158 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 31 Jan 2018 18:44:58 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0VGitWK070158 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0VGittK070157; Wed, 31 Jan 2018 18:44:55 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 31 Jan 2018 18:44:55 +0200 From: Konstantin Belousov To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 Message-ID: <20180131164455.GR97752@kib.kiev.ua> References: <201801311436.w0VEaRrZ030839@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 16:45:04 -0000 On Wed, Jan 31, 2018 at 02:56:24PM +0000, Bjoern A. Zeeb wrote: > On 31 Jan 2018, at 14:36, Konstantin Belousov wrote: > > > Author: kib > > Date: Wed Jan 31 14:36:27 2018 > > New Revision: 328625 > > URL: https://svnweb.freebsd.org/changeset/base/328625 > > > > Log: > > IBRS support, AKA Spectre hardware mitigation. > > > For existing processors, you need a microcode update which adds IBRS > > CPU features, and to manually enable it by setting the > > tunable/sysctl > > hw.ibrs_disable to 0. Current status can be checked in sysctl > > hw.ibrs_active. The mitigation might be inactive if the CPU feature > > Can you change the tunable/sysctl to hw.ibrs_enable[d] (and toggle the > default setting along). This is done consistently with the hw.clflush_disable. Anyway, the intent is that the knob will be used for disabling, since defaults are going to be changed in the near future. > I find it highly confusing to have two different sysctls ???disable??? > and ???active??? and a lot > of people (and cultures) have trouble with the double negative. > Also the ???enable[d]??? variant seems to be pre-dominant in the kernel. > > Also can we spell IBRS in the sysctl description as ???Indirect Branch > Restricted Speculation (IBRS)???? Will do in half a hour. From owner-svn-src-all@freebsd.org Wed Jan 31 16:54:06 2018 Return-Path: Delivered-To: svn-src-all@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 9E29BED692F; Wed, 31 Jan 2018 16:54:06 +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 506606E5DB; Wed, 31 Jan 2018 16:54:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AC5B289FB; Wed, 31 Jan 2018 16:54:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VGs6xL004834; Wed, 31 Jan 2018 16:54:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VGs6mv004833; Wed, 31 Jan 2018 16:54:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801311654.w0VGs6mv004833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 31 Jan 2018 16:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328627 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 328627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 16:54:06 -0000 Author: kib Date: Wed Jan 31 16:54:05 2018 New Revision: 328627 URL: https://svnweb.freebsd.org/changeset/base/328627 Log: Expand IBRS TLA in sysctl help lines. Requested by: bz Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Wed Jan 31 14:44:51 2018 (r328626) +++ head/sys/x86/x86/cpu_machdep.c Wed Jan 31 16:54:05 2018 (r328627) @@ -582,7 +582,7 @@ int hw_ibrs_active; int hw_ibrs_disable = 1; SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0, - "IBRS active"); + "Indirect Branch Restricted Speculation active"); void hw_ibrs_recalculate(void) @@ -620,4 +620,4 @@ hw_ibrs_disable_handler(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I", - "Disable IBRS"); + "Disable Indirect Branch Restricted Speculation"); From owner-svn-src-all@freebsd.org Wed Jan 31 16:56:03 2018 Return-Path: Delivered-To: svn-src-all@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 9793BED6AC2; Wed, 31 Jan 2018 16:56:03 +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 458AC6E795; Wed, 31 Jan 2018 16:56:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 384E9289FC; Wed, 31 Jan 2018 16:56:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VGu2v6004977; Wed, 31 Jan 2018 16:56:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VGu2YD004976; Wed, 31 Jan 2018 16:56:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801311656.w0VGu2YD004976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 31 Jan 2018 16:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328628 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 328628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 16:56:03 -0000 Author: kib Date: Wed Jan 31 16:56:02 2018 New Revision: 328628 URL: https://svnweb.freebsd.org/changeset/base/328628 Log: When switching IBRS on, also enable STIBP (Single Thread Indirect Branch Predictors) mitigation. DOcument 336996-001 promises that CPUs which implement IBRS but not STIBP silently ignore setting of the bit instead of trapping. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Wed Jan 31 16:54:05 2018 (r328627) +++ head/sys/amd64/amd64/support.S Wed Jan 31 16:56:02 2018 (r328628) @@ -875,8 +875,8 @@ ENTRY(handle_ibrs_entry) cmpb $0,hw_ibrs_active(%rip) je 1f movl $MSR_IA32_SPEC_CTRL,%ecx - movl $IA32_SPEC_CTRL_IBRS,%eax - movl $IA32_SPEC_CTRL_IBRS>>32,%edx + movl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax + movl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32,%edx wrmsr movb $1,PCPU(IBPB_SET) testl $CPUID_STDEXT_SMEP,cpu_stdext_feature(%rip) From owner-svn-src-all@freebsd.org Wed Jan 31 16:57:15 2018 Return-Path: Delivered-To: svn-src-all@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 E125AED6CB4; Wed, 31 Jan 2018 16:57:14 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::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 750DE6E95C; Wed, 31 Jan 2018 16:57:14 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt0-x229.google.com with SMTP id d8so22708259qtm.0; Wed, 31 Jan 2018 08:57:14 -0800 (PST) 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=U4d5X5CAd6jY7G0u4XJLOnDJWt6hsjImwcXDOY3cFHE=; b=jmvh/23qRpaM8MFlUevMakQgg6A/0A+crMzOcVIIb94ADb56/ZEHP5UrajkdSxUGcf 7gkMpDi3VXbVa6JkwDfVYRa0jSBiuNbjVdrZ52VAO94kBam4Y+UzmIUyHnSeK820AWR+ WYuFc33y0HkzBFbeuG0w7goAmayxOg+wBt+ZzBzWI3KpvPyk3q9TWSoixigvAUwZWb8E v//rjAMoAGjt9AyE0oJvFKLXDavAZ+gYv0HSP6uliyn60DOFznH2BO708OIvyRPlifxP tIzEyQgsMSNPWqCtmgWsWRGnridc3Jhiylh6r6tePyTcT8/uxzpZZYPYhV5o4II02u2X Lu8g== 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=U4d5X5CAd6jY7G0u4XJLOnDJWt6hsjImwcXDOY3cFHE=; b=HtEClfkMfeZ/9VV3SmE9+kyEK5NZLrIHUeZSLvZlXQakCT4GzeEKFc/8cTSljA1NJl SbWvlET5OZ2laiVo9dg0FQq/tEx51PZZgZW7b/5snDkubnRtRpLv5KQCUn8QEHOWs8z8 PwtQ5gLw+bx+9pZVHztQOq4OZBa1cQMfjyYPpQvrBjCclhWt1hTJwjqfo/CHqzHpaZiX xGZ9mauY6Zry2iOYyHOFfjW2N9FtsKcwF58MLcQg0tdCi3CJ4YQXJizmxc/AeriVJ0OA Eg3TuYn8toCIPGvYprOMVhY5B6DuMSH9Nj+7x7UTEhRmePxFGnh8QGUGOcqG9fHsFaG0 tCYQ== X-Gm-Message-State: AKwxytesraq1ABhj1+mSzfZkyUGXFn4ki8JnmLIm/IG1ec8X0xo3yax8 ubDOuu4pjCBWQBK2q2CxcnRbxw== X-Google-Smtp-Source: AH8x224htIk1E8dQnEGfIzMC6UzO+iO+kA6oujv4zW7DmR0nm6SICMlNy8Kf+QjT2T8Oc0lt/zGL5A== X-Received: by 10.200.22.240 with SMTP id y45mr52169256qtk.216.1517417833665; Wed, 31 Jan 2018 08:57:13 -0800 (PST) Received: from raichu (toroon0560w-lp140-02-70-49-169-112.dsl.bell.ca. [70.49.169.112]) by smtp.gmail.com with ESMTPSA id m70sm11008449qke.7.2018.01.31.08.57.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 08:57:12 -0800 (PST) Sender: Mark Johnston Date: Wed, 31 Jan 2018 11:57:08 -0500 From: Mark Johnston To: Kirk McKusick Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328383 - head/sbin/fsck_ffs Message-ID: <20180131165708.GA11199@raichu> References: <201801242357.w0ONve5P047566@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801242357.w0ONve5P047566@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 16:57:15 -0000 On Wed, Jan 24, 2018 at 11:57:40PM +0000, Kirk McKusick wrote: > Author: mckusick > Date: Wed Jan 24 23:57:40 2018 > New Revision: 328383 > URL: https://svnweb.freebsd.org/changeset/base/328383 > > Log: > More throughly integrate libufs into fsck_ffs by using its cgput() > routine to write out the cylinder groups rather than recreating the > calculation of the cylinder-group check hash in fsck_ffs. > > No functional change intended. > > Modified: > head/sbin/fsck_ffs/fsck.h > head/sbin/fsck_ffs/fsutil.c > head/sbin/fsck_ffs/gjournal.c > head/sbin/fsck_ffs/setup.c > head/sbin/fsck_ffs/suj.c Hi Kirk, This seems to break recovery of SU+J filesystems after an unclean shutdown. fsck_ffs appears to replay the journal and reports that the filesystem is marked clean, but a subsequent attempt to mount the filesystem rw returns an error. I need to run a full fsck or disable SU journaling in order to recover from a crash without manual intervention in single-user mode. From owner-svn-src-all@freebsd.org Wed Jan 31 17:08:16 2018 Return-Path: Delivered-To: svn-src-all@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 790A3ED7427; Wed, 31 Jan 2018 17:08:16 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::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 107DE6F010; Wed, 31 Jan 2018 17:08:16 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x244.google.com with SMTP id p188so15943011ioe.12; Wed, 31 Jan 2018 09:08:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jTRpiLCt4Mxeezof3CvjJKkPgwf3zyxwS4VOIVGT7og=; b=BiStnEKyTCUN/PsS5hy5v0q/I2f1VFG61XchpMeAM4fx2PJib7jifrKPsv/lHG6+5W oDcMcMmhK3f6OYPlWIy4676HbhvYGXH7DA5dvpDBUN1PfeglD4xcIsoah4lHV1kxxvqp B/THfKmO92FjsWUBzp7+WF8ouPjNJIbPjWL4YrXQwRGuCNP6MMrYvx52rbVgQjogJSci bdOfV9/ImjDoNxec32jYRl388JAxqpkBTflmc/u/fzrariQ2GK7Cp/OGyaJ38dGLpaR5 0yjSFJ64PFOZL0/mfDnOH27tIi2tDR9yDl/lmAcSkIHR5ap4bWmY0mE8G+TkDVGGQiYl s7xg== 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=jTRpiLCt4Mxeezof3CvjJKkPgwf3zyxwS4VOIVGT7og=; b=d6Bqll+ZOmdxemGVEfyZhLTVj+LeLLizRoCvpexaVxiYD0+r8gidhc88sRBalNmauI w3GV+V1vLF80AfiM5D8h9C5N2OqzeAPdyHC6yq+7/26mGu0zPrrXQQ6etULcVrBgfWZC PfCwgjD4FFb5E8THAek/lvZ3TgFXpUpG6zAmN4lj/dI1XVpOEMvDgtEPehti0XIz36X5 SsciISRE+BuyC+DxRGDwChLSmWrQx3KR53BtK6fTYGTup179TnJ8yxUVBj3KIsChgB6U HUKzbA4W75WbxvPI8CDsSS56VunOR6faDaz/GYf1vWAW1AGk1MSCFP0xoVWS0UCfQ8pB ZXNQ== X-Gm-Message-State: AKwxytcrxPLgMNUvIOX/EuF2rXHLpnkRoQdAz0OyHYlkOzxVjeREXmJE 3SfhKKIh7fd4RFhuAMjO1mC4W1/w5gpc8gX5oCEoZA== X-Google-Smtp-Source: AH8x22713+NwI5ZUXziD3ikBrcMLLpzkNlnlX2YjoO/5TUc9knZ2K8o+NH79K8loatiteaPjU+74oUxidZh1SEiffXA= X-Received: by 10.107.201.136 with SMTP id z130mr7584523iof.257.1517418495414; Wed, 31 Jan 2018 09:08:15 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.152.9 with HTTP; Wed, 31 Jan 2018 09:07:54 -0800 (PST) In-Reply-To: References: <201801311436.w0VEaRrZ030839@repo.freebsd.org> From: Ed Maste Date: Wed, 31 Jan 2018 12:07:54 -0500 X-Google-Sender-Auth: VeCstfoyFWWYv7la2cUPbgsH20w Message-ID: Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 To: "Bjoern A. Zeeb" Cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 17:08:16 -0000 On 31 January 2018 at 09:56, Bjoern A. Zeeb wrote: > On 31 Jan 2018, at 14:36, Konstantin Belousov wrote: > >> Author: kib >> Date: Wed Jan 31 14:36:27 2018 >> New Revision: 328625 >> URL: https://svnweb.freebsd.org/changeset/base/328625 >> >> Log: >> IBRS support, AKA Spectre hardware mitigation. > > >> For existing processors, you need a microcode update which adds IBRS >> CPU features, and to manually enable it by setting the tunable/sysctl >> hw.ibrs_disable to 0. Current status can be checked in sysctl >> hw.ibrs_active. The mitigation might be inactive if the CPU feature > > > Can you change the tunable/sysctl to hw.ibrs_enable[d] (and toggle the > default setting along). I had a similar thought while the change was in review, but saw that a number of tunables in similar areas also have negative sense. That said perhaps (some minor) consistency is not enough of an argument for the somewhat more confusing sense. From owner-svn-src-all@freebsd.org Wed Jan 31 17:36:41 2018 Return-Path: Delivered-To: svn-src-all@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 0F802ED878E; Wed, 31 Jan 2018 17:36:41 +0000 (UTC) (envelope-from jhb@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 B24ED6FDC5; Wed, 31 Jan 2018 17:36:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A847229041; Wed, 31 Jan 2018 17:36:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VHaes5024682; Wed, 31 Jan 2018 17:36:40 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VHaeii024678; Wed, 31 Jan 2018 17:36:40 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311736.w0VHaeii024678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 17:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328629 - in head: lib/libc/mips/gen sys/mips/include sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: lib/libc/mips/gen sys/mips/include sys/mips/mips X-SVN-Commit-Revision: 328629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 17:36:41 -0000 Author: jhb Date: Wed Jan 31 17:36:39 2018 New Revision: 328629 URL: https://svnweb.freebsd.org/changeset/base/328629 Log: Consistently use 16-byte alignment for MIPS N32 and N64. - Add a new header to hold constants shared between C and assembly such as CALLFRAME_SZ. - Add a new STACK_ALIGN constant to and use it to replace hardcoded constants in the kernel and makecontext(). As a result of this, ensure the stack pointer on N32 and N64 is 16-byte aligned for N32 and N64 after exec(), after pthread_create(), and when sending signals rather than 8-byte aligned. Reviewed by: jmallett Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D13875 Added: head/sys/mips/include/abi.h - copied, changed from r328626, head/sys/mips/include/asm.h Modified: head/lib/libc/mips/gen/makecontext.c head/sys/mips/include/asm.h head/sys/mips/mips/pm_machdep.c head/sys/mips/mips/vm_machdep.c Modified: head/lib/libc/mips/gen/makecontext.c ============================================================================== --- head/lib/libc/mips/gen/makecontext.c Wed Jan 31 16:56:02 2018 (r328628) +++ head/lib/libc/mips/gen/makecontext.c Wed Jan 31 17:36:39 2018 (r328629) @@ -38,6 +38,7 @@ __RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07 #endif #include +#include #include #include @@ -75,13 +76,10 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int ((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); #if defined(__mips_o32) || defined(__mips_o64) sp -= (argc >= 4 ? argc : 4); /* Make room for >=4 arguments. */ - sp = (register_t *) - ((uintptr_t)sp & ~0x7); /* Align on double-word boundary. */ #elif defined(__mips_n32) || defined(__mips_n64) sp -= (argc > 8 ? argc - 8 : 0); /* Make room for > 8 arguments. */ - sp = (register_t *) - ((uintptr_t)sp & ~0xf); /* Align on quad-word boundary. */ #endif + sp = (register_t *)((uintptr_t)sp & ~(STACK_ALIGN - 1)); mc->mc_regs[SP] = (intptr_t)sp; mc->mc_regs[S0] = (intptr_t)ucp; Copied and modified: head/sys/mips/include/abi.h (from r328626, head/sys/mips/include/asm.h) ============================================================================== --- head/sys/mips/include/asm.h Wed Jan 31 14:44:51 2018 (r328626, copy source) +++ head/sys/mips/include/abi.h Wed Jan 31 17:36:39 2018 (r328629) @@ -55,214 +55,9 @@ * v 1.2 89/08/15 18:28:24 rab Exp SPRITE (DECWRL) */ -#ifndef _MACHINE_ASM_H_ -#define _MACHINE_ASM_H_ +#ifndef _MACHINE_ABI_H_ +#define _MACHINE_ABI_H_ -#include -#include -#include - -#undef __FBSDID -#if !defined(lint) && !defined(STRIP_FBSDID) -#define __FBSDID(s) .ident s -#else -#define __FBSDID(s) /* nothing */ -#endif - -/* - * Define -pg profile entry code. - * Must always be noreorder, must never use a macro instruction - * Final addiu to t9 must always equal the size of this _KERN_MCOUNT - */ -#define _KERN_MCOUNT \ - .set push; \ - .set noreorder; \ - .set noat; \ - subu sp,sp,16; \ - sw t9,12(sp); \ - move AT,ra; \ - lui t9,%hi(_mcount); \ - addiu t9,t9,%lo(_mcount); \ - jalr t9; \ - nop; \ - lw t9,4(sp); \ - addiu sp,sp,8; \ - addiu t9,t9,40; \ - .set pop; - -#ifdef GPROF -#define MCOUNT _KERN_MCOUNT -#else -#define MCOUNT -#endif - -#define _C_LABEL(x) x - -#ifdef USE_AENT -#define AENT(x) \ - .aent x, 0 -#else -#define AENT(x) -#endif - -/* - * WARN_REFERENCES: create a warning if the specified symbol is referenced - */ -#define WARN_REFERENCES(_sym,_msg) \ - .section .gnu.warning. ## _sym ; .ascii _msg ; .text - -#ifdef __ELF__ -# define _C_LABEL(x) x -#else -# define _C_LABEL(x) _ ## x -#endif - -/* - * WEAK_ALIAS: create a weak alias. - */ -#define WEAK_ALIAS(alias,sym) \ - .weak alias; \ - alias = sym - -/* - * STRONG_ALIAS: create a strong alias. - */ -#define STRONG_ALIAS(alias,sym) \ - .globl alias; \ - alias = sym - -#define GLOBAL(sym) \ - .globl sym; sym: - -#define ENTRY(sym) \ - .text; .globl sym; .ent sym; sym: - -#define ASM_ENTRY(sym) \ - .text; .globl sym; .type sym,@function; sym: - -/* - * LEAF - * A leaf routine does - * - call no other function, - * - never use any register that callee-saved (S0-S8), and - * - not use any local stack storage. - */ -#define LEAF(x) \ - .globl _C_LABEL(x); \ - .ent _C_LABEL(x), 0; \ -_C_LABEL(x): ; \ - .frame sp, 0, ra; \ - MCOUNT - -/* - * LEAF_NOPROFILE - * No profilable leaf routine. - */ -#define LEAF_NOPROFILE(x) \ - .globl _C_LABEL(x); \ - .ent _C_LABEL(x), 0; \ -_C_LABEL(x): ; \ - .frame sp, 0, ra - -/* - * XLEAF - * declare alternate entry to leaf routine - */ -#define XLEAF(x) \ - .globl _C_LABEL(x); \ - AENT (_C_LABEL(x)); \ -_C_LABEL(x): - -/* - * NESTED - * A function calls other functions and needs - * therefore stack space to save/restore registers. - */ -#define NESTED(x, fsize, retpc) \ - .globl _C_LABEL(x); \ - .ent _C_LABEL(x), 0; \ -_C_LABEL(x): ; \ - .frame sp, fsize, retpc; \ - MCOUNT - -/* - * NESTED_NOPROFILE(x) - * No profilable nested routine. - */ -#define NESTED_NOPROFILE(x, fsize, retpc) \ - .globl _C_LABEL(x); \ - .ent _C_LABEL(x), 0; \ -_C_LABEL(x): ; \ - .frame sp, fsize, retpc - -/* - * XNESTED - * declare alternate entry point to nested routine. - */ -#define XNESTED(x) \ - .globl _C_LABEL(x); \ - AENT (_C_LABEL(x)); \ -_C_LABEL(x): - -/* - * END - * Mark end of a procedure. - */ -#define END(x) \ - .end _C_LABEL(x) - -/* - * IMPORT -- import external symbol - */ -#define IMPORT(sym, size) \ - .extern _C_LABEL(sym),size - -/* - * EXPORT -- export definition of symbol - */ -#define EXPORT(x) \ - .globl _C_LABEL(x); \ -_C_LABEL(x): - -/* - * VECTOR - * exception vector entrypoint - * XXX: regmask should be used to generate .mask - */ -#define VECTOR(x, regmask) \ - .ent _C_LABEL(x),0; \ - EXPORT(x); \ - -#define VECTOR_END(x) \ - EXPORT(x ## End); \ - END(x) - -/* - * Macros to panic and printf from assembly language. - */ -#define PANIC(msg) \ - PTR_LA a0, 9f; \ - jal _C_LABEL(panic); \ - nop; \ - MSG(msg) - -#define PANIC_KSEG0(msg, reg) PANIC(msg) - -#define PRINTF(msg) \ - PTR_LA a0, 9f; \ - jal _C_LABEL(printf); \ - nop; \ - MSG(msg) - -#define MSG(msg) \ - .rdata; \ -9: .asciiz msg; \ - .text - -#define ASMSTR(str) \ - .asciiz str; \ - .align 3 - #if defined(__mips_o32) #define SZREG 4 #else @@ -270,17 +65,9 @@ _C_LABEL(x): #endif #if defined(__mips_o32) || defined(__mips_o64) -#define ALSK 7 /* stack alignment */ -#define ALMASK -7 /* stack alignment */ -#define SZFPREG 4 -#define FP_L lwc1 -#define FP_S swc1 +#define STACK_ALIGN 8 #else -#define ALSK 15 /* stack alignment */ -#define ALMASK -15 /* stack alignment */ -#define SZFPREG 8 -#define FP_L ldc1 -#define FP_S sdc1 +#define STACK_ALIGN 16 #endif /* @@ -305,409 +92,4 @@ _C_LABEL(x): #define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG) #define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG) -/* - * Endian-independent assembly-code aliases for unaligned memory accesses. - */ -#if _BYTE_ORDER == _LITTLE_ENDIAN -# define LWHI lwr -# define LWLO lwl -# define SWHI swr -# define SWLO swl -# if SZREG == 4 -# define REG_LHI lwr -# define REG_LLO lwl -# define REG_SHI swr -# define REG_SLO swl -# else -# define REG_LHI ldr -# define REG_LLO ldl -# define REG_SHI sdr -# define REG_SLO sdl -# endif -#endif - -#if _BYTE_ORDER == _BIG_ENDIAN -# define LWHI lwl -# define LWLO lwr -# define SWHI swl -# define SWLO swr -# if SZREG == 4 -# define REG_LHI lwl -# define REG_LLO lwr -# define REG_SHI swl -# define REG_SLO swr -# else -# define REG_LHI ldl -# define REG_LLO ldr -# define REG_SHI sdl -# define REG_SLO sdr -# endif -#endif - -/* - * While it would be nice to be compatible with the SGI - * REG_L and REG_S macros, because they do not take parameters, it - * is impossible to use them with the _MIPS_SIM_ABIX32 model. - * - * These macros hide the use of mips3 instructions from the - * assembler to prevent the assembler from generating 64-bit style - * ABI calls. - */ -#if _MIPS_SZPTR == 32 -#define PTR_ADD add -#define PTR_ADDI addi -#define PTR_ADDU addu -#define PTR_ADDIU addiu -#define PTR_SUB add -#define PTR_SUBI subi -#define PTR_SUBU subu -#define PTR_SUBIU subu -#define PTR_L lw -#define PTR_LA la -#define PTR_LI li -#define PTR_S sw -#define PTR_SLL sll -#define PTR_SLLV sllv -#define PTR_SRL srl -#define PTR_SRLV srlv -#define PTR_SRA sra -#define PTR_SRAV srav -#define PTR_LL ll -#define PTR_SC sc -#define PTR_WORD .word -#define PTR_SCALESHIFT 2 -#else /* _MIPS_SZPTR == 64 */ -#define PTR_ADD dadd -#define PTR_ADDI daddi -#define PTR_ADDU daddu -#define PTR_ADDIU daddiu -#define PTR_SUB dadd -#define PTR_SUBI dsubi -#define PTR_SUBU dsubu -#define PTR_SUBIU dsubu -#define PTR_L ld -#define PTR_LA dla -#define PTR_LI dli -#define PTR_S sd -#define PTR_SLL dsll -#define PTR_SLLV dsllv -#define PTR_SRL dsrl -#define PTR_SRLV dsrlv -#define PTR_SRA dsra -#define PTR_SRAV dsrav -#define PTR_LL lld -#define PTR_SC scd -#define PTR_WORD .dword -#define PTR_SCALESHIFT 3 -#endif /* _MIPS_SZPTR == 64 */ - -#if _MIPS_SZINT == 32 -#define INT_ADD add -#define INT_ADDI addi -#define INT_ADDU addu -#define INT_ADDIU addiu -#define INT_SUB add -#define INT_SUBI subi -#define INT_SUBU subu -#define INT_SUBIU subu -#define INT_L lw -#define INT_LA la -#define INT_S sw -#define INT_SLL sll -#define INT_SLLV sllv -#define INT_SRL srl -#define INT_SRLV srlv -#define INT_SRA sra -#define INT_SRAV srav -#define INT_LL ll -#define INT_SC sc -#define INT_WORD .word -#define INT_SCALESHIFT 2 -#else -#define INT_ADD dadd -#define INT_ADDI daddi -#define INT_ADDU daddu -#define INT_ADDIU daddiu -#define INT_SUB dadd -#define INT_SUBI dsubi -#define INT_SUBU dsubu -#define INT_SUBIU dsubu -#define INT_L ld -#define INT_LA dla -#define INT_S sd -#define INT_SLL dsll -#define INT_SLLV dsllv -#define INT_SRL dsrl -#define INT_SRLV dsrlv -#define INT_SRA dsra -#define INT_SRAV dsrav -#define INT_LL lld -#define INT_SC scd -#define INT_WORD .dword -#define INT_SCALESHIFT 3 -#endif - -#if _MIPS_SZLONG == 32 -#define LONG_ADD add -#define LONG_ADDI addi -#define LONG_ADDU addu -#define LONG_ADDIU addiu -#define LONG_SUB add -#define LONG_SUBI subi -#define LONG_SUBU subu -#define LONG_SUBIU subu -#define LONG_L lw -#define LONG_LA la -#define LONG_S sw -#define LONG_SLL sll -#define LONG_SLLV sllv -#define LONG_SRL srl -#define LONG_SRLV srlv -#define LONG_SRA sra -#define LONG_SRAV srav -#define LONG_LL ll -#define LONG_SC sc -#define LONG_WORD .word -#define LONG_SCALESHIFT 2 -#else -#define LONG_ADD dadd -#define LONG_ADDI daddi -#define LONG_ADDU daddu -#define LONG_ADDIU daddiu -#define LONG_SUB dadd -#define LONG_SUBI dsubi -#define LONG_SUBU dsubu -#define LONG_SUBIU dsubu -#define LONG_L ld -#define LONG_LA dla -#define LONG_S sd -#define LONG_SLL dsll -#define LONG_SLLV dsllv -#define LONG_SRL dsrl -#define LONG_SRLV dsrlv -#define LONG_SRA dsra -#define LONG_SRAV dsrav -#define LONG_LL lld -#define LONG_SC scd -#define LONG_WORD .dword -#define LONG_SCALESHIFT 3 -#endif - -#if SZREG == 4 -#define REG_L lw -#define REG_S sw -#define REG_LI li -#define REG_ADDU addu -#define REG_SLL sll -#define REG_SLLV sllv -#define REG_SRL srl -#define REG_SRLV srlv -#define REG_SRA sra -#define REG_SRAV srav -#define REG_LL ll -#define REG_SC sc -#define REG_SCALESHIFT 2 -#else -#define REG_L ld -#define REG_S sd -#define REG_LI dli -#define REG_ADDU daddu -#define REG_SLL dsll -#define REG_SLLV dsllv -#define REG_SRL dsrl -#define REG_SRLV dsrlv -#define REG_SRA dsra -#define REG_SRAV dsrav -#define REG_LL lld -#define REG_SC scd -#define REG_SCALESHIFT 3 -#endif - -#if _MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || \ - _MIPS_ISA == _MIPS_ISA_MIPS32 -#define MFC0 mfc0 -#define MTC0 mtc0 -#endif -#if _MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || \ - _MIPS_ISA == _MIPS_ISA_MIPS64 -#define MFC0 dmfc0 -#define MTC0 dmtc0 -#endif - -#if defined(__mips_o32) || defined(__mips_o64) - -#ifdef __ABICALLS__ -#define CPRESTORE(r) .cprestore r -#define CPLOAD(r) .cpload r -#else -#define CPRESTORE(r) /* not needed */ -#define CPLOAD(r) /* not needed */ -#endif - -#define SETUP_GP \ - .set push; \ - .set noreorder; \ - .cpload t9; \ - .set pop -#define SETUP_GPX(r) \ - .set push; \ - .set noreorder; \ - move r,ra; /* save old ra */ \ - bal 7f; \ - nop; \ - 7: .cpload ra; \ - move ra,r; \ - .set pop -#define SETUP_GPX_L(r,lbl) \ - .set push; \ - .set noreorder; \ - move r,ra; /* save old ra */ \ - bal lbl; \ - nop; \ - lbl: .cpload ra; \ - move ra,r; \ - .set pop -#define SAVE_GP(x) .cprestore x - -#define SETUP_GP64(a,b) /* n32/n64 specific */ -#define SETUP_GP64_R(a,b) /* n32/n64 specific */ -#define SETUP_GPX64(a,b) /* n32/n64 specific */ -#define SETUP_GPX64_L(a,b,c) /* n32/n64 specific */ -#define RESTORE_GP64 /* n32/n64 specific */ -#define USE_ALT_CP(a) /* n32/n64 specific */ -#endif /* __mips_o32 || __mips_o64 */ - -#if defined(__mips_o32) || defined(__mips_o64) -#define REG_PROLOGUE .set push -#define REG_EPILOGUE .set pop -#endif -#if defined(__mips_n32) || defined(__mips_n64) -#define REG_PROLOGUE .set push ; .set mips3 -#define REG_EPILOGUE .set pop -#endif - -#if defined(__mips_n32) || defined(__mips_n64) -#define SETUP_GP /* o32 specific */ -#define SETUP_GPX(r) /* o32 specific */ -#define SETUP_GPX_L(r,lbl) /* o32 specific */ -#define SAVE_GP(x) /* o32 specific */ -#define SETUP_GP64(a,b) .cpsetup $25, a, b -#define SETUP_GPX64(a,b) \ - .set push; \ - move b,ra; \ - .set noreorder; \ - bal 7f; \ - nop; \ - 7: .set pop; \ - .cpsetup ra, a, 7b; \ - move ra,b -#define SETUP_GPX64_L(a,b,c) \ - .set push; \ - move b,ra; \ - .set noreorder; \ - bal c; \ - nop; \ - c: .set pop; \ - .cpsetup ra, a, c; \ - move ra,b -#define RESTORE_GP64 .cpreturn -#define USE_ALT_CP(a) .cplocal a -#endif /* __mips_n32 || __mips_n64 */ - -#define GET_CPU_PCPU(reg) \ - PTR_L reg, _C_LABEL(pcpup); - -/* - * Description of the setjmp buffer - * - * word 0 magic number (dependant on creator) - * 1 RA - * 2 S0 - * 3 S1 - * 4 S2 - * 5 S3 - * 6 S4 - * 7 S5 - * 8 S6 - * 9 S7 - * 10 SP - * 11 S8 - * 12 GP (dependent on ABI) - * 13 signal mask (dependant on magic) - * 14 (con't) - * 15 (con't) - * 16 (con't) - * - * The magic number number identifies the jmp_buf and - * how the buffer was created as well as providing - * a sanity check - * - */ - -#define _JB_MAGIC__SETJMP 0xBADFACED -#define _JB_MAGIC_SETJMP 0xFACEDBAD - -/* Valid for all jmp_buf's */ - -#define _JB_MAGIC 0 -#define _JB_REG_RA 1 -#define _JB_REG_S0 2 -#define _JB_REG_S1 3 -#define _JB_REG_S2 4 -#define _JB_REG_S3 5 -#define _JB_REG_S4 6 -#define _JB_REG_S5 7 -#define _JB_REG_S6 8 -#define _JB_REG_S7 9 -#define _JB_REG_SP 10 -#define _JB_REG_S8 11 -#if defined(__mips_n32) || defined(__mips_n64) -#define _JB_REG_GP 12 -#endif - -/* Only valid with the _JB_MAGIC_SETJMP magic */ - -#define _JB_SIGMASK 13 -#define __JB_SIGMASK_REMAINDER 14 /* sigmask_t is 128-bits */ - -#define _JB_FPREG_F20 15 -#define _JB_FPREG_F21 16 -#define _JB_FPREG_F22 17 -#define _JB_FPREG_F23 18 -#define _JB_FPREG_F24 19 -#define _JB_FPREG_F25 20 -#define _JB_FPREG_F26 21 -#define _JB_FPREG_F27 22 -#define _JB_FPREG_F28 23 -#define _JB_FPREG_F29 24 -#define _JB_FPREG_F30 25 -#define _JB_FPREG_F31 26 -#define _JB_FPREG_FCSR 27 - -/* - * Various macros for dealing with TLB hazards - * (a) why so many? - * (b) when to use? - * (c) why not used everywhere? - */ -/* - * Assume that w alaways need nops to escape CP0 hazard - * TODO: Make hazard delays configurable. Stuck with 5 cycles on the moment - * For more info on CP0 hazards see Chapter 7 (p.99) of "MIPS32 Architecture - * For Programmers Volume III: The MIPS32 Privileged Resource Architecture" - */ -#if defined(CPU_NLM) -#define HAZARD_DELAY sll $0,3 -#define ITLBNOPFIX sll $0,3 -#elif defined(CPU_RMI) -#define HAZARD_DELAY -#define ITLBNOPFIX -#elif defined(CPU_MIPS74K) -#define HAZARD_DELAY sll $0,$0,3 -#define ITLBNOPFIX sll $0,$0,3 -#else -#define ITLBNOPFIX nop;nop;nop;nop;nop;nop;nop;nop;nop;sll $0,$0,3; -#define HAZARD_DELAY nop;nop;nop;nop;sll $0,$0,3; -#endif - -#endif /* !_MACHINE_ASM_H_ */ +#endif /* !_MACHINE_ABI_H_ */ Modified: head/sys/mips/include/asm.h ============================================================================== --- head/sys/mips/include/asm.h Wed Jan 31 16:56:02 2018 (r328628) +++ head/sys/mips/include/asm.h Wed Jan 31 17:36:39 2018 (r328629) @@ -58,6 +58,7 @@ #ifndef _MACHINE_ASM_H_ #define _MACHINE_ASM_H_ +#include #include #include #include @@ -263,12 +264,6 @@ _C_LABEL(x): .asciiz str; \ .align 3 -#if defined(__mips_o32) -#define SZREG 4 -#else -#define SZREG 8 -#endif - #if defined(__mips_o32) || defined(__mips_o64) #define ALSK 7 /* stack alignment */ #define ALMASK -7 /* stack alignment */ @@ -282,28 +277,6 @@ _C_LABEL(x): #define FP_L ldc1 #define FP_S sdc1 #endif - -/* - * standard callframe { - * register_t cf_pad[N]; o32/64 (N=0), n32 (N=1) n64 (N=1) - * register_t cf_args[4]; arg0 - arg3 (only on o32 and o64) - * register_t cf_gp; global pointer (only on n32 and n64) - * register_t cf_sp; frame pointer - * register_t cf_ra; return address - * }; - */ -#if defined(__mips_o32) || defined(__mips_o64) -#define CALLFRAME_SIZ (SZREG * (4 + 2)) -#define CALLFRAME_S0 0 -#elif defined(__mips_n32) || defined(__mips_n64) -#define CALLFRAME_SIZ (SZREG * 4) -#define CALLFRAME_S0 (CALLFRAME_SIZ - 4 * SZREG) -#endif -#ifndef _KERNEL -#define CALLFRAME_GP (CALLFRAME_SIZ - 3 * SZREG) -#endif -#define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG) -#define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG) /* * Endian-independent assembly-code aliases for unaligned memory accesses. Modified: head/sys/mips/mips/pm_machdep.c ============================================================================== --- head/sys/mips/mips/pm_machdep.c Wed Jan 31 16:56:02 2018 (r328628) +++ head/sys/mips/mips/pm_machdep.c Wed Jan 31 17:36:39 2018 (r328629) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -132,10 +133,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask SIGISMEMBER(psp->ps_sigonstack, sig)) { sfp = (struct sigframe *)(((uintptr_t)td->td_sigstk.ss_sp + td->td_sigstk.ss_size - sizeof(struct sigframe)) - & ~(sizeof(__int64_t) - 1)); + & ~(STACK_ALIGN - 1)); } else sfp = (struct sigframe *)((vm_offset_t)(regs->sp - - sizeof(struct sigframe)) & ~(sizeof(__int64_t) - 1)); + sizeof(struct sigframe)) & ~(STACK_ALIGN - 1)); /* Build the argument list for the signal handler. */ regs->a0 = sig; @@ -408,12 +409,7 @@ exec_setregs(struct thread *td, struct image_params *i bzero((caddr_t)td->td_frame, sizeof(struct trapframe)); - /* - * The stack pointer has to be aligned to accommodate the largest - * datatype at minimum. This probably means it should be 16-byte - * aligned, but for now we're 8-byte aligning it. - */ - td->td_frame->sp = ((register_t) stack) & ~(sizeof(__int64_t) - 1); + td->td_frame->sp = ((register_t)stack) & ~(STACK_ALIGN - 1); /* * If we're running o32 or n32 programs but have 64-bit registers, Modified: head/sys/mips/mips/vm_machdep.c ============================================================================== --- head/sys/mips/mips/vm_machdep.c Wed Jan 31 16:56:02 2018 (r328628) +++ head/sys/mips/mips/vm_machdep.c Wed Jan 31 17:36:39 2018 (r328629) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -82,18 +83,6 @@ __FBSDID("$FreeBSD$"); #include #include -/* Duplicated from asm.h */ -#if defined(__mips_o32) -#define SZREG 4 -#else -#define SZREG 8 -#endif -#if defined(__mips_o32) || defined(__mips_o64) -#define CALLFRAME_SIZ (SZREG * (4 + 2)) -#elif defined(__mips_n32) || defined(__mips_n64) -#define CALLFRAME_SIZ (SZREG * 4) -#endif - /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -430,13 +419,7 @@ cpu_set_upcall(struct thread *td, void (*entry)(void * struct trapframe *tf; register_t sp; - /* - * At the point where a function is called, sp must be 8 - * byte aligned[for compatibility with 64-bit CPUs] - * in ``See MIPS Run'' by D. Sweetman, p. 269 - * align stack - */ - sp = (((intptr_t)stack->ss_sp + stack->ss_size) & ~0x7) - + sp = (((intptr_t)stack->ss_sp + stack->ss_size) & ~(STACK_ALIGN - 1)) - CALLFRAME_SIZ; /* From owner-svn-src-all@freebsd.org Wed Jan 31 17:56:37 2018 Return-Path: Delivered-To: svn-src-all@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 4C0A1ED97FF; Wed, 31 Jan 2018 17:56:37 +0000 (UTC) (envelope-from jhb@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 E697C70A93; Wed, 31 Jan 2018 17:56:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D69BF2936A; Wed, 31 Jan 2018 17:56:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VHuab8034866; Wed, 31 Jan 2018 17:56:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VHuamh034865; Wed, 31 Jan 2018 17:56:36 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311756.w0VHuamh034865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 17:56:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328630 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 328630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 17:56:37 -0000 Author: jhb Date: Wed Jan 31 17:56:36 2018 New Revision: 328630 URL: https://svnweb.freebsd.org/changeset/base/328630 Log: Clarify that the additional arguments to makecontext() are of type int. MFC after: 1 week Sponsored by: DARPA / AFRL Modified: head/lib/libc/gen/makecontext.3 Modified: head/lib/libc/gen/makecontext.3 ============================================================================== --- head/lib/libc/gen/makecontext.3 Wed Jan 31 17:36:39 2018 (r328629) +++ head/lib/libc/gen/makecontext.3 Wed Jan 31 17:56:36 2018 (r328630) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 10, 2002 +.Dd January 31, 2018 .Dt MAKECONTEXT 3 .Os .Sh NAME @@ -68,11 +68,16 @@ with the arguments provided. The .Fa argc argument -must be equal to the number of additional arguments provided to +must be equal to the number of additional arguments of type +.Vt int +provided to .Fn makecontext -and also equal to the number of arguments to -.Fn func , -or else the behavior is undefined. +and also equal to the number of arguments of type +.Vt int +to +.Fn func ; +otherwise , +the behavior is undefined. .Pp The .Fa "ucp->uc_link" From owner-svn-src-all@freebsd.org Wed Jan 31 17:58:00 2018 Return-Path: Delivered-To: svn-src-all@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 B2BB8ED995C; Wed, 31 Jan 2018 17:58:00 +0000 (UTC) (envelope-from jhb@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 6130070CE1; Wed, 31 Jan 2018 17:58:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C2D62936C; Wed, 31 Jan 2018 17:58:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VHw0CA035139; Wed, 31 Jan 2018 17:58:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VHw0NT035135; Wed, 31 Jan 2018 17:58:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311758.w0VHw0NT035135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 17:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328631 - in head/lib/libc: i386/gen powerpc/gen powerpc64/gen X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/lib/libc: i386/gen powerpc/gen powerpc64/gen X-SVN-Commit-Revision: 328631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 17:58:00 -0000 Author: jhb Date: Wed Jan 31 17:57:59 2018 New Revision: 328631 URL: https://svnweb.freebsd.org/changeset/base/328631 Log: Remove bogus checks against NCARGS. NCARGS isn't a limit on the number of arguments to pass to a function, but the number of bytes that can be consumed by arguments to exec. As such, it is not suitable for a limit on the count of arguments passed to makecontext(). Sponsored by: DARPA / AFRL Modified: head/lib/libc/i386/gen/makecontext.c head/lib/libc/powerpc/gen/makecontext.c head/lib/libc/powerpc64/gen/makecontext.c Modified: head/lib/libc/i386/gen/makecontext.c ============================================================================== --- head/lib/libc/i386/gen/makecontext.c Wed Jan 31 17:56:36 2018 (r328630) +++ head/lib/libc/i386/gen/makecontext.c Wed Jan 31 17:57:59 2018 (r328631) @@ -85,7 +85,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in ucp->uc_mcontext.mc_len = 0; } /* XXX - Do we want to sanity check argc? */ - else if ((argc < 0) || (argc > NCARGS)) { + else if (argc < 0) { ucp->uc_mcontext.mc_len = 0; } /* Make sure the context is valid. */ Modified: head/lib/libc/powerpc/gen/makecontext.c ============================================================================== --- head/lib/libc/powerpc/gen/makecontext.c Wed Jan 31 17:56:36 2018 (r328630) +++ head/lib/libc/powerpc/gen/makecontext.c Wed Jan 31 17:57:59 2018 (r328631) @@ -66,7 +66,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in int i, regargs, stackargs; /* Sanity checks */ - if ((ucp == NULL) || (argc < 0) || (argc > NCARGS) + if ((ucp == NULL) || (argc < 0) || (ucp->uc_stack.ss_sp == NULL) || (ucp->uc_stack.ss_size < MINSIGSTKSZ)) { /* invalidate context */ Modified: head/lib/libc/powerpc64/gen/makecontext.c ============================================================================== --- head/lib/libc/powerpc64/gen/makecontext.c Wed Jan 31 17:56:36 2018 (r328630) +++ head/lib/libc/powerpc64/gen/makecontext.c Wed Jan 31 17:57:59 2018 (r328631) @@ -66,7 +66,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in int i, regargs, stackargs; /* Sanity checks */ - if ((ucp == NULL) || (argc < 0) || (argc > NCARGS) + if ((ucp == NULL) || (argc < 0) || (ucp->uc_stack.ss_sp == NULL) || (ucp->uc_stack.ss_size < MINSIGSTKSZ)) { /* invalidate context */ From owner-svn-src-all@freebsd.org Wed Jan 31 18:00:23 2018 Return-Path: Delivered-To: svn-src-all@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 A822BED9B57; Wed, 31 Jan 2018 18:00:23 +0000 (UTC) (envelope-from jhb@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 5DC7670F8C; Wed, 31 Jan 2018 18:00:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58C6A29372; Wed, 31 Jan 2018 18:00:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VI0Nso035712; Wed, 31 Jan 2018 18:00:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VI0NFA035711; Wed, 31 Jan 2018 18:00:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311800.w0VI0NFA035711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 18:00:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328632 - head/lib/libc/mips/gen X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libc/mips/gen X-SVN-Commit-Revision: 328632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 18:00:23 -0000 Author: jhb Date: Wed Jan 31 18:00:23 2018 New Revision: 328632 URL: https://svnweb.freebsd.org/changeset/base/328632 Log: Remove limitation of 6 arguments for makecontext() on mips. This implementation spills additional arguments on the stack so works fine with more than 6 arguments. I believe the check was just copied over from sparc64 (which doesn't support spilling onto the stack) Sponsored by: DARPA / AFRL Modified: head/lib/libc/mips/gen/makecontext.c Modified: head/lib/libc/mips/gen/makecontext.c ============================================================================== --- head/lib/libc/mips/gen/makecontext.c Wed Jan 31 17:57:59 2018 (r328631) +++ head/lib/libc/mips/gen/makecontext.c Wed Jan 31 18:00:23 2018 (r328632) @@ -66,7 +66,7 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int * so that we can mark a context as invalid. Store it in * mc->mc_regs[ZERO] perhaps? */ - if (argc < 0 || argc > 6 || ucp == NULL || + if (argc < 0 || ucp == NULL || ucp->uc_stack.ss_sp == NULL || ucp->uc_stack.ss_size < MINSIGSTKSZ) return; From owner-svn-src-all@freebsd.org Wed Jan 31 18:02:03 2018 Return-Path: Delivered-To: svn-src-all@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 8AEEDED9DB8; Wed, 31 Jan 2018 18:02:03 +0000 (UTC) (envelope-from jhb@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 3933F71354; Wed, 31 Jan 2018 18:02:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34102294ED; Wed, 31 Jan 2018 18:02:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VI23mZ039352; Wed, 31 Jan 2018 18:02:03 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VI22ab039350; Wed, 31 Jan 2018 18:02:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311802.w0VI22ab039350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 18:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328633 - head/lib/libc/tests/gen X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libc/tests/gen X-SVN-Commit-Revision: 328633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 18:02:03 -0000 Author: jhb Date: Wed Jan 31 18:02:02 2018 New Revision: 328633 URL: https://svnweb.freebsd.org/changeset/base/328633 Log: Add a new set of simple tests for makecontext(). In contrast to the existing NetBSD setcontext_link test, these tests verify that passing from 1 to 6 arguments through to the callback function work correctly which can be useful for testing ABIs which split arguments between registers and the stack. Sponsored by: DARPA / AFRL Added: head/lib/libc/tests/gen/makecontext_test.c (contents, props changed) Modified: head/lib/libc/tests/gen/Makefile Modified: head/lib/libc/tests/gen/Makefile ============================================================================== --- head/lib/libc/tests/gen/Makefile Wed Jan 31 18:00:23 2018 (r328632) +++ head/lib/libc/tests/gen/Makefile Wed Jan 31 18:02:02 2018 (r328633) @@ -12,6 +12,7 @@ ATF_TESTS_C+= fpclassify2_test ATF_TESTS_C+= ftw_test ATF_TESTS_C+= getmntinfo_test ATF_TESTS_C+= glob2_test +ATF_TESTS_C+= makecontext_test ATF_TESTS_C+= popen_test ATF_TESTS_C+= posix_spawn_test ATF_TESTS_C+= realpath2_test Added: head/lib/libc/tests/gen/makecontext_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/gen/makecontext_test.c Wed Jan 31 18:02:02 2018 (r328633) @@ -0,0 +1,189 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +static char uc_stack[16 * 1024]; + +static void +check_1(int arg1) +{ + + ATF_REQUIRE_EQ(arg1, 1); +} + +ATF_TC_WITHOUT_HEAD(makecontext_arg1); +ATF_TC_BODY(makecontext_arg1, tc) +{ + ucontext_t ctx[2]; + + ATF_REQUIRE_EQ(getcontext(&ctx[1]), 0); + ctx[1].uc_stack.ss_sp = uc_stack; + ctx[1].uc_stack.ss_size = sizeof(uc_stack); + ctx[1].uc_link = &ctx[0]; + makecontext(&ctx[1], (void (*)(void))check_1, 1, 1); + + ATF_REQUIRE_EQ(swapcontext(&ctx[0], &ctx[1]), 0); +} + +static void +check_2(int arg1, int arg2) +{ + + ATF_REQUIRE_EQ(arg1, 1); + ATF_REQUIRE_EQ(arg2, 2); +} + +ATF_TC_WITHOUT_HEAD(makecontext_arg2); +ATF_TC_BODY(makecontext_arg2, tc) +{ + ucontext_t ctx[2]; + + ATF_REQUIRE_EQ(getcontext(&ctx[1]), 0); + ctx[1].uc_stack.ss_sp = uc_stack; + ctx[1].uc_stack.ss_size = sizeof(uc_stack); + ctx[1].uc_link = &ctx[0]; + makecontext(&ctx[1], (void (*)(void))check_2, 2, 1, 2); + + ATF_REQUIRE_EQ(swapcontext(&ctx[0], &ctx[1]), 0); +} + +static void +check_3(int arg1, int arg2, int arg3) +{ + + ATF_REQUIRE_EQ(arg1, 1); + ATF_REQUIRE_EQ(arg2, 2); + ATF_REQUIRE_EQ(arg3, 3); +} + +ATF_TC_WITHOUT_HEAD(makecontext_arg3); +ATF_TC_BODY(makecontext_arg3, tc) +{ + ucontext_t ctx[2]; + + ATF_REQUIRE_EQ(getcontext(&ctx[1]), 0); + ctx[1].uc_stack.ss_sp = uc_stack; + ctx[1].uc_stack.ss_size = sizeof(uc_stack); + ctx[1].uc_link = &ctx[0]; + makecontext(&ctx[1], (void (*)(void))check_3, 3, 1, 2, 3); + + ATF_REQUIRE_EQ(swapcontext(&ctx[0], &ctx[1]), 0); +} + +static void +check_4(int arg1, int arg2, int arg3, int arg4) +{ + + ATF_REQUIRE_EQ(arg1, 1); + ATF_REQUIRE_EQ(arg2, 2); + ATF_REQUIRE_EQ(arg3, 3); + ATF_REQUIRE_EQ(arg4, 4); +} + +ATF_TC_WITHOUT_HEAD(makecontext_arg4); +ATF_TC_BODY(makecontext_arg4, tc) +{ + ucontext_t ctx[2]; + + ATF_REQUIRE_EQ(getcontext(&ctx[1]), 0); + ctx[1].uc_stack.ss_sp = uc_stack; + ctx[1].uc_stack.ss_size = sizeof(uc_stack); + ctx[1].uc_link = &ctx[0]; + makecontext(&ctx[1], (void (*)(void))check_4, 4, 1, 2, 3, 4); + + ATF_REQUIRE_EQ(swapcontext(&ctx[0], &ctx[1]), 0); +} + +static void +check_5(int arg1, int arg2, int arg3, int arg4, int arg5) +{ + + ATF_REQUIRE_EQ(arg1, 1); + ATF_REQUIRE_EQ(arg2, 2); + ATF_REQUIRE_EQ(arg3, 3); + ATF_REQUIRE_EQ(arg4, 4); + ATF_REQUIRE_EQ(arg5, 5); +} + +ATF_TC_WITHOUT_HEAD(makecontext_arg5); +ATF_TC_BODY(makecontext_arg5, tc) +{ + ucontext_t ctx[2]; + + ATF_REQUIRE_EQ(getcontext(&ctx[1]), 0); + ctx[1].uc_stack.ss_sp = uc_stack; + ctx[1].uc_stack.ss_size = sizeof(uc_stack); + ctx[1].uc_link = &ctx[0]; + makecontext(&ctx[1], (void (*)(void))check_5, 5, 1, 2, 3, 4, 5); + + ATF_REQUIRE_EQ(swapcontext(&ctx[0], &ctx[1]), 0); +} + +static void +check_6(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) +{ + + ATF_REQUIRE_EQ(arg1, 1); + ATF_REQUIRE_EQ(arg2, 2); + ATF_REQUIRE_EQ(arg3, 3); + ATF_REQUIRE_EQ(arg4, 4); + ATF_REQUIRE_EQ(arg5, 5); + ATF_REQUIRE_EQ(arg6, 6); +} + +ATF_TC_WITHOUT_HEAD(makecontext_arg6); +ATF_TC_BODY(makecontext_arg6, tc) +{ + ucontext_t ctx[2]; + + ATF_REQUIRE_EQ(getcontext(&ctx[1]), 0); + ctx[1].uc_stack.ss_sp = uc_stack; + ctx[1].uc_stack.ss_size = sizeof(uc_stack); + ctx[1].uc_link = &ctx[0]; + makecontext(&ctx[1], (void (*)(void))check_6, 6, 1, 2, 3, 4, 5, 6); + + ATF_REQUIRE_EQ(swapcontext(&ctx[0], &ctx[1]), 0); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, makecontext_arg1); + ATF_TP_ADD_TC(tp, makecontext_arg2); + ATF_TP_ADD_TC(tp, makecontext_arg3); + ATF_TP_ADD_TC(tp, makecontext_arg4); + ATF_TP_ADD_TC(tp, makecontext_arg5); + ATF_TP_ADD_TC(tp, makecontext_arg6); + + return (atf_no_error()); +} From owner-svn-src-all@freebsd.org Wed Jan 31 18:03:41 2018 Return-Path: Delivered-To: svn-src-all@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 3CEA4ED9EE7; Wed, 31 Jan 2018 18:03:41 +0000 (UTC) (envelope-from jhb@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 DF35B71553; Wed, 31 Jan 2018 18:03:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA11F29511; Wed, 31 Jan 2018 18:03:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VI3e6w040226; Wed, 31 Jan 2018 18:03:40 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VI3eFV040225; Wed, 31 Jan 2018 18:03:40 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311803.w0VI3eFV040225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 18:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328634 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libc/sys X-SVN-Commit-Revision: 328634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 18:03:41 -0000 Author: jhb Date: Wed Jan 31 18:03:40 2018 New Revision: 328634 URL: https://svnweb.freebsd.org/changeset/base/328634 Log: Update limits on makecontext() arguments in the setcontext_link test. sparc64 and riscv do not support 10 arguments, but MIPS now does. While here, combine clauses for architectures that support the same number of arguments to reduce duplication. Sponsored by: DARPA / AFRL Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Wed Jan 31 18:02:02 2018 (r328633) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Wed Jan 31 18:03:40 2018 (r328634) @@ -52,12 +52,10 @@ run(int n, ...) va_start(va, n); #ifdef __FreeBSD__ -#if defined(__amd64__) +#if defined(__amd64__) || defined(__sparc64__) for (i = 0; i < 5; i++) { -#elif defined(__aarch64__) +#elif defined(__aarch64__) || defined(__riscv__) for (i = 0; i < 7; i++) { -#elif defined(__mips__) - for (i = 0; i < 5; i++) { #else for (i = 0; i < 9; i++) { #endif @@ -121,18 +119,20 @@ ATF_TC_BODY(setcontext_link, tc) uc[i].uc_link = (i > 0) ? &uc[i - 1] : &save; #ifdef __FreeBSD__ -#if defined(__amd64__) - /* FreeBSD/amd64 only permits up to 6 arguments. */ +#if defined(__amd64__) || defined(__sparc64__) + /* + * FreeBSD/amd64 and FreeBSD/sparc64 only permit up to + * 6 arguments. + */ makecontext(&uc[i], (void *)run, 6, i, 0, 1, 2, 3, 4); -#elif defined(__aarch64__) - /* FreeBSD/arm64 only permits up to 8 arguments. */ +#elif defined(__aarch64__) || defined(__riscv__) + /* + * FreeBSD/arm64 and FreeBSD/riscv64 only permit up to + * 8 arguments. + */ makecontext(&uc[i], (void *)run, 8, i, 0, 1, 2, 3, 4, 5, 6); -#elif defined(__mips__) - /* FreeBSD/mips only permits up to 6 arguments. */ - makecontext(&uc[i], (void *)run, 6, i, - 0, 1, 2, 3, 4); #else makecontext(&uc[i], (void *)run, 10, i, 0, 1, 2, 3, 4, 5, 6, 7, 8); From owner-svn-src-all@freebsd.org Wed Jan 31 18:05:18 2018 Return-Path: Delivered-To: svn-src-all@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 895A7EDA011; Wed, 31 Jan 2018 18:05:18 +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 1179971706; Wed, 31 Jan 2018 18:05:17 +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 w0VI5DKm031266; Wed, 31 Jan 2018 10:05:13 -0800 (PST) (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 w0VI5DsU031265; Wed, 31 Jan 2018 10:05:13 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801311805.w0VI5DsU031265@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 In-Reply-To: <20180131164455.GR97752@kib.kiev.ua> To: Konstantin Belousov Date: Wed, 31 Jan 2018 10:05:13 -0800 (PST) CC: "Bjoern A. Zeeb" , 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-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 18:05:18 -0000 > On Wed, Jan 31, 2018 at 02:56:24PM +0000, Bjoern A. Zeeb wrote: > > On 31 Jan 2018, at 14:36, Konstantin Belousov wrote: > > > > > Author: kib > > > Date: Wed Jan 31 14:36:27 2018 > > > New Revision: 328625 > > > URL: https://svnweb.freebsd.org/changeset/base/328625 > > > > > > Log: > > > IBRS support, AKA Spectre hardware mitigation. > > > > > For existing processors, you need a microcode update which adds IBRS > > > CPU features, and to manually enable it by setting the > > > tunable/sysctl > > > hw.ibrs_disable to 0. Current status can be checked in sysctl > > > hw.ibrs_active. The mitigation might be inactive if the CPU feature > > > > Can you change the tunable/sysctl to hw.ibrs_enable[d] (and toggle the > > default setting along). > This is done consistently with the hw.clflush_disable. > Anyway, the intent is that the knob will be used for disabling, > since defaults are going to be changed in the near future. I thought we had something some place that said negative assertions should be avoided if possible. > > I find it highly confusing to have two different sysctls ???disable??? > > and ???active??? and a lot > > of people (and cultures) have trouble with the double negative. > > Also the ???enable[d]??? variant seems to be pre-dominant in the kernel. > > > > Also can we spell IBRS in the sysctl description as ???Indirect Branch > > Restricted Speculation (IBRS)???? > Will do in half a hour. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Jan 31 18:13:34 2018 Return-Path: Delivered-To: svn-src-all@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 1E33BEDA63A; Wed, 31 Jan 2018 18:13:34 +0000 (UTC) (envelope-from jhb@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 C8A3471CA2; Wed, 31 Jan 2018 18:13:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2C7E296B7; Wed, 31 Jan 2018 18:13:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VIDX6K045392; Wed, 31 Jan 2018 18:13:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VIDXFu045391; Wed, 31 Jan 2018 18:13:33 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801311813.w0VIDXFu045391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 31 Jan 2018 18:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328635 - head/lib/libgcc_s X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libgcc_s X-SVN-Commit-Revision: 328635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 18:13:34 -0000 Author: jhb Date: Wed Jan 31 18:13:33 2018 New Revision: 328635 URL: https://svnweb.freebsd.org/changeset/base/328635 Log: Don't include long double routines on architectures with small long double. Reviewed by: emaste Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D13874 Modified: head/lib/libgcc_s/Makefile Modified: head/lib/libgcc_s/Makefile ============================================================================== --- head/lib/libgcc_s/Makefile Wed Jan 31 18:03:40 2018 (r328634) +++ head/lib/libgcc_s/Makefile Wed Jan 31 18:13:33 2018 (r328635) @@ -28,12 +28,18 @@ SRCS+= s_fabsf.c SRCS+= s_fabsl.c SRCS+= s_fmax.c SRCS+= s_fmaxf.c -SRCS+= s_fmaxl.c SRCS+= s_logb.c SRCS+= s_logbf.c -SRCS+= s_logbl.c SRCS+= s_scalbn.c SRCS+= s_scalbnf.c + +# Don't include long double routines on architectures where long double +# is the same size as double. +.if ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "arm" && + ${MACHINE_CPUARCH} != "powerpc" +SRCS+= s_fmaxl.c +SRCS+= s_logbl.c SRCS+= s_scalbnl.c +.endif .include From owner-svn-src-all@freebsd.org Wed Jan 31 21:06:11 2018 Return-Path: Delivered-To: svn-src-all@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 4B1EAEE1C5B for ; Wed, 31 Jan 2018 21:06:11 +0000 (UTC) (envelope-from steven@multiplay.co.uk) Received: from mail-yw0-x22d.google.com (mail-yw0-x22d.google.com [IPv6:2607:f8b0:4002:c05::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBD3D784D3 for ; Wed, 31 Jan 2018 21:06:10 +0000 (UTC) (envelope-from steven@multiplay.co.uk) Received: by mail-yw0-x22d.google.com with SMTP id v196so8678928ywc.6 for ; Wed, 31 Jan 2018 13:06:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JSkF7wqyD/+2RUkG1MIDYsuDGCwG+h/C4IJ7pd9jKkU=; b=PMeaF2oiQXdG1X2W6NNC1TH1g21/NClpPCVZ6B0gNlhusbicKe0Oazu4aMaqbUQ1AA 2wss4GVRKdbLWm7GVs0HS9ho6EEf9KcPgViosW6bAxQwfNf7jMbAP+QRH5jJboyf9c2P 4caRbKLfb9c3ntnx7oxJ18BX+SQkkoSz63qFf4D6nuw7vGxjr99LFSIErZL9Ixw4dHPJ aMDwtk3vgGOhTZVNawZ+zuo8rs160O+YatVtF0MVNtU8LYZan4VmVDl/03NAfIKc5b4u wUrznLY+bOMqz1J4GX37s7bryt12sFkfHawJ+32aD5vBwheV1qeQCESQMPM667ojxYUb oGaQ== 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=JSkF7wqyD/+2RUkG1MIDYsuDGCwG+h/C4IJ7pd9jKkU=; b=uDgb/yzs32w/2quiwOfZmT+ya5QN6fOoZ27G/ZPl+qeDZ5W+Lxg8WmOYI31y0othc7 HObkDuZbyTTmhF6IKn3JpPlsAZDbTukTXOJsnUdtmbNt6+bTG6D64/W+skOI+urUSrtZ a9XJANVIrUxpq94bbSXXpT+fOcb2+gCF+J7/YftC7kYXVTBQwNtTXjwBdk3yQaSRScGv FK1BpOlmT6UShw1jd+Ev26aK0PC7uGtVIgh0czVTsqsuE5Fgwy7KDZNysWProJGX0AYj GM2txX/pjXslBJSg/mLiTYku9SsY1fiu8xcYP6hlPiYqpgZL8OvUwU/jkwWCej5/RFNu P+/w== X-Gm-Message-State: AKwxyte4LZogMK+v2s2fkLO0XeypWBFgkmJYDsM1n8ztyq3N+EnKjMGz MGpa4gFWGLRxNE/qTEOO5+2bqicf8lpQcqgXZthAjw== X-Google-Smtp-Source: AH8x224kE1Mbpzji1htvvdKn0L4KGJQS8BssDu7Pv7oov/NXg9nP636vyarxyv4SVncdiN6cSq9Kn4BHJ0froQMqVtw= X-Received: by 10.129.10.215 with SMTP id 206mr22905078ywk.117.1517432769981; Wed, 31 Jan 2018 13:06:09 -0800 (PST) MIME-Version: 1.0 References: <20180131164455.GR97752@kib.kiev.ua> <201801311805.w0VI5DsU031265@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201801311805.w0VI5DsU031265@pdx.rh.CN85.dnsmgr.net> From: Steven Hartland Date: Wed, 31 Jan 2018 21:05:58 +0000 Message-ID: Subject: Re: svn commit: r328625 - in head/sys: amd64/amd64 amd64/ia32 amd64/include dev/cpuctl i386/i386 x86/include x86/x86 To: rgrimes@freebsd.org Cc: "Bjoern A. Zeeb" , Konstantin Belousov , src-committers@freebsd.org, 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.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 21:06:11 -0000 Pretty sure I=E2=80=99ve seen that too On Wed, 31 Jan 2018 at 18:05, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > On Wed, Jan 31, 2018 at 02:56:24PM +0000, Bjoern A. Zeeb wrote: > > > On 31 Jan 2018, at 14:36, Konstantin Belousov wrote: > > > > > > > Author: kib > > > > Date: Wed Jan 31 14:36:27 2018 > > > > New Revision: 328625 > > > > URL: https://svnweb.freebsd.org/changeset/base/328625 > > > > > > > > Log: > > > > IBRS support, AKA Spectre hardware mitigation. > > > > > > > For existing processors, you need a microcode update which adds > IBRS > > > > CPU features, and to manually enable it by setting the > > > > tunable/sysctl > > > > hw.ibrs_disable to 0. Current status can be checked in sysctl > > > > hw.ibrs_active. The mitigation might be inactive if the CPU > feature > > > > > > Can you change the tunable/sysctl to hw.ibrs_enable[d] (and toggle th= e > > > default setting along). > > This is done consistently with the hw.clflush_disable. > > Anyway, the intent is that the knob will be used for disabling, > > since defaults are going to be changed in the near future. > > I thought we had something some place that said negative assertions > should be avoided if possible. > > > > I find it highly confusing to have two different sysctls ???disable??= ? > > > and ???active??? and a lot > > > of people (and cultures) have trouble with the double negative. > > > Also the ???enable[d]??? variant seems to be pre-dominant in the > kernel. > > > > > > Also can we spell IBRS in the sysctl description as ???Indirect Branc= h > > > Restricted Speculation (IBRS)???? > > Will do in half a hour. > > > -- > Rod Grimes > rgrimes@freebsd.org > > From owner-svn-src-all@freebsd.org Wed Jan 31 21:15:00 2018 Return-Path: Delivered-To: svn-src-all@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 42491EE2405; Wed, 31 Jan 2018 21:15:00 +0000 (UTC) (envelope-from wulf@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 E98D978B4F; Wed, 31 Jan 2018 21:14:59 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E43102B3B8; Wed, 31 Jan 2018 21:14:59 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VLExP5035831; Wed, 31 Jan 2018 21:14:59 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VLEx8k035829; Wed, 31 Jan 2018 21:14:59 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201801312114.w0VLEx8k035829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Wed, 31 Jan 2018 21:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328636 - in head/sys: dev/atkbdc sys X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head/sys: dev/atkbdc sys X-SVN-Commit-Revision: 328636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 21:15:00 -0000 Author: wulf Date: Wed Jan 31 21:14:59 2018 New Revision: 328636 URL: https://svnweb.freebsd.org/changeset/base/328636 Log: psm(4): Add support for HP EliteBook 1040 ForcePads. ForcePads do not have any physical buttons, instead they detect click based on finger pressure. Forcepads erroneously report button click if there are 2 or more fingers on the touchpad breaking multifinger gestures. To workaround this start reporting a click only after 4 consecutive single touch packets has been received. Skip these packets in case more contacts appear. PR: 223369 Reported by: Neel Chauhan Tested by: Neel Chauhan Reviewed by: gonzo Approved by: gonzo Modified: head/sys/dev/atkbdc/psm.c head/sys/sys/mouse.h Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Wed Jan 31 18:13:33 2018 (r328635) +++ head/sys/dev/atkbdc/psm.c Wed Jan 31 21:14:59 2018 (r328636) @@ -132,6 +132,13 @@ __FBSDID("$FreeBSD$"); #define PSMCPNP_DRIVER_NAME "psmcpnp" +struct psmcpnp_softc { + enum { + PSMCPNP_GENERIC, + PSMCPNP_FORCEPAD, + } type; /* Based on PnP ID */ +}; + /* input queue */ #define PSM_BUFSIZE 960 #define PSM_SMALLBUFSIZE 240 @@ -416,6 +423,7 @@ struct psm_softc { /* Driver status information */ int squelch; /* level to filter movement at low speed */ int syncerrors; /* # of bytes discarded to synchronize */ int pkterrors; /* # of packets failed during quaranteen. */ + int fpcount; /* forcePad valid packet counter */ struct timeval inputtimeout; struct timeval lastsoftintr; /* time of last soft interrupt */ struct timeval lastinputerr; /* time last sync error happened */ @@ -3183,7 +3191,7 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, static int touchpad_buttons; static int guest_buttons; static finger_t f[PSM_FINGERS]; - int w, id, nfingers, ewcode, extended_buttons; + int w, id, nfingers, ewcode, extended_buttons, clickpad_pressed; extended_buttons = 0; @@ -3445,10 +3453,6 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, extended_buttons |= sc->extended_buttons; } } - /* Handle ClickPad */ - if (sc->synhw.capClickPad && - ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01)) - touchpad_buttons |= MOUSE_BUTTON1DOWN; if (sc->synhw.capReportsV && nfingers > 1) f[0] = (finger_t) { @@ -3481,6 +3485,36 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, if (f[0].p < sc->syninfo.min_pressure || f[0].x < 2) nfingers = 0; + /* Handle ClickPad */ + if (sc->synhw.capClickPad) { + clickpad_pressed = (pb->ipacket[0] ^ pb->ipacket[3]) & 0x01; + if (sc->synhw.forcePad) { + /* + * Forcepads erroneously report button click if there + * are 2 or more fingers on the touchpad breaking + * multifinger gestures. To workaround this start + * reporting a click only after 4 consecutive single + * touch packets has been received. + * Skip these packets in case more contacts appear. + */ + switch (nfingers) { + case 0: + sc->fpcount = 0; + break; + case 1: + if (clickpad_pressed && sc->fpcount < INT_MAX) + ++sc->fpcount; + /* FALLTHROUGH */ + default: + if (!clickpad_pressed) + sc->fpcount = 0; + if (sc->fpcount >= sc->syninfo.window_min) + touchpad_buttons |= MOUSE_BUTTON1DOWN; + } + } else if (clickpad_pressed) + touchpad_buttons |= MOUSE_BUTTON1DOWN; + } + for (id = 0; id < PSM_FINGERS; id++) if (id >= nfingers) PSM_FINGER_RESET(f[id]); @@ -5998,6 +6032,8 @@ synaptics_set_mode(struct psm_softc *sc, int mode_byte static int enable_synaptics(struct psm_softc *sc, enum probearg arg) { + device_t psmcpnp; + struct psmcpnp_softc *psmcpnp_sc; KBDC kbdc = sc->kbdc; synapticshw_t synhw; int status[3]; @@ -6075,6 +6111,10 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); } + psmcpnp = devclass_get_device(devclass_find(PSMCPNP_DRIVER_NAME), + sc->unit); + psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL; + /* Set the different capabilities when they exist. */ buttons = 0; synhw.capExtended = (status[0] & 0x80) != 0; @@ -6229,6 +6269,20 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.minimumYCoord = 1408; } + /* + * ClickPad properties are not exported through PS/2 + * protocol. Detection is based on controller's PnP ID. + */ + if (synhw.capClickPad && psmcpnp_sc != NULL) { + switch (psmcpnp_sc->type) { + case PSMCPNP_FORCEPAD: + synhw.forcePad = 1; + break; + default: + break; + } + } + if (verbose >= 2) { printf(" Continued capabilities:\n"); printf(" capClickPad: %d\n", @@ -6265,6 +6319,10 @@ enable_synaptics(struct psm_softc *sc, enum probearg a printf(" minimumYCoord: %d\n", synhw.minimumYCoord); } + if (synhw.capClickPad) { + printf(" forcePad: %d\n", + synhw.forcePad); + } } buttons += synhw.capClickPad; } @@ -7090,7 +7148,7 @@ static device_method_t psmcpnp_methods[] = { static driver_t psmcpnp_driver = { PSMCPNP_DRIVER_NAME, psmcpnp_methods, - 1, /* no softc */ + sizeof(struct psmcpnp_softc), }; static struct isa_pnp_id psmcpnp_ids[] = { @@ -7110,6 +7168,13 @@ static struct isa_pnp_id psmcpnp_ids[] = { { 0 } }; +/* _HID list for quirk detection. Any device below has _CID from psmcpnp_ids */ +static struct isa_pnp_id forcepad_ids[] = { + { 0x0d302e4f, "HP PS/2 forcepad port" }, /* SYN300D, EB 1040 */ + { 0x14302e4f, "HP PS/2 forcepad port" }, /* SYN3014, EB 1040 */ + { 0 } +}; + static int create_a_copy(device_t atkbdc, device_t me) { @@ -7136,11 +7201,16 @@ create_a_copy(device_t atkbdc, device_t me) static int psmcpnp_probe(device_t dev) { + struct psmcpnp_softc *sc = device_get_softc(dev); struct resource *res; u_long irq; int rid; - if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids)) + if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0) + sc->type = PSMCPNP_FORCEPAD; + else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0) + sc->type = PSMCPNP_GENERIC; + else return (ENXIO); /* Modified: head/sys/sys/mouse.h ============================================================================== --- head/sys/sys/mouse.h Wed Jan 31 18:13:33 2018 (r328635) +++ head/sys/sys/mouse.h Wed Jan 31 21:14:59 2018 (r328636) @@ -137,6 +137,7 @@ typedef struct synapticshw { int maximumYCoord; int infoXupmm; int infoYupmm; + int forcePad; } synapticshw_t; /* iftype */ From owner-svn-src-all@freebsd.org Wed Jan 31 21:41:43 2018 Return-Path: Delivered-To: svn-src-all@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 15C27EE3719; Wed, 31 Jan 2018 21:41:43 +0000 (UTC) (envelope-from gjb@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 B93C979F71; Wed, 31 Jan 2018 21:41:42 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B423C2B823; Wed, 31 Jan 2018 21:41:42 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VLfg1j051168; Wed, 31 Jan 2018 21:41:42 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VLfgkw051167; Wed, 31 Jan 2018 21:41:42 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201801312141.w0VLfgkw051167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 31 Jan 2018 21:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328637 - head/lib/libgcc_s X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/lib/libgcc_s X-SVN-Commit-Revision: 328637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 21:41:43 -0000 Author: gjb Date: Wed Jan 31 21:41:42 2018 New Revision: 328637 URL: https://svnweb.freebsd.org/changeset/base/328637 Log: Fix build by escaping a line break. PR: 225597 Submitted by: cbnfinley at gmail.com Sponsored by: The FreeBSD Foundation Modified: head/lib/libgcc_s/Makefile Modified: head/lib/libgcc_s/Makefile ============================================================================== --- head/lib/libgcc_s/Makefile Wed Jan 31 21:14:59 2018 (r328636) +++ head/lib/libgcc_s/Makefile Wed Jan 31 21:41:42 2018 (r328637) @@ -35,7 +35,7 @@ SRCS+= s_scalbnf.c # Don't include long double routines on architectures where long double # is the same size as double. -.if ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "arm" && +.if ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "arm" && \ ${MACHINE_CPUARCH} != "powerpc" SRCS+= s_fmaxl.c SRCS+= s_logbl.c From owner-svn-src-all@freebsd.org Wed Jan 31 21:46:38 2018 Return-Path: Delivered-To: svn-src-all@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 7DA96EE3C04; Wed, 31 Jan 2018 21:46:38 +0000 (UTC) (envelope-from wulf@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 2C7B47A59B; Wed, 31 Jan 2018 21:46:38 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2688E2B868; Wed, 31 Jan 2018 21:46:38 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VLkcwv051660; Wed, 31 Jan 2018 21:46:38 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VLkcOo051659; Wed, 31 Jan 2018 21:46:38 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201801312146.w0VLkcOo051659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Wed, 31 Jan 2018 21:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328638 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 328638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 21:46:38 -0000 Author: wulf Date: Wed Jan 31 21:46:37 2018 New Revision: 328638 URL: https://svnweb.freebsd.org/changeset/base/328638 Log: psm(4): Reduce psm watchdog verbosity Modern touchpads do not issue interrupts on inactivity so "lost interrupt" message became annoying spam nowadays. This change quiets the message if debug.psm.loglevel=5 (or less) is set in /boot/loader.conf Approved by: gonzo Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Wed Jan 31 21:41:42 2018 (r328637) +++ head/sys/dev/atkbdc/psm.c Wed Jan 31 21:46:37 2018 (r328638) @@ -2878,7 +2878,7 @@ psmtimeout(void *arg) sc = (struct psm_softc *)arg; s = spltty(); if (sc->watchdog && kbdc_lock(sc->kbdc, TRUE)) { - VLOG(4, (LOG_DEBUG, "psm%d: lost interrupt?\n", sc->unit)); + VLOG(6, (LOG_DEBUG, "psm%d: lost interrupt?\n", sc->unit)); psmintr(sc); kbdc_lock(sc->kbdc, FALSE); } From owner-svn-src-all@freebsd.org Wed Jan 31 21:56:24 2018 Return-Path: Delivered-To: svn-src-all@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 CB9E1EE437E; Wed, 31 Jan 2018 21:56:24 +0000 (UTC) (envelope-from marius@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 794FA7AD42; Wed, 31 Jan 2018 21:56:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C7AE2BA0C; Wed, 31 Jan 2018 21:56:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VLuOcL057278; Wed, 31 Jan 2018 21:56:24 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VLuOsA057275; Wed, 31 Jan 2018 21:56:24 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201801312156.w0VLuOsA057275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 31 Jan 2018 21:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328639 - in head/contrib/jemalloc: . include/jemalloc X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in head/contrib/jemalloc: . include/jemalloc X-SVN-Commit-Revision: 328639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 21:56:25 -0000 Author: marius Date: Wed Jan 31 21:56:23 2018 New Revision: 328639 URL: https://svnweb.freebsd.org/changeset/base/328639 Log: Account for the fact that jemalloc 5.0.0 dropped STATIC_PAGE_SHIFT in favor for using LG_PAGE directly and, thus, for the fact that host and target don't necessarily use pages of the same sizes. Approved by: jasone Modified: head/contrib/jemalloc/FREEBSD-diffs head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Modified: head/contrib/jemalloc/FREEBSD-diffs ============================================================================== --- head/contrib/jemalloc/FREEBSD-diffs Wed Jan 31 21:46:37 2018 (r328638) +++ head/contrib/jemalloc/FREEBSD-diffs Wed Jan 31 21:56:23 2018 (r328639) @@ -153,7 +153,7 @@ index 00000000..355b565c + * each supported architecture. + */ +#undef JEMALLOC_TLS_MODEL -+#undef STATIC_PAGE_SHIFT ++#undef LG_PAGE +#undef LG_VADDR +#undef LG_SIZEOF_PTR +#undef LG_SIZEOF_INT @@ -212,7 +212,7 @@ index 00000000..355b565c +# define JEMALLOC_TLS_MODEL /* Default. */ +#endif + -+#define STATIC_PAGE_SHIFT PAGE_SHIFT ++#define LG_PAGE PAGE_SHIFT +#define LG_SIZEOF_INT 2 +#define LG_SIZEOF_LONG LG_SIZEOF_PTR +#define LG_SIZEOF_INTMAX_T 3 Modified: head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Wed Jan 31 21:46:37 2018 (r328638) +++ head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Wed Jan 31 21:56:23 2018 (r328639) @@ -17,7 +17,7 @@ * each supported architecture. */ #undef JEMALLOC_TLS_MODEL -#undef STATIC_PAGE_SHIFT +#undef LG_PAGE #undef LG_VADDR #undef LG_SIZEOF_PTR #undef LG_SIZEOF_INT @@ -76,7 +76,7 @@ # define JEMALLOC_TLS_MODEL /* Default. */ #endif -#define STATIC_PAGE_SHIFT PAGE_SHIFT +#define LG_PAGE PAGE_SHIFT #define LG_SIZEOF_INT 2 #define LG_SIZEOF_LONG LG_SIZEOF_PTR #define LG_SIZEOF_INTMAX_T 3 From owner-svn-src-all@freebsd.org Wed Jan 31 22:17:53 2018 Return-Path: Delivered-To: svn-src-all@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 A9AF1EE54E5; Wed, 31 Jan 2018 22:17:53 +0000 (UTC) (envelope-from wulf@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 5677D7BCB9; Wed, 31 Jan 2018 22:17:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4644E2BD30; Wed, 31 Jan 2018 22:17:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VMHr0w067196; Wed, 31 Jan 2018 22:17:53 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VMHqxb067195; Wed, 31 Jan 2018 22:17:52 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201801312217.w0VMHqxb067195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Wed, 31 Jan 2018 22:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328640 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 328640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 22:17:53 -0000 Author: wulf Date: Wed Jan 31 22:17:52 2018 New Revision: 328640 URL: https://svnweb.freebsd.org/changeset/base/328640 Log: psm: Add a kludge to support 0x46 identity middle byte Synaptics touchpads Most synaptics touchpads return 0x47 in middle byte in responce to identify command as stated in p.4.4 of "Synaptics PS/2 TouchPad Interfacing Guide". But some devices e.g. found on HP EliteBook 9470m return 0x46 here. Allow them to be identified as Synaptics as well as 0x47. ExtendedQueries return incorrect data on such a touchpads so we ignore their result and set conservative defaults. PR: 222667 Reported by: Neel Chauhan Tested by: Neel Chauhan Approved by: gonzo Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Wed Jan 31 21:56:23 2018 (r328639) +++ head/sys/dev/atkbdc/psm.c Wed Jan 31 22:17:52 2018 (r328640) @@ -136,6 +136,7 @@ struct psmcpnp_softc { enum { PSMCPNP_GENERIC, PSMCPNP_FORCEPAD, + PSMCPNP_HPSYN81, } type; /* Based on PnP ID */ }; @@ -174,6 +175,15 @@ typedef struct packetbuf { #define PSM_PACKETQUEUE 128 #endif +/* + * Typical bezel limits. Taken from 'Synaptics + * PS/2 TouchPad Interfacing Guide' p.3.2.3. + */ +#define SYNAPTICS_DEFAULT_MAX_X 5472 +#define SYNAPTICS_DEFAULT_MAX_Y 4448 +#define SYNAPTICS_DEFAULT_MIN_X 1472 +#define SYNAPTICS_DEFAULT_MIN_Y 1408 + typedef struct synapticsinfo { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -1096,7 +1106,7 @@ doopen(struct psm_softc *sc, int command_byte) mouse_ext_command(sc->kbdc, 1); get_mouse_status(sc->kbdc, stat, 0, 3); if ((SYNAPTICS_VERSION_GE(sc->synhw, 7, 5) || - stat[1] == 0x47) && + stat[1] == 0x46 || stat[1] == 0x47) && stat[2] == 0x40) { synaptics_set_mode(sc, synaptics_preferred_mode(sc)); VLOG(5, (LOG_DEBUG, "psm%d: Synaptis Absolute Mode " @@ -6037,7 +6047,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a KBDC kbdc = sc->kbdc; synapticshw_t synhw; int status[3]; - int buttons; + int buttons, middle_byte; VLOG(3, (LOG_DEBUG, "synaptics: BEGIN init\n")); @@ -6054,7 +6064,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (status[1] != 0x47) + middle_byte = status[1]; + if (middle_byte != 0x46 && middle_byte != 0x47) return (FALSE); bzero(&synhw, sizeof(synhw)); @@ -6065,7 +6076,15 @@ enable_synaptics(struct psm_softc *sc, enum probearg a printf("Synaptics Touchpad v%d.%d\n", synhw.infoMajor, synhw.infoMinor); - if (synhw.infoMajor < 4) { + /* + * Most synaptics touchpads return 0x47 in middle byte in responce to + * identify command as stated in p.4.4 of "Synaptics PS/2 TouchPad + * Interfacing Guide" and we only support v4.0 or better. But some + * devices return 0x46 here and have a different numbering scheme. + * In the case of 0x46, we allow versions as low as v2.0 + */ + if ((middle_byte == 0x47 && synhw.infoMajor < 4) || + (middle_byte == 0x46 && synhw.infoMajor < 2)) { printf(" Unsupported (pre-v4) Touchpad detected\n"); return (FALSE); } @@ -6106,7 +6125,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) { printf(" Failed to read extended capability bits\n"); return (FALSE); } @@ -6115,10 +6134,29 @@ enable_synaptics(struct psm_softc *sc, enum probearg a sc->unit); psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL; + /* + * Set conservative defaults for 0x46 middle byte touchpads + * as ExtendedQueries return bogus data. + */ + if (middle_byte == 0x46) { + synhw.capExtended = 1; + synhw.capPalmDetect = 1; + synhw.capPassthrough = 1; + synhw.capMultiFinger = 1; + synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X; + synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y; + synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X; + synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y; + /* Enable multitouch mode for HW v8.1 devices */ + if (psmcpnp_sc != NULL && + psmcpnp_sc->type == PSMCPNP_HPSYN81) + synhw.capReportsV = 1; + } else + synhw.capExtended = (status[0] & 0x80) != 0; + /* Set the different capabilities when they exist. */ buttons = 0; - synhw.capExtended = (status[0] & 0x80) != 0; - if (synhw.capExtended) { + if (synhw.capExtended && middle_byte == 0x47) { synhw.nExtendedQueries = (status[0] & 0x70) >> 4; synhw.capMiddle = (status[0] & 0x04) != 0; synhw.capPassthrough = (status[2] & 0x80) != 0; @@ -6240,12 +6278,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.maximumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.maximumXCoord = 5472; - synhw.maximumYCoord = 4448; + synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X; + synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y; } if (synhw.capReportsMin) { @@ -6261,12 +6295,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.minimumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.minimumXCoord = 1472; - synhw.minimumYCoord = 1408; + synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X; + synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y; } /* @@ -6352,7 +6382,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) { printf(" Failed to read mode byte\n"); return (FALSE); } @@ -7175,6 +7205,12 @@ static struct isa_pnp_id forcepad_ids[] = { { 0 } }; +/* List of HW v8.1 synaptics touchpads erroneously detected as HW v2.0 */ +static struct isa_pnp_id hpsyn81_ids[] = { + { 0x9e012e4f, "HP PS/2 trackpad port" }, /* SYN019E, EB 9470 */ + { 0 } +}; + static int create_a_copy(device_t atkbdc, device_t me) { @@ -7208,6 +7244,8 @@ psmcpnp_probe(device_t dev) if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0) sc->type = PSMCPNP_FORCEPAD; + else if(ISA_PNP_PROBE(device_get_parent(dev), dev, hpsyn81_ids) == 0) + sc->type = PSMCPNP_HPSYN81; else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0) sc->type = PSMCPNP_GENERIC; else From owner-svn-src-all@freebsd.org Wed Jan 31 22:20:34 2018 Return-Path: Delivered-To: svn-src-all@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 A1A87EE56A5; Wed, 31 Jan 2018 22:20:34 +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 553A17BE84; Wed, 31 Jan 2018 22:20:34 +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 4C1AD2BD36; Wed, 31 Jan 2018 22:20:34 +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 w0VMKYxD067373; Wed, 31 Jan 2018 22:20:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VMKYJ7067372; Wed, 31 Jan 2018 22:20:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801312220.w0VMKYJ7067372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 31 Jan 2018 22:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328641 - head/usr.bin/dtc X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/dtc X-SVN-Commit-Revision: 328641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 22:20:34 -0000 Author: kevans Date: Wed Jan 31 22:20:33 2018 New Revision: 328641 URL: https://svnweb.freebsd.org/changeset/base/328641 Log: dtc(1): Revert WARNS change from r328173 WARNS > 3 breaks xtoolchain builds to varying degrees. Revert it. Reported by: lwhsu, jhb MFC after: 3 days Modified: head/usr.bin/dtc/Makefile Modified: head/usr.bin/dtc/Makefile ============================================================================== --- head/usr.bin/dtc/Makefile Wed Jan 31 22:17:52 2018 (r328640) +++ head/usr.bin/dtc/Makefile Wed Jan 31 22:20:33 2018 (r328641) @@ -4,6 +4,8 @@ PROG_CXX=dtc SRCS= dtc.cc input_buffer.cc string.cc dtb.cc fdt.cc checking.cc MAN= dtc.1 +WARNS?= 3 + CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions NO_SHARED?=NO From owner-svn-src-all@freebsd.org Wed Jan 31 22:46:06 2018 Return-Path: Delivered-To: svn-src-all@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 5AC7FEE68F7; Wed, 31 Jan 2018 22:46:06 +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 0E3F07CE4D; Wed, 31 Jan 2018 22:46: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 04DC32C215; Wed, 31 Jan 2018 22:46: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 w0VMk5uX082042; Wed, 31 Jan 2018 22:46:05 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VMk5fv082036; Wed, 31 Jan 2018 22:46:05 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801312246.w0VMk5fv082036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Jan 2018 22:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328642 - in head/stand: . common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: . common X-SVN-Commit-Revision: 328642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 22:46:06 -0000 Author: imp Date: Wed Jan 31 22:46:05 2018 New Revision: 328642 URL: https://svnweb.freebsd.org/changeset/base/328642 Log: Break out the interpreters (simple and forth) w/o ifdefs. This is akin to what Pedro Souza and Wojciech Koszek did in the lua GSoC with interp.h, interp_simple.c and changes to interp.c and interp_forth.c, but completely redone from scratch. This effectively restores the spirit of r326712 (my first attempt to bring in Pedro's and Wojciech's work) updated for new requirements that had silently broke their original work. This change also differs by using fixed function names instead of function pointers to simply things. Only one interpreter at a time may be compiled in. Also of note: we take a mutable string, pass it in via a const char * pointer into intrp_forth's interp_run(). We then cast away the const to pass into ficlExec since ficl would require extensive changes to properly const-poison. See Sections 6.5.2.5 and 6.7.3 of C11 standard noting it's only UB if you modify a const object through a non-const pointer, but not char [] -> const char * -> char * as here. Added: head/stand/common/interp_simple.c (contents, props changed) Modified: head/stand/common/bootstrap.h head/stand/common/install.c head/stand/common/interp.c head/stand/common/interp_forth.c head/stand/loader.mk Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Wed Jan 31 22:20:33 2018 (r328641) +++ head/stand/common/bootstrap.h Wed Jan 31 22:46:05 2018 (r328642) @@ -46,17 +46,17 @@ extern char command_errbuf[COMMAND_ERRBUFSZ]; /* interp.c */ void interact(void); -int include(const char *filename); +void interp_emit_prompt(void); +/* Called by interp.c for interp_*.c embedded interpreters */ +int interp_include(const char *filename); /* Execute commands from filename */ +void interp_init(void); /* Initialize interpreater */ +int interp_run(const char *line); /* Run a single command */ /* interp_backslash.c */ char *backslash(const char *str); /* interp_parse.c */ int parse(int *argc, char ***argv, const char *str); - -/* interp_forth.c */ -void bf_init(void); -int bf_run(char *line); /* boot.c */ int autoboot(int timeout, char *prompt); Modified: head/stand/common/install.c ============================================================================== --- head/stand/common/install.c Wed Jan 31 22:20:33 2018 (r328641) +++ head/stand/common/install.c Wed Jan 31 22:46:05 2018 (r328642) @@ -286,7 +286,7 @@ install(char *pkgname) fd = open(s, O_RDONLY); if (fd != -1) { close(fd); - error = include(s); + error = inter_include(s); if (error == CMD_ERROR) goto fail; } Modified: head/stand/common/interp.c ============================================================================== --- head/stand/common/interp.c Wed Jan 31 22:20:33 2018 (r328641) +++ head/stand/common/interp.c Wed Jan 31 22:46:05 2018 (r328642) @@ -37,75 +37,25 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" -#ifdef BOOT_FORTH -#include "ficl.h" -extern FICL_VM *bf_vm; -#endif - #define MAXARGS 20 /* maximum number of arguments allowed */ -static void prompt(void); - -#ifndef BOOT_FORTH /* - * Perform the command - */ -static int -perform(int argc, char *argv[]) -{ - int result; - struct bootblk_command **cmdp; - bootblk_cmd_t *cmd; - - if (argc < 1) - return(CMD_OK); - - /* set return defaults; a successful command will override these */ - command_errmsg = command_errbuf; - strcpy(command_errbuf, "no error message"); - cmd = NULL; - result = CMD_ERROR; - - /* search the command set for the command */ - SET_FOREACH(cmdp, Xcommand_set) { - if (((*cmdp)->c_name != NULL) && !strcmp(argv[0], (*cmdp)->c_name)) - cmd = (*cmdp)->c_fn; - } - if (cmd != NULL) { - result = (cmd)(argc, argv); - } else { - command_errmsg = "unknown command"; - } - return(result); -} -#endif /* ! BOOT_FORTH */ - -/* * Interactive mode */ void interact(void) { static char input[256]; /* big enough? */ -#ifndef BOOT_FORTH - int argc; - char **argv; -#endif -#ifdef BOOT_FORTH - bf_init(); -#endif + interp_init(); - /* Read our default configuration. */ - include("/boot/loader.rc"); - printf("\n"); /* * Before interacting, we might want to autoboot. */ autoboot_maybe(); - + /* * Not autobooting, go manual */ @@ -114,24 +64,12 @@ interact(void) setenv("prompt", "${interpret}", 1); if (getenv("interpret") == NULL) setenv("interpret", "OK", 1); - for (;;) { input[0] = '\0'; - prompt(); + interp_emit_prompt(); ngets(input, sizeof(input)); -#ifdef BOOT_FORTH - bf_vm->sourceID.i = 0; - bf_run(input); -#else - if (!parse(&argc, &argv, input)) { - if (perform(argc, argv)) - printf("%s: %s\n", argv[0], command_errmsg); - free(argv); - } else { - printf("parse error\n"); - } -#endif + interp_run(input); } } @@ -153,7 +91,7 @@ command_include(int argc, char *argv[]) int res; char **argvbuf; - /* + /* * Since argv is static, we need to save it here. */ argvbuf = (char**) calloc((u_int)argc, sizeof(char*)); @@ -162,7 +100,7 @@ command_include(int argc, char *argv[]) res=CMD_OK; for (i = 1; (i < argc) && (res == CMD_OK); i++) - res = include(argvbuf[i]); + res = interp_include(argvbuf[i]); for (i = 0; i < argc; i++) free(argvbuf[i]); @@ -172,174 +110,14 @@ command_include(int argc, char *argv[]) } /* - * Header prepended to each line. The text immediately follows the header. - * We try to make this short in order to save memory -- the loader has - * limited memory available, and some of the forth files are very long. - */ -struct includeline -{ - struct includeline *next; -#ifndef BOOT_FORTH - int flags; - int line; -#define SL_QUIET (1<<0) -#define SL_IGNOREERR (1<<1) -#endif - char text[0]; -}; - -int -include(const char *filename) -{ - struct includeline *script, *se, *sp; - char input[256]; /* big enough? */ -#ifdef BOOT_FORTH - int res; - char *cp; - int prevsrcid, fd, line; -#else - int argc,res; - char **argv, *cp; - int fd, flags, line; -#endif - - if (((fd = open(filename, O_RDONLY)) == -1)) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't open '%s': %s", filename, strerror(errno)); - return(CMD_ERROR); - } - - /* - * Read the script into memory. - */ - script = se = NULL; - line = 0; - - while (fgetstr(input, sizeof(input), fd) >= 0) { - line++; -#ifdef BOOT_FORTH - cp = input; -#else - flags = 0; - /* Discard comments */ - if (strncmp(input+strspn(input, " "), "\\ ", 2) == 0) - continue; - cp = input; - /* Echo? */ - if (input[0] == '@') { - cp++; - flags |= SL_QUIET; - } - /* Error OK? */ - if (input[0] == '-') { - cp++; - flags |= SL_IGNOREERR; - } -#endif - /* Allocate script line structure and copy line, flags */ - if (*cp == '\0') - continue; /* ignore empty line, save memory */ - sp = malloc(sizeof(struct includeline) + strlen(cp) + 1); - /* On malloc failure (it happens!), free as much as possible and exit */ - if (sp == NULL) { - while (script != NULL) { - se = script; - script = script->next; - free(se); - } - snprintf(command_errbuf, sizeof(command_errbuf), - "file '%s' line %d: memory allocation failure - aborting", - filename, line); - close(fd); - return (CMD_ERROR); - } - strcpy(sp->text, cp); -#ifndef BOOT_FORTH - sp->flags = flags; - sp->line = line; -#endif - sp->next = NULL; - - if (script == NULL) { - script = sp; - } else { - se->next = sp; - } - se = sp; - } - close(fd); - - /* - * Execute the script - */ -#ifndef BOOT_FORTH - argv = NULL; -#else - prevsrcid = bf_vm->sourceID.i; - bf_vm->sourceID.i = fd; -#endif - res = CMD_OK; - for (sp = script; sp != NULL; sp = sp->next) { - -#ifdef BOOT_FORTH - res = bf_run(sp->text); - if (res != VM_OUTOFTEXT) { - snprintf(command_errbuf, sizeof(command_errbuf), - "Error while including %s, in the line:\n%s", - filename, sp->text); - res = CMD_ERROR; - break; - } else - res = CMD_OK; -#else - /* print if not being quiet */ - if (!(sp->flags & SL_QUIET)) { - prompt(); - printf("%s\n", sp->text); - } - - /* Parse the command */ - if (!parse(&argc, &argv, sp->text)) { - if ((argc > 0) && (perform(argc, argv) != 0)) { - /* normal command */ - printf("%s: %s\n", argv[0], command_errmsg); - if (!(sp->flags & SL_IGNOREERR)) { - res=CMD_ERROR; - break; - } - } - free(argv); - argv = NULL; - } else { - printf("%s line %d: parse error\n", filename, sp->line); - res=CMD_ERROR; - break; - } -#endif - } -#ifndef BOOT_FORTH - if (argv != NULL) - free(argv); -#else - bf_vm->sourceID.i = prevsrcid; -#endif - while(script != NULL) { - se = script; - script = script->next; - free(se); - } - return(res); -} - -/* * Emit the current prompt; use the same syntax as the parser - * for embedding environment variables. + * for embedding environment variables. Does not accept input. */ -static void -prompt(void) +void +interp_emit_prompt(void) { char *pr, *p, *cp, *ev; - + if ((cp = getenv("prompt")) == NULL) cp = ">"; pr = p = strdup(cp); @@ -350,7 +128,7 @@ prompt(void) ; *cp = 0; ev = getenv(p + 2); - + if (ev != NULL) printf("%s", ev); p = cp + 1; Modified: head/stand/common/interp_forth.c ============================================================================== --- head/stand/common/interp_forth.c Wed Jan 31 22:20:33 2018 (r328641) +++ head/stand/common/interp_forth.c Wed Jan 31 22:46:05 2018 (r328642) @@ -81,7 +81,7 @@ bf_command(FICL_VM *vm) /* Get the name of the current word */ name = vm->runningWord->name; - + /* Find our command structure */ cmd = NULL; SET_FOREACH(cmdp, Xcommand_set) { @@ -90,7 +90,7 @@ bf_command(FICL_VM *vm) } if (cmd == NULL) panic("callout for unknown command '%s'", name); - + /* Check whether we have been compiled or are being interpreted */ if (stackPopINT(vm->pStack)) { /* @@ -118,7 +118,7 @@ bf_command(FICL_VM *vm) tail = vmGetInBuf(vm); for (cp = tail, len = 0; cp != vm->tib.end && *cp != 0 && *cp != '\n'; cp++, len++) ; - + line = malloc(strlen(name) + len + 2); strcpy(line, name); if (len > 0) { @@ -128,7 +128,7 @@ bf_command(FICL_VM *vm) } } DEBUG("cmd '%s'", line); - + command_errmsg = command_errbuf; command_errbuf[0] = 0; if (!parse(&argc, &argv, line)) { @@ -289,12 +289,19 @@ bf_init(void) /* * Feed a line of user input to the Forth interpreter */ -int -bf_run(char *line) +static int +bf_run(const char *line) { int result; - result = ficlExec(bf_vm, line); + /* + * ficl would require extensive changes to accept a const char * + * interface. Instead, cast it away here and hope for the best. + * We know at the present time the caller for us in the boot + * forth loader can tolerate the string being modified because + * the string is passed in here and then not touched again. + */ + result = ficlExec(bf_vm, __DECONST(char *, line)); DEBUG("ficlExec '%s' = %d", line, result); switch (result) { @@ -318,10 +325,119 @@ bf_run(char *line) command_errmsg = NULL; } } - + if (result == VM_USEREXIT) panic("interpreter exit"); setenv("interpret", bf_vm->state ? "" : "OK", 1); return (result); +} + +void +interp_init(void) +{ + + bf_init(); + /* Read our default configuration. */ + interp_include("/boot/loader.rc"); +} + +int +interp_run(const char *input) +{ + + bf_vm->sourceID.i = 0; + return bf_run(input); +} + +/* + * Header prepended to each line. The text immediately follows the header. + * We try to make this short in order to save memory -- the loader has + * limited memory available, and some of the forth files are very long. + */ +struct includeline +{ + struct includeline *next; + char text[0]; +}; + +int +interp_include(const char *filename) +{ + struct includeline *script, *se, *sp; + char input[256]; /* big enough? */ + int res; + char *cp; + int prevsrcid, fd, line; + + if (((fd = open(filename, O_RDONLY)) == -1)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't open '%s': %s", filename, strerror(errno)); + return(CMD_ERROR); + } + + /* + * Read the script into memory. + */ + script = se = NULL; + line = 0; + + while (fgetstr(input, sizeof(input), fd) >= 0) { + line++; + cp = input; + /* Allocate script line structure and copy line, flags */ + if (*cp == '\0') + continue; /* ignore empty line, save memory */ + sp = malloc(sizeof(struct includeline) + strlen(cp) + 1); + /* On malloc failure (it happens!), free as much as possible and exit */ + if (sp == NULL) { + while (script != NULL) { + se = script; + script = script->next; + free(se); + } + snprintf(command_errbuf, sizeof(command_errbuf), + "file '%s' line %d: memory allocation failure - aborting", + filename, line); + close(fd); + return (CMD_ERROR); + } + strcpy(sp->text, cp); + sp->next = NULL; + + if (script == NULL) { + script = sp; + } else { + se->next = sp; + } + se = sp; + } + close(fd); + + /* + * Execute the script + */ + prevsrcid = bf_vm->sourceID.i; + bf_vm->sourceID.i = fd; + res = CMD_OK; + for (sp = script; sp != NULL; sp = sp->next) { + + res = bf_run(sp->text); + if (res != VM_OUTOFTEXT) { + snprintf(command_errbuf, sizeof(command_errbuf), + "Error while including %s, in the line:\n%s", + filename, sp->text); + res = CMD_ERROR; + break; + } else + res = CMD_OK; + } + bf_vm->sourceID.i = prevsrcid; + + while (script != NULL) { + se = script; + script = script->next; + free(se); + } + return(res); } Added: head/stand/common/interp_simple.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/common/interp_simple.c Wed Jan 31 22:46:05 2018 (r328642) @@ -0,0 +1,223 @@ +/*- + * Copyright (c) 1998 Michael Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Simple commandline interpreter, toplevel and misc. + */ + +#include +#include +#include "bootstrap.h" + +/* + * Perform the command + */ +static int +perform(int argc, char *argv[]) +{ + int result; + struct bootblk_command **cmdp; + bootblk_cmd_t *cmd; + + if (argc < 1) + return(CMD_OK); + + /* set return defaults; a successful command will override these */ + command_errmsg = command_errbuf; + strcpy(command_errbuf, "no error message"); + cmd = NULL; + result = CMD_ERROR; + + /* search the command set for the command */ + SET_FOREACH(cmdp, Xcommand_set) { + if (((*cmdp)->c_name != NULL) && !strcmp(argv[0], (*cmdp)->c_name)) + cmd = (*cmdp)->c_fn; + } + if (cmd != NULL) { + result = (cmd)(argc, argv); + } else { + command_errmsg = "unknown command"; + } + return(result); +} + +void +interp_init(void) +{ + + /* Read our default configuration. */ + interp_include("/boot/loader.rc"); +} + +int +interp_run(const char *input) +{ + int argc; + char **argv; + + if (parse(&argc, &argv, input)) { + printf("parse error\n"); + return CMD_ERROR; + } + + if (perform(argc, argv)) { + printf("%s: %s\n", argv[0], command_errmsg); + free(argv); + return CMD_ERROR; + } + free(argv); + return CMD_OK; +} + +/* + * Header prepended to each line. The text immediately follows the header. + * We try to make this short in order to save memory -- the loader has + * limited memory available, and some of the forth files are very long. + */ +struct includeline +{ + struct includeline *next; + int flags; + int line; +#define SL_QUIET (1<<0) +#define SL_IGNOREERR (1<<1) + char text[0]; +}; + +int +interp_include(const char *filename) +{ + struct includeline *script, *se, *sp; + char input[256]; /* big enough? */ + int argc,res; + char **argv, *cp; + int fd, flags, line; + + if (((fd = open(filename, O_RDONLY)) == -1)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't open '%s': %s", filename, strerror(errno)); + return(CMD_ERROR); + } + + /* + * Read the script into memory. + */ + script = se = NULL; + line = 0; + + while (fgetstr(input, sizeof(input), fd) >= 0) { + line++; + flags = 0; + /* Discard comments */ + if (strncmp(input+strspn(input, " "), "\\ ", 2) == 0) + continue; + cp = input; + /* Echo? */ + if (input[0] == '@') { + cp++; + flags |= SL_QUIET; + } + /* Error OK? */ + if (input[0] == '-') { + cp++; + flags |= SL_IGNOREERR; + } + + /* Allocate script line structure and copy line, flags */ + if (*cp == '\0') + continue; /* ignore empty line, save memory */ + sp = malloc(sizeof(struct includeline) + strlen(cp) + 1); + /* On malloc failure (it happens!), free as much as possible and exit */ + if (sp == NULL) { + while (script != NULL) { + se = script; + script = script->next; + free(se); + } + snprintf(command_errbuf, sizeof(command_errbuf), + "file '%s' line %d: memory allocation failure - aborting", + filename, line); + close(fd); + return (CMD_ERROR); + } + strcpy(sp->text, cp); + sp->flags = flags; + sp->line = line; + sp->next = NULL; + + if (script == NULL) { + script = sp; + } else { + se->next = sp; + } + se = sp; + } + close(fd); + + /* + * Execute the script + */ + argv = NULL; + res = CMD_OK; + for (sp = script; sp != NULL; sp = sp->next) { + + /* print if not being quiet */ + if (!(sp->flags & SL_QUIET)) { + interp_emit_prompt(); + printf("%s\n", sp->text); + } + + /* Parse the command */ + if (!parse(&argc, &argv, sp->text)) { + if ((argc > 0) && (perform(argc, argv) != 0)) { + /* normal command */ + printf("%s: %s\n", argv[0], command_errmsg); + if (!(sp->flags & SL_IGNOREERR)) { + res=CMD_ERROR; + break; + } + } + free(argv); + argv = NULL; + } else { + printf("%s line %d: parse error\n", filename, sp->line); + res=CMD_ERROR; + break; + } + } + if (argv != NULL) + free(argv); + + while (script != NULL) { + se = script; + script = script->next; + free(se); + } + return(res); +} Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Wed Jan 31 22:20:33 2018 (r328641) +++ head/stand/loader.mk Wed Jan 31 22:46:05 2018 (r328642) @@ -59,6 +59,8 @@ SRCS+= pnp.c .if ${MK_FORTH} != "no" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" +.else +SRCS+= interp_simple.c .endif .if defined(BOOT_PROMPT_123) From owner-svn-src-all@freebsd.org Wed Jan 31 22:49:51 2018 Return-Path: Delivered-To: svn-src-all@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 729ABEE6BED; Wed, 31 Jan 2018 22:49:51 +0000 (UTC) (envelope-from mckusick@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 215207D095; Wed, 31 Jan 2018 22:49:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 160692C216; Wed, 31 Jan 2018 22:49:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VMno0d082210; Wed, 31 Jan 2018 22:49:50 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VMnohG082209; Wed, 31 Jan 2018 22:49:50 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801312249.w0VMnohG082209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 31 Jan 2018 22:49:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328643 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 22:49:51 -0000 Author: mckusick Date: Wed Jan 31 22:49:50 2018 New Revision: 328643 URL: https://svnweb.freebsd.org/changeset/base/328643 Log: One of the vnode fields listed by vn_printf is the union of pointers whose type depends on the type of vnode. Correct vn_printf so that it correctly identifies the name of the pointer that it is printing. Submitted by: Andreas Longwitz MFC after: 1 week Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Jan 31 22:46:05 2018 (r328642) +++ head/sys/kern/vfs_subr.c Wed Jan 31 22:49:50 2018 (r328643) @@ -3467,8 +3467,25 @@ vn_printf(struct vnode *vp, const char *fmt, ...) va_end(ap); printf("%p: ", (void *)vp); printf("tag %s, type %s\n", vp->v_tag, typename[vp->v_type]); - printf(" usecount %d, writecount %d, refcount %d mountedhere %p\n", - vp->v_usecount, vp->v_writecount, vp->v_holdcnt, vp->v_mountedhere); + printf(" usecount %d, writecount %d, refcount %d", + vp->v_usecount, vp->v_writecount, vp->v_holdcnt); + switch (vp->v_type) { + case VDIR: + printf(" mountedhere %p\n", vp->v_mountedhere); + break; + case VCHR: + printf(" rdev %p\n", vp->v_rdev); + break; + case VSOCK: + printf(" socket %p\n", vp->v_unpcb); + break; + case VFIFO: + printf(" fifoinfo %p\n", vp->v_fifoinfo); + break; + default: + printf("\n"); + break; + } buf[0] = '\0'; buf[1] = '\0'; if (vp->v_vflag & VV_ROOT) From owner-svn-src-all@freebsd.org Wed Jan 31 22:52:36 2018 Return-Path: Delivered-To: svn-src-all@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 4AF2BEE6ED8; Wed, 31 Jan 2018 22:52:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3C6E7D4B0; Wed, 31 Jan 2018 22:52:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 110DB10A7DB; Wed, 31 Jan 2018 17:52:29 -0500 (EST) From: John Baldwin To: Glen Barber Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328637 - head/lib/libgcc_s Date: Wed, 31 Jan 2018 13:49:25 -0800 Message-ID: <2842708.9sbgdJgr1q@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201801312141.w0VLfgkw051167@repo.freebsd.org> References: <201801312141.w0VLfgkw051167@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 31 Jan 2018 17:52:29 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 22:52:36 -0000 On Wednesday, January 31, 2018 09:41:42 PM Glen Barber wrote: > Author: gjb > Date: Wed Jan 31 21:41:42 2018 > New Revision: 328637 > URL: https://svnweb.freebsd.org/changeset/base/328637 > > Log: > Fix build by escaping a line break. > > PR: 225597 > Submitted by: cbnfinley at gmail.com > Sponsored by: The FreeBSD Foundation > > Modified: > head/lib/libgcc_s/Makefile > > Modified: head/lib/libgcc_s/Makefile > ============================================================================== > --- head/lib/libgcc_s/Makefile Wed Jan 31 21:14:59 2018 (r328636) > +++ head/lib/libgcc_s/Makefile Wed Jan 31 21:41:42 2018 (r328637) > @@ -35,7 +35,7 @@ SRCS+= s_scalbnf.c > > # Don't include long double routines on architectures where long double > # is the same size as double. > -.if ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "arm" && > +.if ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "arm" && \ > ${MACHINE_CPUARCH} != "powerpc" > SRCS+= s_fmaxl.c > SRCS+= s_logbl.c Thanks. I've been building MIPS worlds with this change for months. I've no idea why bmake would work for that case but fail for others. You'd think if it was a syntax error it would fail reliably? Perhaps it is doing short-circuit eval such that it didn't parse the rest of the line? -- John Baldwin From owner-svn-src-all@freebsd.org Wed Jan 31 23:13:37 2018 Return-Path: Delivered-To: svn-src-all@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 D26EDEC2F4B; Wed, 31 Jan 2018 23:13:37 +0000 (UTC) (envelope-from mckusick@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 75C097DF23; Wed, 31 Jan 2018 23:13:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AEC52C6CD; Wed, 31 Jan 2018 23:13:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VNDbO5096808; Wed, 31 Jan 2018 23:13:37 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VNDb4m096807; Wed, 31 Jan 2018 23:13:37 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801312313.w0VNDb4m096807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 31 Jan 2018 23:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328644 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 328644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 23:13:38 -0000 Author: mckusick Date: Wed Jan 31 23:13:37 2018 New Revision: 328644 URL: https://svnweb.freebsd.org/changeset/base/328644 Log: When reading a cylinder group, break out reporting of check hash errors from other types of errors so that the error is correctly reported. Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Wed Jan 31 22:49:50 2018 (r328643) +++ head/sys/ufs/ffs/ffs_alloc.c Wed Jan 31 23:13:37 2018 (r328644) @@ -2635,16 +2635,31 @@ ffs_getcg(fs, devvp, cg, bpp, cgpp) if (error != 0) return (error); cgp = (struct cg *)bp->b_data; - if (((fs->fs_metackhash & CK_CYLGRP) != 0 && + if ((fs->fs_metackhash & CK_CYLGRP) != 0 && (bp->b_flags & B_CKHASH) != 0 && - cgp->cg_ckhash != bp->b_ckhash) || - !cg_chkmagic(cgp) || cgp->cg_cgx != cg) { + cgp->cg_ckhash != bp->b_ckhash) { sfs = ffs_getmntstat(devvp); printf("UFS %s%s (%s) cylinder checksum failed: cg %u, cgp: " "0x%x != bp: 0x%jx\n", devvp->v_type == VCHR ? "" : "snapshot of ", sfs->f_mntfromname, sfs->f_mntonname, cg, cgp->cg_ckhash, (uintmax_t)bp->b_ckhash); + bp->b_flags &= ~B_CKHASH; + bp->b_flags |= B_INVAL | B_NOCACHE; + brelse(bp); + return (EIO); + } + if (!cg_chkmagic(cgp) || cgp->cg_cgx != cg) { + sfs = ffs_getmntstat(devvp); + printf("UFS %s%s (%s)", + devvp->v_type == VCHR ? "" : "snapshot of ", + sfs->f_mntfromname, sfs->f_mntonname); + if (!cg_chkmagic(cgp)) + printf(" cg %u: bad magic number 0x%x should be 0x%x\n", + cg, cgp->cg_magic, CG_MAGIC); + else + printf(": wrong cylinder group cg %u != cgx %u\n", cg, + cgp->cg_cgx); bp->b_flags &= ~B_CKHASH; bp->b_flags |= B_INVAL | B_NOCACHE; brelse(bp); From owner-svn-src-all@freebsd.org Wed Jan 31 23:16:19 2018 Return-Path: Delivered-To: svn-src-all@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 D7AE6EC3113; Wed, 31 Jan 2018 23:16: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 8978A7E0D7; Wed, 31 Jan 2018 23:16: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 8020F2C6CE; Wed, 31 Jan 2018 23:16: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 w0VNGJ8L096944; Wed, 31 Jan 2018 23:16:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VNGJc4096943; Wed, 31 Jan 2018 23:16:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801312316.w0VNGJc4096943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Jan 2018 23:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328645 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 328645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 23:16:20 -0000 Author: imp Date: Wed Jan 31 23:16:19 2018 New Revision: 328645 URL: https://svnweb.freebsd.org/changeset/base/328645 Log: Add the new armv7 architecture. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Wed Jan 31 23:13:37 2018 (r328644) +++ head/share/man/man7/arch.7 Wed Jan 31 23:16:19 2018 (r328645) @@ -95,6 +95,7 @@ architectures, the final release. .It arm Ta 6.0 .It armeb Ta 8.0 .It armv6 Ta 10.0 +.It armv7 Ta 12.0 .It arm64 Ta 11.0 .It ia64 Ta 5.0 Ta 10.x .It i386 Ta 1.0 @@ -164,6 +165,8 @@ Examples are: .Dv arm64 currently does not support execution of .Dv armv6 +or +.Dv armv7 binaries, even if the CPU implements .Dv AArch32 execution state. @@ -220,6 +223,7 @@ is 8 bytes on all supported architectures except i386. .It arm Ta little Ta unsigned .It armeb Ta big Ta unsigned .It armv6 Ta little Ta unsigned +.It armv7 Ta little Ta unsigned .It arm64 Ta little Ta unsigned .It i386 Ta little Ta signed .It mips Ta big Ta signed @@ -245,6 +249,7 @@ is 8 bytes on all supported architectures except i386. .It arm Ta 4K .It armeb Ta 4K .It armv6 Ta 4K, 1M +.It armv7 Ta 4K, 1M .It arm64 Ta 4K, 2M, 1G .It i386 Ta 4K, 2M (PAE), 4M .It mips Ta 4K @@ -270,6 +275,7 @@ is 8 bytes on all supported architectures except i386. .It arm Ta soft Ta soft, double precision .It armeb Ta soft Ta soft, double precision .It armv6 Ta hard(1) Ta hard, double precision +.It armv7 Ta hard(1) Ta hard, double precision .It arm64 Ta hard Ta soft, quad precision .It i386 Ta hard Ta hard, 80 bit .It mips Ta soft Ta identical to double @@ -322,6 +328,7 @@ Architecture-specific macros: .It arm Ta Dv __arm__ .It armeb Ta Dv __arm__ .It armv6 Ta Dv __arm__, Dv __ARM_ARCH >= 6 +.It armv7 Ta Dv __arm__, Dv __ARM_ARCH >= 7 .It arm64 Ta Dv __aarch64__ .It i386 Ta Dv __i386__ .It mips Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_o32 From owner-svn-src-all@freebsd.org Wed Jan 31 23:16:55 2018 Return-Path: Delivered-To: svn-src-all@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 E5DE6EC3188; Wed, 31 Jan 2018 23:16:54 +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 957D77E1E0; Wed, 31 Jan 2018 23:16:54 +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 906CE2C6CF; Wed, 31 Jan 2018 23:16:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VNGsJU097008; Wed, 31 Jan 2018 23:16:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VNGsOg097007; Wed, 31 Jan 2018 23:16:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801312316.w0VNGsOg097007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Jan 2018 23:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328646 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 328646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 23:16:55 -0000 Author: imp Date: Wed Jan 31 23:16:54 2018 New Revision: 328646 URL: https://svnweb.freebsd.org/changeset/base/328646 Log: Bump .Dd Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Wed Jan 31 23:16:19 2018 (r328645) +++ head/share/man/man7/arch.7 Wed Jan 31 23:16:54 2018 (r328646) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 15, 2017 +.Dd January 31, 2018 .Dt ARCH 7 .Os .Sh NAME From owner-svn-src-all@freebsd.org Wed Jan 31 23:30:50 2018 Return-Path: Delivered-To: svn-src-all@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 0083EEC3DA1; Wed, 31 Jan 2018 23:30:50 +0000 (UTC) (envelope-from mckusick@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 A77B07E961; Wed, 31 Jan 2018 23:30:49 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A267A2C887; Wed, 31 Jan 2018 23:30:49 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0VNUnEO002824; Wed, 31 Jan 2018 23:30:49 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0VNUnbm002823; Wed, 31 Jan 2018 23:30:49 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801312330.w0VNUnbm002823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 31 Jan 2018 23:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328647 - head/sys/geom/journal X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/geom/journal X-SVN-Commit-Revision: 328647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 23:30:50 -0000 Author: mckusick Date: Wed Jan 31 23:30:49 2018 New Revision: 328647 URL: https://svnweb.freebsd.org/changeset/base/328647 Log: Null out journal softc pointer earlier to avoid a segment fault that can otherwise occur. PR: 221804 Submitted by: Andreas Longwitz MFC after: 1 week Modified: head/sys/geom/journal/g_journal.c Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Wed Jan 31 23:16:54 2018 (r328646) +++ head/sys/geom/journal/g_journal.c Wed Jan 31 23:30:49 2018 (r328647) @@ -2432,6 +2432,7 @@ g_journal_destroy(struct g_journal_softc *sc) sc->sc_current_count); } + gp->softc = NULL; LIST_FOREACH(cp, &gp->consumer, consumer) { if (cp->acr + cp->acw + cp->ace > 0) g_access(cp, -1, -1, -1); @@ -2443,7 +2444,6 @@ g_journal_destroy(struct g_journal_softc *sc) */ g_post_event(g_journal_destroy_consumer, cp, M_WAITOK, NULL); } - gp->softc = NULL; g_wither_geom(gp, ENXIO); free(sc, M_JOURNAL); return (0); From owner-svn-src-all@freebsd.org Thu Feb 1 01:12:51 2018 Return-Path: Delivered-To: svn-src-all@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 9DE51EC9F81; Thu, 1 Feb 2018 01:12:51 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56CEC8195A; Thu, 1 Feb 2018 01:12:51 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from [192.168.19.1] (unknown [127.0.1.132]) by freefall.freebsd.org (Postfix) with ESMTP id BF65713390; Thu, 1 Feb 2018 01:12:50 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) From: "Jonathan Anderson" To: rgrimes@freebsd.org Cc: "Nathan Whitehorn" , "Steve Wills" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328593 - head/release/scripts Date: Wed, 31 Jan 2018 21:42:49 -0330 X-Mailer: MailMate (1.10r5443) Message-ID: In-Reply-To: <201801301828.w0UIScsT026083@pdx.rh.CN85.dnsmgr.net> References: <201801301828.w0UIScsT026083@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 01:12:51 -0000 On 30 Jan 2018, at 14:58, Rodney W. Grimes wrote: >> Do we even want to include the ports tree on install media? >> Extracting >> ports from some out-of-date tarball doesn't seem to match best >> practices >> for ports and it takes up quite a lot of space. >> -Nathan > > Yes, you want to ship a known working known building and tested ports > tree with the release, as there is no tag to pull this specific tree > out of svn. > > I suppose it might be ok top stop putting it in the .iso's, > but this tarball should remain avaliable with the distrubtion > file sets on the ftp server. Is a tarball required, or is it really just the ports tree revision number that one needs? Speaking of which, would it be much work for us to annotate binary packages with a revision number for the ports tree the package was built from? That might make it easier to reproduce package builds, build identical-except-for-one-option packages, etc. Jon -- Jonathan Anderson jonathan@FreeBSD.org From owner-svn-src-all@freebsd.org Thu Feb 1 01:59:38 2018 Return-Path: Delivered-To: svn-src-all@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 935FAECDCA7; Thu, 1 Feb 2018 01:59:38 +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 44298837BC; Thu, 1 Feb 2018 01:59:38 +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 3EFE22E0E6; Thu, 1 Feb 2018 01:59:38 +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 w111xcVT076175; Thu, 1 Feb 2018 01:59:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w111xc9k076174; Thu, 1 Feb 2018 01:59:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201802010159.w111xc9k076174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 1 Feb 2018 01:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328648 - stable/11/sbin/pfctl X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sbin/pfctl X-SVN-Commit-Revision: 328648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 01:59:38 -0000 Author: pfg Date: Thu Feb 1 01:59:37 2018 New Revision: 328648 URL: https://svnweb.freebsd.org/changeset/base/328648 Log: MFC r328497: pfctl(8): Fix two wrong conditions. Caught by gcc80's -Wtautological-compare option. MFC after: 5 days Reviewed by: kp Obtained from: DragonFlyBSD (git e3cdbf6c) Modified: stable/11/sbin/pfctl/pfctl_optimize.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/pfctl/pfctl_optimize.c ============================================================================== --- stable/11/sbin/pfctl/pfctl_optimize.c Wed Jan 31 23:30:49 2018 (r328647) +++ stable/11/sbin/pfctl/pfctl_optimize.c Thu Feb 1 01:59:37 2018 (r328648) @@ -1091,7 +1091,7 @@ skip_cmp_dst_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->dst.addr.v.ifname, b->dst.addr.v.ifname) != 0 || - a->dst.addr.iflags != a->dst.addr.iflags || + a->dst.addr.iflags != b->dst.addr.iflags || memcmp(&a->dst.addr.v.a.mask, &b->dst.addr.v.a.mask, sizeof(a->dst.addr.v.a.mask))) return (1); @@ -1163,7 +1163,7 @@ skip_cmp_src_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->src.addr.v.ifname, b->src.addr.v.ifname) != 0 || - a->src.addr.iflags != a->src.addr.iflags || + a->src.addr.iflags != b->src.addr.iflags || memcmp(&a->src.addr.v.a.mask, &b->src.addr.v.a.mask, sizeof(a->src.addr.v.a.mask))) return (1); From owner-svn-src-all@freebsd.org Thu Feb 1 02:00:37 2018 Return-Path: Delivered-To: svn-src-all@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 5BDE0ECDE3A; Thu, 1 Feb 2018 02:00:37 +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 DA90C8393D; Thu, 1 Feb 2018 02:00:36 +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 D57AE2E0F2; Thu, 1 Feb 2018 02:00:36 +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 w1120aea078475; Thu, 1 Feb 2018 02:00:36 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1120aQn078474; Thu, 1 Feb 2018 02:00:36 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201802010200.w1120aQn078474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 1 Feb 2018 02:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328649 - stable/10/sbin/pfctl X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/sbin/pfctl X-SVN-Commit-Revision: 328649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 02:00:37 -0000 Author: pfg Date: Thu Feb 1 02:00:36 2018 New Revision: 328649 URL: https://svnweb.freebsd.org/changeset/base/328649 Log: MFC r328497: pfctl(8): Fix two wrong conditions. Caught by gcc80's -Wtautological-compare option. MFC after: 5 days Reviewed by: kp Obtained from: DragonFlyBSD (git e3cdbf6c) Modified: stable/10/sbin/pfctl/pfctl_optimize.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/pfctl/pfctl_optimize.c ============================================================================== --- stable/10/sbin/pfctl/pfctl_optimize.c Thu Feb 1 01:59:37 2018 (r328648) +++ stable/10/sbin/pfctl/pfctl_optimize.c Thu Feb 1 02:00:36 2018 (r328649) @@ -1091,7 +1091,7 @@ skip_cmp_dst_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->dst.addr.v.ifname, b->dst.addr.v.ifname) != 0 || - a->dst.addr.iflags != a->dst.addr.iflags || + a->dst.addr.iflags != b->dst.addr.iflags || memcmp(&a->dst.addr.v.a.mask, &b->dst.addr.v.a.mask, sizeof(a->dst.addr.v.a.mask))) return (1); @@ -1163,7 +1163,7 @@ skip_cmp_src_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->src.addr.v.ifname, b->src.addr.v.ifname) != 0 || - a->src.addr.iflags != a->src.addr.iflags || + a->src.addr.iflags != b->src.addr.iflags || memcmp(&a->src.addr.v.a.mask, &b->src.addr.v.a.mask, sizeof(a->src.addr.v.a.mask))) return (1); From owner-svn-src-all@freebsd.org Thu Feb 1 05:28:02 2018 Return-Path: Delivered-To: svn-src-all@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 BAF05F0F33B; Thu, 1 Feb 2018 05:28:02 +0000 (UTC) (envelope-from nwhitehorn@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 710C36E100; Thu, 1 Feb 2018 05:28:02 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6C09A574; Thu, 1 Feb 2018 05:28:02 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w115S2cv080401; Thu, 1 Feb 2018 05:28:02 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w115S2WL080400; Thu, 1 Feb 2018 05:28:02 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201802010528.w115S2WL080400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 1 Feb 2018 05:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328650 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 328650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 05:28:03 -0000 Author: nwhitehorn Date: Thu Feb 1 05:28:02 2018 New Revision: 328650 URL: https://svnweb.freebsd.org/changeset/base/328650 Log: Fix build on 32-bit PowerPC, broken in r328537. Modified: head/sys/powerpc/aim/mp_cpudep.c Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Thu Feb 1 02:00:36 2018 (r328649) +++ head/sys/powerpc/aim/mp_cpudep.c Thu Feb 1 05:28:02 2018 (r328650) @@ -85,15 +85,20 @@ cpudep_ap_early_bootstrap(void) break; case IBMPOWER8: case IBMPOWER8E: +#ifdef __powerpc64__ if (mfmsr() & PSL_HV) { isync(); - /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ + /* + * Direct interrupts to SRR instead of HSRR and + * reset LPCR otherwise + */ mtspr(SPR_LPID, 0); isync(); mtspr(SPR_LPCR, LPCR_LPES); isync(); } +#endif break; } From owner-svn-src-all@freebsd.org Thu Feb 1 05:31:26 2018 Return-Path: Delivered-To: svn-src-all@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 086E7F0F709; Thu, 1 Feb 2018 05:31:26 +0000 (UTC) (envelope-from nwhitehorn@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 B56126EF61; Thu, 1 Feb 2018 05:31:25 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B045A752; Thu, 1 Feb 2018 05:31:25 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w115VPBv081721; Thu, 1 Feb 2018 05:31:25 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w115VOMM081712; Thu, 1 Feb 2018 05:31:24 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201802010531.w115VOMM081712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 1 Feb 2018 05:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328651 - in head/sys/powerpc: aim booke include powerpc X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: in head/sys/powerpc: aim booke include powerpc X-SVN-Commit-Revision: 328651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 05:31:26 -0000 Author: nwhitehorn Date: Thu Feb 1 05:31:24 2018 New Revision: 328651 URL: https://svnweb.freebsd.org/changeset/base/328651 Log: Change the default MSR values used when starting userland and kernel threads from compile-time defines to global variables. This removes a significant amount of duplicated runtime patches to the compile-time defines, centralizing the conditional logic in the early startup code. Reviewed by: jhibbits Modified: head/sys/powerpc/aim/aim_machdep.c head/sys/powerpc/aim/mp_cpudep.c head/sys/powerpc/booke/booke_machdep.c head/sys/powerpc/include/psl.h head/sys/powerpc/powerpc/exec_machdep.c head/sys/powerpc/powerpc/genassym.c head/sys/powerpc/powerpc/machdep.c head/sys/powerpc/powerpc/vm_machdep.c Modified: head/sys/powerpc/aim/aim_machdep.c ============================================================================== --- head/sys/powerpc/aim/aim_machdep.c Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/aim/aim_machdep.c Thu Feb 1 05:31:24 2018 (r328651) @@ -178,6 +178,27 @@ aim_cpu_init(vm_offset_t toc) trap_offset = 0; cacheline_warn = 0; + /* General setup for AIM CPUs */ + psl_kernset = PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI; + +#ifdef __powerpc64__ + psl_kernset |= PSL_SF; + if (mfmsr() & PSL_HV) + psl_kernset |= PSL_HV; +#endif + psl_userset = psl_kernset | PSL_PR; +#ifdef __powerpc64__ + psl_userset32 = psl_userset & ~PSL_SF; +#endif + + /* Bits that users aren't allowed to change */ + psl_userstatic = ~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1); + /* + * Mask bits from the SRR1 that aren't really the MSR: + * Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64) + */ + psl_userstatic &= ~0x783f0000UL; + /* Various very early CPU fix ups */ switch (mfpvr() >> 16) { /* Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/aim/mp_cpudep.c Thu Feb 1 05:31:24 2018 (r328651) @@ -111,7 +111,7 @@ cpudep_ap_bootstrap(void) { register_t msr, sp; - msr = PSL_KERNSET & ~PSL_EE; + msr = psl_kernset & ~PSL_EE; mtmsr(msr); pcpup->pc_curthread = pcpup->pc_idlethread; Modified: head/sys/powerpc/booke/booke_machdep.c ============================================================================== --- head/sys/powerpc/booke/booke_machdep.c Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/booke/booke_machdep.c Thu Feb 1 05:31:24 2018 (r328651) @@ -210,6 +210,16 @@ booke_cpu_init(void) cpu_features |= PPC_FEATURE_BOOKE; + psl_kernset = PSL_CE | PSL_ME | PSL_EE; +#ifdef __powerpc64__ + psl_kernset |= PSL_CM; +#endif + psl_userset = psl_kernset | PSL_PR; +#ifdef __powerpc64__ + psl_userset32 = psl_kernset & ~PSL_CM; +#endif + psl_userstatic = ~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1); + pmap_mmu_install(MMU_TYPE_BOOKE, BUS_PROBE_GENERIC); } Modified: head/sys/powerpc/include/psl.h ============================================================================== --- head/sys/powerpc/include/psl.h Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/include/psl.h Thu Feb 1 05:31:24 2018 (r328651) @@ -90,28 +90,13 @@ #define PSL_FE_PREC (PSL_FE0 | PSL_FE1) /* precise */ #define PSL_FE_DFLT PSL_FE_DIS /* default == none */ -#if defined(BOOKE_E500) -/* Initial kernel MSR, use IS=1 ad DS=1. */ -#define PSL_KERNSET_INIT (PSL_IS | PSL_DS) +#ifndef LOCORE +extern register_t psl_kernset; /* Default MSR values for kernel */ +extern register_t psl_userset; /* Default MSR values for userland */ #ifdef __powerpc64__ -#define PSL_KERNSET (PSL_CM | PSL_CE | PSL_ME | PSL_EE) -#else -#define PSL_KERNSET (PSL_CE | PSL_ME | PSL_EE) +extern register_t psl_userset32; /* Default user MSR values for 32-bit */ #endif -#define PSL_SRR1_MASK 0x00000000UL /* No mask on Book-E */ -#elif defined(BOOKE_PPC4XX) -#define PSL_KERNSET (PSL_CE | PSL_ME | PSL_EE | PSL_FP) -#define PSL_SRR1_MASK 0x00000000UL /* No mask on Book-E */ -#elif defined(AIM) -#ifdef __powerpc64__ -#define PSL_KERNSET (PSL_SF | PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) -#else -#define PSL_KERNSET (PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) +extern register_t psl_userstatic; /* Bits of SRR1 userland may not set */ #endif -#define PSL_SRR1_MASK 0x783f0000UL /* Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64) */ -#endif - -#define PSL_USERSET (PSL_KERNSET | PSL_PR) -#define PSL_USERSTATIC (~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1) & ~PSL_SRR1_MASK) #endif /* _MACHINE_PSL_H_ */ Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/powerpc/exec_machdep.c Thu Feb 1 05:31:24 2018 (r328651) @@ -454,7 +454,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp) /* * Don't let the user set privileged MSR bits */ - if ((mcp->mc_srr1 & PSL_USERSTATIC) != (tf->srr1 & PSL_USERSTATIC)) { + if ((mcp->mc_srr1 & psl_userstatic) != (tf->srr1 & psl_userstatic)) { return (EINVAL); } @@ -538,16 +538,8 @@ exec_setregs(struct thread *td, struct image_params *i tf->srr0 = imgp->entry_addr; #ifdef __powerpc64__ tf->fixreg[12] = imgp->entry_addr; - #ifdef AIM - tf->srr1 = PSL_SF | PSL_USERSET | PSL_FE_DFLT; - if (mfmsr() & PSL_HV) - tf->srr1 |= PSL_HV; - #elif defined(BOOKE) - tf->srr1 = PSL_CM | PSL_USERSET | PSL_FE_DFLT; #endif - #else - tf->srr1 = PSL_USERSET | PSL_FE_DFLT; - #endif + tf->srr1 = psl_userset | PSL_FE_DFLT; td->td_pcb->pcb_flags = 0; } @@ -572,14 +564,7 @@ ppc32_setregs(struct thread *td, struct image_params * tf->fixreg[8] = (register_t)imgp->ps_strings; /* NetBSD extension */ tf->srr0 = imgp->entry_addr; - tf->srr1 = PSL_USERSET | PSL_FE_DFLT; -#ifdef AIM - tf->srr1 &= ~PSL_SF; - if (mfmsr() & PSL_HV) - tf->srr1 |= PSL_HV; -#elif defined(BOOKE) - tf->srr1 &= ~PSL_CM; -#endif + tf->srr1 = psl_userset32 | PSL_FE_DFLT; td->td_pcb->pcb_flags = 0; } #endif @@ -990,7 +975,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Setup to release spin count in fork_exit(). */ td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_msr = PSL_KERNSET; + td->td_md.md_saved_msr = psl_kernset; } void @@ -1015,9 +1000,10 @@ cpu_set_upcall(struct thread *td, void (*entry)(void * tf->fixreg[3] = (register_t)arg; if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { tf->srr0 = (register_t)entry; - tf->srr1 = PSL_USERSET | PSL_FE_DFLT; #ifdef __powerpc64__ - tf->srr1 &= ~PSL_SF; + tf->srr1 = psl_userset32 | PSL_FE_DFLT; + #else + tf->srr1 = psl_userset | PSL_FE_DFLT; #endif } else { #ifdef __powerpc64__ @@ -1026,14 +1012,10 @@ cpu_set_upcall(struct thread *td, void (*entry)(void * tf->srr0 = entry_desc[0]; tf->fixreg[2] = entry_desc[1]; tf->fixreg[11] = entry_desc[2]; - tf->srr1 = PSL_SF | PSL_USERSET | PSL_FE_DFLT; + tf->srr1 = psl_userset | PSL_FE_DFLT; #endif } - #ifdef __powerpc64__ - if (mfmsr() & PSL_HV) - tf->srr1 |= PSL_HV; - #endif td->td_pcb->pcb_flags = 0; td->td_retval[0] = (register_t)entry; Modified: head/sys/powerpc/powerpc/genassym.c ============================================================================== --- head/sys/powerpc/powerpc/genassym.c Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/powerpc/genassym.c Thu Feb 1 05:31:24 2018 (r328651) @@ -236,10 +236,6 @@ ASSYM(PSL_UCLE, PSL_UCLE); ASSYM(PSL_WE, PSL_WE); ASSYM(PSL_UBLE, PSL_UBLE); -#if defined(BOOKE_E500) -ASSYM(PSL_KERNSET_INIT, PSL_KERNSET_INIT); -#endif - #if defined(AIM) && defined(__powerpc64__) ASSYM(PSL_SF, PSL_SF); ASSYM(PSL_HV, PSL_HV); @@ -268,7 +264,4 @@ ASSYM(PSL_FP, PSL_FP); ASSYM(PSL_ME, PSL_ME); ASSYM(PSL_PR, PSL_PR); ASSYM(PSL_PMM, PSL_PMM); -ASSYM(PSL_KERNSET, PSL_KERNSET); -ASSYM(PSL_USERSET, PSL_USERSET); -ASSYM(PSL_USERSTATIC, PSL_USERSTATIC); Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/powerpc/machdep.c Thu Feb 1 05:31:24 2018 (r328651) @@ -160,6 +160,14 @@ uintptr_t powerpc_init(vm_offset_t, vm_offset_t, vm_of long Maxmem = 0; long realmem = 0; +/* Default MSR values set in the AIM/Book-E early startup code */ +register_t psl_kernset; +register_t psl_userset; +register_t psl_userstatic; +#ifdef __powerpc64__ +register_t psl_userset32; +#endif + struct kva_md_info kmi; static void @@ -380,7 +388,7 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs * Bring up MMU */ pmap_bootstrap(startkernel, endkernel); - mtmsr(PSL_KERNSET & ~PSL_EE); + mtmsr(psl_kernset & ~PSL_EE); /* * Initialize params/tunables that are derived from memsize Modified: head/sys/powerpc/powerpc/vm_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/vm_machdep.c Thu Feb 1 05:28:02 2018 (r328650) +++ head/sys/powerpc/powerpc/vm_machdep.c Thu Feb 1 05:31:24 2018 (r328651) @@ -167,7 +167,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_msr = PSL_KERNSET; + td2->td_md.md_saved_msr = psl_kernset; /* * Now cpu_switch() can schedule the new process. From owner-svn-src-all@freebsd.org Thu Feb 1 07:52:07 2018 Return-Path: Delivered-To: svn-src-all@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 46318ECBE43; Thu, 1 Feb 2018 07:52:07 +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 ED8AC7D811; Thu, 1 Feb 2018 07:52:06 +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 E8A831D96; Thu, 1 Feb 2018 07:52:06 +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 w117q6Em056273; Thu, 1 Feb 2018 07:52:06 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w117q6Lf056272; Thu, 1 Feb 2018 07:52:06 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201802010752.w117q6Lf056272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 1 Feb 2018 07:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328652 - 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: 328652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 07:52:07 -0000 Author: kp Date: Thu Feb 1 07:52:06 2018 New Revision: 328652 URL: https://svnweb.freebsd.org/changeset/base/328652 Log: pf: Avoid warning without INVARIANTS When INVARIANTS is not set the 'last' variable is not used, which can generate compiler warnings. If this invariant is ever violated it'd result in a KASSERT failure in refcount_release(), so this one is not strictly required. Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Thu Feb 1 05:31:24 2018 (r328651) +++ head/sys/netpfil/pf/pf.c Thu Feb 1 07:52:06 2018 (r328652) @@ -1613,7 +1613,6 @@ int pf_unlink_state(struct pf_state *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; - int last; if ((flags & PF_ENTER_LOCKED) == 0) PF_HASHROW_LOCK(ih); @@ -1654,8 +1653,9 @@ pf_unlink_state(struct pf_state *s, u_int flags) PF_HASHROW_UNLOCK(ih); pf_detach_state(s); - last = refcount_release(&s->refs); - KASSERT(last == 0, ("Incorrect state reference count")); + /* pf_state_insert() initialises refs to 2, so we can never release the + * last reference here, only in pf_release_state(). */ + (void)refcount_release(&s->refs); return (pf_release_state(s)); } From owner-svn-src-all@freebsd.org Thu Feb 1 11:07:29 2018 Return-Path: Delivered-To: svn-src-all@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 AD836EE0B60; Thu, 1 Feb 2018 11:07:29 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBAE844BE; Thu, 1 Feb 2018 11:07:29 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0A096260227; Thu, 1 Feb 2018 12:07:27 +0100 (CET) Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src To: Jan Beich Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Thu, 1 Feb 2018 12:04:32 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 11:07:29 -0000 On 02/01/18 11:25, Jan Beich wrote: > Hans Petter Selasky writes: > >> Author: hselasky >> Date: Fri Jan 26 10:49:02 2018 >> New Revision: 328436 >> URL: https://svnweb.freebsd.org/changeset/base/328436 >> >> Log: >> Decouple Linux files from the belonging character device right after open >> in the LinuxKPI. This is done by calling finit() just before returning a magic >> value of ENXIO in the "linux_dev_fdopen" function. > > This breaks DRI3 (uses DMABUF) on drm-next-kmod (Linux 4.9 atm) e.g., > > $ LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears > libGL: screen 0 does not appear to be DRI3 capable > libGL error: Connection closed during DRI3 initialization failure > XIO: fatal IO error 35 (Resource temporarily unavailable) on X server ":0" > after 22 requests (22 known processed) with 0 events remaining. > Hi, I'll have a look. It might be an issue in libdrm, because it uses some out-of date methods to enumerate the device nodes, like the major and minor numbers. Did you recompile drm-next-kmod after recompiling the LinuxKPI? --HPS From owner-svn-src-all@freebsd.org Thu Feb 1 10:26:03 2018 Return-Path: Delivered-To: svn-src-all@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 F39ECEDC65C; Thu, 1 Feb 2018 10:26:02 +0000 (UTC) (envelope-from jbeich@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 9BDA882CB3; Thu, 1 Feb 2018 10:26:02 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id 8D8FF1C885; Thu, 1 Feb 2018 10:26:02 +0000 (UTC) From: Jan Beich To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> Date: Thu, 01 Feb 2018 11:25:52 +0100 In-Reply-To: <201801261049.w0QAn2Xt089656@repo.freebsd.org> (Hans Petter Selasky's message of "Fri, 26 Jan 2018 10:49:02 +0000 (UTC)") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 10:26:03 -0000 Hans Petter Selasky writes: > Author: hselasky > Date: Fri Jan 26 10:49:02 2018 > New Revision: 328436 > URL: https://svnweb.freebsd.org/changeset/base/328436 > > Log: > Decouple Linux files from the belonging character device right after open > in the LinuxKPI. This is done by calling finit() just before returning a magic > value of ENXIO in the "linux_dev_fdopen" function. This breaks DRI3 (uses DMABUF) on drm-next-kmod (Linux 4.9 atm) e.g., $ LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears libGL: screen 0 does not appear to be DRI3 capable libGL error: Connection closed during DRI3 initialization failure XIO: fatal IO error 35 (Resource temporarily unavailable) on X server ":0" after 22 requests (22 known processed) with 0 events remaining. From owner-svn-src-all@freebsd.org Thu Feb 1 11:16:02 2018 Return-Path: Delivered-To: svn-src-all@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 1EFBAEE1AFE; Thu, 1 Feb 2018 11:16:02 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A884484C84; Thu, 1 Feb 2018 11:16:01 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 96895260227; Thu, 1 Feb 2018 12:15:59 +0100 (CET) Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src From: Hans Petter Selasky To: Jan Beich Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> Message-ID: <4d1d778d-a0e0-0d3a-b37e-19fba10ae86f@selasky.org> Date: Thu, 1 Feb 2018 12:13:06 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 11:16:02 -0000 On 02/01/18 12:04, Hans Petter Selasky wrote: > On 02/01/18 11:25, Jan Beich wrote: >> Hans Petter Selasky writes: >> >>> Author: hselasky >>> Date: Fri Jan 26 10:49:02 2018 >>> New Revision: 328436 >>> URL: https://svnweb.freebsd.org/changeset/base/328436 >>> >>> Log: >>>    Decouple Linux files from the belonging character device right >>> after open >>>    in the LinuxKPI. This is done by calling finit() just before >>> returning a magic >>>    value of ENXIO in the "linux_dev_fdopen" function. >> >> This breaks DRI3 (uses DMABUF) on drm-next-kmod (Linux 4.9 atm) e.g., >> >> $ LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears >> libGL: screen 0 does not appear to be DRI3 capable >> libGL error: Connection closed during DRI3 initialization failure >> XIO:  fatal IO error 35 (Resource temporarily unavailable) on X server >> ":0" >>        after 22 requests (22 known processed) with 0 events remaining. >> > > Hi, > > I'll have a look. It might be an issue in libdrm, because it uses some > out-of date methods to enumerate the device nodes, like the major and > minor numbers. > > Did you recompile drm-next-kmod after recompiling the LinuxKPI? > > --HPS > Hi, I'm still running: freebsd-base-graphics git@github.com:FreeBSDDesktop/freebsd-base-graphics.git With r328436 applied on top and glxgears work: > env LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears > libGL: OpenDriver: trying /usr/local/lib/dri/i965_dri.so > libGL: Can't open configuration file /home/hans/.drirc: No such file or directory. > libGL: Using DRI2 for screen 0 > libGL: Can't open configuration file /home/hans/.drirc: No such file or directory. > Running synchronized to the vertical refresh. The framerate should be > approximately the same as the monitor refresh rate. > 302 frames in 5.0 seconds = 60.252 FPS Can you do a ktrace and see where it stops? --HPS From owner-svn-src-all@freebsd.org Thu Feb 1 11:51:21 2018 Return-Path: Delivered-To: svn-src-all@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 088E3EE575A; Thu, 1 Feb 2018 11:51:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 980D9863B3; Thu, 1 Feb 2018 11:51:20 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id E41CB260227; Thu, 1 Feb 2018 12:51:18 +0100 (CET) Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src To: Jan Beich Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <5cd0c6e1-e9fd-63d6-07dd-245e8b33631c@selasky.org> Date: Thu, 1 Feb 2018 12:48:25 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 11:51:21 -0000 On 02/01/18 12:20, Jan Beich wrote: >> Hi, >> >> I'll have a look. It might be an issue in libdrm, because it uses some >> out-of date methods to enumerate the device nodes, like the major and >> minor numbers. >> >> Did you recompile drm-next-kmod after recompiling the LinuxKPI? > Yes, recompiled. However, this commit in particular doesn't touch any > kernel headers for recompilation to be necessary. I also confirm > reverting the commit works around the issue. > Can you also verify: 1) run "xhost +" 2) run application as root --HPS From owner-svn-src-all@freebsd.org Thu Feb 1 11:21:06 2018 Return-Path: Delivered-To: svn-src-all@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 9DCEFEE279A; Thu, 1 Feb 2018 11:21:06 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FDDF85004; Thu, 1 Feb 2018 11:21:06 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id 406621D904; Thu, 1 Feb 2018 11:21:06 +0000 (UTC) From: Jan Beich To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> Date: Thu, 01 Feb 2018 12:20:59 +0100 In-Reply-To: (Hans Petter Selasky's message of "Thu, 1 Feb 2018 12:04:32 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 11:21:06 -0000 Hans Petter Selasky writes: > On 02/01/18 11:25, Jan Beich wrote: > >> Hans Petter Selasky writes: >> >>> Author: hselasky >>> Date: Fri Jan 26 10:49:02 2018 >>> New Revision: 328436 >>> URL: https://svnweb.freebsd.org/changeset/base/328436 >>> >>> Log: >>> Decouple Linux files from the belonging character device right after open >>> in the LinuxKPI. This is done by calling finit() just before returning a magic >>> value of ENXIO in the "linux_dev_fdopen" function. >> >> This breaks DRI3 (uses DMABUF) on drm-next-kmod (Linux 4.9 atm) e.g., >> >> $ LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears >> libGL: screen 0 does not appear to be DRI3 capable >> libGL error: Connection closed during DRI3 initialization failure >> XIO: fatal IO error 35 (Resource temporarily unavailable) on X server ":0" >> after 22 requests (22 known processed) with 0 events remaining. >> > > Hi, > > I'll have a look. It might be an issue in libdrm, because it uses some > out-of date methods to enumerate the device nodes, like the major and > minor numbers. > > Did you recompile drm-next-kmod after recompiling the LinuxKPI? Yes, recompiled. However, this commit in particular doesn't touch any kernel headers for recompilation to be necessary. I also confirm reverting the commit works around the issue. From owner-svn-src-all@freebsd.org Thu Feb 1 14:26:27 2018 Return-Path: Delivered-To: svn-src-all@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 94F2FED2072; Thu, 1 Feb 2018 14:26:27 +0000 (UTC) (envelope-from andrew@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 475606D46C; Thu, 1 Feb 2018 14:26:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 424B46235; Thu, 1 Feb 2018 14:26:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11EQRM6051313; Thu, 1 Feb 2018 14:26:27 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11EQRjR051312; Thu, 1 Feb 2018 14:26:27 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201802011426.w11EQRjR051312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Feb 2018 14:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328658 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 328658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 14:26:27 -0000 Author: andrew Date: Thu Feb 1 14:26:26 2018 New Revision: 328658 URL: https://svnweb.freebsd.org/changeset/base/328658 Log: Only promote userspace mappings to superpages. This was dropped in r328510, however due to the break-before-make requirement on arm64 is is currently unsafe to promote kernel pages. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Feb 1 13:17:42 2018 (r328657) +++ head/sys/arm64/arm64/pmap.c Thu Feb 1 14:26:26 2018 (r328658) @@ -3076,12 +3076,13 @@ validate: } #if VM_NRESERVLEVEL > 0 - if ((mpte == NULL || mpte->wire_count == NL3PG) && - pmap_superpages_enabled() && - (m->flags & PG_FICTITIOUS) == 0 && - vm_reserv_level_iffullpop(m) == 0) { - pmap_promote_l2(pmap, pde, va, &lock); - } + if (pmap != pmap_kernel() && + (mpte == NULL || mpte->wire_count == NL3PG) && + pmap_superpages_enabled() && + (m->flags & PG_FICTITIOUS) == 0 && + vm_reserv_level_iffullpop(m) == 0) { + pmap_promote_l2(pmap, pde, va, &lock); + } #endif if (lock != NULL) From owner-svn-src-all@freebsd.org Thu Feb 1 13:01:46 2018 Return-Path: Delivered-To: svn-src-all@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 087DBEC947B; Thu, 1 Feb 2018 13:01:46 +0000 (UTC) (envelope-from hselasky@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 AF3C369371; Thu, 1 Feb 2018 13:01:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9C3553D7; Thu, 1 Feb 2018 13:01:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11D1jba008265; Thu, 1 Feb 2018 13:01:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11D1ioe008255; Thu, 1 Feb 2018 13:01:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802011301.w11D1ioe008255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Feb 2018 13:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328653 - in stable/11/sys: compat/linuxkpi/common/include/asm compat/linuxkpi/common/include/linux compat/linuxkpi/common/include/net compat/linuxkpi/common/src conf contrib/rdma/krpin... X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/asm compat/linuxkpi/common/include/linux compat/linuxkpi/common/include/net compat/linuxkpi/common/src conf contrib/rdma/krping dev/mlx5/mlx5_core dev/... X-SVN-Commit-Revision: 328653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 13:01:46 -0000 Author: hselasky Date: Thu Feb 1 13:01:44 2018 New Revision: 328653 URL: https://svnweb.freebsd.org/changeset/base/328653 Log: MFC r310014-r327788: This is an overwrite merge backport of the LinuxKPI from FreeBSD-head. Following is a complete list of MFC'ed revisions and also partially MFC'ed revisions in the end. The MFC'ed revision are listed in incremental order. Bump the __FreeBSD_version to force recompilation of any external kernel modules. Sponsored by: Mellanox Technologies MFC r310014: Remove the only user of sysctl_add_oid(). My plan is to change this function's prototype at some point in the future to add a new label argument, which can be used to export all of sysctl as metrics that can be scraped by Prometheus. Switch over this caller to use the macro wrapper counterpart. MFC r310031: linuxkpi: Fix not-found case of linux_pci_find_irq_dev Linux list_for_each_entry() does not neccessarily end with the iterator NULL (it may be an offset from NULL if the list member is not the first element of the member struct). Reported by: Coverity CID: 1366940 Reviewed by: hselasky@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8780 MFC r313806: Whitespace fix. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r313807: Allow passing a constant atomic_t to atomic_read(). Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r313808: Implement more LinuxKPI atomic functions and macros. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r313810: Allow container_of() to be used with constant data pointers. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r313872: Implement GFP_DMA32 flag in the LinuxKPI. Define all FreeBSD native GFP bits as GFP_NATIVE_MASK. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r314040: Make the LinuxKPI task struct persistent accross system calls. A set of helper functions have been added to manage the life of the LinuxKPI task struct. When an external system call or task is invoked, a check is made to create the task struct by demand. A thread destructor callback is registered to free the task struct when a thread exits to avoid memory leaks. This change lays the ground for emulating the Linux kernel more closely which is a dependency by the code using the LinuxKPI APIs. Add new dedicated td_lkpi_task field has been added to struct thread instead of abusing td_retval[1]. Fix some header file inclusions to make LINT kernel build properly after this change. Bump the __FreeBSD_version to force a rebuild of all kernel modules. Sponsored by: Mellanox Technologies MFC r314043: Add support for LinuxKPI tasklets. Tasklets are implemented using a taskqueue and a small statemachine on top. The additional statemachine is required to ensure all LinuxKPI tasklets get serialized. FreeBSD taskqueues do not guarantee serialisation of its tasks, except when there is only one worker thread configured. Sponsored by: Mellanox Technologies MFC r314044: Streamline the LinuxKPI spinlock wrappers. 1) Add better spinlock debug names when WITNESS_ALL is defined. 2) Make sure that the calling thread gets bound to the current CPU while a spinlock is locked. Some Linux kernel code depends on that the CPU ID doesn't change while a spinlock is locked. 3) Add support for using LinuxKPI spinlocks during a panic(). Sponsored by: Mellanox Technologies MFC r314050: Replace dummy implementation of RCU in the LinuxKPI with one based on the in-kernel concurrency kit's ck_epoch API. Factor RCU hlist_xxx() functions into own rculist.h header file. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r314105: Improve LinuxKPI scatter list support. The i915kms driver in Linux 4.9 reimplement parts of the scatter list functions with regards to performance. In other words there is not so much room for changing structure layouts and functionality if the i915kms should be built AS-IS. This patch aligns the scatter list support to what is expected by the i915kms driver. Remove some comments not needed while at it. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r314106: Optimise unmapped LinuxKPI page allocations. When allocating unmapped pages, take advantage of the direct map on AMD64 to get the virtual address corresponding to a page. Else all pages allocated must be mapped because sometimes the virtual address of a page is requested. Move all page allocation and deallocation code into an own C-file. Add support for GFP_DMA32, GFP_KERNEL, GFP_ATOMIC and __GFP_ZERO allocation flags. Make a clear separation between mapped and unmapped allocations. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r314109: Convert magic values into macros in the LinuxKPI scatterlist implementation. Suggested by: cem @ Sponsored by: Mellanox Technologies MFC r314136: Implement __test_and_clear_bit() and __test_and_set_bit() in the LinuxKPI. The clang compiler will optimise these functions down to three AMD64 instructions if the bit argument is a constant during compilation. Sponsored by: Mellanox Technologies MFC r314205: Implement BIT_ULL() macro in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r314207: Implement srcu_dereference() macro in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r314214: Prototype device structure to ensure LinuxKPI header file can be included standalone. Sponsored by: Mellanox Technologies MFC r314215: Implement more string functions in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r314336: Define __sum16 type in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r314337: Implement more bit operation functions in the LinuxKPI. Some minor whitespace nits while at it. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r314604: Update the LinuxKPI RCU and SRCU wrappers for the concurrency kit, CK. - Optimise the RCU implementation to not allocate and free ck_epoch_records during runtime. Instead allocate two sets of ck_epoch_records per CPU for general purpose use. The first set is only used for reader locks and the second set is only used for synchronization and barriers and is protected with a regular mutex to prevent simultaneous issues. - Move the task structure away from the rcu_head structure and into the per-CPU structures. This allows the size of the rcu_head structure to be reduced down to the size of two pointers. - Fix a bug where the linux_rcu_barrier() function only waited for one per-CPU epoch record to be completed instead of all. - Use a critical section or a mutex to protect ck_epoch_begin() and ck_epoch_end() depending on RCU or SRCU type. All the ck_epoch_xxx() functions, except ck_epoch_register(), ck_epoch_unregister() and ck_epoch_recycle() are not re-entrant and needs a critical section or a mutex to operate in the LinuxKPI, after inspecting the CK implementation of the above mentioned functions. The simultaneous issues arise from per-CPU epoch records being shared between multiple threads depending on the amount of taskswitching and how many threads are involved with the RCU and SRCU operations. - Properly free all epoch records by using safe list traversal at LinuxKPI module unload. It turns out the ck_epoch_recycle() always have the records on an internal list and use a flag in the epoch record to track allocated and free entries. This would lead to use after free during module unload. - Remove redundant synchronize_rcu() call from the linux_compat_uninit() function. Let the linux_rcu_runtime_uninit() function do the final rcu_barrier() instead. Sponsored by: Mellanox Technologies MFC r314675: Remove duplicate prototype in the LinuxKPI to fix compilation warning. Reported by: emaste @ Sponsored by: Mellanox Technologies MFC r314771: Give LinuxKPI Read-Write semaphores better debug names when WITNESS_ALL is defined. The lock name is based on the filename and line number where the initialisation happens. Sponsored by: Mellanox Technologies MFC r314772: Implement DECLARE_RWSEM() macro in the LinuxKPI to initialize a Read-Write semaphore during module init time. Sponsored by: Mellanox Technologies MFC r314774: Implement add_timer_on() function in the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r314843: LinuxKPI workqueue cleanup. This change makes the workqueue implementation behave more like in Linux, both functionality wise and structure wise. All workqueue code has been moved to linux_work.c Add an atomic based statemachine to the work_struct to ensure proper operation. Prior to this change struct_work was directly mapped to a FreeBSD task. When a taskqueue has multiple threads the same task may end up being executed on more than one worker thread simultaneously. This might cause problems with code coming from Linux, which expects serial behaviour, similar to Linux tasklets. Move all global workqueue function names into the linux_xxx domain to avoid symbol name clashes in the future. Implement a few more workqueue related functions and macros. Create two multithreaded taskqueues for the LinuxKPI during module load, one for time-consuming callbacks and one for non-time consuming callbacks. Sponsored by: Mellanox Technologies MFC r314853: Use grouptaskqueue for tasklets in the LinuxKPI. This avoids creating own per-CPU threads and also ensures the tasklet execution happens on the same CPU core invoking the tasklet. Sponsored by: Mellanox Technologies MFC r314859: Make sure jiffies value is cast to an integer in the LinuxKPI before doing millisecond conversion. Under FreeBSD jiffies are 32-bit. Sponsored by: Mellanox Technologies MFC r314861: Implement time_is_after_eq_jiffies() function in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r314904: Implement eth_zero_addr() in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r314905: Cleanup the LinuxKPI slab implementation. Put large functions into linux_slab.c instead of declaring them static inline. Add support for more memory allocation wrappers like kmalloc_array() and __vmalloc(). Make sure either the M_WAITOK or the M_NOWAIT flag is set and mask away unused memory allocation flags before calling FreeBSD's malloc() routine. Move kmalloc_node() definition to slab.h where it belongs. Implement support for the SLAB_DESTROY_BY_RCU feature when creating a kmem_cache which basically means kmem_cache memory is freed using call_rcu(). Sponsored by: Mellanox Technologies MFC r314920: Fix compilation warning for powerpc64 by not using const keyword in return types: Type qualifiers ignored on function return type [-Wreturn-type] Reported by: andreast @ Sponsored by: Mellanox Technologies MFC r314953: Don't create any threads before SI_SUB_INIT_IF in the LinuxKPI. Else kthread_add() will assert it is called too soon. This fixes a startup issue when COMPAT_LINUXKPI is in enabled the kernel configuration file. Reported by: Michael Butler Sponsored by: Mellanox Technologies MFC r314965: Cleanup the LinuxKPI mutex wrappers. Add support for using mutexes during KDB and shutdown. This is also required for doing mode-switching during panic for drm-next. Add new mutex functions mutex_init_witness() and mutex_destroy() allowing LinuxKPI mutexes to be tracked by witness. Declare mutex_is_locked() and mutex_is_owned() like inline functions to get cleaner warnings. These functions are used inside WARN_ON() statements which might look a bit odd if these functions get fully expanded. Give mutexes better debug names through the mutex_name() macro when WITNESS_ALL is defined. The mutex_name() macro can prefix parts of the filename and line number before the mutex name. Sponsored by: Mellanox Technologies MFC r314970: Implement support for mutexes with deadlock avoidance in the LinuxKPI. When locking a mutex and deadlock is detected the first mutex lock call that sees the deadlock will return -EDEADLK . Sponsored by: Mellanox Technologies MFC r314971: Fix implementation of the DECLARE_WORK() macro in the LinuxKPI to fully initialize the declared work structure and not only the function callback pointer. Sponsored by: Mellanox Technologies MFC r315244: Set "current" pointer for LinuxKPI interrupts and timer callbacks. Sponsored by: Mellanox Technologies MFC r315410: Define some more LinuxKPI task related macros. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r315419: Implement more userspace memory access functions in the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r315420: The LinuxKPI pagefault disable and enable functions can only be used pairwise to support the FreeBSD way of pushing and popping the page fault flags. Ensure this by requiring every occurrence of pagefault disable function call to have a corresponding pagefault enable call. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r315422: Use __LP64__ to detect presence of suword64() to fix linking and loading of the LinuxKPI on 32-bit platforms. Reported by: lwhsu @ Sponsored by: Mellanox Technologies MFC r315442: Add comment describing the use of pagefault_disable() and pagefault_enable() in the LinuxKPI. Suggested by: rpokala@ Sponsored by: Mellanox Technologies MFC r315443: Implement minimalistic memory mapping structure, struct mm_struct, and some associated helper functions in the LinuxKPI. Let the existing linux_alloc_current() function allocate and initialize the new structure and let linux_free_current() drop the refcount on the memory mapping structure. When the mm_struct's refcount reaches zero, the structure is freed. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r315457: Implement get_pid_task(), pid_task() and some other PID helper functions in the LinuxKPI. Add a usage atomic to the task_struct structure to facilitate refcounting the task structure when returned from get_pid_task(). The get_task_struct() and put_task_struct() function is used to manage atomic refcounting. After this change the task_struct should only be freed through put_task_struct(). Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r315713: Add support for more IPv4 and IPv6 related macros in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r315714: Add full VNET support to the inet_get_local_port_range() function in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r315719: Extend cmpxchg() to support 8- and 16-bit values, and add xchg(). These are needed to support updated revisions of the DRM code. Reviewed by: hselasky (previous version) MFC r315856: Add support for ratelimited printouts in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r315859: Function macros are preferred in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r315863: Add proper error checking for the string to number conversion functions in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r315864: Use ppsratecheck() for ratelimiting in the LinuxKPI. Suggested by: cem @ Sponsored by: Mellanox Technologies MFC r316033: Implement a series of physical page management related functions in the LinuxKPI for accessing user-space memory in the kernel. Add functions to hold and wire physical page(s) based on a given range of user-space virtual addresses. Add functions to get and put a reference on, wire, hold, mark accessed, copy and dirty a physical page. Add new VM related structures and defines as a preparation step for advancing the memory map capabilities of the LinuxKPI. Add function to figure out if a virtual address was allocated using malloc(). Add function to convert a virtual kernel address into its physical page pointer. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r316034: Add more platforms supporting the direct map feature in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r316035: Implement vmalloc_32() in the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r316521: Implement down_write_killable() in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r316522: Unify error handling when si_drv1 is NULL in the LinuxKPI. Make sure the character device poll callback function does not return an error code, but a POLLXXX value, in case of failure. Sponsored by: Mellanox Technologies MFC r316561: Before registering a new mm_struct in the LinuxKPI check if other tasks in the belonging procedure already have a valid mm_struct and reference that instead. The mm_struct in the LinuxKPI should be shared among all tasks belonging to the same procedure. This has to do with with the mmap_sem semaphore which should serialize all VM operations inside a given procedure. Linux based drivers depend on this behaviour. Sponsored by: Mellanox Technologies MFC r316562: Implement proper support for memory map operations in the LinuxKPI, like open, close and fault using the character device pager. Some notes about the implementation: 1) Linux drivers set the vm_ops and vm_private_data fields during a mmap() call to indicate that the driver wants to use the LinuxKPI VM operations. Else these operations are not used. 2) The vm_private_data pointer is associated with a VM area structure and inserted into an internal LinuxKPI list. If the vm_private_data pointer already exists, the existing VM area structure is used instead of the allocated one which gets freed. 3) The LinuxKPI's vm_private_data pointer is used as the callback handle for the FreeBSD VM object. The VM subsystem in FreeBSD has a similar list to identify equal handles and will only call the character device pager's close function once. 4) All LinuxKPI VM operations are serialized through the mmap_sem sempaphore, which is per procedure, which prevents simultaneous access to the shared VM area structure when receiving page faults. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r316563: Fix implementation of task_pid_group_leader() in the LinuxKPI. In FreeBSD thread IDs and procedure IDs have distinct number spaces. When asking for the group leader task ID in the LinuxKPI, return the procedure ID and let this resolve to the first task in the procedure having a valid LinuxKPI task structure pointer. Sponsored by: Mellanox Technologies MFC r316564: Implement need_resched() in the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r316565: Define VM_READ, VM_WRITE and VM_EXEC in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r316568: Cleanup the bitmap_xxx() functions in the LinuxKPI: - Move all bitmap related functions from bitops.h to bitmap.h, similar to what Linux does. - Apply some minor code cleanup and simplifications to optimize the generated code when using static inline functions. - Implement the following list of bitmap functions which are needed by drm-next and ibcore: - bitmap_find_next_zero_area_off() - bitmap_find_next_zero_area() - bitmap_or() - bitmap_and() - bitmap_xor() - Add missing include directives to the qlnxe driver (davidcs@ has been notified) Sponsored by: Mellanox Technologies MFC r316606: The __stringify() macro in the LinuxKPI should expand any macros before stringifying. Sponsored by: Mellanox Technologies MFC r316609: Create the LinuxKPI current task structure on the fly if it doesn't exist when the current macro is used. Sponsored by: Mellanox Technologies MFC r316656: Fix compilation of LinuxKPI for PowerPC. Found by: emaste @ Sponsored by: Mellanox Technologies MFC r317135: Zero number of CPUs should be translated into the default number of CPUs when allocating a LinuxKPI workqueue. This also ensures that the created taskqueue always have a non-zero number of worker threads. Sponsored by: Mellanox Technologies MFC r317137: Fix problem regarding priority inversion when using the concurrency kit, CK, in the LinuxKPI. When threads are pinned to a CPU core or when there is only one CPU, it can happen that a higher priority thread can call the CK synchronize function while a lower priority thread holds the read lock. Because the CK's synchronize is a simple wait loop this can lead to a deadlock situation. To solve this problem use the recently introduced CK's wait callback function. When detecting a CK blocking condition figure out the lowest priority among the blockers and update the calling thread's priority and yield. If another CPU core is holding the read lock, pin the thread to the blocked CPU core and update the priority. The calling threads priority and CPU bindings are restored before return. If a thread holding a CK read lock is detected to be sleeping, pause() will be used instead of yield(). Sponsored by: Mellanox Technologies MFC r317138: Use __typeof() instead of typeof() in some RCU related macros in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r317504: Prefer to use real virtual address over direct map address in the linux_page_address() function in the LinuxKPI. This solves an issue where the return value from linux_page_address() is passed to kmem_free(). Sponsored by: Mellanox Technologies MFC r317651: Add on_each_cpu() and wbinvd_on_all_cpus(). Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D10550 MFC r317828: Fix for use after free in the LinuxKPI. Background: The same VM object might be shared by multiple processes and the mm_struct is usually freed when a process exits. Grab a reference on the mm_struct while the vmap is in the linux_vma_head list in case the first process which inserted a VM object has exited. Tested by: kwm @ Sponsored by: Mellanox Technologies MFC r317839: Use pmap_invalidate_cache() to implement wbinvd_on_all_cpus(). Suggested by: jhb X-MFC with: r317651 MFC r318026: Fix init order in the LinuxKPI for RCU support. CPU_FOREACH() is not available until SI_SUB_CPU at SI_ORDER_ANY when the LinuxKPI is loaded as part of the kernel. Sponsored by: Mellanox Technologies MFC r318590: Add get_cpu() and put_cpu(). MFC r319229: Add some miscellaneous definitions to support DRM drivers. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D10985 MFC r319312: Make sure the thread's priority is restored for all three cases inside linux_synchronize_rcu_cb() in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r319316: Fixes for refcounting "struct linux_file" in the LinuxKPI. - Allow "struct linux_file" to be refcounted when its "_file" member is NULL by using its "f_count" field. The reference counts are transferred to the file structure when the file descriptor is installed. - Add missing vdrop() calls for error cases during open(). - Set the "_file" member of "struct linux_file" during open. This allows use of refcounting through get_file() and fput() with LinuxKPI character devices. Sponsored by: Mellanox Technologies MFC r319317: Fix a reference count leak in the LinuxKPI due to calling VM open when it shouldn't be called. Background: The Linux VM open operation is called when a new VMA is created on top of the current VMA. This is done through either mremap flow or split_vma, usually due to mlock, madvise, munmap and so on. This is currently not supported by the LinuxKPI. Sponsored by: Mellanox Technologies MFC r319318: Don't acquire a reference on the VM-space when allocating the LinuxKPI task structure to avoid deadlock when tearing down the VM object during a process exit. Found by: markj @ Sponsored by: Mellanox Technologies MFC r319319: Remove the VMA handle from its list before calling the LinuxKPI VMA close operation to prevent other threads from reusing the VM object handle pointer. Sponsored by: Mellanox Technologies MFC r319320: Make sure the VMAP's "vm_file" field is referenced in a Linux compatible way by the linux_dev_mmap_single() function in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r319321: Properly set the .d_name field in the cdevsw structure for the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r319338: Implement in_atomic() function in the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r319340: Properly implement idr_preload() and idr_preload_end() in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r319341: Implement print_hex_dump(), print_hex_dump_bytes() and printk_ratelimited() in the LinuxKPI. While at it fix the inclusion guard of printk.h to be similar to the rest of the LinuxKPI header files. Sponsored by: Mellanox Technologies MFC r319409: Add generic kqueue() and kevent() support to the LinuxKPI character devices. The implementation allows read and write filters to be created and piggybacks on the poll() file operation to determine when a filter should trigger. The piggyback mechanism is simply to check for the EWOULDBLOCK or EAGAIN return code from read(), write() or ioctl() system calls and then update the kqueue() polling state bits. The implementation is similar to the one found in the cuse(3) module. Refer to sys/fs/cuse/*.[ch] for more details. Sponsored by: Mellanox Technologies MFC r319410: Translate the ERESTARTSYS error code into ERESTART in the LinuxKPI ioctl(), read() and write() system call handlers. This error code is internal to the kernel and should not be seen by user-space programs according to Linux. Submitted by: Yanko Yankulov Sponsored by: Mellanox Technologies MFC r319444: Make sure the selrecord() function is only called from within system polling contexts in the LinuxKPI. After the kqueue() support was added to the LinuxKPI in r319409 the Linux poll file operation will be used outside the system file polling callback function, which can cause a NULL-pointer panic inside selrecord() because curthread->td_sel is set to NULL. This patch moves the selrecord() call away from poll_wait() and to the system file poll callback function in the LinuxKPI, which essentially wraps the Linux one. This is similar to what the cuse(3) module is currently doing. Refer to sys/fs/cuse/*.[ch] for more details. Sponsored by: Mellanox Technologies MFC r319500: Add support for setting the non-blocking I/O flag for LinuxKPI character devices. In Linux the FIONBIO IOCTL is handled by the kernel and not the drivers. Also need return success for the FIOASYNC ioctl due to existing logic in kern_fcntl() even though it is not supported currently. Sponsored by: Mellanox Technologies MFC r319501: Improve kqueue() support in the LinuxKPI. Some applications using the kqueue() does not set non-blocking I/O mode for event driven read of file descriptors. This means the LinuxKPI internal kqueue read and write event flags must be updated before the next read and/or write system call. Else the read and/or write system call may block. This can happen when there is no more data to read following a previous read event. Then the application also gets blocked from processing other events. This situation can also be solved by the applications setting and using non-blocking I/O mode. Sponsored by: Mellanox Technologies MFC r319620: Fix init order in the LinuxKPI for IDR support after recent changes. CPU_FOREACH() is not available until SI_SUB_CPU at SI_ORDER_ANY when the LinuxKPI is loaded as part of the kernel. Sponsored by: Mellanox Technologies MFC r319656: Add more #ifdef arch checks to the linuxkpi arm, mips, and powerpc all implement pmap_mapdev_attr() and pmap_unmapdev(), so add those archs to the checks. powerpc also includes the atomic_swap_*() functions, so add that to the supported list as well. Not tested except by compiling powerpc. Reviewed by: markj MFC r319675: Remove ARM and MIPS from linuxkpi ioremap_attr definition ARM and MIPS fail universe builds. ARM and MIPS are missing the following: * VM_MEMATTR_WRITE_THROUGH * VM_MEMATTR_WRITE_COMBINING Pointy-hat to: jhibbits MFC r319757: Augment wait queue support in the LinuxKPI. In particular: - Don't evaluate event conditions with a sleepqueue lock held, since such code may attempt to acquire arbitrary locks. - Fix the return value for wait_event_interruptible() in the case that the wait is interrupted by a signal. - Implement wait_on_bit_timeout() and wait_on_atomic_t(). - Implement some functions used to test for pending signals. - Implement a number of wait_event_*() variants and unify the existing implementations. - Unify the mechanism used by wait_event_*() and schedule() to put the calling thread to sleep. This is required to support updated DRM drivers. Thanks to hselasky for finding and fixing a number of bugs in the original revision. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D10986 MFC r319758: Implement pci_disable_device() in the LinuxKPI. Submitted by: kmacy MFC r320063: Remove prototypes for unimplemented LinuxKPI functions. MFC r320072: Avoid including list.h in LinuxKPI headers. list.h includes a number of FreeBSD headers as a workaround for the LIST_HEAD name collision. To reduce pollution, avoid including list.h in commonly used headers when it is not explicitly needed. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11249 MFC r320078: Add kthread parking support to the LinuxKPI. Submitted by: kmacy (original version) Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11264 MFC r320189: Allow the VM fault handler to be NULL in the LinuxKPI when handling a memory map request. When the VM fault handler is NULL a return code of VM_PAGER_BAD is returned from the character device's pager populate handler. This fixes compatibility with Linux. Sponsored by: Mellanox Technologies MFC r320192: Add a lockdep macro to the LinuxKPI. Also fix some nearby style issues. MFC r320193: Include kmod.h from the LinuxKPI's module.h. MFC r320194: Add missing lock destructor invocations to the LinuxKPI unload handler. MFC r320196: Update io-mapping.h in the LinuxKPI. Add io_mapping_init_wc() and add a third (unused) parameter to io_mapping_map_wc(). Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11286 MFC r320333: Add noop_lseek() to the LinuxKPI. MFC r320334: Add the thaw_early method to struct dev_pm_ops in the LinuxKPI. MFC r320335: Add a couple of macros to lockdep.h in the LinuxKPI. MFC r320336: Add ns_to_ktime() to the LinuxKPI. MFC r320337: Add u64_to_user_ptr() to the LinuxKPI. MFC r320364: Implement parts of the hrtimer API in the LinuxKPI. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11359 MFC r320580: Let io_mapping_init_wc() fall back to an uncacheable mapping. This allows usage of the function on architectures that don't support write-combining. Reported by: bz, emaste X-MFC With: r320196 MFC r320627: Hold the PCI device list lock when removing an element. MFC r320633: Rename the "driver" field to "bsddriver" to avoid a name collision. MFC r320634: Add some PCI class definitions. MFC r320635: Add a field for the class code to struct pci_driver. Fill out some previously uninitialized fields as well. MFC r320636: Add some auxiliary types for device driver support. MFC r320656: Invoke suspend/resume methods from the driver pmops if available. Obtained from: kmacy (original version) MFC r320774: Fix a bug in synchronize RCU when the calling thread is bound to a CPU. Set "td_pinned" to zero after "sched_unbind()" to prevent "td_pinned" from temporarily becoming negative during "sched_bind()". This can happen if "sched_bind()" uses "sched_pin()" and "sched_unpin()". Sponsored by: Mellanox Technologies MFC r320775: Complete r320189 which allows a NULL VM fault handler in the LinuxKPI. Instead of mapping a dummy page upon a page fault, map the page pointed to by the physical address given by IDX_TO_OFF(vmap->vm_pfn). To simplify the implementation use OBJT_DEVICE to implement our own linux_cdev_pager_fault() instead of using the existing linux_cdev_pager_populate(). Some minor code factoring while at it. Reviewed by: markj @ Sponsored by: Mellanox Technologies MFC r320810: Add TASK_COMM_LEN to the LinuxKPI. MFC r320811: Add device_is_registered() to the LinuxKPI. MFC r320812: Fix the definitions of pgprot_{noncached,writecombine} after r316562. MFC r320813: Add some helper definitions to fs.h in the LinuxKPI. Add a field to struct linux_file to allow the creation of anonymous shmem objects. MFC r320852: Free existing per-thread task structs when unloading linuxkpi.ko. They are otherwise leaked. Reported and tested by: ae MFC r320853: Add a few functions to ktime.h in the LinuxKPI, and fix nearby style. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11534 MFC r320854: Add some functions to math64.h in the LinuxKPI, and fix nearby style. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11535 MFC r320956: Add some functions to jiffies.h. Also add some checks for overflow to existing functions. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11533 MFC r321773: Remove cycle_t type from the LinuxKPI similar to Linux upstream. Sponsored by: Mellanox Technologies MFC r321926: Fix LinuxKPI regression after r321920. The mda_unit and si_drv0 fields are not wide enough to hold the full 64-bit dev_t. Instead use the "dev" field in the "linux_cdev" structure to store and lookup this value. While at it remove superfluous use of parenthesis inside the MAJOR(), MINOR() and MKDEV() macros in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r322028: Add subsystem vendor and device ID fields to struct pci_dev. MFC r322169: Fix hrtimer_active() in case of cancellation. While there, switch to FreeBSD internal callout active status. Reviewed by: markj, hselasky Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D11900 MFC r322212: Add macros for defining attribute groups and for WO and RW attributes. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11872 MFC r322213: Add round_jiffies_up(), local_clock() and __setup_timer() to the LinuxKPI. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11871 MFC r322272: Fix few issues of LinuxKPI workqueue. LinuxKPI workqueue wrappers reported "successful" cancellation for works already completed in normal way. This change brings reported status and real cancellation fact into sync. This required for drm-next operation. Reviewed by: hselasky (earlier version) Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D11904 MFC r322354: Make sure the linux_wait_event_common() function in the LinuxKPI properly handles a timeout value of MAX_SCHEDULE_TIMEOUT which basically means there is no timeout. This is a regression issue after r319757. While at it change the type of returned variable from "long" to "int" to match the actual return type. Sponsored by: Mellanox Technologies MFC r322355: Fixes for wait event in the LinuxKPI. These are regression issues after r319757. 1) Correct the return value from __wait_event_common() from 1 to 0 in case the timeout is specified as MAX_SCHEDULE_TIMEOUT. In the other case __ret is zero and will be substituted in the last part of the macro with the appropriate value before return. 2) Make sure the "timeout" argument is casted to "int" before evaluating negativity. Else the signedness of a "long" might be checked instead of the signedness of an integer. 3) The wait_event() function should not have a return value. Found by: KrishnamRaju ErapaRaju Sponsored by: Mellanox Technologies MFC r322357: Use integer type to pass around jiffies and/or ticks values in the LinuxKPI because in FreeBSD ticks are 32-bit. Sponsored by: Mellanox Technologies MFC r322392: Add a specialized function for DRM drivers to register themselves. Such drivers attach to a vgapci bus rather than directly to a pci bus. For the rest of the LinuxKPI to work correctly in this case, we override the vgapci bus' ivars with those of the grandparent. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11932 MFC r322397: Make sure the "vm_flags" and "vm_page_prot" fields get set correctly in the VM area structure in the LinuxKPI when doing mmap() and that unsupported bits are masked away. While at it fix some redundant use of parenthesing inside some related macros. Found by: KrishnamRaju ErapaRaju Sponsored by: Mellanox Technologies MFC r322567: Add device resource management fields to struct device. MFC r322713: Add a couple of trivial headers to the LinuxKPI. MFC r322714: Define prefetch() only if it hasn't already been defined. MFC r322746: Fix for deadlock situation in the LinuxKPI's RCU synchronize API. Deadlock condition: The return value of TDQ_LOCKPTR(td) is the same for two threads. 1) The first thread signals a wakeup while keeping the rcu_read_lock(). This invokes sched_add() which in turn will try to lock TDQ_LOCK(). 2) The second thread is calling synchronize_rcu() calling mi_switch() over and over again trying to yield(). This prevents the first thread from running and releasing the RCU reader lock. Solution: Release the thread lock while yielding to allow other threads to acquire the lock pointed to by TDQ_LOCKPTR(td). Found by: KrishnamRaju ErapaRaju Sponsored by: Mellanox Technologies MFC r322795: Add some miscellaneous definitions to support the DRM drivers. MFC r322816: Set the bus number field when attaching a PCI device. MFC r323347: Add more sanity checks to linux_fget() in the LinuxKPI. This prevents returning pointers to file descriptors which were not created by the LinuxKPI. Sponsored by: Mellanox Technologies MFC r323349: Properly implement poll_wait() in the LinuxKPI. This prevents direct use of the linux_poll_wakeup() function from unsafe contexts, which can lead to use-after-free issues. Instead of calling linux_poll_wakeup() directly use the wake_up() family of functions in the LinuxKPI to do this. Bump the FreeBSD version to force recompilation of external kernel modules. Sponsored by: Mellanox Technologies MFC r323703: Add support for shared memory functions to the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies MFC r323704: Only wire pages in the LinuxKPI instead of holding and wiring them. This prevents the page daemon from regularly scanning the held pages. Suggested by: kib @ Sponsored by: Mellanox Technologies MFC r323705: The LinuxKPI atomics do not have acquire nor release semantics unless specified. Fix code to use READ_ONCE() and WRITE_ONCE() where appropriate. Suggested by: kib @ Sponsored by: Mellanox Technologies MFC r323910: Add support for 32-bit compatibility IOCTLs in the LinuxKPI. Bump the FreeBSD version to force recompilation of external kernel modules due to structure change. PR: 222504 Submitted by: Greg V Sponsored by: Mellanox Technologies MFC r324278: Make sure the timer belonging to the delayed work in the LinuxKPI gets drained before invoking the work function. Else the timer mutex may still be in use which can lead to use-after-free situations, because the work function might free the work structure before returning. Sponsored by: Mellanox Technologies MFC r324285: Add get_random_{int,long} to the LinuxKPI. Fix some whitespace bugs while here. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D12588 MFC r324597: Don't call selrecord() outside the select system call in the LinuxKPI, because then td->td_sel is NULL and this will result in a segfault inside selrecord(). This happens when only using kqueue() to poll for read and write events. If select() and kqueue() is mixed there won't be a segfault. Reported by: Johannes Lundberg Sponsored by: Mellanox Technologies MFC r324606: Make the PHOLD in linux_wait_event_common() unconditional. After some in-progress work is committed, this would otherwise be the only instance of #if(n)def NO_SWAPPING in the tree. Moreover, the requisite opt_vm.h include was missing, so the PHOLD/PRELE calls were always being compiled in anyway. MFC r325279: Implement ioread16be() in the LinuxKPI. Sponsored by: Mellanox Technologies MFC r325360: Remove redundant dev->si_drv1 NULL checks in the LinuxKPI. This pointer is checked during the linux_dev_open() callback and does not need to be NULL checked again. It should always be set for character devices belonging to the "linuxcdevsw" and technically there is no need to NULL check this pointer at all. Suggested by: kib @ Sponsored by: Mellanox Technologies MFC r325635: Remove some not needed comments in the LinuxKPI. Use the Linux source tree to lookup documentation for the functions implemented in the LinuxKPI instead. Sponsored by: Mellanox Technologies MFC r325707: Mask away return codes from del_timer() and del_timer_sync() because they are not the same like in Linux. Sponsored by: Mellanox Technologies MFC r325708: Remove release and acquire semantics when accessing the "state" field of the LinuxKPI task struct. Change type of "state" variable from "int" to "atomic_t" to simplify code and avoid unneccessary casting. Sponsored by: Mellanox Technologies MFC r325767: Properly handle the case where the linux_cdev_handle_insert() function in the LinuxKPI returns NULL. This happens when the VM area's private data handle already exists and could cause a so-called NULL pointer dereferencing issue prior to this fix. Found by: greg@unrelenting.technology Sponsored by: Mellanox Technologies MFC r327676: linuxkpi: Implement kcalloc() based on mallocarray() This means we now get integer overflow protection, which Linux code might expect as it is also provided by kcalloc() in Linux. MFC r327788: linuxkpi: Simplify kmalloc_array. kmalloc_array seems what we call mallocarray(9). MFC r312926: (partial, no mergeinfo) Revert r312923 a better approach will be taken later MFC r312927: (partial, no mergeinfo) Revert crap accidentally committed MFC r316665: (partial, no mergeinfo) Import CK as of commit 6b141c0bdd21ce8b3e14147af8f87f22b20ecf32 This brings us changes we needed in ck_epoch. MFC r317053: (partial, no mergeinfo) Remove unneeded include of vm_phys.h. MFC r317055: (partial, no mergeinfo) All these files need sys/vmmeter.h, but now they got it implicitly included via sys/pcpu.h. MFC r322168: (partial, no mergeinfo) o Replace __riscv__ with __riscv o Replace __riscv64 with (__riscv && __riscv_xlen == 64) This is required to support new GCC 7.1 compiler. This is compatible with current GCC 6.1 compiler. RISC-V is extensible ISA and the idea here is to have built-in define per each extension, so together with __riscv we will have some subset of these as well (depending on -march string passed to compiler): __riscv_compressed __riscv_atomic __riscv_mul __riscv_div __riscv_muldiv __riscv_fdiv __riscv_fsqrt __riscv_float_abi_soft __riscv_float_abi_single __riscv_float_abi_double __riscv_cmodel_medlow __riscv_cmodel_medany __riscv_cmodel_pic __riscv_xlen Reviewed by: ngie Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11901 MFC r322672: (partial, no mergeinfo) Move some other SI_SUB_INIT_IF initializations to SI_SUB_TASKQ Drop the EARLY_AP_STARTUP gtaskqueue code, as gtaskqueues are now initialized before APs are started. Reviewed by: hselasky@, jhb@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12054 MFC r326984: (partial, no mergeinfo) Update Matthew Macy contact info Email address has changed, uses consistent name (Matthew, not Matt) Reported by: Matthew Macy Differential Revision: https://reviews.freebsd.org/D13537 Added: stable/11/sys/compat/linuxkpi/common/include/asm/msr.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/asm/smp.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/atomic.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/bitmap.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/bottom_half.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/hrtimer.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/mm_types.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/pfn.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/pfn_t.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/pid.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/preempt.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/rculist.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/smp.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/include/linux/ww_mutex.h (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_current.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_hrtimer.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_kthread.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_lock.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_page.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_slab.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_tasklet.c (contents, props changed) stable/11/sys/compat/linuxkpi/common/src/linux_work.c (contents, props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/asm/atomic-long.h stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h stable/11/sys/compat/linuxkpi/common/include/asm/atomic64.h stable/11/sys/compat/linuxkpi/common/include/asm/pgtable.h stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h stable/11/sys/compat/linuxkpi/common/include/linux/cdev.h stable/11/sys/compat/linuxkpi/common/include/linux/clocksource.h stable/11/sys/compat/linuxkpi/common/include/linux/compat.h stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h stable/11/sys/compat/linuxkpi/common/include/linux/completion.h stable/11/sys/compat/linuxkpi/common/include/linux/device.h stable/11/sys/compat/linuxkpi/common/include/linux/dma-mapping.h stable/11/sys/compat/linuxkpi/common/include/linux/etherdevice.h stable/11/sys/compat/linuxkpi/common/include/linux/file.h stable/11/sys/compat/linuxkpi/common/include/linux/fs.h stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h stable/11/sys/compat/linuxkpi/common/include/linux/idr.h stable/11/sys/compat/linuxkpi/common/include/linux/in.h stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h stable/11/sys/compat/linuxkpi/common/include/linux/io-mapping.h stable/11/sys/compat/linuxkpi/common/include/linux/io.h stable/11/sys/compat/linuxkpi/common/include/linux/jiffies.h stable/11/sys/compat/linuxkpi/common/include/linux/kdev_t.h stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h stable/11/sys/compat/linuxkpi/common/include/linux/kobject.h stable/11/sys/compat/linuxkpi/common/include/linux/kthread.h stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h stable/11/sys/compat/linuxkpi/common/include/linux/list.h stable/11/sys/compat/linuxkpi/common/include/linux/lockdep.h stable/11/sys/compat/linuxkpi/common/include/linux/math64.h stable/11/sys/compat/linuxkpi/common/include/linux/mm.h stable/11/sys/compat/linuxkpi/common/include/linux/module.h stable/11/sys/compat/linuxkpi/common/include/linux/mutex.h stable/11/sys/compat/linuxkpi/common/include/linux/page.h stable/11/sys/compat/linuxkpi/common/include/linux/pci.h stable/11/sys/compat/linuxkpi/common/include/linux/poll.h stable/11/sys/compat/linuxkpi/common/include/linux/printk.h stable/11/sys/compat/linuxkpi/common/include/linux/random.h stable/11/sys/compat/linuxkpi/common/include/linux/rcupdate.h stable/11/sys/compat/linuxkpi/common/include/linux/rwlock.h stable/11/sys/compat/linuxkpi/common/include/linux/rwsem.h stable/11/sys/compat/linuxkpi/common/include/linux/scatterlist.h stable/11/sys/compat/linuxkpi/common/include/linux/sched.h stable/11/sys/compat/linuxkpi/common/include/linux/semaphore.h stable/11/sys/compat/linuxkpi/common/include/linux/slab.h stable/11/sys/compat/linuxkpi/common/include/linux/spinlock.h stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h stable/11/sys/compat/linuxkpi/common/include/linux/string.h stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h stable/11/sys/compat/linuxkpi/common/include/linux/timer.h stable/11/sys/compat/linuxkpi/common/include/linux/types.h stable/11/sys/compat/linuxkpi/common/include/linux/uaccess.h stable/11/sys/compat/linuxkpi/common/include/linux/wait.h stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h stable/11/sys/compat/linuxkpi/common/include/net/ip.h stable/11/sys/compat/linuxkpi/common/include/net/ipv6.h stable/11/sys/compat/linuxkpi/common/src/linux_compat.c stable/11/sys/compat/linuxkpi/common/src/linux_idr.c stable/11/sys/compat/linuxkpi/common/src/linux_pci.c stable/11/sys/conf/files stable/11/sys/conf/files.amd64 stable/11/sys/contrib/rdma/krping/krping.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_uar.c stable/11/sys/dev/qlnx/qlnxe/bcm_osal.h stable/11/sys/modules/linuxkpi/Makefile stable/11/sys/modules/qlnx/qlnxe/Makefile stable/11/sys/ofed/drivers/infiniband/core/cma.c stable/11/sys/ofed/drivers/infiniband/core/fmr_pool.c stable/11/sys/ofed/drivers/infiniband/core/iwcm.c stable/11/sys/ofed/drivers/infiniband/core/umem.c stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_dev.h stable/11/sys/ofed/drivers/net/mlx4/pd.c stable/11/sys/sys/param.h stable/11/sys/sys/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/asm/atomic-long.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/asm/atomic-long.h Thu Feb 1 07:52:06 2018 (r328652) +++ stable/11/sys/compat/linuxkpi/common/include/asm/atomic-long.h Thu Feb 1 13:01:44 2018 (r328653) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,7 +31,7 @@ #ifndef _ATOMIC_LONG_H_ #define _ATOMIC_LONG_H_ -#include +#include #include #include @@ -54,13 +54,13 @@ atomic_long_add_return(long i, atomic_long_t *v) static inline void atomic_long_set(atomic_long_t *v, long i) { - atomic_store_rel_long(&v->counter, i); + WRITE_ONCE(v->counter, i); } static inline long atomic_long_read(atomic_long_t *v) { - return atomic_load_acq_long(&v->counter); + return READ_ONCE(v->counter); } static inline long @@ -73,6 +73,12 @@ static inline long atomic_long_dec(atomic_long_t *v) { return atomic_fetchadd_long(&v->counter, -1) - 1; +} + +static inline long +atomic_long_xchg(atomic_long_t *v, long val) +{ + return atomic_swap_long(&v->counter, val); } static inline int Modified: stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h Thu Feb 1 07:52:06 2018 (r328652) +++ stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h Thu Feb 1 13:01:44 2018 (r328653) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,10 +28,11 @@ * * $FreeBSD$ */ -#ifndef _ASM_ATOMIC_H_ + +#ifndef _ASM_ATOMIC_H_ #define _ASM_ATOMIC_H_ -#include +#include #include #include @@ -71,6 +72,12 @@ atomic_sub_return(int i, atomic_t *v) static inline void atomic_set(atomic_t *v, int i) { + WRITE_ONCE(v->counter, i); +} + +static inline void +atomic_set_release(atomic_t *v, int i) +{ atomic_store_rel_int(&v->counter, i); } @@ -81,9 +88,9 @@ atomic_set_mask(unsigned int mask, atomic_t *v) } static inline int -atomic_read(atomic_t *v) +atomic_read(const atomic_t *v) { - return atomic_load_acq_int(&v->counter); + return READ_ONCE(v->counter); } static inline int @@ -123,12 +130,13 @@ static inline int atomic_xchg(atomic_t *v, int i) { #if defined(__i386__) || defined(__amd64__) || \ - defined(__arm__) || defined(__aarch64__) + defined(__arm__) || defined(__aarch64__) || \ + defined(__powerpc__) return (atomic_swap_int(&v->counter, i)); #else int ret; for (;;) { - ret = atomic_load_acq_int(&v->counter); + ret = READ_ONCE(v->counter); if (atomic_cmpset_int(&v->counter, ret, i)) break; } @@ -144,7 +152,7 @@ atomic_cmpxchg(atomic_t *v, int old, int new) for (;;) { if (atomic_cmpset_int(&v->counter, old, new)) break; - ret = atomic_load_acq_int(&v->counter); + ret = READ_ONCE(v->counter); if (ret != old) break; } @@ -152,31 +160,47 @@ atomic_cmpxchg(atomic_t *v, int old, int new) } #define cmpxchg(ptr, old, new) ({ \ - __typeof(*(ptr)) __ret = (old); \ - CTASSERT(sizeof(__ret) == 4 || sizeof(__ret) == 8); \ - for (;;) { \ - if (sizeof(__ret) == 4) { \ - if (atomic_cmpset_int((volatile int *) \ - (ptr), (old), (new))) \ - break; \ - __ret = atomic_load_acq_int( \ - (volatile int *)(ptr)); \ - if (__ret != (old)) \ - break; \ - } else { \ - if (atomic_cmpset_64( \ - (volatile int64_t *)(ptr), \ - (old), (new))) \ - break; \ - __ret = atomic_load_acq_64( \ - (volatile int64_t *)(ptr)); \ - if (__ret != (old)) \ - break; \ - } \ + __typeof(*(ptr)) __ret; \ + \ + CTASSERT(sizeof(__ret) == 1 || sizeof(__ret) == 2 || \ + sizeof(__ret) == 4 || sizeof(__ret) == 8); \ + \ + __ret = (old); \ + switch (sizeof(__ret)) { \ + case 1: \ + while (!atomic_fcmpset_8((volatile int8_t *)(ptr), \ + (int8_t *)&__ret, (new)) && __ret == (old)) \ + ; \ + break; \ + case 2: \ + while (!atomic_fcmpset_16((volatile int16_t *)(ptr), \ + (int16_t *)&__ret, (new)) && __ret == (old)) \ + ; \ + break; \ + case 4: \ + while (!atomic_fcmpset_32((volatile int32_t *)(ptr), \ + (int32_t *)&__ret, (new)) && __ret == (old)) \ + ; \ + break; \ + case 8: \ + while (!atomic_fcmpset_64((volatile int64_t *)(ptr), \ + (int64_t *)&__ret, (new)) && __ret == (old)) \ + ; \ + break; \ } \ __ret; \ }) +#define cmpxchg_relaxed(...) cmpxchg(__VA_ARGS__) + +#define xchg(ptr, v) ({ \ + __typeof(*(ptr)) __ret; \ + \ + __ret = *(ptr); \ + *(ptr) = v; \ + __ret; \ +}) + #define LINUX_ATOMIC_OP(op, c_op) \ static inline void atomic_##op(int i, atomic_t *v) \ { \ @@ -187,8 +211,26 @@ static inline void atomic_##op(int i, atomic_t *v) \ c = old; \ } +#define LINUX_ATOMIC_FETCH_OP(op, c_op) \ +static inline int atomic_fetch_##op(int i, atomic_t *v) \ +{ \ + int c, old; \ + \ + c = v->counter; \ + while ((old = atomic_cmpxchg(v, c, c c_op i)) != c) \ + c = old; \ + \ + return (c); \ +} + LINUX_ATOMIC_OP(or, |) LINUX_ATOMIC_OP(and, &) +LINUX_ATOMIC_OP(andnot, &~) LINUX_ATOMIC_OP(xor, ^) + +LINUX_ATOMIC_FETCH_OP(or, |) +LINUX_ATOMIC_FETCH_OP(and, &) +LINUX_ATOMIC_FETCH_OP(andnot, &~) +LINUX_ATOMIC_FETCH_OP(xor, ^) #endif /* _ASM_ATOMIC_H_ */ Modified: stable/11/sys/compat/linuxkpi/common/include/asm/atomic64.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/asm/atomic64.h Thu Feb 1 07:52:06 2018 (r328652) +++ stable/11/sys/compat/linuxkpi/common/include/asm/atomic64.h Thu Feb 1 13:01:44 2018 (r328653) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Mellanox Technologies, Ltd. + * Copyright (c) 2016-2017 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ #ifndef _ASM_ATOMIC64_H_ #define _ASM_ATOMIC64_H_ -#include +#include #include #include @@ -36,6 +36,8 @@ typedef struct { volatile int64_t counter; } atomic64_t; +#define ATOMIC64_INIT(x) { .counter = (x) } + /*------------------------------------------------------------------------* * 64-bit atomic operations *------------------------------------------------------------------------*/ @@ -72,7 +74,7 @@ atomic64_set(atomic64_t *v, int64_t i) static inline int64_t atomic64_read(atomic64_t *v) { - return atomic_load_acq_64(&v->counter); + return READ_ONCE(v->counter); } static inline int64_t @@ -106,12 +108,13 @@ static inline int64_t atomic64_xchg(atomic64_t *v, int64_t i) { #if defined(__i386__) || defined(__amd64__) || \ - defined(__arm__) || defined(__aarch64__) + defined(__arm__) || defined(__aarch64__) || \ + defined(__powerpc64__) return (atomic_swap_64(&v->counter, i)); #else int64_t ret; for (;;) { - ret = atomic_load_acq_64(&v->counter); + ret = READ_ONCE(v->counter); if (atomic_cmpset_64(&v->counter, ret, i)) break; } @@ -127,7 +130,7 @@ atomic64_cmpxchg(atomic64_t *v, int64_t old, int64_t n for (;;) { if (atomic_cmpset_64(&v->counter, old, new)) break; - ret = atomic_load_acq_64(&v->counter); + ret = READ_ONCE(v->counter); if (ret != old) break; } Added: stable/11/sys/compat/linuxkpi/common/include/asm/msr.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/linuxkpi/common/include/asm/msr.h Thu Feb 1 13:01:44 2018 (r328653) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2017 Mark Johnston + * + * 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 _ASM_MSR_H_ +#define _ASM_MSR_H_ + +#include + +#define rdmsrl(msr, val) ((val) = rdmsr(msr)) + +#endif /* _ASM_MSR_H_ */ Modified: stable/11/sys/compat/linuxkpi/common/include/asm/pgtable.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/asm/pgtable.h Thu Feb 1 07:52:06 2018 (r328652) +++ stable/11/sys/compat/linuxkpi/common/include/asm/pgtable.h Thu Feb 1 13:01:44 2018 (r328653) @@ -33,4 +33,11 @@ #include +typedef unsigned long pteval_t; +typedef unsigned long pmdval_t; +typedef unsigned long pudval_t; +typedef unsigned long pgdval_t; +typedef unsigned long pgprotval_t; +typedef struct page *pgtable_t; + #endif /* _ASM_PGTABLE_H_ */ Added: stable/11/sys/compat/linuxkpi/common/include/asm/smp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/linuxkpi/common/include/asm/smp.h Thu Feb 1 13:01:44 2018 (r328653) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2017 Mark Johnston + * + * 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 _ASM_SMP_H_ +#define _ASM_SMP_H_ + +#if defined(__i386__) || defined(__amd64__) + +#define wbinvd_on_all_cpus() linux_wbinvd_on_all_cpus() + +int linux_wbinvd_on_all_cpus(void); + +#endif + +#define get_cpu() ({ \ + sched_pin(); \ + PCPU_GET(cpuid); \ +}) + +#define put_cpu() \ + sched_unpin() + +#endif /* _ASM_SMP_H_ */ Added: stable/11/sys/compat/linuxkpi/common/include/linux/atomic.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/linuxkpi/common/include/linux/atomic.h Thu Feb 1 13:01:44 2018 (r328653) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2017 Mark Johnston + * + * 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 _LINUX_ATOMIC_H_ +#define _LINUX_ATOMIC_H_ + +#include +#include + +#endif /* _LINUX_ATOMIC_H_ */ Added: stable/11/sys/compat/linuxkpi/common/include/linux/bitmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/linuxkpi/common/include/linux/bitmap.h Thu Feb 1 13:01:44 2018 (r328653) @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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$ + */ + +#ifndef _LINUX_BITMAP_H_ +#define _LINUX_BITMAP_H_ + +#include + +static inline void +bitmap_zero(unsigned long *addr, const unsigned int size) +{ + memset(addr, 0, BITS_TO_LONGS(size) * sizeof(long)); +} + +static inline void +bitmap_fill(unsigned long *addr, const unsigned int size) +{ + const unsigned int tail = size & (BITS_PER_LONG - 1); + + memset(addr, 0xff, BIT_WORD(size) * sizeof(long)); + + if (tail) + addr[BIT_WORD(size)] = BITMAP_LAST_WORD_MASK(tail); +} + +static inline int +bitmap_full(unsigned long *addr, const unsigned int size) +{ + const unsigned int end = BIT_WORD(size); + const unsigned int tail = size & (BITS_PER_LONG - 1); + unsigned int i; + + for (i = 0; i != end; i++) { + if (addr[i] != ~0UL) + return (0); + } + + if (tail) { + const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + + if ((addr[end] & mask) != mask) + return (0); + } + return (1); +} + +static inline int +bitmap_empty(unsigned long *addr, const unsigned int size) +{ + const unsigned int end = BIT_WORD(size); + const unsigned int tail = size & (BITS_PER_LONG - 1); + unsigned int i; + + for (i = 0; i != end; i++) { + if (addr[i] != 0) + return (0); + } + + if (tail) { + const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + + if ((addr[end] & mask) != 0) + return (0); + } + return (1); +} + +static inline void +bitmap_set(unsigned long *map, unsigned int start, int nr) +{ + const unsigned int size = start + nr; + int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG); + unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); + + map += BIT_WORD(start); + + while (nr - bits_to_set >= 0) { + *map |= mask_to_set; + nr -= bits_to_set; + bits_to_set = BITS_PER_LONG; + mask_to_set = ~0UL; + map++; + } + + if (nr) { + mask_to_set &= BITMAP_LAST_WORD_MASK(size); + *map |= mask_to_set; + } +} + +static inline void +bitmap_clear(unsigned long *map, unsigned int start, int nr) +{ + const unsigned int size = start + nr; + int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG); + unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); + + map += BIT_WORD(start); + + while (nr - bits_to_clear >= 0) { + *map &= ~mask_to_clear; + nr -= bits_to_clear; + bits_to_clear = BITS_PER_LONG; + mask_to_clear = ~0UL; + map++; + } + + if (nr) { + mask_to_clear &= BITMAP_LAST_WORD_MASK(size); + *map &= ~mask_to_clear; + } +} + +static inline unsigned int +bitmap_find_next_zero_area_off(const unsigned long *map, + const unsigned int size, unsigned int start, + unsigned int nr, unsigned int align_mask, + unsigned int align_offset) +{ + unsigned int index; + unsigned int end; + unsigned int i; + +retry: + index = find_next_zero_bit(map, size, start); + + index = (((index + align_offset) + align_mask) & ~align_mask) - align_offset; + + end = index + nr; + if (end > size) + return (end); + + i = find_next_bit(map, end, index); + if (i < end) { + start = i + 1; + goto retry; + } + return (index); +} + +static inline unsigned int +bitmap_find_next_zero_area(const unsigned long *map, + const unsigned int size, unsigned int start, + unsigned int nr, unsigned int align_mask) +{ + return (bitmap_find_next_zero_area_off(map, size, + start, nr, align_mask, 0)); +} + +static inline int +bitmap_find_free_region(unsigned long *bitmap, int bits, int order) +{ + int pos; + int end; + + for (pos = 0; (end = pos + (1 << order)) <= bits; pos = end) { + if (!linux_reg_op(bitmap, pos, order, REG_OP_ISFREE)) + continue; + linux_reg_op(bitmap, pos, order, REG_OP_ALLOC); + return (pos); + } + return (-ENOMEM); +} + +static inline int +bitmap_allocate_region(unsigned long *bitmap, int pos, int order) +{ + if (!linux_reg_op(bitmap, pos, order, REG_OP_ISFREE)) + return (-EBUSY); + linux_reg_op(bitmap, pos, order, REG_OP_ALLOC); + return (0); +} + +static inline void +bitmap_release_region(unsigned long *bitmap, int pos, int order) +{ + linux_reg_op(bitmap, pos, order, REG_OP_RELEASE); +} + +static inline unsigned int +bitmap_weight(unsigned long *addr, const unsigned int size) +{ + const unsigned int end = BIT_WORD(size); + const unsigned int tail = size & (BITS_PER_LONG - 1); + unsigned int retval = 0; + unsigned int i; + + for (i = 0; i != end; i++) + retval += hweight_long(addr[i]); + + if (tail) { + const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + + retval += hweight_long(addr[end] & mask); + } + return (retval); +} + +static inline int +bitmap_equal(const unsigned long *pa, + const unsigned long *pb, unsigned size) +{ + const unsigned int end = BIT_WORD(size); + const unsigned int tail = size & (BITS_PER_LONG - 1); + unsigned int i; + + for (i = 0; i != end; i++) { + if (pa[i] != pb[i]) + return (0); + } + + if (tail) { + const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + + if ((pa[end] ^ pb[end]) & mask) + return (0); + } + return (1); +} + +static inline void +bitmap_or(unsigned long *dst, const unsigned long *src1, + const unsigned long *src2, const unsigned int size) +{ + const unsigned int end = BITS_TO_LONGS(size); + unsigned int i; + + for (i = 0; i != end; i++) + dst[i] = src1[i] | src2[i]; +} + +static inline void +bitmap_and(unsigned long *dst, const unsigned long *src1, + const unsigned long *src2, const unsigned int size) +{ + const unsigned int end = BITS_TO_LONGS(size); + unsigned int i; + + for (i = 0; i != end; i++) + dst[i] = src1[i] & src2[i]; +} + +static inline void +bitmap_xor(unsigned long *dst, const unsigned long *src1, + const unsigned long *src2, const unsigned int size) +{ + const unsigned int end = BITS_TO_LONGS(size); + unsigned int i; + + for (i = 0; i != end; i++) + dst[i] = src1[i] ^ src2[i]; +} + +#endif /* _LINUX_BITMAP_H_ */ Modified: stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h Thu Feb 1 07:52:06 2018 (r328652) +++ stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h Thu Feb 1 13:01:44 2018 (r328653) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,16 +31,20 @@ #ifndef _LINUX_BITOPS_H_ #define _LINUX_BITOPS_H_ +#include #include #include #include +#include #define BIT(nr) (1UL << (nr)) +#define BIT_ULL(nr) (1ULL << (nr)) #ifdef __LP64__ #define BITS_PER_LONG 64 #else #define BITS_PER_LONG 32 #endif + #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) #define BITMAP_LAST_WORD_MASK(n) (~0UL >> (BITS_PER_LONG - (n))) #define BITS_TO_LONGS(n) howmany((n), BITS_PER_LONG) @@ -49,6 +53,12 @@ #define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l))) #define BITS_PER_BYTE 8 +#define hweight8(x) bitcount((uint8_t)(x)) +#define hweight16(x) bitcount16(x) +#define hweight32(x) bitcount32(x) +#define hweight64(x) bitcount64(x) +#define hweight_long(x) bitcountl(x) + static inline int __ffs(int mask) { @@ -73,10 +83,15 @@ __flsl(long mask) return (flsl(mask) - 1); } +static inline int +fls64(uint64_t mask) +{ + return (flsll(mask)); +} + static inline uint32_t ror32(uint32_t word, unsigned int shift) { - return ((word >> shift) | (word << (32 - shift))); } @@ -241,70 +256,6 @@ find_next_zero_bit(const unsigned long *addr, unsigned return (bit); } -static inline void -bitmap_zero(unsigned long *addr, int size) -{ - int len; - - len = BITS_TO_LONGS(size) * sizeof(long); - memset(addr, 0, len); -} - -static inline void -bitmap_fill(unsigned long *addr, int size) -{ - int tail; - int len; - - len = (size / BITS_PER_LONG) * sizeof(long); - memset(addr, 0xff, len); - tail = size & (BITS_PER_LONG - 1); - if (tail) - addr[size / BITS_PER_LONG] = BITMAP_LAST_WORD_MASK(tail); -} - -static inline int -bitmap_full(unsigned long *addr, int size) -{ - unsigned long mask; - int tail; - int len; - int i; - - len = size / BITS_PER_LONG; - for (i = 0; i < len; i++) - if (addr[i] != ~0UL) - return (0); - tail = size & (BITS_PER_LONG - 1); - if (tail) { - mask = BITMAP_LAST_WORD_MASK(tail); - if ((addr[i] & mask) != mask) - return (0); - } - return (1); -} - -static inline int -bitmap_empty(unsigned long *addr, int size) -{ - unsigned long mask; - int tail; - int len; - int i; - - len = size / BITS_PER_LONG; - for (i = 0; i < len; i++) - if (addr[i] != 0) - return (0); - tail = size & (BITS_PER_LONG - 1); - if (tail) { - mask = BITMAP_LAST_WORD_MASK(tail); - if ((addr[i] & mask) != 0) - return (0); - } - return (1); -} - #define __set_bit(i, a) \ atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) @@ -318,8 +269,7 @@ bitmap_empty(unsigned long *addr, int size) atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define test_bit(i, a) \ - !!(atomic_load_acq_long(&((volatile unsigned long *)(a))[BIT_WORD(i)]) & \ - BIT_MASK(i)) + !!(READ_ONCE(((volatile unsigned long *)(a))[BIT_WORD(i)]) & BIT_MASK(i)) static inline int test_and_clear_bit(long bit, volatile unsigned long *var) @@ -337,6 +287,21 @@ test_and_clear_bit(long bit, volatile unsigned long *v } static inline int +__test_and_clear_bit(long bit, volatile unsigned long *var) +{ + long val; + + var += BIT_WORD(bit); + bit %= BITS_PER_LONG; + bit = (1UL << bit); + + val = *var; + *var &= ~bit; + + return !!(val & bit); +} + +static inline int test_and_set_bit(long bit, volatile unsigned long *var) { long val; @@ -351,46 +316,19 @@ test_and_set_bit(long bit, volatile unsigned long *var return !!(val & bit); } -static inline void -bitmap_set(unsigned long *map, int start, int nr) +static inline int +__test_and_set_bit(long bit, volatile unsigned long *var) { - unsigned long *p = map + BIT_WORD(start); - const int size = start + nr; - int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG); - unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); + long val; - while (nr - bits_to_set >= 0) { - *p |= mask_to_set; - nr -= bits_to_set; - bits_to_set = BITS_PER_LONG; - mask_to_set = ~0UL; - p++; - } - if (nr) { - mask_to_set &= BITMAP_LAST_WORD_MASK(size); - *p |= mask_to_set; - } -} + var += BIT_WORD(bit); + bit %= BITS_PER_LONG; + bit = (1UL << bit); -static inline void -bitmap_clear(unsigned long *map, int start, int nr) -{ - unsigned long *p = map + BIT_WORD(start); - const int size = start + nr; - int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG); - unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); + val = *var; + *var |= bit; - while (nr - bits_to_clear >= 0) { - *p &= ~mask_to_clear; - nr -= bits_to_clear; - bits_to_clear = BITS_PER_LONG; - mask_to_clear = ~0UL; - p++; - } - if (nr) { - mask_to_clear &= BITMAP_LAST_WORD_MASK(size); - *p &= ~mask_to_clear; - } + return !!(val & bit); } enum { @@ -400,7 +338,7 @@ enum { }; static inline int -__reg_op(unsigned long *bitmap, int pos, int order, int reg_op) +linux_reg_op(unsigned long *bitmap, int pos, int order, int reg_op) { int nbits_reg; int index; @@ -444,70 +382,18 @@ done: return ret; } -static inline int -bitmap_find_free_region(unsigned long *bitmap, int bits, int order) -{ - int pos; - int end; - - for (pos = 0 ; (end = pos + (1 << order)) <= bits; pos = end) { - if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) - continue; - __reg_op(bitmap, pos, order, REG_OP_ALLOC); - return pos; - } - return -ENOMEM; -} - -static inline int -bitmap_allocate_region(unsigned long *bitmap, int pos, int order) -{ - if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) - return -EBUSY; - __reg_op(bitmap, pos, order, REG_OP_ALLOC); - return 0; -} - -static inline void -bitmap_release_region(unsigned long *bitmap, int pos, int order) -{ - __reg_op(bitmap, pos, order, REG_OP_RELEASE); -} - #define for_each_set_bit(bit, addr, size) \ for ((bit) = find_first_bit((addr), (size)); \ (bit) < (size); \ (bit) = find_next_bit((addr), (size), (bit) + 1)) -static inline unsigned -bitmap_weight(unsigned long *bitmap, unsigned nbits) -{ - unsigned bit; - unsigned retval = 0; - for_each_set_bit(bit, bitmap, nbits) - retval++; - return (retval); -} - -static inline int -bitmap_equal(const unsigned long *pa, - const unsigned long *pb, unsigned bits) +static inline uint64_t +sign_extend64(uint64_t value, int index) { - unsigned x; - unsigned y = bits / BITS_PER_LONG; - - for (x = 0; x != y; x++) { - if (pa[x] != pb[x]) - return (0); - } + uint8_t shift = 63 - index; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 1 13:17:43 2018 Return-Path: Delivered-To: svn-src-all@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 7CBE9ECA917; Thu, 1 Feb 2018 13:17:43 +0000 (UTC) (envelope-from hselasky@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 3257C69E05; Thu, 1 Feb 2018 13:17:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D46C56B2; Thu, 1 Feb 2018 13:17:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11DHh4N015499; Thu, 1 Feb 2018 13:17:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11DHh7R015498; Thu, 1 Feb 2018 13:17:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802011317.w11DHh7R015498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Feb 2018 13:17:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r328657 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/include/linux X-SVN-Commit-Revision: 328657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 13:17:43 -0000 Author: hselasky Date: Thu Feb 1 13:17:42 2018 New Revision: 328657 URL: https://svnweb.freebsd.org/changeset/base/328657 Log: MFC r328623: Properly implement the cond_resched() function macro in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/sched.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/sched.h ============================================================================== --- stable/9/sys/ofed/include/linux/sched.h Thu Feb 1 13:16:11 2018 (r328656) +++ stable/9/sys/ofed/include/linux/sched.h Thu Feb 1 13:17:42 2018 (r328657) @@ -103,7 +103,7 @@ do { \ kick_proc0(); \ } while (0) -#define cond_resched() if (!cold) sched_relinquish(curthread) +#define cond_resched() do { if (!cold) sched_relinquish(curthread); } while (0) #define sched_yield() sched_relinquish(curthread) From owner-svn-src-all@freebsd.org Thu Feb 1 13:16:12 2018 Return-Path: Delivered-To: svn-src-all@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 72FCCECA749; Thu, 1 Feb 2018 13:16:12 +0000 (UTC) (envelope-from hselasky@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 2584069CE7; Thu, 1 Feb 2018 13:16:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2068856B1; Thu, 1 Feb 2018 13:16:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11DGCAL015397; Thu, 1 Feb 2018 13:16:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11DGCin015396; Thu, 1 Feb 2018 13:16:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802011316.w11DGCin015396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Feb 2018 13:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328656 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/include/linux X-SVN-Commit-Revision: 328656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 13:16:12 -0000 Author: hselasky Date: Thu Feb 1 13:16:11 2018 New Revision: 328656 URL: https://svnweb.freebsd.org/changeset/base/328656 Log: MFC r328623: Properly implement the cond_resched() function macro in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/sched.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/sched.h ============================================================================== --- stable/10/sys/ofed/include/linux/sched.h Thu Feb 1 13:10:58 2018 (r328655) +++ stable/10/sys/ofed/include/linux/sched.h Thu Feb 1 13:16:11 2018 (r328656) @@ -103,7 +103,7 @@ do { \ kick_proc0(); \ } while (0) -#define cond_resched() if (!cold) sched_relinquish(curthread) +#define cond_resched() do { if (!cold) sched_relinquish(curthread); } while (0) #define sched_yield() sched_relinquish(curthread) From owner-svn-src-all@freebsd.org Thu Feb 1 14:36:25 2018 Return-Path: Delivered-To: svn-src-all@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 99C22ED32D3; Thu, 1 Feb 2018 14:36:25 +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 4CEDF6E17E; Thu, 1 Feb 2018 14:36:25 +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 4771263ED; Thu, 1 Feb 2018 14:36:25 +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 w11EaP6P056599; Thu, 1 Feb 2018 14:36:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11EaPHZ056598; Thu, 1 Feb 2018 14:36:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802011436.w11EaPHZ056598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Feb 2018 14:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328660 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 328660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 14:36:25 -0000 Author: markj Date: Thu Feb 1 14:36:24 2018 New Revision: 328660 URL: https://svnweb.freebsd.org/changeset/base/328660 Log: MFC r328399: Use tcpinfoh_t for TCP headers in the tcp:::debug-{drop,input} probes. Modified: stable/11/sys/netinet/in_kdtrace.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/in_kdtrace.c ============================================================================== --- stable/11/sys/netinet/in_kdtrace.c Thu Feb 1 14:31:12 2018 (r328659) +++ stable/11/sys/netinet/in_kdtrace.c Thu Feb 1 14:36:24 2018 (r328660) @@ -107,7 +107,7 @@ SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr, SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input, "struct tcpcb *", "tcpsinfo_t *" , - "struct tcphdr *", "tcpinfo_t *", + "struct tcphdr *", "tcpinfoh_t *", "uint8_t *", "ipinfo_t *"); SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output, @@ -121,7 +121,7 @@ SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user, SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop, "struct tcpcb *", "tcpsinfo_t *" , - "struct tcphdr *", "tcpinfo_t *", + "struct tcphdr *", "tcpinfoh_t *", "struct mbuf *", "ipinfo_t *"); SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change, From owner-svn-src-all@freebsd.org Thu Feb 1 13:04:02 2018 Return-Path: Delivered-To: svn-src-all@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 87996EC96AB; Thu, 1 Feb 2018 13:04:02 +0000 (UTC) (envelope-from hselasky@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 3D56B69540; Thu, 1 Feb 2018 13:04:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 382C65514; Thu, 1 Feb 2018 13:04:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11D42Ni009995; Thu, 1 Feb 2018 13:04:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11D41sr009994; Thu, 1 Feb 2018 13:04:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802011304.w11D41sr009994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Feb 2018 13:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328654 - stable/11/sys/compat/linuxkpi/common/src X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 328654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 13:04:02 -0000 Author: hselasky Date: Thu Feb 1 13:04:01 2018 New Revision: 328654 URL: https://svnweb.freebsd.org/changeset/base/328654 Log: MFC r328329: Properly implement the "id" callback argument in the "idr_for_each" function in the LinuxKPI. The old implementation assumed only one IDR layer was present. Take additional IDR layers into account when computing the "id" value. Found by: Karthik Palanichamy Tested by: Karthik Palanichamy Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/src/linux_idr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_idr.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_idr.c Thu Feb 1 13:01:44 2018 (r328653) +++ stable/11/sys/compat/linuxkpi/common/src/linux_idr.c Thu Feb 1 13:04:01 2018 (r328654) @@ -680,7 +680,7 @@ idr_alloc_cyclic(struct idr *idr, void *ptr, int start } static int -idr_for_each_layer(struct idr_layer *il, int layer, +idr_for_each_layer(struct idr_layer *il, int offset, int layer, int (*f)(int id, void *p, void *data), void *data) { int i, err; @@ -691,7 +691,7 @@ idr_for_each_layer(struct idr_layer *il, int layer, for (i = 0; i < IDR_SIZE; i++) { if (il->ary[i] == NULL) continue; - err = f(i, il->ary[i], data); + err = f(i + offset, il->ary[i], data); if (err) return (err); } @@ -700,7 +700,8 @@ idr_for_each_layer(struct idr_layer *il, int layer, for (i = 0; i < IDR_SIZE; i++) { if (il->ary[i] == NULL) continue; - err = idr_for_each_layer(il->ary[i], layer - 1, f, data); + err = idr_for_each_layer(il->ary[i], + (i + offset) * IDR_SIZE, layer - 1, f, data); if (err) return (err); } @@ -711,7 +712,7 @@ idr_for_each_layer(struct idr_layer *il, int layer, int idr_for_each(struct idr *idp, int (*f)(int id, void *p, void *data), void *data) { - return (idr_for_each_layer(idp->top, idp->layers - 1, f, data)); + return (idr_for_each_layer(idp->top, 0, idp->layers - 1, f, data)); } int From owner-svn-src-all@freebsd.org Thu Feb 1 13:10:59 2018 Return-Path: Delivered-To: svn-src-all@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 47D0DEC9F2E; Thu, 1 Feb 2018 13:10:59 +0000 (UTC) (envelope-from hselasky@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 ED85E698D5; Thu, 1 Feb 2018 13:10:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E88BA553B; Thu, 1 Feb 2018 13:10:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11DAwV6011172; Thu, 1 Feb 2018 13:10:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11DAw7b011171; Thu, 1 Feb 2018 13:10:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802011310.w11DAw7b011171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Feb 2018 13:10:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328655 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 328655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 13:10:59 -0000 Author: hselasky Date: Thu Feb 1 13:10:58 2018 New Revision: 328655 URL: https://svnweb.freebsd.org/changeset/base/328655 Log: MFC r328623: Properly implement the cond_resched() function macro in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sched.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/sched.h Thu Feb 1 13:04:01 2018 (r328654) +++ stable/11/sys/compat/linuxkpi/common/include/linux/sched.h Thu Feb 1 13:10:58 2018 (r328655) @@ -110,7 +110,7 @@ put_task_struct(struct task_struct *task) linux_free_current(task); } -#define cond_resched() if (!cold) sched_relinquish(curthread) +#define cond_resched() do { if (!cold) sched_relinquish(curthread); } while (0) #define yield() kern_yield(PRI_UNCHANGED) #define sched_yield() sched_relinquish(curthread) From owner-svn-src-all@freebsd.org Thu Feb 1 14:31:13 2018 Return-Path: Delivered-To: svn-src-all@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 8FFFCED293C; Thu, 1 Feb 2018 14:31:13 +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 425466D95F; Thu, 1 Feb 2018 14:31:13 +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 3D2C66269; Thu, 1 Feb 2018 14:31:13 +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 w11EVDGA052497; Thu, 1 Feb 2018 14:31:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11EVDjv052496; Thu, 1 Feb 2018 14:31:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802011431.w11EVDjv052496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 1 Feb 2018 14:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328659 - head/stand/fdt X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/fdt X-SVN-Commit-Revision: 328659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 14:31:13 -0000 Author: kevans Date: Thu Feb 1 14:31:12 2018 New Revision: 328659 URL: https://svnweb.freebsd.org/changeset/base/328659 Log: D14130: stand/fdt: Rip out FDT VA tracking Whether we should be overwriting the loaded FDT module with the 'fixed up' version or not was questionable when this was added, and now that overlays are possible this is downright wrong. Overlays can increase the size of the blob, so writing it back to the original VA will generally write past the end of the block and start clobbering other things in memory. Rip it out- it was questionable to begin with, it's doing bad things now, and it serves no purpose since the modified blob will be copied into place rather than relying on this to reflect the changes. Reviewed by: gonzo MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14130 Modified: head/stand/fdt/fdt_loader_cmd.c Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Thu Feb 1 14:26:26 2018 (r328658) +++ head/stand/fdt/fdt_loader_cmd.c Thu Feb 1 14:31:12 2018 (r328659) @@ -67,10 +67,6 @@ static struct fdt_header *fdt_to_load = NULL; static struct fdt_header *fdtp = NULL; /* Size of FDT blob */ static size_t fdtp_size = 0; -/* Location of FDT in kernel or module. */ -/* This won't be set if FDT is loaded from disk or memory. */ -/* If it is set, we'll update it when fdt_copy() gets called. */ -static vm_offset_t fdtp_va = 0; static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); @@ -221,7 +217,6 @@ fdt_load_dtb(vm_offset_t va) return (1); } - fdtp_va = va; COPYOUT(va, fdtp, fdtp_size); debugf("DTB blob found at 0x%jx, size: 0x%jx\n", (uintmax_t)va, (uintmax_t)fdtp_size); @@ -248,7 +243,6 @@ fdt_load_dtb_addr(struct fdt_header *header) return (1); } - fdtp_va = 0; // Don't write this back into module or kernel. bcopy(header, fdtp, fdtp_size); return (0); } @@ -962,11 +956,6 @@ fdt_copy(vm_offset_t va) if (fdt_fixup() == 0) return (0); - if (fdtp_va != 0) { - /* Overwrite the FDT with the fixed version. */ - /* XXX Is this really appropriate? */ - COPYIN(fdtp, fdtp_va, fdtp_size); - } COPYIN(fdtp, va, fdtp_size); return (fdtp_size); } From owner-svn-src-all@freebsd.org Thu Feb 1 14:37:00 2018 Return-Path: Delivered-To: svn-src-all@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 0B8E2ED3480; Thu, 1 Feb 2018 14:37: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 79E1C6E314; Thu, 1 Feb 2018 14:36:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 747B063EE; Thu, 1 Feb 2018 14:36:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11EaxIB056674; Thu, 1 Feb 2018 14:36:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11EaxnH056673; Thu, 1 Feb 2018 14:36:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802011436.w11EaxnH056673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Feb 2018 14:36:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328661 - stable/11/cddl/lib/libdtrace X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/cddl/lib/libdtrace X-SVN-Commit-Revision: 328661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 14:37:00 -0000 Author: markj Date: Thu Feb 1 14:36:59 2018 New Revision: 328661 URL: https://svnweb.freebsd.org/changeset/base/328661 Log: MFC r328398: Remove uneeded parentheses. Modified: stable/11/cddl/lib/libdtrace/tcp.d Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/lib/libdtrace/tcp.d ============================================================================== --- stable/11/cddl/lib/libdtrace/tcp.d Thu Feb 1 14:36:24 2018 (r328660) +++ stable/11/cddl/lib/libdtrace/tcp.d Thu Feb 1 14:36:59 2018 (r328661) @@ -260,7 +260,7 @@ translator tcpinfoh_t < struct tcphdr *p > { tcp_ack = p == NULL ? -1 : p->th_ack; tcp_offset = p == NULL ? -1 : (p->th_off >> 2); tcp_flags = p == NULL ? 0 : p->th_flags; - tcp_window = p == NULL ? 0 : (p->th_win); + tcp_window = p == NULL ? 0 : p->th_win; tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); tcp_urgent = p == NULL ? 0 : p->th_urp; tcp_hdr = (struct tcphdr *)p; From owner-svn-src-all@freebsd.org Thu Feb 1 15:05:18 2018 Return-Path: Delivered-To: svn-src-all@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 17A24ED65FA; Thu, 1 Feb 2018 15:05:18 +0000 (UTC) (envelope-from andrew@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 BFB6470185; Thu, 1 Feb 2018 15:05:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA8C868BD; Thu, 1 Feb 2018 15:05:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11F5HQt071947; Thu, 1 Feb 2018 15:05:17 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11F5HxA071946; Thu, 1 Feb 2018 15:05:17 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201802011505.w11F5HxA071946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Feb 2018 15:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328662 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 328662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:05:18 -0000 Author: andrew Date: Thu Feb 1 15:05:17 2018 New Revision: 328662 URL: https://svnweb.freebsd.org/changeset/base/328662 Log: Disable EARLY_PRINTF from the Armada 3700 uart, it breaks when we want to use EARLY_PRINTF on other SoCs. Sponsored by: DARPA, AFRL Modified: head/sys/dev/uart/uart_dev_mvebu.c Modified: head/sys/dev/uart/uart_dev_mvebu.c ============================================================================== --- head/sys/dev/uart/uart_dev_mvebu.c Thu Feb 1 14:36:59 2018 (r328661) +++ head/sys/dev/uart/uart_dev_mvebu.c Thu Feb 1 15:05:17 2018 (r328662) @@ -107,6 +107,7 @@ __FBSDID("$FreeBSD$"); /* * For debugging purposes */ +#if 0 #ifdef EARLY_PRINTF #if defined(SOCDEV_PA) && defined(SOCDEV_VA) #define UART_REG_OFFSET 0x12000 @@ -126,6 +127,7 @@ uart_mvebu_early_putc(int c) } early_putc_t *early_putc = uart_mvebu_early_putc; +#endif #endif #endif From owner-svn-src-all@freebsd.org Thu Feb 1 15:23:53 2018 Return-Path: Delivered-To: svn-src-all@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 D4308ED7897; Thu, 1 Feb 2018 15:23:52 +0000 (UTC) (envelope-from mav@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 B201971272; Thu, 1 Feb 2018 15:23:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C25F6C13; Thu, 1 Feb 2018 15:23:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11FNniR082730; Thu, 1 Feb 2018 15:23:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11FNnOA082727; Thu, 1 Feb 2018 15:23:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011523.w11FNnOA082727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 15:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328663 - in stable/11/sys/dev: nvd nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: nvd nvme X-SVN-Commit-Revision: 328663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:23:53 -0000 Author: mav Date: Thu Feb 1 15:23:49 2018 New Revision: 328663 URL: https://svnweb.freebsd.org/changeset/base/328663 Log: MFC r303017 (by imp): Implement crashdump support on NVME Modified: stable/11/sys/dev/nvd/nvd.c stable/11/sys/dev/nvme/nvme.h stable/11/sys/dev/nvme/nvme_ns_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvd/nvd.c ============================================================================== --- stable/11/sys/dev/nvd/nvd.c Thu Feb 1 15:05:17 2018 (r328662) +++ stable/11/sys/dev/nvd/nvd.c Thu Feb 1 15:23:49 2018 (r328663) @@ -47,6 +47,7 @@ struct nvd_disk; static disk_ioctl_t nvd_ioctl; static disk_strategy_t nvd_strategy; +static dumper_t nvd_dump; static void nvd_done(void *arg, const struct nvme_completion *cpl); @@ -226,6 +227,26 @@ nvd_ioctl(struct disk *ndisk, u_long cmd, void *data, return (ret); } +static int +nvd_dump(void *arg, void *virt, vm_offset_t phys, off_t offset, size_t len) +{ + struct nvd_disk *ndisk; + struct disk *dp; + int error; + + dp = arg; + ndisk = dp->d_drv1; + + if (len > 0) { + if ((error = nvme_ns_dump(ndisk->ns, virt, offset, len)) != 0) + return (error); + } else { + /* XXX sync to stable storage */ + } + + return (0); +} + static void nvd_done(void *arg, const struct nvme_completion *cpl) { @@ -302,6 +323,7 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_ar disk = disk_alloc(); disk->d_strategy = nvd_strategy; disk->d_ioctl = nvd_ioctl; + disk->d_dump = nvd_dump; disk->d_name = NVD_STR; disk->d_drv1 = ndisk; Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 15:05:17 2018 (r328662) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 15:23:49 2018 (r328663) @@ -876,6 +876,8 @@ int nvme_ns_cmd_deallocate(struct nvme_namespace *ns, void *cb_arg); int nvme_ns_cmd_flush(struct nvme_namespace *ns, nvme_cb_fn_t cb_fn, void *cb_arg); +int nvme_ns_dump(struct nvme_namespace *ns, void *virt, off_t offset, + size_t len); /* Registration functions */ struct nvme_consumer * nvme_register_consumer(nvme_cons_ns_fn_t ns_fn, Modified: stable/11/sys/dev/nvme/nvme_ns_cmd.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ns_cmd.c Thu Feb 1 15:05:17 2018 (r328662) +++ stable/11/sys/dev/nvme/nvme_ns_cmd.c Thu Feb 1 15:23:49 2018 (r328663) @@ -151,3 +151,47 @@ nvme_ns_cmd_flush(struct nvme_namespace *ns, nvme_cb_f return (0); } + +/* Timeout = 1 sec */ +#define NVD_DUMP_TIMEOUT 100000 + +int +nvme_ns_dump(struct nvme_namespace *ns, void *virt, off_t offset, size_t len) +{ + struct nvme_completion_poll_status status; + struct nvme_request *req; + struct nvme_command *cmd; + uint64_t lba, lba_count; + int i; + + status.done = FALSE; + req = nvme_allocate_request_vaddr(virt, len, nvme_completion_poll_cb, + &status); + if (req == NULL) + return (ENOMEM); + + cmd = &req->cmd; + cmd->opc = NVME_OPC_WRITE; + cmd->nsid = ns->id; + + lba = offset / nvme_ns_get_sector_size(ns); + lba_count = len / nvme_ns_get_sector_size(ns); + + *(uint64_t *)&cmd->cdw10 = lba; + cmd->cdw12 = lba_count - 1; + + nvme_ctrlr_submit_io_request(ns->ctrlr, req); + if (req->qpair == NULL) + return (ENXIO); + + i = 0; + while ((i++ < NVD_DUMP_TIMEOUT) && (status.done == FALSE)) { + DELAY(10); + nvme_qpair_process_completions(req->qpair); + } + + if (status.done == FALSE) + return (ETIMEDOUT); + + return (0); +} From owner-svn-src-all@freebsd.org Thu Feb 1 15:27:48 2018 Return-Path: Delivered-To: svn-src-all@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 DF76AED7D98; Thu, 1 Feb 2018 15:27:47 +0000 (UTC) (envelope-from mav@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 93AC071727; Thu, 1 Feb 2018 15:27:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E8E16C22; Thu, 1 Feb 2018 15:27:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11FRlQC083083; Thu, 1 Feb 2018 15:27:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11FRlbt083081; Thu, 1 Feb 2018 15:27:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011527.w11FRlbt083081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 15:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328664 - in stable/11/sys/dev: nvd nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: nvd nvme X-SVN-Commit-Revision: 328664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:27:48 -0000 Author: mav Date: Thu Feb 1 15:27:47 2018 New Revision: 328664 URL: https://svnweb.freebsd.org/changeset/base/328664 Log: MFC r303040, r303042 (by scottl): Supporting flushing the dump before returning, and simplify/combine the logic. Switch to a 5us delay since most NVME devices can easily do 200,000 iops. Modified: stable/11/sys/dev/nvd/nvd.c stable/11/sys/dev/nvme/nvme_ns_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvd/nvd.c ============================================================================== --- stable/11/sys/dev/nvd/nvd.c Thu Feb 1 15:23:49 2018 (r328663) +++ stable/11/sys/dev/nvd/nvd.c Thu Feb 1 15:27:47 2018 (r328664) @@ -232,19 +232,11 @@ nvd_dump(void *arg, void *virt, vm_offset_t phys, off_ { struct nvd_disk *ndisk; struct disk *dp; - int error; dp = arg; ndisk = dp->d_drv1; - if (len > 0) { - if ((error = nvme_ns_dump(ndisk->ns, virt, offset, len)) != 0) - return (error); - } else { - /* XXX sync to stable storage */ - } - - return (0); + return (nvme_ns_dump(ndisk->ns, virt, offset, len)); } static void Modified: stable/11/sys/dev/nvme/nvme_ns_cmd.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ns_cmd.c Thu Feb 1 15:23:49 2018 (r328663) +++ stable/11/sys/dev/nvme/nvme_ns_cmd.c Thu Feb 1 15:27:47 2018 (r328664) @@ -153,7 +153,7 @@ nvme_ns_cmd_flush(struct nvme_namespace *ns, nvme_cb_f } /* Timeout = 1 sec */ -#define NVD_DUMP_TIMEOUT 100000 +#define NVD_DUMP_TIMEOUT 200000 int nvme_ns_dump(struct nvme_namespace *ns, void *virt, off_t offset, size_t len) @@ -171,22 +171,21 @@ nvme_ns_dump(struct nvme_namespace *ns, void *virt, of return (ENOMEM); cmd = &req->cmd; - cmd->opc = NVME_OPC_WRITE; - cmd->nsid = ns->id; - lba = offset / nvme_ns_get_sector_size(ns); - lba_count = len / nvme_ns_get_sector_size(ns); + if (len > 0) { + lba = offset / nvme_ns_get_sector_size(ns); + lba_count = len / nvme_ns_get_sector_size(ns); + nvme_ns_write_cmd(cmd, ns->id, lba, lba_count); + } else + nvme_ns_flush_cmd(cmd, ns->id); - *(uint64_t *)&cmd->cdw10 = lba; - cmd->cdw12 = lba_count - 1; - nvme_ctrlr_submit_io_request(ns->ctrlr, req); if (req->qpair == NULL) return (ENXIO); i = 0; while ((i++ < NVD_DUMP_TIMEOUT) && (status.done == FALSE)) { - DELAY(10); + DELAY(5); nvme_qpair_process_completions(req->qpair); } From owner-svn-src-all@freebsd.org Thu Feb 1 15:32:15 2018 Return-Path: Delivered-To: svn-src-all@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 B1FE2ED8282; Thu, 1 Feb 2018 15:32:15 +0000 (UTC) (envelope-from mav@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 6238671C51; Thu, 1 Feb 2018 15:32:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D10B6D9A; Thu, 1 Feb 2018 15:32:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11FWFG7088116; Thu, 1 Feb 2018 15:32:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11FWFPx088114; Thu, 1 Feb 2018 15:32:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011532.w11FWFPx088114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 15:32:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328665 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:32:16 -0000 Author: mav Date: Thu Feb 1 15:32:14 2018 New Revision: 328665 URL: https://svnweb.freebsd.org/changeset/base/328665 Log: MFC r303126 (by imp): Actually import nvme_sim so the CAM attachment for NVME (nda) actually works. Added: stable/11/sys/dev/nvme/nvme_sim.c - copied unchanged from r303126, head/sys/dev/nvme/nvme_sim.c Modified: stable/11/sys/dev/nvme/nvme_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 15:27:47 2018 (r328664) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 15:32:14 2018 (r328665) @@ -245,10 +245,6 @@ struct nvme_controller { struct mtx lock; - struct cam_sim *sim; - struct cam_path *path; - int cam_ref; - uint32_t ready_timeout_in_ms; bus_space_tag_t bus_tag; Copied: stable/11/sys/dev/nvme/nvme_sim.c (from r303126, head/sys/dev/nvme/nvme_sim.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 15:32:14 2018 (r328665, copy of r303126, head/sys/dev/nvme/nvme_sim.c) @@ -0,0 +1,400 @@ +/*- + * Copyright (c) 2016 Netflix, Inc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include // Yes, this is wrong. +#include + +#include "nvme_private.h" + +#define ccb_accb_ptr spriv_ptr0 +#define ccb_ctrlr_ptr spriv_ptr1 +static void nvme_sim_action(struct cam_sim *sim, union ccb *ccb); +static void nvme_sim_poll(struct cam_sim *sim); + +#define sim2softc(sim) ((struct nvme_sim_softc *)cam_sim_softc(sim)) +#define sim2ns(sim) (sim2softc(sim)->s_ns) +#define sim2ctrlr(sim) (sim2softc(sim)->s_ctrlr) + +struct nvme_sim_softc +{ + struct nvme_controller *s_ctrlr; + struct nvme_namespace *s_ns; + struct cam_sim *s_sim; + struct cam_path *s_path; +}; + +static void +nvme_sim_nvmeio_done(void *ccb_arg, const struct nvme_completion *cpl) +{ + union ccb *ccb = (union ccb *)ccb_arg; + + /* + * Let the periph know the completion, and let it sort out what + * it means. Make our best guess, though for the status code. + */ + memcpy(&ccb->nvmeio.cpl, cpl, sizeof(*cpl)); + if (nvme_completion_is_error(cpl)) + ccb->ccb_h.status = CAM_REQ_CMP_ERR; + else + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); +} + +static void +nvme_sim_nvmeio(struct cam_sim *sim, union ccb *ccb) +{ + struct ccb_nvmeio *nvmeio = &ccb->nvmeio; + struct nvme_request *req; + void *payload; + uint32_t size; + struct nvme_controller *ctrlr; + + ctrlr = sim2ctrlr(sim); + payload = nvmeio->data_ptr; + size = nvmeio->dxfer_len; + /* SG LIST ??? */ + if ((nvmeio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_BIO) + req = nvme_allocate_request_bio((struct bio *)payload, + nvme_sim_nvmeio_done, ccb); + else if (payload == NULL) + req = nvme_allocate_request_null(nvme_sim_nvmeio_done, ccb); + else + req = nvme_allocate_request_vaddr(payload, size, + nvme_sim_nvmeio_done, ccb); + + if (req == NULL) { + nvmeio->ccb_h.status = CAM_RESRC_UNAVAIL; + xpt_done(ccb); + return; + } + + memcpy(&req->cmd, &ccb->nvmeio.cmd, sizeof(ccb->nvmeio.cmd)); + + nvme_ctrlr_submit_io_request(ctrlr, req); + + ccb->ccb_h.status |= CAM_SIM_QUEUED; +} + +static void +nvme_sim_action(struct cam_sim *sim, union ccb *ccb) +{ + struct nvme_controller *ctrlr; + struct nvme_namespace *ns; + + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, + ("nvme_sim_action: func= %#x\n", + ccb->ccb_h.func_code)); + + /* + * XXX when we support multiple namespaces in the base driver we'll need + * to revisit how all this gets stored and saved in the periph driver's + * reserved areas. Right now we store all three in the softc of the sim. + */ + ns = sim2ns(sim); + ctrlr = sim2ctrlr(sim); + + printf("Sim action: ctrlr %p ns %p\n", ctrlr, ns); + + mtx_assert(&ctrlr->lock, MA_OWNED); + + switch (ccb->ccb_h.func_code) { + case XPT_CALC_GEOMETRY: /* Calculate Geometry Totally nuts ? XXX */ + /* + * Only meaningful for old-school SCSI disks since only the SCSI + * da driver generates them. Reject all these that slip through. + */ + /*FALLTHROUGH*/ + case XPT_ABORT: /* Abort the specified CCB */ + case XPT_EN_LUN: /* Enable LUN as a target */ + case XPT_TARGET_IO: /* Execute target I/O request */ + case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */ + case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/ + /* + * Only target mode generates these, and only for SCSI. They are + * all invalid/unsupported for NVMe. + */ + ccb->ccb_h.status = CAM_REQ_INVALID; + break; + case XPT_SET_TRAN_SETTINGS: + /* + * NVMe doesn't really have different transfer settings, but + * other parts of CAM think failure here is a big deal. + */ + ccb->ccb_h.status = CAM_REQ_CMP; + break; + case XPT_PATH_INQ: /* Path routing inquiry */ + { + struct ccb_pathinq *cpi = &ccb->cpi; + + /* + * NVMe may have multiple LUNs on the same path. Current generation + * of NVMe devives support only a single name space. Multiple name + * space drives are coming, but it's unclear how we should report + * them up the stack. + */ + cpi->version_num = 1; + cpi->hba_inquiry = 0; + cpi->target_sprt = 0; + cpi->hba_misc = PIM_UNMAPPED /* | PIM_NOSCAN */; + cpi->hba_eng_cnt = 0; + cpi->max_target = 0; + cpi->max_lun = ctrlr->cdata.nn; + cpi->maxio = nvme_ns_get_max_io_xfer_size(ns); + cpi->initiator_id = 0; + cpi->bus_id = cam_sim_bus(sim); + cpi->base_transfer_speed = 4000000; /* 4 GB/s 4 lanes pcie 3 */ + strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strncpy(cpi->hba_vid, "NVMe", HBA_IDLEN); + strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->unit_number = cam_sim_unit(sim); + cpi->transport = XPORT_NVME; /* XXX XPORT_PCIE ? */ + cpi->transport_version = 1; /* XXX Get PCIe spec ? */ + cpi->protocol = PROTO_NVME; + cpi->protocol_version = NVME_REV_1; /* Groks all 1.x NVMe cards */ + cpi->xport_specific.nvme.nsid = ns->id; + cpi->ccb_h.status = CAM_REQ_CMP; + break; + } + case XPT_GET_TRAN_SETTINGS: /* Get transport settings */ + { + struct ccb_trans_settings *cts; + struct ccb_trans_settings_nvme *nvmep; + struct ccb_trans_settings_nvme *nvmex; + + cts = &ccb->cts; + nvmex = &cts->xport_specific.nvme; + nvmep = &cts->proto_specific.nvme; + + nvmex->valid = CTS_NVME_VALID_SPEC; + nvmex->spec_major = 1; /* XXX read from card */ + nvmex->spec_minor = 2; + nvmex->spec_tiny = 0; + + nvmep->valid = CTS_NVME_VALID_SPEC; + nvmep->spec_major = 1; /* XXX read from card */ + nvmep->spec_minor = 2; + nvmep->spec_tiny = 0; + cts->transport = XPORT_NVME; + cts->protocol = PROTO_NVME; + cts->ccb_h.status = CAM_REQ_CMP; + break; + } + case XPT_TERM_IO: /* Terminate the I/O process */ + /* + * every driver handles this, but nothing generates it. Assume + * it's OK to just say 'that worked'. + */ + /*FALLTHROUGH*/ + case XPT_RESET_DEV: /* Bus Device Reset the specified device */ + case XPT_RESET_BUS: /* Reset the specified bus */ + /* + * NVMe doesn't really support physically resetting the bus. It's part + * of the bus scanning dance, so return sucess to tell the process to + * proceed. + */ + ccb->ccb_h.status = CAM_REQ_CMP; + break; + case XPT_NVME_IO: /* Execute the requested I/O operation */ + nvme_sim_nvmeio(sim, ccb); + return; /* no done */ + default: + ccb->ccb_h.status = CAM_REQ_INVALID; + break; + } + xpt_done(ccb); +} + +static void +nvme_sim_poll(struct cam_sim *sim) +{ + + nvme_ctrlr_intx_handler(sim2ctrlr(sim)); +} + +static void * +nvme_sim_new_controller(struct nvme_controller *ctrlr) +{ + struct cam_devq *devq; + int max_trans; + int unit; + struct nvme_sim_softc *sc = NULL; + + max_trans = 256;/* XXX not so simple -- must match queues */ + unit = device_get_unit(ctrlr->dev); + devq = cam_simq_alloc(max_trans); + if (devq == NULL) + return NULL; + + sc = malloc(sizeof(*sc), M_NVME, M_ZERO | M_WAITOK); + + sc->s_ctrlr = ctrlr; + + sc->s_sim = cam_sim_alloc(nvme_sim_action, nvme_sim_poll, + "nvme", sc, unit, &ctrlr->lock, max_trans, max_trans, devq); + if (sc->s_sim == NULL) { + printf("Failed to allocate a sim\n"); + cam_simq_free(devq); + free(sc, M_NVME); + return NULL; + } + + return sc; +} + +static void +nvme_sim_rescan_target(struct nvme_controller *ctrlr, struct cam_path *path) +{ + union ccb *ccb; + + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + printf("unable to alloc CCB for rescan\n"); + return; + } + + if (xpt_clone_path(&ccb->ccb_h.path, path) != CAM_REQ_CMP) { + printf("unable to copy path for rescan\n"); + xpt_free_ccb(ccb); + return; + } + + xpt_rescan(ccb); +} + +static void * +nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg) +{ + struct nvme_sim_softc *sc = sc_arg; + struct nvme_controller *ctrlr = sc->s_ctrlr; + int i; + + sc->s_ns = ns; + + printf("Our SIM's softc %p ctrlr %p ns %p\n", sc, ctrlr, ns); + + /* + * XXX this is creating one bus per ns, but it should be one + * XXX target per controller, and one LUN per namespace. + * XXX Current drives only support one NS, so there's time + * XXX to fix it later when new drives arrive. + * + * XXX I'm pretty sure the xpt_bus_register() call below is + * XXX like super lame and it really belongs in the sim_new_ctrlr + * XXX callback. Then the create_path below would be pretty close + * XXX to being right. Except we should be per-ns not per-ctrlr + * XXX data. + */ + + mtx_lock(&ctrlr->lock); +/* Create bus */ + + /* + * XXX do I need to lock ctrlr->lock ? + * XXX do I need to lock the path? + * ata and scsi seem to in their code, but their discovery is + * somewhat more asynchronous. We're only every called one at a + * time, and nothing is in parallel. + */ + + i = 0; + if (xpt_bus_register(sc->s_sim, ctrlr->dev, 0) != CAM_SUCCESS) + goto error; + i++; + if (xpt_create_path(&sc->s_path, /*periph*/NULL, cam_sim_path(sc->s_sim), + 1, ns->id) != CAM_REQ_CMP) + goto error; + i++; + + sc->s_path->device->nvme_data = nvme_ns_get_data(ns); + sc->s_path->device->nvme_cdata = nvme_ctrlr_get_data(ns->ctrlr); + +/* Scan bus */ + printf("Initiate rescan of the bus\n"); + nvme_sim_rescan_target(ctrlr, sc->s_path); + + mtx_unlock(&ctrlr->lock); + + return ns; + +error: + switch (i) { + case 2: + xpt_free_path(sc->s_path); + case 1: + xpt_bus_deregister(cam_sim_path(sc->s_sim)); + case 0: + cam_sim_free(sc->s_sim, /*free_devq*/TRUE); + } + mtx_unlock(&ctrlr->lock); + return NULL; +} + +static void +nvme_sim_controller_fail(void *ctrlr_arg) +{ + /* XXX cleanup XXX */ +} + +struct nvme_consumer *consumer_cookie; + +static void +nvme_sim_init(void) +{ + + consumer_cookie = nvme_register_consumer(nvme_sim_new_ns, + nvme_sim_new_controller, NULL, nvme_sim_controller_fail); +} + +SYSINIT(nvme_sim_register, SI_SUB_DRIVERS, SI_ORDER_ANY, + nvme_sim_init, NULL); + +static void +nvme_sim_uninit(void) +{ + /* XXX Cleanup */ + + nvme_unregister_consumer(consumer_cookie); +} + +SYSUNINIT(nvme_sim_unregister, SI_SUB_DRIVERS, SI_ORDER_ANY, + nvme_sim_uninit, NULL); From owner-svn-src-all@freebsd.org Thu Feb 1 15:32:49 2018 Return-Path: Delivered-To: svn-src-all@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 60E7FED8313; Thu, 1 Feb 2018 15:32:49 +0000 (UTC) (envelope-from mav@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 139D571DC9; Thu, 1 Feb 2018 15:32:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E7B36DBA; Thu, 1 Feb 2018 15:32:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11FWmp3088205; Thu, 1 Feb 2018 15:32:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11FWmIa088204; Thu, 1 Feb 2018 15:32:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011532.w11FWmIa088204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 15:32:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328666 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:32:49 -0000 Author: mav Date: Thu Feb 1 15:32:48 2018 New Revision: 328666 URL: https://svnweb.freebsd.org/changeset/base/328666 Log: MFC r303466: Kill a few stray debug printfs. Modified: stable/11/sys/dev/nvme/nvme_sim.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 15:32:14 2018 (r328665) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 15:32:48 2018 (r328666) @@ -133,8 +133,6 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) ns = sim2ns(sim); ctrlr = sim2ctrlr(sim); - printf("Sim action: ctrlr %p ns %p\n", ctrlr, ns); - mtx_assert(&ctrlr->lock, MA_OWNED); switch (ccb->ccb_h.func_code) { @@ -310,8 +308,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar sc->s_ns = ns; - printf("Our SIM's softc %p ctrlr %p ns %p\n", sc, ctrlr, ns); - /* * XXX this is creating one bus per ns, but it should be one * XXX target per controller, and one LUN per namespace. @@ -349,7 +345,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar sc->s_path->device->nvme_cdata = nvme_ctrlr_get_data(ns->ctrlr); /* Scan bus */ - printf("Initiate rescan of the bus\n"); nvme_sim_rescan_target(ctrlr, sc->s_path); mtx_unlock(&ctrlr->lock); From owner-svn-src-all@freebsd.org Thu Feb 1 15:35:34 2018 Return-Path: Delivered-To: svn-src-all@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 4BD9CED8580 for ; Thu, 1 Feb 2018 15:35:34 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (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 A2A8B72002 for ; Thu, 1 Feb 2018 15:35:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x234.google.com with SMTP id c17so19590288iod.1 for ; Thu, 01 Feb 2018 07:35:33 -0800 (PST) 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=IMja54nzSvskCgKBu0v0dWXJAz7e+aohBxAus3i1s2w=; b=bjjiQW8TGfIL3sZd8g3L08ENDxk3SmFhTyJ8KTmFIA8UMxTU1uQBbjy18Y4WaVwOdz QnTyjzCsvk6S6zedCekMSlY/xkYRgpDfuXsGkbfm/C0px5EDtZ+1M8seg8fy9bESl5hR KD/Dm6DH3ddhLGHgyil1U++8OenjkuY7wogzG4aK5Gay7VXaxpqAoYU2G3SoH+aQPU+Z h/5+R1JA7GYGPlnTEDE/bOC+vcJBV0NrRwxRFYFvpL2EsMyubbjCg6MBHjAw2+N/pO3W sXhLgNhy9Cs7KQVaVjm2RJstJQIHkkMAIXwiNHFxjIY8CQoQAWyNims5lePQL+V0uHY/ 1iFA== 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=IMja54nzSvskCgKBu0v0dWXJAz7e+aohBxAus3i1s2w=; b=IF/TmPtSKeP6K7tBnG0B/tmvSJi1J8McahAW0e1K7Wlg+kodd/1ibSJCEfoc8vkXWH bn1FztQGgl9U9QQTBulgNVfnbqih/ZKk6ITUd9+2WOSpMohFklh8Lrg3KWztuD9qpL8s iinPsiBjgfisZ3fDN4xx59fqYAYL3n0jnytxxZT/tRiEjZQPJbA4478vOqssU0YEOs4f BpLx82mROijG2gBMKb151qtQoeU4Xc1z2hPqGLUhNrbvwycr7GDL82oicCitihRZTRjb 7DL3UhJ/J/lHintznx6qCE9YX3d5/XfZQlo2APn3PoVXKqI0HR3Swhrh+ZMpwjQ2Lstj zl7w== X-Gm-Message-State: AKwxytez7YfTe+cvMFpREBBTrFCz9G6Yk86MY7QS11bZ/5m6pgRADafb 6FMTs1zTqQGzHku8fQ3US36obkyZMaDNIqJvz+9/gg== X-Google-Smtp-Source: AH8x225pCKhTdgGixvFc9LmhZRZzYSEQi2Od5cEe9zh7aiJc4YgbM4jfVRIhd7Jnjpw1Dd4kbMhtjAKXyipFbFpTQ5s= X-Received: by 10.107.88.12 with SMTP id m12mr35704721iob.136.1517499332956; Thu, 01 Feb 2018 07:35:32 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 1 Feb 2018 07:35:32 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201802011532.w11FWmIa088204@repo.freebsd.org> References: <201802011532.w11FWmIa088204@repo.freebsd.org> From: Warner Losh Date: Thu, 1 Feb 2018 08:35:32 -0700 X-Google-Sender-Auth: I7t5PAognWWxfixaUc1m3eTkZNk Message-ID: Subject: Re: svn commit: r328666 - stable/11/sys/dev/nvme To: Alexander Motin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:35:34 -0000 I'd been specifically not MFC'ing the NVME stuff because I wasn't sure that its ABI had jelled yet.... Be sure to merge everything because there's 0 support for anything but the tip of -current for the NVME CAM stuff. Warner On Thu, Feb 1, 2018 at 8:32 AM, Alexander Motin wrote: > Author: mav > Date: Thu Feb 1 15:32:48 2018 > New Revision: 328666 > URL: https://svnweb.freebsd.org/changeset/base/328666 > > Log: > MFC r303466: Kill a few stray debug printfs. > > Modified: > stable/11/sys/dev/nvme/nvme_sim.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/dev/nvme/nvme_sim.c > ============================================================ > ================== > --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 15:32:14 2018 > (r328665) > +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 15:32:48 2018 > (r328666) > @@ -133,8 +133,6 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) > ns = sim2ns(sim); > ctrlr = sim2ctrlr(sim); > > - printf("Sim action: ctrlr %p ns %p\n", ctrlr, ns); > - > mtx_assert(&ctrlr->lock, MA_OWNED); > > switch (ccb->ccb_h.func_code) { > @@ -310,8 +308,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar > > sc->s_ns = ns; > > - printf("Our SIM's softc %p ctrlr %p ns %p\n", sc, ctrlr, ns); > - > /* > * XXX this is creating one bus per ns, but it should be one > * XXX target per controller, and one LUN per namespace. > @@ -349,7 +345,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar > sc->s_path->device->nvme_cdata = nvme_ctrlr_get_data(ns->ctrlr); > > /* Scan bus */ > - printf("Initiate rescan of the bus\n"); > nvme_sim_rescan_target(ctrlr, sc->s_path); > > mtx_unlock(&ctrlr->lock); > > From owner-svn-src-all@freebsd.org Thu Feb 1 15:45:23 2018 Return-Path: Delivered-To: svn-src-all@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 7EC9FED8FA0; Thu, 1 Feb 2018 15:45:23 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yw0-x235.google.com (mail-yw0-x235.google.com [IPv6:2607:f8b0:4002:c05::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0EF4C727DD; Thu, 1 Feb 2018 15:45:23 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yw0-x235.google.com with SMTP id u21so10745589ywc.2; Thu, 01 Feb 2018 07:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vyPa8NxNhRLrcDk7+cbwyGZjOPTH0ZPRJkm2f0wGQYY=; b=n3Z4NGxNz94/VDHIvY7oD4JHE+3utXvnCsutIuj5c9GSpqO/VE8jPLJFdaQhSBkx1a /TUq08fCM7umYKuRsmkQxtnjhYHEAcVBkJuxJAwsydqVugOpi8kIFsVIT+uT75UVGkam tpWvpGvVOjlELLBI5DZTHoaTiWVFvbpNCdwJ1LpQI2NtgJ0eu4I4/OucSIMgu7Mon+bq 7iXfiWpXZUVbLE61o0s0GY/mzLCmjZCo6TjOxChk82xpZT7BZIdFeY0uWGPwwB+6jTpt LMogXz85vMrE44PilfYpae90rx1iT3xKITYAGDEcMW1f2A3NY621gt3OBr27LXmASA1V DyTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vyPa8NxNhRLrcDk7+cbwyGZjOPTH0ZPRJkm2f0wGQYY=; b=X2WRQEwVjc+g7p9DmltgQ8pqzTHl3q8tupnm4k53f1w53dLKKitPrZAR6MRZseK7xb KZmhPP827xixidbE2oCYt7ij7jPhqA0WzRzjMNIvOTbdv+Q8bI6mz6iHxnJDnglEGdjE F1nw+ahIMEs8cUm1MGOiQUsn34eI3ZA/KI4YqB9vVjY3GqlH1rdQ/WbxGIALLUaOiim6 w913Wqk97JTHlC7/ZDW9x8uOobbrYaEm8BXIZ5EUW+PmInyNYmRUlkrmBGLApbsG2PAU jQvS56W3Oz+0TrY749V4XXx8zk35SGPAPpShWbOkuL5DVPWl0O+cysLpYrd4ru3Z3PYZ 7r3g== X-Gm-Message-State: AKwxytc/eufw0zV1cMsVvrrjnWkHSLkvIOj/cqcu2DYkdCPUtUumtuu5 l/wDAgc6s38ZSJbSZKa2BozJhqGL X-Google-Smtp-Source: AH8x224gWXE03a2EgXyZkNyPXvIpp0H8+FrYHM6U9Akt7dFPWeO4kIus2r+wImOKuLHhr4/s2Rm/Hw== X-Received: by 10.37.44.207 with SMTP id s198mr5915682ybs.238.1517499922315; Thu, 01 Feb 2018 07:45:22 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.164.17.129]) by smtp.gmail.com with ESMTPSA id u3sm7111593ywg.28.2018.02.01.07.45.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 07:45:21 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r328666 - stable/11/sys/dev/nvme To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201802011532.w11FWmIa088204@repo.freebsd.org> From: Alexander Motin Message-ID: <35677873-32dc-67a1-6cee-9e300b5d0674@FreeBSD.org> Date: Thu, 1 Feb 2018 10:45:21 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:45:23 -0000 On 01.02.2018 10:35, Warner Losh wrote: > I'd been specifically not MFC'ing the NVME stuff because I wasn't sure > that its ABI had jelled yet.... > > Be sure to merge everything because there's 0 support for anything but > the tip of -current for the NVME CAM stuff. Sure, as much as ABI permit. I just found that we need some of recent head changes for some NVMe devices to work, and then found that the code in area was not merged for a year. I don't like random cherry-picking, > On Thu, Feb 1, 2018 at 8:32 AM, Alexander Motin > wrote: > > Author: mav > Date: Thu Feb  1 15:32:48 2018 > New Revision: 328666 > URL: https://svnweb.freebsd.org/changeset/base/328666 > > > Log: >   MFC r303466: Kill a few stray debug printfs. > > Modified: >   stable/11/sys/dev/nvme/nvme_sim.c > Directory Properties: >   stable/11/   (props changed) > > Modified: stable/11/sys/dev/nvme/nvme_sim.c > ============================================================================== > --- stable/11/sys/dev/nvme/nvme_sim.c   Thu Feb  1 15:32:14 2018    >     (r328665) > +++ stable/11/sys/dev/nvme/nvme_sim.c   Thu Feb  1 15:32:48 2018    >     (r328666) > @@ -133,8 +133,6 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) >         ns = sim2ns(sim); >         ctrlr = sim2ctrlr(sim); > > -       printf("Sim action: ctrlr %p ns %p\n", ctrlr, ns); > - >         mtx_assert(&ctrlr->lock, MA_OWNED); > >         switch (ccb->ccb_h.func_code) { > @@ -310,8 +308,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void > *sc_ar > >         sc->s_ns = ns; > > -       printf("Our SIM's softc %p ctrlr %p ns %p\n", sc, ctrlr, ns); > - >         /* >          * XXX this is creating one bus per ns, but it should be one >          * XXX target per controller, and one LUN per namespace. > @@ -349,7 +345,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void > *sc_ar >         sc->s_path->device->nvme_cdata = nvme_ctrlr_get_data(ns->ctrlr); > >  /* Scan bus */ > -       printf("Initiate rescan of the bus\n"); >         nvme_sim_rescan_target(ctrlr, sc->s_path); > >         mtx_unlock(&ctrlr->lock); > > -- Alexander Motin From owner-svn-src-all@freebsd.org Thu Feb 1 15:46:20 2018 Return-Path: Delivered-To: svn-src-all@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 A7D0CED90A5; Thu, 1 Feb 2018 15:46:20 +0000 (UTC) (envelope-from mav@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 5B14A72994; Thu, 1 Feb 2018 15:46:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55E366F6E; Thu, 1 Feb 2018 15:46:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11FkKet093667; Thu, 1 Feb 2018 15:46:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11FkKWL093664; Thu, 1 Feb 2018 15:46:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011546.w11FkKWL093664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 15:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328667 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:46:20 -0000 Author: mav Date: Thu Feb 1 15:46:19 2018 New Revision: 328667 URL: https://svnweb.freebsd.org/changeset/base/328667 Log: MFC r308431 (by scottl): Convert the Q-Pair and PRP list memory allocations to use BUSDMA. Add a bunch of safery belts and error handling in related codepaths. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_private.h stable/11/sys/dev/nvme/nvme_qpair.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 15:32:48 2018 (r328666) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 15:46:19 2018 (r328667) @@ -80,11 +80,12 @@ nvme_ctrlr_allocate_bar(struct nvme_controller *ctrlr) return (0); } -static void +static int nvme_ctrlr_construct_admin_qpair(struct nvme_controller *ctrlr) { struct nvme_qpair *qpair; uint32_t num_entries; + int error; qpair = &ctrlr->adminq; @@ -105,12 +106,13 @@ nvme_ctrlr_construct_admin_qpair(struct nvme_controlle * The admin queue's max xfer size is treated differently than the * max I/O xfer size. 16KB is sufficient here - maybe even less? */ - nvme_qpair_construct(qpair, - 0, /* qpair ID */ - 0, /* vector */ - num_entries, - NVME_ADMIN_TRACKERS, - ctrlr); + error = nvme_qpair_construct(qpair, + 0, /* qpair ID */ + 0, /* vector */ + num_entries, + NVME_ADMIN_TRACKERS, + ctrlr); + return (error); } static int @@ -118,7 +120,7 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller { struct nvme_qpair *qpair; union cap_lo_register cap_lo; - int i, num_entries, num_trackers; + int i, error, num_entries, num_trackers; num_entries = NVME_IO_ENTRIES; TUNABLE_INT_FETCH("hw.nvme.io_entries", &num_entries); @@ -163,12 +165,14 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller * For I/O queues, use the controller-wide max_xfer_size * calculated in nvme_attach(). */ - nvme_qpair_construct(qpair, + error = nvme_qpair_construct(qpair, i+1, /* qpair ID */ ctrlr->msix_enabled ? i+1 : 0, /* vector */ num_entries, num_trackers, ctrlr); + if (error) + return (error); /* * Do not bother binding interrupts if we only have one I/O @@ -1098,7 +1102,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de nvme_ctrlr_setup_interrupts(ctrlr); ctrlr->max_xfer_size = NVME_MAX_XFER_SIZE; - nvme_ctrlr_construct_admin_qpair(ctrlr); + if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) + return (ENXIO); ctrlr->cdev = make_dev(&nvme_ctrlr_cdevsw, device_get_unit(dev), UID_ROOT, GID_WHEEL, 0600, "nvme%d", device_get_unit(dev)); Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 15:32:48 2018 (r328666) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 15:46:19 2018 (r328667) @@ -172,9 +172,8 @@ struct nvme_tracker { bus_dmamap_t payload_dma_map; uint16_t cid; - uint64_t prp[NVME_MAX_PRP_LIST_ENTRIES]; + uint64_t *prp; bus_addr_t prp_bus_addr; - bus_dmamap_t prp_dma_map; }; struct nvme_qpair { @@ -206,10 +205,8 @@ struct nvme_qpair { bus_dma_tag_t dma_tag; bus_dma_tag_t dma_tag_payload; - bus_dmamap_t cmd_dma_map; + bus_dmamap_t queuemem_map; uint64_t cmd_bus_addr; - - bus_dmamap_t cpl_dma_map; uint64_t cpl_bus_addr; TAILQ_HEAD(, nvme_tracker) free_tr; @@ -417,7 +414,7 @@ void nvme_ctrlr_submit_io_request(struct nvme_controll void nvme_ctrlr_post_failed_request(struct nvme_controller *ctrlr, struct nvme_request *req); -void nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, +int nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, uint16_t vector, uint32_t num_entries, uint32_t num_trackers, struct nvme_controller *ctrlr); Modified: stable/11/sys/dev/nvme/nvme_qpair.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 15:32:48 2018 (r328666) +++ stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 15:46:19 2018 (r328667) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); static void _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req); +static void nvme_qpair_destroy(struct nvme_qpair *qpair); struct nvme_opcode_string { @@ -290,22 +291,6 @@ nvme_completion_is_retry(const struct nvme_completion } static void -nvme_qpair_construct_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr, - uint16_t cid) -{ - - bus_dmamap_create(qpair->dma_tag_payload, 0, &tr->payload_dma_map); - bus_dmamap_create(qpair->dma_tag, 0, &tr->prp_dma_map); - - bus_dmamap_load(qpair->dma_tag, tr->prp_dma_map, tr->prp, - sizeof(tr->prp), nvme_single_map, &tr->prp_bus_addr, 0); - - callout_init(&tr->timer, 1); - tr->cid = cid; - tr->qpair = qpair; -} - -static void nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr, struct nvme_completion *cpl, boolean_t print_on_error) { @@ -457,14 +442,16 @@ nvme_qpair_msix_handler(void *arg) nvme_qpair_process_completions(qpair); } -void +int nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, uint16_t vector, uint32_t num_entries, uint32_t num_trackers, struct nvme_controller *ctrlr) { struct nvme_tracker *tr; - uint32_t i; - int err; + size_t cmdsz, cplsz, prpsz, allocsz, prpmemsz; + uint64_t queuemem_phys, prpmem_phys, list_phys; + uint8_t *queuemem, *prpmem, *prp_list; + int i, err; qpair->id = id; qpair->vector = vector; @@ -495,41 +482,52 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ BUS_SPACE_MAXADDR, NULL, NULL, NVME_MAX_XFER_SIZE, (NVME_MAX_XFER_SIZE/PAGE_SIZE)+1, PAGE_SIZE, 0, NULL, NULL, &qpair->dma_tag_payload); - if (err != 0) + if (err != 0) { nvme_printf(ctrlr, "payload tag create failed %d\n", err); + goto out; + } + /* + * Each component must be page aligned, and individual PRP lists + * cannot cross a page boundary. + */ + cmdsz = qpair->num_entries * sizeof(struct nvme_command); + cmdsz = roundup2(cmdsz, PAGE_SIZE); + cplsz = qpair->num_entries * sizeof(struct nvme_completion); + cplsz = roundup2(cplsz, PAGE_SIZE); + prpsz = sizeof(uint64_t) * NVME_MAX_PRP_LIST_ENTRIES;; + prpmemsz = qpair->num_trackers * prpsz; + allocsz = cmdsz + cplsz + prpmemsz; + err = bus_dma_tag_create(bus_get_dma_tag(ctrlr->dev), - 4, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, 1, BUS_SPACE_MAXSIZE, 0, - NULL, NULL, &qpair->dma_tag); - if (err != 0) + PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + allocsz, 1, allocsz, 0, NULL, NULL, &qpair->dma_tag); + if (err != 0) { nvme_printf(ctrlr, "tag create failed %d\n", err); + goto out; + } + if (bus_dmamem_alloc(qpair->dma_tag, (void **)&queuemem, + BUS_DMA_NOWAIT, &qpair->queuemem_map)) { + nvme_printf(ctrlr, "failed to alloc qpair memory\n"); + goto out; + } + + if (bus_dmamap_load(qpair->dma_tag, qpair->queuemem_map, + queuemem, allocsz, nvme_single_map, &queuemem_phys, 0) != 0) { + nvme_printf(ctrlr, "failed to load qpair memory\n"); + goto out; + } + qpair->num_cmds = 0; qpair->num_intr_handler_calls = 0; + qpair->cmd = (struct nvme_command *)queuemem; + qpair->cpl = (struct nvme_completion *)(queuemem + cmdsz); + prpmem = (uint8_t *)(queuemem + cmdsz + cplsz); + qpair->cmd_bus_addr = queuemem_phys; + qpair->cpl_bus_addr = queuemem_phys + cmdsz; + prpmem_phys = queuemem_phys + cmdsz + cplsz; - qpair->cmd = contigmalloc(qpair->num_entries * - sizeof(struct nvme_command), M_NVME, M_ZERO, - 0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); - qpair->cpl = contigmalloc(qpair->num_entries * - sizeof(struct nvme_completion), M_NVME, M_ZERO, - 0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); - - err = bus_dmamap_create(qpair->dma_tag, 0, &qpair->cmd_dma_map); - if (err != 0) - nvme_printf(ctrlr, "cmd_dma_map create failed %d\n", err); - - err = bus_dmamap_create(qpair->dma_tag, 0, &qpair->cpl_dma_map); - if (err != 0) - nvme_printf(ctrlr, "cpl_dma_map create failed %d\n", err); - - bus_dmamap_load(qpair->dma_tag, qpair->cmd_dma_map, - qpair->cmd, qpair->num_entries * sizeof(struct nvme_command), - nvme_single_map, &qpair->cmd_bus_addr, 0); - bus_dmamap_load(qpair->dma_tag, qpair->cpl_dma_map, - qpair->cpl, qpair->num_entries * sizeof(struct nvme_completion), - nvme_single_map, &qpair->cpl_bus_addr, 0); - qpair->sq_tdbl_off = nvme_mmio_offsetof(doorbell[id].sq_tdbl); qpair->cq_hdbl_off = nvme_mmio_offsetof(doorbell[id].cq_hdbl); @@ -537,14 +535,51 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ TAILQ_INIT(&qpair->outstanding_tr); STAILQ_INIT(&qpair->queued_req); + list_phys = prpmem_phys; + prp_list = prpmem; for (i = 0; i < qpair->num_trackers; i++) { + + if (list_phys + prpsz > prpmem_phys + prpmemsz) { + qpair->num_trackers = i; + break; + } + + /* + * Make sure that the PRP list for this tracker doesn't + * overflow to another page. + */ + if (trunc_page(list_phys) != + trunc_page(list_phys + prpsz - 1)) { + list_phys = roundup2(list_phys, PAGE_SIZE); + prp_list = + (uint8_t *)roundup2((uintptr_t)prp_list, PAGE_SIZE); + } + tr = malloc(sizeof(*tr), M_NVME, M_ZERO | M_WAITOK); - nvme_qpair_construct_tracker(qpair, tr, i); + bus_dmamap_create(qpair->dma_tag_payload, 0, + &tr->payload_dma_map); + callout_init(&tr->timer, 1); + tr->cid = i; + tr->qpair = qpair; + tr->prp = (uint64_t *)prp_list; + tr->prp_bus_addr = list_phys; TAILQ_INSERT_HEAD(&qpair->free_tr, tr, tailq); + list_phys += prpsz; + prp_list += prpsz; } - qpair->act_tr = malloc(sizeof(struct nvme_tracker *) * qpair->num_entries, - M_NVME, M_ZERO | M_WAITOK); + if (qpair->num_trackers == 0) { + nvme_printf(ctrlr, "failed to allocate enough trackers\n"); + goto out; + } + + qpair->act_tr = malloc(sizeof(struct nvme_tracker *) * + qpair->num_entries, M_NVME, M_ZERO | M_WAITOK); + return (0); + +out: + nvme_qpair_destroy(qpair); + return (ENOMEM); } static void @@ -555,25 +590,19 @@ nvme_qpair_destroy(struct nvme_qpair *qpair) if (qpair->tag) bus_teardown_intr(qpair->ctrlr->dev, qpair->res, qpair->tag); + if (mtx_initialized(&qpair->lock)) + mtx_destroy(&qpair->lock); + if (qpair->res) bus_release_resource(qpair->ctrlr->dev, SYS_RES_IRQ, rman_get_rid(qpair->res), qpair->res); - if (qpair->cmd) { - bus_dmamap_unload(qpair->dma_tag, qpair->cmd_dma_map); - bus_dmamap_destroy(qpair->dma_tag, qpair->cmd_dma_map); - contigfree(qpair->cmd, - qpair->num_entries * sizeof(struct nvme_command), M_NVME); + if (qpair->cmd != NULL) { + bus_dmamap_unload(qpair->dma_tag, qpair->queuemem_map); + bus_dmamem_free(qpair->dma_tag, qpair->cmd, + qpair->queuemem_map); } - if (qpair->cpl) { - bus_dmamap_unload(qpair->dma_tag, qpair->cpl_dma_map); - bus_dmamap_destroy(qpair->dma_tag, qpair->cpl_dma_map); - contigfree(qpair->cpl, - qpair->num_entries * sizeof(struct nvme_completion), - M_NVME); - } - if (qpair->dma_tag) bus_dma_tag_destroy(qpair->dma_tag); @@ -587,7 +616,6 @@ nvme_qpair_destroy(struct nvme_qpair *qpair) tr = TAILQ_FIRST(&qpair->free_tr); TAILQ_REMOVE(&qpair->free_tr, tr, tailq); bus_dmamap_destroy(qpair->dma_tag, tr->payload_dma_map); - bus_dmamap_destroy(qpair->dma_tag, tr->prp_dma_map); free(tr, M_NVME); } } From owner-svn-src-all@freebsd.org Thu Feb 1 15:46:58 2018 Return-Path: Delivered-To: svn-src-all@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 2DD51ED9165 for ; Thu, 1 Feb 2018 15:46:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (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 7E87672ADD for ; Thu, 1 Feb 2018 15:46:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22b.google.com with SMTP id d13so19632604iog.5 for ; Thu, 01 Feb 2018 07:46:57 -0800 (PST) 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=RMePzu1KI5ViFiVlYZyFQpbUy5kK7W22S9f8PhUvr7o=; b=VdhWzldbi+OUgDdxSLsgIUnlH8HBFddIgL7rjb/6HQEtamhOXjbtRQDD09vBohWVYQ hT+UUMHuV3wZRgo1OolKeyy1Mi/J3iN6GJX5nosaXFKIBv/1tipxdWRbGxs9UK9Fo7eL NK4/zkcRuM9pb+k5M9kkEkhj8v0/l1PTc6nK5DnV2+c3p0szIRDp+zU3D6EHF7TKyJex d+iD4CTH27LpRDnThYAk+DX3h2hg/PRAmtUPDBMRzVIhx/WlhlsQq0GyC6w2NQWwpH7d o/LeicnrjBQBTwntjvOSQiWt97etcYnp5ZIjBMiAQ06F7MUSeJSJnOMV7MMPQMRv7cmL yjpw== 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=RMePzu1KI5ViFiVlYZyFQpbUy5kK7W22S9f8PhUvr7o=; b=QX13uNkXXvQJtNqQ+eyQS7+/WpjgqzPxZJXXw9apuKNjRe7sROhMl5FknWr2tMfcrw vEYNz0j5o76q8oNbvFJ98Vd0KefEIkBjuf1ss3ZddOTAF9z1ebRq95X0Manrt2DhI6Ss ZieyiOQ1VZgpPPYWpye+ocJ+9qX10kNM82JPaNxhu3as5mVztvIBmVYZ1x6rmyZqlUuB j1dOKhAIVzlO0Ax6fYTKEcOBudgCOLjXgPl+yMUzA/Kp0L+UArWPXdMgbLnOegmLXWqj Tdh9u3ncQtWq6CzNj50JckDBdks9hmAPnhf18RX6jaxB7mY+lYVbIdfpRInDNBwcOjMq uELg== X-Gm-Message-State: AKwxyteQfbp6IgDaD3unrJCtktqR4I8wGRI5P6pgL/wl2xH/yBE/d+QG gSrXZNdbWk+vQm1JB21fmZI24N72dLVUfUkHilQEQw== X-Google-Smtp-Source: AH8x224pLrKYua/kjoWgsw6+Z0QiggA7CQxlNgM3MbYJpr4MXh8qUSZ2ue+K8k03gp1T22YtPL4F9rAy5GTz14UrdrA= X-Received: by 10.107.88.12 with SMTP id m12mr35745317iob.136.1517500016812; Thu, 01 Feb 2018 07:46:56 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 1 Feb 2018 07:46:56 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <35677873-32dc-67a1-6cee-9e300b5d0674@FreeBSD.org> References: <201802011532.w11FWmIa088204@repo.freebsd.org> <35677873-32dc-67a1-6cee-9e300b5d0674@FreeBSD.org> From: Warner Losh Date: Thu, 1 Feb 2018 08:46:56 -0700 X-Google-Sender-Auth: R1ZU1u-p0VsAJDgBdg13jUkga8E Message-ID: Subject: Re: svn commit: r328666 - stable/11/sys/dev/nvme To: Alexander Motin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 15:46:58 -0000 On Thu, Feb 1, 2018 at 8:45 AM, Alexander Motin wrote: > On 01.02.2018 10:35, Warner Losh wrote: > > I'd been specifically not MFC'ing the NVME stuff because I wasn't sure > > that its ABI had jelled yet.... > > > > Be sure to merge everything because there's 0 support for anything but > > the tip of -current for the NVME CAM stuff. > > Sure, as much as ABI permit. I just found that we need some of recent > head changes for some NVMe devices to work, and then found that the code > in area was not merged for a year. I don't like random cherry-picking, There was an ABI breakage in -current that was fixed with this stuff, but if everything is merged, we should be 100% ABI compatible. Please let me know if you think that's not the case. Warner > On Thu, Feb 1, 2018 at 8:32 AM, Alexander Motin > > wrote: > > > > Author: mav > > Date: Thu Feb 1 15:32:48 2018 > > New Revision: 328666 > > URL: https://svnweb.freebsd.org/changeset/base/328666 > > > > > > Log: > > MFC r303466: Kill a few stray debug printfs. > > > > Modified: > > stable/11/sys/dev/nvme/nvme_sim.c > > Directory Properties: > > stable/11/ (props changed) > > > > Modified: stable/11/sys/dev/nvme/nvme_sim.c > > ============================================================ > ================== > > --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 15:32:14 2018 > > (r328665) > > +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 15:32:48 2018 > > (r328666) > > @@ -133,8 +133,6 @@ nvme_sim_action(struct cam_sim *sim, union ccb > *ccb) > > ns = sim2ns(sim); > > ctrlr = sim2ctrlr(sim); > > > > - printf("Sim action: ctrlr %p ns %p\n", ctrlr, ns); > > - > > mtx_assert(&ctrlr->lock, MA_OWNED); > > > > switch (ccb->ccb_h.func_code) { > > @@ -310,8 +308,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void > > *sc_ar > > > > sc->s_ns = ns; > > > > - printf("Our SIM's softc %p ctrlr %p ns %p\n", sc, ctrlr, ns); > > - > > /* > > * XXX this is creating one bus per ns, but it should be one > > * XXX target per controller, and one LUN per namespace. > > @@ -349,7 +345,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void > > *sc_ar > > sc->s_path->device->nvme_cdata = > nvme_ctrlr_get_data(ns->ctrlr); > > > > /* Scan bus */ > > - printf("Initiate rescan of the bus\n"); > > nvme_sim_rescan_target(ctrlr, sc->s_path); > > > > mtx_unlock(&ctrlr->lock); > > > > > > -- > Alexander Motin > From owner-svn-src-all@freebsd.org Thu Feb 1 16:13:29 2018 Return-Path: Delivered-To: svn-src-all@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 85807EDAF38; Thu, 1 Feb 2018 16:13:29 +0000 (UTC) (envelope-from mav@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 381D374377; Thu, 1 Feb 2018 16:13:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32F247477; Thu, 1 Feb 2018 16:13:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GDTqf010403; Thu, 1 Feb 2018 16:13:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GDT24010402; Thu, 1 Feb 2018 16:13:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011613.w11GDT24010402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328668 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:13:29 -0000 Author: mav Date: Thu Feb 1 16:13:28 2018 New Revision: 328668 URL: https://svnweb.freebsd.org/changeset/base/328668 Log: MFC r308850 (by imp): Print numbers instead of hex values for smart data. The full 128-bit number is printed, even though you'd need like a billion IOPs for a 10 billion seconds to overflow the 64-bit counters (~300 years). Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 15:46:19 2018 (r328667) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:13:28 2018 (r328668) @@ -42,7 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#if _BYTE_ORDER != _LITTLE_ENDIAN +#error "Code only works on little endian machines" +#endif + #include "nvmecontrol.h" #define DEFAULT_SIZE (4096) @@ -50,6 +55,38 @@ __FBSDID("$FreeBSD$"); typedef void (*print_fn_t)(void *buf, uint32_t size); + +/* + * 128-bit integer augments to standard values + */ +#define UINT128_DIG 39 +typedef __uint128_t uint128_t; + +static inline uint128_t +to128(void *p) +{ + return *(uint128_t *)p; +} + +static char * +uint128_to_str(uint128_t u, char *buf, size_t buflen) +{ + char *end = buf + buflen - 1; + + *end-- = '\0'; + if (u == 0) + *end-- = '0'; + while (u && end >= buf) { + *end-- = u % 10 + '0'; + u /= 10; + } + end++; + if (u != 0) + return NULL; + + return end; +} + static void * get_log_buffer(uint32_t size) { @@ -128,6 +165,7 @@ static void print_log_health(void *buf, uint32_t size __unused) { struct nvme_health_information_page *health = buf; + char cbuf[UINT128_DIG + 1]; printf("SMART/Health Information Log\n"); printf("============================\n"); @@ -155,40 +193,26 @@ print_log_health(void *buf, uint32_t size __unused) printf("Percentage used: %u\n", health->percentage_used); - /* - * TODO: These are pretty ugly in hex. Is there a library that - * will convert 128-bit unsigned values to decimal? - */ - printf("Data units (512 byte) read: 0x%016jx%016jx\n", - health->data_units_read[1], - health->data_units_read[0]); - printf("Data units (512 byte) written: 0x%016jx%016jx\n", - health->data_units_written[1], - health->data_units_written[0]); - printf("Host read commands: 0x%016jx%016jx\n", - health->host_read_commands[1], - health->host_read_commands[0]); - printf("Host write commands: 0x%016jx%016jx\n", - health->host_write_commands[1], - health->host_write_commands[0]); - printf("Controller busy time (minutes): 0x%016jx%016jx\n", - health->controller_busy_time[1], - health->controller_busy_time[0]); - printf("Power cycles: 0x%016jx%016jx\n", - health->power_cycles[1], - health->power_cycles[0]); - printf("Power on hours: 0x%016jx%016jx\n", - health->power_on_hours[1], - health->power_on_hours[0]); - printf("Unsafe shutdowns: 0x%016jx%016jx\n", - health->unsafe_shutdowns[1], - health->unsafe_shutdowns[0]); - printf("Media errors: 0x%016jx%016jx\n", - health->media_errors[1], - health->media_errors[0]); - printf("No. error info log entries: 0x%016jx%016jx\n", - health->num_error_info_log_entries[1], - health->num_error_info_log_entries[0]); + printf("Data units (512,000 byte) read: %s\n", + uint128_to_str(to128(health->data_units_read), cbuf, sizeof(cbuf))); + printf("Data units (512,000 byte) written: %s\n", + uint128_to_str(to128(health->data_units_written), cbuf, sizeof(cbuf))); + printf("Host read commands: %s\n", + uint128_to_str(to128(health->host_read_commands), cbuf, sizeof(cbuf))); + printf("Host write commands: %s\n", + uint128_to_str(to128(health->host_write_commands), cbuf, sizeof(cbuf))); + printf("Controller busy time (minutes): %s\n", + uint128_to_str(to128(health->controller_busy_time), cbuf, sizeof(cbuf))); + printf("Power cycles: %s\n", + uint128_to_str(to128(health->power_cycles), cbuf, sizeof(cbuf))); + printf("Power on hours: %s\n", + uint128_to_str(to128(health->power_on_hours), cbuf, sizeof(cbuf))); + printf("Unsafe shutdowns: %s\n", + uint128_to_str(to128(health->unsafe_shutdowns), cbuf, sizeof(cbuf))); + printf("Media errors: %s\n", + uint128_to_str(to128(health->media_errors), cbuf, sizeof(cbuf))); + printf("No. error info log entries: %s\n", + uint128_to_str(to128(health->num_error_info_log_entries), cbuf, sizeof(cbuf))); } static void From owner-svn-src-all@freebsd.org Thu Feb 1 16:15:04 2018 Return-Path: Delivered-To: svn-src-all@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 3427BEDB143; Thu, 1 Feb 2018 16:15:04 +0000 (UTC) (envelope-from mav@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 DB74F74588; Thu, 1 Feb 2018 16:15:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D66D1747B; Thu, 1 Feb 2018 16:15:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GF3Nq010526; Thu, 1 Feb 2018 16:15:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GF34V010524; Thu, 1 Feb 2018 16:15:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011615.w11GF34V010524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:15:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328669 - in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Commit-Revision: 328669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:15:04 -0000 Author: mav Date: Thu Feb 1 16:15:03 2018 New Revision: 328669 URL: https://svnweb.freebsd.org/changeset/base/328669 Log: MFC r308851 (by imp): Expand the SMART / Health Information Log Page (Page 02) printout based on NVM Express 1.2.1 Standard. Modified: stable/11/sbin/nvmecontrol/logpage.c stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:13:28 2018 (r328668) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:15:03 2018 (r328669) @@ -162,10 +162,18 @@ print_log_error(void *buf, uint32_t size) } static void +print_temp(uint16_t t) +{ + printf("%u K, %2.2f C, %3.2f F\n", t, (float)t - 273.15, (float)t * 9 / 5 - 459.67); +} + + +static void print_log_health(void *buf, uint32_t size __unused) { struct nvme_health_information_page *health = buf; char cbuf[UINT128_DIG + 1]; + int i; printf("SMART/Health Information Log\n"); printf("============================\n"); @@ -182,10 +190,8 @@ print_log_health(void *buf, uint32_t size __unused) health->critical_warning.bits.read_only); printf(" Volatile memory backup: %d\n", health->critical_warning.bits.volatile_memory_backup); - printf("Temperature: %u K, %2.2f C, %3.2f F\n", - health->temperature, - (float)health->temperature - (float)273.15, - ((float)health->temperature * (float)9/5) - (float)459.67); + printf("Temperature: "); + print_temp(health->temperature); printf("Available spare: %u\n", health->available_spare); printf("Available spare threshold: %u\n", @@ -193,9 +199,9 @@ print_log_health(void *buf, uint32_t size __unused) printf("Percentage used: %u\n", health->percentage_used); - printf("Data units (512,000 byte) read: %s\n", + printf("Data units (512,000 byte) read: %s\n", uint128_to_str(to128(health->data_units_read), cbuf, sizeof(cbuf))); - printf("Data units (512,000 byte) written: %s\n", + printf("Data units written: %s\n", uint128_to_str(to128(health->data_units_written), cbuf, sizeof(cbuf))); printf("Host read commands: %s\n", uint128_to_str(to128(health->host_read_commands), cbuf, sizeof(cbuf))); @@ -213,6 +219,15 @@ print_log_health(void *buf, uint32_t size __unused) uint128_to_str(to128(health->media_errors), cbuf, sizeof(cbuf))); printf("No. error info log entries: %s\n", uint128_to_str(to128(health->num_error_info_log_entries), cbuf, sizeof(cbuf))); + + printf("Warning Temp Composite Time: %d\n", health->warning_temp_time); + printf("Error Temp Composite Time: %d\n", health->error_temp_time); + for (i = 0; i < 7; i++) { + if (health->temp_sensor[i] == 0) + continue; + printf("Temperature Sensor %d: ", i + 1); + print_temp(health->temp_sensor[i]); + } } static void Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:13:28 2018 (r328668) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:15:03 2018 (r328669) @@ -724,8 +724,11 @@ struct nvme_health_information_page { uint64_t unsafe_shutdowns[2]; uint64_t media_errors[2]; uint64_t num_error_info_log_entries[2]; + uint32_t warning_temp_time; + uint32_t error_temp_time; + uint16_t temp_sensor[8]; - uint8_t reserved2[320]; + uint8_t reserved2[296]; } __packed __aligned(4); struct nvme_firmware_page { From owner-svn-src-all@freebsd.org Thu Feb 1 16:15:40 2018 Return-Path: Delivered-To: svn-src-all@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 79347EDB211; Thu, 1 Feb 2018 16:15:40 +0000 (UTC) (envelope-from mav@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 27376746DF; Thu, 1 Feb 2018 16:15:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22499747D; Thu, 1 Feb 2018 16:15:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GFemZ010611; Thu, 1 Feb 2018 16:15:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GFe9j010610; Thu, 1 Feb 2018 16:15:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011615.w11GFe9j010610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328670 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:15:40 -0000 Author: mav Date: Thu Feb 1 16:15:39 2018 New Revision: 328670 URL: https://svnweb.freebsd.org/changeset/base/328670 Log: MFC r308852 (by imp): Add log pages defined through NVM Express 1.2.1. Modified: stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:15:03 2018 (r328669) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:15:39 2018 (r328670) @@ -663,8 +663,11 @@ enum nvme_log_page { NVME_LOG_ERROR = 0x01, NVME_LOG_HEALTH_INFORMATION = 0x02, NVME_LOG_FIRMWARE_SLOT = 0x03, - /* 0x04-0x7F - reserved */ + NVME_LOG_CHANGED_NAMESPACE = 0x04, + NVME_LOG_COMMAND_EFFECT = 0x05, + /* 0x06-0x7F - reserved */ /* 0x80-0xBF - I/O command set specific */ + NVME_LOG_RES_NOTIFICATION = 0x80 /* 0xC0-0xFF - vendor specific */ }; From owner-svn-src-all@freebsd.org Thu Feb 1 16:16:09 2018 Return-Path: Delivered-To: svn-src-all@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 AA452EDB2B1; Thu, 1 Feb 2018 16:16:09 +0000 (UTC) (envelope-from mav@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 5DB6D7480D; Thu, 1 Feb 2018 16:16:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58A61747E; Thu, 1 Feb 2018 16:16:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GG9Cf010684; Thu, 1 Feb 2018 16:16:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GG93u010683; Thu, 1 Feb 2018 16:16:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011616.w11GG93u010683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328671 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:16:09 -0000 Author: mav Date: Thu Feb 1 16:16:09 2018 New Revision: 328671 URL: https://svnweb.freebsd.org/changeset/base/328671 Log: MFC r308853 (by imp): Add log pages that Intel SSDs provide. It turns out that many of these are widely implemented beyond just Intel drives. Modified: stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:15:39 2018 (r328670) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:16:09 2018 (r328671) @@ -667,8 +667,18 @@ enum nvme_log_page { NVME_LOG_COMMAND_EFFECT = 0x05, /* 0x06-0x7F - reserved */ /* 0x80-0xBF - I/O command set specific */ - NVME_LOG_RES_NOTIFICATION = 0x80 + NVME_LOG_RES_NOTIFICATION = 0x80, /* 0xC0-0xFF - vendor specific */ +/* + * The following are Intel Specific log pages, but they seem to + * be widely implemented. + */ + INTEL_LOG_READ_LAT_LOG = 0xc1, + INTEL_LOG_WRITE_LAT_LOG = 0xc2, + INTEL_LOG_TEMP_STATS = 0xc5, + INTEL_LOG_ADD_SMART = 0xca, + INTEL_LOG_DRIVE_MKT_NAME = 0xdd, + }; struct nvme_error_information_entry { From owner-svn-src-all@freebsd.org Thu Feb 1 16:20:45 2018 Return-Path: Delivered-To: svn-src-all@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 EA1AEEDB75E; Thu, 1 Feb 2018 16:20:44 +0000 (UTC) (envelope-from mav@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 A047474B91; Thu, 1 Feb 2018 16:20:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AEAB7495; Thu, 1 Feb 2018 16:20:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GKi2j010957; Thu, 1 Feb 2018 16:20:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GKi4F010956; Thu, 1 Feb 2018 16:20:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011620.w11GKi4F010956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328672 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:20:45 -0000 Author: mav Date: Thu Feb 1 16:20:44 2018 New Revision: 328672 URL: https://svnweb.freebsd.org/changeset/base/328672 Log: MFC r308849 (by imp): Use a table for pages we know the size of. We have a special case for the error log since it isn't a fixed size. Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:16:09 2018 (r328671) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:20:44 2018 (r328672) @@ -261,12 +261,17 @@ print_log_firmware(void *buf, uint32_t size __unused) static struct logpage_function { uint8_t log_page; - print_fn_t fn; + print_fn_t print_fn; + size_t size; } logfuncs[] = { - {NVME_LOG_ERROR, print_log_error }, - {NVME_LOG_HEALTH_INFORMATION, print_log_health }, - {NVME_LOG_FIRMWARE_SLOT, print_log_firmware }, - {0, NULL }, + {NVME_LOG_ERROR, print_log_error, + 0}, + {NVME_LOG_HEALTH_INFORMATION, print_log_health, + sizeof(struct nvme_health_information_page)}, + {NVME_LOG_FIRMWARE_SLOT, print_log_firmware, + sizeof(struct nvme_firmware_page)}, + {0, NULL, + 0}, }; static void @@ -355,6 +360,7 @@ logpage(int argc, char *argv[]) } print_fn = print_hex; + size = DEFAULT_SIZE; if (!hexflag) { /* * See if there is a pretty print function for the @@ -364,30 +370,20 @@ logpage(int argc, char *argv[]) f = logfuncs; while (f->log_page > 0) { if (log_page == f->log_page) { - print_fn = f->fn; + print_fn = f->print_fn; + size = f->size; break; } f++; } } - /* Read the log page */ - switch (log_page) { - case NVME_LOG_ERROR: + if (log_page == NVME_LOG_ERROR) { size = sizeof(struct nvme_error_information_entry); size *= (cdata.elpe + 1); - break; - case NVME_LOG_HEALTH_INFORMATION: - size = sizeof(struct nvme_health_information_page); - break; - case NVME_LOG_FIRMWARE_SLOT: - size = sizeof(struct nvme_firmware_page); - break; - default: - size = DEFAULT_SIZE; - break; } + /* Read the log page */ buf = get_log_buffer(size); read_logpage(fd, log_page, nsid, buf, size); print_fn(buf, size); From owner-svn-src-all@freebsd.org Thu Feb 1 16:21:46 2018 Return-Path: Delivered-To: svn-src-all@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 0E1BDEDB952; Thu, 1 Feb 2018 16:21:46 +0000 (UTC) (envelope-from mav@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 B562C74DBA; Thu, 1 Feb 2018 16:21:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B045A75E4; Thu, 1 Feb 2018 16:21:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GLjvT013202; Thu, 1 Feb 2018 16:21:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GLjVq013200; Thu, 1 Feb 2018 16:21:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011621.w11GLjVq013200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:21:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328673 - in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Commit-Revision: 328673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:21:46 -0000 Author: mav Date: Thu Feb 1 16:21:45 2018 New Revision: 328673 URL: https://svnweb.freebsd.org/changeset/base/328673 Log: MFC r308854 (by imp): Print Intel's expanded Temperature log page. Modified: stable/11/sbin/nvmecontrol/logpage.c stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:20:44 2018 (r328672) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:21:45 2018 (r328673) @@ -100,7 +100,7 @@ get_log_buffer(uint32_t size) } void -read_logpage(int fd, uint8_t log_page, int nsid, void *payload, +read_logpage(int fd, uint8_t log_page, int nsid, void *payload, uint32_t payload_size) { struct nvme_pt_command pt; @@ -259,6 +259,35 @@ print_log_firmware(void *buf, uint32_t size __unused) } } +static void +print_intel_temp_stats(void *buf, uint32_t size __unused) +{ + struct intel_log_temp_stats *temp = buf; + + printf("Intel Temperature Log\n"); + printf("=====================\n"); + + printf("Current: "); + print_temp(temp->current); + printf("Overtemp Last Flags %#jx\n", (uintmax_t)temp->overtemp_flag_last); + printf("Overtemp Lifetime Flags %#jx\n", (uintmax_t)temp->overtemp_flag_life); + printf("Max Temperature "); + print_temp(temp->max_temp); + printf("Min Temperature "); + print_temp(temp->min_temp); + printf("Max Operating Temperature "); + print_temp(temp->max_oper_temp); + printf("Min Operating Temperature "); + print_temp(temp->min_oper_temp); + printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); +} + +/* + * Table of log page printer / sizing. + * + * This includes Intel specific pages that are widely implemented. Not + * sure how best to switch between different vendors. + */ static struct logpage_function { uint8_t log_page; print_fn_t print_fn; @@ -270,6 +299,8 @@ static struct logpage_function { sizeof(struct nvme_health_information_page)}, {NVME_LOG_FIRMWARE_SLOT, print_log_firmware, sizeof(struct nvme_firmware_page)}, + {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, + sizeof(struct intel_log_temp_stats)}, {0, NULL, 0}, }; Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:20:44 2018 (r328672) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:21:45 2018 (r328673) @@ -670,7 +670,7 @@ enum nvme_log_page { NVME_LOG_RES_NOTIFICATION = 0x80, /* 0xC0-0xFF - vendor specific */ /* - * The following are Intel Specific log pages, but they seem to + * The following are Intel Specific log pages, but they seem to * be widely implemented. */ INTEL_LOG_READ_LAT_LOG = 0xc1, @@ -754,6 +754,19 @@ struct nvme_firmware_page { uint8_t reserved[7]; uint64_t revision[7]; /* revisions for 7 slots */ uint8_t reserved2[448]; +} __packed __aligned(4); + +struct intel_log_temp_stats +{ + uint64_t current; + uint64_t overtemp_flag_last; + uint64_t overtemp_flag_life; + uint64_t max_temp; + uint64_t min_temp; + uint64_t _rsvd[5]; + uint64_t max_oper_temp; + uint64_t min_oper_temp; + uint64_t est_offset; } __packed __aligned(4); #define NVME_TEST_MAX_THREADS 128 From owner-svn-src-all@freebsd.org Thu Feb 1 16:22:29 2018 Return-Path: Delivered-To: svn-src-all@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 7C1A0EDBA4E; Thu, 1 Feb 2018 16:22:29 +0000 (UTC) (envelope-from mav@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 2FEE375086; Thu, 1 Feb 2018 16:22:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1082C7619; Thu, 1 Feb 2018 16:22:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GMScB015665; Thu, 1 Feb 2018 16:22:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GMSHs015663; Thu, 1 Feb 2018 16:22:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011622.w11GMSHs015663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328674 - in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sbin/nvmecontrol sys/dev/nvme X-SVN-Commit-Revision: 328674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:22:29 -0000 Author: mav Date: Thu Feb 1 16:22:28 2018 New Revision: 328674 URL: https://svnweb.freebsd.org/changeset/base/328674 Log: MFC r308855 (by imp): Implement HGST Log page 0xc1, as documented in the HGST SN100 and SN150 product manuals. Subpage 0x32 is documented, but not implemented. Modified: stable/11/sbin/nvmecontrol/logpage.c stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:21:45 2018 (r328673) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 16:22:28 2018 (r328674) @@ -56,6 +56,25 @@ __FBSDID("$FreeBSD$"); typedef void (*print_fn_t)(void *buf, uint32_t size); +struct kv_name +{ + uint32_t key; + const char *name; +}; + +static const char * +kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key) +{ + static char bad[32]; + size_t i; + + for (i = 0; i < kv_count; i++, kv++) + if (kv->key == key) + return kv->name; + snprintf(bad, sizeof(bad), "Attribute %#x", key); + return bad; +} + /* * 128-bit integer augments to standard values */ @@ -283,6 +302,405 @@ print_intel_temp_stats(void *buf, uint32_t size __unus } /* + * HGST's 0xc1 page. This is a grab bag of additional data. Please see + * https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf + * https://www.hgst.com/sites/default/files/resources/US_SN100_ProdManual.pdf + * Appendix A for details + */ + +typedef void (*subprint_fn_t)(void *buf, uint16_t subtype, uint8_t res, uint32_t size); + +struct subpage_print +{ + uint16_t key; + subprint_fn_t fn; +}; + +static void print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_self_test(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_background_scan(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_erase_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_temp_history(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_ssd_perf(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_firmware_load(void *buf, uint16_t subtype, uint8_t res, uint32_t size); + +static struct subpage_print hgst_subpage[] = { + { 0x02, print_hgst_info_write_errors }, + { 0x03, print_hgst_info_read_errors }, + { 0x05, print_hgst_info_verify_errors }, + { 0x10, print_hgst_info_self_test }, + { 0x15, print_hgst_info_background_scan }, + { 0x30, print_hgst_info_erase_errors }, + { 0x31, print_hgst_info_erase_counts }, + { 0x32, print_hgst_info_temp_history }, + { 0x37, print_hgst_info_ssd_perf }, + { 0x38, print_hgst_info_firmware_load }, +}; + +/* Print a subpage that is basically just key value pairs */ +static void +print_hgst_info_subpage_gen(void *buf, uint16_t subtype __unused, uint32_t size, + const struct kv_name *kv, size_t kv_count) +{ + uint8_t *wsp, *esp; + uint16_t ptype; + uint8_t plen; + uint64_t param; + int i; + + wsp = buf; + esp = wsp + size; + while (wsp < esp) { + ptype = le16dec(wsp); + wsp += 2; + wsp++; /* Flags, just ignore */ + plen = *wsp++; + param = 0; + for (i = 0; i < plen; i++) + param |= (uint64_t)*wsp++ << (i * 8); + printf(" %-30s: %jd\n", kv_lookup(kv, kv_count, ptype), (uintmax_t)param); + } +} + +static void +print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Writes" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Write Commands" }, + { 0x8001, "HGST Special" }, + }; + + printf("Write Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Reads" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Read Commands" }, + { 0x8001, "XOR Recovered" }, + { 0x8002, "Total Corrected Bits" }, + }; + + printf("Read Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Reads" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Commands Processed" }, + }; + + printf("Verify Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_self_test(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + size_t i; + uint8_t *walker = buf; + uint16_t code, hrs; + uint32_t lba; + + printf("Self Test Subpage:\n"); + for (i = 0; i < size / 20; i++) { /* Each entry is 20 bytes */ + code = le16dec(walker); + walker += 2; + walker++; /* Ignore fixed flags */ + if (*walker == 0) /* Last entry is zero length */ + break; + if (*walker++ != 0x10) { + printf("Bad length for self test report\n"); + return; + } + printf(" %-30s: %d\n", "Recent Test", code); + printf(" %-28s: %#x\n", "Self-Test Results", *walker & 0xf); + printf(" %-28s: %#x\n", "Self-Test Code", (*walker >> 5) & 0x7); + walker++; + printf(" %-28s: %#x\n", "Self-Test Number", *walker++); + hrs = le16dec(walker); + walker += 2; + lba = le32dec(walker); + walker += 4; + printf(" %-28s: %u\n", "Total Power On Hrs", hrs); + printf(" %-28s: %#jx (%jd)\n", "LBA", (uintmax_t)lba, (uintmax_t)lba); + printf(" %-28s: %#x\n", "Sense Key", *walker++ & 0xf); + printf(" %-28s: %#x\n", "Additional Sense Code", *walker++); + printf(" %-28s: %#x\n", "Additional Sense Qualifier", *walker++); + printf(" %-28s: %#x\n", "Vendor Specific Detail", *walker++); + } +} + +static void +print_hgst_info_background_scan(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + uint8_t *walker = buf; + uint8_t status; + uint16_t code, nscan, progress; + uint32_t pom, nand; + + printf("Background Media Scan Subpage:\n"); + /* Decode the header */ + code = le16dec(walker); + walker += 2; + walker++; /* Ignore fixed flags */ + if (*walker++ != 0x10) { + printf("Bad length for background scan header\n"); + return; + } + if (code != 0) { + printf("Expceted code 0, found code %#x\n", code); + return; + } + pom = le32dec(walker); + walker += 4; + walker++; /* Reserved */ + status = *walker++; + nscan = le16dec(walker); + walker += 2; + progress = le16dec(walker); + walker += 2; + walker += 6; /* Reserved */ + printf(" %-30s: %d\n", "Power On Minutes", pom); + printf(" %-30s: %x (%s)\n", "BMS Status", status, + status == 0 ? "idle" : (status == 1 ? "active" : (status == 8 ? "suspended" : "unknown"))); + printf(" %-30s: %d\n", "Number of BMS", nscan); + printf(" %-30s: %d\n", "Progress Current BMS", progress); + /* Report retirements */ + if (walker - (uint8_t *)buf != 20) { + printf("Coding error, offset not 20\n"); + return; + } + size -= 20; + printf(" %-30s: %d\n", "BMS retirements", size / 0x18); + while (size > 0) { + code = le16dec(walker); + walker += 2; + walker++; + if (*walker++ != 0x14) { + printf("Bad length parameter\n"); + return; + } + pom = le32dec(walker); + walker += 4; + /* + * Spec sheet says the following are hard coded, if true, just + * print the NAND retirement. + */ + if (walker[0] == 0x41 && + walker[1] == 0x0b && + walker[2] == 0x01 && + walker[3] == 0x00 && + walker[4] == 0x00 && + walker[5] == 0x00 && + walker[6] == 0x00 && + walker[7] == 0x00) { + walker += 8; + walker += 4; /* Skip reserved */ + nand = le32dec(walker); + walker += 4; + printf(" %-30s: %d\n", "Retirement number", code); + printf(" %-28s: %#x\n", "NAND (C/T)BBBPPP", nand); + } else { + printf("Parameter %#x entry corrupt\n", code); + walker += 16; + } + } +} + +static void +print_hgst_info_erase_errors(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Erase" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Erase Commands" }, + { 0x8001, "Mfg Defect Count" }, + { 0x8002, "Grown Defect Count" }, + { 0x8003, "Erase Count -- User" }, + { 0x8004, "Erase Count -- System" }, + }; + + printf("Erase Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + /* My drive doesn't export this -- so not coding up */ + printf("XXX: Erase counts subpage: %p, %#x %d\n", buf, subtype, size); +} + +static void +print_hgst_info_temp_history(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint32_t min; + + printf("Temperature History:\n"); + printf(" %-30s: %d C\n", "Current Temperature", *walker++); + printf(" %-30s: %d C\n", "Reference Temperature", *walker++); + printf(" %-30s: %d C\n", "Maximum Temperature", *walker++); + printf(" %-30s: %d C\n", "Minimum Temperature", *walker++); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Max Temperture Time", min / 60, min % 60); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Over Temperture Duration", min / 60, min % 60); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Min Temperture Time", min / 60, min % 60); +} + +static void +print_hgst_info_ssd_perf(void *buf, uint16_t subtype __unused, uint8_t res, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint64_t val; + + printf("SSD Performance Subpage Type %d:\n", res); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Cache Read Hits Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Cache Read Hits Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Commands Stalled", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Odd Start Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Odd End Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Commands Stalled", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Write Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Write Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Before Writes", val); +} + +static void +print_hgst_info_firmware_load(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) +{ + uint8_t *walker = buf; + + printf("Firmware Load Subpage:\n"); + printf(" %-30s: %d\n", "Firmware Downloads", le32dec(walker)); +} + +static void +kv_indirect(void *buf, uint32_t subtype, uint8_t res, uint32_t size, struct subpage_print *sp, size_t nsp) +{ + size_t i; + + for (i = 0; i < nsp; i++, sp++) { + if (sp->key == subtype) { + sp->fn(buf, subtype, res, size); + return; + } + } + printf("No handler for page type %x\n", subtype); +} + +static void +print_hgst_info_log(void *buf, uint32_t size __unused) +{ + uint8_t *walker, *end, *subpage; + int pages; + uint16_t len; + uint8_t subtype, res; + + printf("HGST Extra Info Log\n"); + printf("===================\n"); + + walker = buf; + pages = *walker++; + walker++; + len = le16dec(walker); + walker += 2; + end = walker + len; /* Length is exclusive of this header */ + + while (walker < end) { + subpage = walker + 4; + subtype = *walker++ & 0x3f; /* subtype */ + res = *walker++; /* Reserved */ + len = le16dec(walker); + walker += len + 2; /* Length, not incl header */ + if (walker > end) { + printf("Ooops! Off the end of the list\n"); + break; + } + kv_indirect(subpage, subtype, res, len, hgst_subpage, nitems(hgst_subpage)); + } +} + +/* * Table of log page printer / sizing. * * This includes Intel specific pages that are widely implemented. Not @@ -301,6 +719,8 @@ static struct logpage_function { sizeof(struct nvme_firmware_page)}, {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, + {HGST_INFO_LOG, print_hgst_info_log, + DEFAULT_SIZE}, {0, NULL, 0}, }; Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:21:45 2018 (r328673) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:22:28 2018 (r328674) @@ -669,16 +669,21 @@ enum nvme_log_page { /* 0x80-0xBF - I/O command set specific */ NVME_LOG_RES_NOTIFICATION = 0x80, /* 0xC0-0xFF - vendor specific */ -/* - * The following are Intel Specific log pages, but they seem to - * be widely implemented. - */ + + /* + * The following are Intel Specific log pages, but they seem + * to be widely implemented. + */ INTEL_LOG_READ_LAT_LOG = 0xc1, INTEL_LOG_WRITE_LAT_LOG = 0xc2, INTEL_LOG_TEMP_STATS = 0xc5, INTEL_LOG_ADD_SMART = 0xca, INTEL_LOG_DRIVE_MKT_NAME = 0xdd, + /* + * HGST log page, with lots ofs sub pages. + */ + HGST_INFO_LOG = 0xc1, }; struct nvme_error_information_entry { From owner-svn-src-all@freebsd.org Thu Feb 1 16:24:04 2018 Return-Path: Delivered-To: svn-src-all@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 5DA87EDBC1E; Thu, 1 Feb 2018 16:24:04 +0000 (UTC) (envelope-from mav@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 30A8A752BE; Thu, 1 Feb 2018 16:24:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BB027623; Thu, 1 Feb 2018 16:24:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GO4Lt015790; Thu, 1 Feb 2018 16:24:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GO4IA015789; Thu, 1 Feb 2018 16:24:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011624.w11GO4IA015789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328675 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:24:04 -0000 Author: mav Date: Thu Feb 1 16:24:03 2018 New Revision: 328675 URL: https://svnweb.freebsd.org/changeset/base/328675 Log: MFC r313113 (by imp): Ensure that the passthrough request will fit in MAXPHYS bytes after it has been rounded to full pages. This avoids a panic in vm_fault_quick_hold_pages due to this off-by-one error passing one page too many into vmapbuf. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:22:28 2018 (r328674) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:24:03 2018 (r328675) @@ -874,8 +874,20 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr struct mtx *mtx; struct buf *buf = NULL; int ret = 0; + vm_offset_t addr, end; if (pt->len > 0) { + /* + * vmapbuf calls vm_fault_quick_hold_pages which only maps full + * pages. Ensure this request has fewer than MAXPHYS bytes when + * extended to full pages. + */ + addr = (vm_offset_t)pt->buf; + end = round_page(addr + pt->len); + addr = trunc_page(addr); + if (end - addr > MAXPHYS) + return EIO; + if (pt->len > ctrlr->max_xfer_size) { nvme_printf(ctrlr, "pt->len (%d) " "exceeds max_xfer_size (%d)\n", pt->len, From owner-svn-src-all@freebsd.org Thu Feb 1 16:26:36 2018 Return-Path: Delivered-To: svn-src-all@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 A6B01EDBDF7; Thu, 1 Feb 2018 16:26:36 +0000 (UTC) (envelope-from mav@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 4F7A1754E5; Thu, 1 Feb 2018 16:26:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44F297625; Thu, 1 Feb 2018 16:26:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GQahh015949; Thu, 1 Feb 2018 16:26:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GQZWh015946; Thu, 1 Feb 2018 16:26:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011626.w11GQZWh015946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328676 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:26:37 -0000 Author: mav Date: Thu Feb 1 16:26:35 2018 New Revision: 328676 URL: https://svnweb.freebsd.org/changeset/base/328676 Log: MFC r314884 (by imp): Make multi-namespace nvme drives more robust. Fix assumptions about name spaces in NVME driver. First, it assumes cdata.nn is the number of configured devices. However, it is the number of supported name spaces. Second, it assumes that there will never be more than 16 name spaces supported, but a certain drive I'm testing reports 1024. It assumes that name spaces are a tightly packed namespace, but the standard seems to indicate otherwise. Finally, it assumes that an error would be generated when quearying an unconfigured namespace. Instead, it succeeds but the identify data is all zeros. Fix these by limiting the number of name spaces we probe to 16. Remove aborting when we find one in error. When the size of the name space is zero, ignore it. This is admittedly a bandaide. The long term fix will be to participate in the enumeration and name space change protocols definfed in the NVNe standard. Modified: stable/11/sys/dev/nvme/nvme.c stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_ns.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.c ============================================================================== --- stable/11/sys/dev/nvme/nvme.c Thu Feb 1 16:24:03 2018 (r328675) +++ stable/11/sys/dev/nvme/nvme.c Thu Feb 1 16:26:35 2018 (r328676) @@ -328,8 +328,10 @@ nvme_notify(struct nvme_consumer *cons, */ return; } - for (ns_idx = 0; ns_idx < ctrlr->cdata.nn; ns_idx++) { + for (ns_idx = 0; ns_idx < min(ctrlr->cdata.nn, NVME_MAX_NAMESPACES); ns_idx++) { ns = &ctrlr->ns[ns_idx]; + if (ns->data.nsze == 0) + continue; if (cons->ns_fn != NULL) ns->cons_cookie[cons->id] = (*cons->ns_fn)(ns, ctrlr_cookie); Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:24:03 2018 (r328675) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:26:35 2018 (r328676) @@ -458,13 +458,11 @@ static int nvme_ctrlr_construct_namespaces(struct nvme_controller *ctrlr) { struct nvme_namespace *ns; - int i, status; + int i; - for (i = 0; i < ctrlr->cdata.nn; i++) { + for (i = 0; i < min(ctrlr->cdata.nn, NVME_MAX_NAMESPACES); i++) { ns = &ctrlr->ns[i]; - status = nvme_ns_construct(ns, i+1, ctrlr); - if (status != 0) - return (status); + nvme_ns_construct(ns, i+1, ctrlr); } return (0); Modified: stable/11/sys/dev/nvme/nvme_ns.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ns.c Thu Feb 1 16:24:03 2018 (r328675) +++ stable/11/sys/dev/nvme/nvme_ns.c Thu Feb 1 16:26:35 2018 (r328676) @@ -512,13 +512,22 @@ nvme_ns_construct(struct nvme_namespace *ns, uint16_t } /* + * If the size of is zero, chances are this isn't a valid + * namespace (eg one that's not been configured yet). The + * standard says the entire id will be zeros, so this is a + * cheap way to test for that. + */ + if (ns->data.nsze == 0) + return (ENXIO); + + /* * Note: format is a 0-based value, so > is appropriate here, * not >=. */ if (ns->data.flbas.format > ns->data.nlbaf) { printf("lba format %d exceeds number supported (%d)\n", ns->data.flbas.format, ns->data.nlbaf+1); - return (1); + return (ENXIO); } if (ctrlr->cdata.oncs.dsm) From owner-svn-src-all@freebsd.org Thu Feb 1 16:27:11 2018 Return-Path: Delivered-To: svn-src-all@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 1AE7AEDBEC5; Thu, 1 Feb 2018 16:27:11 +0000 (UTC) (envelope-from mav@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 C463875656; Thu, 1 Feb 2018 16:27:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF66E7627; Thu, 1 Feb 2018 16:27:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GRAYF016026; Thu, 1 Feb 2018 16:27:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GRApl016023; Thu, 1 Feb 2018 16:27:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011627.w11GRApl016023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328677 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:27:11 -0000 Author: mav Date: Thu Feb 1 16:27:10 2018 New Revision: 328677 URL: https://svnweb.freebsd.org/changeset/base/328677 Log: MFC r314889 (by imp): Avoid dereferencing unintialized elements in the error path. Some drives sometimes have errors for things like setting the number of queue entries in the submission queue. The error paths taken for these drives ensure a panic dereferencing uninialized data. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_qpair.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:26:35 2018 (r328676) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:27:10 2018 (r328677) @@ -193,8 +193,10 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr) ctrlr->is_failed = TRUE; nvme_qpair_fail(&ctrlr->adminq); - for (i = 0; i < ctrlr->num_io_queues; i++) - nvme_qpair_fail(&ctrlr->ioq[i]); + if (ctrlr->ioq != NULL) { + for (i = 0; i < ctrlr->num_io_queues; i++) + nvme_qpair_fail(&ctrlr->ioq[i]); + } nvme_notify_fail_consumers(ctrlr); } @@ -397,7 +399,7 @@ nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrl while (status.done == FALSE) pause("nvme", 1); if (nvme_completion_is_error(&status.cpl)) { - nvme_printf(ctrlr, "nvme_set_num_queues failed!\n"); + nvme_printf(ctrlr, "nvme_ctrlr_set_num_qpairs failed!\n"); return (ENXIO); } Modified: stable/11/sys/dev/nvme/nvme_qpair.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 16:26:35 2018 (r328676) +++ stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 16:27:10 2018 (r328677) @@ -1000,6 +1000,9 @@ nvme_qpair_fail(struct nvme_qpair *qpair) struct nvme_tracker *tr; struct nvme_request *req; + if (!mtx_initialized(&qpair->lock)) + return; + mtx_lock(&qpair->lock); while (!STAILQ_EMPTY(&qpair->queued_req)) { From owner-svn-src-all@freebsd.org Thu Feb 1 16:27:50 2018 Return-Path: Delivered-To: svn-src-all@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 BC713EDBFA4; Thu, 1 Feb 2018 16:27:50 +0000 (UTC) (envelope-from mav@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 6F7E875797; Thu, 1 Feb 2018 16:27:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 504987628; Thu, 1 Feb 2018 16:27:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GRo9i016106; Thu, 1 Feb 2018 16:27:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GRoIT016105; Thu, 1 Feb 2018 16:27:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011627.w11GRoIT016105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:27:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328678 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:27:51 -0000 Author: mav Date: Thu Feb 1 16:27:50 2018 New Revision: 328678 URL: https://svnweb.freebsd.org/changeset/base/328678 Log: MFC r320424 (by imp): Add new definitions for namespaces. Modified: stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:27:10 2018 (r328677) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:27:50 2018 (r328678) @@ -341,9 +341,11 @@ enum nvme_admin_opcode { NVME_OPC_GET_FEATURES = 0x0a, /* 0x0b - reserved */ NVME_OPC_ASYNC_EVENT_REQUEST = 0x0c, - /* 0x0d-0x0f - reserved */ + NVME_OPC_NAMESPACE_MANAGEMENT = 0x0d, + /* 0x0e-0x0f - reserved */ NVME_OPC_FIRMWARE_ACTIVATE = 0x10, NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD = 0x11, + NVME_OPC_NAMESPACE_ATTACHMENT = 0x15, NVME_OPC_FORMAT_NVM = 0x80, NVME_OPC_SECURITY_SEND = 0x81, @@ -456,8 +458,11 @@ struct nvme_controller_data { /** maximum data transfer size */ uint8_t mdts; - uint8_t reserved1[178]; + /** Controller ID */ + uint16_t ctrlr_id; + uint8_t reserved1[176]; + /* bytes 256-511: admin command set attributes */ /** optional admin command support */ @@ -471,7 +476,10 @@ struct nvme_controller_data { /* supports firmware activate/download commands */ uint16_t firmware : 1; - uint16_t oacs_rsvd : 13; + /* supports namespace management commands */ + uint16_t nsmgmt : 1; + + uint16_t oacs_rsvd : 12; } __packed oacs; /** abort command limit */ @@ -513,8 +521,16 @@ struct nvme_controller_data { uint8_t avscc_rsvd : 7; } __packed avscc; - uint8_t reserved2[247]; + uint8_t reserved2[15]; + /** Name space capabilities */ + struct { + /* if nsmgmt, report tnvmcap and unvmcap */ + uint8_t tnvmcap[16]; + uint8_t unvmcap[16]; + } __packed untncap; + + uint8_t reserved3[200]; /* bytes 512-703: nvm command set attributes */ /** submission queue entry size */ @@ -529,7 +545,7 @@ struct nvme_controller_data { uint8_t max : 4; } __packed cqes; - uint8_t reserved3[2]; + uint8_t reserved4[2]; /** number of namespaces */ uint32_t nn; @@ -555,10 +571,10 @@ struct nvme_controller_data { } __packed vwc; /* TODO: flesh out remaining nvm command set attributes */ - uint8_t reserved4[178]; + uint8_t reserved5[178]; /* bytes 704-2047: i/o command set attributes */ - uint8_t reserved5[1344]; + uint8_t reserved6[1344]; /* bytes 2048-3071: power state descriptors */ struct nvme_power_state power_state[32]; From owner-svn-src-all@freebsd.org Thu Feb 1 16:33:16 2018 Return-Path: Delivered-To: svn-src-all@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 77E1DEDC583; Thu, 1 Feb 2018 16:33:16 +0000 (UTC) (envelope-from mav@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 2660E75D3A; Thu, 1 Feb 2018 16:33:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20DA777D4; Thu, 1 Feb 2018 16:33:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GXGCg020727; Thu, 1 Feb 2018 16:33:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GXGG8020725; Thu, 1 Feb 2018 16:33:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011633.w11GXGG8020725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:33:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328679 - stable/11/sys/cam X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam X-SVN-Commit-Revision: 328679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:33:16 -0000 Author: mav Date: Thu Feb 1 16:33:15 2018 New Revision: 328679 URL: https://svnweb.freebsd.org/changeset/base/328679 Log: MFC r303123 (by imp): Fix mismerge and include the nvme support. Also, print out the name of any CCB's functions that's not supported. Modified: stable/11/sys/cam/cam_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_xpt.c ============================================================================== --- stable/11/sys/cam/cam_xpt.c Thu Feb 1 16:27:50 2018 (r328678) +++ stable/11/sys/cam/cam_xpt.c Thu Feb 1 16:33:15 2018 (r328679) @@ -1034,6 +1034,8 @@ xpt_announce_periph(struct cam_periph *periph, char *a else if (path->device->protocol == PROTO_SEMB) semb_print_ident( (struct sep_identify_data *)&path->device->ident_data); + else if (path->device->protocol == PROTO_NVME) + nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); else printf("Unknown protocol device\n"); if (path->device->serial_num_len > 0) { @@ -1087,6 +1089,8 @@ xpt_denounce_periph(struct cam_periph *periph) else if (path->device->protocol == PROTO_SEMB) semb_print_ident_short( (struct sep_identify_data *)&path->device->ident_data); + else if (path->device->protocol == PROTO_NVME) + nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); else printf("Unknown protocol device"); if (path->device->serial_num_len > 0) @@ -2540,6 +2544,10 @@ xpt_action_default(union ccb *start_ccb) if (start_ccb->ccb_h.func_code == XPT_ATA_IO) start_ccb->ataio.resid = 0; /* FALLTHROUGH */ + case XPT_NVME_IO: + if (start_ccb->ccb_h.func_code == XPT_NVME_IO) + start_ccb->nvmeio.resid = 0; + /* FALLTHROUGH */ case XPT_RESET_DEV: case XPT_ENG_EXEC: case XPT_SMP_IO: @@ -2685,6 +2693,8 @@ call_sim: cgd->inq_data = dev->inq_data; cgd->ident_data = dev->ident_data; cgd->inq_flags = dev->inq_flags; + cgd->nvme_data = dev->nvme_data; + cgd->nvme_cdata = dev->nvme_cdata; cgd->ccb_h.status = CAM_REQ_CMP; cgd->serial_num_len = dev->serial_num_len; if ((dev->serial_num_len > 0) @@ -3030,8 +3040,10 @@ call_sim: case XPT_TERM_IO: case XPT_ENG_INQ: /* XXX Implement */ - printf("%s: CCB type %#x not supported\n", __func__, - start_ccb->ccb_h.func_code); + xpt_print_path(start_ccb->ccb_h.path); + printf("%s: CCB type %#x %s not supported\n", __func__, + start_ccb->ccb_h.func_code, + xpt_action_name(start_ccb->ccb_h.func_code)); start_ccb->ccb_h.status = CAM_PROVIDE_FAIL; if (start_ccb->ccb_h.func_code & XPT_FC_DEV_QUEUED) { xpt_done(start_ccb); @@ -3340,6 +3352,13 @@ xpt_run_devq(struct cam_devq *devq) ata_cmd_string(&work_ccb->ataio.cmd, cdb_str, sizeof(cdb_str)))); break; + case XPT_NVME_IO: + CAM_DEBUG(work_ccb->ccb_h.path, + CAM_DEBUG_CDB,("%s. NCB: %s\n", + nvme_op_string(&work_ccb->nvmeio.cmd), + nvme_cmd_string(&work_ccb->nvmeio.cmd, + cdb_str, sizeof(cdb_str)))); + break; default: break; } @@ -3927,6 +3946,9 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, case XPORT_ATA: case XPORT_SATA: new_bus->xport = ata_get_xport(); + break; + case XPORT_NVME: + new_bus->xport = nvme_get_xport(); break; default: new_bus->xport = &xport_default; From owner-svn-src-all@freebsd.org Thu Feb 1 16:35:41 2018 Return-Path: Delivered-To: svn-src-all@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 5FD56EDC81E; Thu, 1 Feb 2018 16:35:41 +0000 (UTC) (envelope-from mav@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 1241B75F51; Thu, 1 Feb 2018 16:35:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CED677DB; Thu, 1 Feb 2018 16:35:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GZee3020905; Thu, 1 Feb 2018 16:35:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GZeo0020898; Thu, 1 Feb 2018 16:35:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011635.w11GZeo0020898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328680 - in stable/11/sys: cam cam/scsi dev/nvme kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: cam cam/scsi dev/nvme kern X-SVN-Commit-Revision: 328680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:35:41 -0000 Author: mav Date: Thu Feb 1 16:35:40 2018 New Revision: 328680 URL: https://svnweb.freebsd.org/changeset/base/328680 Log: MFC r320984 (by imp): This adds CAM pass(4) support for NVMe IO's. Applications indicate the IO type (Admin or NVM) using XPT op-codes XPT_NVME_ADMIN or XPT_NVME_IO. Modified: stable/11/sys/cam/cam_ccb.h stable/11/sys/cam/cam_periph.c stable/11/sys/cam/cam_xpt.c stable/11/sys/cam/scsi/scsi_pass.c stable/11/sys/dev/nvme/nvme_sim.c stable/11/sys/kern/subr_bus_dma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_ccb.h ============================================================================== --- stable/11/sys/cam/cam_ccb.h Thu Feb 1 16:33:15 2018 (r328679) +++ stable/11/sys/cam/cam_ccb.h Thu Feb 1 16:35:40 2018 (r328680) @@ -206,7 +206,7 @@ typedef enum { /* Serial Management Protocol */ XPT_NVME_IO = 0x1c | XPT_FC_DEV_QUEUED, - /* Execiute the requestred NVMe I/O operation */ + /* Execute the requested NVMe I/O operation */ XPT_MMCSD_IO = 0x1d | XPT_FC_DEV_QUEUED, /* Placeholder for MMC / SD / SDIO I/O stuff */ @@ -215,6 +215,9 @@ typedef enum { | XPT_FC_XPT_ONLY, /* Scan Target */ + XPT_NVME_ADMIN = 0x1f | XPT_FC_DEV_QUEUED, + /* Execute the requested NVMe Admin operation */ + /* HBA engine commands 0x20->0x2F */ XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY, /* HBA engine feature inquiry */ @@ -801,7 +804,7 @@ struct ccb_relsim { }; /* - * NVMe I/O Request CCB used for the XPT_NVME_IO function code. + * NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes. */ struct ccb_nvmeio { struct ccb_hdr ccb_h; @@ -1429,6 +1432,21 @@ cam_fill_nvmeio(struct ccb_nvmeio *nvmeio, u_int32_t r u_int32_t timeout) { nvmeio->ccb_h.func_code = XPT_NVME_IO; + nvmeio->ccb_h.flags = flags; + nvmeio->ccb_h.retry_count = retries; + nvmeio->ccb_h.cbfcnp = cbfcnp; + nvmeio->ccb_h.timeout = timeout; + nvmeio->data_ptr = data_ptr; + nvmeio->dxfer_len = dxfer_len; +} + +static __inline void +cam_fill_nvmeadmin(struct ccb_nvmeio *nvmeio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int8_t *data_ptr, u_int32_t dxfer_len, + u_int32_t timeout) +{ + nvmeio->ccb_h.func_code = XPT_NVME_ADMIN; nvmeio->ccb_h.flags = flags; nvmeio->ccb_h.retry_count = retries; nvmeio->ccb_h.cbfcnp = cbfcnp; Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Thu Feb 1 16:33:15 2018 (r328679) +++ stable/11/sys/cam/cam_periph.c Thu Feb 1 16:35:40 2018 (r328680) @@ -829,6 +829,17 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma dirs[1] = CAM_DIR_IN; numbufs = 2; break; + case XPT_NVME_IO: + case XPT_NVME_ADMIN: + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) + return (0); + if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) + return (EINVAL); + data_ptrs[0] = &ccb->nvmeio.data_ptr; + lengths[0] = ccb->nvmeio.dxfer_len; + dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; + numbufs = 1; + break; case XPT_DEV_ADVINFO: if (ccb->cdai.bufsiz == 0) return (0); @@ -994,6 +1005,11 @@ cam_periph_unmapmem(union ccb *ccb, struct cam_periph_ case XPT_DEV_ADVINFO: numbufs = min(mapinfo->num_bufs_used, 1); data_ptrs[0] = (uint8_t **)&ccb->cdai.buf; + break; + case XPT_NVME_IO: + case XPT_NVME_ADMIN: + data_ptrs[0] = &ccb->nvmeio.data_ptr; + numbufs = min(mapinfo->num_bufs_used, 1); break; default: /* allow ourselves to be swapped once again */ Modified: stable/11/sys/cam/cam_xpt.c ============================================================================== --- stable/11/sys/cam/cam_xpt.c Thu Feb 1 16:33:15 2018 (r328679) +++ stable/11/sys/cam/cam_xpt.c Thu Feb 1 16:35:40 2018 (r328680) @@ -2545,9 +2545,9 @@ xpt_action_default(union ccb *start_ccb) start_ccb->ataio.resid = 0; /* FALLTHROUGH */ case XPT_NVME_IO: - if (start_ccb->ccb_h.func_code == XPT_NVME_IO) - start_ccb->nvmeio.resid = 0; /* FALLTHROUGH */ + case XPT_NVME_ADMIN: + /* FALLTHROUGH */ case XPT_RESET_DEV: case XPT_ENG_EXEC: case XPT_SMP_IO: @@ -5412,6 +5412,7 @@ static struct kv map[] = { { XPT_MMCSD_IO, "XPT_MMCSD_IO" }, { XPT_SMP_IO, "XPT_SMP_IO" }, { XPT_SCAN_TGT, "XPT_SCAN_TGT" }, + { XPT_NVME_ADMIN, "XPT_NVME_ADMIN" }, { XPT_ENG_INQ, "XPT_ENG_INQ" }, { XPT_ENG_EXEC, "XPT_ENG_EXEC" }, { XPT_EN_LUN, "XPT_EN_LUN" }, Modified: stable/11/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_pass.c Thu Feb 1 16:33:15 2018 (r328679) +++ stable/11/sys/cam/scsi/scsi_pass.c Thu Feb 1 16:35:40 2018 (r328680) @@ -1146,6 +1146,11 @@ passiocleanup(struct pass_softc *softc, struct pass_io numbufs = min(io_req->num_bufs, 1); data_ptrs[0] = (uint8_t **)&ccb->cdai.buf; break; + case XPT_NVME_IO: + case XPT_NVME_ADMIN: + data_ptrs[0] = &ccb->nvmeio.data_ptr; + numbufs = min(io_req->num_bufs, 1); + break; default: /* allow ourselves to be swapped once again */ return; @@ -1384,6 +1389,25 @@ passmemsetup(struct cam_periph *periph, struct pass_io dirs[0] = CAM_DIR_IN; numbufs = 1; break; + case XPT_NVME_ADMIN: + case XPT_NVME_IO: + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) + return (0); + + io_req->data_flags = ccb->ccb_h.flags & CAM_DATA_MASK; + + /* + * We only support a single virtual address for NVMe + */ + if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) + return (EINVAL); + + data_ptrs[0] = &ccb->nvmeio.data_ptr; + lengths[0] = ccb->nvmeio.dxfer_len; + dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; + numbufs = 1; + maxmap = softc->maxio; + break; default: return(EINVAL); break; /* NOTREACHED */ @@ -1943,7 +1967,8 @@ passdoioctl(struct cdev *dev, u_long cmd, caddr_t addr */ if ((fc == XPT_SCSI_IO) || (fc == XPT_ATA_IO) || (fc == XPT_SMP_IO) || (fc == XPT_DEV_MATCH) - || (fc == XPT_DEV_ADVINFO)) { + || (fc == XPT_DEV_ADVINFO) + || (fc == XPT_NVME_ADMIN) || (fc == XPT_NVME_IO)) { error = passmemsetup(periph, io_req); if (error != 0) { uma_zfree(softc->pass_zone, io_req); Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:33:15 2018 (r328679) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:35:40 2018 (r328680) @@ -110,7 +110,10 @@ nvme_sim_nvmeio(struct cam_sim *sim, union ccb *ccb) memcpy(&req->cmd, &ccb->nvmeio.cmd, sizeof(ccb->nvmeio.cmd)); - nvme_ctrlr_submit_io_request(ctrlr, req); + if (ccb->ccb_h.func_code == XPT_NVME_IO) + nvme_ctrlr_submit_io_request(ctrlr, req); + else + nvme_ctrlr_submit_admin_request(ctrlr, req); ccb->ccb_h.status |= CAM_SIM_QUEUED; } @@ -233,6 +236,7 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_REQ_CMP; break; case XPT_NVME_IO: /* Execute the requested I/O operation */ + case XPT_NVME_ADMIN: /* or Admin operation */ nvme_sim_nvmeio(sim, ccb); return; /* no done */ default: Modified: stable/11/sys/kern/subr_bus_dma.c ============================================================================== --- stable/11/sys/kern/subr_bus_dma.c Thu Feb 1 16:33:15 2018 (r328679) +++ stable/11/sys/kern/subr_bus_dma.c Thu Feb 1 16:35:40 2018 (r328680) @@ -218,6 +218,16 @@ _bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t sglist_cnt = 0; break; } + case XPT_NVME_IO: + case XPT_NVME_ADMIN: { + struct ccb_nvmeio *nvmeio; + + nvmeio = &ccb->nvmeio; + data_ptr = nvmeio->data_ptr; + dxfer_len = nvmeio->dxfer_len; + sglist_cnt = 0; + break; + } default: panic("_bus_dmamap_load_ccb: Unsupported func code %d", ccb_h->func_code); From owner-svn-src-all@freebsd.org Thu Feb 1 16:40:38 2018 Return-Path: Delivered-To: svn-src-all@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 4E7C4EDCBAD; Thu, 1 Feb 2018 16:40:38 +0000 (UTC) (envelope-from mav@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 EB00A761C0; Thu, 1 Feb 2018 16:40:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E605977EA; Thu, 1 Feb 2018 16:40:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Geb1v021956; Thu, 1 Feb 2018 16:40:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GebCJ021950; Thu, 1 Feb 2018 16:40:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011640.w11GebCJ021950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328681 - in stable/11/sys: conf dev/nvd dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: conf dev/nvd dev/nvme X-SVN-Commit-Revision: 328681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:40:38 -0000 Author: mav Date: Thu Feb 1 16:40:37 2018 New Revision: 328681 URL: https://svnweb.freebsd.org/changeset/base/328681 Log: MFC r322036 (by imp): Make nvd vs nda choice boot-time rather than build-time Introduce hw.nvme.use_nvd tunable. This tunable allows both nvd and nda to be installed in the kernel, while allowing only one of them to create devices. This is an all-or-nothing setting, and you can't change it after boot-time. However, it will allow easier A/B testing. Modified: stable/11/sys/conf/files stable/11/sys/conf/files.amd64 stable/11/sys/dev/nvd/nvd.c stable/11/sys/dev/nvme/nvme.h stable/11/sys/dev/nvme/nvme_sim.c stable/11/sys/dev/nvme/nvme_sysctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu Feb 1 16:35:40 2018 (r328680) +++ stable/11/sys/conf/files Thu Feb 1 16:40:37 2018 (r328681) @@ -86,8 +86,8 @@ cam/cam_xpt.c optional scbus cam/ata/ata_all.c optional scbus cam/ata/ata_xpt.c optional scbus cam/ata/ata_pmp.c optional scbus -cam/nvme/nvme_all.c optional scbus nvme -cam/nvme/nvme_da.c optional scbus nvme da !nvd +cam/nvme/nvme_all.c optional scbus nvme +cam/nvme/nvme_da.c optional scbus nvme da cam/nvme/nvme_xpt.c optional scbus nvme cam/scsi/scsi_xpt.c optional scbus cam/scsi/scsi_all.c optional scbus Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Thu Feb 1 16:35:40 2018 (r328680) +++ stable/11/sys/conf/files.amd64 Thu Feb 1 16:40:37 2018 (r328681) @@ -336,7 +336,7 @@ dev/nvme/nvme_ctrlr_cmd.c optional nvme dev/nvme/nvme_ns.c optional nvme dev/nvme/nvme_ns_cmd.c optional nvme dev/nvme/nvme_qpair.c optional nvme -dev/nvme/nvme_sim.c optional nvme scbus !nvd +dev/nvme/nvme_sim.c optional nvme scbus dev/nvme/nvme_sysctl.c optional nvme dev/nvme/nvme_test.c optional nvme dev/nvme/nvme_util.c optional nvme Modified: stable/11/sys/dev/nvd/nvd.c ============================================================================== --- stable/11/sys/dev/nvd/nvd.c Thu Feb 1 16:35:40 2018 (r328680) +++ stable/11/sys/dev/nvd/nvd.c Thu Feb 1 16:40:37 2018 (r328681) @@ -134,6 +134,8 @@ MODULE_DEPEND(nvd, nvme, 1, 1, 1); static int nvd_load() { + if (!nvme_use_nvd) + return 0; TAILQ_INIT(&ctrlr_head); TAILQ_INIT(&disk_head); @@ -149,6 +151,9 @@ nvd_unload() { struct nvd_controller *ctrlr; struct nvd_disk *disk; + + if (!nvme_use_nvd) + return; while (!TAILQ_EMPTY(&ctrlr_head)) { ctrlr = TAILQ_FIRST(&ctrlr_head); Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:35:40 2018 (r328680) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:40:37 2018 (r328681) @@ -1003,6 +1003,8 @@ void nvme_ns_trim_cmd(struct nvme_command *cmd, uint16 cmd->cdw11 = NVME_DSM_ATTR_DEALLOCATE; } +extern int nvme_use_nvd; + #endif /* _KERNEL */ #endif /* __NVME_H__ */ Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:35:40 2018 (r328680) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:40:37 2018 (r328681) @@ -379,6 +379,8 @@ struct nvme_consumer *consumer_cookie; static void nvme_sim_init(void) { + if (nvme_use_nvd) + return; consumer_cookie = nvme_register_consumer(nvme_sim_new_ns, nvme_sim_new_controller, NULL, nvme_sim_controller_fail); @@ -390,6 +392,8 @@ SYSINIT(nvme_sim_register, SI_SUB_DRIVERS, SI_ORDER_AN static void nvme_sim_uninit(void) { + if (nvme_use_nvd) + return; /* XXX Cleanup */ nvme_unregister_consumer(consumer_cookie); Modified: stable/11/sys/dev/nvme/nvme_sysctl.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sysctl.c Thu Feb 1 16:35:40 2018 (r328680) +++ stable/11/sys/dev/nvme/nvme_sysctl.c Thu Feb 1 16:40:37 2018 (r328681) @@ -33,6 +33,12 @@ __FBSDID("$FreeBSD$"); #include "nvme_private.h" +int nvme_use_nvd = 1; + +SYSCTL_NODE(_hw, OID_AUTO, nvme, CTLFLAG_RD, 0, "NVMe sysctl tunables"); +SYSCTL_INT(_hw_nvme, OID_AUTO, use_nvd, CTLFLAG_RDTUN, + &nvme_use_nvd, 1, "1 = Create NVD devices, 0 = Create NDA devices"); + /* * CTLTYPE_S64 and sysctl_handle_64 were added in r217616. Define these * explicitly here for older kernels that don't include the r217616 From owner-svn-src-all@freebsd.org Thu Feb 1 16:44:20 2018 Return-Path: Delivered-To: svn-src-all@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 0994EEDD018; Thu, 1 Feb 2018 16:44:20 +0000 (UTC) (envelope-from mav@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 B151376778; Thu, 1 Feb 2018 16:44:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABB3F7970; Thu, 1 Feb 2018 16:44:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GiJ7u026021; Thu, 1 Feb 2018 16:44:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GiJbg026020; Thu, 1 Feb 2018 16:44:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011644.w11GiJbg026020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328683 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:44:20 -0000 Author: mav Date: Thu Feb 1 16:44:19 2018 New Revision: 328683 URL: https://svnweb.freebsd.org/changeset/base/328683 Log: MFC r322257 (by imp): Use the correct queue depth for nda devices. Modified: stable/11/sys/dev/nvme/nvme_sim.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:43:48 2018 (r328682) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:44:19 2018 (r328683) @@ -261,7 +261,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr) int unit; struct nvme_sim_softc *sc = NULL; - max_trans = 256;/* XXX not so simple -- must match queues */ + max_trans = ctrlr->num_io_queues; unit = device_get_unit(ctrlr->dev); devq = cam_simq_alloc(max_trans); if (devq == NULL) From owner-svn-src-all@freebsd.org Thu Feb 1 16:45:09 2018 Return-Path: Delivered-To: svn-src-all@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 E3A4BEDD0EA; Thu, 1 Feb 2018 16:45:08 +0000 (UTC) (envelope-from mav@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 95E377689C; Thu, 1 Feb 2018 16:45:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90D0B7972; Thu, 1 Feb 2018 16:45:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Gj8es026113; Thu, 1 Feb 2018 16:45:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Gj862026112; Thu, 1 Feb 2018 16:45:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011645.w11Gj862026112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328684 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:45:09 -0000 Author: mav Date: Thu Feb 1 16:45:08 2018 New Revision: 328684 URL: https://svnweb.freebsd.org/changeset/base/328684 Log: MFC r322443 (by nwhitehorn): Move NVME controller shutdown from being called as part of module unloading to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that the NVME controller gets shut down before the device and bus disappear and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs. PR: kern/211852 Modified: stable/11/sys/dev/nvme/nvme.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.c ============================================================================== --- stable/11/sys/dev/nvme/nvme.c Thu Feb 1 16:44:19 2018 (r328683) +++ stable/11/sys/dev/nvme/nvme.c Thu Feb 1 16:45:08 2018 (r328684) @@ -58,6 +58,7 @@ MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocati static int nvme_probe(device_t); static int nvme_attach(device_t); static int nvme_detach(device_t); +static int nvme_shutdown(device_t); static int nvme_modevent(module_t mod, int type, void *arg); static devclass_t nvme_devclass; @@ -67,6 +68,7 @@ static device_method_t nvme_pci_methods[] = { DEVMETHOD(device_probe, nvme_probe), DEVMETHOD(device_attach, nvme_attach), DEVMETHOD(device_detach, nvme_detach), + DEVMETHOD(device_shutdown, nvme_shutdown), { 0, 0 } }; @@ -180,22 +182,15 @@ nvme_unload(void) { } -static void -nvme_shutdown(void) +static int +nvme_shutdown(device_t dev) { - device_t *devlist; struct nvme_controller *ctrlr; - int dev, devcount; - if (devclass_get_devices(nvme_devclass, &devlist, &devcount)) - return; + ctrlr = DEVICE2SOFTC(dev); + nvme_ctrlr_shutdown(ctrlr); - for (dev = 0; dev < devcount; dev++) { - ctrlr = DEVICE2SOFTC(devlist[dev]); - nvme_ctrlr_shutdown(ctrlr); - } - - free(devlist, M_TEMP); + return (0); } static int @@ -208,9 +203,6 @@ nvme_modevent(module_t mod, int type, void *arg) break; case MOD_UNLOAD: nvme_unload(); - break; - case MOD_SHUTDOWN: - nvme_shutdown(); break; default: break; From owner-svn-src-all@freebsd.org Thu Feb 1 16:45:45 2018 Return-Path: Delivered-To: svn-src-all@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 602A0EDD217; Thu, 1 Feb 2018 16:45:45 +0000 (UTC) (envelope-from mav@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 0E87F76AEB; Thu, 1 Feb 2018 16:45:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0912C7976; Thu, 1 Feb 2018 16:45:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GjigO026288; Thu, 1 Feb 2018 16:45:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Gji3O026287; Thu, 1 Feb 2018 16:45:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011645.w11Gji3O026287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328685 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:45:45 -0000 Author: mav Date: Thu Feb 1 16:45:44 2018 New Revision: 328685 URL: https://svnweb.freebsd.org/changeset/base/328685 Log: MFC r322872 (by imp): Enable bus mastering on the device before resetting the device. The card has to do PCIe transactions to complete the reset process, but can't do them, per the PCIe spec, unless bus mastering is enabled. Modified: stable/11/sys/dev/nvme/nvme.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.c ============================================================================== --- stable/11/sys/dev/nvme/nvme.c Thu Feb 1 16:45:08 2018 (r328684) +++ stable/11/sys/dev/nvme/nvme.c Thu Feb 1 16:45:44 2018 (r328685) @@ -247,6 +247,12 @@ nvme_attach(device_t dev) } /* + * Enable busmastering so the completion status messages can + * be busmastered back to the host. + */ + pci_enable_busmaster(dev); + + /* * Reset controller twice to ensure we do a transition from cc.en==1 * to cc.en==0. This is because we don't really know what status * the controller was left in when boot handed off to OS. @@ -262,8 +268,6 @@ nvme_attach(device_t dev) nvme_ctrlr_destruct(ctrlr, dev); return (status); } - - pci_enable_busmaster(dev); ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook; ctrlr->config_hook.ich_arg = ctrlr; From owner-svn-src-all@freebsd.org Thu Feb 1 16:48:41 2018 Return-Path: Delivered-To: svn-src-all@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 3320EEDD51A; Thu, 1 Feb 2018 16:48:41 +0000 (UTC) (envelope-from mav@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 D8D9976EB4; Thu, 1 Feb 2018 16:48:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D38D87982; Thu, 1 Feb 2018 16:48:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Gme6C026529; Thu, 1 Feb 2018 16:48:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GmeQn026528; Thu, 1 Feb 2018 16:48:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011648.w11GmeQn026528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328687 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:48:41 -0000 Author: mav Date: Thu Feb 1 16:48:40 2018 New Revision: 328687 URL: https://svnweb.freebsd.org/changeset/base/328687 Log: MFC r322874, r322875 (by imp): Sanity check sizes Add compile time sanity checks to make sure that packed structures are the proper size, typically as defined in the NVMe standard. Modified: stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:48:25 2018 (r328686) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:48:40 2018 (r328687) @@ -69,6 +69,8 @@ union cap_lo_register { } bits __packed; } __packed; +_Static_assert(sizeof(union cap_lo_register) == 4, "bad size for cap_lo_register"); + union cap_hi_register { uint32_t raw; struct { @@ -93,6 +95,8 @@ union cap_hi_register { } bits __packed; } __packed; +_Static_assert(sizeof(union cap_hi_register) == 4, "bad size of cap_hi_register"); + union cc_register { uint32_t raw; struct { @@ -123,6 +127,8 @@ union cc_register { } bits __packed; } __packed; +_Static_assert(sizeof(union cc_register) == 4, "bad size for cc_register"); + enum shn_value { NVME_SHN_NORMAL = 0x1, NVME_SHN_ABRUPT = 0x2, @@ -144,6 +150,8 @@ union csts_register { } bits __packed; } __packed; +_Static_assert(sizeof(union csts_register) == 4, "bad size for csts_register"); + enum shst_value { NVME_SHST_NORMAL = 0x0, NVME_SHST_OCCURRING = 0x1, @@ -165,6 +173,8 @@ union aqa_register { } bits __packed; } __packed; +_Static_assert(sizeof(union aqa_register) == 4, "bad size for aqa_resgister"); + struct nvme_registers { /** controller capabilities */ @@ -198,6 +208,8 @@ struct nvme_registers } doorbell[1] __packed; } __packed; +_Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); + struct nvme_command { /* dword 0 */ @@ -231,6 +243,8 @@ struct nvme_command uint32_t cdw15; /* command-specific */ } __packed; +_Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for nvme_command"); + struct nvme_status { uint16_t p : 1; /* phase tag */ @@ -241,6 +255,8 @@ struct nvme_status { uint16_t dnr : 1; /* do not retry */ } __packed; +_Static_assert(sizeof(struct nvme_status) == 2, "bad size for nvme_status"); + struct nvme_completion { /* dword 0 */ @@ -258,6 +274,8 @@ struct nvme_completion { struct nvme_status status; } __packed; +_Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for nvme_completion"); + struct nvme_dsm_range { uint32_t attributes; @@ -265,6 +283,8 @@ struct nvme_dsm_range { uint64_t starting_lba; } __packed; +_Static_assert(sizeof(struct nvme_dsm_range) == 16, "bad size for nvme_dsm_ranage"); + /* status code types */ enum nvme_status_code_type { NVME_SCT_GENERIC = 0x0, @@ -423,6 +443,8 @@ struct nvme_power_state { uint8_t ps_rsvd10[9]; } __packed; +_Static_assert(sizeof(struct nvme_power_state) == 32, "bad size for nvme_power_state"); + #define NVME_SERIAL_NUMBER_LENGTH 20 #define NVME_MODEL_NUMBER_LENGTH 40 #define NVME_FIRMWARE_REVISION_LENGTH 8 @@ -583,6 +605,8 @@ struct nvme_controller_data { uint8_t vs[1024]; } __packed __aligned(4); +_Static_assert(sizeof(struct nvme_controller_data) == 4096, "bad size for nvme_controller_data"); + struct nvme_namespace_data { /** namespace size */ @@ -673,6 +697,8 @@ struct nvme_namespace_data { uint8_t vendor_specific[3712]; } __packed __aligned(4); +_Static_assert(sizeof(struct nvme_namespace_data) == 4096, "bad size for nvme_namepsace_data"); + enum nvme_log_page { /* 0x00 - reserved */ @@ -715,6 +741,8 @@ struct nvme_error_information_entry { uint8_t reserved[35]; } __packed __aligned(4); +_Static_assert(sizeof(struct nvme_error_information_entry) == 64, "bad size for nvme_error_information_entry"); + union nvme_critical_warning_state { uint8_t raw; @@ -729,6 +757,8 @@ union nvme_critical_warning_state { } __packed bits; } __packed; +_Static_assert(sizeof(union nvme_critical_warning_state) == 1, "bad size for nvme_critical_warning_state"); + struct nvme_health_information_page { union nvme_critical_warning_state critical_warning; @@ -765,6 +795,8 @@ struct nvme_health_information_page { uint8_t reserved2[296]; } __packed __aligned(4); +_Static_assert(sizeof(struct nvme_health_information_page) == 512, "bad size for nvme_health_information_page"); + struct nvme_firmware_page { struct { @@ -777,6 +809,8 @@ struct nvme_firmware_page { uint8_t reserved2[448]; } __packed __aligned(4); +_Static_assert(sizeof(struct nvme_firmware_page) == 512, "bad size for nvme_firmware_page"); + struct intel_log_temp_stats { uint64_t current; @@ -789,6 +823,8 @@ struct intel_log_temp_stats uint64_t min_oper_temp; uint64_t est_offset; } __packed __aligned(4); + +_Static_assert(sizeof(struct intel_log_temp_stats) == 13 * 8, "bad size for intel_log_temp_stats"); #define NVME_TEST_MAX_THREADS 128 From owner-svn-src-all@freebsd.org Thu Feb 1 16:49:29 2018 Return-Path: Delivered-To: svn-src-all@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 65451EDD5F9; Thu, 1 Feb 2018 16:49:29 +0000 (UTC) (envelope-from mav@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 1AF6C7704B; Thu, 1 Feb 2018 16:49:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15ECC7985; Thu, 1 Feb 2018 16:49:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GnS9M026622; Thu, 1 Feb 2018 16:49:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GnSJ4026621; Thu, 1 Feb 2018 16:49:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011649.w11GnSJ4026621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328688 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:49:29 -0000 Author: mav Date: Thu Feb 1 16:49:28 2018 New Revision: 328688 URL: https://svnweb.freebsd.org/changeset/base/328688 Log: MFC r322901 (by imp): Add feature codes from NVMe 1.3 specification: o Automomous Power State Transition o Host Memory Buffer o Timestamp o Keep Alive Timer o Host Controlled Thermal Management o Non-Operational Power State Config Also note that feature codes 0x78-0x7f are reserved for the NVMe Management Interface. Modified: stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:48:40 2018 (r328687) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:49:28 2018 (r328688) @@ -397,7 +397,14 @@ enum nvme_feature { NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION = 0x09, NVME_FEAT_WRITE_ATOMICITY = 0x0A, NVME_FEAT_ASYNC_EVENT_CONFIGURATION = 0x0B, - /* 0x0C-0x7F - reserved */ + NVME_FEAT_AUTONOMOUS_POWER_STATE_TRANSITION = 0x0C, + NVME_FEAT_HOST_MEMORY_BUFFER = 0x0D, + NVME_FEAT_TIMESTAMP = 0x0E, + NVME_FEAT_KEEP_ALIVE_TIMER = 0x0F, + NVME_FEAT_HOST_CONTROLLED_THERMAL_MGMT = 0x10, + NVME_FEAT_NON_OP_POWER_STATE_CONFIG = 0x11, + /* 0x12-0x77 - reserved */ + /* 0x78-0x7f - NVMe Management Interface */ NVME_FEAT_SOFTWARE_PROGRESS_MARKER = 0x80, /* 0x81-0xBF - command set specific (reserved) */ /* 0xC0-0xFF - vendor specific */ From owner-svn-src-all@freebsd.org Thu Feb 1 16:50:26 2018 Return-Path: Delivered-To: svn-src-all@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 58B00EDD747; Thu, 1 Feb 2018 16:50:26 +0000 (UTC) (envelope-from mav@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 0D688771EA; Thu, 1 Feb 2018 16:50:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0842B798C; Thu, 1 Feb 2018 16:50:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GoPdi026747; Thu, 1 Feb 2018 16:50:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GoPOT026743; Thu, 1 Feb 2018 16:50:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011650.w11GoPOT026743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328689 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:50:26 -0000 Author: mav Date: Thu Feb 1 16:50:25 2018 New Revision: 328689 URL: https://svnweb.freebsd.org/changeset/base/328689 Log: MFC r322902 (by imp): NVME Namespace ID is 32-bits, so widen interface to reflect that. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_ctrlr_cmd.c stable/11/sys/dev/nvme/nvme_ns.c stable/11/sys/dev/nvme/nvme_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:49:28 2018 (r328688) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:50:25 2018 (r328689) @@ -460,7 +460,7 @@ static int nvme_ctrlr_construct_namespaces(struct nvme_controller *ctrlr) { struct nvme_namespace *ns; - int i; + uint32_t i; for (i = 0; i < min(ctrlr->cdata.nn, NVME_MAX_NAMESPACES); i++) { ns = &ctrlr->ns[i]; Modified: stable/11/sys/dev/nvme/nvme_ctrlr_cmd.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr_cmd.c Thu Feb 1 16:49:28 2018 (r328688) +++ stable/11/sys/dev/nvme/nvme_ctrlr_cmd.c Thu Feb 1 16:50:25 2018 (r328689) @@ -52,7 +52,7 @@ nvme_ctrlr_cmd_identify_controller(struct nvme_control } void -nvme_ctrlr_cmd_identify_namespace(struct nvme_controller *ctrlr, uint16_t nsid, +nvme_ctrlr_cmd_identify_namespace(struct nvme_controller *ctrlr, uint32_t nsid, void *payload, nvme_cb_fn_t cb_fn, void *cb_arg) { struct nvme_request *req; Modified: stable/11/sys/dev/nvme/nvme_ns.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ns.c Thu Feb 1 16:49:28 2018 (r328688) +++ stable/11/sys/dev/nvme/nvme_ns.c Thu Feb 1 16:50:25 2018 (r328689) @@ -476,7 +476,7 @@ nvme_ns_bio_process(struct nvme_namespace *ns, struct } int -nvme_ns_construct(struct nvme_namespace *ns, uint16_t id, +nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, struct nvme_controller *ctrlr) { struct nvme_completion_poll_status status; Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 16:49:28 2018 (r328688) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 16:50:25 2018 (r328689) @@ -225,8 +225,8 @@ struct nvme_namespace { struct nvme_controller *ctrlr; struct nvme_namespace_data data; - uint16_t id; - uint16_t flags; + uint32_t id; + uint32_t flags; struct cdev *cdev; void *cons_cookie[NVME_MAX_CONSUMERS]; uint32_t stripesize; @@ -356,7 +356,7 @@ void nvme_ctrlr_cmd_identify_controller(struct nvme_co void *payload, nvme_cb_fn_t cb_fn, void *cb_arg); void nvme_ctrlr_cmd_identify_namespace(struct nvme_controller *ctrlr, - uint16_t nsid, void *payload, + uint32_t nsid, void *payload, nvme_cb_fn_t cb_fn, void *cb_arg); void nvme_ctrlr_cmd_set_interrupt_coalescing(struct nvme_controller *ctrlr, uint32_t microseconds, @@ -438,7 +438,7 @@ void nvme_io_qpair_enable(struct nvme_qpair *qpair); void nvme_io_qpair_disable(struct nvme_qpair *qpair); void nvme_io_qpair_destroy(struct nvme_qpair *qpair); -int nvme_ns_construct(struct nvme_namespace *ns, uint16_t id, +int nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, struct nvme_controller *ctrlr); void nvme_ns_destruct(struct nvme_namespace *ns); From owner-svn-src-all@freebsd.org Thu Feb 1 16:51:11 2018 Return-Path: Delivered-To: svn-src-all@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 B8EC3EDD99C; Thu, 1 Feb 2018 16:51:11 +0000 (UTC) (envelope-from mav@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 6BCC1773CA; Thu, 1 Feb 2018 16:51:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66BCE7AA7; Thu, 1 Feb 2018 16:51:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11GpB5g027715; Thu, 1 Feb 2018 16:51:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11GpB8I027714; Thu, 1 Feb 2018 16:51:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011651.w11GpB8I027714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328690 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:51:12 -0000 Author: mav Date: Thu Feb 1 16:51:11 2018 New Revision: 328690 URL: https://svnweb.freebsd.org/changeset/base/328690 Log: MFC r322903 (by imp): Fill in reserved areas from NVMe spec in the IDENTIFY structure (struct nvme_controller_data) as defined in the NVM Express specification, revsion 1.3. Modified: stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:50:25 2018 (r328689) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 16:51:11 2018 (r328690) @@ -490,8 +490,28 @@ struct nvme_controller_data { /** Controller ID */ uint16_t ctrlr_id; - uint8_t reserved1[176]; + /** Version */ + uint32_t ver; + /** RTD3 Resume Latency */ + uint32_t rtd3r; + + /** RTD3 Enter Latency */ + uint32_t rtd3e; + + /** Optional Asynchronous Events Supported */ + uint32_t oaes; /* bitfield really */ + + /** Controller Attributes */ + uint32_t ctratt; /* bitfield really */ + + uint8_t reserved1[12]; + + /** FRU Globally Unique Identifier */ + uint8_t fguid[16]; + + uint8_t reserved2[128]; + /* bytes 256-511: admin command set attributes */ /** optional admin command support */ @@ -550,8 +570,29 @@ struct nvme_controller_data { uint8_t avscc_rsvd : 7; } __packed avscc; - uint8_t reserved2[15]; + /** Autonomous Power State Transition Attributes */ + struct { + /* Autonmous Power State Transitions supported */ + uint8_t apst_supp : 1; + uint8_t apsta_rsvd : 7; + } __packed apsta; + + /** Warning Composite Temperature Threshold */ + uint16_t wctemp; + + /** Critical Composite Temperature Threshold */ + uint16_t cctemp; + + /** Maximum Time for Firmware Activation */ + uint16_t mtfa; + + /** Host Memory Buffer Preferred Size */ + uint32_t hmpre; + + /** Host Memory Buffer Minimum Size */ + uint32_t hmmin; + /** Name space capabilities */ struct { /* if nsmgmt, report tnvmcap and unvmcap */ @@ -559,7 +600,34 @@ struct nvme_controller_data { uint8_t unvmcap[16]; } __packed untncap; - uint8_t reserved3[200]; + /** Replay Protected Memory Block Support */ + uint32_t rpmbs; /* Really a bitfield */ + + /** Extended Device Self-test Time */ + uint16_t edstt; + + /** Device Self-test Options */ + uint8_t dsto; /* Really a bitfield */ + + /** Firmware Update Granularity */ + uint8_t fwug; + + /** Keep Alive Support */ + uint16_t kas; + + /** Host Controlled Thermal Management Attributes */ + uint16_t hctma; /* Really a bitfield */ + + /** Minimum Thermal Management Temperature */ + uint16_t mntmt; + + /** Maximum Thermal Management Temperature */ + uint16_t mxtmt; + + /** Sanitize Capabilities */ + uint32_t sanicap; /* Really a bitfield */ + + uint8_t reserved3[180]; /* bytes 512-703: nvm command set attributes */ /** submission queue entry size */ @@ -574,7 +642,8 @@ struct nvme_controller_data { uint8_t max : 4; } __packed cqes; - uint8_t reserved4[2]; + /** Maximum Outstanding Commands */ + uint16_t maxcmd; /** number of namespaces */ uint32_t nn; From owner-svn-src-all@freebsd.org Thu Feb 1 16:52:04 2018 Return-Path: Delivered-To: svn-src-all@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 A9522EDDAB6; Thu, 1 Feb 2018 16:52:04 +0000 (UTC) (envelope-from mav@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 59E2F77714; Thu, 1 Feb 2018 16:52:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 363DB7AF2; Thu, 1 Feb 2018 16:52:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Gq4QF031063; Thu, 1 Feb 2018 16:52:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Gq3Zh031059; Thu, 1 Feb 2018 16:52:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011652.w11Gq3Zh031059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328691 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:52:04 -0000 Author: mav Date: Thu Feb 1 16:52:03 2018 New Revision: 328691 URL: https://svnweb.freebsd.org/changeset/base/328691 Log: MFC r322994: Set the max transactions for NVMe drives better. Provided a better estimate for the number of transactions that can be pending at one time. This will be number of queues * number of trackers / 4, as suggested by Jim Harris. This gives a better estimate of the number of transactions that CAM should queue before applying back pressure. This should be revisted when we have real multi-queue support in CAM and the upper layers of the I/O stack. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_private.h stable/11/sys/dev/nvme/nvme_sim.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:51:11 2018 (r328690) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:52:03 2018 (r328691) @@ -146,6 +146,14 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller num_trackers = min(num_trackers, (num_entries-1)); /* + * Our best estimate for the maximum number of I/Os that we should + * noramlly have in flight at one time. This should be viewed as a hint, + * not a hard limit and will need to be revisitted when the upper layers + * of the storage system grows multi-queue support. + */ + ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues / 4; + + /* * This was calculated previously when setting up interrupts, but * a controller could theoretically support fewer I/O queues than * MSI-X vectors. So calculate again here just to be safe. Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 16:51:11 2018 (r328690) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 16:52:03 2018 (r328691) @@ -263,6 +263,7 @@ struct nvme_controller { uint32_t num_io_queues; uint32_t num_cpus_per_ioq; + uint32_t max_hw_pend_io; /* Fields for tracking progress during controller initialization. */ struct intr_config_hook config_hook; Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:51:11 2018 (r328690) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 16:52:03 2018 (r328691) @@ -261,7 +261,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr) int unit; struct nvme_sim_softc *sc = NULL; - max_trans = ctrlr->num_io_queues; + max_trans = ctrlr->max_hw_pend_io; unit = device_get_unit(ctrlr->dev); devq = cam_simq_alloc(max_trans); if (devq == NULL) From owner-svn-src-all@freebsd.org Thu Feb 1 16:53:09 2018 Return-Path: Delivered-To: svn-src-all@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 6D2D7EDDC0F; Thu, 1 Feb 2018 16:53:09 +0000 (UTC) (envelope-from mav@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 1ED3377962; Thu, 1 Feb 2018 16:53:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 182447B1B; Thu, 1 Feb 2018 16:53:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Gr8aU031850; Thu, 1 Feb 2018 16:53:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Gr8p4031848; Thu, 1 Feb 2018 16:53:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011653.w11Gr8p4031848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 16:53:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328692 - in stable/11/sys: conf dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: conf dev/nvme X-SVN-Commit-Revision: 328692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 16:53:09 -0000 Author: mav Date: Thu Feb 1 16:53:08 2018 New Revision: 328692 URL: https://svnweb.freebsd.org/changeset/base/328692 Log: MFC r322995 (by imp): Add new compile-time option NVME_USE_NVD that sets the default value of the runtime hw.nvme.use_vnd tunable. We still default to nvd unless otherwise requested. Modified: stable/11/sys/conf/options stable/11/sys/dev/nvme/nvme_sysctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Thu Feb 1 16:52:03 2018 (r328691) +++ stable/11/sys/conf/options Thu Feb 1 16:53:08 2018 (r328692) @@ -1001,3 +1001,6 @@ UINPUT_DEBUG opt_evdev.h # Hyper-V network driver HN_DEBUG opt_hn.h + +# NVME options +NVME_USE_NVD opt_nvme.h Modified: stable/11/sys/dev/nvme/nvme_sysctl.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sysctl.c Thu Feb 1 16:52:03 2018 (r328691) +++ stable/11/sys/dev/nvme/nvme_sysctl.c Thu Feb 1 16:53:08 2018 (r328692) @@ -27,13 +27,19 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_nvme.h" + #include #include #include #include "nvme_private.h" -int nvme_use_nvd = 1; +#ifndef NVME_USE_NVD +#define NVME_USE_NVD 1 +#endif + +int nvme_use_nvd = NVME_USE_NVD; SYSCTL_NODE(_hw, OID_AUTO, nvme, CTLFLAG_RD, 0, "NVMe sysctl tunables"); SYSCTL_INT(_hw_nvme, OID_AUTO, use_nvd, CTLFLAG_RDTUN, From owner-svn-src-all@freebsd.org Thu Feb 1 17:32:46 2018 Return-Path: Delivered-To: svn-src-all@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 51C8FEE024D; Thu, 1 Feb 2018 17:32:46 +0000 (UTC) (envelope-from hselasky@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 0430979570; Thu, 1 Feb 2018 17:32:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F338F101A5; Thu, 1 Feb 2018 17:32:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11HWjGE054072; Thu, 1 Feb 2018 17:32:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11HWj0t054071; Thu, 1 Feb 2018 17:32:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802011732.w11HWj0t054071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Feb 2018 17:32:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328694 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 328694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 17:32:46 -0000 Author: hselasky Date: Thu Feb 1 17:32:45 2018 New Revision: 328694 URL: https://svnweb.freebsd.org/changeset/base/328694 Log: Make sure the LinuxKPI's internal ERESTARTSYS error code gets translated into ERESTART for mmap and page fault calls aswell. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Feb 1 17:16:17 2018 (r328693) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Feb 1 17:32:45 2018 (r328694) @@ -1149,6 +1149,8 @@ linux_file_mmap_single(struct file *fp, vm_ooffset_t * error = EINTR; } else { error = -OPW(fp, td, filp->f_op->mmap(filp, vmap)); + if (error == ERESTARTSYS) + error = ERESTART; up_write(&vmap->vm_mm->mmap_sem); } From owner-svn-src-all@freebsd.org Thu Feb 1 17:59:15 2018 Return-Path: Delivered-To: svn-src-all@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 0AEDCEE1B55; Thu, 1 Feb 2018 17:59:15 +0000 (UTC) (envelope-from rgrimes@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 B1DBA7A7E0; Thu, 1 Feb 2018 17:59:14 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 ACC5B104FF; Thu, 1 Feb 2018 17:59:14 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11HxEPx064046; Thu, 1 Feb 2018 17:59:14 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11HxE5T064045; Thu, 1 Feb 2018 17:59:14 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201802011759.w11HxE5T064045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 1 Feb 2018 17:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328695 - head/share/examples/bhyve X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/share/examples/bhyve X-SVN-Commit-Revision: 328695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 17:59:15 -0000 Author: rgrimes Date: Thu Feb 1 17:59:14 2018 New Revision: 328695 URL: https://svnweb.freebsd.org/changeset/base/328695 Log: Add option '-n' network device emulation type which has a default of virtio-net PR: 225558 Submitted by: Johannes Lundberg Approved by: grehan (mentor) MFC after: 3 days Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh ============================================================================== --- head/share/examples/bhyve/vmrun.sh Thu Feb 1 17:32:45 2018 (r328694) +++ head/share/examples/bhyve/vmrun.sh Thu Feb 1 17:59:14 2018 (r328695) @@ -38,6 +38,7 @@ DEFAULT_CPUS=2 DEFAULT_TAPDEV=tap0 DEFAULT_CONSOLE=stdio +DEFAULT_NIC=virtio-net DEFAULT_VIRTIO_DISK="./diskdev" DEFAULT_ISOFILE="./release.iso" @@ -72,6 +73,7 @@ usage() { echo " -l: the OS loader to use (default is /boot/userboot.so)" echo " -L: IP address for UEFI GOP VNC server (default: 127.0.0.1)" echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" + echo " -n: network adapter emulation type (default is ${DEFAULT_NIC})" echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)" echo " -P: UEFI GOP VNC port (default: 5900)" echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" @@ -100,6 +102,7 @@ isofile=${DEFAULT_ISOFILE} memsize=${DEFAULT_MEMSIZE} console=${DEFAULT_CONSOLE} cpus=${DEFAULT_CPUS} +nic=${DEFAULT_NIC} tap_total=0 disk_total=0 disk_emulation="virtio-blk" @@ -117,7 +120,7 @@ vncport=5900 fbsize="w=1024,h=768" tablet="" -while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c ; do +while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:n:p:P:t:Tuvw c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" @@ -171,6 +174,9 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c m) memsize=${OPTARG} ;; + n) + nic=${OPTARG} + ;; p) eval "pass_dev${pass_total}=\"${OPTARG}\"" pass_total=$(($pass_total + 1)) @@ -313,7 +319,7 @@ while [ 1 ]; do i=0 while [ $i -lt $tap_total ] ; do eval "tapname=\$tap_dev${i}" - devargs="$devargs -s $nextslot:0,virtio-net,${tapname} " + devargs="$devargs -s $nextslot:0,${nic},${tapname} " nextslot=$(($nextslot + 1)) i=$(($i + 1)) done From owner-svn-src-all@freebsd.org Thu Feb 1 18:13:42 2018 Return-Path: Delivered-To: svn-src-all@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 3A1ABEE2B93; Thu, 1 Feb 2018 18:13:42 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E73747B753; Thu, 1 Feb 2018 18:13:41 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id DEC888C08; Thu, 1 Feb 2018 18:13:41 +0000 (UTC) From: Jan Beich To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> <4d1d778d-a0e0-0d3a-b37e-19fba10ae86f@selasky.org> Date: Thu, 01 Feb 2018 19:13:35 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 18:13:42 -0000 Hans Petter Selasky writes: > On 02/01/18 12:04, Hans Petter Selasky wrote: > >> On 02/01/18 11:25, Jan Beich wrote: >>> Hans Petter Selasky writes: >>> >>>> Author: hselasky >>>> Date: Fri Jan 26 10:49:02 2018 >>>> New Revision: 328436 >>>> URL: https://svnweb.freebsd.org/changeset/base/328436 >>>> >>>> Log: >>>> Decouple Linux files from the belonging character device right >>>> after open >>>> in the LinuxKPI. This is done by calling finit() just before >>>> returning a magic >>>> value of ENXIO in the "linux_dev_fdopen" function. >>> >>> This breaks DRI3 (uses DMABUF) on drm-next-kmod (Linux 4.9 atm) e.g., >>> >>> $ LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears >>> libGL: screen 0 does not appear to be DRI3 capable >>> libGL error: Connection closed during DRI3 initialization failure >>> XIO: fatal IO error 35 (Resource temporarily unavailable) on X >>> server ":0" >>> after 22 requests (22 known processed) with 0 events remaining. >>> >> >> Hi, >> >> I'll have a look. It might be an issue in libdrm, because it uses >> some out-of date methods to enumerate the device nodes, like the >> major and minor numbers. >> >> Did you recompile drm-next-kmod after recompiling the LinuxKPI? >> >> --HPS >> > > Hi, > > I'm still running: > > freebsd-base-graphics > git@github.com:FreeBSDDesktop/freebsd-base-graphics.git drm-next branch from freebsd-base-graphics is out of date compared to master from kms-drm which is the basis for graphics/drm-next-kmod port. I've switched to drm-next-kmod long ago as resolving regular merge conflicts under sys/compat/linuxkpi became very tedious. > With r328436 applied on top and glxgears work: > >> env LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears >> libGL: OpenDriver: trying /usr/local/lib/dri/i965_dri.so >> libGL: Can't open configuration file /home/hans/.drirc: No such file or directory. >> libGL: Using DRI2 for screen 0 What DDX driver do you use? modesetting(4x) uses DRI3 by default but for intel(4x) you need to explicitly enable it via xorg.conf e.g., see (**) lines below $ fgrep DRI /var/log/Xorg.0.log [ 11.875] (**) intel(0): Option "DRI" "3" [ 11.880] (II) intel(0): [DRI2] Setup complete [ 11.880] (II) intel(0): [DRI2] DRI driver: i965 [ 11.880] (II) intel(0): [DRI2] VDPAU driver: va_gl [ 11.880] (II) intel(0): direct rendering: DRI2 DRI3 enabled [ 11.902] (II) GLX: Initialized DRI2 GL provider for screen 0 Maybe also build graphics/mesa-{dri,libs} with CFLAGS += -D__DRM_NEXT__ in case LIBGL_DRI3_ENABLE=1 doesn't work for X server. Here's what I see with the commit reverted: $ LIBGL_DRI3_ENABLE=1 LIBGL_DEBUG=verbose MESA_DEBUG=context glxgears libGL: Can't open configuration file /home/foo/.drirc: No such file or directory. libGL: pci id for fd 4: 8086:1912, driver i965 libGL: OpenDriver: trying /usr/local/lib/dri/i965_dri.so libGL: Can't open configuration file /home/foo/.drirc: No such file or directory. libGL: Can't open configuration file /home/foo/.drirc: No such file or directory. libGL: Using DRI3 for screen 0 libGL: Can't open configuration file /home/foo/.drirc: No such file or directory. 308 frames in 5.0 seconds = 61.437 FPS ^C >> libGL: Can't open configuration file /home/hans/.drirc: No such file or directory. >> Running synchronized to the vertical refresh. The framerate should be >> approximately the same as the monitor refresh rate. >> 302 frames in 5.0 seconds = 60.252 FPS > > Can you do a ktrace and see where it stops? It stops after one of messages from X server via unix(4) socket. glxgears CALL mmap(0,0x7000,0x3,0x1002,0xffffffff,0) glxgears RET mmap 34429681664/0x8042b4000 glxgears CALL mmap(0,0x7000,0x3,0x1002,0xffffffff,0) glxgears RET mmap 34429710336/0x8042bb000 glxgears CALL poll(0x7fffffffe588,0x1,0xffffffff) glxgears RET poll 1 glxgears CALL writev(0x3,0x7fffffffe628,0x1) glxgears GIO fd 3 wrote 12 bytes -0x0000 9501 0300 5501 0000 0000 0000 |....U.......| +0x0000 9501 0300 5501 0000 0000 0000 |....U.......| glxgears RET writev 12/0xc glxgears CALL poll(0x7fffffffe5e8,0x1,0xffffffff) glxgears RET poll 1 glxgears CALL recvmsg(0x3,0x7fffffffe4a8,0) -glxgears GIO fd 3 read 32 bytes -0x0000 0101 1700 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 |..........................| -0x001a 0000 0000 0000 |......| - -glxgears RET recvmsg 32/0x20 -glxgears CALL fcntl(0x4,F_GETFD) -glxgears RET fcntl 0 -glxgears CALL fcntl(0x4,F_SETFD,FD_CLOEXEC) -glxgears RET fcntl 0 -glxgears CALL getpid -glxgears RET getpid 46871/0xb717 -glxgears CALL __sysctl(0x7fffffffe488,0x2,0x7fffffffe400,0x7fffffffe3f8,0,0) -glxgears SCTL "kern.arandom" -glxgears RET __sysctl 0 -glxgears CALL openat(AT_FDCWD,0x800c0138d,0) -glxgears NAMI "/usr/local/etc/drirc" -glxgears RET openat 5 -glxgears CALL read(0x5,0x804246000,0x1000) -glxgears GIO fd 5 read 4096 bytes [...] -glxgears RET read 348/0x15c -glxgears CALL read(0x5,0x8042c2578,0x1000) -glxgears GIO fd 5 read 0 bytes +glxgears GIO fd 3 read 0 bytes "" -glxgears RET read 0 -glxgears CALL close(0x5) -glxgears RET close 0 -glxgears CALL openat(AT_FDCWD,0x80422e2e0,0) -glxgears NAMI "/home/foo/.drirc" -glxgears RET openat -1 errno 2 No such file or directory -glxgears CALL fstatat(AT_FDCWD,0x7fffffffdf70,0x7fffffffe370,0) +glxgears RET recvmsg 0 +glxgears CALL write(0x2,0x7fffffffdf60,0x7) +glxgears GIO fd 2 wrote 7 bytes +"libGL: " +glxgears RET write 7 +glxgears CALL write(0x2,0x7fffffffe060,0x2c) +glxgears GIO fd 2 wrote 44 bytes +"screen 0 does not appear to be DRI3 capable +" +glxgears RET write 44/0x2c +glxgears CALL write(0x2,0x7fffffffdf60,0xd) +glxgears GIO fd 2 wrote 13 bytes +"libGL error: " +glxgears RET write 13/0xd +glxgears CALL write(0x2,0x7fffffffe060,0x34) +glxgears GIO fd 2 wrote 52 bytes +"Connection closed during DRI3 initialization failure" +glxgears RET write 52/0x34 > Can you also verify: > > 1) run "xhost +" > 2) run application as root Neither (1) nor (2) helps. From owner-svn-src-all@freebsd.org Thu Feb 1 18:25:32 2018 Return-Path: Delivered-To: svn-src-all@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 B8173EE3757; Thu, 1 Feb 2018 18:25:32 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56E9A7C17C; Thu, 1 Feb 2018 18:25:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 6E27826009E; Thu, 1 Feb 2018 19:25:23 +0100 (CET) Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src To: Jan Beich Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> <4d1d778d-a0e0-0d3a-b37e-19fba10ae86f@selasky.org> From: Hans Petter Selasky Message-ID: Date: Thu, 1 Feb 2018 19:22:26 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 18:25:32 -0000 I'm able to reproduce. Trying to narrow down the problem. --HPS From owner-svn-src-all@freebsd.org Thu Feb 1 18:57:12 2018 Return-Path: Delivered-To: svn-src-all@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 EA1AEEE55FA; Thu, 1 Feb 2018 18:57:11 +0000 (UTC) (envelope-from mav@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 9E77C7D88D; Thu, 1 Feb 2018 18:57:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9963C10F0F; Thu, 1 Feb 2018 18:57:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11IvB9Z001025; Thu, 1 Feb 2018 18:57:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11IvAgU001015; Thu, 1 Feb 2018 18:57:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011857.w11IvAgU001015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 18:57:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328696 - in stable/11/sys: cam cam/nvme cam/scsi dev/nvme kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: cam cam/nvme cam/scsi dev/nvme kern X-SVN-Commit-Revision: 328696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 18:57:12 -0000 Author: mav Date: Thu Feb 1 18:57:10 2018 New Revision: 328696 URL: https://svnweb.freebsd.org/changeset/base/328696 Log: MFC r322997: Add CAM/NVMe support for CAM_DATA_SG This adds support in pass(4) for data to be described with a scatter-gather list (sglist) to augment the existing (single) virtual address. Modified: stable/11/sys/cam/cam_ccb.h stable/11/sys/cam/nvme/nvme_da.c stable/11/sys/cam/scsi/scsi_pass.c stable/11/sys/dev/nvme/nvme_private.h stable/11/sys/dev/nvme/nvme_qpair.c stable/11/sys/dev/nvme/nvme_sim.c stable/11/sys/kern/subr_bus_dma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_ccb.h ============================================================================== --- stable/11/sys/cam/cam_ccb.h Thu Feb 1 17:59:14 2018 (r328695) +++ stable/11/sys/cam/cam_ccb.h Thu Feb 1 18:57:10 2018 (r328696) @@ -813,7 +813,8 @@ struct ccb_nvmeio { struct nvme_completion cpl; /* NVME completion, per NVME standard */ uint8_t *data_ptr; /* Ptr to the data buf/SG list */ uint32_t dxfer_len; /* Data transfer length */ - uint32_t resid; /* Transfer residual length: 2's comp unused ?*/ + uint16_t sglist_cnt; /* Number of SG list entries */ + uint16_t unused; /* padding for removed uint32_t */ }; /* Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 17:59:14 2018 (r328695) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 18:57:10 2018 (r328696) @@ -1006,12 +1006,7 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb bp->bio_resid = bp->bio_bcount; bp->bio_flags |= BIO_ERROR; } else { - if (state == NDA_CCB_TRIM) - bp->bio_resid = 0; - else - bp->bio_resid = nvmeio->resid; - if (bp->bio_resid > 0) - bp->bio_flags |= BIO_ERROR; + bp->bio_resid = 0; } if (state == NDA_CCB_TRIM) free(bp->bio_driver2, M_NVMEDA); Modified: stable/11/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_pass.c Thu Feb 1 17:59:14 2018 (r328695) +++ stable/11/sys/cam/scsi/scsi_pass.c Thu Feb 1 18:57:10 2018 (r328696) @@ -1396,15 +1396,11 @@ passmemsetup(struct cam_periph *periph, struct pass_io io_req->data_flags = ccb->ccb_h.flags & CAM_DATA_MASK; - /* - * We only support a single virtual address for NVMe - */ - if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) - return (EINVAL); - data_ptrs[0] = &ccb->nvmeio.data_ptr; lengths[0] = ccb->nvmeio.dxfer_len; dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; + num_segs = ccb->nvmeio.sglist_cnt; + seg_cnt_ptr = &ccb->nvmeio.sglist_cnt; numbufs = 1; maxmap = softc->maxio; break; Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 17:59:14 2018 (r328695) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 18:57:10 2018 (r328696) @@ -135,6 +135,7 @@ struct nvme_completion_poll_status { #ifdef NVME_UNMAPPED_BIO_SUPPORT #define NVME_REQUEST_BIO 4 #endif +#define NVME_REQUEST_CCB 5 struct nvme_request { @@ -514,6 +515,20 @@ nvme_allocate_request_bio(struct bio *bio, nvme_cb_fn_ req->payload_size = bio->bio_bcount; #endif } + return (req); +} + +static __inline struct nvme_request * +nvme_allocate_request_ccb(union ccb *ccb, nvme_cb_fn_t cb_fn, void *cb_arg) +{ + struct nvme_request *req; + + req = _nvme_allocate_request(cb_fn, cb_arg); + if (req != NULL) { + req->type = NVME_REQUEST_CCB; + req->u.payload = ccb; + } + return (req); } Modified: stable/11/sys/dev/nvme/nvme_qpair.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 17:59:14 2018 (r328695) +++ stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 18:57:10 2018 (r328696) @@ -851,6 +851,14 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, s "bus_dmamap_load_bio returned 0x%x!\n", err); break; #endif + case NVME_REQUEST_CCB: + err = bus_dmamap_load_ccb(tr->qpair->dma_tag_payload, + tr->payload_dma_map, req->u.payload, + nvme_payload_map, tr, 0); + if (err != 0) + nvme_printf(qpair->ctrlr, + "bus_dmamap_load_ccb returned 0x%x!\n", err); + break; default: panic("unknown nvme request type 0x%x\n", req->type); break; Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 17:59:14 2018 (r328695) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 18:57:10 2018 (r328696) @@ -96,6 +96,8 @@ nvme_sim_nvmeio(struct cam_sim *sim, union ccb *ccb) if ((nvmeio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_BIO) req = nvme_allocate_request_bio((struct bio *)payload, nvme_sim_nvmeio_done, ccb); + else if ((nvmeio->ccb_h.flags & CAM_DATA_SG) == CAM_DATA_SG) + req = nvme_allocate_request_ccb(ccb, nvme_sim_nvmeio_done, ccb); else if (payload == NULL) req = nvme_allocate_request_null(nvme_sim_nvmeio_done, ccb); else Modified: stable/11/sys/kern/subr_bus_dma.c ============================================================================== --- stable/11/sys/kern/subr_bus_dma.c Thu Feb 1 17:59:14 2018 (r328695) +++ stable/11/sys/kern/subr_bus_dma.c Thu Feb 1 18:57:10 2018 (r328696) @@ -225,7 +225,7 @@ _bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t nvmeio = &ccb->nvmeio; data_ptr = nvmeio->data_ptr; dxfer_len = nvmeio->dxfer_len; - sglist_cnt = 0; + sglist_cnt = nvmeio->sglist_cnt; break; } default: From owner-svn-src-all@freebsd.org Thu Feb 1 18:59:04 2018 Return-Path: Delivered-To: svn-src-all@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 6F28AEE5835; Thu, 1 Feb 2018 18:59:04 +0000 (UTC) (envelope-from mav@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 1C6E07DB36; Thu, 1 Feb 2018 18:59:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2F4110F14; Thu, 1 Feb 2018 18:59:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Ix3LQ001530; Thu, 1 Feb 2018 18:59:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Ix37o001519; Thu, 1 Feb 2018 18:59:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011859.w11Ix37o001519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 18:59:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328697 - in stable/11/sys: cam dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: cam dev/nvme X-SVN-Commit-Revision: 328697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 18:59:04 -0000 Author: mav Date: Thu Feb 1 18:59:03 2018 New Revision: 328697 URL: https://svnweb.freebsd.org/changeset/base/328697 Log: MFC r322998 (by imp): Fix a few overlooked spots where the coded uses 16-bit NSIDs. Chuck Tuffli had submitted a more thorough patch that I was unaware of when I did my work and this brings in the bits I missed from that patch. Modified: stable/11/sys/cam/cam_ccb.h stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_ccb.h ============================================================================== --- stable/11/sys/cam/cam_ccb.h Thu Feb 1 18:57:10 2018 (r328696) +++ stable/11/sys/cam/cam_ccb.h Thu Feb 1 18:59:03 2018 (r328697) @@ -626,7 +626,7 @@ struct ccb_pathinq_settings_sas { }; struct ccb_pathinq_settings_nvme { - uint16_t nsid; /* Namespace ID for this path */ + uint32_t nsid; /* Namespace ID for this path */ }; #define PATHINQ_SETTINGS_SIZE 128 Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 18:57:10 2018 (r328696) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 18:59:03 2018 (r328697) @@ -1070,7 +1070,7 @@ int nvme_ns_bio_process(struct nvme_namespace *ns, str /* Command building helper functions -- shared with CAM */ static inline -void nvme_ns_flush_cmd(struct nvme_command *cmd, uint16_t nsid) +void nvme_ns_flush_cmd(struct nvme_command *cmd, uint32_t nsid) { cmd->opc = NVME_OPC_FLUSH; @@ -1078,7 +1078,7 @@ void nvme_ns_flush_cmd(struct nvme_command *cmd, uint1 } static inline -void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t rwcmd, uint16_t nsid, +void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t rwcmd, uint32_t nsid, uint64_t lba, uint32_t count) { cmd->opc = rwcmd; @@ -1092,21 +1092,21 @@ void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t } static inline -void nvme_ns_write_cmd(struct nvme_command *cmd, uint16_t nsid, +void nvme_ns_write_cmd(struct nvme_command *cmd, uint32_t nsid, uint64_t lba, uint32_t count) { nvme_ns_rw_cmd(cmd, NVME_OPC_WRITE, nsid, lba, count); } static inline -void nvme_ns_read_cmd(struct nvme_command *cmd, uint16_t nsid, +void nvme_ns_read_cmd(struct nvme_command *cmd, uint32_t nsid, uint64_t lba, uint32_t count) { nvme_ns_rw_cmd(cmd, NVME_OPC_READ, nsid, lba, count); } static inline -void nvme_ns_trim_cmd(struct nvme_command *cmd, uint16_t nsid, +void nvme_ns_trim_cmd(struct nvme_command *cmd, uint32_t nsid, uint32_t num_ranges) { cmd->opc = NVME_OPC_DATASET_MANAGEMENT; From owner-svn-src-all@freebsd.org Thu Feb 1 19:00:06 2018 Return-Path: Delivered-To: svn-src-all@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 0FD78EE591A; Thu, 1 Feb 2018 19:00:06 +0000 (UTC) (envelope-from mav@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 B697A7DC8E; Thu, 1 Feb 2018 19:00:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B195010F19; Thu, 1 Feb 2018 19:00:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J05Iv001821; Thu, 1 Feb 2018 19:00:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J05Ed001820; Thu, 1 Feb 2018 19:00:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011900.w11J05Ed001820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328698 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:00:06 -0000 Author: mav Date: Thu Feb 1 19:00:05 2018 New Revision: 328698 URL: https://svnweb.freebsd.org/changeset/base/328698 Log: MFC r323834 (by imp): Fix queue depth for nda. 1/4 of the number of queues times queue entries is too limiting. It works up to about 4k IOPS / 3.0GB/s for hardware that can do 4.4k/3.2GB/s with nvd. 3/4 works better, though it highlights issues in the fairness of nda's choice of TRIM vs READ. That will be fixed separately. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 18:59:03 2018 (r328697) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 19:00:05 2018 (r328698) @@ -151,7 +151,7 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller * not a hard limit and will need to be revisitted when the upper layers * of the storage system grows multi-queue support. */ - ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues / 4; + ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues * 3 / 4; /* * This was calculated previously when setting up interrupts, but From owner-svn-src-all@freebsd.org Thu Feb 1 19:01:07 2018 Return-Path: Delivered-To: svn-src-all@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 8984FEE5A03; Thu, 1 Feb 2018 19:01:07 +0000 (UTC) (envelope-from mav@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 3F35A7DE5E; Thu, 1 Feb 2018 19:01:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A2AC10F41; Thu, 1 Feb 2018 19:01:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J17dI002949; Thu, 1 Feb 2018 19:01:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J17Rp002948; Thu, 1 Feb 2018 19:01:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011901.w11J17Rp002948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328699 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:01:07 -0000 Author: mav Date: Thu Feb 1 19:01:06 2018 New Revision: 328699 URL: https://svnweb.freebsd.org/changeset/base/328699 Log: MFC r324075 (by imp): Tweak performance of nda completions Use xpt_done_direct in preference to xpt_done when completing a successful I/O. Continue to use xpt_done when there's an error, or for completion of the submission of a CCB. This eliminates a context switch to the cam_doneq thread. Modified: stable/11/sys/dev/nvme/nvme_sim.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 19:00:05 2018 (r328698) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 19:01:06 2018 (r328699) @@ -73,11 +73,13 @@ nvme_sim_nvmeio_done(void *ccb_arg, const struct nvme_ * it means. Make our best guess, though for the status code. */ memcpy(&ccb->nvmeio.cpl, cpl, sizeof(*cpl)); - if (nvme_completion_is_error(cpl)) + if (nvme_completion_is_error(cpl)) { ccb->ccb_h.status = CAM_REQ_CMP_ERR; - else + xpt_done(ccb); + } else { ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); + xpt_done_direct(ccb); + } } static void From owner-svn-src-all@freebsd.org Thu Feb 1 19:04:51 2018 Return-Path: Delivered-To: svn-src-all@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 6B6F0EE5E12; Thu, 1 Feb 2018 19:04:51 +0000 (UTC) (envelope-from mav@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 11EE17E2C1; Thu, 1 Feb 2018 19:04:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CB30110E6; Thu, 1 Feb 2018 19:04:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J4oxL007290; Thu, 1 Feb 2018 19:04:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J4ond007289; Thu, 1 Feb 2018 19:04:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011904.w11J4ond007289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328700 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:04:51 -0000 Author: mav Date: Thu Feb 1 19:04:50 2018 New Revision: 328700 URL: https://svnweb.freebsd.org/changeset/base/328700 Log: MFC r324631 (by imp): Explicitly set reserved fields and 'fuse' to 0. This prevents us from acidentally sending bogus values in these fields, which some drives may reject with an error or worse (undefined behavior). This is especially needed for the ndadump routine which allocates the cmd from stack garbage.... Modified: stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 19:01:06 2018 (r328699) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 19:04:50 2018 (r328700) @@ -1082,7 +1082,11 @@ void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t uint64_t lba, uint32_t count) { cmd->opc = rwcmd; + cmd->fuse = 0; + cmd->rsvd1 = 0; cmd->nsid = nsid; + cmd->rsvd2 = 0; + cmd->rsvd3 = 0; cmd->cdw10 = lba & 0xffffffffu; cmd->cdw11 = lba >> 32; cmd->cdw12 = count-1; From owner-svn-src-all@freebsd.org Thu Feb 1 19:05:49 2018 Return-Path: Delivered-To: svn-src-all@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 49462EE5F03; Thu, 1 Feb 2018 19:05:49 +0000 (UTC) (envelope-from mav@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 EC04F7E45B; Thu, 1 Feb 2018 19:05:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E70B6110E8; Thu, 1 Feb 2018 19:05:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J5m5X007519; Thu, 1 Feb 2018 19:05:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J5mTe007517; Thu, 1 Feb 2018 19:05:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011905.w11J5mTe007517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328701 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:05:49 -0000 Author: mav Date: Thu Feb 1 19:05:48 2018 New Revision: 328701 URL: https://svnweb.freebsd.org/changeset/base/328701 Log: MFC r324633 (by imp): Create general polling function for the nvme controller. Use it when we're doing the various pin-based interrupt modes. Adjust nvme_ctrlr_intx_handler to use nvme_ctrlr_poll. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 19:04:50 2018 (r328700) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 19:05:48 2018 (r328701) @@ -815,18 +815,33 @@ nvme_ctrlr_reset_task(void *arg, int pending) atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); } +/* + * Poll all the queues enabled on the device for completion. + */ void -nvme_ctrlr_intx_handler(void *arg) +nvme_ctrlr_poll(struct nvme_controller *ctrlr) { - struct nvme_controller *ctrlr = arg; + int i; - nvme_mmio_write_4(ctrlr, intms, 1); - nvme_qpair_process_completions(&ctrlr->adminq); - if (ctrlr->ioq && ctrlr->ioq[0].cpl) - nvme_qpair_process_completions(&ctrlr->ioq[0]); + for (i = 0; i < ctrlr->num_io_queues; i++) + if (ctrlr->ioq && ctrlr->ioq[i].cpl) + nvme_qpair_process_completions(&ctrlr->ioq[i]); +} +/* + * Poll the single-vector intertrupt case: num_io_queues will be 1 and + * there's only a single vector. While we're polling, we mask further + * interrupts in the controller. + */ +void +nvme_ctrlr_intx_handler(void *arg) +{ + struct nvme_controller *ctrlr = arg; + + nvme_mmio_write_4(ctrlr, intms, 1); + nvme_ctrlr_poll(ctrlr); nvme_mmio_write_4(ctrlr, intmc, 1); } Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 19:04:50 2018 (r328700) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 19:05:48 2018 (r328701) @@ -542,5 +542,6 @@ void nvme_notify_fail_consumers(struct nvme_controller void nvme_notify_new_controller(struct nvme_controller *ctrlr); void nvme_ctrlr_intx_handler(void *arg); +void nvme_ctrlr_poll(struct nvme_controller *ctrlr); #endif /* __NVME_PRIVATE_H__ */ From owner-svn-src-all@freebsd.org Thu Feb 1 19:06:43 2018 Return-Path: Delivered-To: svn-src-all@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 1C6A3EE5FDE; Thu, 1 Feb 2018 19:06:43 +0000 (UTC) (envelope-from mav@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 BB0BF7E5AB; Thu, 1 Feb 2018 19:06:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5D39110EA; Thu, 1 Feb 2018 19:06:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J6gnV007732; Thu, 1 Feb 2018 19:06:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J6gDG007731; Thu, 1 Feb 2018 19:06:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011906.w11J6gDG007731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:06:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328702 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:06:43 -0000 Author: mav Date: Thu Feb 1 19:06:42 2018 New Revision: 328702 URL: https://svnweb.freebsd.org/changeset/base/328702 Log: MFC r324634 (by imp): Use nvme_ctrlr_poll instead of nvme_ctrlr_intx_handler since it is more general and doesn't try to access registers that may be undefined when the card is in MSIX mode. This change, along with r324630, r324631, r324632, makes nda crash dumps work again. Previously, they only worked on CPU 0 when the stack garbage was just so. Modified: stable/11/sys/dev/nvme/nvme_sim.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 19:05:48 2018 (r328701) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 19:06:42 2018 (r328702) @@ -254,7 +254,7 @@ static void nvme_sim_poll(struct cam_sim *sim) { - nvme_ctrlr_intx_handler(sim2ctrlr(sim)); + nvme_ctrlr_poll(sim2ctrlr(sim)); } static void * From owner-svn-src-all@freebsd.org Thu Feb 1 19:07:22 2018 Return-Path: Delivered-To: svn-src-all@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 2A979EE6050; Thu, 1 Feb 2018 19:07:22 +0000 (UTC) (envelope-from mav@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 D11527E6E3; Thu, 1 Feb 2018 19:07:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8376110EB; Thu, 1 Feb 2018 19:07:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J7LWQ007899; Thu, 1 Feb 2018 19:07:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J7L44007895; Thu, 1 Feb 2018 19:07:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011907.w11J7L44007895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328703 - in stable/11/sys: cam/nvme dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: cam/nvme dev/nvme X-SVN-Commit-Revision: 328703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:07:22 -0000 Author: mav Date: Thu Feb 1 19:07:21 2018 New Revision: 328703 URL: https://svnweb.freebsd.org/changeset/base/328703 Log: MFC r324644 (by imp): Closer examination shows that nvme and CAM both normally zero-fill allocations (for req and ccb, which ultimately contain the nvme_cmd). As such, we can micro-optimize these routines. Add a comment to this effect, and bzero the ccb used to make the requests for the nda dump rotuine so it more closely matches a ccb allocated with xpt_get_ccb(). Modified: stable/11/sys/cam/nvme/nvme_da.c stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:06:42 2018 (r328702) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:07:21 2018 (r328703) @@ -398,6 +398,8 @@ ndadump(void *arg, void *virtual, vm_offset_t physical return (ENXIO); } + /* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ + memset(&nvmeio, 0, sizeof(nvmeio)); if (length > 0) { xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); ccb.ccb_h.ccb_state = NDA_CCB_DUMP; Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 19:06:42 2018 (r328702) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 19:07:21 2018 (r328703) @@ -1068,7 +1068,12 @@ uint32_t nvme_ns_get_stripesize(struct nvme_namespace int nvme_ns_bio_process(struct nvme_namespace *ns, struct bio *bp, nvme_cb_fn_t cb_fn); -/* Command building helper functions -- shared with CAM */ +/* + * Command building helper functions -- shared with CAM + * These functions assume allocator zeros out cmd structure + * CAM's xpt_get_ccb and the request allocator for nvme both + * do zero'd allocations. + */ static inline void nvme_ns_flush_cmd(struct nvme_command *cmd, uint32_t nsid) { @@ -1082,17 +1087,10 @@ void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t uint64_t lba, uint32_t count) { cmd->opc = rwcmd; - cmd->fuse = 0; - cmd->rsvd1 = 0; cmd->nsid = nsid; - cmd->rsvd2 = 0; - cmd->rsvd3 = 0; cmd->cdw10 = lba & 0xffffffffu; cmd->cdw11 = lba >> 32; cmd->cdw12 = count-1; - cmd->cdw13 = 0; - cmd->cdw14 = 0; - cmd->cdw15 = 0; } static inline From owner-svn-src-all@freebsd.org Thu Feb 1 19:13:20 2018 Return-Path: Delivered-To: svn-src-all@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 54B85EE66CA; Thu, 1 Feb 2018 19:13:20 +0000 (UTC) (envelope-from mav@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 045CB7EDB9; Thu, 1 Feb 2018 19:13:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9F9211284; Thu, 1 Feb 2018 19:13:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JDJkL013561; Thu, 1 Feb 2018 19:13:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JDJ6H013560; Thu, 1 Feb 2018 19:13:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011913.w11JDJ6H013560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328704 - stable/11/sys/cam/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/nvme X-SVN-Commit-Revision: 328704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:13:20 -0000 Author: mav Date: Thu Feb 1 19:13:19 2018 New Revision: 328704 URL: https://svnweb.freebsd.org/changeset/base/328704 Log: MFC r324632 (by imp): Be nicer on the dump stack by allocating only a ccb_nvmeio rather than a full ccb. This saves a few hundre bytes, which might be important during a crash dump... Modified: stable/11/sys/cam/nvme/nvme_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:07:21 2018 (r328703) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:13:19 2018 (r328704) @@ -379,7 +379,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical struct cam_periph *periph; struct nda_softc *softc; u_int secsize; - union ccb ccb; + struct ccb_nvmeio nvmeio; struct disk *dp; uint64_t lba; uint32_t count; @@ -401,15 +401,15 @@ ndadump(void *arg, void *virtual, vm_offset_t physical /* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ memset(&nvmeio, 0, sizeof(nvmeio)); if (length > 0) { - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); - ccb.ccb_h.ccb_state = NDA_CCB_DUMP; - nda_nvme_write(softc, &ccb.nvmeio, virtual, lba, length, count); - xpt_polled_action(&ccb); + xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; + nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); + xpt_polled_action((union ccb *)&nvmeio); - error = cam_periph_error(&ccb, + error = cam_periph_error((union ccb *)&nvmeio, 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, + if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); if (error != 0) printf("Aborting dump due to I/O error.\n"); @@ -419,16 +419,16 @@ ndadump(void *arg, void *virtual, vm_offset_t physical } /* Flush */ - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); - ccb.ccb_h.ccb_state = NDA_CCB_DUMP; - nda_nvme_flush(softc, &ccb.nvmeio); - xpt_polled_action(&ccb); + nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; + nda_nvme_flush(softc, &nvmeio); + xpt_polled_action((union ccb *)&nvmeio); - error = cam_periph_error(&ccb, + error = cam_periph_error((union ccb *)&nvmeio, 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, + if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); if (error != 0) xpt_print(periph->path, "flush cmd failed\n"); From owner-svn-src-all@freebsd.org Thu Feb 1 19:27:11 2018 Return-Path: Delivered-To: svn-src-all@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 31B52EE744A; Thu, 1 Feb 2018 19:27:11 +0000 (UTC) (envelope-from mav@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 D805D7F86E; Thu, 1 Feb 2018 19:27:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1B8E11425; Thu, 1 Feb 2018 19:27:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JRAsm020592; Thu, 1 Feb 2018 19:27:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JRAFJ020591; Thu, 1 Feb 2018 19:27:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011927.w11JRAFJ020591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328705 - stable/11/sys/cam/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/nvme X-SVN-Commit-Revision: 328705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:27:11 -0000 Author: mav Date: Thu Feb 1 19:27:10 2018 New Revision: 328705 URL: https://svnweb.freebsd.org/changeset/base/328705 Log: MFC r303125 (by imp): Remove some bogus comments and printfs. Also, we can't cam_periph_releaes_locked() at the end of nvme_probe_start because we hit an assertion which may be bogus. Instead, leak a periph until we sort it out. Since these devices don't arrive and depart often, so this is the lessor of two evils. Modified: stable/11/sys/cam/nvme/nvme_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_xpt.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_xpt.c Thu Feb 1 19:13:19 2018 (r328704) +++ stable/11/sys/cam/nvme/nvme_xpt.c Thu Feb 1 19:27:10 2018 (r328705) @@ -163,13 +163,14 @@ static struct xpt_xport nvme_xport = { struct xpt_xport * nvme_get_xport(void) { + return (&nvme_xport); } static void nvme_probe_periph_init() { - printf("nvme cam probe device init\n"); + } static cam_status @@ -297,18 +298,15 @@ nvme_probe_start(struct cam_periph *periph, union ccb start_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(start_ccb); } -// XXX not sure I need this -// XXX unlike other XPTs, we never freeze the queue since we have a super-simple -// XXX state machine - /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. -- did we really do this? */ -// cam_release_devq(path, 0, 0, 0, FALSE); cam_periph_invalidate(periph); - cam_periph_release_locked(periph); + /* Can't release periph since we hit a (possibly bogus) assertion */ +// cam_periph_release_locked(periph); } static void nvme_probe_cleanup(struct cam_periph *periph) { + free(periph->softc, M_CAMXPT); } From owner-svn-src-all@freebsd.org Thu Feb 1 19:28:01 2018 Return-Path: Delivered-To: svn-src-all@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 1D53DEE74E8; Thu, 1 Feb 2018 19:28:01 +0000 (UTC) (envelope-from mav@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 C45087F9AE; Thu, 1 Feb 2018 19:28:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF32B11427; Thu, 1 Feb 2018 19:28:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JS0l4020676; Thu, 1 Feb 2018 19:28:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JS0os020675; Thu, 1 Feb 2018 19:28:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011928.w11JS0os020675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328706 - stable/11/sys/cam/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/nvme X-SVN-Commit-Revision: 328706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:28:01 -0000 Author: mav Date: Thu Feb 1 19:28:00 2018 New Revision: 328706 URL: https://svnweb.freebsd.org/changeset/base/328706 Log: MFC r303315 (by imp): Remove some extraneous printfs. Modified: stable/11/sys/cam/nvme/nvme_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_xpt.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_xpt.c Thu Feb 1 19:27:10 2018 (r328705) +++ stable/11/sys/cam/nvme/nvme_xpt.c Thu Feb 1 19:28:00 2018 (r328706) @@ -538,13 +538,8 @@ nvme_action(union ccb *start_ccb) switch (start_ccb->ccb_h.func_code) { case XPT_SCAN_BUS: - printf("NVME scan BUS started -- ignored\n"); -// break; case XPT_SCAN_TGT: - printf("NVME scan TGT started -- ignored\n"); -// break; case XPT_SCAN_LUN: - printf("NVME scan started\n"); nvme_scan_lun(start_ccb->ccb_h.path->periph, start_ccb->ccb_h.path, start_ccb->crcn.flags, start_ccb); From owner-svn-src-all@freebsd.org Thu Feb 1 19:30:03 2018 Return-Path: Delivered-To: svn-src-all@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 997EFEE763D; Thu, 1 Feb 2018 19:30:03 +0000 (UTC) (envelope-from mav@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 4BC717FB52; Thu, 1 Feb 2018 19:30:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46BB91142E; Thu, 1 Feb 2018 19:30:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JU3N6020845; Thu, 1 Feb 2018 19:30:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JU3f4020844; Thu, 1 Feb 2018 19:30:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011930.w11JU3f4020844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328707 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:30:03 -0000 Author: mav Date: Thu Feb 1 19:30:02 2018 New Revision: 328707 URL: https://svnweb.freebsd.org/changeset/base/328707 Log: MFC r308848 (by imp): Remove check for valid log pages. Let the drive tell us which pages are valid or not. While many pages are reserved in the standard, that doesn't make them invalid and future versions of the standard may define then. Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:28:00 2018 (r328706) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:30:02 2018 (r328707) @@ -757,14 +757,6 @@ logpage(int argc, char *argv[]) "\"%s\" not valid log page id.\n", optarg); logpage_usage(); - /* TODO: Define valid log page id ranges in nvme.h? */ - } else if (log_page == 0 || - (log_page >= 0x04 && log_page <= 0x7F) || - (log_page >= 0x80 && log_page <= 0xBF)) { - fprintf(stderr, - "\"%s\" not valid log page id.\n", - optarg); - logpage_usage(); } pageflag = true; break; From owner-svn-src-all@freebsd.org Thu Feb 1 19:30:38 2018 Return-Path: Delivered-To: svn-src-all@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 D7E6DEE76A4; Thu, 1 Feb 2018 19:30:37 +0000 (UTC) (envelope-from mav@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 896D97FC7D; Thu, 1 Feb 2018 19:30:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 846A811434; Thu, 1 Feb 2018 19:30:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JUbus020918; Thu, 1 Feb 2018 19:30:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JUbJU020917; Thu, 1 Feb 2018 19:30:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011930.w11JUbJU020917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328708 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:30:38 -0000 Author: mav Date: Thu Feb 1 19:30:37 2018 New Revision: 328708 URL: https://svnweb.freebsd.org/changeset/base/328708 Log: MFC r308856 (by imp): Decode the Intel-specific Additional SMART data page (0xca) and print it in human readable form. Include a pointer to the public spec that was followed to implement this in the code. Samsung also implements page 0xca on some of their drives, but the format is slighly different, so the code skips printing zero keys. Samsung's log page has additional, unknown data after the end of Intel defined data which isn't displayed. Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:30:02 2018 (r328707) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:30:37 2018 (r328708) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); typedef void (*print_fn_t)(void *buf, uint32_t size); - struct kv_name { uint32_t key; @@ -106,6 +105,15 @@ uint128_to_str(uint128_t u, char *buf, size_t buflen) return end; } +/* "fMissing" from endian.h */ +static __inline uint64_t +le48dec(const void *pp) +{ + uint8_t const *p = (uint8_t const *)pp; + + return (((uint64_t)le16dec(p + 4) << 32) | le32dec(p)); +} + static void * get_log_buffer(uint32_t size) { @@ -278,6 +286,13 @@ print_log_firmware(void *buf, uint32_t size __unused) } } +/* + * Intel specific log pages from + * http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/ssd-dc-p3700-spec.pdf + * + * Though the version as of this date has a typo for the size of log page 0xca, + * offset 147: it is only 1 byte, not 6. + */ static void print_intel_temp_stats(void *buf, uint32_t size __unused) { @@ -301,6 +316,68 @@ print_intel_temp_stats(void *buf, uint32_t size __unus printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); } +static void +print_intel_add_smart(void *buf, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint8_t *end = walker + 150; + const char *name; + uint64_t raw; + uint8_t normalized; + + static struct kv_name kv[] = + { + { 0xab, "Program Fail Count" }, + { 0xac, "Erase Fail Count" }, + { 0xad, "Wear Leveling Count" }, + { 0xb8, "End to End Error Count" }, + { 0xc7, "CRC Error Count" }, + { 0xe2, "Timed: Media Wear" }, + { 0xe3, "Timed: Host Read %" }, + { 0xe4, "Timed: Elapsed Time" }, + { 0xea, "Thermal Throttle Status" }, + { 0xf0, "Retry Buffer Overflows" }, + { 0xf3, "PLL Lock Loss Count" }, + { 0xf4, "NAND Bytes Written" }, + { 0xf5, "Host Bytes Written" }, + }; + + printf("Additional SMART Data Log\n"); + printf("=========================\n"); + /* + * walker[0] = Key + * walker[1,2] = reserved + * walker[3] = Normalized Value + * walker[4] = reserved + * walker[5..10] = Little Endian Raw value + * (or other represenations) + * walker[11] = reserved + */ + while (walker < end) { + name = kv_lookup(kv, nitems(kv), *walker); + normalized = walker[3]; + raw = le48dec(walker + 5); + switch (*walker){ + case 0: + break; + case 0xad: + printf("%-32s: %3d min: %u max: %u ave: %u\n", name, normalized, + le16dec(walker + 5), le16dec(walker + 7), le16dec(walker + 9)); + break; + case 0xe2: + printf("%-32s: %3d %.3f%%\n", name, normalized, raw / 1024.0); + break; + case 0xea: + printf("%-32s: %3d %d%% %d times\n", name, normalized, walker[5], le32dec(walker+6)); + break; + default: + printf("%-32s: %3d %ju\n", name, normalized, (uintmax_t)raw); + break; + } + walker += 12; + } +} + /* * HGST's 0xc1 page. This is a grab bag of additional data. Please see * https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf @@ -719,6 +796,8 @@ static struct logpage_function { sizeof(struct nvme_firmware_page)}, {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, + {INTEL_LOG_ADD_SMART, print_intel_add_smart, + DEFAULT_SIZE}, {HGST_INFO_LOG, print_hgst_info_log, DEFAULT_SIZE}, {0, NULL, From owner-svn-src-all@freebsd.org Thu Feb 1 19:31:40 2018 Return-Path: Delivered-To: svn-src-all@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 02730EE78CB; Thu, 1 Feb 2018 19:31:40 +0000 (UTC) (envelope-from mav@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 A840D7FFEE; Thu, 1 Feb 2018 19:31:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A34601157C; Thu, 1 Feb 2018 19:31:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JVdRt021798; Thu, 1 Feb 2018 19:31:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JVdwA021797; Thu, 1 Feb 2018 19:31:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011931.w11JVdwA021797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:31:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328709 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:31:40 -0000 Author: mav Date: Thu Feb 1 19:31:39 2018 New Revision: 328709 URL: https://svnweb.freebsd.org/changeset/base/328709 Log: MFC r308869 (by imp): i386 turns out to not have __uint128_t. So confusingly use 64-bit math instead. Since we're little endian, we can get away with it. Also, since the counters in quesitons would require billions of iops for tens of billions of seconds to overflow, and since such data rates are unlikely for people using i386 for a while, that's OK. The fastest cards today can't do even a million IOPs. Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:30:37 2018 (r328708) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:31:39 2018 (r328709) @@ -75,10 +75,18 @@ kv_lookup(const struct kv_name *kv, size_t kv_count, u } /* - * 128-bit integer augments to standard values + * 128-bit integer augments to standard values. On i386 this + * doesn't exist, so we use 64-bit values. The 128-bit counters + * are crazy anyway, since for this purpose, you'd need a + * billion IOPs for billions of seconds to overflow them. + * So, on 32-bit i386, you'll get truncated values. */ #define UINT128_DIG 39 +#ifdef __i386__ +typedef uint64_t uint128_t; +#else typedef __uint128_t uint128_t; +#endif static inline uint128_t to128(void *p) From owner-svn-src-all@freebsd.org Thu Feb 1 19:32:46 2018 Return-Path: Delivered-To: svn-src-all@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 96ECBEE7A08; Thu, 1 Feb 2018 19:32:46 +0000 (UTC) (envelope-from mav@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 48C60801E4; Thu, 1 Feb 2018 19:32:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B81115C1; Thu, 1 Feb 2018 19:32:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JWkMr025677; Thu, 1 Feb 2018 19:32:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JWkw3025676; Thu, 1 Feb 2018 19:32:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011932.w11JWkw3025676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328710 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:32:46 -0000 Author: mav Date: Thu Feb 1 19:32:45 2018 New Revision: 328710 URL: https://svnweb.freebsd.org/changeset/base/328710 Log: MFC r309413 (by imp): Flag the vendor specific pages as such. This allows different decoding for the same page number as different vendors encode vendor specific pages differently. Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:31:39 2018 (r328709) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:32:45 2018 (r328710) @@ -793,23 +793,23 @@ print_hgst_info_log(void *buf, uint32_t size __unused) */ static struct logpage_function { uint8_t log_page; + const char *vendor; print_fn_t print_fn; size_t size; } logfuncs[] = { - {NVME_LOG_ERROR, print_log_error, + {NVME_LOG_ERROR, NULL, print_log_error, 0}, - {NVME_LOG_HEALTH_INFORMATION, print_log_health, + {NVME_LOG_HEALTH_INFORMATION, NULL, print_log_health, sizeof(struct nvme_health_information_page)}, - {NVME_LOG_FIRMWARE_SLOT, print_log_firmware, + {NVME_LOG_FIRMWARE_SLOT, NULL, print_log_firmware, sizeof(struct nvme_firmware_page)}, - {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, + {INTEL_LOG_TEMP_STATS, "intel", print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, - {INTEL_LOG_ADD_SMART, print_intel_add_smart, + {INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart, DEFAULT_SIZE}, - {HGST_INFO_LOG, print_hgst_info_log, + {HGST_INFO_LOG, "hgst", print_hgst_info_log, DEFAULT_SIZE}, - {0, NULL, - 0}, + {0, NULL, NULL, 0}, }; static void @@ -830,11 +830,12 @@ logpage(int argc, char *argv[]) char cname[64]; uint32_t size; void *buf; + const char *vendor = NULL; struct logpage_function *f; struct nvme_controller_data cdata; print_fn_t print_fn; - while ((ch = getopt(argc, argv, "p:x")) != -1) { + while ((ch = getopt(argc, argv, "p:xv:")) != -1) { switch (ch) { case 'p': /* TODO: Add human-readable ASCII page IDs */ @@ -850,6 +851,9 @@ logpage(int argc, char *argv[]) case 'x': hexflag = true; break; + case 'v': + vendor = optarg; + break; } } @@ -893,18 +897,21 @@ logpage(int argc, char *argv[]) size = DEFAULT_SIZE; if (!hexflag) { /* - * See if there is a pretty print function for the - * specified log page. If one isn't found, we - * just revert to the default (print_hex). + * See if there is a pretty print function for the specified log + * page. If one isn't found, we just revert to the default + * (print_hex). If there was a vendor specified bt the user, and + * the page is vendor specific, don't match the print function + * unless the vendors match. */ - f = logfuncs; - while (f->log_page > 0) { - if (log_page == f->log_page) { - print_fn = f->print_fn; - size = f->size; - break; - } - f++; + for (f = logfuncs; f->log_page > 0; f++) { + if (f->vendor != NULL && vendor != NULL && + strcmp(f->vendor, vendor) != 0) + continue; + if (log_page != f->log_page) + continue; + print_fn = f->print_fn; + size = f->size; + break; } } From owner-svn-src-all@freebsd.org Thu Feb 1 19:33:17 2018 Return-Path: Delivered-To: svn-src-all@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 C6BD7EE7A94; Thu, 1 Feb 2018 19:33:17 +0000 (UTC) (envelope-from mav@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 7A4D98032C; Thu, 1 Feb 2018 19:33:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75575115C3; Thu, 1 Feb 2018 19:33:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JXHYG025775; Thu, 1 Feb 2018 19:33:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JXHmL025774; Thu, 1 Feb 2018 19:33:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011933.w11JXHmL025774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328711 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:33:18 -0000 Author: mav Date: Thu Feb 1 19:33:17 2018 New Revision: 328711 URL: https://svnweb.freebsd.org/changeset/base/328711 Log: MFC r309684 (by imp): Fix Typo Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:32:45 2018 (r328710) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:33:17 2018 (r328711) @@ -113,7 +113,7 @@ uint128_to_str(uint128_t u, char *buf, size_t buflen) return end; } -/* "fMissing" from endian.h */ +/* "Missing" from endian.h */ static __inline uint64_t le48dec(const void *pp) { From owner-svn-src-all@freebsd.org Thu Feb 1 19:33:52 2018 Return-Path: Delivered-To: svn-src-all@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 D002BEE7B2E; Thu, 1 Feb 2018 19:33:51 +0000 (UTC) (envelope-from mav@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 82AAA80479; Thu, 1 Feb 2018 19:33:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64719115C7; Thu, 1 Feb 2018 19:33:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JXpLd025850; Thu, 1 Feb 2018 19:33:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JXpeG025849; Thu, 1 Feb 2018 19:33:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011933.w11JXpeG025849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:33:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328712 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:33:52 -0000 Author: mav Date: Thu Feb 1 19:33:51 2018 New Revision: 328712 URL: https://svnweb.freebsd.org/changeset/base/328712 Log: MFC r309777 (by imp): Implement Intel's log page 0xc1 (Read Command Latency Log) and page 0xc1 (Write Command Latency Log). Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:33:17 2018 (r328711) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:33:51 2018 (r328712) @@ -324,7 +324,48 @@ print_intel_temp_stats(void *buf, uint32_t size __unus printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); } +/* + * Format from Table 22, section 5.7 IO Command Latency Statistics. + * Read and write stats pages have identical encoding. + */ static void +print_intel_read_write_lat_log(void *buf, uint32_t size __unused) +{ + const char *walker = buf; + int i; + + printf("Major: %d\n", le16dec(walker + 0)); + printf("Minor: %d\n", le16dec(walker + 2)); + for (i = 0; i < 32; i++) + printf("%4dus-%4dus: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 4 + i * 4)); + for (i = 1; i < 32; i++) + printf("%4dms-%4dms: %ju\n", i, i + 1, (uintmax_t)le32dec(walker + 132 + i * 4)); + for (i = 1; i < 32; i++) + printf("%4dms-%4dms: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 256 + i * 4)); +} + +static void +print_intel_read_lat_log(void *buf, uint32_t size) +{ + + printf("Intel Read Latency Log\n"); + printf("======================\n"); + print_intel_read_write_lat_log(buf, size); +} + +static void +print_intel_write_lat_log(void *buf, uint32_t size) +{ + + printf("Intel Write Latency Log\n"); + printf("=======================\n"); + print_intel_read_write_lat_log(buf, size); +} + +/* + * Table 19. 5.4 SMART Attributes + */ +static void print_intel_add_smart(void *buf, uint32_t size __unused) { uint8_t *walker = buf; @@ -803,11 +844,15 @@ static struct logpage_function { sizeof(struct nvme_health_information_page)}, {NVME_LOG_FIRMWARE_SLOT, NULL, print_log_firmware, sizeof(struct nvme_firmware_page)}, + {HGST_INFO_LOG, "hgst", print_hgst_info_log, + DEFAULT_SIZE}, {INTEL_LOG_TEMP_STATS, "intel", print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, - {INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart, + {INTEL_LOG_READ_LAT_LOG, "intel", print_intel_read_lat_log, DEFAULT_SIZE}, - {HGST_INFO_LOG, "hgst", print_hgst_info_log, + {INTEL_LOG_WRITE_LAT_LOG, "intel", print_intel_write_lat_log, + DEFAULT_SIZE}, + {INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart, DEFAULT_SIZE}, {0, NULL, NULL, 0}, }; From owner-svn-src-all@freebsd.org Thu Feb 1 19:35:35 2018 Return-Path: Delivered-To: svn-src-all@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 40402EE7CA5; Thu, 1 Feb 2018 19:35:35 +0000 (UTC) (envelope-from mav@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 E6E9780649; Thu, 1 Feb 2018 19:35:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1C48115CC; Thu, 1 Feb 2018 19:35:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JZYEm025992; Thu, 1 Feb 2018 19:35:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JZYTx025991; Thu, 1 Feb 2018 19:35:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011935.w11JZYTx025991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328713 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:35:35 -0000 Author: mav Date: Thu Feb 1 19:35:34 2018 New Revision: 328713 URL: https://svnweb.freebsd.org/changeset/base/328713 Log: MFC r313111 (by imp): Use aligned buffer for the firmware data. Otherwise, when loading a MAXPHYS bytes of data, the I/O would require MAXPHYS + PAGE_SIZE worth of pages to do the I/O and we'd hit an assertion in vm_fault_quick_hold_pages unless MAXPHYS was larger than 1M + PAGE_SIZE. Modified: stable/11/sbin/nvmecontrol/firmware.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/firmware.c ============================================================================== --- stable/11/sbin/nvmecontrol/firmware.c Thu Feb 1 19:33:51 2018 (r328712) +++ stable/11/sbin/nvmecontrol/firmware.c Thu Feb 1 19:35:34 2018 (r328713) @@ -114,7 +114,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl off = 0; resid = payload_size; - if ((chunk = malloc(NVME_MAX_XFER_SIZE)) == NULL) + if ((chunk = aligned_alloc(NVME_MAX_XFER_SIZE, PAGE_SIZE)) == NULL) errx(1, "unable to malloc %d bytes", NVME_MAX_XFER_SIZE); while (resid > 0) { From owner-svn-src-all@freebsd.org Thu Feb 1 19:36:43 2018 Return-Path: Delivered-To: svn-src-all@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 E761DEE7E06; Thu, 1 Feb 2018 19:36:42 +0000 (UTC) (envelope-from mav@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 98D8380842; Thu, 1 Feb 2018 19:36:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93DC8115D2; Thu, 1 Feb 2018 19:36:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JaggY026090; Thu, 1 Feb 2018 19:36:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JagrM026089; Thu, 1 Feb 2018 19:36:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011936.w11JagrM026089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328714 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:36:43 -0000 Author: mav Date: Thu Feb 1 19:36:42 2018 New Revision: 328714 URL: https://svnweb.freebsd.org/changeset/base/328714 Log: MFC r313188 (by imp): Put the arguments to aligned_alloc in the right order. Modified: stable/11/sbin/nvmecontrol/firmware.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/firmware.c ============================================================================== --- stable/11/sbin/nvmecontrol/firmware.c Thu Feb 1 19:35:34 2018 (r328713) +++ stable/11/sbin/nvmecontrol/firmware.c Thu Feb 1 19:36:42 2018 (r328714) @@ -114,7 +114,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl off = 0; resid = payload_size; - if ((chunk = aligned_alloc(NVME_MAX_XFER_SIZE, PAGE_SIZE)) == NULL) + if ((chunk = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE)) == NULL) errx(1, "unable to malloc %d bytes", NVME_MAX_XFER_SIZE); while (resid > 0) { From owner-svn-src-all@freebsd.org Thu Feb 1 19:37:19 2018 Return-Path: Delivered-To: svn-src-all@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 51629EE7EFA; Thu, 1 Feb 2018 19:37:19 +0000 (UTC) (envelope-from mav@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 F310E809E7; Thu, 1 Feb 2018 19:37:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5C46115D6; Thu, 1 Feb 2018 19:37:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JbIM4026170; Thu, 1 Feb 2018 19:37:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JbIxA026168; Thu, 1 Feb 2018 19:37:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011937.w11JbIxA026168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328715 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:37:19 -0000 Author: mav Date: Thu Feb 1 19:37:18 2018 New Revision: 328715 URL: https://svnweb.freebsd.org/changeset/base/328715 Log: MFC r313190 (by imp): Move the usage and command name lookup into functions. Modified: stable/11/sbin/nvmecontrol/nvmecontrol.c stable/11/sbin/nvmecontrol/nvmecontrol.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:36:42 2018 (r328714) +++ stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:37:18 2018 (r328715) @@ -45,13 +45,8 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" -typedef void (*nvme_fn_t)(int argc, char *argv[]); -static struct nvme_function { - const char *name; - nvme_fn_t fn; - const char *usage; -} funcs[] = { +static struct nvme_function funcs[] = { {"devlist", devlist, DEVLIST_USAGE}, {"identify", identify, IDENTIFY_USAGE}, {"perftest", perftest, PERFTEST_USAGE}, @@ -62,12 +57,10 @@ static struct nvme_function { {NULL, NULL, NULL}, }; -static void -usage(void) +void +gen_usage(struct nvme_function *f) { - struct nvme_function *f; - f = funcs; fprintf(stderr, "usage:\n"); while (f->name != NULL) { fprintf(stderr, "%s", f->usage); @@ -76,6 +69,21 @@ usage(void) exit(1); } +void +dispatch(int argc, char *argv[], struct nvme_function *tbl) +{ + struct nvme_function *f = tbl; + + while (f->name != NULL) { + if (strcmp(argv[1], f->name) == 0) + f->fn(argc-1, &argv[1]); + f++; + } + + fprintf(stderr, "Unknown command: %s\n", argv[1]); + gen_usage(tbl); +} + static void print_bytes(void *data, uint32_t length) { @@ -217,19 +225,11 @@ parse_ns_str(const char *ns_str, char *ctrlr_str, int int main(int argc, char *argv[]) { - struct nvme_function *f; if (argc < 2) - usage(); + gen_usage(funcs); - f = funcs; - while (f->name != NULL) { - if (strcmp(argv[1], f->name) == 0) - f->fn(argc-1, &argv[1]); - f++; - } - - usage(); + dispatch(argc, argv, funcs); return (0); } Modified: stable/11/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:36:42 2018 (r328714) +++ stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:37:18 2018 (r328715) @@ -31,6 +31,14 @@ #include +typedef void (*nvme_fn_t)(int argc, char *argv[]); + +struct nvme_function { + const char *name; + nvme_fn_t fn; + const char *usage; +}; + #define NVME_CTRLR_PREFIX "nvme" #define NVME_NS_PREFIX "ns" @@ -73,6 +81,8 @@ void read_namespace_data(int fd, int nsid, struct nvme void print_hex(void *data, uint32_t length); void read_logpage(int fd, uint8_t log_page, int nsid, void *payload, uint32_t payload_size); +void gen_usage(struct nvme_function *); +void dispatch(int argc, char *argv[], struct nvme_function *f); #endif From owner-svn-src-all@freebsd.org Thu Feb 1 19:37:51 2018 Return-Path: Delivered-To: svn-src-all@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 72295EE7FB6; Thu, 1 Feb 2018 19:37:51 +0000 (UTC) (envelope-from mav@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 2481780B3B; Thu, 1 Feb 2018 19:37:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F714115D8; Thu, 1 Feb 2018 19:37:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JbpFh026245; Thu, 1 Feb 2018 19:37:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JboGp026240; Thu, 1 Feb 2018 19:37:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011937.w11JboGp026240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328716 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:37:51 -0000 Author: mav Date: Thu Feb 1 19:37:50 2018 New Revision: 328716 URL: https://svnweb.freebsd.org/changeset/base/328716 Log: MFC r313191 (by imp): Implement 5 wdc-specific nvme control options for their HGST drives: wdc cap-diag Capture diagnostic data from drive wdc drive-log Capture drive history data from drive wdc get-crash-dump Retrieve firmware crash dump from drive Added: stable/11/sbin/nvmecontrol/wdc.c - copied unchanged from r313191, head/sbin/nvmecontrol/wdc.c Modified: stable/11/sbin/nvmecontrol/Makefile stable/11/sbin/nvmecontrol/nvmecontrol.8 stable/11/sbin/nvmecontrol/nvmecontrol.c stable/11/sbin/nvmecontrol/nvmecontrol.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/Makefile ============================================================================== --- stable/11/sbin/nvmecontrol/Makefile Thu Feb 1 19:37:18 2018 (r328715) +++ stable/11/sbin/nvmecontrol/Makefile Thu Feb 1 19:37:50 2018 (r328716) @@ -3,7 +3,7 @@ PACKAGE=runtime PROG= nvmecontrol SRCS= nvmecontrol.c devlist.c firmware.c identify.c logpage.c \ - perftest.c reset.c nvme_util.c power.c + perftest.c reset.c nvme_util.c power.c wdc.c MAN= nvmecontrol.8 .PATH: ${SRCTOP}/sys/dev/nvme Modified: stable/11/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:37:18 2018 (r328715) +++ stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:37:50 2018 (r328716) @@ -75,6 +75,24 @@ .Op Fl l .Op Fl p power_state .Op fl w workload_hint +.Nm +.Ic wdc cap-diag +.Op Fl o path_template +.Aq device id +.Nm +.Ic wdc drive-log +.Op Fl o path_template +.Aq device id +.Nm +.Ic wdc get-crash-dump +.Op Fl o path_template +.Aq device id +.\" .Nm +.\" .Ic wdc purge +.\" .Aq device id +.\" .Nm +.\" .Ic wdc purge-monitor +.\" .Aq device id .Sh DESCRIPTION NVM Express (NVMe) is a storage protocol standard, for SSDs and other high-speed storage devices over PCI Express. Modified: stable/11/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:37:18 2018 (r328715) +++ stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:37:50 2018 (r328716) @@ -54,6 +54,7 @@ static struct nvme_function funcs[] = { {"logpage", logpage, LOGPAGE_USAGE}, {"firmware", firmware, FIRMWARE_USAGE}, {"power", power, POWER_USAGE}, + {"wdc", wdc, WDC_USAGE}, {NULL, NULL, NULL}, }; Modified: stable/11/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:37:18 2018 (r328715) +++ stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:37:50 2018 (r328716) @@ -66,6 +66,9 @@ struct nvme_function { #define POWER_USAGE \ " nvmecontrol power [-l] [-p new-state [-w workload-hint]] \n" +#define WDC_USAGE \ +" nvmecontrol wdc (cap-diag|drive-log|get-crash-dump|purge|purge-montior)\n" + void devlist(int argc, char *argv[]); void identify(int argc, char *argv[]); void perftest(int argc, char *argv[]); @@ -73,6 +76,7 @@ void reset(int argc, char *argv[]); void logpage(int argc, char *argv[]); void firmware(int argc, char *argv[]); void power(int argc, char *argv[]); +void wdc(int argc, char *argv[]); int open_dev(const char *str, int *fd, int show_error, int exit_on_error); void parse_ns_str(const char *ns_str, char *ctrlr_str, int *nsid); Copied: stable/11/sbin/nvmecontrol/wdc.c (from r313191, head/sbin/nvmecontrol/wdc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:37:50 2018 (r328716, copy of r313191, head/sbin/nvmecontrol/wdc.c) @@ -0,0 +1,341 @@ +/*- + * Copyright (c) 2017 Netflix, Inc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nvmecontrol.h" + +#define WDC_NVME_TOC_SIZE 8 + +#define WDC_NVME_CAP_DIAG_OPCODE 0xe6 +#define WDC_NVME_CAP_DIAG_CMD 0x0000 + +#define WDC_NVME_DIAG_OPCODE 0xc6 +#define WDC_NVME_DRIVE_LOG_SIZE_CMD 0x0120 +#define WDC_NVME_DRIVE_LOG_CMD 0x0020 +#define WDC_NVME_CRASH_DUMP_SIZE_CMD 0x0320 +#define WDC_NVME_CRASH_DUMP_CMD 0x0420 +#define WDC_NVME_PFAIL_DUMP_SIZE_CMD 0x0520 +#define WDC_NVME_PFAIL_DUMP_CMD 0x0620 + +#define WDC_NVME_CLEAR_DUMP_OPCODE 0xff +#define WDC_NVME_CLEAR_CRASH_DUMP_CMD 0x0503 +#define WDC_NVME_CLEAR_PFAIL_DUMP_CMD 0x0603 + +static void wdc_cap_diag(int argc, char *argv[]); +static void wdc_drive_log(int argc, char *argv[]); +static void wdc_get_crash_dump(int argc, char *argv[]); +static void wdc_purge(int argc, char *argv[]); +static void wdc_purge_monitor(int argc, char *argv[]); + +#define WDC_CAP_DIAG_USAGE "\tnvmecontrol wdc cap-diag [-o path-template]\n" +#define WDC_DRIVE_LOG_USAGE "\tnvmecontrol wdc drive-log [-o path-template]\n" +#define WDC_GET_CRASH_DUMP_USAGE "\tnvmecontrol wdc get-crash-dump [-o path-template]\n" +#define WDC_PURGE_USAGE "\tnvmecontrol wdc purge [-o path-template]\n" +#define WDC_PURGE_MONITOR_USAGE "\tnvmecontrol wdc purge-montor\n" + +static struct nvme_function wdc_funcs[] = { + {"cap-diag", wdc_cap_diag, WDC_CAP_DIAG_USAGE}, + {"drive-log", wdc_drive_log, WDC_DRIVE_LOG_USAGE}, + {"get-crash-dump", wdc_get_crash_dump, WDC_GET_CRASH_DUMP_USAGE}, + {"purge", wdc_purge, WDC_PURGE_USAGE}, + {"purge_monitor", wdc_purge_monitor, WDC_PURGE_MONITOR_USAGE}, + {NULL, NULL, NULL}, +}; + +static void +wdc_append_serial_name(int fd, char *buf, size_t len, const char *suffix) +{ + struct nvme_controller_data cdata; + char sn[NVME_SERIAL_NUMBER_LENGTH + 1]; + char *walker; + + len -= strlen(buf); + buf += strlen(buf); + read_controller_data(fd, &cdata); + memcpy(sn, cdata.sn, NVME_SERIAL_NUMBER_LENGTH); + walker = sn + NVME_SERIAL_NUMBER_LENGTH - 1; + while (walker > sn && *walker == ' ') + walker--; + *walker = '\0'; + snprintf(buf, len, "%s%s.bin", sn, suffix); +} + +static void +wdc_get_data(int fd, uint32_t opcode, uint32_t len, uint32_t off, uint32_t cmd, + uint8_t *buffer, size_t buflen) +{ + struct nvme_pt_command pt; + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = opcode; + pt.cmd.cdw10 = len / sizeof(uint32_t); /* - 1 like all the others ??? */ + pt.cmd.cdw11 = off / sizeof(uint32_t); + pt.cmd.cdw12 = cmd; + pt.buf = buffer; + pt.len = buflen; + pt.is_read = 1; +// printf("opcode %#x cdw10(len) %#x cdw11(offset?) %#x cdw12(cmd/sub) %#x buflen %zd\n", +// (int)opcode, (int)cdw10, (int)cdw11, (int)cdw12, buflen); + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(1, "wdc_get_data request failed"); + if (nvme_completion_is_error(&pt.cpl)) + errx(1, "wdc_get_data request returned error"); +} + +static void +wdc_do_dump(int fd, char *tmpl, const char *suffix, uint32_t opcode, + uint32_t size_cmd, uint32_t cmd, int len_off) +{ + int fd2; + uint8_t *buf; + uint32_t len, resid, offset; + + wdc_append_serial_name(fd, tmpl, MAXPATHLEN, suffix); + + buf = aligned_alloc(PAGE_SIZE, WDC_NVME_TOC_SIZE); + if (buf == NULL) + errx(1, "Can't get buffer to get size"); + wdc_get_data(fd, opcode, WDC_NVME_TOC_SIZE, + 0, size_cmd, buf, WDC_NVME_TOC_SIZE); + len = be32dec(buf + len_off); + + if (len == 0) + errx(1, "No data for %s", suffix); + + printf("Dumping %d bytes to %s\n", len, tmpl); + /* XXX overwrite protection? */ + fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC); + if (fd2 < 0) + err(1, "open %s", tmpl); + offset = 0; + buf = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE); + if (buf == NULL) + errx(1, "Can't get buffer to read dump"); + while (len > 0) { + resid = len > NVME_MAX_XFER_SIZE ? NVME_MAX_XFER_SIZE : len; + wdc_get_data(fd, opcode, resid, offset, cmd, buf, resid); + if (write(fd2, buf, resid) != resid) + err(1, "write"); + offset += resid; + len -= resid; + } + free(buf); + close(fd2); +} + +static void +wdc_do_clear_dump(int fd, uint32_t opcode, uint32_t cmd) +{ + struct nvme_pt_command pt; + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = opcode; + pt.cmd.cdw12 = cmd; + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(1, "wdc_do_clear_dump request failed"); + if (nvme_completion_is_error(&pt.cpl)) + errx(1, "wdc_do_clear_dump request returned error"); +} + +static void +wdc_cap_diag_usage() +{ + fprintf(stderr, "usage:\n"); + fprintf(stderr, WDC_CAP_DIAG_USAGE); + exit(1); +} + +static void +wdc_cap_diag(int argc, char *argv[]) +{ + char path_tmpl[MAXPATHLEN]; + int ch, fd; + + path_tmpl[0] = '\0'; + while ((ch = getopt(argc, argv, "o:")) != -1) { + switch ((char)ch) { + case 'o': + strlcpy(path_tmpl, optarg, MAXPATHLEN); + break; + default: + wdc_cap_diag_usage(); + } + } + /* Check that a controller was specified. */ + if (optind >= argc) + wdc_cap_diag_usage(); + open_dev(argv[optind], &fd, 1, 1); + + wdc_do_dump(fd, path_tmpl, "cap_diag", WDC_NVME_CAP_DIAG_OPCODE, + WDC_NVME_CAP_DIAG_CMD, WDC_NVME_CAP_DIAG_CMD, 4); + + close(fd); + + exit(1); +} + +static void +wdc_drive_log_usage() +{ + fprintf(stderr, "usage:\n"); + fprintf(stderr, WDC_DRIVE_LOG_USAGE); + exit(1); +} + +static void +wdc_drive_log(int argc, char *argv[]) +{ + char path_tmpl[MAXPATHLEN]; + int ch, fd; + + path_tmpl[0] = '\0'; + while ((ch = getopt(argc, argv, "o:")) != -1) { + switch ((char)ch) { + case 'o': + strlcpy(path_tmpl, optarg, MAXPATHLEN); + break; + default: + wdc_drive_log_usage(); + } + } + /* Check that a controller was specified. */ + if (optind >= argc) + wdc_drive_log_usage(); + open_dev(argv[optind], &fd, 1, 1); + + wdc_do_dump(fd, path_tmpl, "drive_log", WDC_NVME_DIAG_OPCODE, + WDC_NVME_DRIVE_LOG_SIZE_CMD, WDC_NVME_DRIVE_LOG_CMD, 0); + + close(fd); + + exit(1); +} + +static void +wdc_get_crash_dump_usage() +{ + fprintf(stderr, "usage:\n"); + fprintf(stderr, WDC_CAP_DIAG_USAGE); + exit(1); +} + +static void +wdc_get_crash_dump(int argc, char *argv[]) +{ + char path_tmpl[MAXPATHLEN]; + int ch, fd; + + while ((ch = getopt(argc, argv, "o:")) != -1) { + switch ((char)ch) { + case 'o': + strlcpy(path_tmpl, optarg, MAXPATHLEN); + break; + default: + wdc_get_crash_dump_usage(); + } + } + /* Check that a controller was specified. */ + if (optind >= argc) + wdc_get_crash_dump_usage(); + open_dev(argv[optind], &fd, 1, 1); + + wdc_do_dump(fd, path_tmpl, "crash_dump", WDC_NVME_DIAG_OPCODE, + WDC_NVME_CRASH_DUMP_SIZE_CMD, WDC_NVME_CRASH_DUMP_CMD, 0); + wdc_do_clear_dump(fd, WDC_NVME_CLEAR_DUMP_OPCODE, + WDC_NVME_CLEAR_CRASH_DUMP_CMD); +// wdc_led_beacon_disable(fd); + wdc_do_dump(fd, path_tmpl, "pfail_dump", WDC_NVME_DIAG_OPCODE, + WDC_NVME_PFAIL_DUMP_SIZE_CMD, WDC_NVME_PFAIL_DUMP_CMD, 0); + wdc_do_clear_dump(fd, WDC_NVME_CLEAR_DUMP_OPCODE, + WDC_NVME_CLEAR_PFAIL_DUMP_CMD); + + close(fd); + + exit(1); +} + +static void +wdc_purge(int argc, char *argv[]) +{ + char path_tmpl[MAXPATHLEN]; + int ch; + + while ((ch = getopt(argc, argv, "o:")) != -1) { + switch ((char)ch) { + case 'o': + strlcpy(path_tmpl, optarg, MAXPATHLEN); + break; + default: + wdc_cap_diag_usage(); + } + } + + printf("purge has not been implemented.\n"); + exit(1); +} + +static void +wdc_purge_monitor(int argc, char *argv[]) +{ + char path_tmpl[MAXPATHLEN]; + int ch; + + while ((ch = getopt(argc, argv, "o:")) != -1) { + switch ((char)ch) { + case 'o': + strlcpy(path_tmpl, optarg, MAXPATHLEN); + break; + default: + wdc_cap_diag_usage(); + } + } + + printf("purge has not been implemented.\n"); + exit(1); +} + +void +wdc(int argc, char *argv[]) +{ + + dispatch(argc, argv, wdc_funcs); +} From owner-svn-src-all@freebsd.org Thu Feb 1 19:38:29 2018 Return-Path: Delivered-To: svn-src-all@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 D5B51EE807C; Thu, 1 Feb 2018 19:38:29 +0000 (UTC) (envelope-from mav@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 87EDB80C68; Thu, 1 Feb 2018 19:38:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82E7B115DA; Thu, 1 Feb 2018 19:38:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JcTwm026325; Thu, 1 Feb 2018 19:38:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JcTA4026324; Thu, 1 Feb 2018 19:38:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011938.w11JcTA4026324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328717 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:38:30 -0000 Author: mav Date: Thu Feb 1 19:38:29 2018 New Revision: 328717 URL: https://svnweb.freebsd.org/changeset/base/328717 Log: MFC r313251 (by imp): Fix a typo in usage string for unimplemented command. Modified: stable/11/sbin/nvmecontrol/wdc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/wdc.c ============================================================================== --- stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:37:50 2018 (r328716) +++ stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:38:29 2018 (r328717) @@ -69,7 +69,7 @@ static void wdc_purge_monitor(int argc, char *argv[]); #define WDC_DRIVE_LOG_USAGE "\tnvmecontrol wdc drive-log [-o path-template]\n" #define WDC_GET_CRASH_DUMP_USAGE "\tnvmecontrol wdc get-crash-dump [-o path-template]\n" #define WDC_PURGE_USAGE "\tnvmecontrol wdc purge [-o path-template]\n" -#define WDC_PURGE_MONITOR_USAGE "\tnvmecontrol wdc purge-montor\n" +#define WDC_PURGE_MONITOR_USAGE "\tnvmecontrol wdc purge-monitor\n" static struct nvme_function wdc_funcs[] = { {"cap-diag", wdc_cap_diag, WDC_CAP_DIAG_USAGE}, From owner-svn-src-all@freebsd.org Thu Feb 1 19:39:00 2018 Return-Path: Delivered-To: svn-src-all@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 934BAEE8101; Thu, 1 Feb 2018 19:39:00 +0000 (UTC) (envelope-from mav@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 693EF80DBF; Thu, 1 Feb 2018 19:39:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6438E115DE; Thu, 1 Feb 2018 19:39:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Jd0Z7026400; Thu, 1 Feb 2018 19:39:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Jd0fQ026399; Thu, 1 Feb 2018 19:39:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011939.w11Jd0fQ026399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:39:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328718 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:39:00 -0000 Author: mav Date: Thu Feb 1 19:39:00 2018 New Revision: 328718 URL: https://svnweb.freebsd.org/changeset/base/328718 Log: MFC r313252 (by imp): Fix off by one error that truncated the serial number for filenames. Modified: stable/11/sbin/nvmecontrol/wdc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/wdc.c ============================================================================== --- stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:38:29 2018 (r328717) +++ stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:39:00 2018 (r328718) @@ -94,7 +94,7 @@ wdc_append_serial_name(int fd, char *buf, size_t len, walker = sn + NVME_SERIAL_NUMBER_LENGTH - 1; while (walker > sn && *walker == ' ') walker--; - *walker = '\0'; + *++walker = '\0'; snprintf(buf, len, "%s%s.bin", sn, suffix); } From owner-svn-src-all@freebsd.org Thu Feb 1 19:39:30 2018 Return-Path: Delivered-To: svn-src-all@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 1B1FEEE81B4; Thu, 1 Feb 2018 19:39:30 +0000 (UTC) (envelope-from mav@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 C104E80F04; Thu, 1 Feb 2018 19:39:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB962115E0; Thu, 1 Feb 2018 19:39:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JdT2Y026482; Thu, 1 Feb 2018 19:39:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JdTS9026480; Thu, 1 Feb 2018 19:39:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011939.w11JdTS9026480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328719 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:39:30 -0000 Author: mav Date: Thu Feb 1 19:39:29 2018 New Revision: 328719 URL: https://svnweb.freebsd.org/changeset/base/328719 Log: MFC r313257 (by imp): Add some descriptions to the man page for the supported log pages as well as the new wdc commands. Make wdc be an alias for hgst when specifying the vendor to use to interpret the page. Modified: stable/11/sbin/nvmecontrol/logpage.c stable/11/sbin/nvmecontrol/nvmecontrol.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:39:00 2018 (r328718) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:39:29 2018 (r328719) @@ -846,6 +846,8 @@ static struct logpage_function { sizeof(struct nvme_firmware_page)}, {HGST_INFO_LOG, "hgst", print_hgst_info_log, DEFAULT_SIZE}, + {HGST_INFO_LOG, "wdc", print_hgst_info_log, + DEFAULT_SIZE}, {INTEL_LOG_TEMP_STATS, "intel", print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, {INTEL_LOG_READ_LAT_LOG, "intel", print_intel_read_lat_log, Modified: stable/11/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:39:00 2018 (r328718) +++ stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:39:29 2018 (r328719) @@ -62,6 +62,7 @@ .Ic logpage .Aq Fl p Ar page_id .Op Fl x +.Op Fl v Ar vendor-string .Aq device id .Aq namespace id .Nm @@ -74,7 +75,7 @@ .Ic power .Op Fl l .Op Fl p power_state -.Op fl w workload_hint +.Op Fl w workload_hint .Nm .Ic wdc cap-diag .Op Fl o path_template @@ -96,6 +97,26 @@ .Sh DESCRIPTION NVM Express (NVMe) is a storage protocol standard, for SSDs and other high-speed storage devices over PCI Express. +.Pp +.Ss logpage +The logpage command knows how to print log pages of various types. +It also knows about vendor specific log pages from hgst/wdc and intel. +Page 0xc1 for hgst/wdc contains the advanced smart information about +the drive. +Page 0xc1 is read latency stats for intel. +Page 0xc2 is write latency stats for intel. +Page 0xc5 is temperature stats for intel. +Page 0xca is advanced smart information for intel. +.Ss wdc +The various wdc command retrieve log data from the wdc/hgst drives. +The +.Fl o +flag specifies a path template to use to output the files. +Each file takes the path template (which defaults to nothing), appends +the drive's serial number and the type of dump it is followed +by .bin. +These logs must be sent to the vendor for analysis. +This tool only provides a way to extract them. .Sh EXAMPLES .Dl nvmecontrol devlist .Pp From owner-svn-src-all@freebsd.org Thu Feb 1 19:39:34 2018 Return-Path: Delivered-To: svn-src-all@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 19763EE81DA; Thu, 1 Feb 2018 19:39:34 +0000 (UTC) (envelope-from rgrimes@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 B535D80F1F; Thu, 1 Feb 2018 19:39:33 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AD3FD115E2; Thu, 1 Feb 2018 19:39:33 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JdXxs026529; Thu, 1 Feb 2018 19:39:33 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JdXBq026528; Thu, 1 Feb 2018 19:39:33 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201802011939.w11JdXBq026528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 1 Feb 2018 19:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328720 - head/share/examples/bhyve X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/share/examples/bhyve X-SVN-Commit-Revision: 328720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:39:34 -0000 Author: rgrimes Date: Thu Feb 1 19:39:33 2018 New Revision: 328720 URL: https://svnweb.freebsd.org/changeset/base/328720 Log: Add -n to usage synopsis forgotten in r328695. Fix long lines in usage. Consistently use "default:" rather than "default is" Approved by: grehan (mentor) MFC after: 3 days Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh ============================================================================== --- head/share/examples/bhyve/vmrun.sh Thu Feb 1 19:39:29 2018 (r328719) +++ head/share/examples/bhyve/vmrun.sh Thu Feb 1 19:39:33 2018 (r328720) @@ -49,34 +49,43 @@ errmsg() { usage() { local msg=$1 - echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ] [-d ]" - echo " [-e ] [-f ] [-F ]" + echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ]" \ + "[-d ]" + echo " [-e ] [-f ]" \ + "[-F ]" echo " [-g ] [-H ]" echo " [-I ] [-l ]" echo " [-L ]" - echo " [-m ] [-P ] [-t ] " + echo " [-m ]" \ + "[-n ]" + echo " [-P ] [-t ] " echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" echo " -A: use AHCI disk emulation instead of virtio" - echo " -c: number of virtual cpus (default is ${DEFAULT_CPUS})" - echo " -C: console device (default is ${DEFAULT_CONSOLE})" - echo " -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})" + echo " -c: number of virtual cpus (default: ${DEFAULT_CPUS})" + echo " -C: console device (default: ${DEFAULT_CONSOLE})" + echo " -d: virtio diskdev file (default: ${DEFAULT_VIRTIO_DISK})" echo " -e: set FreeBSD loader environment variable" echo " -E: Use UEFI mode" echo " -f: Use a specific UEFI firmware" - echo " -F: Use a custom UEFI GOP framebuffer size (default: w=1024,h=768)" + echo " -F: Use a custom UEFI GOP framebuffer size" \ + "(default: w=1024,h=768)" echo " -g: listen for connection from kgdb at " echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" - echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" - echo " -l: the OS loader to use (default is /boot/userboot.so)" - echo " -L: IP address for UEFI GOP VNC server (default: 127.0.0.1)" - echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" - echo " -n: network adapter emulation type (default is ${DEFAULT_NIC})" - echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)" + echo " -I: Installation CDROM image location" \ + "(default: ${DEFAULT_ISOFILE})" + echo " -l: the OS loader to use (default: /boot/userboot.so)" + echo " -L: IP address for UEFI GOP VNC server" \ + "(default: 127.0.0.1)" + echo " -m: memory size (default: ${DEFAULT_MEMSIZE})" + echo " -n: network adapter emulation type" \ + "(default: ${DEFAULT_NIC})" + echo " -p: pass-through a host PCI device at bus/slot/func" \ + "(e.g. 10/0/0)" echo " -P: UEFI GOP VNC port (default: 5900)" - echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" + echo " -t: tap device for virtio-net (default: $DEFAULT_TAPDEV)" echo " -T: Enable tablet device (for UEFI GOP)" echo " -u: RTC keeps UTC time" echo " -v: Wait for VNC client connection before booting VM" From owner-svn-src-all@freebsd.org Thu Feb 1 19:40:52 2018 Return-Path: Delivered-To: svn-src-all@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 EF5BDEE8354; Thu, 1 Feb 2018 19:40:51 +0000 (UTC) (envelope-from mav@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 A22408122D; Thu, 1 Feb 2018 19:40:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D277115FE; Thu, 1 Feb 2018 19:40:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Jepig026656; Thu, 1 Feb 2018 19:40:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JepKd026654; Thu, 1 Feb 2018 19:40:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011940.w11JepKd026654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:40:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328721 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:40:52 -0000 Author: mav Date: Thu Feb 1 19:40:51 2018 New Revision: 328721 URL: https://svnweb.freebsd.org/changeset/base/328721 Log: MFC r313258 (by imp): Add the ability to dump log pages directly in binary to stdout. Update man page to include this flag, and an example of dumping a vendor-specific page while I'm here. Modified: stable/11/sbin/nvmecontrol/logpage.c stable/11/sbin/nvmecontrol/nvmecontrol.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:39:33 2018 (r328720) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:40:51 2018 (r328721) @@ -74,6 +74,12 @@ kv_lookup(const struct kv_name *kv, size_t kv_count, u return bad; } +static void +print_bin(void *data, uint32_t length) +{ + write(STDOUT_FILENO, data, length); +} + /* * 128-bit integer augments to standard values. On i386 this * doesn't exist, so we use 64-bit values. The 128-bit counters @@ -872,7 +878,7 @@ logpage(int argc, char *argv[]) { int fd, nsid; int log_page = 0, pageflag = false; - int hexflag = false, ns_specified; + int binflag = false, hexflag = false, ns_specified; char ch, *p; char cname[64]; uint32_t size; @@ -882,8 +888,11 @@ logpage(int argc, char *argv[]) struct nvme_controller_data cdata; print_fn_t print_fn; - while ((ch = getopt(argc, argv, "p:xv:")) != -1) { + while ((ch = getopt(argc, argv, "bp:xv:")) != -1) { switch (ch) { + case 'b': + binflag = true; + break; case 'p': /* TODO: Add human-readable ASCII page IDs */ log_page = strtol(optarg, &p, 0); @@ -942,7 +951,9 @@ logpage(int argc, char *argv[]) print_fn = print_hex; size = DEFAULT_SIZE; - if (!hexflag) { + if (binflag) + print_fn = print_bin; + if (!binflag && !hexflag) { /* * See if there is a pretty print function for the specified log * page. If one isn't found, we just revert to the default Modified: stable/11/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:39:33 2018 (r328720) +++ stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:40:51 2018 (r328721) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 26, 2013 +.Dd February 4, 2017 .Dt NVMECONTROL 8 .Os .Sh NAME @@ -63,6 +63,7 @@ .Aq Fl p Ar page_id .Op Fl x .Op Fl v Ar vendor-string +.Op Fl b .Aq device id .Aq namespace id .Nm @@ -147,9 +148,20 @@ Display a human-readable summary of the nvme0 controll Log pages defined by the NVMe specification include Error Information Log (ID=1), SMART/Health Information Log (ID=2), and Firmware Slot Log (ID=3). .Pp +.Dl nvmecontrol logpage -p 0xc1 -v wdc nvme0 +.Pp +Display a human-readable summary of the nvme0's wdc-specific advanced +SMART data. +.Pp .Dl nvmecontrol logpage -p 1 -x nvme0 .Pp Display a hexadecimal dump of the nvme0 controller's Error Information Log. +.Pp +.Dl nvmecontrol logpage -p 0xcb -b nvme0 > /tmp/page-cb.bin +.Pp +Print the contents of vendor specific page 0xcb as binary data on +standard out. +Redirect it to a temporary file. .Pp .Dl nvmecontrol firmware -s 2 -f /tmp/nvme_firmware nvme0 .Pp From owner-svn-src-all@freebsd.org Thu Feb 1 19:41:46 2018 Return-Path: Delivered-To: svn-src-all@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 BFB21EE8549; Thu, 1 Feb 2018 19:41:46 +0000 (UTC) (envelope-from mav@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 7187581569; Thu, 1 Feb 2018 19:41:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 695A511641; Thu, 1 Feb 2018 19:41:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JfkLL030299; Thu, 1 Feb 2018 19:41:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Jfkf7030298; Thu, 1 Feb 2018 19:41:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011941.w11Jfkf7030298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:41:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328722 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:41:46 -0000 Author: mav Date: Thu Feb 1 19:41:46 2018 New Revision: 328722 URL: https://svnweb.freebsd.org/changeset/base/328722 Log: MFC r313259 (by imp): Use ssize_t instead of uint32_t to prevent warnings about a comparison with different signs. Due to the promotion rules, this would only happen on 32-bit platforms. Modified: stable/11/sbin/nvmecontrol/wdc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/wdc.c ============================================================================== --- stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:40:51 2018 (r328721) +++ stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:41:46 2018 (r328722) @@ -127,7 +127,8 @@ wdc_do_dump(int fd, char *tmpl, const char *suffix, ui { int fd2; uint8_t *buf; - uint32_t len, resid, offset; + uint32_t len, offset; + ssize_t resid; wdc_append_serial_name(fd, tmpl, MAXPATHLEN, suffix); From owner-svn-src-all@freebsd.org Thu Feb 1 19:43:19 2018 Return-Path: Delivered-To: svn-src-all@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 8A108EE870E; Thu, 1 Feb 2018 19:43:19 +0000 (UTC) (envelope-from mav@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 38D7A817FE; Thu, 1 Feb 2018 19:43:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33A7E1178C; Thu, 1 Feb 2018 19:43:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JhJnW031207; Thu, 1 Feb 2018 19:43:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JhJZo031206; Thu, 1 Feb 2018 19:43:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011943.w11JhJZo031206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328723 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:43:19 -0000 Author: mav Date: Thu Feb 1 19:43:18 2018 New Revision: 328723 URL: https://svnweb.freebsd.org/changeset/base/328723 Log: MFC r314228 (by imp): Fix typos in output. Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:41:46 2018 (r328722) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:43:18 2018 (r328723) @@ -714,13 +714,13 @@ print_hgst_info_temp_history(void *buf, uint16_t subty printf(" %-30s: %d C\n", "Minimum Temperature", *walker++); min = le32dec(walker); walker += 4; - printf(" %-30s: %d:%02d:00\n", "Max Temperture Time", min / 60, min % 60); + printf(" %-30s: %d:%02d:00\n", "Max Temperature Time", min / 60, min % 60); min = le32dec(walker); walker += 4; - printf(" %-30s: %d:%02d:00\n", "Over Temperture Duration", min / 60, min % 60); + printf(" %-30s: %d:%02d:00\n", "Over Temperature Duration", min / 60, min % 60); min = le32dec(walker); walker += 4; - printf(" %-30s: %d:%02d:00\n", "Min Temperture Time", min / 60, min % 60); + printf(" %-30s: %d:%02d:00\n", "Min Temperature Time", min / 60, min % 60); } static void From owner-svn-src-all@freebsd.org Thu Feb 1 19:43:52 2018 Return-Path: Delivered-To: svn-src-all@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 38B21EE8795; Thu, 1 Feb 2018 19:43:52 +0000 (UTC) (envelope-from mav@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 DE1FE81930; Thu, 1 Feb 2018 19:43:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D932E1178D; Thu, 1 Feb 2018 19:43:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JhpfR031280; Thu, 1 Feb 2018 19:43:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JhpLV031279; Thu, 1 Feb 2018 19:43:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011943.w11JhpLV031279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328724 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:43:52 -0000 Author: mav Date: Thu Feb 1 19:43:51 2018 New Revision: 328724 URL: https://svnweb.freebsd.org/changeset/base/328724 Log: MFC r314229 (by imp): Exit with usage if argv[1] is NULL in dispatch. This fixes core dumps when a command has subcommands, but the user doesn't give the parameters on the command line. Modified: stable/11/sbin/nvmecontrol/nvmecontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:43:18 2018 (r328723) +++ stable/11/sbin/nvmecontrol/nvmecontrol.c Thu Feb 1 19:43:51 2018 (r328724) @@ -75,6 +75,11 @@ dispatch(int argc, char *argv[], struct nvme_function { struct nvme_function *f = tbl; + if (argv[1] == NULL) { + gen_usage(tbl); + return; + } + while (f->name != NULL) { if (strcmp(argv[1], f->name) == 0) f->fn(argc-1, &argv[1]); From owner-svn-src-all@freebsd.org Thu Feb 1 19:44:25 2018 Return-Path: Delivered-To: svn-src-all@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 91703EE8845; Thu, 1 Feb 2018 19:44:25 +0000 (UTC) (envelope-from mav@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 4454181A5F; Thu, 1 Feb 2018 19:44:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F3F91178F; Thu, 1 Feb 2018 19:44:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JiPYM031379; Thu, 1 Feb 2018 19:44:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JiOoP031376; Thu, 1 Feb 2018 19:44:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011944.w11JiOoP031376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328725 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:44:25 -0000 Author: mav Date: Thu Feb 1 19:44:24 2018 New Revision: 328725 URL: https://svnweb.freebsd.org/changeset/base/328725 Log: MFC r314230 (by imp): Make nvmecontrol logpage -p help list known pages. Make -p help and -v help list all the pages we know about. Add -v to usage. Update the man page. Modified: stable/11/sbin/nvmecontrol/logpage.c stable/11/sbin/nvmecontrol/nvmecontrol.8 stable/11/sbin/nvmecontrol/nvmecontrol.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:43:51 2018 (r328724) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:44:24 2018 (r328725) @@ -369,7 +369,7 @@ print_intel_write_lat_log(void *buf, uint32_t size) } /* - * Table 19. 5.4 SMART Attributes + * Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra data not documented. */ static void print_intel_add_smart(void *buf, uint32_t size __unused) @@ -835,34 +835,39 @@ print_hgst_info_log(void *buf, uint32_t size __unused) /* * Table of log page printer / sizing. * - * This includes Intel specific pages that are widely implemented. Not - * sure how best to switch between different vendors. + * This includes Intel specific pages that are widely implemented. + * Make sure you keep all the pages of one vendor together so -v help + * lists all the vendors pages. */ static struct logpage_function { uint8_t log_page; const char *vendor; + const char *name; print_fn_t print_fn; size_t size; } logfuncs[] = { - {NVME_LOG_ERROR, NULL, print_log_error, - 0}, - {NVME_LOG_HEALTH_INFORMATION, NULL, print_log_health, - sizeof(struct nvme_health_information_page)}, - {NVME_LOG_FIRMWARE_SLOT, NULL, print_log_firmware, - sizeof(struct nvme_firmware_page)}, - {HGST_INFO_LOG, "hgst", print_hgst_info_log, - DEFAULT_SIZE}, - {HGST_INFO_LOG, "wdc", print_hgst_info_log, - DEFAULT_SIZE}, - {INTEL_LOG_TEMP_STATS, "intel", print_intel_temp_stats, - sizeof(struct intel_log_temp_stats)}, - {INTEL_LOG_READ_LAT_LOG, "intel", print_intel_read_lat_log, - DEFAULT_SIZE}, - {INTEL_LOG_WRITE_LAT_LOG, "intel", print_intel_write_lat_log, - DEFAULT_SIZE}, - {INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart, - DEFAULT_SIZE}, - {0, NULL, NULL, 0}, + {NVME_LOG_ERROR, NULL, "Drive Error Log", + print_log_error, 0}, + {NVME_LOG_HEALTH_INFORMATION, NULL, "Health/SMART Data", + print_log_health, sizeof(struct nvme_health_information_page)}, + {NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information", + print_log_firmware, sizeof(struct nvme_firmware_page)}, + {HGST_INFO_LOG, "hgst", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE}, + {HGST_INFO_LOG, "wds", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE}, + {INTEL_LOG_TEMP_STATS, "intel", "Temperature Stats", + print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, + {INTEL_LOG_READ_LAT_LOG, "intel", "Read Latencies", + print_intel_read_lat_log, DEFAULT_SIZE}, + {INTEL_LOG_WRITE_LAT_LOG, "intel", "Write Latencies", + print_intel_write_lat_log, DEFAULT_SIZE}, + {INTEL_LOG_ADD_SMART, "intel", "Extra Health/SMART Data", + print_intel_add_smart, DEFAULT_SIZE}, + {INTEL_LOG_ADD_SMART, "samsung", "Extra Health/SMART Data", + print_intel_add_smart, DEFAULT_SIZE}, + + {0, NULL, NULL, NULL, 0}, }; static void @@ -873,6 +878,23 @@ logpage_usage(void) exit(1); } +static void +logpage_help(void) +{ + struct logpage_function *f; + const char *v; + + fprintf(stderr, "\n"); + fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name"); + fprintf(stderr, "-------- ---------- ----------\n"); + for (f = logfuncs; f->log_page > 0; f++) { + v = f->vendor == NULL ? "-" : f->vendor; + fprintf(stderr, "0x%02x %-10s %s\n", f->log_page, v, f->name); + } + + exit(1); +} + void logpage(int argc, char *argv[]) { @@ -894,6 +916,9 @@ logpage(int argc, char *argv[]) binflag = true; break; case 'p': + if (strcmp(optarg, "help") == 0) + logpage_help(); + /* TODO: Add human-readable ASCII page IDs */ log_page = strtol(optarg, &p, 0); if (p != NULL && *p != '\0') { @@ -908,6 +933,8 @@ logpage(int argc, char *argv[]) hexflag = true; break; case 'v': + if (strcmp(optarg, "help") == 0) + logpage_help(); vendor = optarg; break; } Modified: stable/11/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:43:51 2018 (r328724) +++ stable/11/sbin/nvmecontrol/nvmecontrol.8 Thu Feb 1 19:44:24 2018 (r328725) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 4, 2017 +.Dd February 24, 2017 .Dt NVMECONTROL 8 .Os .Sh NAME @@ -108,6 +108,15 @@ Page 0xc1 is read latency stats for intel. Page 0xc2 is write latency stats for intel. Page 0xc5 is temperature stats for intel. Page 0xca is advanced smart information for intel. +.Pp +Specifying +.Fl p +.Ic help +will list all valid vendors and pages. +.Fl x +will print the page as hex. +.Fl b +will print the binary data for the page. .Ss wdc The various wdc command retrieve log data from the wdc/hgst drives. The Modified: stable/11/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:43:51 2018 (r328724) +++ stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:44:24 2018 (r328725) @@ -58,7 +58,7 @@ struct nvme_function { " nvmecontrol reset \n" #define LOGPAGE_USAGE \ -" nvmecontrol logpage <-p page_id> [-x] \n" \ +" nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ #define FIRMWARE_USAGE \ " nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] \n" From owner-svn-src-all@freebsd.org Thu Feb 1 19:45:29 2018 Return-Path: Delivered-To: svn-src-all@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 70147EE895F; Thu, 1 Feb 2018 19:45:29 +0000 (UTC) (envelope-from mav@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 1E0B081BC1; Thu, 1 Feb 2018 19:45:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 191AF11792; Thu, 1 Feb 2018 19:45:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JjSYj031498; Thu, 1 Feb 2018 19:45:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JjSSS031497; Thu, 1 Feb 2018 19:45:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011945.w11JjSSS031497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328726 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:45:29 -0000 Author: mav Date: Thu Feb 1 19:45:28 2018 New Revision: 328726 URL: https://svnweb.freebsd.org/changeset/base/328726 Log: MFC r316105 (by ngie): Don't use K&R style prototypes; ANSIfy them This fixes several -Wold-style-definition warnings. Modified: stable/11/sbin/nvmecontrol/wdc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/wdc.c ============================================================================== --- stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:44:24 2018 (r328725) +++ stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:45:28 2018 (r328726) @@ -178,7 +178,7 @@ wdc_do_clear_dump(int fd, uint32_t opcode, uint32_t cm } static void -wdc_cap_diag_usage() +wdc_cap_diag_usage(void) { fprintf(stderr, "usage:\n"); fprintf(stderr, WDC_CAP_DIAG_USAGE); @@ -215,7 +215,7 @@ wdc_cap_diag(int argc, char *argv[]) } static void -wdc_drive_log_usage() +wdc_drive_log_usage(void) { fprintf(stderr, "usage:\n"); fprintf(stderr, WDC_DRIVE_LOG_USAGE); @@ -252,7 +252,7 @@ wdc_drive_log(int argc, char *argv[]) } static void -wdc_get_crash_dump_usage() +wdc_get_crash_dump_usage(void) { fprintf(stderr, "usage:\n"); fprintf(stderr, WDC_CAP_DIAG_USAGE); From owner-svn-src-all@freebsd.org Thu Feb 1 19:46:09 2018 Return-Path: Delivered-To: svn-src-all@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 1511DEE8A09; Thu, 1 Feb 2018 19:46:09 +0000 (UTC) (envelope-from mav@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 BBBCC81CDF; Thu, 1 Feb 2018 19:46:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6BDD11794; Thu, 1 Feb 2018 19:46:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Jk8Wq031580; Thu, 1 Feb 2018 19:46:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Jk8sZ031579; Thu, 1 Feb 2018 19:46:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011946.w11Jk8sZ031579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:46:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328727 - stable/11/sys/cam/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/nvme X-SVN-Commit-Revision: 328727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:46:09 -0000 Author: mav Date: Thu Feb 1 19:46:08 2018 New Revision: 328727 URL: https://svnweb.freebsd.org/changeset/base/328727 Log: MFC r320412 (by imp): Namespace is 32-bits, don't cast it to 16 here Modified: stable/11/sys/cam/nvme/nvme_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:45:28 2018 (r328726) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:46:08 2018 (r328727) @@ -745,7 +745,7 @@ ndaregister(struct cam_periph *periph, void *arg) /* * The name space ID is the lun, save it for later I/O */ - softc->nsid = (uint16_t)xpt_path_lun_id(periph->path); + softc->nsid = (uint32_t)xpt_path_lun_id(periph->path); /* * Register this media as a disk From owner-svn-src-all@freebsd.org Thu Feb 1 19:46:42 2018 Return-Path: Delivered-To: svn-src-all@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 9CCE7EE8AEE; Thu, 1 Feb 2018 19:46:42 +0000 (UTC) (envelope-from mav@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 4A8F081E53; Thu, 1 Feb 2018 19:46:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4583F11798; Thu, 1 Feb 2018 19:46:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Jkg9j031662; Thu, 1 Feb 2018 19:46:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JkfPP031658; Thu, 1 Feb 2018 19:46:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011946.w11JkfPP031658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:46:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328728 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:46:42 -0000 Author: mav Date: Thu Feb 1 19:46:41 2018 New Revision: 328728 URL: https://svnweb.freebsd.org/changeset/base/328728 Log: MFC r320423 (by imp): Move 128-bit integer routines to util.c so they can be used by more than just the log page code. Added: stable/11/sbin/nvmecontrol/util.c - copied unchanged from r320423, head/sbin/nvmecontrol/util.c Modified: stable/11/sbin/nvmecontrol/Makefile stable/11/sbin/nvmecontrol/logpage.c stable/11/sbin/nvmecontrol/nvmecontrol.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/Makefile ============================================================================== --- stable/11/sbin/nvmecontrol/Makefile Thu Feb 1 19:46:08 2018 (r328727) +++ stable/11/sbin/nvmecontrol/Makefile Thu Feb 1 19:46:41 2018 (r328728) @@ -3,7 +3,7 @@ PACKAGE=runtime PROG= nvmecontrol SRCS= nvmecontrol.c devlist.c firmware.c identify.c logpage.c \ - perftest.c reset.c nvme_util.c power.c wdc.c + perftest.c reset.c nvme_util.c power.c util.c wdc.c MAN= nvmecontrol.8 .PATH: ${SRCTOP}/sys/dev/nvme Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:46:08 2018 (r328727) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 19:46:41 2018 (r328728) @@ -80,54 +80,6 @@ print_bin(void *data, uint32_t length) write(STDOUT_FILENO, data, length); } -/* - * 128-bit integer augments to standard values. On i386 this - * doesn't exist, so we use 64-bit values. The 128-bit counters - * are crazy anyway, since for this purpose, you'd need a - * billion IOPs for billions of seconds to overflow them. - * So, on 32-bit i386, you'll get truncated values. - */ -#define UINT128_DIG 39 -#ifdef __i386__ -typedef uint64_t uint128_t; -#else -typedef __uint128_t uint128_t; -#endif - -static inline uint128_t -to128(void *p) -{ - return *(uint128_t *)p; -} - -static char * -uint128_to_str(uint128_t u, char *buf, size_t buflen) -{ - char *end = buf + buflen - 1; - - *end-- = '\0'; - if (u == 0) - *end-- = '0'; - while (u && end >= buf) { - *end-- = u % 10 + '0'; - u /= 10; - } - end++; - if (u != 0) - return NULL; - - return end; -} - -/* "Missing" from endian.h */ -static __inline uint64_t -le48dec(const void *pp) -{ - uint8_t const *p = (uint8_t const *)pp; - - return (((uint64_t)le16dec(p + 4) << 32) | le32dec(p)); -} - static void * get_log_buffer(uint32_t size) { Modified: stable/11/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:46:08 2018 (r328727) +++ stable/11/sbin/nvmecontrol/nvmecontrol.h Thu Feb 1 19:46:41 2018 (r328728) @@ -88,5 +88,27 @@ void read_logpage(int fd, uint8_t log_page, int nsid, void gen_usage(struct nvme_function *); void dispatch(int argc, char *argv[], struct nvme_function *f); +/* Utility Routines */ +/* + * 128-bit integer augments to standard values. On i386 this + * doesn't exist, so we use 64-bit values. So, on 32-bit i386, + * you'll get truncated values until someone implement 128bit + * ints in sofware. + */ +#define UINT128_DIG 39 +#ifdef __i386__ +typedef uint64_t uint128_t; +#else +typedef __uint128_t uint128_t; #endif +static __inline uint128_t +to128(void *p) +{ + return *(uint128_t *)p; +} + +uint64_t le48dec(const void *pp); +char * uint128_to_str(uint128_t u, char *buf, size_t buflen); + +#endif Copied: stable/11/sbin/nvmecontrol/util.c (from r320423, head/sbin/nvmecontrol/util.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sbin/nvmecontrol/util.c Thu Feb 1 19:46:41 2018 (r328728, copy of r320423, head/sbin/nvmecontrol/util.c) @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2017 Netflix, Inc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "nvmecontrol.h" + +char * +uint128_to_str(uint128_t u, char *buf, size_t buflen) +{ + char *end = buf + buflen - 1; + + *end-- = '\0'; + if (u == 0) + *end-- = '0'; + while (u && end >= buf) { + *end-- = u % 10 + '0'; + u /= 10; + } + end++; + if (u != 0) + return NULL; + + return end; +} + +/* "Missing" from endian.h */ +uint64_t +le48dec(const void *pp) +{ + uint8_t const *p = (uint8_t const *)pp; + + return (((uint64_t)le16dec(p + 4) << 32) | le32dec(p)); +} From owner-svn-src-all@freebsd.org Thu Feb 1 19:47:17 2018 Return-Path: Delivered-To: svn-src-all@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 54C63EE8BD5; Thu, 1 Feb 2018 19:47:17 +0000 (UTC) (envelope-from mav@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 066BE81FCA; Thu, 1 Feb 2018 19:47:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCF281179B; Thu, 1 Feb 2018 19:47:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JlG7C031740; Thu, 1 Feb 2018 19:47:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JlGqV031739; Thu, 1 Feb 2018 19:47:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011947.w11JlGqV031739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328729 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:47:17 -0000 Author: mav Date: Thu Feb 1 19:47:16 2018 New Revision: 328729 URL: https://svnweb.freebsd.org/changeset/base/328729 Log: MFC r320425 (by imp): Report some aspects of namespaces and namespace support in identify command. Modified: stable/11/sbin/nvmecontrol/identify.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/identify.c ============================================================================== --- stable/11/sbin/nvmecontrol/identify.c Thu Feb 1 19:46:41 2018 (r328728) +++ stable/11/sbin/nvmecontrol/identify.c Thu Feb 1 19:47:16 2018 (r328729) @@ -44,6 +44,7 @@ static void print_controller(struct nvme_controller_data *cdata) { uint8_t str[128]; + char cbuf[UINT128_DIG + 1]; printf("Controller Capabilities/Features\n"); printf("================================\n"); @@ -65,8 +66,8 @@ print_controller(struct nvme_controller_data *cdata) printf("Unlimited\n"); else printf("%d\n", PAGE_SIZE * (1 << cdata->mdts)); - printf("\n"); + printf("\n"); printf("Admin Command Set Attributes\n"); printf("============================\n"); printf("Security Send/Receive: %s\n", @@ -75,6 +76,8 @@ print_controller(struct nvme_controller_data *cdata) cdata->oacs.format ? "Supported" : "Not Supported"); printf("Firmware Activate/Download: %s\n", cdata->oacs.firmware ? "Supported" : "Not Supported"); + printf("Namespace Managment: %s\n", + cdata->oacs.nsmgmt ? "Supported" : "Not Supported"); printf("Abort Command Limit: %d\n", cdata->acl+1); printf("Async Event Request Limit: %d\n", cdata->aerl+1); printf("Number of Firmware Slots: "); @@ -91,8 +94,8 @@ print_controller(struct nvme_controller_data *cdata) cdata->lpa.ns_smart ? "Yes" : "No"); printf("Error Log Page Entries: %d\n", cdata->elpe+1); printf("Number of Power States: %d\n", cdata->npss+1); - printf("\n"); + printf("\n"); printf("NVM Command Set Attributes\n"); printf("==========================\n"); printf("Submission Queue Entry Size\n"); @@ -110,6 +113,16 @@ print_controller(struct nvme_controller_data *cdata) cdata->oncs.dsm ? "Supported" : "Not Supported"); printf("Volatile Write Cache: %s\n", cdata->vwc.present ? "Present" : "Not Present"); + + if (cdata->oacs.nsmgmt) { + printf("\n"); + printf("Namespace Drive Attributes\n"); + printf("==========================\n"); + printf("NVM total cap: %s\n", + uint128_to_str(to128(cdata->untncap.tnvmcap), cbuf, sizeof(cbuf))); + printf("NVM unallocated cap: %s\n", + uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, sizeof(cbuf))); + } } static void From owner-svn-src-all@freebsd.org Thu Feb 1 19:48:06 2018 Return-Path: Delivered-To: svn-src-all@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 D154CEE8CF8; Thu, 1 Feb 2018 19:48:05 +0000 (UTC) (envelope-from mav@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 59CFE82170; Thu, 1 Feb 2018 19:48:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54CB91179D; Thu, 1 Feb 2018 19:48:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11Jm5EP031823; Thu, 1 Feb 2018 19:48:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Jm5de031822; Thu, 1 Feb 2018 19:48:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011948.w11Jm5de031822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328730 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:48:06 -0000 Author: mav Date: Thu Feb 1 19:48:05 2018 New Revision: 328730 URL: https://svnweb.freebsd.org/changeset/base/328730 Log: MFC r320483 (by imp): Improve wdc error log pulling. After review by the WDC engineers, improve how we pull down the so-called 'e6' logs. The 'c6' logs are obsolete and support for them has been removed because FreeBSD needed to pull them in chunks, which is incompatible with the 0xc6 opcode implementation. Rather than leave the code in place that produces bad log pulls, remove it. Modified: stable/11/sbin/nvmecontrol/wdc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/wdc.c ============================================================================== --- stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:47:16 2018 (r328729) +++ stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:48:05 2018 (r328730) @@ -47,36 +47,12 @@ __FBSDID("$FreeBSD$"); #define WDC_NVME_CAP_DIAG_OPCODE 0xe6 #define WDC_NVME_CAP_DIAG_CMD 0x0000 -#define WDC_NVME_DIAG_OPCODE 0xc6 -#define WDC_NVME_DRIVE_LOG_SIZE_CMD 0x0120 -#define WDC_NVME_DRIVE_LOG_CMD 0x0020 -#define WDC_NVME_CRASH_DUMP_SIZE_CMD 0x0320 -#define WDC_NVME_CRASH_DUMP_CMD 0x0420 -#define WDC_NVME_PFAIL_DUMP_SIZE_CMD 0x0520 -#define WDC_NVME_PFAIL_DUMP_CMD 0x0620 - -#define WDC_NVME_CLEAR_DUMP_OPCODE 0xff -#define WDC_NVME_CLEAR_CRASH_DUMP_CMD 0x0503 -#define WDC_NVME_CLEAR_PFAIL_DUMP_CMD 0x0603 - static void wdc_cap_diag(int argc, char *argv[]); -static void wdc_drive_log(int argc, char *argv[]); -static void wdc_get_crash_dump(int argc, char *argv[]); -static void wdc_purge(int argc, char *argv[]); -static void wdc_purge_monitor(int argc, char *argv[]); #define WDC_CAP_DIAG_USAGE "\tnvmecontrol wdc cap-diag [-o path-template]\n" -#define WDC_DRIVE_LOG_USAGE "\tnvmecontrol wdc drive-log [-o path-template]\n" -#define WDC_GET_CRASH_DUMP_USAGE "\tnvmecontrol wdc get-crash-dump [-o path-template]\n" -#define WDC_PURGE_USAGE "\tnvmecontrol wdc purge [-o path-template]\n" -#define WDC_PURGE_MONITOR_USAGE "\tnvmecontrol wdc purge-monitor\n" static struct nvme_function wdc_funcs[] = { {"cap-diag", wdc_cap_diag, WDC_CAP_DIAG_USAGE}, - {"drive-log", wdc_drive_log, WDC_DRIVE_LOG_USAGE}, - {"get-crash-dump", wdc_get_crash_dump, WDC_GET_CRASH_DUMP_USAGE}, - {"purge", wdc_purge, WDC_PURGE_USAGE}, - {"purge_monitor", wdc_purge_monitor, WDC_PURGE_MONITOR_USAGE}, {NULL, NULL, NULL}, }; @@ -123,8 +99,9 @@ wdc_get_data(int fd, uint32_t opcode, uint32_t len, ui static void wdc_do_dump(int fd, char *tmpl, const char *suffix, uint32_t opcode, - uint32_t size_cmd, uint32_t cmd, int len_off) + uint32_t cmd, int len_off) { + int first; int fd2; uint8_t *buf; uint32_t len, offset; @@ -132,52 +109,49 @@ wdc_do_dump(int fd, char *tmpl, const char *suffix, ui wdc_append_serial_name(fd, tmpl, MAXPATHLEN, suffix); - buf = aligned_alloc(PAGE_SIZE, WDC_NVME_TOC_SIZE); - if (buf == NULL) - errx(1, "Can't get buffer to get size"); - wdc_get_data(fd, opcode, WDC_NVME_TOC_SIZE, - 0, size_cmd, buf, WDC_NVME_TOC_SIZE); - len = be32dec(buf + len_off); - - if (len == 0) - errx(1, "No data for %s", suffix); - - printf("Dumping %d bytes to %s\n", len, tmpl); /* XXX overwrite protection? */ - fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC); + fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd2 < 0) err(1, "open %s", tmpl); - offset = 0; buf = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE); if (buf == NULL) errx(1, "Can't get buffer to read dump"); - while (len > 0) { + offset = 0; + len = NVME_MAX_XFER_SIZE; + first = 1; + + do { resid = len > NVME_MAX_XFER_SIZE ? NVME_MAX_XFER_SIZE : len; wdc_get_data(fd, opcode, resid, offset, cmd, buf, resid); + + if (first) { + len = be32dec(buf + len_off); + if (len == 0) + errx(1, "No data for %s", suffix); + if (memcmp("E6LG", buf, 4) != 0) + printf("Expected header of E6LG, found '%4.4s' instead\n", + buf); + printf("Dumping %d bytes of version %d.%d log to %s\n", len, + buf[8], buf[9], tmpl); + /* + * Adjust amount to dump if total dump < 1MB, + * though it likely doesn't matter to the WDC + * analysis tools. + */ + if (resid > len) + resid = len; + first = 0; + } if (write(fd2, buf, resid) != resid) err(1, "write"); offset += resid; len -= resid; - } + } while (len > 0); free(buf); close(fd2); } static void -wdc_do_clear_dump(int fd, uint32_t opcode, uint32_t cmd) -{ - struct nvme_pt_command pt; - - memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = opcode; - pt.cmd.cdw12 = cmd; - if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "wdc_do_clear_dump request failed"); - if (nvme_completion_is_error(&pt.cpl)) - errx(1, "wdc_do_clear_dump request returned error"); -} - -static void wdc_cap_diag_usage(void) { fprintf(stderr, "usage:\n"); @@ -207,131 +181,11 @@ wdc_cap_diag(int argc, char *argv[]) open_dev(argv[optind], &fd, 1, 1); wdc_do_dump(fd, path_tmpl, "cap_diag", WDC_NVME_CAP_DIAG_OPCODE, - WDC_NVME_CAP_DIAG_CMD, WDC_NVME_CAP_DIAG_CMD, 4); + WDC_NVME_CAP_DIAG_CMD, 4); close(fd); exit(1); -} - -static void -wdc_drive_log_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, WDC_DRIVE_LOG_USAGE); - exit(1); -} - -static void -wdc_drive_log(int argc, char *argv[]) -{ - char path_tmpl[MAXPATHLEN]; - int ch, fd; - - path_tmpl[0] = '\0'; - while ((ch = getopt(argc, argv, "o:")) != -1) { - switch ((char)ch) { - case 'o': - strlcpy(path_tmpl, optarg, MAXPATHLEN); - break; - default: - wdc_drive_log_usage(); - } - } - /* Check that a controller was specified. */ - if (optind >= argc) - wdc_drive_log_usage(); - open_dev(argv[optind], &fd, 1, 1); - - wdc_do_dump(fd, path_tmpl, "drive_log", WDC_NVME_DIAG_OPCODE, - WDC_NVME_DRIVE_LOG_SIZE_CMD, WDC_NVME_DRIVE_LOG_CMD, 0); - - close(fd); - - exit(1); -} - -static void -wdc_get_crash_dump_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, WDC_CAP_DIAG_USAGE); - exit(1); -} - -static void -wdc_get_crash_dump(int argc, char *argv[]) -{ - char path_tmpl[MAXPATHLEN]; - int ch, fd; - - while ((ch = getopt(argc, argv, "o:")) != -1) { - switch ((char)ch) { - case 'o': - strlcpy(path_tmpl, optarg, MAXPATHLEN); - break; - default: - wdc_get_crash_dump_usage(); - } - } - /* Check that a controller was specified. */ - if (optind >= argc) - wdc_get_crash_dump_usage(); - open_dev(argv[optind], &fd, 1, 1); - - wdc_do_dump(fd, path_tmpl, "crash_dump", WDC_NVME_DIAG_OPCODE, - WDC_NVME_CRASH_DUMP_SIZE_CMD, WDC_NVME_CRASH_DUMP_CMD, 0); - wdc_do_clear_dump(fd, WDC_NVME_CLEAR_DUMP_OPCODE, - WDC_NVME_CLEAR_CRASH_DUMP_CMD); -// wdc_led_beacon_disable(fd); - wdc_do_dump(fd, path_tmpl, "pfail_dump", WDC_NVME_DIAG_OPCODE, - WDC_NVME_PFAIL_DUMP_SIZE_CMD, WDC_NVME_PFAIL_DUMP_CMD, 0); - wdc_do_clear_dump(fd, WDC_NVME_CLEAR_DUMP_OPCODE, - WDC_NVME_CLEAR_PFAIL_DUMP_CMD); - - close(fd); - - exit(1); -} - -static void -wdc_purge(int argc, char *argv[]) -{ - char path_tmpl[MAXPATHLEN]; - int ch; - - while ((ch = getopt(argc, argv, "o:")) != -1) { - switch ((char)ch) { - case 'o': - strlcpy(path_tmpl, optarg, MAXPATHLEN); - break; - default: - wdc_cap_diag_usage(); - } - } - - printf("purge has not been implemented.\n"); - exit(1); -} - -static void -wdc_purge_monitor(int argc, char *argv[]) -{ - char path_tmpl[MAXPATHLEN]; - int ch; - - while ((ch = getopt(argc, argv, "o:")) != -1) { - switch ((char)ch) { - case 'o': - strlcpy(path_tmpl, optarg, MAXPATHLEN); - break; - default: - wdc_cap_diag_usage(); - } - } - - printf("purge has not been implemented.\n"); - exit(1); } void From owner-svn-src-all@freebsd.org Thu Feb 1 19:57:22 2018 Return-Path: Delivered-To: svn-src-all@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 156E6EC25BD; Thu, 1 Feb 2018 19:57:22 +0000 (UTC) (envelope-from hselasky@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 B50968286C; Thu, 1 Feb 2018 19:57:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF0B41193D; Thu, 1 Feb 2018 19:57:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11JvLv9036857; Thu, 1 Feb 2018 19:57:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11JvL3K036856; Thu, 1 Feb 2018 19:57:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802011957.w11JvL3K036856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Feb 2018 19:57:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328731 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 328731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:57:22 -0000 Author: hselasky Date: Thu Feb 1 19:57:21 2018 New Revision: 328731 URL: https://svnweb.freebsd.org/changeset/base/328731 Log: Fix some recent regressions after r328436 in the LinuxKPI: 1) The OPW() function macro should have the same return type like the function it executes. 2) The DEVFS I/O-limit should be enforced for all character device reads and writes. 3) The character device file handle should be passable, same as for DEVFS based file handles. Reported by: jbeich @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Feb 1 19:48:05 2018 (r328730) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Feb 1 19:57:21 2018 (r328731) @@ -669,7 +669,7 @@ static struct cdev_pager_ops linux_cdev_pager_ops[2] = #define OPW(fp,td,code) ({ \ struct file *__fpop; \ - int __retval; \ + __typeof(code) __retval; \ \ __fpop = (td)->td_fpop; \ (td)->td_fpop = (fp); \ @@ -1277,6 +1277,8 @@ linux_file_read(struct file *file, struct uio *uio, st /* XXX no support for I/O vectors currently */ if (uio->uio_iovcnt != 1) return (EOPNOTSUPP); + if (uio->uio_resid > DEVFS_IOSIZE_MAX) + return (EINVAL); linux_set_current(td); if (filp->f_op->read) { bytes = OPW(file, td, filp->f_op->read(filp, uio->uio_iov->iov_base, @@ -1314,6 +1316,8 @@ linux_file_write(struct file *file, struct uio *uio, s /* XXX no support for I/O vectors currently */ if (uio->uio_iovcnt != 1) return (EOPNOTSUPP); + if (uio->uio_resid > DEVFS_IOSIZE_MAX) + return (EINVAL); linux_set_current(td); if (filp->f_op->write) { bytes = OPW(file, td, filp->f_op->write(filp, uio->uio_iov->iov_base, @@ -1556,6 +1560,7 @@ struct fileops linuxfileops = { .fo_chmod = invfo_chmod, .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, + .fo_flags = DFLAG_PASSABLE, }; /* From owner-svn-src-all@freebsd.org Thu Feb 1 19:58:43 2018 Return-Path: Delivered-To: svn-src-all@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 DFAE4EC2734; Thu, 1 Feb 2018 19:58:43 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A70A82A00; Thu, 1 Feb 2018 19:58:43 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id CD02226026B; Thu, 1 Feb 2018 20:58:41 +0100 (CET) Subject: Re: svn commit: r328436 - head/sys/compat/linuxkpi/common/src From: Hans Petter Selasky To: Jan Beich Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801261049.w0QAn2Xt089656@repo.freebsd.org> <4d1d778d-a0e0-0d3a-b37e-19fba10ae86f@selasky.org> Message-ID: <5884337f-567b-ac1d-117a-4c39cd248c07@selasky.org> Date: Thu, 1 Feb 2018 20:55:46 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:58:44 -0000 On 02/01/18 19:22, Hans Petter Selasky wrote: > I'm able to reproduce. Trying to narrow down the problem. > > --HPS > Hi, Should be fixed by r328731. File handle was not passable, and was invalidated during forking and so on. Thanks for reporting! --HPS From owner-svn-src-all@freebsd.org Thu Feb 1 21:04:11 2018 Return-Path: Delivered-To: svn-src-all@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 9A491EC9316; Thu, 1 Feb 2018 21:04:11 +0000 (UTC) (envelope-from mav@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 4A98885EF5; Thu, 1 Feb 2018 21:04:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 415B1124DE; Thu, 1 Feb 2018 21:04:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11L4Baj072792; Thu, 1 Feb 2018 21:04:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11L4BFY072791; Thu, 1 Feb 2018 21:04:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012104.w11L4BFY072791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328732 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328732 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:04:11 -0000 Author: mav Date: Thu Feb 1 21:04:10 2018 New Revision: 328732 URL: https://svnweb.freebsd.org/changeset/base/328732 Log: MFC r320522 (by imp): Fix sign of resid and add a mostly useless cast to cope with signed vs unsigned check warnings from traditional unix code construsts bogusly flagged as potentially unsafe. Modified: stable/11/sbin/nvmecontrol/wdc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/wdc.c ============================================================================== --- stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 19:57:21 2018 (r328731) +++ stable/11/sbin/nvmecontrol/wdc.c Thu Feb 1 21:04:10 2018 (r328732) @@ -105,7 +105,7 @@ wdc_do_dump(int fd, char *tmpl, const char *suffix, ui int fd2; uint8_t *buf; uint32_t len, offset; - ssize_t resid; + size_t resid; wdc_append_serial_name(fd, tmpl, MAXPATHLEN, suffix); @@ -142,7 +142,7 @@ wdc_do_dump(int fd, char *tmpl, const char *suffix, ui resid = len; first = 0; } - if (write(fd2, buf, resid) != resid) + if (write(fd2, buf, resid) != (ssize_t)resid) err(1, "write"); offset += resid; len -= resid; From owner-svn-src-all@freebsd.org Thu Feb 1 21:06:29 2018 Return-Path: Delivered-To: svn-src-all@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 40DEDEC9514; Thu, 1 Feb 2018 21:06:29 +0000 (UTC) (envelope-from mav@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 E7491860C2; Thu, 1 Feb 2018 21:06:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2501124E2; Thu, 1 Feb 2018 21:06:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11L6SnO073046; Thu, 1 Feb 2018 21:06:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11L6SpB073042; Thu, 1 Feb 2018 21:06:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012106.w11L6SpB073042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:06:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328733 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328733 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:06:29 -0000 Author: mav Date: Thu Feb 1 21:06:28 2018 New Revision: 328733 URL: https://svnweb.freebsd.org/changeset/base/328733 Log: MFC r322992 (by imp): Print the controller's ID in identify. Modified: stable/11/sbin/nvmecontrol/identify.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/identify.c ============================================================================== --- stable/11/sbin/nvmecontrol/identify.c Thu Feb 1 21:04:10 2018 (r328732) +++ stable/11/sbin/nvmecontrol/identify.c Thu Feb 1 21:06:28 2018 (r328733) @@ -66,8 +66,9 @@ print_controller(struct nvme_controller_data *cdata) printf("Unlimited\n"); else printf("%d\n", PAGE_SIZE * (1 << cdata->mdts)); - + printf("Controller ID: 0x%02x\n", cdata->ctrlr_id); printf("\n"); + printf("Admin Command Set Attributes\n"); printf("============================\n"); printf("Security Send/Receive: %s\n", From owner-svn-src-all@freebsd.org Thu Feb 1 21:07:59 2018 Return-Path: Delivered-To: svn-src-all@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 372B2EC9703; Thu, 1 Feb 2018 21:07:59 +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 D67418632C; Thu, 1 Feb 2018 21:07:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D12EC124E8; Thu, 1 Feb 2018 21:07:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11L7wQH073450; Thu, 1 Feb 2018 21:07:58 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11L7tio073418; Thu, 1 Feb 2018 21:07:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012107.w11L7tio073418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:07:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328734 - in vendor/llvm/dist-release_60: docs include/llvm/Analysis include/llvm/MC lib/Analysis lib/CodeGen lib/CodeGen/GlobalISel lib/CodeGen/SelectionDAG lib/MC lib/Target/AArch64 l... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist-release_60: docs include/llvm/Analysis include/llvm/MC lib/Analysis lib/CodeGen lib/CodeGen/GlobalISel lib/CodeGen/SelectionDAG lib/MC lib/Target/AArch64 lib/Target/AMDGPU lib/Targ... X-SVN-Commit-Revision: 328734 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:07:59 -0000 Author: dim Date: Thu Feb 1 21:07:55 2018 New Revision: 328734 URL: https://svnweb.freebsd.org/changeset/base/328734 Log: Vendor import of llvm release_60 branch r323948: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323948 Added: vendor/llvm/dist-release_60/test/Analysis/ValueTracking/select-pattern.ll vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/fallback-nofastisel.ll vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/irtranslator-volatile-load-pr36018.ll vendor/llvm/dist-release_60/test/CodeGen/AArch64/fast-regalloc-empty-bb-with-liveins.mir vendor/llvm/dist-release_60/test/CodeGen/X86/pr34592.ll vendor/llvm/dist-release_60/test/MC/X86/eval-fill.s (contents, props changed) vendor/llvm/dist-release_60/test/ThinLTO/X86/Inputs/dicompositetype-unique-alias.ll vendor/llvm/dist-release_60/test/ThinLTO/X86/dicompositetype-unique-alias.ll vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/bug36015.ll Modified: vendor/llvm/dist-release_60/docs/ReleaseNotes.rst vendor/llvm/dist-release_60/include/llvm/Analysis/ValueTracking.h vendor/llvm/dist-release_60/include/llvm/MC/MCFragment.h vendor/llvm/dist-release_60/include/llvm/MC/MCObjectStreamer.h vendor/llvm/dist-release_60/include/llvm/MC/MCStreamer.h vendor/llvm/dist-release_60/lib/Analysis/ValueTracking.cpp vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/IRTranslator.cpp vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/LegalizerHelper.cpp vendor/llvm/dist-release_60/lib/CodeGen/RegAllocFast.cpp vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp vendor/llvm/dist-release_60/lib/MC/MCAsmStreamer.cpp vendor/llvm/dist-release_60/lib/MC/MCAssembler.cpp vendor/llvm/dist-release_60/lib/MC/MCMachOStreamer.cpp vendor/llvm/dist-release_60/lib/MC/MCObjectStreamer.cpp vendor/llvm/dist-release_60/lib/MC/MCStreamer.cpp vendor/llvm/dist-release_60/lib/MC/MCWinCOFFStreamer.cpp vendor/llvm/dist-release_60/lib/MC/WasmObjectWriter.cpp vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64FastISel.cpp vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64Subtarget.cpp vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInsertSkips.cpp vendor/llvm/dist-release_60/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist-release_60/lib/Transforms/Scalar/CallSiteSplitting.cpp vendor/llvm/dist-release_60/lib/Transforms/Scalar/StructurizeCFG.cpp vendor/llvm/dist-release_60/lib/Transforms/Utils/ValueMapper.cpp vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/legalize-constant.mir vendor/llvm/dist-release_60/test/CodeGen/AArch64/dllimport.ll vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/llvm.amdgcn.kill.ll vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/multilevel-break.ll vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/nested-loop-conditions.ll vendor/llvm/dist-release_60/test/MC/X86/x86-32-coverage.s vendor/llvm/dist-release_60/test/Transforms/CallSiteSplitting/callsite-no-splitting.ll vendor/llvm/dist-release_60/test/Transforms/InstCombine/minmax-fold.ll vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/AMDGPU/backedge-id-bug.ll vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/nested-loop-order.ll Modified: vendor/llvm/dist-release_60/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist-release_60/docs/ReleaseNotes.rst Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/docs/ReleaseNotes.rst Thu Feb 1 21:07:55 2018 (r328734) @@ -15,7 +15,7 @@ Introduction ============ This document contains the release notes for the LLVM Compiler Infrastructure, -release 5.0.0. Here we describe the status of LLVM, including major improvements +release 6.0.0. Here we describe the status of LLVM, including major improvements from the previous release, improvements in various subprojects of LLVM, and some of the current users of the code. All LLVM releases may be downloaded from the `LLVM releases web site `_. Modified: vendor/llvm/dist-release_60/include/llvm/Analysis/ValueTracking.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/Analysis/ValueTracking.h Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/include/llvm/Analysis/ValueTracking.h Thu Feb 1 21:07:55 2018 (r328734) @@ -508,7 +508,8 @@ class Value; /// -> LHS = %a, RHS = i32 4, *CastOp = Instruction::SExt /// SelectPatternResult matchSelectPattern(Value *V, Value *&LHS, Value *&RHS, - Instruction::CastOps *CastOp = nullptr); + Instruction::CastOps *CastOp = nullptr, + unsigned Depth = 0); inline SelectPatternResult matchSelectPattern(const Value *V, const Value *&LHS, const Value *&RHS, Instruction::CastOps *CastOp = nullptr) { Modified: vendor/llvm/dist-release_60/include/llvm/MC/MCFragment.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/MC/MCFragment.h Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/include/llvm/MC/MCFragment.h Thu Feb 1 21:07:55 2018 (r328734) @@ -422,14 +422,21 @@ class MCFillFragment : public MCFragment { uint8_t Value; /// The number of bytes to insert. - uint64_t Size; + const MCExpr &Size; + /// Source location of the directive that this fragment was created for. + SMLoc Loc; + public: - MCFillFragment(uint8_t Value, uint64_t Size, MCSection *Sec = nullptr) - : MCFragment(FT_Fill, false, 0, Sec), Value(Value), Size(Size) {} + MCFillFragment(uint8_t Value, const MCExpr &Size, SMLoc Loc, + MCSection *Sec = nullptr) + : MCFragment(FT_Fill, false, 0, Sec), Value(Value), Size(Size), Loc(Loc) { + } uint8_t getValue() const { return Value; } - uint64_t getSize() const { return Size; } + const MCExpr &getSize() const { return Size; } + + SMLoc getLoc() const { return Loc; } static bool classof(const MCFragment *F) { return F->getKind() == MCFragment::FT_Fill; Modified: vendor/llvm/dist-release_60/include/llvm/MC/MCObjectStreamer.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/MC/MCObjectStreamer.h Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/include/llvm/MC/MCObjectStreamer.h Thu Feb 1 21:07:55 2018 (r328734) @@ -161,7 +161,6 @@ class MCObjectStreamer : public MCStreamer { (public) bool EmitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc) override; using MCStreamer::emitFill; - void emitFill(uint64_t NumBytes, uint8_t FillValue) override; void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc = SMLoc()) override; void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr, Modified: vendor/llvm/dist-release_60/include/llvm/MC/MCStreamer.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/MC/MCStreamer.h Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/include/llvm/MC/MCStreamer.h Thu Feb 1 21:07:55 2018 (r328734) @@ -662,7 +662,7 @@ class MCStreamer { (public) /// \brief Emit NumBytes bytes worth of the value specified by FillValue. /// This implements directives such as '.space'. - virtual void emitFill(uint64_t NumBytes, uint8_t FillValue); + void emitFill(uint64_t NumBytes, uint8_t FillValue); /// \brief Emit \p Size bytes worth of the value specified by \p FillValue. /// Modified: vendor/llvm/dist-release_60/lib/Analysis/ValueTracking.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Analysis/ValueTracking.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Analysis/ValueTracking.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -4165,17 +4165,18 @@ static SelectPatternResult matchClamp(CmpInst::Predica /// a < c ? min(a,b) : min(b,c) ==> min(min(a,b),min(b,c)) static SelectPatternResult matchMinMaxOfMinMax(CmpInst::Predicate Pred, Value *CmpLHS, Value *CmpRHS, - Value *TrueVal, Value *FalseVal) { + Value *TVal, Value *FVal, + unsigned Depth) { // TODO: Allow FP min/max with nnan/nsz. assert(CmpInst::isIntPredicate(Pred) && "Expected integer comparison"); Value *A, *B; - SelectPatternResult L = matchSelectPattern(TrueVal, A, B); + SelectPatternResult L = matchSelectPattern(TVal, A, B, nullptr, Depth + 1); if (!SelectPatternResult::isMinOrMax(L.Flavor)) return {SPF_UNKNOWN, SPNB_NA, false}; Value *C, *D; - SelectPatternResult R = matchSelectPattern(FalseVal, C, D); + SelectPatternResult R = matchSelectPattern(FVal, C, D, nullptr, Depth + 1); if (L.Flavor != R.Flavor) return {SPF_UNKNOWN, SPNB_NA, false}; @@ -4214,7 +4215,7 @@ static SelectPatternResult matchMinMaxOfMinMax(CmpInst break; return {SPF_UNKNOWN, SPNB_NA, false}; default: - llvm_unreachable("Bad flavor while matching min/max"); + return {SPF_UNKNOWN, SPNB_NA, false}; } // a pred c ? m(a, b) : m(c, b) --> m(m(a, b), m(c, b)) @@ -4240,7 +4241,8 @@ static SelectPatternResult matchMinMaxOfMinMax(CmpInst static SelectPatternResult matchMinMax(CmpInst::Predicate Pred, Value *CmpLHS, Value *CmpRHS, Value *TrueVal, Value *FalseVal, - Value *&LHS, Value *&RHS) { + Value *&LHS, Value *&RHS, + unsigned Depth) { // Assume success. If there's no match, callers should not use these anyway. LHS = TrueVal; RHS = FalseVal; @@ -4249,7 +4251,7 @@ static SelectPatternResult matchMinMax(CmpInst::Predic if (SPR.Flavor != SelectPatternFlavor::SPF_UNKNOWN) return SPR; - SPR = matchMinMaxOfMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal); + SPR = matchMinMaxOfMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal, Depth); if (SPR.Flavor != SelectPatternFlavor::SPF_UNKNOWN) return SPR; @@ -4313,7 +4315,8 @@ static SelectPatternResult matchSelectPattern(CmpInst: FastMathFlags FMF, Value *CmpLHS, Value *CmpRHS, Value *TrueVal, Value *FalseVal, - Value *&LHS, Value *&RHS) { + Value *&LHS, Value *&RHS, + unsigned Depth) { LHS = CmpLHS; RHS = CmpRHS; @@ -4429,7 +4432,7 @@ static SelectPatternResult matchSelectPattern(CmpInst: } if (CmpInst::isIntPredicate(Pred)) - return matchMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal, LHS, RHS); + return matchMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal, LHS, RHS, Depth); // According to (IEEE 754-2008 5.3.1), minNum(0.0, -0.0) and similar // may return either -0.0 or 0.0, so fcmp/select pair has stricter @@ -4550,7 +4553,11 @@ static Value *lookThroughCast(CmpInst *CmpI, Value *V1 } SelectPatternResult llvm::matchSelectPattern(Value *V, Value *&LHS, Value *&RHS, - Instruction::CastOps *CastOp) { + Instruction::CastOps *CastOp, + unsigned Depth) { + if (Depth >= MaxDepth) + return {SPF_UNKNOWN, SPNB_NA, false}; + SelectInst *SI = dyn_cast(V); if (!SI) return {SPF_UNKNOWN, SPNB_NA, false}; @@ -4579,7 +4586,7 @@ SelectPatternResult llvm::matchSelectPattern(Value *V, FMF.setNoSignedZeros(); return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS, cast(TrueVal)->getOperand(0), C, - LHS, RHS); + LHS, RHS, Depth); } if (Value *C = lookThroughCast(CmpI, FalseVal, TrueVal, CastOp)) { // If this is a potential fmin/fmax with a cast to integer, then ignore @@ -4588,11 +4595,11 @@ SelectPatternResult llvm::matchSelectPattern(Value *V, FMF.setNoSignedZeros(); return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS, C, cast(FalseVal)->getOperand(0), - LHS, RHS); + LHS, RHS, Depth); } } return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS, TrueVal, FalseVal, - LHS, RHS); + LHS, RHS, Depth); } /// Return true if "icmp Pred LHS RHS" is always true. Modified: vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/IRTranslator.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/IRTranslator.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/IRTranslator.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -812,6 +812,10 @@ bool IRTranslator::translateCall(const User &U, Machin auto TII = MF->getTarget().getIntrinsicInfo(); const Function *F = CI.getCalledFunction(); + // FIXME: support Windows dllimport function calls. + if (F && F->hasDLLImportStorageClass()) + return false; + if (CI.isInlineAsm()) return translateInlineAsm(CI, MIRBuilder); Modified: vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/LegalizerHelper.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/LegalizerHelper.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/CodeGen/GlobalISel/LegalizerHelper.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -661,7 +661,24 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigne } case TargetOpcode::G_FCONSTANT: { unsigned DstExt = MRI.createGenericVirtualRegister(WideTy); - MIRBuilder.buildFConstant(DstExt, *MI.getOperand(1).getFPImm()); + const ConstantFP *CFP = MI.getOperand(1).getFPImm(); + APFloat Val = CFP->getValueAPF(); + LLVMContext &Ctx = MIRBuilder.getMF().getFunction().getContext(); + auto LLT2Sem = [](LLT Ty) { + switch (Ty.getSizeInBits()) { + case 32: + return &APFloat::IEEEsingle(); + break; + case 64: + return &APFloat::IEEEdouble(); + break; + default: + llvm_unreachable("Unhandled fp widen type"); + } + }; + bool LosesInfo; + Val.convert(*LLT2Sem(WideTy), APFloat::rmTowardZero, &LosesInfo); + MIRBuilder.buildFConstant(DstExt, *ConstantFP::get(Ctx, Val)); MIRBuilder.buildFPTrunc(MI.getOperand(0).getReg(), DstExt); MI.eraseFromParent(); return Legalized; Modified: vendor/llvm/dist-release_60/lib/CodeGen/RegAllocFast.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/RegAllocFast.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/CodeGen/RegAllocFast.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -193,9 +193,10 @@ namespace { void spillVirtReg(MachineBasicBlock::iterator MI, unsigned VirtReg); void usePhysReg(MachineOperand &MO); - void definePhysReg(MachineInstr &MI, MCPhysReg PhysReg, RegState NewState); + void definePhysReg(MachineBasicBlock::iterator MI, MCPhysReg PhysReg, + RegState NewState); unsigned calcSpillCost(MCPhysReg PhysReg) const; - void assignVirtToPhysReg(LiveReg&, MCPhysReg PhysReg); + void assignVirtToPhysReg(LiveReg &, MCPhysReg PhysReg); LiveRegMap::iterator findLiveVirtReg(unsigned VirtReg) { return LiveVirtRegs.find(TargetRegisterInfo::virtReg2Index(VirtReg)); @@ -434,8 +435,8 @@ void RegAllocFast::usePhysReg(MachineOperand &MO) { /// Mark PhysReg as reserved or free after spilling any virtregs. This is very /// similar to defineVirtReg except the physreg is reserved instead of /// allocated. -void RegAllocFast::definePhysReg(MachineInstr &MI, MCPhysReg PhysReg, - RegState NewState) { +void RegAllocFast::definePhysReg(MachineBasicBlock::iterator MI, + MCPhysReg PhysReg, RegState NewState) { markRegUsedInInstr(PhysReg); switch (unsigned VirtReg = PhysRegState[PhysReg]) { case regDisabled: @@ -857,7 +858,7 @@ void RegAllocFast::allocateBasicBlock(MachineBasicBloc // Add live-in registers as live. for (const MachineBasicBlock::RegisterMaskPair LI : MBB.liveins()) if (MRI->isAllocatable(LI.PhysReg)) - definePhysReg(*MII, LI.PhysReg, regReserved); + definePhysReg(MII, LI.PhysReg, regReserved); VirtDead.clear(); Coalesced.clear(); Modified: vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -1380,8 +1380,10 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Func FastISelFailed = false; // Initialize the Fast-ISel state, if needed. FastISel *FastIS = nullptr; - if (TM.Options.EnableFastISel) + if (TM.Options.EnableFastISel) { + DEBUG(dbgs() << "Enabling fast-isel\n"); FastIS = TLI->createFastISel(*FuncInfo, LibInfo); + } setupSwiftErrorVals(Fn, TLI, FuncInfo); Modified: vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -717,6 +717,8 @@ bool TargetPassConfig::addCoreISelPasses() { if (EnableGlobalISel == cl::BOU_TRUE || (EnableGlobalISel == cl::BOU_UNSET && isGlobalISelEnabled() && EnableFastISelOption != cl::BOU_TRUE)) { + TM->setFastISel(false); + if (addIRTranslator()) return true; Modified: vendor/llvm/dist-release_60/lib/MC/MCAsmStreamer.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/MCAsmStreamer.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/MC/MCAsmStreamer.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -192,9 +192,6 @@ class MCAsmStreamer final : public MCStreamer { (publi void EmitGPRel32Value(const MCExpr *Value) override; - - void emitFill(uint64_t NumBytes, uint8_t FillValue) override; - void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc = SMLoc()) override; @@ -965,17 +962,12 @@ void MCAsmStreamer::EmitGPRel32Value(const MCExpr *Val EmitEOL(); } -/// emitFill - Emit NumBytes bytes worth of the value specified by -/// FillValue. This implements directives such as '.space'. -void MCAsmStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - if (NumBytes == 0) return; - - const MCExpr *E = MCConstantExpr::create(NumBytes, getContext()); - emitFill(*E, FillValue); -} - void MCAsmStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) { + int64_t IntNumBytes; + if (NumBytes.evaluateAsAbsolute(IntNumBytes) && IntNumBytes == 0) + return; + if (const char *ZeroDirective = MAI->getZeroDirective()) { // FIXME: Emit location directives OS << ZeroDirective; Modified: vendor/llvm/dist-release_60/lib/MC/MCAssembler.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/MCAssembler.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/MC/MCAssembler.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -281,8 +281,18 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmL return cast(F).getContents().size(); case MCFragment::FT_CompactEncodedInst: return cast(F).getContents().size(); - case MCFragment::FT_Fill: - return cast(F).getSize(); + case MCFragment::FT_Fill: { + auto &FF = cast(F); + int64_t Size = 0; + if (!FF.getSize().evaluateAsAbsolute(Size, Layout)) + getContext().reportError(FF.getLoc(), + "expected assembly-time absolute expression"); + if (Size < 0) { + getContext().reportError(FF.getLoc(), "invalid number of bytes"); + return 0; + } + return Size; + } case MCFragment::FT_LEB: return cast(F).getContents().size(); @@ -540,7 +550,7 @@ static void writeFragment(const MCAssembler &Asm, cons for (unsigned I = 1; I < MaxChunkSize; ++I) Data[I] = Data[0]; - uint64_t Size = FF.getSize(); + uint64_t Size = FragmentSize; for (unsigned ChunkSize = MaxChunkSize; ChunkSize; ChunkSize /= 2) { StringRef Ref(Data, ChunkSize); for (uint64_t I = 0, E = Size / ChunkSize; I != E; ++I) Modified: vendor/llvm/dist-release_60/lib/MC/MCMachOStreamer.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/MCMachOStreamer.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/MC/MCMachOStreamer.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -411,29 +411,19 @@ void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol * void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) { - getAssembler().registerSection(*Section); - - // The symbol may not be present, which only creates the section. - if (!Symbol) - return; - // On darwin all virtual sections have zerofill type. assert(Section->isVirtualSection() && "Section does not have zerofill type!"); - assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); + PushSection(); + SwitchSection(Section); - getAssembler().registerSymbol(*Symbol); - - // Emit an align fragment if necessary. - if (ByteAlignment != 1) - new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section); - - MCFragment *F = new MCFillFragment(0, Size, Section); - Symbol->setFragment(F); - - // Update the maximum alignment on the zero fill section if necessary. - if (ByteAlignment > Section->getAlignment()) - Section->setAlignment(ByteAlignment); + // The symbol may not be present, which only creates the section. + if (Symbol) { + EmitValueToAlignment(ByteAlignment, 0, 1, 0); + EmitLabel(Symbol); + EmitZeros(Size); + } + PopSection(); } // This should always be called with the thread local bss section. Like the Modified: vendor/llvm/dist-release_60/lib/MC/MCObjectStreamer.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/MCObjectStreamer.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/MC/MCObjectStreamer.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -577,28 +577,13 @@ bool MCObjectStreamer::EmitRelocDirective(const MCExpr return false; } -void MCObjectStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - assert(getCurrentSectionOnly() && "need a section"); - insert(new MCFillFragment(FillValue, NumBytes)); -} - void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) { MCDataFragment *DF = getOrCreateDataFragment(); flushPendingLabels(DF, DF->getContents().size()); - int64_t IntNumBytes; - if (!NumBytes.evaluateAsAbsolute(IntNumBytes, getAssembler())) { - getContext().reportError(Loc, "expected absolute expression"); - return; - } - - if (IntNumBytes <= 0) { - getContext().reportError(Loc, "invalid number of bytes"); - return; - } - - emitFill(IntNumBytes, FillValue); + assert(getCurrentSectionOnly() && "need a section"); + insert(new MCFillFragment(FillValue, NumBytes, Loc)); } void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size, Modified: vendor/llvm/dist-release_60/lib/MC/MCStreamer.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/MCStreamer.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/MC/MCStreamer.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -184,8 +184,7 @@ void MCStreamer::EmitGPRel32Value(const MCExpr *Value) /// Emit NumBytes bytes worth of the value specified by FillValue. /// This implements directives such as '.space'. void MCStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - for (uint64_t i = 0, e = NumBytes; i != e; ++i) - EmitIntValue(FillValue, 1); + emitFill(*MCConstantExpr::create(NumBytes, getContext()), FillValue); } void MCStreamer::emitFill(uint64_t NumValues, int64_t Size, int64_t Expr) { Modified: vendor/llvm/dist-release_60/lib/MC/MCWinCOFFStreamer.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/MCWinCOFFStreamer.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/MC/MCWinCOFFStreamer.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -257,20 +257,13 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol auto *Symbol = cast(S); MCSection *Section = getContext().getObjectFileInfo()->getBSSSection(); - getAssembler().registerSection(*Section); - if (Section->getAlignment() < ByteAlignment) - Section->setAlignment(ByteAlignment); - - getAssembler().registerSymbol(*Symbol); + PushSection(); + SwitchSection(Section); + EmitValueToAlignment(ByteAlignment, 0, 1, 0); + EmitLabel(Symbol); Symbol->setExternal(false); - - if (ByteAlignment != 1) - new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0, - ByteAlignment, Section); - - MCFillFragment *Fragment = new MCFillFragment( - /*Value=*/0, Size, Section); - Symbol->setFragment(Fragment); + EmitZeros(Size); + PopSection(); } void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, Modified: vendor/llvm/dist-release_60/lib/MC/WasmObjectWriter.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/WasmObjectWriter.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/MC/WasmObjectWriter.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -528,7 +528,10 @@ static void addData(SmallVectorImpl &DataBytes, Align->getMaxBytesToEmit()); DataBytes.resize(Size, Value); } else if (auto *Fill = dyn_cast(&Frag)) { - DataBytes.insert(DataBytes.end(), Fill->getSize(), Fill->getValue()); + int64_t Size; + if (!Fill->getSize().evaluateAsAbsolute(Size)) + llvm_unreachable("The fill should be an assembler constant"); + DataBytes.insert(DataBytes.end(), Size, Fill->getValue()); } else { const auto &DataFrag = cast(Frag); const SmallVectorImpl &Contents = DataFrag.getContents(); Modified: vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64FastISel.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64FastISel.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64FastISel.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -476,26 +476,27 @@ unsigned AArch64FastISel::materializeGV(const GlobalVa // ADRP + LDRX BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::ADRP), ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_GOT | AArch64II::MO_PAGE); + .addGlobalAddress(GV, 0, AArch64II::MO_PAGE | OpFlags); ResultReg = createResultReg(&AArch64::GPR64RegClass); BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::LDRXui), ResultReg) - .addReg(ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_GOT | AArch64II::MO_PAGEOFF | - AArch64II::MO_NC); + .addReg(ADRPReg) + .addGlobalAddress(GV, 0, + AArch64II::MO_PAGEOFF | AArch64II::MO_NC | OpFlags); } else { // ADRP + ADDX BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::ADRP), ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_PAGE); + .addGlobalAddress(GV, 0, AArch64II::MO_PAGE | OpFlags); ResultReg = createResultReg(&AArch64::GPR64spRegClass); BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::ADDXri), ResultReg) - .addReg(ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_PAGEOFF | AArch64II::MO_NC) - .addImm(0); + .addReg(ADRPReg) + .addGlobalAddress(GV, 0, + AArch64II::MO_PAGEOFF | AArch64II::MO_NC | OpFlags) + .addImm(0); } return ResultReg; } Modified: vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -929,6 +929,12 @@ bool AArch64InstructionSelector::select(MachineInstr & return false; } + // FIXME: PR36018: Volatile loads in some cases are incorrectly selected by + // folding with an extend. Until we have a G_SEXTLOAD solution bail out if + // we hit one. + if (Opcode == TargetOpcode::G_LOAD && MemOp.isVolatile()) + return false; + const unsigned PtrReg = I.getOperand(1).getReg(); #ifndef NDEBUG const RegisterBank &PtrRB = *RBI.getRegBank(PtrReg, MRI, TRI); Modified: vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64Subtarget.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64Subtarget.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64Subtarget.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -189,15 +189,18 @@ AArch64Subtarget::ClassifyGlobalReference(const Global if (TM.getCodeModel() == CodeModel::Large && isTargetMachO()) return AArch64II::MO_GOT; + unsigned Flags = GV->hasDLLImportStorageClass() ? AArch64II::MO_DLLIMPORT + : AArch64II::MO_NO_FLAG; + if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV)) - return AArch64II::MO_GOT; + return AArch64II::MO_GOT | Flags; // The small code model's direct accesses use ADRP, which cannot // necessarily produce the value 0 (if the code is above 4GB). if (useSmallAddressing() && GV->hasExternalWeakLinkage()) - return AArch64II::MO_GOT; + return AArch64II::MO_GOT | Flags; - return AArch64II::MO_NO_FLAG; + return Flags; } unsigned char AArch64Subtarget::classifyGlobalFunctionReference( Modified: vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInsertSkips.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInsertSkips.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInsertSkips.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -210,65 +210,73 @@ void SIInsertSkips::kill(MachineInstr &MI) { switch (MI.getOperand(2).getImm()) { case ISD::SETOEQ: case ISD::SETEQ: - Opcode = AMDGPU::V_CMPX_EQ_F32_e32; + Opcode = AMDGPU::V_CMPX_EQ_F32_e64; break; case ISD::SETOGT: case ISD::SETGT: - Opcode = AMDGPU::V_CMPX_LT_F32_e32; + Opcode = AMDGPU::V_CMPX_LT_F32_e64; break; case ISD::SETOGE: case ISD::SETGE: - Opcode = AMDGPU::V_CMPX_LE_F32_e32; + Opcode = AMDGPU::V_CMPX_LE_F32_e64; break; case ISD::SETOLT: case ISD::SETLT: - Opcode = AMDGPU::V_CMPX_GT_F32_e32; + Opcode = AMDGPU::V_CMPX_GT_F32_e64; break; case ISD::SETOLE: case ISD::SETLE: - Opcode = AMDGPU::V_CMPX_GE_F32_e32; + Opcode = AMDGPU::V_CMPX_GE_F32_e64; break; case ISD::SETONE: case ISD::SETNE: - Opcode = AMDGPU::V_CMPX_LG_F32_e32; + Opcode = AMDGPU::V_CMPX_LG_F32_e64; break; case ISD::SETO: - Opcode = AMDGPU::V_CMPX_O_F32_e32; + Opcode = AMDGPU::V_CMPX_O_F32_e64; break; case ISD::SETUO: - Opcode = AMDGPU::V_CMPX_U_F32_e32; + Opcode = AMDGPU::V_CMPX_U_F32_e64; break; case ISD::SETUEQ: - Opcode = AMDGPU::V_CMPX_NLG_F32_e32; + Opcode = AMDGPU::V_CMPX_NLG_F32_e64; break; case ISD::SETUGT: - Opcode = AMDGPU::V_CMPX_NGE_F32_e32; + Opcode = AMDGPU::V_CMPX_NGE_F32_e64; break; case ISD::SETUGE: - Opcode = AMDGPU::V_CMPX_NGT_F32_e32; + Opcode = AMDGPU::V_CMPX_NGT_F32_e64; break; case ISD::SETULT: - Opcode = AMDGPU::V_CMPX_NLE_F32_e32; + Opcode = AMDGPU::V_CMPX_NLE_F32_e64; break; case ISD::SETULE: - Opcode = AMDGPU::V_CMPX_NLT_F32_e32; + Opcode = AMDGPU::V_CMPX_NLT_F32_e64; break; case ISD::SETUNE: - Opcode = AMDGPU::V_CMPX_NEQ_F32_e32; + Opcode = AMDGPU::V_CMPX_NEQ_F32_e64; break; default: llvm_unreachable("invalid ISD:SET cond code"); } - // TODO: Allow this: - if (!MI.getOperand(0).isReg() || - !TRI->isVGPR(MBB.getParent()->getRegInfo(), - MI.getOperand(0).getReg())) - llvm_unreachable("SI_KILL operand should be a VGPR"); + assert(MI.getOperand(0).isReg()); - BuildMI(MBB, &MI, DL, TII->get(Opcode)) - .add(MI.getOperand(1)) - .add(MI.getOperand(0)); + if (TRI->isVGPR(MBB.getParent()->getRegInfo(), + MI.getOperand(0).getReg())) { + Opcode = AMDGPU::getVOPe32(Opcode); + BuildMI(MBB, &MI, DL, TII->get(Opcode)) + .add(MI.getOperand(1)) + .add(MI.getOperand(0)); + } else { + BuildMI(MBB, &MI, DL, TII->get(Opcode)) + .addReg(AMDGPU::VCC, RegState::Define) + .addImm(0) // src0 modifiers + .add(MI.getOperand(1)) + .addImm(0) // src1 modifiers + .add(MI.getOperand(0)) + .addImm(0); // omod + } break; } case AMDGPU::SI_KILL_I1_TERMINATOR: { Modified: vendor/llvm/dist-release_60/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -39,11 +39,11 @@ void X86IntelInstPrinter::printInst(const MCInst *MI, const MCSubtargetInfo &STI) { const MCInstrDesc &Desc = MII.get(MI->getOpcode()); uint64_t TSFlags = Desc.TSFlags; + unsigned Flags = MI->getFlags(); - if (TSFlags & X86II::LOCK) + if ((TSFlags & X86II::LOCK) || (Flags & X86::IP_HAS_LOCK)) OS << "\tlock\t"; - unsigned Flags = MI->getFlags(); if (Flags & X86::IP_HAS_REPEAT_NE) OS << "\trepne\t"; else if (Flags & X86::IP_HAS_REPEAT) Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -31776,9 +31776,10 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & // Check all uses of the condition operand to check whether it will be // consumed by non-BLEND instructions. Those may require that all bits // are set properly. - for (SDNode *U : Cond->uses()) { + for (SDNode::use_iterator UI = Cond->use_begin(), UE = Cond->use_end(); + UI != UE; ++UI) { // TODO: Add other opcodes eventually lowered into BLEND. - if (U->getOpcode() != ISD::VSELECT) + if (UI->getOpcode() != ISD::VSELECT || UI.getOperandNo() != 0) return SDValue(); } Modified: vendor/llvm/dist-release_60/lib/Transforms/Scalar/CallSiteSplitting.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Transforms/Scalar/CallSiteSplitting.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Transforms/Scalar/CallSiteSplitting.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -142,10 +142,11 @@ recordConditions(const CallSite &CS, BasicBlock *Pred, recordCondition(CS, Pred, CS.getInstruction()->getParent(), Conditions); BasicBlock *From = Pred; BasicBlock *To = Pred; - SmallPtrSet Visited = {From}; + SmallPtrSet Visited; while (!Visited.count(From->getSinglePredecessor()) && (From = From->getSinglePredecessor())) { recordCondition(CS, From, To, Conditions); + Visited.insert(From); To = From; } } Modified: vendor/llvm/dist-release_60/lib/Transforms/Scalar/StructurizeCFG.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Transforms/Scalar/StructurizeCFG.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Transforms/Scalar/StructurizeCFG.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -14,6 +14,7 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/DivergenceAnalysis.h" +#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/RegionInfo.h" #include "llvm/Analysis/RegionIterator.h" #include "llvm/Analysis/RegionPass.h" @@ -176,8 +177,9 @@ class StructurizeCFG : public RegionPass { Region *ParentRegion; DominatorTree *DT; + LoopInfo *LI; - std::deque Order; + SmallVector Order; BBSet Visited; BBPhiMap DeletedPhis; @@ -202,7 +204,7 @@ class StructurizeCFG : public RegionPass { void gatherPredicates(RegionNode *N); - void analyzeNode(RegionNode *N); + void collectInfos(); void insertConditions(bool Loops); @@ -256,6 +258,7 @@ class StructurizeCFG : public RegionPass { AU.addRequired(); AU.addRequiredID(LowerSwitchID); AU.addRequired(); + AU.addRequired(); AU.addPreserved(); RegionPass::getAnalysisUsage(AU); @@ -289,17 +292,55 @@ bool StructurizeCFG::doInitialization(Region *R, RGPas /// \brief Build up the general order of nodes void StructurizeCFG::orderNodes() { - assert(Visited.empty()); - assert(Predicates.empty()); - assert(Loops.empty()); - assert(LoopPreds.empty()); + ReversePostOrderTraversal RPOT(ParentRegion); + SmallDenseMap LoopBlocks; - // This must be RPO order for the back edge detection to work - for (RegionNode *RN : ReversePostOrderTraversal(ParentRegion)) { - // FIXME: Is there a better order to use for structurization? - Order.push_back(RN); - analyzeNode(RN); + // The reverse post-order traversal of the list gives us an ordering close + // to what we want. The only problem with it is that sometimes backedges + // for outer loops will be visited before backedges for inner loops. + for (RegionNode *RN : RPOT) { + BasicBlock *BB = RN->getEntry(); + Loop *Loop = LI->getLoopFor(BB); + ++LoopBlocks[Loop]; } + + unsigned CurrentLoopDepth = 0; + Loop *CurrentLoop = nullptr; + for (auto I = RPOT.begin(), E = RPOT.end(); I != E; ++I) { + BasicBlock *BB = (*I)->getEntry(); + unsigned LoopDepth = LI->getLoopDepth(BB); + + if (is_contained(Order, *I)) + continue; + + if (LoopDepth < CurrentLoopDepth) { + // Make sure we have visited all blocks in this loop before moving back to + // the outer loop. + + auto LoopI = I; + while (unsigned &BlockCount = LoopBlocks[CurrentLoop]) { + LoopI++; + BasicBlock *LoopBB = (*LoopI)->getEntry(); + if (LI->getLoopFor(LoopBB) == CurrentLoop) { + --BlockCount; + Order.push_back(*LoopI); + } + } + } + + CurrentLoop = LI->getLoopFor(BB); + if (CurrentLoop) + LoopBlocks[CurrentLoop]--; + + CurrentLoopDepth = LoopDepth; + Order.push_back(*I); + } + + // This pass originally used a post-order traversal and then operated on + // the list in reverse. Now that we are using a reverse post-order traversal + // rather than re-working the whole pass to operate on the list in order, + // we just reverse the list and continue to operate on it in reverse. + std::reverse(Order.begin(), Order.end()); } /// \brief Determine the end of the loops @@ -425,19 +466,32 @@ void StructurizeCFG::gatherPredicates(RegionNode *N) { } /// \brief Collect various loop and predicate infos -void StructurizeCFG::analyzeNode(RegionNode *RN) { - DEBUG(dbgs() << "Visiting: " - << (RN->isSubRegion() ? "SubRegion with entry: " : "") - << RN->getEntry()->getName() << '\n'); +void StructurizeCFG::collectInfos() { + // Reset predicate + Predicates.clear(); - // Analyze all the conditions leading to a node - gatherPredicates(RN); + // and loop infos + Loops.clear(); + LoopPreds.clear(); - // Remember that we've seen this node - Visited.insert(RN->getEntry()); + // Reset the visited nodes + Visited.clear(); - // Find the last back edges - analyzeLoops(RN); + for (RegionNode *RN : reverse(Order)) { + DEBUG(dbgs() << "Visiting: " + << (RN->isSubRegion() ? "SubRegion with entry: " : "") + << RN->getEntry()->getName() << " Loop Depth: " + << LI->getLoopDepth(RN->getEntry()) << "\n"); + + // Analyze all the conditions leading to a node + gatherPredicates(RN); + + // Remember that we've seen this node + Visited.insert(RN->getEntry()); + + // Find the last back edges + analyzeLoops(RN); + } } /// \brief Insert the missing branch conditions @@ -610,7 +664,7 @@ void StructurizeCFG::changeExit(RegionNode *Node, Basi BasicBlock *StructurizeCFG::getNextFlow(BasicBlock *Dominator) { LLVMContext &Context = Func->getContext(); BasicBlock *Insert = Order.empty() ? ParentRegion->getExit() : - Order.front()->getEntry(); + Order.back()->getEntry(); BasicBlock *Flow = BasicBlock::Create(Context, FlowBlockName, Func, Insert); DT->addNewBlock(Flow, Dominator); @@ -690,8 +744,7 @@ bool StructurizeCFG::isPredictableTrue(RegionNode *Nod /// Take one node from the order vector and wire it up void StructurizeCFG::wireFlow(bool ExitUseAllowed, BasicBlock *LoopEnd) { - RegionNode *Node = Order.front(); - Order.pop_front(); + RegionNode *Node = Order.pop_back_val(); Visited.insert(Node->getEntry()); if (isPredictableTrue(Node)) { @@ -715,7 +768,7 @@ void StructurizeCFG::wireFlow(bool ExitUseAllowed, PrevNode = Node; while (!Order.empty() && !Visited.count(LoopEnd) && - dominatesPredicates(Entry, Order.front())) { + dominatesPredicates(Entry, Order.back())) { handleLoops(false, LoopEnd); } @@ -726,7 +779,7 @@ void StructurizeCFG::wireFlow(bool ExitUseAllowed, void StructurizeCFG::handleLoops(bool ExitUseAllowed, BasicBlock *LoopEnd) { - RegionNode *Node = Order.front(); + RegionNode *Node = Order.back(); BasicBlock *LoopStart = Node->getEntry(); if (!Loops.count(LoopStart)) { @@ -871,9 +924,10 @@ bool StructurizeCFG::runOnRegion(Region *R, RGPassMana ParentRegion = R; DT = &getAnalysis().getDomTree(); + LI = &getAnalysis().getLoopInfo(); orderNodes(); - + collectInfos(); createFlow(); insertConditions(false); insertConditions(true); Modified: vendor/llvm/dist-release_60/lib/Transforms/Utils/ValueMapper.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Transforms/Utils/ValueMapper.cpp Thu Feb 1 21:06:28 2018 (r328733) +++ vendor/llvm/dist-release_60/lib/Transforms/Utils/ValueMapper.cpp Thu Feb 1 21:07:55 2018 (r328734) @@ -25,6 +25,7 @@ #include "llvm/IR/CallSite.h" #include "llvm/IR/Constant.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalAlias.h" @@ -536,13 +537,23 @@ Optional MDNodeMapper::tryToMapOperand(con return None; } +static Metadata *cloneOrBuildODR(const MDNode &N) { + auto *CT = dyn_cast(&N); + // If ODR type uniquing is enabled, we would have uniqued composite types + // with identifiers during bitcode reading, so we can just use CT. + if (CT && CT->getContext().isODRUniquingDebugTypes() && + CT->getIdentifier() != "") + return const_cast(CT); + return MDNode::replaceWithDistinct(N.clone()); +} + MDNode *MDNodeMapper::mapDistinctNode(const MDNode &N) { assert(N.isDistinct() && "Expected a distinct node"); assert(!M.getVM().getMappedMD(&N) && "Expected an unmapped node"); - DistinctWorklist.push_back(cast( - (M.Flags & RF_MoveDistinctMDs) - ? M.mapToSelf(&N) - : M.mapToMetadata(&N, MDNode::replaceWithDistinct(N.clone())))); + DistinctWorklist.push_back( + cast((M.Flags & RF_MoveDistinctMDs) + ? M.mapToSelf(&N) + : M.mapToMetadata(&N, cloneOrBuildODR(N)))); return DistinctWorklist.back(); } Added: vendor/llvm/dist-release_60/test/Analysis/ValueTracking/select-pattern.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_60/test/Analysis/ValueTracking/select-pattern.ll Thu Feb 1 21:07:55 2018 (r328734) @@ -0,0 +1,46 @@ +; RUN: opt -simplifycfg < %s -S | FileCheck %s + +; The dead code would cause a select that had itself +; as an operand to be analyzed. This would then cause +; infinite recursion and eventual crash. + +define void @PR36045(i1 %t, i32* %b) { +; CHECK-LABEL: @PR36045( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret void +; +entry: + br i1 %t, label %if, label %end + +if: + br i1 %t, label %unreach, label %pre + +unreach: + unreachable + +pre: + %p = phi i32 [ 70, %if ], [ %sel, %for ] + br label %for + +for: + %cmp = icmp sgt i32 %p, 8 + %add = add i32 %p, 2 + %sel = select i1 %cmp, i32 %p, i32 %add + %cmp21 = icmp ult i32 %sel, 21 + br i1 %cmp21, label %pre, label %for.end + +for.end: + br i1 %t, label %unreach2, label %then12 + +then12: + store i32 0, i32* %b + br label %unreach2 + +unreach2: + %spec = phi i32 [ %sel, %for.end ], [ 42, %then12 ] + unreachable + +end: + ret void +} + Added: vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/fallback-nofastisel.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/fallback-nofastisel.ll Thu Feb 1 21:07:55 2018 (r328734) @@ -0,0 +1,11 @@ +; RUN: llc -mtriple=aarch64_be-- %s -o /dev/null -debug-only=isel -O0 2>&1 | FileCheck %s +; REQUIRES: asserts + +; This test uses big endian in order to force an abort since it's not currently supported for GISel. +; The purpose is to check that we don't fall back to FastISel. Checking the pass structure is insufficient +; because the FastISel is set up in the SelectionDAGISel, so it doesn't appear on the pass structure. + +; CHECK-NOT: Enabling fast-ise +define void @empty() { + ret void +} Added: vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/irtranslator-volatile-load-pr36018.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/irtranslator-volatile-load-pr36018.ll Thu Feb 1 21:07:55 2018 (r328734) @@ -0,0 +1,14 @@ +; RUN: llc -O0 -mtriple=aarch64-apple-ios -o - %s | FileCheck %s + +@g = global i16 0, align 2 +declare void @bar(i32) + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 1 21:11:19 2018 Return-Path: Delivered-To: svn-src-all@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 0AD85EC9A06; Thu, 1 Feb 2018 21:11:19 +0000 (UTC) (envelope-from mav@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 B01BA86599; Thu, 1 Feb 2018 21:11:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB17E12528; Thu, 1 Feb 2018 21:11:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LBIQq078234; Thu, 1 Feb 2018 21:11:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LBHp7078227; Thu, 1 Feb 2018 21:11:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012111.w11LBHp7078227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:11:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328735 - in stable/11/sys/cam: . nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cam: . nvme X-SVN-Commit-Revision: 328735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:11:19 -0000 Author: mav Date: Thu Feb 1 21:11:17 2018 New Revision: 328735 URL: https://svnweb.freebsd.org/changeset/base/328735 Log: MFC r322999 (by imp): Fix NVMe's use of XPT_GDEV_TYPE This patch changes the way XPT_GDEV_TYPE works for NVMe. The current ccb_getdev structure includes pointers to the NVMe Identify Controller and Namespace structures, but these are kernel virtual addresses which are not accessible from user space. As an alternative, the patch changes the pointers into padding in ccb_getdev and adds two new types to ccb_dev_advinfo to retrieve the Identify Controller (CDAI_TYPE_NVME_CNTRL) and Namespace (CDAI_TYPE_NVME_NS) data structures. Modified: stable/11/sys/cam/cam_ccb.h stable/11/sys/cam/cam_xpt.c stable/11/sys/cam/nvme/nvme_all.c stable/11/sys/cam/nvme/nvme_all.h stable/11/sys/cam/nvme/nvme_da.c stable/11/sys/cam/nvme/nvme_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_ccb.h ============================================================================== --- stable/11/sys/cam/cam_ccb.h Thu Feb 1 21:07:55 2018 (r328734) +++ stable/11/sys/cam/cam_ccb.h Thu Feb 1 21:11:17 2018 (r328735) @@ -362,8 +362,7 @@ struct ccb_getdev { u_int8_t serial_num[252]; u_int8_t inq_flags; u_int8_t serial_num_len; - const struct nvme_controller_data *nvme_cdata; - const struct nvme_namespace_data *nvme_data; + void *padding[2]; }; /* Device Statistics CCB */ @@ -1227,6 +1226,8 @@ struct ccb_dev_advinfo { #define CDAI_TYPE_PHYS_PATH 3 #define CDAI_TYPE_RCAPLONG 4 #define CDAI_TYPE_EXT_INQ 5 +#define CDAI_TYPE_NVME_CNTRL 6 /* NVMe Identify Controller data */ +#define CDAI_TYPE_NVME_NS 7 /* NVMe Identify Namespace data */ off_t bufsiz; /* IN: Size of external buffer */ #define CAM_SCSI_DEVID_MAXLEN 65536 /* length in buffer is an uint16_t */ off_t provsiz; /* OUT: Size required/used */ Modified: stable/11/sys/cam/cam_xpt.c ============================================================================== --- stable/11/sys/cam/cam_xpt.c Thu Feb 1 21:07:55 2018 (r328734) +++ stable/11/sys/cam/cam_xpt.c Thu Feb 1 21:11:17 2018 (r328735) @@ -2693,8 +2693,6 @@ call_sim: cgd->inq_data = dev->inq_data; cgd->ident_data = dev->ident_data; cgd->inq_flags = dev->inq_flags; - cgd->nvme_data = dev->nvme_data; - cgd->nvme_cdata = dev->nvme_cdata; cgd->ccb_h.status = CAM_REQ_CMP; cgd->serial_num_len = dev->serial_num_len; if ((dev->serial_num_len > 0) Modified: stable/11/sys/cam/nvme/nvme_all.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_all.c Thu Feb 1 21:07:55 2018 (r328734) +++ stable/11/sys/cam/nvme/nvme_all.c Thu Feb 1 21:11:17 2018 (r328735) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #else #include @@ -54,6 +55,13 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef _KERNEL +#include +#include +#include +#include +#endif + void nvme_ns_cmd(struct ccb_nvmeio *nvmeio, uint8_t cmd, uint32_t nsid, uint32_t cdw10, uint32_t cdw11, uint32_t cdw12, uint32_t cdw13, @@ -121,4 +129,24 @@ nvme_cmd_string(const struct nvme_command *cmd, char * cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, cmd->cdw15); return cmd_string; +} + +const void * +nvme_get_identify_cntrl(struct cam_periph *periph) +{ + struct cam_ed *device; + + device = periph->path->device; + + return device->nvme_cdata; +} + +const void * +nvme_get_identify_ns(struct cam_periph *periph) +{ + struct cam_ed *device; + + device = periph->path->device; + + return device->nvme_data; } Modified: stable/11/sys/cam/nvme/nvme_all.h ============================================================================== --- stable/11/sys/cam/nvme/nvme_all.h Thu Feb 1 21:07:55 2018 (r328734) +++ stable/11/sys/cam/nvme/nvme_all.h Thu Feb 1 21:11:17 2018 (r328735) @@ -44,5 +44,7 @@ int nvme_identify_match(caddr_t identbuffer, caddr_t t void nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *); const char *nvme_op_string(const struct nvme_command *); const char *nvme_cmd_string(const struct nvme_command *, char *, size_t); +const void *nvme_get_identify_cntrl(struct cam_periph *); +const void *nvme_get_identify_ns(struct cam_periph *); #endif /* CAM_NVME_NVME_ALL_H */ Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 21:07:55 2018 (r328734) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 21:11:17 2018 (r328735) @@ -686,21 +686,14 @@ ndaregister(struct cam_periph *periph, void *arg) struct nda_softc *softc; struct disk *disk; struct ccb_pathinq cpi; - struct ccb_getdev *cgd; const struct nvme_namespace_data *nsd; const struct nvme_controller_data *cd; char announce_buf[80]; -// caddr_t match; u_int maxio; int quirks; - cgd = (struct ccb_getdev *)arg; - if (cgd == NULL) { - printf("ndaregister: no getdev CCB, can't register device\n"); - return(CAM_REQ_CMP_ERR); - } - nsd = cgd->nvme_data; - cd = cgd->nvme_cdata; + nsd = nvme_get_identify_ns(periph); + cd = nvme_get_identify_cntrl(periph); softc = (struct nda_softc *)malloc(sizeof(*softc), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -721,19 +714,7 @@ ndaregister(struct cam_periph *periph, void *arg) periph->softc = softc; -#if 0 - /* - * See if this device has any quirks. - */ - match = cam_quirkmatch((caddr_t)&cgd->ident_data, - (caddr_t)nda_quirk_table, - sizeof(nda_quirk_table)/sizeof(*nda_quirk_table), - sizeof(*nda_quirk_table), ata_identify_match); - if (match != NULL) - softc->quirks = ((struct nda_quirk_entry *)match)->quirks; - else -#endif - softc->quirks = NDA_Q_NONE; + softc->quirks = NDA_Q_NONE; bzero(&cpi, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE); Modified: stable/11/sys/cam/nvme/nvme_xpt.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_xpt.c Thu Feb 1 21:07:55 2018 (r328734) +++ stable/11/sys/cam/nvme/nvme_xpt.c Thu Feb 1 21:11:17 2018 (r328735) @@ -519,6 +519,24 @@ nvme_dev_advinfo(union ccb *start_ccb) memcpy(cdai->buf, device->physpath, amt); } break; + case CDAI_TYPE_NVME_CNTRL: + if (cdai->flags & CDAI_FLAG_STORE) + return; + amt = sizeof(struct nvme_controller_data); + cdai->provsiz = amt; + if (amt > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->nvme_cdata, amt); + break; + case CDAI_TYPE_NVME_NS: + if (cdai->flags & CDAI_FLAG_STORE) + return; + amt = sizeof(struct nvme_namespace_data); + cdai->provsiz = amt; + if (amt > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->nvme_data, amt); + break; default: return; } From owner-svn-src-all@freebsd.org Thu Feb 1 21:12:09 2018 Return-Path: Delivered-To: svn-src-all@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 AF01AEC9C77; Thu, 1 Feb 2018 21:12:09 +0000 (UTC) (envelope-from mav@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 61DED868AC; Thu, 1 Feb 2018 21:12:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CD961256A; Thu, 1 Feb 2018 21:12:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LC9ks078324; Thu, 1 Feb 2018 21:12:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LC9MB078323; Thu, 1 Feb 2018 21:12:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012112.w11LC9MB078323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328736 - stable/11/sys/cam/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/nvme X-SVN-Commit-Revision: 328736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:12:09 -0000 Author: mav Date: Thu Feb 1 21:12:09 2018 New Revision: 328736 URL: https://svnweb.freebsd.org/changeset/base/328736 Log: MFC r323625 (by imp): Allow multiple TRIMs to be done for nda Don't call cam_iosched_trim_done or cam_iosched_submit_trim for nda since its hardware can handle almost an arbitrary number of TRIMs and we don't have to be careful to only ever do one. Modified: stable/11/sys/cam/nvme/nvme_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 21:11:17 2018 (r328735) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 21:12:09 2018 (r328736) @@ -918,7 +918,12 @@ ndastart(struct cam_periph *periph, union ccb *start_c nda_nvme_trim(softc, &start_ccb->nvmeio, dsm_range, 1); start_ccb->ccb_h.ccb_state = NDA_CCB_TRIM; start_ccb->ccb_h.flags |= CAM_UNLOCKED; - cam_iosched_submit_trim(softc->cam_iosched); /* XXX */ + /* + * Note: We can have multiple TRIMs in flight, so we don't call + * cam_iosched_submit_trim(softc->cam_iosched); + * since that forces the I/O scheduler to only schedule one at a time. + * On NVMe drives, this is a performance disaster. + */ goto out; } case BIO_FLUSH: @@ -1005,7 +1010,11 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb TAILQ_INIT(&queue); TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue); #endif - cam_iosched_trim_done(softc->cam_iosched); + /* + * Since we can have multiple trims in flight, we don't + * need to call this here. + * cam_iosched_trim_done(softc->cam_iosched); + */ ndaschedule(periph); cam_periph_unlock(periph); #ifdef notyet From owner-svn-src-all@freebsd.org Thu Feb 1 21:12:59 2018 Return-Path: Delivered-To: svn-src-all@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 BAAEAEC9DE1; Thu, 1 Feb 2018 21:12:59 +0000 (UTC) (envelope-from mav@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 7101986A5B; Thu, 1 Feb 2018 21:12:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C00612683; Thu, 1 Feb 2018 21:12:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LCx3h078411; Thu, 1 Feb 2018 21:12:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LCxlM078410; Thu, 1 Feb 2018 21:12:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012112.w11LCxlM078410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:12:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328737 - stable/11/sys/cam/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/nvme X-SVN-Commit-Revision: 328737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:12:59 -0000 Author: mav Date: Thu Feb 1 21:12:59 2018 New Revision: 328737 URL: https://svnweb.freebsd.org/changeset/base/328737 Log: MFC r324630 (by imp): Update comment to reflect actual default timeout. Modified: stable/11/sys/cam/nvme/nvme_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 21:12:09 2018 (r328736) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 21:12:59 2018 (r328737) @@ -189,7 +189,7 @@ nda_nvme_flush(struct nda_softc *softc, struct ccb_nvm CAM_DIR_NONE, /* flags */ NULL, /* data_ptr */ 0, /* dxfer_len */ - nda_default_timeout * 1000); /* timeout 5s */ + nda_default_timeout * 1000); /* timeout 30s */ nvme_ns_flush_cmd(&nvmeio->cmd, softc->nsid); } @@ -203,7 +203,7 @@ nda_nvme_trim(struct nda_softc *softc, struct ccb_nvme CAM_DIR_OUT, /* flags */ payload, /* data_ptr */ num_ranges * sizeof(struct nvme_dsm_range), /* dxfer_len */ - nda_default_timeout * 1000); /* timeout 5s */ + nda_default_timeout * 1000); /* timeout 30s */ nvme_ns_trim_cmd(&nvmeio->cmd, softc->nsid, num_ranges); } @@ -217,7 +217,7 @@ nda_nvme_write(struct nda_softc *softc, struct ccb_nvm CAM_DIR_OUT, /* flags */ payload, /* data_ptr */ len, /* dxfer_len */ - nda_default_timeout * 1000); /* timeout 5s */ + nda_default_timeout * 1000); /* timeout 30s */ nvme_ns_write_cmd(&nvmeio->cmd, softc->nsid, lba, count); } @@ -246,7 +246,7 @@ nda_nvme_rw_bio(struct nda_softc *softc, struct ccb_nv flags, /* flags */ payload, /* data_ptr */ bp->bio_bcount, /* dxfer_len */ - nda_default_timeout * 1000); /* timeout 5s */ + nda_default_timeout * 1000); /* timeout 30s */ nvme_ns_rw_cmd(&nvmeio->cmd, rwcmd, softc->nsid, lba, count); } From owner-svn-src-all@freebsd.org Thu Feb 1 21:13:19 2018 Return-Path: Delivered-To: svn-src-all@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 486CFEC9E2E; Thu, 1 Feb 2018 21:13:19 +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 DCA4C86B53; Thu, 1 Feb 2018 21:13:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEBBE12684; Thu, 1 Feb 2018 21:13:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LDIac078476; Thu, 1 Feb 2018 21:13:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LDIai078475; Thu, 1 Feb 2018 21:13:18 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012113.w11LDIai078475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328738 - vendor/llvm/llvm-release_60-r323948 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_60-r323948 X-SVN-Commit-Revision: 328738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:13:19 -0000 Author: dim Date: Thu Feb 1 21:13:18 2018 New Revision: 328738 URL: https://svnweb.freebsd.org/changeset/base/328738 Log: Tag llvm release_60 branch r323948. Added: vendor/llvm/llvm-release_60-r323948/ - copied from r328737, vendor/llvm/dist-release_60/ From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:17 2018 Return-Path: Delivered-To: svn-src-all@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 B97A2EC9F08; Thu, 1 Feb 2018 21:14:16 +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 6A2B386CA4; Thu, 1 Feb 2018 21:14:16 +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 64F4512685; Thu, 1 Feb 2018 21:14:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LEGdw078589; Thu, 1 Feb 2018 21:14:16 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEFIM078580; Thu, 1 Feb 2018 21:14:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEFIM078580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328739 - in vendor/clang/dist-release_60: docs include/clang/Basic include/clang/Driver lib/Basic/Targets lib/Driver/ToolChains test/Driver X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_60: docs include/clang/Basic include/clang/Driver lib/Basic/Targets lib/Driver/ToolChains test/Driver X-SVN-Commit-Revision: 328739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:17 -0000 Author: dim Date: Thu Feb 1 21:14:15 2018 New Revision: 328739 URL: https://svnweb.freebsd.org/changeset/base/328739 Log: Vendor import of clang release_60 branch r323948: https://llvm.org/svn/llvm-project/cfe/branches/release_60@323948 Added: vendor/clang/dist-release_60/test/Driver/global-isel.c (contents, props changed) Modified: vendor/clang/dist-release_60/docs/ReleaseNotes.rst vendor/clang/dist-release_60/include/clang/Basic/DiagnosticDriverKinds.td vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist-release_60/include/clang/Driver/Options.td vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp vendor/clang/dist-release_60/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist-release_60/lib/Driver/ToolChains/Hexagon.cpp vendor/clang/dist-release_60/test/Driver/hexagon-hvx.c Modified: vendor/clang/dist-release_60/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist-release_60/docs/ReleaseNotes.rst Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/docs/ReleaseNotes.rst Thu Feb 1 21:14:15 2018 (r328739) @@ -213,7 +213,49 @@ Objective-C Language Changes in Clang OpenCL C Language Changes in Clang ---------------------------------- -... + +- Added subgroup builtins to enqueue kernel support. + +- Added CL2.0 atomics as Clang builtins that now accept + an additional memory scope parameter propagated to atomic IR instructions + (this is to align with the corresponding change in LLVM IR) (see `spec s6.13.11.4 + `_). + +- Miscellaneous fixes in the CL header. + +- Allow per target selection of address space during CodeGen of certain OpenCL types. + Default target implementation is provided mimicking old behavior. + +- Macro ``__IMAGE_SUPPORT__`` is now automatically added (as per `spec s6.10 + `_). + +- Added ``cl_intel_subgroups`` and ``cl_intel_subgroups_short`` extensions. + +- All function calls are marked by `the convergent attribute + `_ + to prevent optimizations that break SPMD program semantics. This will be removed + by LLVM passes if it can be proved that the function does not use convergent + operations. + +- Create a kernel wrapper for enqueued blocks, which simplifies enqueue support by + providing common functionality. + +- Added private address space explicitly in AST and refactored address space support + with several simplifications and bug fixes (`PR33419 `_ + and `PR33420 `_). + +- OpenCL now allows functions with empty parameters to be treated as if they had a + void parameter list (inspired from C++ support). OpenCL C spec update to follow. + +- General miscellaneous refactoring and cleanup of blocks support for OpenCL to + remove unused parts inherited from Objective C implementation. + +- Miscellaneous improvements in vector diagnostics. + +- Added half float load and store builtins without enabling half as a legal type + (``__builtin_store_half for double``, ``__builtin_store_halff`` for double, + ``__builtin_load_half for double``, ``__builtin_load_halff`` for float). + OpenMP Support in Clang ---------------------------------- Modified: vendor/clang/dist-release_60/include/clang/Basic/DiagnosticDriverKinds.td ============================================================================== --- vendor/clang/dist-release_60/include/clang/Basic/DiagnosticDriverKinds.td Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/include/clang/Basic/DiagnosticDriverKinds.td Thu Feb 1 21:14:15 2018 (r328739) @@ -354,4 +354,12 @@ def warn_drv_fine_grained_bitfield_accesses_ignored : def note_drv_verify_prefix_spelling : Note< "-verify prefixes must start with a letter and contain only alphanumeric" " characters, hyphens, and underscores">; + +def warn_drv_experimental_isel_incomplete : Warning< + "-fexperimental-isel support for the '%0' architecture is incomplete">, + InGroup; + +def warn_drv_experimental_isel_incomplete_opt : Warning< + "-fexperimental-isel support is incomplete for this architecture at the current optimization level">, + InGroup; } Modified: vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td Thu Feb 1 21:14:15 2018 (r328739) @@ -985,3 +985,6 @@ def UnknownArgument : DiagGroup<"unknown-argument">; // A warning group for warnings about code that clang accepts when // compiling OpenCL C/C++ but which is not compatible with the SPIR spec. def SpirCompat : DiagGroup<"spir-compat">; + +// Warning for the experimental-isel options. +def ExperimentalISel : DiagGroup<"experimental-isel">; Modified: vendor/clang/dist-release_60/include/clang/Driver/Options.td ============================================================================== --- vendor/clang/dist-release_60/include/clang/Driver/Options.td Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/include/clang/Driver/Options.td Thu Feb 1 21:14:15 2018 (r328739) @@ -1031,6 +1031,8 @@ def finline_functions : Flag<["-"], "finline-functions def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@ -1237,6 +1239,8 @@ def fno_exceptions : Flag<["-"], "fno-exceptions">, Gr def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group, + HelpText<"Disables the experimental global instruction selector">; def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Disables an experimental new pass manager in LLVM.">; Modified: vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp Thu Feb 1 21:14:15 2018 (r328739) @@ -409,7 +409,7 @@ void X86TargetInfo::setSSELevel(llvm::StringMap if (Enabled) { switch (Level) { case AVX512F: - Features["avx512f"] = true; + Features["avx512f"] = Features["fma"] = Features["f16c"] = true; LLVM_FALLTHROUGH; case AVX2: Features["avx2"] = true; @@ -623,6 +623,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::String } else if (Name == "fma") { if (Enabled) setSSELevel(Features, AVX, Enabled); + else + setSSELevel(Features, AVX512F, Enabled); } else if (Name == "fma4") { setXOPLevel(Features, FMA4, Enabled); } else if (Name == "xop") { @@ -632,6 +634,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::String } else if (Name == "f16c") { if (Enabled) setSSELevel(Features, AVX, Enabled); + else + setSSELevel(Features, AVX512F, Enabled); } else if (Name == "sha") { if (Enabled) setSSELevel(Features, SSE2, Enabled); Modified: vendor/clang/dist-release_60/lib/Driver/ToolChains/Clang.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Driver/ToolChains/Clang.cpp Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/lib/Driver/ToolChains/Clang.cpp Thu Feb 1 21:14:15 2018 (r328739) @@ -4639,6 +4639,37 @@ void Clang::ConstructJob(Compilation &C, const JobActi CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { + CmdArgs.push_back("-mllvm"); + if (A->getOption().matches(options::OPT_fexperimental_isel)) { + CmdArgs.push_back("-global-isel=1"); + + // GISel is on by default on AArch64 -O0, so don't bother adding + // the fallback remarks for it. Other combinations will add a warning of + // some kind. + bool IsArchSupported = Triple.getArch() == llvm::Triple::aarch64; + bool IsOptLevelSupported = false; + + Arg *A = Args.getLastArg(options::OPT_O_Group); + if (Triple.getArch() == llvm::Triple::aarch64) { + if (!A || A->getOption().matches(options::OPT_O0)) + IsOptLevelSupported = true; + } + if (!IsArchSupported || !IsOptLevelSupported) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-global-isel-abort=2"); + + if (!IsArchSupported) + D.Diag(diag::warn_drv_experimental_isel_incomplete) << Triple.getArchName(); + else + D.Diag(diag::warn_drv_experimental_isel_incomplete_opt); + } + } else { + CmdArgs.push_back("-global-isel=0"); + } + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Modified: vendor/clang/dist-release_60/lib/Driver/ToolChains/Hexagon.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Driver/ToolChains/Hexagon.cpp Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/lib/Driver/ToolChains/Hexagon.cpp Thu Feb 1 21:14:15 2018 (r328739) @@ -46,7 +46,7 @@ static void handleHVXWarnings(const Driver &D, const A // Handle the unsupported values passed to mhvx-length. if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_length_EQ)) { StringRef Val = A->getValue(); - if (Val != "64B" && Val != "128B") + if (!Val.equals_lower("64b") && !Val.equals_lower("128b")) D.Diag(diag::err_drv_unsupported_option_argument) << A->getOption().getName() << Val; } Added: vendor/clang/dist-release_60/test/Driver/global-isel.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Driver/global-isel.c Thu Feb 1 21:14:15 2018 (r328739) @@ -0,0 +1,24 @@ +// REQUIRES: x86-registered-target,aarch64-registered-target + +// RUN: %clang -fexperimental-isel -S -### %s 2>&1 | FileCheck --check-prefix=ENABLED %s +// RUN: %clang -fno-experimental-isel -S -### %s 2>&1 | FileCheck --check-prefix=DISABLED %s + +// RUN: %clang -target aarch64 -fexperimental-isel -S %s -### 2>&1 | FileCheck --check-prefix=ARM64-DEFAULT %s +// RUN: %clang -target aarch64 -fexperimental-isel -S -O0 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O0 %s +// RUN: %clang -target aarch64 -fexperimental-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2 %s +// RUN: %clang -target aarch64 -fexperimental-isel -Wno-experimental-isel -S -O2 %s -### 2>&1 | FileCheck --check-prefix=ARM64-O2-NOWARN %s + +// RUN: %clang -target x86_64 -fexperimental-isel -S %s -### 2>&1 | FileCheck --check-prefix=X86_64 %s + +// ENABLED: "-mllvm" "-global-isel=1" +// DISABLED: "-mllvm" "-global-isel=0" + +// ARM64-DEFAULT-NOT: warning: -fexperimental-sel +// ARM64-DEFAULT-NOT: "-global-isel-abort=2" +// ARM64-O0-NOT: warning: -fexperimental-sel +// ARM64-O2: warning: -fexperimental-isel support is incomplete for this architecture at the current optimization level +// ARM64-O2: "-mllvm" "-global-isel-abort=2" +// ARM64-O2-NOWARN-NOT: warning: -fexperimental-isel + +// X86_64: -fexperimental-isel support for the 'x86_64' architecture is incomplete +// X86_64: "-mllvm" "-global-isel-abort=2" Modified: vendor/clang/dist-release_60/test/Driver/hexagon-hvx.c ============================================================================== --- vendor/clang/dist-release_60/test/Driver/hexagon-hvx.c Thu Feb 1 21:13:18 2018 (r328738) +++ vendor/clang/dist-release_60/test/Driver/hexagon-hvx.c Thu Feb 1 21:14:15 2018 (r328739) @@ -21,6 +21,9 @@ // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx \ // RUN: -mhvx-length=128B 2>&1 | FileCheck -check-prefix=CHECKHVX2 %s + +// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx \ +// RUN: -mhvx-length=128b 2>&1 | FileCheck -check-prefix=CHECKHVX2 %s // CHECKHVX2-NOT: "-target-feature" "+hvx-length64b" // CHECKHVX2: "-target-feature" "+hvx-length128b" @@ -79,8 +82,10 @@ // The default mode on v60,v62 is 64B. // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \ // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s -// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx -mhvx-length=64B\ -// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s +// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \ +// RUN: -mhvx-length=64b 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s +// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \ +// RUN: -mhvx-length=64B 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s // CHECK-HVXLENGTH-64B: "-target-feature" "+hvx{{.*}}" "-target-feature" "+hvx-length64b" // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx -mhvx-length=128B\ // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-128B %s From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:19 2018 Return-Path: Delivered-To: svn-src-all@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 CB5ECEC9F31; Thu, 1 Feb 2018 21:14:19 +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 7EF8B86CB6; Thu, 1 Feb 2018 21:14:19 +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 604B412686; Thu, 1 Feb 2018 21:14:19 +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 w11LEJ41078637; Thu, 1 Feb 2018 21:14:19 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEJFX078636; Thu, 1 Feb 2018 21:14:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEJFX078636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328740 - vendor/clang/clang-release_60-r323948 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_60-r323948 X-SVN-Commit-Revision: 328740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:20 -0000 Author: dim Date: Thu Feb 1 21:14:19 2018 New Revision: 328740 URL: https://svnweb.freebsd.org/changeset/base/328740 Log: Tag clang release_60 branch r323948. Added: vendor/clang/clang-release_60-r323948/ - copied from r328739, vendor/clang/dist-release_60/ From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:24 2018 Return-Path: Delivered-To: svn-src-all@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 ED689EC9F6C; Thu, 1 Feb 2018 21:14:23 +0000 (UTC) (envelope-from mav@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 D746F86D4F; Thu, 1 Feb 2018 21:14:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BD9412687; Thu, 1 Feb 2018 21:14:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LELWi078686; Thu, 1 Feb 2018 21:14:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LELv0078685; Thu, 1 Feb 2018 21:14:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012114.w11LELv0078685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328741 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:24 -0000 Author: mav Date: Thu Feb 1 21:14:21 2018 New Revision: 328741 URL: https://svnweb.freebsd.org/changeset/base/328741 Log: MFC r324977 (by imp): Add nvme_controller_data argument to all print functions. It's desirable to access controler data to inform printing log pages (such as limiting the printing to valid ranges). Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 21:14:19 2018 (r328740) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 21:14:21 2018 (r328741) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_SIZE (4096) #define MAX_FW_SLOTS (7) -typedef void (*print_fn_t)(void *buf, uint32_t size); +typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void *buf, uint32_t size); struct kv_name { @@ -75,8 +75,16 @@ kv_lookup(const struct kv_name *kv, size_t kv_count, u } static void -print_bin(void *data, uint32_t length) +print_log_hex(const struct nvme_controller_data *cdata __unused, void *data, uint32_t length) { + + print_hex(data, length); +} + +static void +print_bin(const struct nvme_controller_data *cdata __unused, void *data, uint32_t length) +{ + write(STDOUT_FILENO, data, length); } @@ -115,7 +123,7 @@ read_logpage(int fd, uint8_t log_page, int nsid, void } static void -print_log_error(void *buf, uint32_t size) +print_log_error(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) { int i, nentries; struct nvme_error_information_entry *entry = buf; @@ -162,7 +170,7 @@ print_temp(uint16_t t) static void -print_log_health(void *buf, uint32_t size __unused) +print_log_health(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { struct nvme_health_information_page *health = buf; char cbuf[UINT128_DIG + 1]; @@ -224,7 +232,7 @@ print_log_health(void *buf, uint32_t size __unused) } static void -print_log_firmware(void *buf, uint32_t size __unused) +print_log_firmware(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { int i; const char *status; @@ -260,7 +268,7 @@ print_log_firmware(void *buf, uint32_t size __unused) * offset 147: it is only 1 byte, not 6. */ static void -print_intel_temp_stats(void *buf, uint32_t size __unused) +print_intel_temp_stats(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { struct intel_log_temp_stats *temp = buf; @@ -287,7 +295,7 @@ print_intel_temp_stats(void *buf, uint32_t size __unus * Read and write stats pages have identical encoding. */ static void -print_intel_read_write_lat_log(void *buf, uint32_t size __unused) +print_intel_read_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { const char *walker = buf; int i; @@ -303,28 +311,28 @@ print_intel_read_write_lat_log(void *buf, uint32_t siz } static void -print_intel_read_lat_log(void *buf, uint32_t size) +print_intel_read_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) { printf("Intel Read Latency Log\n"); printf("======================\n"); - print_intel_read_write_lat_log(buf, size); + print_intel_read_write_lat_log(cdata, buf, size); } static void -print_intel_write_lat_log(void *buf, uint32_t size) +print_intel_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) { printf("Intel Write Latency Log\n"); printf("=======================\n"); - print_intel_read_write_lat_log(buf, size); + print_intel_read_write_lat_log(cdata, buf, size); } /* * Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra data not documented. */ static void -print_intel_add_smart(void *buf, uint32_t size __unused) +print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { uint8_t *walker = buf; uint8_t *end = walker + 150; @@ -753,7 +761,7 @@ kv_indirect(void *buf, uint32_t subtype, uint8_t res, } static void -print_hgst_info_log(void *buf, uint32_t size __unused) +print_hgst_info_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { uint8_t *walker, *end, *subpage; int pages; @@ -928,7 +936,7 @@ logpage(int argc, char *argv[]) "smart/health information"); } - print_fn = print_hex; + print_fn = print_log_hex; size = DEFAULT_SIZE; if (binflag) print_fn = print_bin; @@ -960,7 +968,7 @@ logpage(int argc, char *argv[]) /* Read the log page */ buf = get_log_buffer(size); read_logpage(fd, log_page, nsid, buf, size); - print_fn(buf, size); + print_fn(&cdata, buf, size); close(fd); exit(0); From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:24 2018 Return-Path: Delivered-To: svn-src-all@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 96317EC9F71; Thu, 1 Feb 2018 21:14:24 +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 25AB686D94; Thu, 1 Feb 2018 21:14:24 +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 0CB3E12688; Thu, 1 Feb 2018 21:14:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LENb7078733; Thu, 1 Feb 2018 21:14:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEN8t078731; Thu, 1 Feb 2018 21:14:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEN8t078731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328742 - in vendor/compiler-rt/dist-release_60/lib: hwasan tsan/rtl X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/compiler-rt/dist-release_60/lib: hwasan tsan/rtl X-SVN-Commit-Revision: 328742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:24 -0000 Author: dim Date: Thu Feb 1 21:14:23 2018 New Revision: 328742 URL: https://svnweb.freebsd.org/changeset/base/328742 Log: Vendor import of compiler-rt release_60 branch r323948: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@323948 Modified: vendor/compiler-rt/dist-release_60/lib/hwasan/CMakeLists.txt vendor/compiler-rt/dist-release_60/lib/tsan/rtl/tsan_platform.h Modified: vendor/compiler-rt/dist-release_60/lib/hwasan/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist-release_60/lib/hwasan/CMakeLists.txt Thu Feb 1 21:14:21 2018 (r328741) +++ vendor/compiler-rt/dist-release_60/lib/hwasan/CMakeLists.txt Thu Feb 1 21:14:23 2018 (r328742) @@ -17,7 +17,7 @@ set(HWASAN_RTL_CXX_SOURCES set(HWASAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_rtti_flag(OFF HWASAN_RTL_CFLAGS) -append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE HWASAN_RTL_CFLAGS) +append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC HWASAN_RTL_CFLAGS) # Prevent clang from generating libc calls. append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding HWASAN_RTL_CFLAGS) Modified: vendor/compiler-rt/dist-release_60/lib/tsan/rtl/tsan_platform.h ============================================================================== --- vendor/compiler-rt/dist-release_60/lib/tsan/rtl/tsan_platform.h Thu Feb 1 21:14:21 2018 (r328741) +++ vendor/compiler-rt/dist-release_60/lib/tsan/rtl/tsan_platform.h Thu Feb 1 21:14:23 2018 (r328742) @@ -79,25 +79,27 @@ struct Mapping { #define TSAN_MID_APP_RANGE 1 #elif defined(__mips64) /* -C/C++ on linux/mips64 -0100 0000 00 - 0200 0000 00: main binary -0200 0000 00 - 1400 0000 00: - -1400 0000 00 - 2400 0000 00: shadow -2400 0000 00 - 3000 0000 00: - -3000 0000 00 - 4000 0000 00: metainfo (memory blocks and sync objects) -4000 0000 00 - 6000 0000 00: - -6000 0000 00 - 6200 0000 00: traces -6200 0000 00 - fe00 0000 00: - -fe00 0000 00 - ff00 0000 00: heap -ff00 0000 00 - ff80 0000 00: - -ff80 0000 00 - ffff ffff ff: modules and main thread stack +C/C++ on linux/mips64 (40-bit VMA) +0000 0000 00 - 0100 0000 00: - (4 GB) +0100 0000 00 - 0200 0000 00: main binary (4 GB) +0200 0000 00 - 2000 0000 00: - (120 GB) +2000 0000 00 - 4000 0000 00: shadow (128 GB) +4000 0000 00 - 5000 0000 00: metainfo (memory blocks and sync objects) (64 GB) +5000 0000 00 - aa00 0000 00: - (360 GB) +aa00 0000 00 - ab00 0000 00: main binary (PIE) (4 GB) +ab00 0000 00 - b000 0000 00: - (20 GB) +b000 0000 00 - b200 0000 00: traces (8 GB) +b200 0000 00 - fe00 0000 00: - (304 GB) +fe00 0000 00 - ff00 0000 00: heap (4 GB) +ff00 0000 00 - ff80 0000 00: - (2 GB) +ff80 0000 00 - ffff ffff ff: modules and main thread stack (<2 GB) */ struct Mapping { static const uptr kMetaShadowBeg = 0x4000000000ull; static const uptr kMetaShadowEnd = 0x5000000000ull; static const uptr kTraceMemBeg = 0xb000000000ull; static const uptr kTraceMemEnd = 0xb200000000ull; - static const uptr kShadowBeg = 0x2400000000ull; + static const uptr kShadowBeg = 0x2000000000ull; static const uptr kShadowEnd = 0x4000000000ull; static const uptr kHeapMemBeg = 0xfe00000000ull; static const uptr kHeapMemEnd = 0xff00000000ull; From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:34 2018 Return-Path: Delivered-To: svn-src-all@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 61C90EC9FDA; Thu, 1 Feb 2018 21:14:34 +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 0CC6F86E48; Thu, 1 Feb 2018 21:14:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01D3912689; Thu, 1 Feb 2018 21:14:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LEQAS078781; Thu, 1 Feb 2018 21:14:26 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEQom078780; Thu, 1 Feb 2018 21:14:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEQom078780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328743 - vendor/compiler-rt/compiler-rt-release_60-r323948 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_60-r323948 X-SVN-Commit-Revision: 328743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:34 -0000 Author: dim Date: Thu Feb 1 21:14:26 2018 New Revision: 328743 URL: https://svnweb.freebsd.org/changeset/base/328743 Log: Tag compiler-rt release_60 branch r323948. Added: vendor/compiler-rt/compiler-rt-release_60-r323948/ - copied from r328742, vendor/compiler-rt/dist-release_60/ From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:34 2018 Return-Path: Delivered-To: svn-src-all@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 7447EEC9FDB; Thu, 1 Feb 2018 21:14:34 +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 DFC6A86F28; Thu, 1 Feb 2018 21:14:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B6331268A; Thu, 1 Feb 2018 21:14:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LEW9V078832; Thu, 1 Feb 2018 21:14:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEWSg078831; Thu, 1 Feb 2018 21:14:32 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEWSg078831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328744 - vendor/libc++/libc++-release_60-r323948 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_60-r323948 X-SVN-Commit-Revision: 328744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:34 -0000 Author: dim Date: Thu Feb 1 21:14:31 2018 New Revision: 328744 URL: https://svnweb.freebsd.org/changeset/base/328744 Log: Tag libc++ release_60 branch r323948. Added: vendor/libc++/libc++-release_60-r323948/ - copied from r328743, vendor/libc++/dist-release_60/ From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:40 2018 Return-Path: Delivered-To: svn-src-all@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 6C578ECA059; Thu, 1 Feb 2018 21:14:40 +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 C214286FD9; Thu, 1 Feb 2018 21:14:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECC481268B; Thu, 1 Feb 2018 21:14:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LEZ7D078897; Thu, 1 Feb 2018 21:14:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEYt8078882; Thu, 1 Feb 2018 21:14:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEYt8078882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328745 - in vendor/lld/dist-release_60: ELF test/ELF/linkerscript X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist-release_60: ELF test/ELF/linkerscript X-SVN-Commit-Revision: 328745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:40 -0000 Author: dim Date: Thu Feb 1 21:14:34 2018 New Revision: 328745 URL: https://svnweb.freebsd.org/changeset/base/328745 Log: Vendor import of lld release_60 branch r323948: https://llvm.org/svn/llvm-project/lld/branches/release_60@323948 Added: vendor/lld/dist-release_60/test/ELF/linkerscript/at3.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/linkerscript/merge-header-load.s (contents, props changed) Modified: vendor/lld/dist-release_60/ELF/AArch64ErrataFix.cpp vendor/lld/dist-release_60/ELF/LinkerScript.cpp vendor/lld/dist-release_60/ELF/LinkerScript.h vendor/lld/dist-release_60/ELF/OutputSections.h vendor/lld/dist-release_60/ELF/ScriptParser.cpp vendor/lld/dist-release_60/ELF/Writer.cpp vendor/lld/dist-release_60/ELF/Writer.h Modified: vendor/lld/dist-release_60/ELF/AArch64ErrataFix.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/AArch64ErrataFix.cpp Thu Feb 1 21:14:31 2018 (r328744) +++ vendor/lld/dist-release_60/ELF/AArch64ErrataFix.cpp Thu Feb 1 21:14:34 2018 (r328745) @@ -47,6 +47,7 @@ using namespace llvm; using namespace llvm::ELF; using namespace llvm::object; +using namespace llvm::support; using namespace llvm::support::endian; using namespace lld; @@ -357,7 +358,7 @@ static uint64_t scanCortexA53Errata843419(InputSection uint64_t PatchOff = 0; const uint8_t *Buf = IS->Data.begin(); - const uint32_t *InstBuf = reinterpret_cast(Buf + Off); + const ulittle32_t *InstBuf = reinterpret_cast(Buf + Off); uint32_t Instr1 = *InstBuf++; uint32_t Instr2 = *InstBuf++; uint32_t Instr3 = *InstBuf++; Modified: vendor/lld/dist-release_60/ELF/LinkerScript.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/LinkerScript.cpp Thu Feb 1 21:14:31 2018 (r328744) +++ vendor/lld/dist-release_60/ELF/LinkerScript.cpp Thu Feb 1 21:14:34 2018 (r328745) @@ -589,8 +589,12 @@ void LinkerScript::output(InputSection *S) { // If there is a memory region associated with this input section, then // place the section in that region and update the region index. + if (Ctx->LMARegion) + Ctx->LMARegion->CurPos += Pos - Before; + // FIXME: should we also produce overflow errors for LMARegion? + if (Ctx->MemRegion) { - uint64_t &CurOffset = Ctx->MemRegionOffset[Ctx->MemRegion]; + uint64_t &CurOffset = Ctx->MemRegion->CurPos; CurOffset += Pos - Before; uint64_t CurSize = CurOffset - Ctx->MemRegion->Origin; if (CurSize > Ctx->MemRegion->Length) { @@ -617,9 +621,8 @@ MemoryRegion *LinkerScript::findMemoryRegion(OutputSec // If a memory region name was specified in the output section command, // then try to find that region first. if (!Sec->MemoryRegionName.empty()) { - auto It = MemoryRegions.find(Sec->MemoryRegionName); - if (It != MemoryRegions.end()) - return It->second; + if (MemoryRegion *M = MemoryRegions.lookup(Sec->MemoryRegionName)) + return M; error("memory region '" + Sec->MemoryRegionName + "' not declared"); return nullptr; } @@ -652,31 +655,24 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { setDot(Sec->AddrExpr, Sec->Location, false); Ctx->MemRegion = Sec->MemRegion; + Ctx->LMARegion = Sec->LMARegion; if (Ctx->MemRegion) - Dot = Ctx->MemRegionOffset[Ctx->MemRegion]; + Dot = Ctx->MemRegion->CurPos; switchTo(Sec); - if (Sec->LMAExpr) { - uint64_t D = Dot; - Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; }; - } + if (Sec->LMAExpr) + Ctx->LMAOffset = Sec->LMAExpr().getValue() - Dot; - if (!Sec->LMARegionName.empty()) { - if (MemoryRegion *MR = MemoryRegions.lookup(Sec->LMARegionName)) { - uint64_t Offset = MR->Origin - Dot; - Ctx->LMAOffset = [=] { return Offset; }; - } else { - error("memory region '" + Sec->LMARegionName + "' not declared"); - } - } + if (MemoryRegion *MR = Sec->LMARegion) + Ctx->LMAOffset = MR->CurPos - Dot; // If neither AT nor AT> is specified for an allocatable section, the linker // will set the LMA such that the difference between VMA and LMA for the // section is the same as the preceding output section in the same region // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html - if (Ctx->LMAOffset) - Ctx->OutSec->LMAOffset = Ctx->LMAOffset(); + if (PhdrEntry *L = Ctx->OutSec->PtLoad) + L->LMAOffset = Ctx->LMAOffset; // The Size previously denoted how many InputSections had been added to this // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to @@ -698,7 +694,9 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { Cmd->Offset = Dot - Ctx->OutSec->Addr; Dot += Cmd->Size; if (Ctx->MemRegion) - Ctx->MemRegionOffset[Ctx->MemRegion] += Cmd->Size; + Ctx->MemRegion->CurPos += Cmd->Size; + if (Ctx->LMARegion) + Ctx->LMARegion->CurPos += Cmd->Size; Ctx->OutSec->Size = Dot - Ctx->OutSec->Addr; continue; } @@ -797,6 +795,12 @@ void LinkerScript::adjustSectionsAfterSorting() { if (auto *Sec = dyn_cast(Base)) { if (!Sec->Live) continue; + if (!Sec->LMARegionName.empty()) { + if (MemoryRegion *M = MemoryRegions.lookup(Sec->LMARegionName)) + Sec->LMARegion = M; + else + error("memory region '" + Sec->LMARegionName + "' not declared"); + } Sec->MemRegion = findMemoryRegion(Sec); // Handle align (e.g. ".foo : ALIGN(16) { ... }"). if (Sec->AlignExpr) @@ -887,8 +891,8 @@ void LinkerScript::allocateHeaders(std::vectorMemoryRegions) { - const MemoryRegion *MR = MRI.second; - MemRegionOffset[MR] = MR->Origin; + MemoryRegion *MR = MRI.second; + MR->CurPos = MR->Origin; } } Modified: vendor/lld/dist-release_60/ELF/LinkerScript.h ============================================================================== --- vendor/lld/dist-release_60/ELF/LinkerScript.h Thu Feb 1 21:14:31 2018 (r328744) +++ vendor/lld/dist-release_60/ELF/LinkerScript.h Thu Feb 1 21:14:34 2018 (r328745) @@ -118,11 +118,17 @@ enum class ConstraintKind { NoConstraint, ReadOnly, Re // target memory. Instances of the struct are created by parsing the // MEMORY command. struct MemoryRegion { + MemoryRegion(StringRef Name, uint64_t Origin, uint64_t Length, uint32_t Flags, + uint32_t NegFlags) + : Name(Name), Origin(Origin), Length(Length), Flags(Flags), + NegFlags(NegFlags) {} + std::string Name; uint64_t Origin; uint64_t Length; uint32_t Flags; uint32_t NegFlags; + uint64_t CurPos = 0; }; // This struct represents one section match pattern in SECTIONS() command. @@ -200,8 +206,8 @@ class LinkerScript final { uint64_t ThreadBssOffset = 0; OutputSection *OutSec = nullptr; MemoryRegion *MemRegion = nullptr; - llvm::DenseMap MemRegionOffset; - std::function LMAOffset; + MemoryRegion *LMARegion = nullptr; + uint64_t LMAOffset = 0; }; llvm::DenseMap NameToOutputSection; Modified: vendor/lld/dist-release_60/ELF/OutputSections.h ============================================================================== --- vendor/lld/dist-release_60/ELF/OutputSections.h Thu Feb 1 21:14:31 2018 (r328744) +++ vendor/lld/dist-release_60/ELF/OutputSections.h Thu Feb 1 21:14:34 2018 (r328745) @@ -49,7 +49,7 @@ class OutputSection final : public BaseCommand, public static bool classof(const BaseCommand *C); - uint64_t getLMA() const { return Addr + LMAOffset; } + uint64_t getLMA() const { return PtLoad ? Addr + PtLoad->LMAOffset : Addr; } template void writeHeaderTo(typename ELFT::Shdr *SHdr); unsigned SectionIndex; @@ -78,7 +78,6 @@ class OutputSection final : public BaseCommand, public // The following fields correspond to Elf_Shdr members. uint64_t Offset = 0; - uint64_t LMAOffset = 0; uint64_t Addr = 0; uint32_t ShName = 0; @@ -89,6 +88,7 @@ class OutputSection final : public BaseCommand, public // The following members are normally only used in linker scripts. MemoryRegion *MemRegion = nullptr; + MemoryRegion *LMARegion = nullptr; Expr AddrExpr; Expr AlignExpr; Expr LMAExpr; Modified: vendor/lld/dist-release_60/ELF/ScriptParser.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/ScriptParser.cpp Thu Feb 1 21:14:31 2018 (r328744) +++ vendor/lld/dist-release_60/ELF/ScriptParser.cpp Thu Feb 1 21:14:34 2018 (r328745) @@ -1293,8 +1293,8 @@ void ScriptParser::readMemory() { // Add the memory region to the region map. if (Script->MemoryRegions.count(Name)) setError("region '" + Name + "' already defined"); - MemoryRegion *MR = make(); - *MR = {Name, Origin, Length, Flags, NegFlags}; + MemoryRegion *MR = + make(Name, Origin, Length, Flags, NegFlags); Script->MemoryRegions[Name] = MR; } } Modified: vendor/lld/dist-release_60/ELF/Writer.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/Writer.cpp Thu Feb 1 21:14:31 2018 (r328744) +++ vendor/lld/dist-release_60/ELF/Writer.cpp Thu Feb 1 21:14:34 2018 (r328745) @@ -822,6 +822,8 @@ void PhdrEntry::add(OutputSection *Sec) { p_align = std::max(p_align, Sec->Alignment); if (p_type == PT_LOAD) Sec->PtLoad = this; + if (Sec->LMAExpr) + ASectionHasLMA = true; } // The beginning and the ending of .rel[a].plt section are marked @@ -1626,7 +1628,9 @@ template std::vector Writer< // different flags or is loaded at a discontiguous address using AT linker // script command. uint64_t NewFlags = computeFlags(Sec->getPhdrFlags()); - if (Sec->LMAExpr || Flags != NewFlags) { + if ((Sec->LMAExpr && Load->ASectionHasLMA) || + Sec->MemRegion != Load->FirstSec->MemRegion || Flags != NewFlags) { + Load = AddHdr(PT_LOAD, NewFlags); Flags = NewFlags; } Modified: vendor/lld/dist-release_60/ELF/Writer.h ============================================================================== --- vendor/lld/dist-release_60/ELF/Writer.h Thu Feb 1 21:14:31 2018 (r328744) +++ vendor/lld/dist-release_60/ELF/Writer.h Thu Feb 1 21:14:34 2018 (r328745) @@ -44,6 +44,13 @@ struct PhdrEntry { OutputSection *FirstSec = nullptr; OutputSection *LastSec = nullptr; bool HasLMA = false; + + // True if one of the sections in this program header has a LMA specified via + // linker script: AT(addr). We never allow 2 or more sections with LMA in the + // same program header. + bool ASectionHasLMA = false; + + uint64_t LMAOffset = 0; }; void addReservedSymbols(); Added: vendor/lld/dist-release_60/test/ELF/linkerscript/at3.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/linkerscript/at3.s Thu Feb 1 21:14:34 2018 (r328745) @@ -0,0 +1,38 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: echo "MEMORY { \ +# RUN: FOO (ax) : ORIGIN = 0x1000, LENGTH = 0x100 \ +# RUN: BAR (ax) : ORIGIN = 0x2000, LENGTH = 0x100 \ +# RUN: ZED (ax) : ORIGIN = 0x3000, LENGTH = 0x100 \ +# RUN: FLASH (ax) : ORIGIN = 0x6000, LENGTH = 0x200 \ +# RUN: } \ +# RUN: SECTIONS { \ +# RUN: .foo1 : { *(.foo1) } > FOO AT>FLASH \ +# RUN: .foo2 : { *(.foo2) BYTE(0x42) } > BAR AT>FLASH \ +# RUN: .foo3 : { *(.foo3) } > ZED AT>FLASH \ +# RUN: }" > %t.script +# RUN: ld.lld %t.o --script %t.script -o %t +# RUN: llvm-readelf -sections -program-headers %t | FileCheck %s + +# CHECK: .foo1 PROGBITS 0000000000001000 001000 +# CHECK: .foo2 PROGBITS 0000000000002000 002000 +# CHECK: .foo3 PROGBITS 0000000000003000 003000 + +# CHECK: Program Headers: +# CHECK-NOT: LOAD + +# CHECK: Type Offset VirtAddr PhysAddr +# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000006000 +# CHECK-NEXT: LOAD 0x002000 0x0000000000002000 0x0000000000006008 +# CHECK-NEXT: LOAD 0x003000 0x0000000000003000 0x0000000000006011 + +# CHECK-NOT: LOAD + +.section .foo1, "a" +.quad 0 + +.section .foo2, "ax" +.quad 0 + +.section .foo3, "ax" +.quad 0 Added: vendor/lld/dist-release_60/test/ELF/linkerscript/merge-header-load.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/linkerscript/merge-header-load.s Thu Feb 1 21:14:34 2018 (r328745) @@ -0,0 +1,21 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: echo "SECTIONS { \ +# RUN: . = 0xffffffff80000200; \ +# RUN: .text : AT (0x4200) { *(.text) } \ +# RUN: }" > %t.script +# RUN: ld.lld %t.o --script %t.script -o %t +# RUN: llvm-readelf -program-headers %t | FileCheck %s + +# Test that we put the header in the first PT_LOAD. We used to create a PT_LOAD +# just for it and it would have a different virtual to physical address delta. + +# CHECK: Program Headers: +# CHECK: Type Offset VirtAddr PhysAddr +# CHECK-NEXT: PHDR 0x000040 0xffffffff80000040 0x0000000000004040 +# CHECK-NEXT: LOAD 0x000000 0xffffffff80000000 0x0000000000004000 +# CHECK-NOT: LOAD + +.global _start +_start: +nop From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:45 2018 Return-Path: Delivered-To: svn-src-all@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 E87E9ECA075; Thu, 1 Feb 2018 21:14:44 +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 BB3F387053; Thu, 1 Feb 2018 21:14:40 +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 8C20A1268C; Thu, 1 Feb 2018 21:14:40 +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 w11LEee2078946; Thu, 1 Feb 2018 21:14:40 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEeGN078945; Thu, 1 Feb 2018 21:14:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEeGN078945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328746 - vendor/lld/lld-release_60-r323948 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_60-r323948 X-SVN-Commit-Revision: 328746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:45 -0000 Author: dim Date: Thu Feb 1 21:14:40 2018 New Revision: 328746 URL: https://svnweb.freebsd.org/changeset/base/328746 Log: Tag lld release_60 branch r323948. Added: vendor/lld/lld-release_60-r323948/ - copied from r328745, vendor/lld/dist-release_60/ From owner-svn-src-all@freebsd.org Thu Feb 1 21:14:50 2018 Return-Path: Delivered-To: svn-src-all@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 3BDD7ECA0AE; Thu, 1 Feb 2018 21:14:50 +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 749B187161; Thu, 1 Feb 2018 21:14:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D57D61268D; Thu, 1 Feb 2018 21:14:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LEiT4078994; Thu, 1 Feb 2018 21:14:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEie2078993; Thu, 1 Feb 2018 21:14:44 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012114.w11LEie2078993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328747 - vendor/lldb/lldb-release_60-r323948 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_60-r323948 X-SVN-Commit-Revision: 328747 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:14:50 -0000 Author: dim Date: Thu Feb 1 21:14:44 2018 New Revision: 328747 URL: https://svnweb.freebsd.org/changeset/base/328747 Log: Tag lldb release_60 branch r323948. Added: vendor/lldb/lldb-release_60-r323948/ - copied from r328746, vendor/lldb/dist-release_60/ From owner-svn-src-all@freebsd.org Thu Feb 1 21:15:00 2018 Return-Path: Delivered-To: svn-src-all@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 59225ECA11E; Thu, 1 Feb 2018 21:15:00 +0000 (UTC) (envelope-from mav@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 9BB4787303; Thu, 1 Feb 2018 21:14:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02E691268E; Thu, 1 Feb 2018 21:14:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LEsp5079044; Thu, 1 Feb 2018 21:14:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LEsil079043; Thu, 1 Feb 2018 21:14:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012114.w11LEsil079043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:14:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328748 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 328748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:15:00 -0000 Author: mav Date: Thu Feb 1 21:14:54 2018 New Revision: 328748 URL: https://svnweb.freebsd.org/changeset/base/328748 Log: MFC r324978: Report only the valid slots in the firmware log page. Printing the entire log page is causing confusion over available slots. Report only those slots that are valid. In the case where the firmware download isn't supported, assume that only the first slot is valid (I have no hardware to test this assumption though) Modified: stable/11/sbin/nvmecontrol/logpage.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 21:14:44 2018 (r328747) +++ stable/11/sbin/nvmecontrol/logpage.c Thu Feb 1 21:14:54 2018 (r328748) @@ -234,14 +234,19 @@ print_log_health(const struct nvme_controller_data *cd static void print_log_firmware(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { - int i; + int i, slots; const char *status; struct nvme_firmware_page *fw = buf; printf("Firmware Slot Log\n"); printf("=================\n"); - for (i = 0; i < MAX_FW_SLOTS; i++) { + if (cdata->oacs.firmware == 0) + slots = 1; + else + slots = MIN(cdata->frmw.num_slots, MAX_FW_SLOTS); + + for (i = 0; i < slots; i++) { printf("Slot %d: ", i + 1); if (fw->afi.slot == i + 1) status = " Active"; From owner-svn-src-all@freebsd.org Thu Feb 1 21:23:43 2018 Return-Path: Delivered-To: svn-src-all@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 A1C6FECAE7D; Thu, 1 Feb 2018 21:23:43 +0000 (UTC) (envelope-from mav@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 56DB56802F; Thu, 1 Feb 2018 21:23:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 519221284B; Thu, 1 Feb 2018 21:23:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LNhsb084340; Thu, 1 Feb 2018 21:23:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LNgmp084337; Thu, 1 Feb 2018 21:23:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012123.w11LNgmp084337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:23:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328749 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:23:43 -0000 Author: mav Date: Thu Feb 1 21:23:42 2018 New Revision: 328749 URL: https://svnweb.freebsd.org/changeset/base/328749 Log: MFC r326937, r326940 (by imp): When we're disabling the nvme device, some drives have a controller bug that requires 'hands off' for a period of time (2.3s) before we check the RDY bit. Sicne this is a very odd quirk for a very limited selection of drives, do this as a quirk. This prevented a successful reset of the card when the card wedged. Also, make sure that we comply with the advice from section 3.1.5 of the 1.3 spec says that transitioning CC.EN from 0 to 1 when CSTS.RDY is 1 or transitioning CC.EN from 1 to 0 when CSTS.RDY is 0 "has undefined results". Short circuit when EN == RDY == desired state. Finally, fail the reset if the disable fails. This will lead to a failed device, which is what we want. (note: nda device needs work for coping with a failed device). Modified: stable/11/sys/dev/nvme/nvme.c stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.c ============================================================================== --- stable/11/sys/dev/nvme/nvme.c Thu Feb 1 21:14:54 2018 (r328748) +++ stable/11/sys/dev/nvme/nvme.c Thu Feb 1 21:23:42 2018 (r328749) @@ -88,6 +88,7 @@ static struct _pcsid int match_subdevice; uint16_t subdevice; const char *desc; + uint32_t quirks; } pci_ids[] = { { 0x01118086, 0, 0, "NVMe Controller" }, { IDT32_PCI_ID, 0, 0, "IDT NVMe Controller (32 channel)" }, @@ -98,6 +99,11 @@ static struct _pcsid { 0x09538086, 1, 0x3705, "DC P3500 SSD [2.5\" SFF]" }, { 0x09538086, 1, 0x3709, "DC P3600 SSD [Add-in Card]" }, { 0x09538086, 1, 0x370a, "DC P3600 SSD [2.5\" SFF]" }, + { 0x00031c58, 0, 0, "HGST SN100", QUIRK_DELAY_B4_CHK_RDY }, + { 0x00231c58, 0, 0, "WDC SN200", QUIRK_DELAY_B4_CHK_RDY }, + { 0x05401c5f, 0, 0, "Memblaze Pblaze4", QUIRK_DELAY_B4_CHK_RDY }, + { 0xa821144d, 0, 0, "Samsung PM1725", QUIRK_DELAY_B4_CHK_RDY }, + { 0xa822144d, 0, 0, "Samsung PM1725a", QUIRK_DELAY_B4_CHK_RDY }, { 0x00000000, 0, 0, NULL } }; @@ -238,6 +244,19 @@ nvme_attach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); int status; + struct _pcsid *ep; + uint32_t devid; + uint16_t subdevice; + + devid = pci_get_devid(dev); + subdevice = pci_get_subdevice(dev); + ep = pci_ids; + while (ep->devid) { + if (nvme_match(devid, subdevice, ep)) + break; + ++ep; + } + ctrlr->quirks = ep->quirks; status = nvme_ctrlr_construct(ctrlr, dev); Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 21:14:54 2018 (r328748) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 21:23:42 2018 (r328749) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); #include "nvme_private.h" +#define B4_CHK_RDY_DELAY_MS 2300 /* work arond controller bug */ + static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); @@ -239,49 +241,65 @@ static int nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { int ms_waited; - union cc_register cc; union csts_register csts; - cc.raw = nvme_mmio_read_4(ctrlr, cc); csts.raw = nvme_mmio_read_4(ctrlr, csts); - if (cc.bits.en != desired_val) { - nvme_printf(ctrlr, "%s called with desired_val = %d " - "but cc.en = %d\n", __func__, desired_val, cc.bits.en); - return (ENXIO); - } - ms_waited = 0; - while (csts.bits.rdy != desired_val) { - DELAY(1000); if (ms_waited++ > ctrlr->ready_timeout_in_ms) { nvme_printf(ctrlr, "controller ready did not become %d " "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } + DELAY(1000); csts.raw = nvme_mmio_read_4(ctrlr, csts); } return (0); } -static void +static int nvme_ctrlr_disable(struct nvme_controller *ctrlr) { union cc_register cc; union csts_register csts; + int err; cc.raw = nvme_mmio_read_4(ctrlr, cc); csts.raw = nvme_mmio_read_4(ctrlr, csts); - if (cc.bits.en == 1 && csts.bits.rdy == 0) - nvme_ctrlr_wait_for_ready(ctrlr, 1); + /* + * Per 3.1.5 in NVME 1.3 spec, transitioning CC.EN from 0 to 1 + * when CSTS.RDY is 1 or transitioning CC.EN from 1 to 0 when + * CSTS.RDY is 0 "has undefined results" So make sure that CSTS.RDY + * isn't the desired value. Short circuit if we're already disabled. + */ + if (cc.bits.en == 1) { + if (csts.bits.rdy == 0) { + /* EN == 1, wait for RDY == 1 or fail */ + err = nvme_ctrlr_wait_for_ready(ctrlr, 1); + if (err != 0) + return (err); + } + } else { + /* EN == 0 already wait for RDY == 0 */ + if (csts.bits.rdy == 0) + return (0); + else + return (nvme_ctrlr_wait_for_ready(ctrlr, 0)); + } cc.bits.en = 0; nvme_mmio_write_4(ctrlr, cc, cc.raw); - DELAY(5000); - nvme_ctrlr_wait_for_ready(ctrlr, 0); + /* + * Some drives have issues with accessing the mmio after we + * disable, so delay for a bit after we write the bit to + * cope with these issues. + */ + if (ctrlr->quirks & QUIRK_DELAY_B4_CHK_RDY) + pause("nvmeR", B4_CHK_RDY_DELAY_MS * hz / 1000); + return (nvme_ctrlr_wait_for_ready(ctrlr, 0)); } static int @@ -290,15 +308,24 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) union cc_register cc; union csts_register csts; union aqa_register aqa; + int err; cc.raw = nvme_mmio_read_4(ctrlr, cc); csts.raw = nvme_mmio_read_4(ctrlr, csts); + /* + * See note in nvme_ctrlr_disable. Short circuit if we're already enabled. + */ if (cc.bits.en == 1) { if (csts.bits.rdy == 1) return (0); else return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); + } else { + /* EN == 0 already wait for RDY == 0 or fail */ + err = nvme_ctrlr_wait_for_ready(ctrlr, 0); + if (err != 0) + return (err); } nvme_mmio_write_8(ctrlr, asq, ctrlr->adminq.cmd_bus_addr); @@ -324,7 +351,6 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) cc.bits.mps = (PAGE_SIZE >> 13); nvme_mmio_write_4(ctrlr, cc, cc.raw); - DELAY(5000); return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } @@ -332,7 +358,7 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) int nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) { - int i; + int i, err; nvme_admin_qpair_disable(&ctrlr->adminq); /* @@ -347,7 +373,9 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) DELAY(100*1000); - nvme_ctrlr_disable(ctrlr); + err = nvme_ctrlr_disable(ctrlr); + if (err != 0) + return err; return (nvme_ctrlr_enable(ctrlr)); } Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 21:14:54 2018 (r328748) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 21:23:42 2018 (r328749) @@ -244,6 +244,8 @@ struct nvme_controller { struct mtx lock; uint32_t ready_timeout_in_ms; + uint32_t quirks; +#define QUIRK_DELAY_B4_CHK_RDY 1 /* Can't touch MMIO on disable */ bus_space_tag_t bus_tag; bus_space_handle_t bus_handle; From owner-svn-src-all@freebsd.org Thu Feb 1 21:25:57 2018 Return-Path: Delivered-To: svn-src-all@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 696D7ECB0B8; Thu, 1 Feb 2018 21:25:57 +0000 (UTC) (envelope-from mav@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 0A05F681EC; Thu, 1 Feb 2018 21:25:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2B3F12850; Thu, 1 Feb 2018 21:25:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LPuO4084516; Thu, 1 Feb 2018 21:25:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LPuQ1084514; Thu, 1 Feb 2018 21:25:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012125.w11LPuQ1084514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:25:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328750 - in stable/11/sys: cam dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: cam dev/nvme X-SVN-Commit-Revision: 328750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:25:57 -0000 Author: mav Date: Thu Feb 1 21:25:56 2018 New Revision: 328750 URL: https://svnweb.freebsd.org/changeset/base/328750 Log: MFC r327034 (by imp): Return domain, bus, slot, and function for the transport settings in PATH_INQ requests for nvme. Modified: stable/11/sys/cam/cam_ccb.h stable/11/sys/dev/nvme/nvme_sim.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_ccb.h ============================================================================== --- stable/11/sys/cam/cam_ccb.h Thu Feb 1 21:23:42 2018 (r328749) +++ stable/11/sys/cam/cam_ccb.h Thu Feb 1 21:25:56 2018 (r328750) @@ -626,6 +626,11 @@ struct ccb_pathinq_settings_sas { struct ccb_pathinq_settings_nvme { uint32_t nsid; /* Namespace ID for this path */ + uint32_t domain; + uint8_t bus; + uint8_t slot; + uint8_t function; + uint8_t extra; }; #define PATHINQ_SETTINGS_SIZE 128 Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 21:23:42 2018 (r328749) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 21:25:56 2018 (r328750) @@ -169,7 +169,8 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) break; case XPT_PATH_INQ: /* Path routing inquiry */ { - struct ccb_pathinq *cpi = &ccb->cpi; + struct ccb_pathinq *cpi = &ccb->cpi; + device_t dev = ctrlr->dev; /* * NVMe may have multiple LUNs on the same path. Current generation @@ -197,6 +198,11 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->protocol = PROTO_NVME; cpi->protocol_version = NVME_REV_1; /* Groks all 1.x NVMe cards */ cpi->xport_specific.nvme.nsid = ns->id; + cpi->xport_specific.nvme.domain = pci_get_domain(dev); + cpi->xport_specific.nvme.bus = pci_get_bus(dev); + cpi->xport_specific.nvme.slot = pci_get_slot(dev); + cpi->xport_specific.nvme.function = pci_get_function(dev); + cpi->xport_specific.nvme.extra = 0; cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-all@freebsd.org Thu Feb 1 21:34:51 2018 Return-Path: Delivered-To: svn-src-all@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 2D373ECBB23; Thu, 1 Feb 2018 21:34:51 +0000 (UTC) (envelope-from mav@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 D0BDC68849; Thu, 1 Feb 2018 21:34:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB476129F6; Thu, 1 Feb 2018 21:34:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LYodI089462; Thu, 1 Feb 2018 21:34:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LYoNJ089461; Thu, 1 Feb 2018 21:34:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802012134.w11LYoNJ089461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 21:34:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328751 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:34:51 -0000 Author: mav Date: Thu Feb 1 21:34:50 2018 New Revision: 328751 URL: https://svnweb.freebsd.org/changeset/base/328751 Log: MFC small part of r325794 to fix the build. Modified: stable/11/sys/dev/nvme/nvme_sim.c Modified: stable/11/sys/dev/nvme/nvme_sim.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 21:25:56 2018 (r328750) +++ stable/11/sys/dev/nvme/nvme_sim.c Thu Feb 1 21:34:50 2018 (r328751) @@ -44,6 +44,9 @@ __FBSDID("$FreeBSD$"); #include // Yes, this is wrong. #include +#include +#include + #include "nvme_private.h" #define ccb_accb_ptr spriv_ptr0 From owner-svn-src-all@freebsd.org Thu Feb 1 21:41:19 2018 Return-Path: Delivered-To: svn-src-all@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 ABC67ECC1E4; Thu, 1 Feb 2018 21:41:18 +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 5AF6568E08; Thu, 1 Feb 2018 21:41:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5586F12B2E; Thu, 1 Feb 2018 21:41:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LfIfn090502; Thu, 1 Feb 2018 21:41:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11LfFKk090474; Thu, 1 Feb 2018 21:41:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802012141.w11LfFKk090474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 1 Feb 2018 21:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328753 - in head: contrib/compiler-rt/lib/tsan/rtl contrib/llvm/include/llvm/Analysis contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/GlobalISel contrib/llv... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/compiler-rt/lib/tsan/rtl contrib/llvm/include/llvm/Analysis contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/GlobalISel contrib/llvm/lib/CodeGen/SelectionDA... X-SVN-Commit-Revision: 328753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:41:19 -0000 Author: dim Date: Thu Feb 1 21:41:15 2018 New Revision: 328753 URL: https://svnweb.freebsd.org/changeset/base/328753 Log: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 6.0.0 (branches/release_60 r323948). MFC after: 3 months X-MFC-With: r327952 PR: 224669 Modified: head/contrib/compiler-rt/lib/tsan/rtl/tsan_platform.h head/contrib/llvm/include/llvm/Analysis/ValueTracking.h head/contrib/llvm/lib/Analysis/ValueTracking.cpp head/contrib/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp head/contrib/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp head/contrib/llvm/lib/CodeGen/RegAllocFast.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp head/contrib/llvm/lib/Target/AArch64/AArch64FastISel.cpp head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp head/contrib/llvm/lib/Target/AArch64/AArch64Subtarget.cpp head/contrib/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp head/contrib/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp head/contrib/llvm/lib/Transforms/Utils/ValueMapper.cpp head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Hexagon.cpp head/contrib/llvm/tools/lld/ELF/AArch64ErrataFix.cpp head/contrib/llvm/tools/lld/ELF/Writer.h head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Common/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/compiler-rt/lib/tsan/rtl/tsan_platform.h ============================================================================== --- head/contrib/compiler-rt/lib/tsan/rtl/tsan_platform.h Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/compiler-rt/lib/tsan/rtl/tsan_platform.h Thu Feb 1 21:41:15 2018 (r328753) @@ -79,25 +79,27 @@ struct Mapping { #define TSAN_MID_APP_RANGE 1 #elif defined(__mips64) /* -C/C++ on linux/mips64 -0100 0000 00 - 0200 0000 00: main binary -0200 0000 00 - 1400 0000 00: - -1400 0000 00 - 2400 0000 00: shadow -2400 0000 00 - 3000 0000 00: - -3000 0000 00 - 4000 0000 00: metainfo (memory blocks and sync objects) -4000 0000 00 - 6000 0000 00: - -6000 0000 00 - 6200 0000 00: traces -6200 0000 00 - fe00 0000 00: - -fe00 0000 00 - ff00 0000 00: heap -ff00 0000 00 - ff80 0000 00: - -ff80 0000 00 - ffff ffff ff: modules and main thread stack +C/C++ on linux/mips64 (40-bit VMA) +0000 0000 00 - 0100 0000 00: - (4 GB) +0100 0000 00 - 0200 0000 00: main binary (4 GB) +0200 0000 00 - 2000 0000 00: - (120 GB) +2000 0000 00 - 4000 0000 00: shadow (128 GB) +4000 0000 00 - 5000 0000 00: metainfo (memory blocks and sync objects) (64 GB) +5000 0000 00 - aa00 0000 00: - (360 GB) +aa00 0000 00 - ab00 0000 00: main binary (PIE) (4 GB) +ab00 0000 00 - b000 0000 00: - (20 GB) +b000 0000 00 - b200 0000 00: traces (8 GB) +b200 0000 00 - fe00 0000 00: - (304 GB) +fe00 0000 00 - ff00 0000 00: heap (4 GB) +ff00 0000 00 - ff80 0000 00: - (2 GB) +ff80 0000 00 - ffff ffff ff: modules and main thread stack (<2 GB) */ struct Mapping { static const uptr kMetaShadowBeg = 0x4000000000ull; static const uptr kMetaShadowEnd = 0x5000000000ull; static const uptr kTraceMemBeg = 0xb000000000ull; static const uptr kTraceMemEnd = 0xb200000000ull; - static const uptr kShadowBeg = 0x2400000000ull; + static const uptr kShadowBeg = 0x2000000000ull; static const uptr kShadowEnd = 0x4000000000ull; static const uptr kHeapMemBeg = 0xfe00000000ull; static const uptr kHeapMemEnd = 0xff00000000ull; Modified: head/contrib/llvm/include/llvm/Analysis/ValueTracking.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ValueTracking.h Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/include/llvm/Analysis/ValueTracking.h Thu Feb 1 21:41:15 2018 (r328753) @@ -508,7 +508,8 @@ class Value; /// -> LHS = %a, RHS = i32 4, *CastOp = Instruction::SExt /// SelectPatternResult matchSelectPattern(Value *V, Value *&LHS, Value *&RHS, - Instruction::CastOps *CastOp = nullptr); + Instruction::CastOps *CastOp = nullptr, + unsigned Depth = 0); inline SelectPatternResult matchSelectPattern(const Value *V, const Value *&LHS, const Value *&RHS, Instruction::CastOps *CastOp = nullptr) { Modified: head/contrib/llvm/lib/Analysis/ValueTracking.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ValueTracking.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Analysis/ValueTracking.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -4165,17 +4165,18 @@ static SelectPatternResult matchClamp(CmpInst::Predica /// a < c ? min(a,b) : min(b,c) ==> min(min(a,b),min(b,c)) static SelectPatternResult matchMinMaxOfMinMax(CmpInst::Predicate Pred, Value *CmpLHS, Value *CmpRHS, - Value *TrueVal, Value *FalseVal) { + Value *TVal, Value *FVal, + unsigned Depth) { // TODO: Allow FP min/max with nnan/nsz. assert(CmpInst::isIntPredicate(Pred) && "Expected integer comparison"); Value *A, *B; - SelectPatternResult L = matchSelectPattern(TrueVal, A, B); + SelectPatternResult L = matchSelectPattern(TVal, A, B, nullptr, Depth + 1); if (!SelectPatternResult::isMinOrMax(L.Flavor)) return {SPF_UNKNOWN, SPNB_NA, false}; Value *C, *D; - SelectPatternResult R = matchSelectPattern(FalseVal, C, D); + SelectPatternResult R = matchSelectPattern(FVal, C, D, nullptr, Depth + 1); if (L.Flavor != R.Flavor) return {SPF_UNKNOWN, SPNB_NA, false}; @@ -4240,7 +4241,8 @@ static SelectPatternResult matchMinMaxOfMinMax(CmpInst static SelectPatternResult matchMinMax(CmpInst::Predicate Pred, Value *CmpLHS, Value *CmpRHS, Value *TrueVal, Value *FalseVal, - Value *&LHS, Value *&RHS) { + Value *&LHS, Value *&RHS, + unsigned Depth) { // Assume success. If there's no match, callers should not use these anyway. LHS = TrueVal; RHS = FalseVal; @@ -4249,7 +4251,7 @@ static SelectPatternResult matchMinMax(CmpInst::Predic if (SPR.Flavor != SelectPatternFlavor::SPF_UNKNOWN) return SPR; - SPR = matchMinMaxOfMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal); + SPR = matchMinMaxOfMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal, Depth); if (SPR.Flavor != SelectPatternFlavor::SPF_UNKNOWN) return SPR; @@ -4313,7 +4315,8 @@ static SelectPatternResult matchSelectPattern(CmpInst: FastMathFlags FMF, Value *CmpLHS, Value *CmpRHS, Value *TrueVal, Value *FalseVal, - Value *&LHS, Value *&RHS) { + Value *&LHS, Value *&RHS, + unsigned Depth) { LHS = CmpLHS; RHS = CmpRHS; @@ -4429,7 +4432,7 @@ static SelectPatternResult matchSelectPattern(CmpInst: } if (CmpInst::isIntPredicate(Pred)) - return matchMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal, LHS, RHS); + return matchMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal, LHS, RHS, Depth); // According to (IEEE 754-2008 5.3.1), minNum(0.0, -0.0) and similar // may return either -0.0 or 0.0, so fcmp/select pair has stricter @@ -4550,7 +4553,11 @@ static Value *lookThroughCast(CmpInst *CmpI, Value *V1 } SelectPatternResult llvm::matchSelectPattern(Value *V, Value *&LHS, Value *&RHS, - Instruction::CastOps *CastOp) { + Instruction::CastOps *CastOp, + unsigned Depth) { + if (Depth >= MaxDepth) + return {SPF_UNKNOWN, SPNB_NA, false}; + SelectInst *SI = dyn_cast(V); if (!SI) return {SPF_UNKNOWN, SPNB_NA, false}; @@ -4579,7 +4586,7 @@ SelectPatternResult llvm::matchSelectPattern(Value *V, FMF.setNoSignedZeros(); return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS, cast(TrueVal)->getOperand(0), C, - LHS, RHS); + LHS, RHS, Depth); } if (Value *C = lookThroughCast(CmpI, FalseVal, TrueVal, CastOp)) { // If this is a potential fmin/fmax with a cast to integer, then ignore @@ -4588,11 +4595,11 @@ SelectPatternResult llvm::matchSelectPattern(Value *V, FMF.setNoSignedZeros(); return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS, C, cast(FalseVal)->getOperand(0), - LHS, RHS); + LHS, RHS, Depth); } } return ::matchSelectPattern(Pred, FMF, CmpLHS, CmpRHS, TrueVal, FalseVal, - LHS, RHS); + LHS, RHS, Depth); } /// Return true if "icmp Pred LHS RHS" is always true. Modified: head/contrib/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -812,6 +812,10 @@ bool IRTranslator::translateCall(const User &U, Machin auto TII = MF->getTarget().getIntrinsicInfo(); const Function *F = CI.getCalledFunction(); + // FIXME: support Windows dllimport function calls. + if (F && F->hasDLLImportStorageClass()) + return false; + if (CI.isInlineAsm()) return translateInlineAsm(CI, MIRBuilder); Modified: head/contrib/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -661,7 +661,24 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigne } case TargetOpcode::G_FCONSTANT: { unsigned DstExt = MRI.createGenericVirtualRegister(WideTy); - MIRBuilder.buildFConstant(DstExt, *MI.getOperand(1).getFPImm()); + const ConstantFP *CFP = MI.getOperand(1).getFPImm(); + APFloat Val = CFP->getValueAPF(); + LLVMContext &Ctx = MIRBuilder.getMF().getFunction().getContext(); + auto LLT2Sem = [](LLT Ty) { + switch (Ty.getSizeInBits()) { + case 32: + return &APFloat::IEEEsingle(); + break; + case 64: + return &APFloat::IEEEdouble(); + break; + default: + llvm_unreachable("Unhandled fp widen type"); + } + }; + bool LosesInfo; + Val.convert(*LLT2Sem(WideTy), APFloat::rmTowardZero, &LosesInfo); + MIRBuilder.buildFConstant(DstExt, *ConstantFP::get(Ctx, Val)); MIRBuilder.buildFPTrunc(MI.getOperand(0).getReg(), DstExt); MI.eraseFromParent(); return Legalized; Modified: head/contrib/llvm/lib/CodeGen/RegAllocFast.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/RegAllocFast.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/CodeGen/RegAllocFast.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -193,9 +193,10 @@ namespace { void spillVirtReg(MachineBasicBlock::iterator MI, unsigned VirtReg); void usePhysReg(MachineOperand &MO); - void definePhysReg(MachineInstr &MI, MCPhysReg PhysReg, RegState NewState); + void definePhysReg(MachineBasicBlock::iterator MI, MCPhysReg PhysReg, + RegState NewState); unsigned calcSpillCost(MCPhysReg PhysReg) const; - void assignVirtToPhysReg(LiveReg&, MCPhysReg PhysReg); + void assignVirtToPhysReg(LiveReg &, MCPhysReg PhysReg); LiveRegMap::iterator findLiveVirtReg(unsigned VirtReg) { return LiveVirtRegs.find(TargetRegisterInfo::virtReg2Index(VirtReg)); @@ -434,8 +435,8 @@ void RegAllocFast::usePhysReg(MachineOperand &MO) { /// Mark PhysReg as reserved or free after spilling any virtregs. This is very /// similar to defineVirtReg except the physreg is reserved instead of /// allocated. -void RegAllocFast::definePhysReg(MachineInstr &MI, MCPhysReg PhysReg, - RegState NewState) { +void RegAllocFast::definePhysReg(MachineBasicBlock::iterator MI, + MCPhysReg PhysReg, RegState NewState) { markRegUsedInInstr(PhysReg); switch (unsigned VirtReg = PhysRegState[PhysReg]) { case regDisabled: @@ -857,7 +858,7 @@ void RegAllocFast::allocateBasicBlock(MachineBasicBloc // Add live-in registers as live. for (const MachineBasicBlock::RegisterMaskPair LI : MBB.liveins()) if (MRI->isAllocatable(LI.PhysReg)) - definePhysReg(*MII, LI.PhysReg, regReserved); + definePhysReg(MII, LI.PhysReg, regReserved); VirtDead.clear(); Coalesced.clear(); Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -1380,8 +1380,10 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Func FastISelFailed = false; // Initialize the Fast-ISel state, if needed. FastISel *FastIS = nullptr; - if (TM.Options.EnableFastISel) + if (TM.Options.EnableFastISel) { + DEBUG(dbgs() << "Enabling fast-isel\n"); FastIS = TLI->createFastISel(*FuncInfo, LibInfo); + } setupSwiftErrorVals(Fn, TLI, FuncInfo); Modified: head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -717,6 +717,8 @@ bool TargetPassConfig::addCoreISelPasses() { if (EnableGlobalISel == cl::BOU_TRUE || (EnableGlobalISel == cl::BOU_UNSET && isGlobalISelEnabled() && EnableFastISelOption != cl::BOU_TRUE)) { + TM->setFastISel(false); + if (addIRTranslator()) return true; Modified: head/contrib/llvm/lib/Target/AArch64/AArch64FastISel.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64FastISel.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Target/AArch64/AArch64FastISel.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -476,26 +476,27 @@ unsigned AArch64FastISel::materializeGV(const GlobalVa // ADRP + LDRX BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::ADRP), ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_GOT | AArch64II::MO_PAGE); + .addGlobalAddress(GV, 0, AArch64II::MO_PAGE | OpFlags); ResultReg = createResultReg(&AArch64::GPR64RegClass); BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::LDRXui), ResultReg) - .addReg(ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_GOT | AArch64II::MO_PAGEOFF | - AArch64II::MO_NC); + .addReg(ADRPReg) + .addGlobalAddress(GV, 0, + AArch64II::MO_PAGEOFF | AArch64II::MO_NC | OpFlags); } else { // ADRP + ADDX BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::ADRP), ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_PAGE); + .addGlobalAddress(GV, 0, AArch64II::MO_PAGE | OpFlags); ResultReg = createResultReg(&AArch64::GPR64spRegClass); BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(AArch64::ADDXri), ResultReg) - .addReg(ADRPReg) - .addGlobalAddress(GV, 0, AArch64II::MO_PAGEOFF | AArch64II::MO_NC) - .addImm(0); + .addReg(ADRPReg) + .addGlobalAddress(GV, 0, + AArch64II::MO_PAGEOFF | AArch64II::MO_NC | OpFlags) + .addImm(0); } return ResultReg; } Modified: head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -929,6 +929,12 @@ bool AArch64InstructionSelector::select(MachineInstr & return false; } + // FIXME: PR36018: Volatile loads in some cases are incorrectly selected by + // folding with an extend. Until we have a G_SEXTLOAD solution bail out if + // we hit one. + if (Opcode == TargetOpcode::G_LOAD && MemOp.isVolatile()) + return false; + const unsigned PtrReg = I.getOperand(1).getReg(); #ifndef NDEBUG const RegisterBank &PtrRB = *RBI.getRegBank(PtrReg, MRI, TRI); Modified: head/contrib/llvm/lib/Target/AArch64/AArch64Subtarget.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64Subtarget.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Target/AArch64/AArch64Subtarget.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -189,15 +189,18 @@ AArch64Subtarget::ClassifyGlobalReference(const Global if (TM.getCodeModel() == CodeModel::Large && isTargetMachO()) return AArch64II::MO_GOT; + unsigned Flags = GV->hasDLLImportStorageClass() ? AArch64II::MO_DLLIMPORT + : AArch64II::MO_NO_FLAG; + if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV)) - return AArch64II::MO_GOT; + return AArch64II::MO_GOT | Flags; // The small code model's direct accesses use ADRP, which cannot // necessarily produce the value 0 (if the code is above 4GB). if (useSmallAddressing() && GV->hasExternalWeakLinkage()) - return AArch64II::MO_GOT; + return AArch64II::MO_GOT | Flags; - return AArch64II::MO_NO_FLAG; + return Flags; } unsigned char AArch64Subtarget::classifyGlobalFunctionReference( Modified: head/contrib/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -210,65 +210,73 @@ void SIInsertSkips::kill(MachineInstr &MI) { switch (MI.getOperand(2).getImm()) { case ISD::SETOEQ: case ISD::SETEQ: - Opcode = AMDGPU::V_CMPX_EQ_F32_e32; + Opcode = AMDGPU::V_CMPX_EQ_F32_e64; break; case ISD::SETOGT: case ISD::SETGT: - Opcode = AMDGPU::V_CMPX_LT_F32_e32; + Opcode = AMDGPU::V_CMPX_LT_F32_e64; break; case ISD::SETOGE: case ISD::SETGE: - Opcode = AMDGPU::V_CMPX_LE_F32_e32; + Opcode = AMDGPU::V_CMPX_LE_F32_e64; break; case ISD::SETOLT: case ISD::SETLT: - Opcode = AMDGPU::V_CMPX_GT_F32_e32; + Opcode = AMDGPU::V_CMPX_GT_F32_e64; break; case ISD::SETOLE: case ISD::SETLE: - Opcode = AMDGPU::V_CMPX_GE_F32_e32; + Opcode = AMDGPU::V_CMPX_GE_F32_e64; break; case ISD::SETONE: case ISD::SETNE: - Opcode = AMDGPU::V_CMPX_LG_F32_e32; + Opcode = AMDGPU::V_CMPX_LG_F32_e64; break; case ISD::SETO: - Opcode = AMDGPU::V_CMPX_O_F32_e32; + Opcode = AMDGPU::V_CMPX_O_F32_e64; break; case ISD::SETUO: - Opcode = AMDGPU::V_CMPX_U_F32_e32; + Opcode = AMDGPU::V_CMPX_U_F32_e64; break; case ISD::SETUEQ: - Opcode = AMDGPU::V_CMPX_NLG_F32_e32; + Opcode = AMDGPU::V_CMPX_NLG_F32_e64; break; case ISD::SETUGT: - Opcode = AMDGPU::V_CMPX_NGE_F32_e32; + Opcode = AMDGPU::V_CMPX_NGE_F32_e64; break; case ISD::SETUGE: - Opcode = AMDGPU::V_CMPX_NGT_F32_e32; + Opcode = AMDGPU::V_CMPX_NGT_F32_e64; break; case ISD::SETULT: - Opcode = AMDGPU::V_CMPX_NLE_F32_e32; + Opcode = AMDGPU::V_CMPX_NLE_F32_e64; break; case ISD::SETULE: - Opcode = AMDGPU::V_CMPX_NLT_F32_e32; + Opcode = AMDGPU::V_CMPX_NLT_F32_e64; break; case ISD::SETUNE: - Opcode = AMDGPU::V_CMPX_NEQ_F32_e32; + Opcode = AMDGPU::V_CMPX_NEQ_F32_e64; break; default: llvm_unreachable("invalid ISD:SET cond code"); } - // TODO: Allow this: - if (!MI.getOperand(0).isReg() || - !TRI->isVGPR(MBB.getParent()->getRegInfo(), - MI.getOperand(0).getReg())) - llvm_unreachable("SI_KILL operand should be a VGPR"); + assert(MI.getOperand(0).isReg()); - BuildMI(MBB, &MI, DL, TII->get(Opcode)) - .add(MI.getOperand(1)) - .add(MI.getOperand(0)); + if (TRI->isVGPR(MBB.getParent()->getRegInfo(), + MI.getOperand(0).getReg())) { + Opcode = AMDGPU::getVOPe32(Opcode); + BuildMI(MBB, &MI, DL, TII->get(Opcode)) + .add(MI.getOperand(1)) + .add(MI.getOperand(0)); + } else { + BuildMI(MBB, &MI, DL, TII->get(Opcode)) + .addReg(AMDGPU::VCC, RegState::Define) + .addImm(0) // src0 modifiers + .add(MI.getOperand(1)) + .addImm(0) // src1 modifiers + .add(MI.getOperand(0)) + .addImm(0); // omod + } break; } case AMDGPU::SI_KILL_I1_TERMINATOR: { Modified: head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -39,11 +39,11 @@ void X86IntelInstPrinter::printInst(const MCInst *MI, const MCSubtargetInfo &STI) { const MCInstrDesc &Desc = MII.get(MI->getOpcode()); uint64_t TSFlags = Desc.TSFlags; + unsigned Flags = MI->getFlags(); - if (TSFlags & X86II::LOCK) + if ((TSFlags & X86II::LOCK) || (Flags & X86::IP_HAS_LOCK)) OS << "\tlock\t"; - unsigned Flags = MI->getFlags(); if (Flags & X86::IP_HAS_REPEAT_NE) OS << "\trepne\t"; else if (Flags & X86::IP_HAS_REPEAT) Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -31776,9 +31776,10 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & // Check all uses of the condition operand to check whether it will be // consumed by non-BLEND instructions. Those may require that all bits // are set properly. - for (SDNode *U : Cond->uses()) { + for (SDNode::use_iterator UI = Cond->use_begin(), UE = Cond->use_end(); + UI != UE; ++UI) { // TODO: Add other opcodes eventually lowered into BLEND. - if (U->getOpcode() != ISD::VSELECT) + if (UI->getOpcode() != ISD::VSELECT || UI.getOperandNo() != 0) return SDValue(); } Modified: head/contrib/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -142,10 +142,11 @@ recordConditions(const CallSite &CS, BasicBlock *Pred, recordCondition(CS, Pred, CS.getInstruction()->getParent(), Conditions); BasicBlock *From = Pred; BasicBlock *To = Pred; - SmallPtrSet Visited = {From}; + SmallPtrSet Visited; while (!Visited.count(From->getSinglePredecessor()) && (From = From->getSinglePredecessor())) { recordCondition(CS, From, To, Conditions); + Visited.insert(From); To = From; } } Modified: head/contrib/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -14,6 +14,7 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/DivergenceAnalysis.h" +#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/RegionInfo.h" #include "llvm/Analysis/RegionIterator.h" #include "llvm/Analysis/RegionPass.h" @@ -176,8 +177,9 @@ class StructurizeCFG : public RegionPass { Region *ParentRegion; DominatorTree *DT; + LoopInfo *LI; - std::deque Order; + SmallVector Order; BBSet Visited; BBPhiMap DeletedPhis; @@ -202,7 +204,7 @@ class StructurizeCFG : public RegionPass { void gatherPredicates(RegionNode *N); - void analyzeNode(RegionNode *N); + void collectInfos(); void insertConditions(bool Loops); @@ -256,6 +258,7 @@ class StructurizeCFG : public RegionPass { AU.addRequired(); AU.addRequiredID(LowerSwitchID); AU.addRequired(); + AU.addRequired(); AU.addPreserved(); RegionPass::getAnalysisUsage(AU); @@ -289,17 +292,55 @@ bool StructurizeCFG::doInitialization(Region *R, RGPas /// \brief Build up the general order of nodes void StructurizeCFG::orderNodes() { - assert(Visited.empty()); - assert(Predicates.empty()); - assert(Loops.empty()); - assert(LoopPreds.empty()); + ReversePostOrderTraversal RPOT(ParentRegion); + SmallDenseMap LoopBlocks; - // This must be RPO order for the back edge detection to work - for (RegionNode *RN : ReversePostOrderTraversal(ParentRegion)) { - // FIXME: Is there a better order to use for structurization? - Order.push_back(RN); - analyzeNode(RN); + // The reverse post-order traversal of the list gives us an ordering close + // to what we want. The only problem with it is that sometimes backedges + // for outer loops will be visited before backedges for inner loops. + for (RegionNode *RN : RPOT) { + BasicBlock *BB = RN->getEntry(); + Loop *Loop = LI->getLoopFor(BB); + ++LoopBlocks[Loop]; } + + unsigned CurrentLoopDepth = 0; + Loop *CurrentLoop = nullptr; + for (auto I = RPOT.begin(), E = RPOT.end(); I != E; ++I) { + BasicBlock *BB = (*I)->getEntry(); + unsigned LoopDepth = LI->getLoopDepth(BB); + + if (is_contained(Order, *I)) + continue; + + if (LoopDepth < CurrentLoopDepth) { + // Make sure we have visited all blocks in this loop before moving back to + // the outer loop. + + auto LoopI = I; + while (unsigned &BlockCount = LoopBlocks[CurrentLoop]) { + LoopI++; + BasicBlock *LoopBB = (*LoopI)->getEntry(); + if (LI->getLoopFor(LoopBB) == CurrentLoop) { + --BlockCount; + Order.push_back(*LoopI); + } + } + } + + CurrentLoop = LI->getLoopFor(BB); + if (CurrentLoop) + LoopBlocks[CurrentLoop]--; + + CurrentLoopDepth = LoopDepth; + Order.push_back(*I); + } + + // This pass originally used a post-order traversal and then operated on + // the list in reverse. Now that we are using a reverse post-order traversal + // rather than re-working the whole pass to operate on the list in order, + // we just reverse the list and continue to operate on it in reverse. + std::reverse(Order.begin(), Order.end()); } /// \brief Determine the end of the loops @@ -425,19 +466,32 @@ void StructurizeCFG::gatherPredicates(RegionNode *N) { } /// \brief Collect various loop and predicate infos -void StructurizeCFG::analyzeNode(RegionNode *RN) { - DEBUG(dbgs() << "Visiting: " - << (RN->isSubRegion() ? "SubRegion with entry: " : "") - << RN->getEntry()->getName() << '\n'); +void StructurizeCFG::collectInfos() { + // Reset predicate + Predicates.clear(); - // Analyze all the conditions leading to a node - gatherPredicates(RN); + // and loop infos + Loops.clear(); + LoopPreds.clear(); - // Remember that we've seen this node - Visited.insert(RN->getEntry()); + // Reset the visited nodes + Visited.clear(); - // Find the last back edges - analyzeLoops(RN); + for (RegionNode *RN : reverse(Order)) { + DEBUG(dbgs() << "Visiting: " + << (RN->isSubRegion() ? "SubRegion with entry: " : "") + << RN->getEntry()->getName() << " Loop Depth: " + << LI->getLoopDepth(RN->getEntry()) << "\n"); + + // Analyze all the conditions leading to a node + gatherPredicates(RN); + + // Remember that we've seen this node + Visited.insert(RN->getEntry()); + + // Find the last back edges + analyzeLoops(RN); + } } /// \brief Insert the missing branch conditions @@ -610,7 +664,7 @@ void StructurizeCFG::changeExit(RegionNode *Node, Basi BasicBlock *StructurizeCFG::getNextFlow(BasicBlock *Dominator) { LLVMContext &Context = Func->getContext(); BasicBlock *Insert = Order.empty() ? ParentRegion->getExit() : - Order.front()->getEntry(); + Order.back()->getEntry(); BasicBlock *Flow = BasicBlock::Create(Context, FlowBlockName, Func, Insert); DT->addNewBlock(Flow, Dominator); @@ -690,8 +744,7 @@ bool StructurizeCFG::isPredictableTrue(RegionNode *Nod /// Take one node from the order vector and wire it up void StructurizeCFG::wireFlow(bool ExitUseAllowed, BasicBlock *LoopEnd) { - RegionNode *Node = Order.front(); - Order.pop_front(); + RegionNode *Node = Order.pop_back_val(); Visited.insert(Node->getEntry()); if (isPredictableTrue(Node)) { @@ -715,7 +768,7 @@ void StructurizeCFG::wireFlow(bool ExitUseAllowed, PrevNode = Node; while (!Order.empty() && !Visited.count(LoopEnd) && - dominatesPredicates(Entry, Order.front())) { + dominatesPredicates(Entry, Order.back())) { handleLoops(false, LoopEnd); } @@ -726,7 +779,7 @@ void StructurizeCFG::wireFlow(bool ExitUseAllowed, void StructurizeCFG::handleLoops(bool ExitUseAllowed, BasicBlock *LoopEnd) { - RegionNode *Node = Order.front(); + RegionNode *Node = Order.back(); BasicBlock *LoopStart = Node->getEntry(); if (!Loops.count(LoopStart)) { @@ -871,9 +924,10 @@ bool StructurizeCFG::runOnRegion(Region *R, RGPassMana ParentRegion = R; DT = &getAnalysis().getDomTree(); + LI = &getAnalysis().getLoopInfo(); orderNodes(); - + collectInfos(); createFlow(); insertConditions(false); insertConditions(true); Modified: head/contrib/llvm/lib/Transforms/Utils/ValueMapper.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Utils/ValueMapper.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/lib/Transforms/Utils/ValueMapper.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -25,6 +25,7 @@ #include "llvm/IR/CallSite.h" #include "llvm/IR/Constant.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalAlias.h" @@ -536,13 +537,23 @@ Optional MDNodeMapper::tryToMapOperand(con return None; } +static Metadata *cloneOrBuildODR(const MDNode &N) { + auto *CT = dyn_cast(&N); + // If ODR type uniquing is enabled, we would have uniqued composite types + // with identifiers during bitcode reading, so we can just use CT. + if (CT && CT->getContext().isODRUniquingDebugTypes() && + CT->getIdentifier() != "") + return const_cast(CT); + return MDNode::replaceWithDistinct(N.clone()); +} + MDNode *MDNodeMapper::mapDistinctNode(const MDNode &N) { assert(N.isDistinct() && "Expected a distinct node"); assert(!M.getVM().getMappedMD(&N) && "Expected an unmapped node"); - DistinctWorklist.push_back(cast( - (M.Flags & RF_MoveDistinctMDs) - ? M.mapToSelf(&N) - : M.mapToMetadata(&N, MDNode::replaceWithDistinct(N.clone())))); + DistinctWorklist.push_back( + cast((M.Flags & RF_MoveDistinctMDs) + ? M.mapToSelf(&N) + : M.mapToMetadata(&N, cloneOrBuildODR(N)))); return DistinctWorklist.back(); } Modified: head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td Thu Feb 1 21:41:15 2018 (r328753) @@ -354,4 +354,12 @@ def warn_drv_fine_grained_bitfield_accesses_ignored : def note_drv_verify_prefix_spelling : Note< "-verify prefixes must start with a letter and contain only alphanumeric" " characters, hyphens, and underscores">; + +def warn_drv_experimental_isel_incomplete : Warning< + "-fexperimental-isel support for the '%0' architecture is incomplete">, + InGroup; + +def warn_drv_experimental_isel_incomplete_opt : Warning< + "-fexperimental-isel support is incomplete for this architecture at the current optimization level">, + InGroup; } Modified: head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td Thu Feb 1 21:41:15 2018 (r328753) @@ -985,3 +985,6 @@ def UnknownArgument : DiagGroup<"unknown-argument">; // A warning group for warnings about code that clang accepts when // compiling OpenCL C/C++ but which is not compatible with the SPIR spec. def SpirCompat : DiagGroup<"spir-compat">; + +// Warning for the experimental-isel options. +def ExperimentalISel : DiagGroup<"experimental-isel">; Modified: head/contrib/llvm/tools/clang/include/clang/Driver/Options.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Thu Feb 1 21:41:15 2018 (r328753) @@ -1031,6 +1031,8 @@ def finline_functions : Flag<["-"], "finline-functions def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>, HelpText<"Inline functions which are (explicitly or implicitly) marked inline">; def finline : Flag<["-"], "finline">, Group; +def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, + HelpText<"Enables the experimental global instruction selector">; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Enables an experimental new pass manager in LLVM.">; @@ -1237,6 +1239,8 @@ def fno_exceptions : Flag<["-"], "fno-exceptions">, Gr def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group, + HelpText<"Disables the experimental global instruction selector">; def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, Group, Flags<[CC1Option]>, HelpText<"Disables an experimental new pass manager in LLVM.">; Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -4639,6 +4639,37 @@ void Clang::ConstructJob(Compilation &C, const JobActi CmdArgs.push_back("-fwhole-program-vtables"); } + if (Arg *A = Args.getLastArg(options::OPT_fexperimental_isel, + options::OPT_fno_experimental_isel)) { + CmdArgs.push_back("-mllvm"); + if (A->getOption().matches(options::OPT_fexperimental_isel)) { + CmdArgs.push_back("-global-isel=1"); + + // GISel is on by default on AArch64 -O0, so don't bother adding + // the fallback remarks for it. Other combinations will add a warning of + // some kind. + bool IsArchSupported = Triple.getArch() == llvm::Triple::aarch64; + bool IsOptLevelSupported = false; + + Arg *A = Args.getLastArg(options::OPT_O_Group); + if (Triple.getArch() == llvm::Triple::aarch64) { + if (!A || A->getOption().matches(options::OPT_O0)) + IsOptLevelSupported = true; + } + if (!IsArchSupported || !IsOptLevelSupported) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-global-isel-abort=2"); + + if (!IsArchSupported) + D.Diag(diag::warn_drv_experimental_isel_incomplete) << Triple.getArchName(); + else + D.Diag(diag::warn_drv_experimental_isel_incomplete_opt); + } + } else { + CmdArgs.push_back("-global-isel=0"); + } + } + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Hexagon.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Hexagon.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Hexagon.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -46,7 +46,7 @@ static void handleHVXWarnings(const Driver &D, const A // Handle the unsupported values passed to mhvx-length. if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_length_EQ)) { StringRef Val = A->getValue(); - if (Val != "64B" && Val != "128B") + if (!Val.equals_lower("64b") && !Val.equals_lower("128b")) D.Diag(diag::err_drv_unsupported_option_argument) << A->getOption().getName() << Val; } Modified: head/contrib/llvm/tools/lld/ELF/AArch64ErrataFix.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/AArch64ErrataFix.cpp Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/tools/lld/ELF/AArch64ErrataFix.cpp Thu Feb 1 21:41:15 2018 (r328753) @@ -47,6 +47,7 @@ using namespace llvm; using namespace llvm::ELF; using namespace llvm::object; +using namespace llvm::support; using namespace llvm::support::endian; using namespace lld; @@ -357,7 +358,7 @@ static uint64_t scanCortexA53Errata843419(InputSection uint64_t PatchOff = 0; const uint8_t *Buf = IS->Data.begin(); - const uint32_t *InstBuf = reinterpret_cast(Buf + Off); + const ulittle32_t *InstBuf = reinterpret_cast(Buf + Off); uint32_t Instr1 = *InstBuf++; uint32_t Instr2 = *InstBuf++; uint32_t Instr3 = *InstBuf++; Modified: head/contrib/llvm/tools/lld/ELF/Writer.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Writer.h Thu Feb 1 21:37:47 2018 (r328752) +++ head/contrib/llvm/tools/lld/ELF/Writer.h Thu Feb 1 21:41:15 2018 (r328753) @@ -45,8 +45,9 @@ struct PhdrEntry { OutputSection *LastSec = nullptr; bool HasLMA = false; - // True if any of the sections in this program header as a LMA specified via - // linker script: AT(addr). + // True if one of the sections in this program header has a LMA specified via + // linker script: AT(addr). We never allow 2 or more sections with LMA in the + // same program header. bool ASectionHasLMA = false; uint64_t LMAOffset = 0; Modified: head/lib/clang/include/clang/Basic/Version.inc ============================================================================== --- head/lib/clang/include/clang/Basic/Version.inc Thu Feb 1 21:37:47 2018 (r328752) +++ head/lib/clang/include/clang/Basic/Version.inc Thu Feb 1 21:41:15 2018 (r328753) @@ -8,4 +8,4 @@ #define CLANG_VENDOR "FreeBSD " -#define SVN_REVISION "323338" +#define SVN_REVISION "323948" Modified: head/lib/clang/include/lld/Common/Version.inc ============================================================================== --- head/lib/clang/include/lld/Common/Version.inc Thu Feb 1 21:37:47 2018 (r328752) +++ head/lib/clang/include/lld/Common/Version.inc Thu Feb 1 21:41:15 2018 (r328753) @@ -4,5 +4,5 @@ #define LLD_VERSION_STRING "6.0.0" #define LLD_VERSION_MAJOR 6 #define LLD_VERSION_MINOR 0 -#define LLD_REVISION_STRING "323338" +#define LLD_REVISION_STRING "323948" #define LLD_REPOSITORY_STRING "FreeBSD" Modified: head/lib/clang/include/llvm/Support/VCSRevision.h ============================================================================== --- head/lib/clang/include/llvm/Support/VCSRevision.h Thu Feb 1 21:37:47 2018 (r328752) +++ head/lib/clang/include/llvm/Support/VCSRevision.h Thu Feb 1 21:41:15 2018 (r328753) @@ -1,2 +1,2 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "svn-r323338" +#define LLVM_REVISION "svn-r323948" From owner-svn-src-all@freebsd.org Thu Feb 1 21:58:53 2018 Return-Path: Delivered-To: svn-src-all@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 5DE9BECD61B; Thu, 1 Feb 2018 21:58:53 +0000 (UTC) (envelope-from adrian@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 1189569C75; Thu, 1 Feb 2018 21:58:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0813212D53; Thu, 1 Feb 2018 21:58:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11LwqHb000543; Thu, 1 Feb 2018 21:58:52 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11Lwqwg000540; Thu, 1 Feb 2018 21:58:52 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802012158.w11Lwqwg000540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 1 Feb 2018 21:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328754 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 328754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 21:58:53 -0000 Author: adrian Date: Thu Feb 1 21:58:52 2018 New Revision: 328754 URL: https://svnweb.freebsd.org/changeset/base/328754 Log: [atheros] Fix-up the base address stuff after I did a drive-by with the calibration data location. The old way required the data to be present really early and copied it from memory mapped NOR flash; this only worked during kernel boot but not for ath/ath_hal modules. Tested: * AR9331, Carambola2, ath/hal modules. Modified: head/sys/mips/conf/AR933X_BASE.hints head/sys/mips/conf/std.AR933X Modified: head/sys/mips/conf/AR933X_BASE.hints ============================================================================== --- head/sys/mips/conf/AR933X_BASE.hints Thu Feb 1 21:41:15 2018 (r328753) +++ head/sys/mips/conf/AR933X_BASE.hints Thu Feb 1 21:58:52 2018 (r328754) @@ -9,6 +9,10 @@ hint.apb.0.at="nexus0" hint.apb.0.irq=4 +# ART calibration data mapping device +hint.ar71xx_caldata.0.at="nexus0" +hint.ar71xx_caldata.0.order=0 + # uart0 hint.uart.0.at="apb0" # NB: This isn't an ns8250 UART @@ -39,9 +43,13 @@ hint.ath.0.msize=0x20000 hint.ath.0.irq=0 hint.ath.0.vendor_id=0x168c hint.ath.0.device_id=0x0035 -# Set this to define where the ath calibration data -# should be fetched from in physical memory. -# hint.ath.0.eepromaddr=0x1fff1000 + +# Where the ART is - last 64k in the first 8MB of flash +#hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000 +#hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384 + +# And now tell the ath(4) driver where to look! +#hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware" # SPI flash hint.spi.0.at="nexus0" Modified: head/sys/mips/conf/std.AR933X ============================================================================== --- head/sys/mips/conf/std.AR933X Thu Feb 1 21:41:15 2018 (r328753) +++ head/sys/mips/conf/std.AR933X Thu Feb 1 21:58:52 2018 (r328754) @@ -62,6 +62,9 @@ makeoptions MODULES_OVERRIDE+="hwpmc_mips24k" option AH_SUPPORT_AR9330 # Chipset support option ATH_EEPROM_FIRMWARE # Use EEPROM from flash +# Support EEPROM caldata in AHB devices +options ATH_EEPROM_FIRMWARE + device usb device ehci From owner-svn-src-all@freebsd.org Thu Feb 1 22:00:05 2018 Return-Path: Delivered-To: svn-src-all@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 D1D97ECD7AF; Thu, 1 Feb 2018 22:00:05 +0000 (UTC) (envelope-from adrian@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 7694569F14; Thu, 1 Feb 2018 22:00:05 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71AD612D5B; Thu, 1 Feb 2018 22:00:05 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11M05ac000886; Thu, 1 Feb 2018 22:00:05 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11M05V9000884; Thu, 1 Feb 2018 22:00:05 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802012200.w11M05V9000884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 1 Feb 2018 22:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328755 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 328755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 22:00:06 -0000 Author: adrian Date: Thu Feb 1 22:00:05 2018 New Revision: 328755 URL: https://svnweb.freebsd.org/changeset/base/328755 Log: [atheros] Teach the QCA955x SoC code about the new hints stuff. Modified: head/sys/mips/conf/QCA955X_BASE.hints head/sys/mips/conf/std.QCA955X Modified: head/sys/mips/conf/QCA955X_BASE.hints ============================================================================== --- head/sys/mips/conf/QCA955X_BASE.hints Thu Feb 1 21:58:52 2018 (r328754) +++ head/sys/mips/conf/QCA955X_BASE.hints Thu Feb 1 22:00:05 2018 (r328755) @@ -12,6 +12,10 @@ hint.apb.0.at="nexus0" # the irq ranges appropriately. hint.apb.0.irq=4 +# ART calibration data mapping device +hint.ar71xx_caldata.0.at="nexus0" +hint.ar71xx_caldata.0.order=0 + # uart0 hint.uart.0.at="apb0" # NB: This isn't an ns8250 UART @@ -59,9 +63,13 @@ hint.ath.0.msize=0x20000 hint.ath.0.irq=0 hint.ath.0.vendor_id=0x168c hint.ath.0.device_id=0x0039 -# Set this to define where the ath calibration data -# should be fetched from in physical memory. -# hint.ath.0.eepromaddr=0x1fff1000 + +# Where the ART is - last 64k in the first 8MB of flash +#hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000 +#hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384 + +# And now tell the ath(4) driver where to look! +#hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware" # SPI flash hint.spi.0.at="nexus0" Modified: head/sys/mips/conf/std.QCA955X ============================================================================== --- head/sys/mips/conf/std.QCA955X Thu Feb 1 21:58:52 2018 (r328754) +++ head/sys/mips/conf/std.QCA955X Thu Feb 1 22:00:05 2018 (r328755) @@ -50,7 +50,17 @@ options NO_FFS_SNAPSHOT # We don't require snapshot include "std.AR_MIPS_BASE" makeoptions MODULES_OVERRIDE+="hwpmc_mips74k" +# EEPROM caldata for AHB connected device +options AR71XX_ATH_EEPROM +device ar71xx_caldata +device firmware + +# Support QCA955x in the HAL option AH_SUPPORT_QCA9550 # Chipset support + +# Support EEPROM caldata in AHB devices +options ATH_EEPROM_FIRMWARE + device uart_ar71xx device ar71xx_apb From owner-svn-src-all@freebsd.org Thu Feb 1 22:00:39 2018 Return-Path: Delivered-To: svn-src-all@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 DE55EECD87F; Thu, 1 Feb 2018 22:00:38 +0000 (UTC) (envelope-from adrian@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 94B396A074; Thu, 1 Feb 2018 22:00:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FCBE12D60; Thu, 1 Feb 2018 22:00:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11M0chS000946; Thu, 1 Feb 2018 22:00:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11M0cIi000944; Thu, 1 Feb 2018 22:00:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802012200.w11M0cIi000944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 1 Feb 2018 22:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328756 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 328756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 22:00:39 -0000 Author: adrian Date: Thu Feb 1 22:00:38 2018 New Revision: 328756 URL: https://svnweb.freebsd.org/changeset/base/328756 Log: [atheros] teach these two boards about the new hints location as well. Modified: head/sys/mips/conf/AP135.hints head/sys/mips/conf/AP143.hints Modified: head/sys/mips/conf/AP135.hints ============================================================================== --- head/sys/mips/conf/AP135.hints Thu Feb 1 22:00:05 2018 (r328755) +++ head/sys/mips/conf/AP135.hints Thu Feb 1 22:00:38 2018 (r328756) @@ -106,22 +106,12 @@ hint.arge.1.pll_1000=0x03000101 # MAC for arge1 is the second 6 bytes of the ART hint.arge.1.eeprommac=0x1fff0006 -# ath0: Where the ART is - last 64k in the flash -hint.ath.0.eepromaddr=0x1fff0000 -hint.ath.0.eepromsize=16384 +# Where the ART is - last 64k in the first 8MB of flash +hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000 +hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384 -# ath1: it's different; it's a PCIe attached device, so -# we instead need to teach the PCIe bridge code about it -# (ie, the 'early pci fixup' stuff that programs the PCIe -# host registers on the NIC) and then we teach ath where -# to find it. - -# ath1 hint - pcie slot 0 -# hint.pcib.0.bus.0.0.0.ath_fixup_addr=0x1fff4000 -# hint.pcib.0.bus.0.0.0.ath_fixup_size=16384 - -# ath0 - eeprom comes from here -# hint.ath.1.eeprom_firmware="pcib.0.bus.0.0.0.eeprom_firmware" +# And now tell the ath(4) driver where to look! +hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware" # flash layout: # Modified: head/sys/mips/conf/AP143.hints ============================================================================== --- head/sys/mips/conf/AP143.hints Thu Feb 1 22:00:05 2018 (r328755) +++ head/sys/mips/conf/AP143.hints Thu Feb 1 22:00:38 2018 (r328756) @@ -24,9 +24,12 @@ hint.arge.1.phymask=0x0 # No directly mapped PHYs hint.arge.1.media=1000 hint.arge.1.fduplex=1 -# ath0: Where the ART is - last 64k in the flash -hint.ath.0.eepromaddr=0x1fff0000 -hint.ath.0.eepromsize=16384 +# Where the ART is - last 64k in the first 8MB of flash +hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000 +hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384 + +# And now tell the ath(4) driver where to look! +hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware" # The AP121 4MB flash layout: # From owner-svn-src-all@freebsd.org Thu Feb 1 22:01:12 2018 Return-Path: Delivered-To: svn-src-all@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 A11E3ECD95E; Thu, 1 Feb 2018 22:01:12 +0000 (UTC) (envelope-from adrian@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 5599E6A20D; Thu, 1 Feb 2018 22:01:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5083712D83; Thu, 1 Feb 2018 22:01:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11M1CC9001022; Thu, 1 Feb 2018 22:01:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11M1CZU001021; Thu, 1 Feb 2018 22:01:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802012201.w11M1CZU001021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 1 Feb 2018 22:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328757 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 328757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 22:01:12 -0000 Author: adrian Date: Thu Feb 1 22:01:11 2018 New Revision: 328757 URL: https://svnweb.freebsd.org/changeset/base/328757 Log: [atheros] Fix DIR-825C1 to use the new hints. Tested: * DIR-825C1 Modified: head/sys/mips/conf/DIR-825C1.hints Modified: head/sys/mips/conf/DIR-825C1.hints ============================================================================== --- head/sys/mips/conf/DIR-825C1.hints Thu Feb 1 22:00:38 2018 (r328756) +++ head/sys/mips/conf/DIR-825C1.hints Thu Feb 1 22:01:11 2018 (r328757) @@ -80,9 +80,12 @@ hint.arge.0.fduplex=1 hint.arge.0.miimode=3 # RGMII hint.arge.0.pll_1000=0x06000000 -# ath0: Where the ART is - last 64k in the flash -hint.ath.0.eepromaddr=0x1fff0000 -hint.ath.0.eepromsize=16384 +# Where the ART is - last 64k in the first 8MB of flash +hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000 +hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384 + +# And now tell the ath(4) driver where to look! +hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware" # ath1: it's different; it's a PCIe attached device, so # we instead need to teach the PCIe bridge code about it From owner-svn-src-all@freebsd.org Thu Feb 1 22:01:54 2018 Return-Path: Delivered-To: svn-src-all@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 9D192ECDA4F; Thu, 1 Feb 2018 22:01:54 +0000 (UTC) (envelope-from adrian@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 5049F6A52A; Thu, 1 Feb 2018 22:01:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B35C12EC4; Thu, 1 Feb 2018 22:01:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11M1s6R004925; Thu, 1 Feb 2018 22:01:54 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11M1rD0004923; Thu, 1 Feb 2018 22:01:53 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802012201.w11M1rD0004923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 1 Feb 2018 22:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328758 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 328758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 22:01:54 -0000 Author: adrian Date: Thu Feb 1 22:01:53 2018 New Revision: 328758 URL: https://svnweb.freebsd.org/changeset/base/328758 Log: [atheros] Update QCA953x support to use the new hints. Modified: head/sys/mips/conf/QCA953X_BASE head/sys/mips/conf/QCA953X_BASE.hints Modified: head/sys/mips/conf/QCA953X_BASE ============================================================================== --- head/sys/mips/conf/QCA953X_BASE Thu Feb 1 22:01:11 2018 (r328757) +++ head/sys/mips/conf/QCA953X_BASE Thu Feb 1 22:01:53 2018 (r328758) @@ -53,7 +53,16 @@ options NO_FFS_SNAPSHOT # We don't require snapshot include "std.AR_MIPS_BASE" makeoptions MODULES_OVERRIDE+="hwpmc_mips24k" -option AH_SUPPORT_QCA9530 # Chipset support +# EEPROM caldata for AHB connected device +options AR71XX_ATH_EEPROM +device ar71xx_caldata +device firmware + +# Support QCA9530 in the HAL +options AH_SUPPORT_QCA9530 # Chipset support + +# Support EEPROM caldata in AHB devices +options ATH_EEPROM_FIRMWARE device usb device ehci Modified: head/sys/mips/conf/QCA953X_BASE.hints ============================================================================== --- head/sys/mips/conf/QCA953X_BASE.hints Thu Feb 1 22:01:11 2018 (r328757) +++ head/sys/mips/conf/QCA953X_BASE.hints Thu Feb 1 22:01:53 2018 (r328758) @@ -9,6 +9,10 @@ hint.apb.0.at="nexus0" hint.apb.0.irq=4 +# ART calibration data mapping device +hint.ar71xx_caldata.0.at="nexus0" +hint.ar71xx_caldata.0.order=0 + # mdiobus on arge0 - required to bring up arge0 hint.argemdio.0.at="nexus0" hint.argemdio.0.maddr=0x19000000 @@ -51,9 +55,12 @@ hint.ath.0.msize=0x20000 hint.ath.0.irq=0 hint.ath.0.vendor_id=0x168c hint.ath.0.device_id=0x003d -# Set this to define where the ath calibration data -# should be fetched from in physical memory. -# hint.ath.0.eepromaddr=0x1fff1000 +# Where the ART is - last 64k in the first 8MB of flash +#hint.ar71xx_caldata.0.map.0.ath_fixup_addr=0x1fff0000 +#hint.ar71xx_caldata.0.map.0.ath_fixup_size=16384 + +# And now tell the ath(4) driver where to look! +#hint.ath.0.eeprom_firmware="ar71xx_caldata.0.map.0.eeprom_firmware" # SPI flash hint.spi.0.at="nexus0" From owner-svn-src-all@freebsd.org Fri Feb 2 00:01:51 2018 Return-Path: Delivered-To: svn-src-all@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 E854CED5C03; Fri, 2 Feb 2018 00:01:50 +0000 (UTC) (envelope-from mckusick@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 8C3A16F5FC; Fri, 2 Feb 2018 00:01:50 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85E5B142C2; Fri, 2 Feb 2018 00:01:50 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1201owE066607; Fri, 2 Feb 2018 00:01:50 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1201onj066606; Fri, 2 Feb 2018 00:01:50 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802020001.w1201onj066606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 2 Feb 2018 00:01:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328762 - head/lib/libufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/lib/libufs X-SVN-Commit-Revision: 328762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 00:01:51 -0000 Author: mckusick Date: Fri Feb 2 00:01:50 2018 New Revision: 328762 URL: https://svnweb.freebsd.org/changeset/base/328762 Log: Fix punctuation. Modified: head/lib/libufs/cgread.3 Modified: head/lib/libufs/cgread.3 ============================================================================== --- head/lib/libufs/cgread.3 Thu Feb 1 23:49:17 2018 (r328761) +++ head/lib/libufs/cgread.3 Fri Feb 2 00:01:50 2018 (r328762) @@ -134,7 +134,7 @@ function returns 0 if there are no more cylinder group The .Fn cgread1 function returns 1 on success and \-1 on error. -The other functions return 0 on success and \-1 on error; +The other functions return 0 on success and \-1 on error. .Sh ERRORS The .Fn cgget , From owner-svn-src-all@freebsd.org Fri Feb 2 00:07:39 2018 Return-Path: Delivered-To: svn-src-all@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 9320AED6306; Fri, 2 Feb 2018 00:07:39 +0000 (UTC) (envelope-from mckusick@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 448296FB73; Fri, 2 Feb 2018 00:07:39 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DC37142FF; Fri, 2 Feb 2018 00:07:39 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1207d6i067047; Fri, 2 Feb 2018 00:07:39 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1207dWn067046; Fri, 2 Feb 2018 00:07:39 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802020007.w1207dWn067046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 2 Feb 2018 00:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328763 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 328763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 00:07:39 -0000 Author: mckusick Date: Fri Feb 2 00:07:38 2018 New Revision: 328763 URL: https://svnweb.freebsd.org/changeset/base/328763 Log: Use sbput(3) rather than sbwrite(3) to ensure that the updated copy of the superblock gets written. Reported by: Mark Johnston Modified: head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Fri Feb 2 00:01:50 2018 (r328762) +++ head/sbin/fsck_ffs/suj.c Fri Feb 2 00:07:38 2018 (r328763) @@ -213,8 +213,8 @@ closedisk(const char *devnam) fs->fs_clean = 1; fs->fs_time = time(NULL); fs->fs_mtime = time(NULL); - if (sbwrite(&disk, 0) == -1) - err(EX_OSERR, "sbwrite(%s)", devnam); + if (sbput(disk.d_fd, fs, 0) == -1) + err(EX_OSERR, "sbput(%s)", devnam); if (ufs_disk_close(&disk) == -1) err(EX_OSERR, "ufs_disk_close(%s)", devnam); fs = NULL; From owner-svn-src-all@freebsd.org Fri Feb 2 00:11:01 2018 Return-Path: Delivered-To: svn-src-all@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 4A3CFED6606; Fri, 2 Feb 2018 00:11:01 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com [209.85.223.181]) (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 E0A006FEF7; Fri, 2 Feb 2018 00:11:00 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f181.google.com with SMTP id f34so21136472ioi.13; Thu, 01 Feb 2018 16:11:00 -0800 (PST) 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=lc+ne84NYYVxUL/0Y9GAoLZjoPX1pV4JsSbqHw/1o5o=; b=Dte/w7NUOLUiJOg7ZvN/duuXJHh56VdG6Kd4m/Ciw1pPKmzrUUNDkF17B5lXzQud91 hkQpMs6LgWPmAIzMuDmG/NIN0g0u5a7zaZqDxOvHAx5OIVZrxJgQD0C3bpwkWFffZj6M +wt0fHjkbClaQZqjkONijICWtQOW06m+BsVjtzP7XAuQGxRgZUWpo3i9J1Ta2LUAUF+P syetPLhPf5negPDKBLyRp/tEQJkBge/oxCoHO92uRX5Lw844QCoeMq2PPJ+CdSVJXj15 habTVPifbTwCnm+kSxLxJuyS0Vqzks4G8pq6IZBFTboHdIAJio9PUyqzwH6zJU9U6y9r Jjeg== X-Gm-Message-State: AKwxytctyUQ+KrqPqw4R62A/4x/hbbeiO4RofaJXAOY+7RMvetDJawtr uffTMKd8x55vHIW3TqVCtysL3mPO X-Google-Smtp-Source: AH8x225zZRlBmaPjVo9ISo+M+hYOeODx/b71X+rBZ9jNG8Ig3nZF2l1tR2dPjPRY+e1e0Sg3GJACsw== X-Received: by 10.107.93.13 with SMTP id r13mr8404570iob.32.1517530254567; Thu, 01 Feb 2018 16:10:54 -0800 (PST) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com. [209.85.223.172]) by smtp.gmail.com with ESMTPSA id z62sm451720ioe.49.2018.02.01.16.10.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 16:10:54 -0800 (PST) Received: by mail-io0-f172.google.com with SMTP id p188so21115887ioe.12; Thu, 01 Feb 2018 16:10:54 -0800 (PST) X-Received: by 10.107.131.210 with SMTP id n79mr39447314ioi.215.1517530254084; Thu, 01 Feb 2018 16:10:54 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Thu, 1 Feb 2018 16:10:53 -0800 (PST) In-Reply-To: <201802020007.w1207dWn067046@repo.freebsd.org> References: <201802020007.w1207dWn067046@repo.freebsd.org> From: Conrad Meyer Date: Thu, 1 Feb 2018 16:10:53 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328763 - head/sbin/fsck_ffs To: Kirk McKusick Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 00:11:01 -0000 There's one last sbwrite() in fsck_ffs, in the gjournal code. Is that one known to be safe, or should it also use sbput()? Best, Conrad On Thu, Feb 1, 2018 at 4:07 PM, Kirk McKusick wrote: > Author: mckusick > Date: Fri Feb 2 00:07:38 2018 > New Revision: 328763 > URL: https://svnweb.freebsd.org/changeset/base/328763 > > Log: > Use sbput(3) rather than sbwrite(3) to ensure that the updated copy of > the superblock gets written. > > Reported by: Mark Johnston > > Modified: > head/sbin/fsck_ffs/suj.c > > Modified: head/sbin/fsck_ffs/suj.c > ============================================================================== > --- head/sbin/fsck_ffs/suj.c Fri Feb 2 00:01:50 2018 (r328762) > +++ head/sbin/fsck_ffs/suj.c Fri Feb 2 00:07:38 2018 (r328763) > @@ -213,8 +213,8 @@ closedisk(const char *devnam) > fs->fs_clean = 1; > fs->fs_time = time(NULL); > fs->fs_mtime = time(NULL); > - if (sbwrite(&disk, 0) == -1) > - err(EX_OSERR, "sbwrite(%s)", devnam); > + if (sbput(disk.d_fd, fs, 0) == -1) > + err(EX_OSERR, "sbput(%s)", devnam); > if (ufs_disk_close(&disk) == -1) > err(EX_OSERR, "ufs_disk_close(%s)", devnam); > fs = NULL; > From owner-svn-src-all@freebsd.org Fri Feb 2 00:52:30 2018 Return-Path: Delivered-To: svn-src-all@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 E8B0BED8E20; Fri, 2 Feb 2018 00:52:29 +0000 (UTC) (envelope-from mckusick@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 83EF571A02; Fri, 2 Feb 2018 00:52:29 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7ECA114B59; Fri, 2 Feb 2018 00:52:29 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w120qT3M091950; Fri, 2 Feb 2018 00:52:29 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w120qT1s091949; Fri, 2 Feb 2018 00:52:29 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802020052.w120qT1s091949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 2 Feb 2018 00:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328764 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328764 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 00:52:30 -0000 Author: mckusick Date: Fri Feb 2 00:52:29 2018 New Revision: 328764 URL: https://svnweb.freebsd.org/changeset/base/328764 Log: MFC of 328444. Eliminate "fsync: giving up on dirty" messages. Modified: stable/11/sys/kern/vfs_default.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_default.c ============================================================================== --- stable/11/sys/kern/vfs_default.c Fri Feb 2 00:07:38 2018 (r328763) +++ stable/11/sys/kern/vfs_default.c Fri Feb 2 00:52:29 2018 (r328764) @@ -629,13 +629,21 @@ vop_stdfsync(ap) struct thread *a_td; } */ *ap; { - struct vnode *vp = ap->a_vp; - struct buf *bp; + struct vnode *vp; + struct buf *bp, *nbp; struct bufobj *bo; - struct buf *nbp; - int error = 0; - int maxretry = 1000; /* large, arbitrarily chosen */ + struct mount *mp; + int error, maxretry; + error = 0; + maxretry = 10000; /* large, arbitrarily chosen */ + vp = ap->a_vp; + mp = NULL; + if (vp->v_type == VCHR) { + VI_LOCK(vp); + mp = vp->v_rdev->si_mountpt; + VI_UNLOCK(vp); + } bo = &vp->v_bufobj; BO_LOCK(bo); loop1: @@ -678,6 +686,8 @@ loop2: bremfree(bp); bawrite(bp); } + if (maxretry < 1000) + pause("dirty", hz < 1000 ? 1 : hz / 1000); BO_LOCK(bo); goto loop2; } @@ -699,7 +709,8 @@ loop2: TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs) if ((error = bp->b_error) == 0) continue; - if (error == 0 && --maxretry >= 0) + if ((mp != NULL && mp->mnt_secondary_writes > 0) || + (error == 0 && --maxretry >= 0)) goto loop1; error = EAGAIN; } From owner-svn-src-all@freebsd.org Fri Feb 2 01:28:15 2018 Return-Path: Delivered-To: svn-src-all@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 8C504EDAF8C; Fri, 2 Feb 2018 01:28:15 +0000 (UTC) (envelope-from mckusick@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 3E16C72DC4; Fri, 2 Feb 2018 01:28:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3905E15055; Fri, 2 Feb 2018 01:28:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w121SFBT007372; Fri, 2 Feb 2018 01:28:15 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w121SE7i007371; Fri, 2 Feb 2018 01:28:15 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802020128.w121SE7i007371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 2 Feb 2018 01:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328765 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 328765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 01:28:15 -0000 Author: mckusick Date: Fri Feb 2 01:28:14 2018 New Revision: 328765 URL: https://svnweb.freebsd.org/changeset/base/328765 Log: MFC of 328444. Eliminate "fsync: giving up on dirty" messages. Modified: stable/10/sys/kern/vfs_default.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_default.c ============================================================================== --- stable/10/sys/kern/vfs_default.c Fri Feb 2 00:52:29 2018 (r328764) +++ stable/10/sys/kern/vfs_default.c Fri Feb 2 01:28:14 2018 (r328765) @@ -639,13 +639,21 @@ vop_stdfsync(ap) struct thread *a_td; } */ *ap; { - struct vnode *vp = ap->a_vp; - struct buf *bp; + struct vnode *vp; + struct buf *bp, *nbp; struct bufobj *bo; - struct buf *nbp; - int error = 0; - int maxretry = 1000; /* large, arbitrarily chosen */ + struct mount *mp; + int error, maxretry; + error = 0; + maxretry = 10000; /* large, arbitrarily chosen */ + vp = ap->a_vp; + mp = NULL; + if (vp->v_type == VCHR) { + VI_LOCK(vp); + mp = vp->v_rdev->si_mountpt; + VI_UNLOCK(vp); + } bo = &vp->v_bufobj; BO_LOCK(bo); loop1: @@ -688,6 +696,8 @@ loop2: bremfree(bp); bawrite(bp); } + if (maxretry < 1000) + pause("dirty", hz < 1000 ? 1 : hz / 1000); BO_LOCK(bo); goto loop2; } @@ -709,7 +719,8 @@ loop2: TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs) if ((error = bp->b_error) == 0) continue; - if (error == 0 && --maxretry >= 0) + if ((mp != NULL && mp->mnt_secondary_writes > 0) || + (error == 0 && --maxretry >= 0)) goto loop1; error = EAGAIN; } From owner-svn-src-all@freebsd.org Fri Feb 2 02:05:15 2018 Return-Path: Delivered-To: svn-src-all@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 F3125EDCA59; Fri, 2 Feb 2018 02:05:14 +0000 (UTC) (envelope-from adrian@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 A2BE474091; Fri, 2 Feb 2018 02:05:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9989E156CF; Fri, 2 Feb 2018 02:05:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1225EiM027170; Fri, 2 Feb 2018 02:05:14 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1225EWH027167; Fri, 2 Feb 2018 02:05:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802020205.w1225EWH027167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Feb 2018 02:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328766 - head/sys/dev/etherswitch X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/etherswitch X-SVN-Commit-Revision: 328766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 02:05:15 -0000 Author: adrian Date: Fri Feb 2 02:05:14 2018 New Revision: 328766 URL: https://svnweb.freebsd.org/changeset/base/328766 Log: [etherswitch] add the first pass of a simple API to flush and fetch the L2 address table from the ethernet switch. This stuff may be a bit fluid during this -HEAD cycle as various other switch features are added, but the current stuff is enough to drive initial development and features on the atheros range of integrated and external switches. * add a method to flush the whole address table; * add a method to flush all addresses on a given port; * add a method to download the address table; * .. and then a method to fetch entries from the address table. The table fetch/read methods pass through to the drivers for now since the drivers may implement different ways of fetching/caching the address table data. The atheros devices for example fetch the table by iterating over the table through a set of registers and so you need to keep that locked whilst you iterate otherwise you may have the table flushed half way by a port status change. This is a no-op until the userland and arswitch code shows up. Modified: head/sys/dev/etherswitch/etherswitch.c head/sys/dev/etherswitch/etherswitch.h head/sys/dev/etherswitch/etherswitch_if.m Modified: head/sys/dev/etherswitch/etherswitch.c ============================================================================== --- head/sys/dev/etherswitch/etherswitch.c Fri Feb 2 01:28:14 2018 (r328765) +++ head/sys/dev/etherswitch/etherswitch.c Fri Feb 2 02:05:14 2018 (r328766) @@ -144,6 +144,7 @@ etherswitchioctl(struct cdev *cdev, u_long cmd, caddr_ etherswitch_info_t *info; etherswitch_reg_t *reg; etherswitch_phyreg_t *phyreg; + etherswitch_portid_t *portid; int error = 0; switch (cmd) { @@ -200,6 +201,23 @@ etherswitchioctl(struct cdev *cdev, u_long cmd, caddr_ case IOETHERSWITCHSETCONF: error = ETHERSWITCH_SETCONF(etherswitch, (etherswitch_conf_t *)data); + break; + + case IOETHERSWITCHFLUSHALL: + error = ETHERSWITCH_FLUSH_ALL(etherswitch); + break; + + case IOETHERSWITCHFLUSHPORT: + portid = (etherswitch_portid_t *)data; + error = ETHERSWITCH_FLUSH_PORT(etherswitch, portid->es_port); + break; + + case IOETHERSWITCHGETTABLE: + error = ETHERSWITCH_FETCH_TABLE(etherswitch, (void *) data); + break; + + case IOETHERSWITCHGETTABLEENTRY: + error = ETHERSWITCH_FETCH_TABLE_ENTRY(etherswitch, (void *) data); break; default: Modified: head/sys/dev/etherswitch/etherswitch.h ============================================================================== --- head/sys/dev/etherswitch/etherswitch.h Fri Feb 2 01:28:14 2018 (r328765) +++ head/sys/dev/etherswitch/etherswitch.h Fri Feb 2 02:05:14 2018 (r328766) @@ -6,6 +6,7 @@ #define __SYS_DEV_ETHERSWITCH_ETHERSWITCH_H #include +#include #ifdef _KERNEL extern devclass_t etherswitch_devclass; @@ -101,6 +102,28 @@ typedef struct etherswitch_vlangroup etherswitch_vlang #define ETHERSWITCH_PORTMASK(_port) (1 << (_port)) +struct etherswitch_portid { + int es_port; +}; +typedef struct etherswitch_portid etherswitch_portid_t; + +struct etherswitch_atu_entry { + int id; + int es_portmask; + uint8_t es_macaddr[ETHER_ADDR_LEN]; +}; +typedef struct etherswitch_atu_entry etherswitch_atu_entry_t; + +struct etherswitch_atu_table { + uint32_t es_nitems; +}; +typedef struct etherswitch_atu_table etherswitch_atu_table_t; + +struct etherswitch_atu_flush_macentry { + uint8_t es_macaddr[ETHER_ADDR_LEN]; +}; +typedef struct etherswitch_atu_flush_macentry etherswitch_atu_flush_macentry_t; + #define IOETHERSWITCHGETINFO _IOR('i', 1, etherswitch_info_t) #define IOETHERSWITCHGETREG _IOWR('i', 2, etherswitch_reg_t) #define IOETHERSWITCHSETREG _IOW('i', 3, etherswitch_reg_t) @@ -112,5 +135,10 @@ typedef struct etherswitch_vlangroup etherswitch_vlang #define IOETHERSWITCHSETPHYREG _IOW('i', 9, etherswitch_phyreg_t) #define IOETHERSWITCHGETCONF _IOR('i', 10, etherswitch_conf_t) #define IOETHERSWITCHSETCONF _IOW('i', 11, etherswitch_conf_t) +#define IOETHERSWITCHFLUSHALL _IOW('i', 12, etherswitch_portid_t) /* Dummy */ +#define IOETHERSWITCHFLUSHPORT _IOW('i', 13, etherswitch_portid_t) +#define IOETHERSWITCHFLUSHMAC _IOW('i', 14, etherswitch_atu_flush_macentry_t) +#define IOETHERSWITCHGETTABLE _IOWR('i', 15, etherswitch_atu_table_t) +#define IOETHERSWITCHGETTABLEENTRY _IOWR('i', 16, etherswitch_atu_entry_t) #endif Modified: head/sys/dev/etherswitch/etherswitch_if.m ============================================================================== --- head/sys/dev/etherswitch/etherswitch_if.m Fri Feb 2 01:28:14 2018 (r328765) +++ head/sys/dev/etherswitch/etherswitch_if.m Fri Feb 2 02:05:14 2018 (r328766) @@ -35,6 +35,45 @@ CODE { { return (0); } + + static int + null_etherswitch_flush_all(device_t dev) + { + + return (ENXIO); + } + + static int + null_etherswitch_flush_port(device_t dev, int port) + { + + return (ENXIO); + } + + static int + null_etherswitch_flush_mac(device_t dev, + etherswitch_atu_flush_macentry_t *e) + { + + return (ENXIO); + } + + static int + null_etherswitch_fetch_table(device_t dev, + etherswitch_atu_table_t *table) + { + + table->es_nitems = 0; + return (ENXIO); + } + + static int + null_etherswitch_fetch_entry(device_t dev, + etherswitch_atu_entry_t *e) + { + + return (ENXIO); + } }; # @@ -141,3 +180,42 @@ METHOD int setconf { device_t dev; etherswitch_conf_t *conf; } DEFAULT null_etherswitch_setconf; + +# +# Flush all of the programmed/learnt MAC addresses +# +METHOD int flush_all { + device_t dev; +} DEFAULT null_etherswitch_flush_all; + +# +# Flush a single MAC address entry +# +METHOD int flush_mac { + device_t dev; + etherswitch_atu_flush_macentry_t *entry; +} DEFAULT null_etherswitch_flush_mac; + +# +# Flush all of the dynamic MAC addresses on a given port +# +METHOD int flush_port { + device_t dev; + int port; +} DEFAULT null_etherswitch_flush_port; + +# +# Fetch the address table from the ethernet switch. +# +METHOD int fetch_table { + device_t dev; + etherswitch_atu_table_t *table; +} DEFAULT null_etherswitch_fetch_table; + +# +# Fetch a single entry from the ethernet switch table. +# +METHOD int fetch_table_entry { + device_t dev; + etherswitch_atu_entry_t *entry; +} DEFAULT null_etherswitch_fetch_entry; From owner-svn-src-all@freebsd.org Fri Feb 2 02:28:25 2018 Return-Path: Delivered-To: svn-src-all@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 C88A1EDDBDB; Fri, 2 Feb 2018 02:28:25 +0000 (UTC) (envelope-from swills@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 7BFFB74B2D; Fri, 2 Feb 2018 02:28:25 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 72DDD15A13; Fri, 2 Feb 2018 02:28:25 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w122SPHN036815; Fri, 2 Feb 2018 02:28:25 GMT (envelope-from swills@FreeBSD.org) Received: (from swills@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w122SPTP036814; Fri, 2 Feb 2018 02:28:25 GMT (envelope-from swills@FreeBSD.org) Message-Id: <201802020228.w122SPTP036814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: swills set sender to swills@FreeBSD.org using -f From: Steve Wills Date: Fri, 2 Feb 2018 02:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328767 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: swills X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 328767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 02:28:26 -0000 Author: swills (ports committer) Date: Fri Feb 2 02:28:25 2018 New Revision: 328767 URL: https://svnweb.freebsd.org/changeset/base/328767 Log: Correct longjmp Reviewed by: nwhitehorn Differential Revision: https://reviews.freebsd.org/D14159 Modified: head/sys/powerpc/aim/trap_subr64.S Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Fri Feb 2 02:05:14 2018 (r328766) +++ head/sys/powerpc/aim/trap_subr64.S Fri Feb 2 02:28:25 2018 (r328767) @@ -347,7 +347,7 @@ cpu_reset_handler: beq %cr0,2f nop li %r4,1 - b CNAME(longjmp) + bl CNAME(longjmp) nop 2: #ifdef SMP From owner-svn-src-all@freebsd.org Fri Feb 2 03:35:02 2018 Return-Path: Delivered-To: svn-src-all@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 B78D5EE0DAD; Fri, 2 Feb 2018 03:35:02 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from mouf.net (mouf.net [IPv6:2607:fc50:0:4400:216:3eff:fe69:33b3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mouf.net", Issuer "mouf.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F5E67715E; Fri, 2 Feb 2018 03:35:02 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from lrrr.mouf.net (cpe-24-163-43-246.nc.res.rr.com [24.163.43.246]) (authenticated bits=0) by mouf.net (8.14.9/8.14.9) with ESMTP id w123YrPY074551 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 2 Feb 2018 03:34:59 GMT (envelope-from swills@FreeBSD.org) Subject: Re: svn commit: r328612 - head/lib/libc/stdlib To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801310305.w0V35EU4090569@repo.freebsd.org> From: Steve Wills Message-ID: Date: Thu, 1 Feb 2018 22:34:48 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201801310305.w0V35EU4090569@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mouf.net [199.48.129.64]); Fri, 02 Feb 2018 03:35:00 +0000 (UTC) X-Spam-Status: No, score=1.3 required=4.5 tests=RCVD_IN_RP_RNBL autolearn=no autolearn_force=no version=3.4.1 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mouf.net X-Virus-Scanned: clamav-milter 0.99.2 at mouf.net X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 03:35:03 -0000 This, somehow, seems to have broken the mips64 build: https://ci.freebsd.org/job/FreeBSD-head-mips64-build/216/consoleFull The previous rev works. Steve On 01/30/2018 22:05, Warner Losh wrote: > Author: imp > Date: Wed Jan 31 03:05:14 2018 > New Revision: 328612 > URL: https://svnweb.freebsd.org/changeset/base/328612 > > Log: > Move strtold wrapper from strtol.c to its own strtold.c. This code > was written by theraven@ (David Chisnall) entirely, there's no > original Berkeley code left here so just copy his copyright over. > > Added: > head/lib/libc/stdlib/strtold.c (contents, props changed) > Modified: > head/lib/libc/stdlib/Makefile.inc > head/lib/libc/stdlib/strtol.c > > Modified: head/lib/libc/stdlib/Makefile.inc > ============================================================================== > --- head/lib/libc/stdlib/Makefile.inc Wed Jan 31 01:04:36 2018 (r328611) > +++ head/lib/libc/stdlib/Makefile.inc Wed Jan 31 03:05:14 2018 (r328612) > @@ -15,7 +15,7 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof. > radixsort.c rand.c \ > random.c reallocarray.c reallocf.c realpath.c remque.c \ > set_constraint_handler_s.c strfmon.c strtoimax.c \ > - strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ > + strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ > strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c > > # Work around an issue on case-insensitive file systems. > > Modified: head/lib/libc/stdlib/strtol.c > ============================================================================== > --- head/lib/libc/stdlib/strtol.c Wed Jan 31 01:04:36 2018 (r328611) > +++ head/lib/libc/stdlib/strtol.c Wed Jan 31 03:05:14 2018 (r328612) > @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); > #include > #include "xlocale_private.h" > > - > /* > * Convert a string to a long integer. > * > @@ -152,9 +151,4 @@ long > strtol(const char * __restrict nptr, char ** __restrict endptr, int base) > { > return strtol_l(nptr, endptr, base, __get_locale()); > -} > -long double > -strtold(const char * __restrict nptr, char ** __restrict endptr) > -{ > - return strtold_l(nptr, endptr, __get_locale()); > } > > Added: head/lib/libc/stdlib/strtold.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libc/stdlib/strtold.c Wed Jan 31 03:05:14 2018 (r328612) > @@ -0,0 +1,45 @@ > +/*- > + * SPDX-License-Identifier: BSD-3-Clause > + * > + * Copyright (c) 2011 The FreeBSD Foundation > + * All rights reserved. > + * Portions of this software were developed by David Chisnall > + * 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. > + * 3. Neither the name of the University nor the names of its contributors > + * may be used to endorse or promote products derived from this software > + * without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include "xlocale_private.h" > + > +long double > +strtold(const char * __restrict nptr, char ** __restrict endptr) > +{ > + > + return strtold_l(nptr, endptr, __get_locale()); > +} > _______________________________________________ > 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-all@freebsd.org Fri Feb 2 04:09:57 2018 Return-Path: Delivered-To: svn-src-all@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 7FDADEE2935 for ; Fri, 2 Feb 2018 04:09:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE5B5786BE for ; Fri, 2 Feb 2018 04:09:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x233.google.com with SMTP id v71so9680218wmv.2 for ; Thu, 01 Feb 2018 20:09:56 -0800 (PST) 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=kXicLRub7dTi3DRHnRm4AVjZmiX/lJFVz4PT2N7jyV4=; b=nQGLjOTZD8eiVnwovEhcJ2Nlf2zltlaoHknEAa3pYg/flkMZLdwjE7lbtp0i97yf3b xKUQdiANOpM3s44uHJ29bkE/Qa54vI07q43W1r7em9OStzKZfjIr0gjLw+adSpCTPoWr J5nHqqwe2aZH1ji7Kq+kt5JaFMykiB6Uer7KNhHShQ1m47GeR2LmIFKqQfox346n2sEg 11RHyy0UngPdPtYUbsrPgtG+kd4ZXpfLMqgeUKm5zHk6QWWL7ERb7xzpjw8t20FZFJs5 6vxxQa+LZlHCEZa0em+v9N/fsl21MXvxeBL6QGPo0LZeiWTk/fvHA+UWouBa9Wb2q5er mYgQ== 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=kXicLRub7dTi3DRHnRm4AVjZmiX/lJFVz4PT2N7jyV4=; b=Rq5cOEYgKz6ROILQ02KkEiz8eVAESACFF9LjKoRIDg0poSOQUzBJlQytB9UTetNvab 4HnmAj8mMN2++E9sz8juYFh+5GOvEoml/bwwl7xEa2Uac0GqKTkNnYccm0Ye0kAieDkI gLDmJBMDhU98Rnd+DtzFpHZwGhsznhQA3+RsaPm1xZLC1VeNMAs3ysLHrRXeGUmAfMpo CAoOc/n56JXNaaPyHruYVpsnANlyLTWWcLVflO7jFMw9sCPnwtSF/LfPgHiYxMqLjq7f iuz5T6zJEzROQuXYEuHe9ZaSH16ofbRJM7SRt+B1DpsjDiCfLGHsGZOgoX5iflaab41P OPpw== X-Gm-Message-State: AKwxytfCkJG5oy/dzf7/8fFn0oEcuTFJ3X5p/Kd6D4VCeK0yAt874xAO aqmZUXGjs7kJH8MERRZ4nQSYJtmAcHWesZB8XZ7NJQ== X-Google-Smtp-Source: AH8x225d656R/MXXgZFFdSHaZkZO5vbFoq0+KcFEzxU3ebSqXJOwGcWt4YNll5LQZg/ctMjqcDJ6ZMbN9rG4NkND9h8= X-Received: by 10.80.244.226 with SMTP id v31mr65117593edm.221.1517544595324; Thu, 01 Feb 2018 20:09:55 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Thu, 1 Feb 2018 20:09:54 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: References: <201801310305.w0V35EU4090569@repo.freebsd.org> From: Warner Losh Date: Thu, 1 Feb 2018 21:09:54 -0700 X-Google-Sender-Auth: 9dW1JnghCIBf6PiT1E7DeOsFGxo Message-ID: Subject: Re: svn commit: r328612 - head/lib/libc/stdlib To: Steve Wills 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.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 04:09:57 -0000 On Thu, Feb 1, 2018 at 8:34 PM, Steve Wills wrote: > This, somehow, seems to have broken the mips64 build: > > https://ci.freebsd.org/job/FreeBSD-head-mips64-build/216/consoleFull > > The previous rev works. > This breaks devd, of all things, with /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libgcc.a(comparedf2.o): In function `__gedf2': /usr/src/contrib/compiler-rt/lib/builtins/comparedf2.c:96: multiple definition of `__gedf2' /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libc.a(gedf2.o):/usr/src/lib/libc/softfloat/gedf2.c:18: first defined here /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libgcc.a(comparedf2.o): In function `__eqdf2': /usr/src/contrib/compiler-rt/lib/builtins/comparedf2.c:126: multiple definition of `__eqdf2' /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libc.a(eqdf2.o):/usr/src/lib/libc/softfloat/eqdf2.c:18: first defined here /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libgcc.a(comparedf2.o): In function `__ltdf2': /usr/src/contrib/compiler-rt/lib/builtins/comparedf2.c:131: multiple definition of `__ltdf2' /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libc.a(ltdf2.o):/usr/src/lib/libc/softfloat/ltdf2.c:18: first defined here /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libgcc.a(comparedf2.o): In function `__nedf2': /usr/src/contrib/compiler-rt/lib/builtins/comparedf2.c:136: multiple definition of `__nedf2' /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libc.a(nedf2.o):/usr/src/lib/libc/softfloat/nedf2.c:18: first defined here /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libgcc.a(comparedf2.o): In function `__gtdf2': /usr/src/contrib/compiler-rt/lib/builtins/comparedf2.c:141: multiple definition of `__gtdf2' /usr/obj/usr/src/mips.mips64/tmp/usr/lib/libc.a(gtdf2.o):/usr/src/lib/libc/softfloat/gtdf2.c:18: first defined here undefined.... devd doesn't even use strtodl. (looks like the code to associate make output with the right commands is broken, since I had to dig for it. Warner > Steve > > > On 01/30/2018 22:05, Warner Losh wrote: > >> Author: imp >> Date: Wed Jan 31 03:05:14 2018 >> New Revision: 328612 >> URL: https://svnweb.freebsd.org/changeset/base/328612 >> >> Log: >> Move strtold wrapper from strtol.c to its own strtold.c. This code >> was written by theraven@ (David Chisnall) entirely, there's no >> original Berkeley code left here so just copy his copyright over. >> >> Added: >> head/lib/libc/stdlib/strtold.c (contents, props changed) >> Modified: >> head/lib/libc/stdlib/Makefile.inc >> head/lib/libc/stdlib/strtol.c >> >> Modified: head/lib/libc/stdlib/Makefile.inc >> ============================================================ >> ================== >> --- head/lib/libc/stdlib/Makefile.inc Wed Jan 31 01:04:36 2018 >> (r328611) >> +++ head/lib/libc/stdlib/Makefile.inc Wed Jan 31 03:05:14 2018 >> (r328612) >> @@ -15,7 +15,7 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof. >> radixsort.c rand.c \ >> random.c reallocarray.c reallocf.c realpath.c remque.c \ >> set_constraint_handler_s.c strfmon.c strtoimax.c \ >> - strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ >> + strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c >> strtoull.c \ >> strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c >> twalk.c >> # Work around an issue on case-insensitive file systems. >> >> Modified: head/lib/libc/stdlib/strtol.c >> ============================================================ >> ================== >> --- head/lib/libc/stdlib/strtol.c Wed Jan 31 01:04:36 2018 >> (r328611) >> +++ head/lib/libc/stdlib/strtol.c Wed Jan 31 03:05:14 2018 >> (r328612) >> @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); >> #include >> #include "xlocale_private.h" >> - >> /* >> * Convert a string to a long integer. >> * >> @@ -152,9 +151,4 @@ long >> strtol(const char * __restrict nptr, char ** __restrict endptr, int >> base) >> { >> return strtol_l(nptr, endptr, base, __get_locale()); >> -} >> -long double >> -strtold(const char * __restrict nptr, char ** __restrict endptr) >> -{ >> - return strtold_l(nptr, endptr, __get_locale()); >> } >> >> Added: head/lib/libc/stdlib/strtold.c >> ============================================================ >> ================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/lib/libc/stdlib/strtold.c Wed Jan 31 03:05:14 2018 >> (r328612) >> @@ -0,0 +1,45 @@ >> +/*- >> + * SPDX-License-Identifier: BSD-3-Clause >> + * >> + * Copyright (c) 2011 The FreeBSD Foundation >> + * All rights reserved. >> + * Portions of this software were developed by David Chisnall >> + * 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. >> + * 3. Neither the name of the University nor the names of its >> contributors >> + * may be used to endorse or promote products derived from this >> software >> + * without specific prior written permission. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' >> AND >> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >> PURPOSE >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE >> LIABLE >> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >> CONSEQUENTIAL >> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE >> GOODS >> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, >> STRICT >> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY >> WAY >> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >> + * SUCH DAMAGE. >> + */ >> + >> +#include >> +__FBSDID("$FreeBSD$"); >> + >> +#include >> +#include "xlocale_private.h" >> + >> +long double >> +strtold(const char * __restrict nptr, char ** __restrict endptr) >> +{ >> + >> + return strtold_l(nptr, endptr, __get_locale()); >> +} >> _______________________________________________ >> 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-all@freebsd.org Fri Feb 2 05:04:44 2018 Return-Path: Delivered-To: svn-src-all@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 8B5D5EE501E; Fri, 2 Feb 2018 05:04:44 +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 3EF487A15B; Fri, 2 Feb 2018 05:04: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 33E2A17464; Fri, 2 Feb 2018 05:04:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1254iQu017538; Fri, 2 Feb 2018 05:04:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1254ido017537; Fri, 2 Feb 2018 05:04:44 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802020504.w1254ido017537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 05:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328768 - head/lib/libcompiler_rt X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libcompiler_rt X-SVN-Commit-Revision: 328768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 05:04:44 -0000 Author: imp Date: Fri Feb 2 05:04:43 2018 New Revision: 328768 URL: https://svnweb.freebsd.org/changeset/base/328768 Log: The routines defined in comparedf2 and comparesf2 are defined in libc for softfloat mips. No need to include them here. Modified: head/lib/libcompiler_rt/Makefile.inc Modified: head/lib/libcompiler_rt/Makefile.inc ============================================================================== --- head/lib/libcompiler_rt/Makefile.inc Fri Feb 2 02:28:25 2018 (r328767) +++ head/lib/libcompiler_rt/Makefile.inc Fri Feb 2 05:04:43 2018 (r328768) @@ -186,7 +186,7 @@ SRCF+= subsf3 SRCF+= truncdfsf2 .endif -.if ${MACHINE_CPUARCH} != "arm" +.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" SRCF+= comparedf2 SRCF+= comparesf2 .endif From owner-svn-src-all@freebsd.org Fri Feb 2 06:32:31 2018 Return-Path: Delivered-To: svn-src-all@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 E1383EE8729; Fri, 2 Feb 2018 06:32:30 +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 913857CB99; Fri, 2 Feb 2018 06:32:30 +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 8C214182C0; Fri, 2 Feb 2018 06:32:30 +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 w126WUtO061959; Fri, 2 Feb 2018 06:32:30 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w126WRFH061924; Fri, 2 Feb 2018 06:32:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802020632.w126WRFH061924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 06:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328769 - in head/stand: . efi/boot1 efi/fdt efi/libefi efi/loader fdt ficl geli i386/boot0 i386/btx/btx i386/btx/btxldr i386/btx/lib i386/cdboot i386/kgzldr i386/libfirewire i386/libi3... X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: . efi/boot1 efi/fdt efi/libefi efi/loader fdt ficl geli i386/boot0 i386/btx/btx i386/btx/btxldr i386/btx/lib i386/cdboot i386/kgzldr i386/libfirewire i386/libi386 i386/loader i386/mbr i... X-SVN-Commit-Revision: 328769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 06:32:31 -0000 Author: imp Date: Fri Feb 2 06:32:26 2018 New Revision: 328769 URL: https://svnweb.freebsd.org/changeset/base/328769 Log: Centralize several variables. MK_CTF, MK_SSP, MK_PROFILE, NO_PIC, and INTERNALLIB are always the same, so set them in defs.mk. MAN= is common, so set it here too. This removes a lot of boring repetition from the Makefiles that added almost no value. Modified: head/stand/defs.mk head/stand/efi/boot1/Makefile head/stand/efi/fdt/Makefile head/stand/efi/libefi/Makefile head/stand/efi/loader/Makefile head/stand/fdt/Makefile head/stand/ficl/Makefile head/stand/geli/Makefile head/stand/i386/boot0/Makefile head/stand/i386/btx/btx/Makefile head/stand/i386/btx/btxldr/Makefile head/stand/i386/btx/lib/Makefile head/stand/i386/cdboot/Makefile head/stand/i386/kgzldr/Makefile head/stand/i386/libfirewire/Makefile head/stand/i386/libi386/Makefile head/stand/i386/loader/Makefile head/stand/i386/mbr/Makefile head/stand/i386/pmbr/Makefile head/stand/libsa/Makefile head/stand/mips/beri/boot2/Makefile head/stand/mips/beri/loader/Makefile head/stand/ofw/libofw/Makefile head/stand/powerpc/boot1.chrp/Makefile head/stand/powerpc/kboot/Makefile head/stand/powerpc/ofw/Makefile head/stand/powerpc/uboot/Makefile head/stand/sparc64/boot1/Makefile head/stand/sparc64/loader/Makefile head/stand/uboot/fdt/Makefile head/stand/uboot/lib/Makefile head/stand/usb/Makefile.test head/stand/userboot/test/Makefile head/stand/userboot/userboot/Makefile head/stand/zfs/Makefile Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/defs.mk Fri Feb 2 06:32:26 2018 (r328769) @@ -7,6 +7,13 @@ WARNS?=1 .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} +MK_CTF= no +MK_SSP= no +MK_PROFILE= no +NO_PIC= +MAN= +INTERNALLIB= + BOOTSRC= ${SRCTOP}/stand EFISRC= ${BOOTSRC}/efi EFIINC= ${EFISRC}/include Modified: head/stand/efi/boot1/Makefile ============================================================================== --- head/stand/efi/boot1/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/efi/boot1/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -1,11 +1,6 @@ # $FreeBSD$ -MAN= - .include - -MK_SSP= no -MK_FORTH= no PROG= boot1.sym INTERNALPROG= Modified: head/stand/efi/fdt/Makefile ============================================================================== --- head/stand/efi/fdt/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/efi/fdt/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -5,7 +5,6 @@ .PATH: ${LDRSRC} LIB= efi_fdt -INTERNALLIB= WARNS?= 6 SRCS= efi_fdt.c Modified: head/stand/efi/libefi/Makefile ============================================================================== --- head/stand/efi/libefi/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/efi/libefi/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -7,7 +7,6 @@ .endif LIB= efi -INTERNALLIB= WARNS?= 2 SRCS= delay.c devpath.c efi_console.c efichar.c efinet.c efipart.c env.c errno.c \ Modified: head/stand/efi/loader/Makefile ============================================================================== --- head/stand/efi/loader/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/efi/loader/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -1,7 +1,5 @@ # $FreeBSD$ -MAN= - LOADER_NET_SUPPORT?= yes LOADER_MSDOS_SUPPORT?= yes LOADER_UFS_SUPPORT?= yes @@ -9,8 +7,6 @@ LOADER_CD9660_SUPPORT?= no LOADER_EXT2FS_SUPPORT?= no .include - -MK_SSP= no PROG= loader.sym INTERNALPROG= Modified: head/stand/fdt/Makefile ============================================================================== --- head/stand/fdt/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/fdt/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -5,7 +5,6 @@ .PATH: ${SYSDIR}/contrib/libfdt/ LIB= fdt -INTERNALLIB= # Vendor sources of libfdt. SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ Modified: head/stand/ficl/Makefile ============================================================================== --- head/stand/ficl/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/ficl/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -20,7 +20,6 @@ PROG= testmain .include .else LIB= ficl -INTERNALLIB= .include .endif Modified: head/stand/geli/Makefile ============================================================================== --- head/stand/geli/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/geli/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -1,16 +1,11 @@ # $FreeBSD$ # libgeliboot -MAN= DO32=1 .include -MK_SSP= no LIB= geliboot -INTERNALLIB= -MK_PROFILE= no -NO_PIC= # Our password input method SRCS+= pwgets.c Modified: head/stand/i386/boot0/Makefile ============================================================================== --- head/stand/i386/boot0/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/boot0/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -3,7 +3,6 @@ PROG?= boot0 STRIP= BINMODE=${NOBINMODE} -MAN= SRCS= ${PROG}.S # Additional options that you can specify with make OPTS="..." Modified: head/stand/i386/btx/btx/Makefile ============================================================================== --- head/stand/i386/btx/btx/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/btx/btx/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -4,7 +4,6 @@ PROG= btx INTERNALPROG= -MAN= SRCS= btx.S .if defined(BOOT_BTX_NOHANG) Modified: head/stand/i386/btx/btxldr/Makefile ============================================================================== --- head/stand/i386/btx/btxldr/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/btx/btxldr/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -4,7 +4,6 @@ PROG= btxldr INTERNALPROG= -MAN= SRCS= btxldr.S CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} Modified: head/stand/i386/btx/lib/Makefile ============================================================================== --- head/stand/i386/btx/lib/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/btx/lib/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -4,7 +4,6 @@ PROG= crt0.o INTERNALPROG= -MAN= SRCS= btxcsu.S btxsys.s btxv86.s CFLAGS+=-I${BOOTSRC}/i386/common LDFLAGS+=-Wl,-r Modified: head/stand/i386/cdboot/Makefile ============================================================================== --- head/stand/i386/cdboot/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/cdboot/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -5,7 +5,6 @@ PROG= cdboot STRIP= BINMODE=${NOBINMODE} -MAN= SRCS= ${PROG}.S CFLAGS+=-I${BOOTSRC}/i386/common Modified: head/stand/i386/kgzldr/Makefile ============================================================================== --- head/stand/i386/kgzldr/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/kgzldr/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -6,7 +6,6 @@ PROG= kgzldr.o STRIP= BINMODE=${LIBMODE} BINDIR= ${LIBDIR} -MAN= SRCS= start.s boot.c inflate.c lib.c crt.s sio.s CFLAGS= -Os Modified: head/stand/i386/libfirewire/Makefile ============================================================================== --- head/stand/i386/libfirewire/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/libfirewire/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -3,7 +3,6 @@ .include LIB= firewire -INTERNALLIB= .PATH: ${SYSDIR}/dev/dcons ${SYSDIR}/dev/firewire SRCS+= firewire.c fwohci.c dconsole.c Modified: head/stand/i386/libi386/Makefile ============================================================================== --- head/stand/i386/libi386/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/libi386/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -5,7 +5,6 @@ HAVE_GELI= yes .include LIB= i386 -INTERNALLIB= SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \ biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ Modified: head/stand/i386/loader/Makefile ============================================================================== --- head/stand/i386/loader/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/loader/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -14,11 +14,8 @@ LOADER_BZIP2_SUPPORT?= yes .include -MK_SSP= no - LOADER?= loader PROG= ${LOADER}.sym -MAN= INTERNALPROG= NEWVERSWHAT?= "bootstrap loader" x86 VERSION_FILE= ${.CURDIR}/../loader/version Modified: head/stand/i386/mbr/Makefile ============================================================================== --- head/stand/i386/mbr/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/mbr/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -3,7 +3,6 @@ PROG= mbr STRIP= BINMODE=${NOBINMODE} -MAN= SRCS= ${PROG}.s # MBR flags: 0x80 -- try packet interface (also known as EDD or LBA) Modified: head/stand/i386/pmbr/Makefile ============================================================================== --- head/stand/i386/pmbr/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/i386/pmbr/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -3,7 +3,6 @@ PROG= pmbr STRIP= BINMODE=${NOBINMODE} -MAN= SRCS= ${PROG}.s ORG= 0x600 Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/libsa/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -6,17 +6,12 @@ # quite large. # -MK_PROFILE= no -MK_SSP= no - .include -INTERNALLIB= LIBSA_CPUARCH?=${MACHINE_CPUARCH} LIBC_SRC= ${SRCTOP}/lib/libc LIB?= sa -NO_PIC= # standalone components and stuff we have modified locally SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd.c environment.c getopt.c gets.c \ Modified: head/stand/mips/beri/boot2/Makefile ============================================================================== --- head/stand/mips/beri/boot2/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/mips/beri/boot2/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -43,8 +43,6 @@ SRCS= relocate.S \ cfi.c \ sdcard.c -MAN= - AFLAGS= -G0 CFLAGS+= -I${LDRSRC} \ Modified: head/stand/mips/beri/loader/Makefile ============================================================================== --- head/stand/mips/beri/loader/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/mips/beri/loader/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -38,9 +38,6 @@ LOADER_BZIP2_SUPPORT?= yes .include -MK_SSP= no -MAN= - PROG?= loader NEWVERSWHAT= "BERI loader" ${MACHINE_CPUARCH} INSTALLFLAGS= -b Modified: head/stand/ofw/libofw/Makefile ============================================================================== --- head/stand/ofw/libofw/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/ofw/libofw/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -3,7 +3,6 @@ .include LIB= ofw -INTERNALLIB= SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \ ofw_memory.c ofw_module.c ofw_net.c ofw_reboot.c \ Modified: head/stand/powerpc/boot1.chrp/Makefile ============================================================================== --- head/stand/powerpc/boot1.chrp/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/powerpc/boot1.chrp/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -9,8 +9,6 @@ INSTALLFLAGS= -b FILES= boot1.hfs SRCS= boot1.c ashldi3.c syncicache.c -MAN= - CFLAGS+=-I${LDRSRC} LDFLAGS=-nostdlib -static -Wl,-N Modified: head/stand/powerpc/kboot/Makefile ============================================================================== --- head/stand/powerpc/kboot/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/powerpc/kboot/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -11,8 +11,6 @@ LOADER_GZIP_SUPPORT?= yes LOADER_BZIP2_SUPPORT?= no .include -MK_SSP= no -MAN= PROG= loader.kboot NEWVERSWHAT= "kboot loader" ${MACHINE_ARCH} Modified: head/stand/powerpc/ofw/Makefile ============================================================================== --- head/stand/powerpc/ofw/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/powerpc/ofw/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -11,8 +11,6 @@ LOADER_GZIP_SUPPORT?= yes LOADER_BZIP2_SUPPORT?= no .include -MK_SSP= no -MAN= PROG= loader NEWVERSWHAT= "Open Firmware loader" ${MACHINE_ARCH} Modified: head/stand/powerpc/uboot/Makefile ============================================================================== --- head/stand/powerpc/uboot/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/powerpc/uboot/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -14,7 +14,6 @@ LOADER_BZIP2_SUPPORT?= no PROG= ubldr NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} INSTALLFLAGS= -b -MAN= # Architecture-specific loader code SRCS= start.S conf.c vers.c Modified: head/stand/sparc64/boot1/Makefile ============================================================================== --- head/stand/sparc64/boot1/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/sparc64/boot1/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -4,7 +4,6 @@ PROG= boot1.elf INTERNALPROG= -MAN= FILES?= boot1 SRCS= _start.s boot1.c CLEANFILES+=${FILES} boot1.aout Modified: head/stand/sparc64/loader/Makefile ============================================================================== --- head/stand/sparc64/loader/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/sparc64/loader/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -13,8 +13,6 @@ LOADER_BZIP2_SUPPORT?= no LOADER_DEBUG?= no .include -MK_SSP= no -MAN= PROG?= loader NEWVERSWHAT?= "bootstrap loader" sparc64 Modified: head/stand/uboot/fdt/Makefile ============================================================================== --- head/stand/uboot/fdt/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/uboot/fdt/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -5,7 +5,6 @@ .PATH: ${LDRSRC} LIB= uboot_fdt -INTERNALLIB= WARNS?= 2 SRCS= uboot_fdt.c Modified: head/stand/uboot/lib/Makefile ============================================================================== --- head/stand/uboot/lib/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/uboot/lib/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -5,7 +5,6 @@ .PATH: ${LDRSRC} LIB= uboot -INTERNALLIB= WARNS?= 2 SRCS= console.c copy.c devicename.c elf_freebsd.c glue.c Modified: head/stand/usb/Makefile.test ============================================================================== --- head/stand/usb/Makefile.test Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/usb/Makefile.test Fri Feb 2 06:32:26 2018 (r328769) @@ -32,7 +32,6 @@ .PATH: ${.CURDIR} PROG= usbloader -MAN= SRCS= CFLAGS+= -Wall Modified: head/stand/userboot/test/Makefile ============================================================================== --- head/stand/userboot/test/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/userboot/test/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -1,10 +1,6 @@ # $FreeBSD$ - -MAN= - .include -MK_SSP= no PROG= test INTERNALPROG= Modified: head/stand/userboot/userboot/Makefile ============================================================================== --- head/stand/userboot/userboot/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/userboot/userboot/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -1,7 +1,5 @@ # $FreeBSD$ -MAN= - LOADER_MSDOS_SUPPORT?= yes LOADER_UFS_SUPPORT?= yes LOADER_CD9660_SUPPORT?= no @@ -9,10 +7,7 @@ LOADER_EXT2FS_SUPPORT?= no .include -MK_SSP= no - SHLIB_NAME= userboot.so -MK_CTF= no STRIP= LIBDIR= /boot Modified: head/stand/zfs/Makefile ============================================================================== --- head/stand/zfs/Makefile Fri Feb 2 05:04:43 2018 (r328768) +++ head/stand/zfs/Makefile Fri Feb 2 06:32:26 2018 (r328769) @@ -3,7 +3,6 @@ .include LIB= zfsboot -INTERNALLIB= .PATH: ${ZFSSRC} SRCS+= zfs.c skein.c skein_block.c From owner-svn-src-all@freebsd.org Fri Feb 2 07:39:35 2018 Return-Path: Delivered-To: svn-src-all@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 90B29EEADB7; Fri, 2 Feb 2018 07:39:35 +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 3C77F7EB8D; Fri, 2 Feb 2018 07:39:35 +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 2E80318C57; Fri, 2 Feb 2018 07:39:35 +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 w127dZsI092661; Fri, 2 Feb 2018 07:39:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w127dZAD092660; Fri, 2 Feb 2018 07:39:35 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802020739.w127dZAD092660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 2 Feb 2018 07:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328770 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 328770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 07:39:35 -0000 Author: ae Date: Fri Feb 2 07:39:34 2018 New Revision: 328770 URL: https://svnweb.freebsd.org/changeset/base/328770 Log: Merge r1.120 from NetBSD: Fix a pretty simple, yet pretty tragic typo: we should return IPPROTO_DONE, not IPPROTO_NONE. With IPPROTO_NONE we will keep parsing the header chain on an mbuf that was already freed. Reported by: Maxime Villard MFC after: 3 days Modified: head/sys/netinet6/ip6_mroute.c Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Fri Feb 2 06:32:26 2018 (r328769) +++ head/sys/netinet6/ip6_mroute.c Fri Feb 2 07:39:34 2018 (r328770) @@ -1857,7 +1857,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto) "of the inner packet", (eip6->ip6_vfc & IPV6_VERSION)); m_freem(m); - return (IPPROTO_NONE); + return (IPPROTO_DONE); } /* verify the inner packet is destined to a mcast group */ From owner-svn-src-all@freebsd.org Fri Feb 2 07:48:47 2018 Return-Path: Delivered-To: svn-src-all@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 80D92EC2569; Fri, 2 Feb 2018 07:48:47 +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 252A57F0FE; Fri, 2 Feb 2018 07:48:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BA9018E01; Fri, 2 Feb 2018 07:48:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w127mk7N097388; Fri, 2 Feb 2018 07:48:46 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w127mkSG097382; Fri, 2 Feb 2018 07:48:46 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802020748.w127mkSG097382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 2 Feb 2018 07:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328771 - stable/11/contrib/bsnmp/snmpd X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/contrib/bsnmp/snmpd X-SVN-Commit-Revision: 328771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 07:48:47 -0000 Author: ae Date: Fri Feb 2 07:48:46 2018 New Revision: 328771 URL: https://svnweb.freebsd.org/changeset/base/328771 Log: MFC r328160: Add to bsnmpd(1) ability to specify multiple community strings with different access rights. By default there are two community strings with index 1 and 2, one for read-only access and second for read-write access: begemotSnmpdCommunityString.0.1 = $(read) begemotSnmpdCommunityString.0.2 = $(write) Now it is possible to define additional community strings using different indexes: begemotSnmpdCommunityString.0.3 = "SomeString1" begemotSnmpdCommunityPermission.0.3 = 1 begemotSnmpdCommunityString.0.4 = "SomeString2" begemotSnmpdCommunityPermission.0.4 = 2 begemotSnmpdCommunityString.0.5 = "SomeString3" begemotSnmpdCommunityString.0.6 = "SomeString4" New attribute begemotSnmpdCommunityPermission can be used to specify access rights: 1 means "read-only" access, 2 means "read-write" access. If attribute is not specified for some index this means "read-only" rights. Community strings must be unique, i.e. must not be the same for different indexes. Obtained from: Yandex LLC Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D13785 MFC r328171: Rename "index" variable to "idx" since gcc complains that it shadows index(3) function declaration. Modified: stable/11/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt stable/11/contrib/bsnmp/snmpd/action.c stable/11/contrib/bsnmp/snmpd/main.c stable/11/contrib/bsnmp/snmpd/snmpd.config stable/11/contrib/bsnmp/snmpd/snmpmod.h stable/11/contrib/bsnmp/snmpd/tree.def Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt ============================================================================== --- stable/11/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt Fri Feb 2 07:39:34 2018 (r328770) +++ stable/11/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt Fri Feb 2 07:48:46 2018 (r328771) @@ -44,7 +44,7 @@ IMPORTS FROM BEGEMOT-MIB; begemotSnmpd MODULE-IDENTITY - LAST-UPDATED "200212040000Z" + LAST-UPDATED "201801190000Z" ORGANIZATION "Fraunhofer FOKUS, CATS" CONTACT-INFO " Hartmut Brandt @@ -274,7 +274,8 @@ BegemotSnmpdCommunityEntry ::= SEQUENCE { begemotSnmpdCommunityModule SectionName, begemotSnmpdCommunityIndex Unsigned32, begemotSnmpdCommunityString OCTET STRING, - begemotSnmpdCommunityDescr OCTET STRING + begemotSnmpdCommunityDescr OCTET STRING, + begemotSnmpdCommunityPermission INTEGER } begemotSnmpdCommunityModule OBJECT-TYPE @@ -309,6 +310,14 @@ begemotSnmpdCommunityDescr OBJECT-TYPE DESCRIPTION "A description what this community is good for." ::= { begemotSnmpdCommunityEntry 4 } + +begemotSnmpdCommunityPermission OBJECT-TYPE + SYNTAX INTEGER (1..4294967295) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The numerical value of access rights granted to the community." + ::= { begemotSnmpdCommunityEntry 5 } -- -- Module table Modified: stable/11/contrib/bsnmp/snmpd/action.c ============================================================================== --- stable/11/contrib/bsnmp/snmpd/action.c Fri Feb 2 07:39:34 2018 (r328770) +++ stable/11/contrib/bsnmp/snmpd/action.c Fri Feb 2 07:48:46 2018 (r328771) @@ -751,8 +751,9 @@ int op_community(struct snmp_context *ctx, struct snmp_value *value, u_int sub, u_int iidx __unused, enum snmp_op op) { - asn_subid_t which = value->var.subs[sub - 1]; + struct asn_oid idx; struct community *c; + asn_subid_t which = value->var.subs[sub - 1]; switch (op) { @@ -770,12 +771,47 @@ op_community(struct snmp_context *ctx, struct snmp_val break; case SNMP_OP_SET: - if ((community != COMM_INITIALIZE && snmpd.comm_dis) || - (c = FIND_OBJECT_OID(&community_list, &value->var, sub)) == NULL) - return (SNMP_ERR_NO_CREATION); - if (which != LEAF_begemotSnmpdCommunityString) + if (community != COMM_INITIALIZE && snmpd.comm_dis) return (SNMP_ERR_NOT_WRITEABLE); - return (string_save(value, ctx, -1, &c->string)); + idx.len = 2; + idx.subs[0] = 0; + idx.subs[1] = value->var.subs[value->var.len - 1]; + switch (which) { + case LEAF_begemotSnmpdCommunityString: + /* check that given string is unique */ + TAILQ_FOREACH(c, &community_list, link) { + if (!asn_compare_oid(&idx, &c->index)) + continue; + if (c->string != NULL && strcmp(c->string, + value->v.octetstring.octets) == 0) + return (SNMP_ERR_WRONG_VALUE); + } + case LEAF_begemotSnmpdCommunityPermission: + break; + default: + return (SNMP_ERR_NOT_WRITEABLE); + } + if ((c = FIND_OBJECT_OID(&community_list, &value->var, + sub)) == NULL) { + /* create new community and use user sepcified index */ + c = comm_define_ordered(COMM_READ, "SNMP Custom Community", + &idx, NULL, NULL); + if (c == NULL) + return (SNMP_ERR_NO_CREATION); + } + switch (which) { + case LEAF_begemotSnmpdCommunityString: + return (string_save(value, ctx, -1, &c->string)); + case LEAF_begemotSnmpdCommunityPermission: + if (value->v.integer != COMM_READ && + value->v.integer != COMM_WRITE) + return (SNMP_ERR_WRONG_VALUE); + c->private = value->v.integer; + break; + default: + return (SNMP_ERR_NOT_WRITEABLE); + } + return (SNMP_ERR_NOERROR); case SNMP_OP_ROLLBACK: if (which == LEAF_begemotSnmpdCommunityString) { @@ -786,6 +822,8 @@ op_community(struct snmp_context *ctx, struct snmp_val string_rollback(ctx, &c->string); return (SNMP_ERR_NOERROR); } + if (which == LEAF_begemotSnmpdCommunityPermission) + return (SNMP_ERR_NOERROR); abort(); case SNMP_OP_COMMIT: @@ -797,6 +835,8 @@ op_community(struct snmp_context *ctx, struct snmp_val string_commit(ctx); return (SNMP_ERR_NOERROR); } + if (which == LEAF_begemotSnmpdCommunityPermission) + return (SNMP_ERR_NOERROR); abort(); default: @@ -810,6 +850,12 @@ op_community(struct snmp_context *ctx, struct snmp_val case LEAF_begemotSnmpdCommunityDescr: return (string_get(value, c->descr, -1)); + + case LEAF_begemotSnmpdCommunityPermission: + value->v.integer = c->private; + return (SNMP_ERR_NOERROR); + default: + return (SNMP_ERR_NOT_WRITEABLE); } abort(); } Modified: stable/11/contrib/bsnmp/snmpd/main.c ============================================================================== --- stable/11/contrib/bsnmp/snmpd/main.c Fri Feb 2 07:39:34 2018 (r328770) +++ stable/11/contrib/bsnmp/snmpd/main.c Fri Feb 2 07:48:46 2018 (r328771) @@ -1160,8 +1160,8 @@ snmpd_input(struct port_input *pi, struct tport *tport */ if (pdu.version < SNMP_V3 && ((pi->cred && !pi->priv && pdu.type == SNMP_PDU_SET) || - (community != COMM_WRITE && - (pdu.type == SNMP_PDU_SET || community != COMM_READ)))) { + (comm != NULL && comm->private != COMM_WRITE && + (pdu.type == SNMP_PDU_SET || comm->private != COMM_READ)))) { snmpd_stats.inBadCommunityUses++; snmp_pdu_free(&pdu); snmp_input_consume(pi); @@ -1609,8 +1609,8 @@ main(int argc, char *argv[]) /* * Get standard communities */ - (void)comm_define(1, "SNMP read", NULL, NULL); - (void)comm_define(2, "SNMP write", NULL, NULL); + comm_define(COMM_READ, "SNMP read", NULL, NULL); + comm_define(COMM_WRITE, "SNMP write", NULL, NULL); community = COMM_INITIALIZE; trap_reqid = reqid_allocate(512, NULL); @@ -2027,25 +2027,23 @@ asn_error_func(const struct asn_buf *b, const char *er /* * Create a new community */ -u_int -comm_define(u_int priv, const char *descr, struct lmodule *owner, - const char *str) +struct community* +comm_define_ordered(u_int priv, const char *descr, struct asn_oid *idx, + struct lmodule *owner, const char *str) { struct community *c, *p; u_int ncomm; - /* generate an identifier */ - do { - if ((ncomm = next_community_index++) == UINT_MAX) - next_community_index = 1; - TAILQ_FOREACH(c, &community_list, link) - if (c->value == ncomm) - break; - } while (c != NULL); + ncomm = idx->subs[idx->len - 1]; + /* check that community doesn't already exist */ + TAILQ_FOREACH(c, &community_list, link) + if (c->value == ncomm) + return (c); + if ((c = malloc(sizeof(struct community))) == NULL) { - syslog(LOG_ERR, "comm_define: %m"); - return (0); + syslog(LOG_ERR, "%s: %m", __func__); + return (NULL); } c->owner = owner; c->value = ncomm; @@ -2056,23 +2054,14 @@ comm_define(u_int priv, const char *descr, struct lmod if (str != NULL) { if((c->string = malloc(strlen(str)+1)) == NULL) { free(c); - return (0); + return (NULL); } strcpy(c->string, str); } - - /* make index */ - if (c->owner == NULL) { - c->index.len = 1; - c->index.subs[0] = 0; - } else { - c->index = c->owner->index; - } - c->index.subs[c->index.len++] = c->private; - /* * Insert ordered */ + c->index = *idx; TAILQ_FOREACH(p, &community_list, link) { if (asn_compare_oid(&p->index, &c->index) > 0) { TAILQ_INSERT_BEFORE(p, c, link); @@ -2081,6 +2070,38 @@ comm_define(u_int priv, const char *descr, struct lmod } if (p == NULL) TAILQ_INSERT_TAIL(&community_list, c, link); + return (c); +} + +u_int +comm_define(u_int priv, const char *descr, struct lmodule *owner, + const char *str) +{ + struct asn_oid idx, *p; + struct community *c; + u_int ncomm; + + /* generate an identifier */ + do { + if ((ncomm = next_community_index++) == UINT_MAX) + next_community_index = 1; + TAILQ_FOREACH(c, &community_list, link) + if (c->value == ncomm) + break; + } while (c != NULL); + + /* make index */ + if (owner != NULL) + p = &owner->index; + else { + p = &idx; + p->len = 1; + p->subs[0] = 0; + } + p->subs[p->len++] = ncomm; + c = comm_define_ordered(priv, descr, p, owner, str); + if (c == NULL) + return (0); return (c->value); } Modified: stable/11/contrib/bsnmp/snmpd/snmpd.config ============================================================================== --- stable/11/contrib/bsnmp/snmpd/snmpd.config Fri Feb 2 07:39:34 2018 (r328770) +++ stable/11/contrib/bsnmp/snmpd/snmpd.config Fri Feb 2 07:48:46 2018 (r328771) @@ -68,6 +68,7 @@ begemotSnmpdDebugSyslogPri = 7 # begemotSnmpdCommunityString.0.1 = $(read) # begemotSnmpdCommunityString.0.2 = $(write) +# begemotSnmpdCommunityString.0.3 = "otherPublic" begemotSnmpdCommunityDisable = 1 # open standard SNMP ports Modified: stable/11/contrib/bsnmp/snmpd/snmpmod.h ============================================================================== --- stable/11/contrib/bsnmp/snmpd/snmpmod.h Fri Feb 2 07:39:34 2018 (r328770) +++ stable/11/contrib/bsnmp/snmpd/snmpmod.h Fri Feb 2 07:48:46 2018 (r328771) @@ -334,6 +334,8 @@ extern struct systemg systemg; #define COMM_WRITE 2 u_int comm_define(u_int, const char *descr, struct lmodule *, const char *str); +struct community *comm_define_ordered(u_int priv, const char *descr, + struct asn_oid *index, struct lmodule *owner, const char *str); const char * comm_string(u_int); /* community for current packet */ Modified: stable/11/contrib/bsnmp/snmpd/tree.def ============================================================================== --- stable/11/contrib/bsnmp/snmpd/tree.def Fri Feb 2 07:39:34 2018 (r328770) +++ stable/11/contrib/bsnmp/snmpd/tree.def Fri Feb 2 07:48:46 2018 (r328771) @@ -135,6 +135,7 @@ typedef RowStatus ENUM ( (2 begemotSnmpdCommunityIndex UNSIGNED32) (3 begemotSnmpdCommunityString OCTETSTRING GET SET) (4 begemotSnmpdCommunityDescr OCTETSTRING GET) + (5 begemotSnmpdCommunityPermission INTEGER GET SET) )) # # Module table From owner-svn-src-all@freebsd.org Fri Feb 2 07:55:32 2018 Return-Path: Delivered-To: svn-src-all@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 7858EEC2A6A; Fri, 2 Feb 2018 07:55:32 +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 2A7697F5A2; Fri, 2 Feb 2018 07:55:32 +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 206EC18F94; Fri, 2 Feb 2018 07:55:32 +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 w127tVYG002580; Fri, 2 Feb 2018 07:55:31 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w127tVdC002577; Fri, 2 Feb 2018 07:55:31 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802020755.w127tVdC002577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 2 Feb 2018 07:55:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328772 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netpfil/ipfw X-SVN-Commit-Revision: 328772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 07:55:32 -0000 Author: ae Date: Fri Feb 2 07:55:31 2018 New Revision: 328772 URL: https://svnweb.freebsd.org/changeset/base/328772 Log: MFC r328161: Add UDPLite support to ipfw(4). Now it is possible to use UDPLite's port numbers in rules, create dynamic states for UDPLite packets and see "UDPLite" for matched packets in log. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c stable/11/sys/netpfil/ipfw/ip_fw_log.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw2.c Fri Feb 2 07:48:46 2018 (r328771) +++ stable/11/sys/netpfil/ipfw/ip_fw2.c Fri Feb 2 07:55:31 2018 (r328772) @@ -850,6 +850,9 @@ check_uidgid(ipfw_insn_u32 *insn, struct ip_fw_args *a } else if (id->proto == IPPROTO_UDP) { lookupflags = INPLOOKUP_WILDCARD; pi = &V_udbinfo; + } else if (id->proto == IPPROTO_UDPLITE) { + lookupflags = INPLOOKUP_WILDCARD; + pi = &V_ulitecbinfo; } else return 0; lookupflags |= INPLOOKUP_RLOCKPCB; @@ -1209,6 +1212,7 @@ do { \ break; case IPPROTO_UDP: + case IPPROTO_UDPLITE: PULLUP_TO(hlen, ulp, struct udphdr); dst_port = UDP(ulp)->uh_dport; src_port = UDP(ulp)->uh_sport; @@ -1386,6 +1390,7 @@ do { \ break; case IPPROTO_UDP: + case IPPROTO_UDPLITE: PULLUP_TO(hlen, ulp, struct udphdr); dst_port = UDP(ulp)->uh_dport; src_port = UDP(ulp)->uh_sport; @@ -1517,7 +1522,8 @@ do { \ if (offset != 0) break; if (proto == IPPROTO_TCP || - proto == IPPROTO_UDP) + proto == IPPROTO_UDP || + proto == IPPROTO_UDPLITE) match = check_uidgid( (ipfw_insn_u32 *)cmd, args, &ucred_lookup, @@ -1656,6 +1662,7 @@ do { \ /* Skip proto without ports */ if (proto != IPPROTO_TCP && proto != IPPROTO_UDP && + proto != IPPROTO_UDPLITE && proto != IPPROTO_SCTP) break; if (vidx == 2 /* dst-port */) @@ -1812,8 +1819,9 @@ do { \ * to guarantee that we have a * packet with port info. */ - if ((proto==IPPROTO_UDP || proto==IPPROTO_TCP) - && offset == 0) { + if ((proto == IPPROTO_UDP || + proto == IPPROTO_UDPLITE || + proto == IPPROTO_TCP) && offset == 0) { u_int16_t x = (cmd->opcode == O_IP_SRCPORT) ? src_port : dst_port ; @@ -2200,6 +2208,8 @@ do { \ pi = &V_tcbinfo; else if (proto == IPPROTO_UDP) pi = &V_udbinfo; + else if (proto == IPPROTO_UDPLITE) + pi = &V_ulitecbinfo; else break; Modified: stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Feb 2 07:48:46 2018 (r328771) +++ stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Feb 2 07:55:31 2018 (r328772) @@ -582,7 +582,8 @@ dyn_update_proto_state(ipfw_dyn_rule *q, const struct q->expire = time_uptime + V_dyn_rst_lifetime; break; } - } else if (id->proto == IPPROTO_UDP) { + } else if (id->proto == IPPROTO_UDP || + id->proto == IPPROTO_UDPLITE) { q->expire = time_uptime + V_dyn_udp_lifetime; } else { /* other protocols */ Modified: stable/11/sys/netpfil/ipfw/ip_fw_log.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_log.c Fri Feb 2 07:48:46 2018 (r328771) +++ stable/11/sys/netpfil/ipfw/ip_fw_log.c Fri Feb 2 07:55:31 2018 (r328772) @@ -332,7 +332,10 @@ ipfw_log(struct ip_fw_chain *chain, struct ip_fw *f, u break; case IPPROTO_UDP: - len = snprintf(SNPARGS(proto, 0), "UDP %s", src); + case IPPROTO_UDPLITE: + len = snprintf(SNPARGS(proto, 0), "UDP%s%s", + args->f_id.proto == IPPROTO_UDP ? " ": "Lite ", + src); if (offset == 0) snprintf(SNPARGS(proto, len), ":%d %s:%d", ntohs(udp->uh_sport), From owner-svn-src-all@freebsd.org Fri Feb 2 11:56:30 2018 Return-Path: Delivered-To: svn-src-all@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 E087EED3357; Fri, 2 Feb 2018 11:56:30 +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 94578681EB; Fri, 2 Feb 2018 11:56:30 +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 8F4911B654; Fri, 2 Feb 2018 11:56:30 +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 w12BuU3X024204; Fri, 2 Feb 2018 11:56:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12BuUbj024203; Fri, 2 Feb 2018 11:56:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802021156.w12BuUbj024203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Feb 2018 11:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328773 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 328773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 11:56:31 -0000 Author: kib Date: Fri Feb 2 11:56:30 2018 New Revision: 328773 URL: https://svnweb.freebsd.org/changeset/base/328773 Log: On pageout, in vnode generic pager, for partially dirty page, only clear dirty bits for completely invalid blocks. Otherwise we might not write out the last chunk that is shorter than 512 bytes, if the file end is not aligned on disk block boundary. This become important after the r324794. PR: 225586 Reported by: tris_vern@hotmail.com Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Fri Feb 2 07:55:31 2018 (r328772) +++ head/sys/vm/vnode_pager.c Fri Feb 2 11:56:30 2018 (r328773) @@ -1266,6 +1266,8 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page maxsize = object->un_pager.vnp.vnp_size - poffset; ncount = btoc(maxsize); if ((pgoff = (int)maxsize & PAGE_MASK) != 0) { + pgoff = roundup2(pgoff, DEV_BSIZE); + /* * If the object is locked and the following * conditions hold, then the page's dirty From owner-svn-src-all@freebsd.org Fri Feb 2 12:42:47 2018 Return-Path: Delivered-To: svn-src-all@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 A455BED73FB; Fri, 2 Feb 2018 12:42:47 +0000 (UTC) (envelope-from hselasky@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 F21D969D7C; Fri, 2 Feb 2018 12:42:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED1311BE4E; Fri, 2 Feb 2018 12:42:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12CgkYH048664; Fri, 2 Feb 2018 12:42:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12CgkRX048663; Fri, 2 Feb 2018 12:42:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802021242.w12CgkRX048663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 2 Feb 2018 12:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328774 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 12:42:47 -0000 Author: hselasky Date: Fri Feb 2 12:42:46 2018 New Revision: 328774 URL: https://svnweb.freebsd.org/changeset/base/328774 Log: Slightly bump the maximum OID path for loading tunable SYSCTLs. Coming updates to the mlx5en(4) driver will require this. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Fri Feb 2 11:56:30 2018 (r328773) +++ head/sys/kern/kern_sysctl.c Fri Feb 2 12:42:46 2018 (r328774) @@ -190,7 +190,7 @@ sysctl_load_tunable_by_oid_locked(struct sysctl_oid *o struct sysctl_req req; struct sysctl_oid *curr; char *penv = NULL; - char path[64]; + char path[96]; ssize_t rem = sizeof(path); ssize_t len; uint8_t val_8; From owner-svn-src-all@freebsd.org Fri Feb 2 12:57:34 2018 Return-Path: Delivered-To: svn-src-all@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 E1EE8ED7F52; Fri, 2 Feb 2018 12:57:33 +0000 (UTC) (envelope-from avg@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 9216E6A68E; Fri, 2 Feb 2018 12:57:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88DB61BFE3; Fri, 2 Feb 2018 12:57:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12CvX0p053616; Fri, 2 Feb 2018 12:57:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12CvXmn053615; Fri, 2 Feb 2018 12:57:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802021257.w12CvXmn053615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 2 Feb 2018 12:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328776 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 12:57:34 -0000 Author: avg Date: Fri Feb 2 12:57:33 2018 New Revision: 328776 URL: https://svnweb.freebsd.org/changeset/base/328776 Log: ZFS ARC: restore illumos uses of 'needfree' that were removed in r325851 This is purely a cosmetic change to have a more complete copy of ifdef-ed out illumos code. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Feb 2 12:52:42 2018 (r328775) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Feb 2 12:57:33 2018 (r328776) @@ -4236,6 +4236,7 @@ arc_available_memory(void) free_memory_reason_t r = FMR_UNKNOWN; #ifdef _KERNEL +#ifdef __FreeBSD__ /* * Cooperate with pagedaemon when it's time for it to scan * and reclaim some pages. @@ -4246,7 +4247,15 @@ arc_available_memory(void) r = FMR_LOTSFREE; } -#ifdef illumos +#else + if (needfree > 0) { + n = PAGESIZE * (-needfree); + if (n < lowest) { + lowest = n; + r = FMR_NEEDFREE; + } + } + /* * check that we're out of range of the pageout scanner. It starts to * schedule paging if freemem is less than lotsfree and needfree. @@ -4289,7 +4298,7 @@ arc_available_memory(void) r = FMR_PAGES_PP_MAXIMUM; } -#endif /* illumos */ +#endif /* __FreeBSD__ */ #if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC) /* * If we're on an i386 platform, it's possible that we'll exhaust the @@ -4482,6 +4491,11 @@ arc_reclaim_thread(void *dummy __unused) int64_t to_free = (arc_c >> arc_shrink_shift) - free_memory; if (to_free > 0) { +#ifdef _KERNEL +#ifdef illumos + to_free = MAX(to_free, ptob(needfree)); +#endif +#endif arc_shrink(to_free); } } else if (free_memory < arc_c >> arc_no_grow_shift) { From owner-svn-src-all@freebsd.org Fri Feb 2 14:47:26 2018 Return-Path: Delivered-To: svn-src-all@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 9AFD8EDCF1F; Fri, 2 Feb 2018 14:47:26 +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 48B476E246; Fri, 2 Feb 2018 14:47:26 +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 43B561D1A9; Fri, 2 Feb 2018 14:47:26 +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 w12ElQTZ008678; Fri, 2 Feb 2018 14:47:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12ElQAK008677; Fri, 2 Feb 2018 14:47:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802021447.w12ElQAK008677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 2 Feb 2018 14:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328778 - stable/11/sys/boot/fdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/boot/fdt X-SVN-Commit-Revision: 328778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 14:47:27 -0000 Author: kevans Date: Fri Feb 2 14:47:25 2018 New Revision: 328778 URL: https://svnweb.freebsd.org/changeset/base/328778 Log: MFC r328584: stand/fdt: Remove unused write-only new_fdtp, correct comment This is effectively a direct commit to stable/11 due to path restructuring in HEAD. The diff against HEAD has simply been applied to the old path. Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Feb 2 14:33:57 2018 (r328777) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Feb 2 14:47:25 2018 (r328778) @@ -379,7 +379,6 @@ fdt_apply_overlays() size_t max_overlay_size, next_fdtp_size; size_t current_fdtp_size; void *current_fdtp; - void *new_fdtp; void *next_fdtp; void *overlay; int rv; @@ -387,7 +386,6 @@ fdt_apply_overlays() if ((fdtp == NULL) || (fdtp_size == 0)) return; - new_fdtp = NULL; max_overlay_size = 0; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { if (max_overlay_size < fp->f_size) @@ -424,7 +422,7 @@ fdt_apply_overlays() continue; } COPYOUT(fp->f_addr, overlay, fp->f_size); - /* Both overlay and new_fdtp may be modified in place */ + /* Both overlay and next_fdtp may be modified in place */ rv = fdt_overlay_apply(next_fdtp, overlay); if (rv == 0) { /* Rotate next -> current */ From owner-svn-src-all@freebsd.org Fri Feb 2 15:01:34 2018 Return-Path: Delivered-To: svn-src-all@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 15E59EDDB77; Fri, 2 Feb 2018 15:01: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 BEF006EB4B; Fri, 2 Feb 2018 15:01:33 +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 BA0781D494; Fri, 2 Feb 2018 15:01:33 +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 w12F1X1U015277; Fri, 2 Feb 2018 15:01:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12F1XcZ015276; Fri, 2 Feb 2018 15:01:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802021501.w12F1XcZ015276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 15:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328779 - in head/stand: common forth X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: common forth X-SVN-Commit-Revision: 328779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 15:01:34 -0000 Author: imp Date: Fri Feb 2 15:01:33 2018 New Revision: 328779 URL: https://svnweb.freebsd.org/changeset/base/328779 Log: Retire pnp.4th and the code needed only for 4th words used here. This has never been installed. It was added to the tree disconnected to the build in FreeBSD 5 (17 years ago) and has never been used as far as I can tell. The desired improvements never really happened (despite a couple minor cleanups along the way). It's relevance is long past, so better to retire it. Deleted: head/stand/forth/pnp.4th Modified: head/stand/common/pnp.c Modified: head/stand/common/pnp.c ============================================================================== --- head/stand/common/pnp.c Fri Feb 2 14:47:25 2018 (r328778) +++ head/stand/common/pnp.c Fri Feb 2 15:01:33 2018 (r328779) @@ -17,9 +17,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef BOOT_FORTH -#include "ficl.h" -#endif static struct pnpinfo_stql pnp_devices; static int pnp_devices_initted = 0; @@ -187,50 +184,3 @@ pnp_eisaformat(u_int8_t *data) idbuf[7] = 0; return(idbuf); } - -#ifdef BOOT_FORTH -void -ficlPnpdevices(FICL_VM *pVM) -{ - static int pnp_devices_initted = 0; -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 0, 1); -#endif - - if(!pnp_devices_initted) { - STAILQ_INIT(&pnp_devices); - pnp_devices_initted = 1; - } - - stackPushPtr(pVM->pStack, &pnp_devices); - - return; -} - -void -ficlPnphandlers(FICL_VM *pVM) -{ -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 0, 1); -#endif - - stackPushPtr(pVM->pStack, pnphandlers); - - return; -} - -/* - * Glue function to add the appropriate forth words to access pnp BIOS - * functionality. - */ -static void ficlCompilePnp(FICL_SYSTEM *pSys) -{ - FICL_DICT *dp = pSys->dp; - assert (dp); - - dictAppendWord(dp, "pnpdevices",ficlPnpdevices, FW_DEFAULT); - dictAppendWord(dp, "pnphandlers",ficlPnphandlers, FW_DEFAULT); -} - -FICL_COMPILE_SET(ficlCompilePnp); -#endif From owner-svn-src-all@freebsd.org Fri Feb 2 15:01:45 2018 Return-Path: Delivered-To: svn-src-all@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 4F521EDDBA3; Fri, 2 Feb 2018 15:01:45 +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 058F96EC4C; Fri, 2 Feb 2018 15:01:45 +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 DBD3F1D4A5; Fri, 2 Feb 2018 15:01:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12F1isU015335; Fri, 2 Feb 2018 15:01:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12F1iL0015330; Fri, 2 Feb 2018 15:01:44 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802021501.w12F1iL0015330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 15:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328780 - in head: . stand/efi/libefi stand/forth X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . stand/efi/libefi stand/forth X-SVN-Commit-Revision: 328780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 15:01:45 -0000 Author: imp Date: Fri Feb 2 15:01:44 2018 New Revision: 328780 URL: https://svnweb.freebsd.org/changeset/base/328780 Log: These 4th words were an attempt to allow integration into the boot loader scripts. However, that path won't be taken after all it seems. Remove this code before it decays into uselessness. Also remove build dependencies on forth no longer needed. Modified: head/ObsoleteFiles.inc head/stand/efi/libefi/Makefile head/stand/efi/libefi/env.c head/stand/forth/Makefile head/stand/forth/loader.4th Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Feb 2 15:01:33 2018 (r328779) +++ head/ObsoleteFiles.inc Fri Feb 2 15:01:44 2018 (r328780) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20180201: Obsolete forth files +OLD_FILES+=boot/efi.4th + # 20180114: new clang import which bumps version from 5.0.1 to 6.0.0. OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/asan_interface.h Modified: head/stand/efi/libefi/Makefile ============================================================================== --- head/stand/efi/libefi/Makefile Fri Feb 2 15:01:33 2018 (r328779) +++ head/stand/efi/libefi/Makefile Fri Feb 2 15:01:44 2018 (r328780) @@ -2,10 +2,6 @@ .include -.if ${MK_FORTH} != "no" -.include "${BOOTSRC}/ficl.mk" -.endif - LIB= efi WARNS?= 2 Modified: head/stand/efi/libefi/env.c ============================================================================== --- head/stand/efi/libefi/env.c Fri Feb 2 15:01:33 2018 (r328779) +++ head/stand/efi/libefi/env.c Fri Feb 2 15:01:44 2018 (r328780) @@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include "bootstrap.h" -#ifdef BOOT_FORTH -#include "ficl.h" -#endif /* * Simple wrappers to the underlying UEFI functions. @@ -375,160 +372,3 @@ command_efi_unset(int argc, char *argv[]) } return (CMD_OK); } - -#ifdef BOOT_FORTH -/* - * FreeBSD's loader interaction words and extras - * - * efi-setenv ( value n name n guid n attr -- 0 | -1) - * efi-getenv ( guid n addr n -- addr' n' | -1 ) - * efi-unsetenv ( name n guid n'' -- ) - */ - -/* - * efi-setenv - * efi-setenv ( value n name n guid n attr -- 0 | -1) - * - * Set environment variables using the SetVariable EFI runtime service. - * - * Value and guid are passed through in binary form (so guid needs to be - * converted to binary form from its string form). Name is converted from - * ASCII to CHAR16. Since ficl doesn't have support for internationalization, - * there's no native CHAR16 interface provided. - * - * attr is an int in the bitmask of the following attributes for this variable. - * - * 1 Non volatile - * 2 Boot service access - * 4 Run time access - * (corresponding to the same bits in the UEFI spec). - */ -static void -ficlEfiSetenv(FICL_VM *pVM) -{ - char *value = NULL, *guid = NULL; - CHAR16 *name = NULL; - int i; - char *namep, *valuep, *guidp; - int names, values, guids, attr; - EFI_STATUS status; - uuid_t u; - uint32_t ustatus; - bool error = true; - -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 6, 0); -#endif - attr = stackPopINT(pVM->pStack); - guids = stackPopINT(pVM->pStack); - guidp = (char*)stackPopPtr(pVM->pStack); - names = stackPopINT(pVM->pStack); - namep = (char*)stackPopPtr(pVM->pStack); - values = stackPopINT(pVM->pStack); - valuep = (char*)stackPopPtr(pVM->pStack); - - guid = (char*)ficlMalloc(guids); - if (guid == NULL) - goto out; - memcpy(guid, guidp, guids); - uuid_from_string(guid, &u, &ustatus); - if (ustatus != uuid_s_ok) { - stackPushINT(pVM->pStack, -1); - goto out; - } - - name = ficlMalloc((names + 1) * sizeof(CHAR16)); - if (name == NULL) - goto out; - for (i = 0; i < names; i++) - name[i] = namep[i]; - name[names] = 0; - - value = ficlMalloc(values + 1); - if (value == NULL) - goto out; - memcpy(value, valuep, values); - - status = efi_set_variable(name, (EFI_GUID *)&u, attr, values, value); - if (status == EFI_SUCCESS) - stackPushINT(pVM->pStack, 0); - else - stackPushINT(pVM->pStack, -1); - error = false; -out: - ficlFree(name); - ficlFree(value); - ficlFree(guid); - - if (error == true) - vmThrowErr(pVM, "Error: out of memory"); -} - -static void -ficlEfiGetenv(FICL_VM *pVM) -{ - char *name, *value; - char *namep; - int names; - -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 2, 2); -#endif - names = stackPopINT(pVM->pStack); - namep = (char*) stackPopPtr(pVM->pStack); - - name = (char*) ficlMalloc(names+1); - if (name == NULL) - vmThrowErr(pVM, "Error: out of memory"); - strncpy(name, namep, names); - name[names] = '\0'; - - value = getenv(name); - ficlFree(name); - - if(value != NULL) { - stackPushPtr(pVM->pStack, value); - stackPushINT(pVM->pStack, strlen(value)); - } else - stackPushINT(pVM->pStack, -1); -} - -static void -ficlEfiUnsetenv(FICL_VM *pVM) -{ - char *name; - char *namep; - int names; - -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 2, 0); -#endif - names = stackPopINT(pVM->pStack); - namep = (char*) stackPopPtr(pVM->pStack); - - name = (char*) ficlMalloc(names+1); - if (name == NULL) - vmThrowErr(pVM, "Error: out of memory"); - strncpy(name, namep, names); - name[names] = '\0'; - - unsetenv(name); - ficlFree(name); -} - -/************************************************************************** -** Add FreeBSD UEFI platform extensions into the system dictionary -**************************************************************************/ -void ficlEfiCompilePlatform(FICL_SYSTEM *pSys) -{ - FICL_DICT *dp = pSys->dp; - assert (dp); - - dictAppendWord(dp, "efi-setenv", ficlEfiSetenv, FW_DEFAULT); - dictAppendWord(dp, "efi-getenv", ficlEfiGetenv, FW_DEFAULT); - dictAppendWord(dp, "efi-unsetenv", ficlEfiUnsetenv, FW_DEFAULT); -} - -FICL_COMPILE_SET(ficlEfiCompilePlatform); - -#endif /* BOOT_FORTH */ Modified: head/stand/forth/Makefile ============================================================================== --- head/stand/forth/Makefile Fri Feb 2 15:01:33 2018 (r328779) +++ head/stand/forth/Makefile Fri Feb 2 15:01:44 2018 (r328780) @@ -19,7 +19,6 @@ FILES+= brand-fbsd.4th FILES+= check-password.4th FILES+= color.4th FILES+= delay.4th -FILES+= efi.4th FILES+= frames.4th FILES+= loader.4th FILES+= logo-beastie.4th Modified: head/stand/forth/loader.4th ============================================================================== --- head/stand/forth/loader.4th Fri Feb 2 15:01:33 2018 (r328779) +++ head/stand/forth/loader.4th Fri Feb 2 15:01:44 2018 (r328780) @@ -46,9 +46,6 @@ include /boot/support.4th include /boot/color.4th include /boot/delay.4th include /boot/check-password.4th -s" efi-version" getenv? [if] - include /boot/efi.4th -[then] only forth definitions From owner-svn-src-all@freebsd.org Fri Feb 2 15:01:53 2018 Return-Path: Delivered-To: svn-src-all@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 4836EEDDBF5; Fri, 2 Feb 2018 15:01: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 C33AB6ECE5; Fri, 2 Feb 2018 15:01:50 +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 D54651D4AE; Fri, 2 Feb 2018 15:01:49 +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 w12F1nKV016172; Fri, 2 Feb 2018 15:01:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12F1nG2016169; Fri, 2 Feb 2018 15:01:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802021501.w12F1nG2016169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 15:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328781 - in head: . stand/forth stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . stand/forth stand/i386/libi386 X-SVN-Commit-Revision: 328781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 15:01:53 -0000 Author: imp Date: Fri Feb 2 15:01:49 2018 New Revision: 328781 URL: https://svnweb.freebsd.org/changeset/base/328781 Log: Remove pcibios forth support. I had thought that this would be useful. However it was committed too late, and wound up being unused. It's in the way of future work now, so retire it rather than bring it forward. Deleted: head/stand/forth/pcibios.4th Modified: head/ObsoleteFiles.inc head/stand/forth/Makefile head/stand/i386/libi386/biospci.c Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Feb 2 15:01:44 2018 (r328780) +++ head/ObsoleteFiles.inc Fri Feb 2 15:01:49 2018 (r328781) @@ -40,6 +40,7 @@ # 20180201: Obsolete forth files OLD_FILES+=boot/efi.4th +OLD_FILES+=boot/pcibios.4th # 20180114: new clang import which bumps version from 5.0.1 to 6.0.0. OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h Modified: head/stand/forth/Makefile ============================================================================== --- head/stand/forth/Makefile Fri Feb 2 15:01:44 2018 (r328780) +++ head/stand/forth/Makefile Fri Feb 2 15:01:49 2018 (r328781) @@ -29,7 +29,6 @@ FILES+= logo-orbbw.4th FILES+= menu.4th FILES+= menu-commands.4th FILES+= menusets.4th -FILES+= pcibios.4th FILES+= screen.4th FILES+= shortcuts.4th FILES+= support.4th Modified: head/stand/i386/libi386/biospci.c ============================================================================== --- head/stand/i386/libi386/biospci.c Fri Feb 2 15:01:44 2018 (r328780) +++ head/stand/i386/libi386/biospci.c Fri Feb 2 15:01:49 2018 (r328781) @@ -38,9 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include "libi386.h" -#ifdef BOOT_FORTH -#include "ficl.h" -#endif /* * Stupid PCI BIOS interface doesn't let you simply enumerate everything @@ -406,183 +403,3 @@ biospci_locator(int8_t bus, uint8_t device, uint8_t fu return ((bus << 8) | ((device & 0x1f) << 3) | (function & 0x7)); } - -/* - * Counts the number of instances of devid we have in the system, as least as - * far as the PCI BIOS is able to tell. - */ -static int -biospci_count_device_type(uint32_t devid) -{ - int i; - - for (i = 0; 1; i++) { - v86.ctl = V86_FLAGS; - v86.addr = PCI_INT; - v86.eax = FIND_PCI_DEVICE; - v86.edx = devid & 0xffff; /* EDX - Vendor ID */ - v86.ecx = (devid >> 16) & 0xffff; /* ECX - Device ID */ - v86.esi = i; - v86int(); - if (V86_CY(v86.efl) || (v86.eax & 0xff00)) - break; - - } - return i; -} - -#ifdef BOOT_FORTH -/* - * pcibios-device-count (devid -- count) - * - * Returns the PCI BIOS' count of how many devices matching devid are in the system. - * devid is the 32-bit vendor + device. - */ -static void -ficlPciBiosCountDevices(FICL_VM *pVM) -{ - uint32_t devid; - int i; - - devid = stackPopINT(pVM->pStack); - - i = biospci_count_device_type(devid); - - stackPushINT(pVM->pStack, i); -} - -/* - * pcibios-write-config (locator offset width value -- ) - * - * Writes the specified config register. - * Locator is bus << 8 | device << 3 | fuction - * offset is the pci config register - * width is 0 for byte, 1 for word, 2 for dword - * value is the value to write - */ -static void -ficlPciBiosWriteConfig(FICL_VM *pVM) -{ - uint32_t value, width, offset, locator; - - value = stackPopINT(pVM->pStack); - width = stackPopINT(pVM->pStack); - offset = stackPopINT(pVM->pStack); - locator = stackPopINT(pVM->pStack); - - biospci_write_config(locator, offset, width, value); -} - -/* - * pcibios-read-config (locator offset width -- value) - * - * Reads the specified config register. - * Locator is bus << 8 | device << 3 | fuction - * offset is the pci config register - * width is 0 for byte, 1 for word, 2 for dword - * value is the value to read from the register - */ -static void -ficlPciBiosReadConfig(FICL_VM *pVM) -{ - uint32_t value, width, offset, locator; - - width = stackPopINT(pVM->pStack); - offset = stackPopINT(pVM->pStack); - locator = stackPopINT(pVM->pStack); - - biospci_read_config(locator, offset, width, &value); - - stackPushINT(pVM->pStack, value); -} - -/* - * pcibios-find-devclass (class index -- locator) - * - * Finds the index'th instance of class in the pci tree. - * must be an exact match. - * class is the class to search for. - * index 0..N (set to 0, increment until error) - * - * Locator is bus << 8 | device << 3 | fuction (or -1 on error) - */ -static void -ficlPciBiosFindDevclass(FICL_VM *pVM) -{ - uint32_t index, class, locator; - - index = stackPopINT(pVM->pStack); - class = stackPopINT(pVM->pStack); - - if (biospci_find_devclass(class, index, &locator)) - locator = 0xffffffff; - - stackPushINT(pVM->pStack, locator); -} - -/* - * pcibios-find-device(devid index -- locator) - * - * Finds the index'th instance of devid in the pci tree. - * must be an exact match. - * class is the class to search for. - * index 0..N (set to 0, increment until error) - * - * Locator is bus << 8 | device << 3 | fuction (or -1 on error) - */ -static void -ficlPciBiosFindDevice(FICL_VM *pVM) -{ - uint32_t index, devid, locator; - - index = stackPopINT(pVM->pStack); - devid = stackPopINT(pVM->pStack); - - if (biospci_find_device(devid, index, &locator)) - locator = 0xffffffff; - - stackPushINT(pVM->pStack, locator); -} - -/* - * pcibios-find-device(bus device function -- locator) - * - * converts bus, device, function to locator. - * - * Locator is bus << 8 | device << 3 | fuction - */ -static void -ficlPciBiosLocator(FICL_VM *pVM) -{ - uint32_t bus, device, function, locator; - - function = stackPopINT(pVM->pStack); - device = stackPopINT(pVM->pStack); - bus = stackPopINT(pVM->pStack); - - locator = biospci_locator(bus, device, function); - - stackPushINT(pVM->pStack, locator); -} - -/* - * Glue function to add the appropriate forth words to access pci bios - * functionality. - */ -static void ficlCompilePciBios(FICL_SYSTEM *pSys) -{ - FICL_DICT *dp = pSys->dp; - assert (dp); - - dictAppendWord(dp, "pcibios-device-count", ficlPciBiosCountDevices, FW_DEFAULT); - dictAppendWord(dp, "pcibios-read-config", ficlPciBiosReadConfig, FW_DEFAULT); - dictAppendWord(dp, "pcibios-write-config", ficlPciBiosWriteConfig, FW_DEFAULT); - dictAppendWord(dp, "pcibios-find-devclass", ficlPciBiosFindDevclass, FW_DEFAULT); - dictAppendWord(dp, "pcibios-find-device", ficlPciBiosFindDevice, FW_DEFAULT); - dictAppendWord(dp, "pcibios-locator", ficlPciBiosLocator, FW_DEFAULT); - - ficlSetEnv(pSys, "pcibios-version", biospci_version); -} - -FICL_COMPILE_SET(ficlCompilePciBios); -#endif From owner-svn-src-all@freebsd.org Fri Feb 2 15:01:54 2018 Return-Path: Delivered-To: svn-src-all@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 DAB2CEDDBFB; Fri, 2 Feb 2018 15:01:54 +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 87E6F6ED78; Fri, 2 Feb 2018 15:01:54 +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 7F9A71D4B2; Fri, 2 Feb 2018 15:01:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12F1sNO016225; Fri, 2 Feb 2018 15:01:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12F1s1F016224; Fri, 2 Feb 2018 15:01:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802021501.w12F1s1F016224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 15:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328782 - head/stand X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand X-SVN-Commit-Revision: 328782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 15:01:55 -0000 Author: imp Date: Fri Feb 2 15:01:54 2018 New Revision: 328782 URL: https://svnweb.freebsd.org/changeset/base/328782 Log: Now that we no longer conditionally compile some files outside of ficl with BOOT_FORTH, retire it from here. Modified: head/stand/ficl.mk Modified: head/stand/ficl.mk ============================================================================== --- head/stand/ficl.mk Fri Feb 2 15:01:49 2018 (r328781) +++ head/stand/ficl.mk Fri Feb 2 15:01:54 2018 (r328782) @@ -17,5 +17,4 @@ CFLAGS+= -fPIC .endif CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC} -CFLAGS+= -DBOOT_FORTH CFLAGS+= -DBF_DICTSIZE=15000 From owner-svn-src-all@freebsd.org Fri Feb 2 15:40:51 2018 Return-Path: Delivered-To: svn-src-all@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 477C6EDF627; Fri, 2 Feb 2018 15:40:51 +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 E9E21704DD; Fri, 2 Feb 2018 15:40:50 +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 E4EDB1D9D6; Fri, 2 Feb 2018 15:40:50 +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 w12FeoVv033886; Fri, 2 Feb 2018 15:40:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12FencI033875; Fri, 2 Feb 2018 15:40:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802021540.w12FencI033875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 15:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328783 - in head/stand: . arm/uboot efi/loader i386/loader mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw powerpc/uboot sparc64/loader userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: . arm/uboot efi/loader i386/loader mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw powerpc/uboot sparc64/loader userboot/userboot X-SVN-Commit-Revision: 328783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 15:40:51 -0000 Author: imp Date: Fri Feb 2 15:40:49 2018 New Revision: 328783 URL: https://svnweb.freebsd.org/changeset/base/328783 Log: Invent new LDR_INTERP for the loader interpreter to use. Use this in preference to LIBFICL{,32}. LIBFICL{,32} are now always defined, but LDR_INTERP{,32} is defined empty when building w/o forth (aka the simple interpreter) and defined to LIBFICL{,32} when we are building forth. Modified: head/stand/arm/uboot/Makefile head/stand/efi/loader/Makefile head/stand/i386/loader/Makefile head/stand/loader.mk head/stand/mips/beri/loader/Makefile head/stand/mips/uboot/Makefile head/stand/powerpc/kboot/Makefile head/stand/powerpc/ofw/Makefile head/stand/powerpc/uboot/Makefile head/stand/sparc64/loader/Makefile head/stand/userboot/userboot/Makefile Modified: head/stand/arm/uboot/Makefile ============================================================================== --- head/stand/arm/uboot/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/arm/uboot/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -41,8 +41,8 @@ LDFLAGS+= -Wl,-znotext CFLAGS+= -fPIC -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Modified: head/stand/efi/loader/Makefile ============================================================================== --- head/stand/efi/loader/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/efi/loader/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -119,8 +119,8 @@ loader.efi: ${PROG} LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a -DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ +DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ ${LDSCRIPT} -LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} .include Modified: head/stand/i386/loader/Makefile ============================================================================== --- head/stand/i386/loader/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/i386/loader/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} -LDADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -DLOADER_PREFER_AMD64 Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/loader.mk Fri Feb 2 15:40:49 2018 (r328783) @@ -128,14 +128,15 @@ LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif .endif -# NB: The makefiles depend on these being empty when we don't build forth. -.if ${MK_FORTH} != "no" LIBFICL= ${BOOTOBJ}/ficl/libficl.a .if ${MACHINE} == "i386" LIBFICL32= ${LIBFICL} .else LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a .endif +.if ${MK_FORTH} != no +LDR_INTERP= ${LIBFICL} +LDR_INTERP32= ${LIBFICL32} .endif CLEANFILES+= vers.c Modified: head/stand/mips/beri/loader/Makefile ============================================================================== --- head/stand/mips/beri/loader/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/mips/beri/loader/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -87,8 +87,8 @@ LDFLAGS+= -static \ -L${.CURDIR} \ -e __start -DPADD= ${LIBFICL} ${LIBSA} -LDADD= ${LIBFICL} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBSA} .if defined(LOADER_USB_SUPPORT) # Do garbage collection Modified: head/stand/mips/uboot/Makefile ============================================================================== --- head/stand/mips/uboot/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/mips/uboot/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -35,8 +35,8 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MA .include "${BOOTSRC}/uboot.mk" -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Modified: head/stand/powerpc/kboot/Makefile ============================================================================== --- head/stand/powerpc/kboot/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/powerpc/kboot/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -39,7 +39,7 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powe # 64-bit bridge extensions CFLAGS+= -Wa,-mppc64bridge -DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} -LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} .include Modified: head/stand/powerpc/ofw/Makefile ============================================================================== --- head/stand/powerpc/ofw/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/powerpc/ofw/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -46,7 +46,7 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powe LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a CFLAGS+= -I${BOOTSRC}/ofw/libofw -DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} -LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} .include Modified: head/stand/powerpc/uboot/Makefile ============================================================================== --- head/stand/powerpc/uboot/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/powerpc/uboot/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -27,7 +27,7 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powe .include "${BOOTSRC}/uboot.mk" -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} .include Modified: head/stand/sparc64/loader/Makefile ============================================================================== --- head/stand/sparc64/loader/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/sparc64/loader/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -40,7 +40,7 @@ LDFLAGS+= -static LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a CFLAGS+= -I${BOOTSRC}/ofw/libofw/ -DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} -LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} .include Modified: head/stand/userboot/userboot/Makefile ============================================================================== --- head/stand/userboot/userboot/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/userboot/userboot/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -43,10 +43,10 @@ CFLAGS+= -DUSERBOOT_ZFS_SUPPORT LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif -# Always add MI sources +# Always add MI sources .include "${BOOTSRC}/loader.mk" CFLAGS+= -I. -DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSA} -LDADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSA} +DPADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} +LDADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} .include From owner-svn-src-all@freebsd.org Fri Feb 2 16:35:17 2018 Return-Path: Delivered-To: svn-src-all@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 CB0D9EE28B0; Fri, 2 Feb 2018 16:35:17 +0000 (UTC) (envelope-from rgrimes@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 7AE8472D0E; Fri, 2 Feb 2018 16:35:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 74F891E344; Fri, 2 Feb 2018 16:35:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12GZHOC064318; Fri, 2 Feb 2018 16:35:17 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12GZHdG064317; Fri, 2 Feb 2018 16:35:17 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201802021635.w12GZHdG064317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 2 Feb 2018 16:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328784 - head/share/examples/bhyve X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/share/examples/bhyve X-SVN-Commit-Revision: 328784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 16:35:18 -0000 Author: rgrimes Date: Fri Feb 2 16:35:17 2018 New Revision: 328784 URL: https://svnweb.freebsd.org/changeset/base/328784 Log: Clean up long lines. Approved by: grehan (mentor) MFC after: 3 days Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh ============================================================================== --- head/share/examples/bhyve/vmrun.sh Fri Feb 2 15:40:49 2018 (r328783) +++ head/share/examples/bhyve/vmrun.sh Fri Feb 2 16:35:17 2018 (r328784) @@ -244,7 +244,8 @@ fi if [ ${efi_mode} -gt 0 ]; then if [ ! -f ${efi_firmware} ]; then - echo "Error: EFI Firmware ${efi_firmware} doesn't exist. Try: pkg install uefi-edk2-bhyve" + echo "Error: EFI Firmware ${efi_firmware} doesn't exist." \ + "Try: pkg install uefi-edk2-bhyve" exit 1 fi fi @@ -281,7 +282,8 @@ while [ 1 ]; do file -s ${first_diskdev} | grep "boot sector" > /dev/null rc=$? if [ $rc -ne 0 ]; then - file -s ${first_diskdev} | grep ": Unix Fast File sys" > /dev/null + file -s ${first_diskdev} | \ + grep ": Unix Fast File sys" > /dev/null rc=$? fi if [ $rc -ne 0 ]; then @@ -312,8 +314,8 @@ while [ 1 ]; do fi if [ ${efi_mode} -eq 0 ]; then - ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} ${loader_opt} \ - ${vmname} + ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} \ + ${loader_opt} ${vmname} bhyve_exit=$? if [ $bhyve_exit -ne 0 ]; then break @@ -353,7 +355,8 @@ while [ 1 ]; do efiargs="" if [ ${efi_mode} -gt 0 ]; then - efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport},${fbsize}${vncwait}" + efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport}," + efiargs="${efiargs}${fbsize}${vncwait}" efiargs="${efiargs} -l bootrom,${efi_firmware}" efiargs="${efiargs} ${tablet}" fi From owner-svn-src-all@freebsd.org Fri Feb 2 16:47:33 2018 Return-Path: Delivered-To: svn-src-all@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 0AE4AEE31EB; Fri, 2 Feb 2018 16:47:33 +0000 (UTC) (envelope-from emaste@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 AA8D373935; Fri, 2 Feb 2018 16:47:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4FC11E4DD; Fri, 2 Feb 2018 16:47:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12GlWkr069726; Fri, 2 Feb 2018 16:47:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12GlWfo069725; Fri, 2 Feb 2018 16:47:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802021647.w12GlWfo069725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 2 Feb 2018 16:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328785 - head/lib/libc/stdlib X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libc/stdlib X-SVN-Commit-Revision: 328785 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 16:47:33 -0000 Author: emaste Date: Fri Feb 2 16:47:32 2018 New Revision: 328785 URL: https://svnweb.freebsd.org/changeset/base/328785 Log: Use standard 2-clause license where copyright is held by the FreeBSD Foundation Modified: head/lib/libc/stdlib/strtold.c Modified: head/lib/libc/stdlib/strtold.c ============================================================================== --- head/lib/libc/stdlib/strtold.c Fri Feb 2 16:35:17 2018 (r328784) +++ head/lib/libc/stdlib/strtold.c Fri Feb 2 16:47:32 2018 (r328785) @@ -1,11 +1,12 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2011 The FreeBSD Foundation + * Copyright (C) 2011 The FreeBSD Foundation * All rights reserved. - * Portions of this software were developed by David Chisnall - * under sponsorship from the FreeBSD Foundation. * + * This software was developed by David Chisnall 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: @@ -14,14 +15,11 @@ * 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. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * 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 REGENTS OR CONTRIBUTORS BE LIABLE + * 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) From owner-svn-src-all@freebsd.org Fri Feb 2 17:07:57 2018 Return-Path: Delivered-To: svn-src-all@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 1C36CEE42EA; Fri, 2 Feb 2018 17:07:57 +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 A8D0A747E3; Fri, 2 Feb 2018 17:07:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A30971E801; Fri, 2 Feb 2018 17:07:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12H7uWu080142; Fri, 2 Feb 2018 17:07:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H7rKg080110; Fri, 2 Feb 2018 17:07:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021707.w12H7rKg080110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328786 - in vendor/llvm/dist-release_60: include/llvm include/llvm/CodeGen lib/CodeGen lib/CodeGen/SelectionDAG lib/Target/AMDGPU lib/Target/ARM lib/Target/Mips lib/Target/Sparc lib/Ta... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist-release_60: include/llvm include/llvm/CodeGen lib/CodeGen lib/CodeGen/SelectionDAG lib/Target/AMDGPU lib/Target/ARM lib/Target/Mips lib/Target/Sparc lib/Target/X86 lib/Transforms/S... X-SVN-Commit-Revision: 328786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:07:57 -0000 Author: dim Date: Fri Feb 2 17:07:53 2018 New Revision: 328786 URL: https://svnweb.freebsd.org/changeset/base/328786 Log: Vendor import of llvm release_60 branch r324090: https://llvm.org/svn/llvm-project/llvm/branches/release_60@324090 Added: vendor/llvm/dist-release_60/lib/CodeGen/IndirectBrExpandPass.cpp (contents, props changed) vendor/llvm/dist-release_60/lib/Target/X86/X86RetpolineThunks.cpp (contents, props changed) vendor/llvm/dist-release_60/test/CodeGen/Mips/pr36061.ll vendor/llvm/dist-release_60/test/CodeGen/Mips/unsized-global.ll vendor/llvm/dist-release_60/test/CodeGen/Thumb/pr35836.ll vendor/llvm/dist-release_60/test/CodeGen/Thumb/pr35836_2.ll vendor/llvm/dist-release_60/test/CodeGen/X86/retpoline-external.ll vendor/llvm/dist-release_60/test/CodeGen/X86/retpoline.ll vendor/llvm/dist-release_60/test/Transforms/IndirectBrExpand/ vendor/llvm/dist-release_60/test/Transforms/IndirectBrExpand/basic.ll Modified: vendor/llvm/dist-release_60/include/llvm/CodeGen/Passes.h vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetInstrInfo.h vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetLowering.h vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetPassConfig.h vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetSubtargetInfo.h vendor/llvm/dist-release_60/include/llvm/InitializePasses.h vendor/llvm/dist-release_60/lib/CodeGen/CMakeLists.txt vendor/llvm/dist-release_60/lib/CodeGen/CodeGen.cpp vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp vendor/llvm/dist-release_60/lib/CodeGen/TargetSubtargetInfo.cpp vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.cpp vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.h vendor/llvm/dist-release_60/lib/Target/Mips/MipsISelLowering.cpp vendor/llvm/dist-release_60/lib/Target/Mips/MipsTargetObjectFile.cpp vendor/llvm/dist-release_60/lib/Target/Sparc/SparcFrameLowering.cpp vendor/llvm/dist-release_60/lib/Target/X86/CMakeLists.txt vendor/llvm/dist-release_60/lib/Target/X86/X86.h vendor/llvm/dist-release_60/lib/Target/X86/X86.td vendor/llvm/dist-release_60/lib/Target/X86/X86AsmPrinter.h vendor/llvm/dist-release_60/lib/Target/X86/X86FastISel.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86FrameLowering.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86ISelDAGToDAG.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.h vendor/llvm/dist-release_60/lib/Target/X86/X86InstrCompiler.td vendor/llvm/dist-release_60/lib/Target/X86/X86InstrControl.td vendor/llvm/dist-release_60/lib/Target/X86/X86InstrInfo.td vendor/llvm/dist-release_60/lib/Target/X86/X86MCInstLower.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86Subtarget.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86Subtarget.h vendor/llvm/dist-release_60/lib/Target/X86/X86TargetMachine.cpp vendor/llvm/dist-release_60/lib/Transforms/Scalar/DeadStoreElimination.cpp vendor/llvm/dist-release_60/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/smrd.ll vendor/llvm/dist-release_60/test/CodeGen/SPARC/stack-align.ll vendor/llvm/dist-release_60/test/CodeGen/X86/O0-pipeline.ll vendor/llvm/dist-release_60/test/Transforms/DeadStoreElimination/merge-stores.ll vendor/llvm/dist-release_60/test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/split-gep-and-gvn-addrspace-addressing-modes.ll vendor/llvm/dist-release_60/tools/opt/opt.cpp Modified: vendor/llvm/dist-release_60/include/llvm/CodeGen/Passes.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/CodeGen/Passes.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/include/llvm/CodeGen/Passes.h Fri Feb 2 17:07:53 2018 (r328786) @@ -417,6 +417,9 @@ namespace llvm { // This pass expands memcmp() to load/stores. FunctionPass *createExpandMemCmpPass(); + // This pass expands indirectbr instructions. + FunctionPass *createIndirectBrExpandPass(); + } // End llvm namespace #endif Modified: vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetInstrInfo.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetInstrInfo.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetInstrInfo.h Fri Feb 2 17:07:53 2018 (r328786) @@ -950,6 +950,10 @@ class TargetInstrInfo : public MCInstrInfo { (public) /// Return true when a target supports MachineCombiner. virtual bool useMachineCombiner() const { return false; } + /// Return true if the given SDNode can be copied during scheduling + /// even if it has glue. + virtual bool canCopyGluedNodeDuringSchedule(SDNode *N) const { return false; } + protected: /// Target-dependent implementation for foldMemoryOperand. /// Target-independent code in foldMemoryOperand will Modified: vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetLowering.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetLowering.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetLowering.h Fri Feb 2 17:07:53 2018 (r328786) @@ -800,7 +800,7 @@ class TargetLoweringBase { (public) } /// Return true if lowering to a jump table is allowed. - bool areJTsAllowed(const Function *Fn) const { + virtual bool areJTsAllowed(const Function *Fn) const { if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true") return false; Modified: vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetPassConfig.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetPassConfig.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetPassConfig.h Fri Feb 2 17:07:53 2018 (r328786) @@ -416,6 +416,13 @@ class TargetPassConfig : public ImmutablePass { (prote /// immediately before machine code is emitted. virtual void addPreEmitPass() { } + /// Targets may add passes immediately before machine code is emitted in this + /// callback. This is called even later than `addPreEmitPass`. + // FIXME: Rename `addPreEmitPass` to something more sensible given its actual + // position and remove the `2` suffix here as this callback is what + // `addPreEmitPass` *should* be but in reality isn't. + virtual void addPreEmitPass2() {} + /// Utilities for targets to add passes to the pass manager. /// Modified: vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetSubtargetInfo.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetSubtargetInfo.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/include/llvm/CodeGen/TargetSubtargetInfo.h Fri Feb 2 17:07:53 2018 (r328786) @@ -174,6 +174,9 @@ class TargetSubtargetInfo : public MCSubtargetInfo { ( /// \brief True if the subtarget should run the atomic expansion pass. virtual bool enableAtomicExpand() const; + /// True if the subtarget should run the indirectbr expansion pass. + virtual bool enableIndirectBrExpand() const; + /// \brief Override generic scheduling policy within a region. /// /// This is a convenient way for targets that don't provide any custom Modified: vendor/llvm/dist-release_60/include/llvm/InitializePasses.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/InitializePasses.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/include/llvm/InitializePasses.h Fri Feb 2 17:07:53 2018 (r328786) @@ -161,6 +161,7 @@ void initializeIVUsersWrapperPassPass(PassRegistry&); void initializeIfConverterPass(PassRegistry&); void initializeImplicitNullChecksPass(PassRegistry&); void initializeIndVarSimplifyLegacyPassPass(PassRegistry&); +void initializeIndirectBrExpandPassPass(PassRegistry&); void initializeInductiveRangeCheckEliminationPass(PassRegistry&); void initializeInferAddressSpacesPass(PassRegistry&); void initializeInferFunctionAttrsLegacyPassPass(PassRegistry&); Modified: vendor/llvm/dist-release_60/lib/CodeGen/CMakeLists.txt ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/CMakeLists.txt Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/CodeGen/CMakeLists.txt Fri Feb 2 17:07:53 2018 (r328786) @@ -33,6 +33,7 @@ add_llvm_library(LLVMCodeGen GlobalMerge.cpp IfConversion.cpp ImplicitNullChecks.cpp + IndirectBrExpandPass.cpp InlineSpiller.cpp InterferenceCache.cpp InterleavedAccessPass.cpp Modified: vendor/llvm/dist-release_60/lib/CodeGen/CodeGen.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/CodeGen.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/CodeGen/CodeGen.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -38,6 +38,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeGCModuleInfoPass(Registry); initializeIfConverterPass(Registry); initializeImplicitNullChecksPass(Registry); + initializeIndirectBrExpandPassPass(Registry); initializeInterleavedAccessPass(Registry); initializeLiveDebugValuesPass(Registry); initializeLiveDebugVariablesPass(Registry); Added: vendor/llvm/dist-release_60/lib/CodeGen/IndirectBrExpandPass.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_60/lib/CodeGen/IndirectBrExpandPass.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -0,0 +1,221 @@ +//===- IndirectBrExpandPass.cpp - Expand indirectbr to switch -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// Implements an expansion pass to turn `indirectbr` instructions in the IR +/// into `switch` instructions. This works by enumerating the basic blocks in +/// a dense range of integers, replacing each `blockaddr` constant with the +/// corresponding integer constant, and then building a switch that maps from +/// the integers to the actual blocks. All of the indirectbr instructions in the +/// function are redirected to this common switch. +/// +/// While this is generically useful if a target is unable to codegen +/// `indirectbr` natively, it is primarily useful when there is some desire to +/// get the builtin non-jump-table lowering of a switch even when the input +/// source contained an explicit indirect branch construct. +/// +/// Note that it doesn't make any sense to enable this pass unless a target also +/// disables jump-table lowering of switches. Doing that is likely to pessimize +/// the code. +/// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Sequence.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/TargetPassConfig.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/InstIterator.h" +#include "llvm/IR/Instruction.h" +#include "llvm/IR/Instructions.h" +#include "llvm/Pass.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetMachine.h" + +using namespace llvm; + +#define DEBUG_TYPE "indirectbr-expand" + +namespace { + +class IndirectBrExpandPass : public FunctionPass { + const TargetLowering *TLI = nullptr; + +public: + static char ID; // Pass identification, replacement for typeid + + IndirectBrExpandPass() : FunctionPass(ID) { + initializeIndirectBrExpandPassPass(*PassRegistry::getPassRegistry()); + } + + bool runOnFunction(Function &F) override; +}; + +} // end anonymous namespace + +char IndirectBrExpandPass::ID = 0; + +INITIALIZE_PASS(IndirectBrExpandPass, DEBUG_TYPE, + "Expand indirectbr instructions", false, false) + +FunctionPass *llvm::createIndirectBrExpandPass() { + return new IndirectBrExpandPass(); +} + +bool IndirectBrExpandPass::runOnFunction(Function &F) { + auto &DL = F.getParent()->getDataLayout(); + auto *TPC = getAnalysisIfAvailable(); + if (!TPC) + return false; + + auto &TM = TPC->getTM(); + auto &STI = *TM.getSubtargetImpl(F); + if (!STI.enableIndirectBrExpand()) + return false; + TLI = STI.getTargetLowering(); + + SmallVector IndirectBrs; + + // Set of all potential successors for indirectbr instructions. + SmallPtrSet IndirectBrSuccs; + + // Build a list of indirectbrs that we want to rewrite. + for (BasicBlock &BB : F) + if (auto *IBr = dyn_cast(BB.getTerminator())) { + // Handle the degenerate case of no successors by replacing the indirectbr + // with unreachable as there is no successor available. + if (IBr->getNumSuccessors() == 0) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + continue; + } + + IndirectBrs.push_back(IBr); + for (BasicBlock *SuccBB : IBr->successors()) + IndirectBrSuccs.insert(SuccBB); + } + + if (IndirectBrs.empty()) + return false; + + // If we need to replace any indirectbrs we need to establish integer + // constants that will correspond to each of the basic blocks in the function + // whose address escapes. We do that here and rewrite all the blockaddress + // constants to just be those integer constants cast to a pointer type. + SmallVector BBs; + + for (BasicBlock &BB : F) { + // Skip blocks that aren't successors to an indirectbr we're going to + // rewrite. + if (!IndirectBrSuccs.count(&BB)) + continue; + + auto IsBlockAddressUse = [&](const Use &U) { + return isa(U.getUser()); + }; + auto BlockAddressUseIt = llvm::find_if(BB.uses(), IsBlockAddressUse); + if (BlockAddressUseIt == BB.use_end()) + continue; + + assert(std::find_if(std::next(BlockAddressUseIt), BB.use_end(), + IsBlockAddressUse) == BB.use_end() && + "There should only ever be a single blockaddress use because it is " + "a constant and should be uniqued."); + + auto *BA = cast(BlockAddressUseIt->getUser()); + + // Skip if the constant was formed but ended up not being used (due to DCE + // or whatever). + if (!BA->isConstantUsed()) + continue; + + // Compute the index we want to use for this basic block. We can't use zero + // because null can be compared with block addresses. + int BBIndex = BBs.size() + 1; + BBs.push_back(&BB); + + auto *ITy = cast(DL.getIntPtrType(BA->getType())); + ConstantInt *BBIndexC = ConstantInt::get(ITy, BBIndex); + + // Now rewrite the blockaddress to an integer constant based on the index. + // FIXME: We could potentially preserve the uses as arguments to inline asm. + // This would allow some uses such as diagnostic information in crashes to + // have higher quality even when this transform is enabled, but would break + // users that round-trip blockaddresses through inline assembly and then + // back into an indirectbr. + BA->replaceAllUsesWith(ConstantExpr::getIntToPtr(BBIndexC, BA->getType())); + } + + if (BBs.empty()) { + // There are no blocks whose address is taken, so any indirectbr instruction + // cannot get a valid input and we can replace all of them with unreachable. + for (auto *IBr : IndirectBrs) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + } + return true; + } + + BasicBlock *SwitchBB; + Value *SwitchValue; + + // Compute a common integer type across all the indirectbr instructions. + IntegerType *CommonITy = nullptr; + for (auto *IBr : IndirectBrs) { + auto *ITy = + cast(DL.getIntPtrType(IBr->getAddress()->getType())); + if (!CommonITy || ITy->getBitWidth() > CommonITy->getBitWidth()) + CommonITy = ITy; + } + + auto GetSwitchValue = [DL, CommonITy](IndirectBrInst *IBr) { + return CastInst::CreatePointerCast( + IBr->getAddress(), CommonITy, + Twine(IBr->getAddress()->getName()) + ".switch_cast", IBr); + }; + + if (IndirectBrs.size() == 1) { + // If we only have one indirectbr, we can just directly replace it within + // its block. + SwitchBB = IndirectBrs[0]->getParent(); + SwitchValue = GetSwitchValue(IndirectBrs[0]); + IndirectBrs[0]->eraseFromParent(); + } else { + // Otherwise we need to create a new block to hold the switch across BBs, + // jump to that block instead of each indirectbr, and phi together the + // values for the switch. + SwitchBB = BasicBlock::Create(F.getContext(), "switch_bb", &F); + auto *SwitchPN = PHINode::Create(CommonITy, IndirectBrs.size(), + "switch_value_phi", SwitchBB); + SwitchValue = SwitchPN; + + // Now replace the indirectbr instructions with direct branches to the + // switch block and fill out the PHI operands. + for (auto *IBr : IndirectBrs) { + SwitchPN->addIncoming(GetSwitchValue(IBr), IBr->getParent()); + BranchInst::Create(SwitchBB, IBr); + IBr->eraseFromParent(); + } + } + + // Now build the switch in the block. The block will have no terminator + // already. + auto *SI = SwitchInst::Create(SwitchValue, BBs[0], BBs.size(), SwitchBB); + + // Add a case for each block. + for (int i : llvm::seq(1, BBs.size())) + SI->addCase(ConstantInt::get(CommonITy, i + 1), BBs[i]); + + return true; +} Modified: vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -1996,14 +1996,15 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Lib Type *ArgTy = ArgVT.getTypeForEVT(*DAG.getContext()); Entry.Node = Op; Entry.Ty = ArgTy; - Entry.IsSExt = isSigned; - Entry.IsZExt = !isSigned; + Entry.IsSExt = TLI.shouldSignExtendTypeInLibCall(ArgVT, isSigned); + Entry.IsZExt = !TLI.shouldSignExtendTypeInLibCall(ArgVT, isSigned); Args.push_back(Entry); } SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC), TLI.getPointerTy(DAG.getDataLayout())); - Type *RetTy = Node->getValueType(0).getTypeForEVT(*DAG.getContext()); + EVT RetVT = Node->getValueType(0); + Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext()); // By default, the input chain to this libcall is the entry node of the // function. If the libcall is going to be emitted as a tail call then @@ -2022,13 +2023,14 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Lib InChain = TCChain; TargetLowering::CallLoweringInfo CLI(DAG); + bool signExtend = TLI.shouldSignExtendTypeInLibCall(RetVT, isSigned); CLI.setDebugLoc(SDLoc(Node)) .setChain(InChain) .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args)) .setTailCall(isTailCall) - .setSExtResult(isSigned) - .setZExtResult(!isSigned) + .setSExtResult(signExtend) + .setZExtResult(!signExtend) .setIsPostTypeLegalization(true); std::pair CallInfo = TLI.LowerCallTo(CLI); Modified: vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -1117,22 +1117,34 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit if (!N) return nullptr; - if (SU->getNode()->getGluedNode()) + DEBUG(dbgs() << "Considering duplicating the SU\n"); + DEBUG(SU->dump(this)); + + if (N->getGluedNode() && + !TII->canCopyGluedNodeDuringSchedule(N)) { + DEBUG(dbgs() + << "Giving up because it has incoming glue and the target does not " + "want to copy it\n"); return nullptr; + } SUnit *NewSU; bool TryUnfold = false; for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) { MVT VT = N->getSimpleValueType(i); - if (VT == MVT::Glue) + if (VT == MVT::Glue) { + DEBUG(dbgs() << "Giving up because it has outgoing glue\n"); return nullptr; - else if (VT == MVT::Other) + } else if (VT == MVT::Other) TryUnfold = true; } for (const SDValue &Op : N->op_values()) { MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo()); - if (VT == MVT::Glue) + if (VT == MVT::Glue && !TII->canCopyGluedNodeDuringSchedule(N)) { + DEBUG(dbgs() << "Giving up because it one of the operands is glue and " + "the target does not want to copy it\n"); return nullptr; + } } // If possible unfold instruction. Modified: vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/CodeGen/TargetPassConfig.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -907,6 +907,9 @@ void TargetPassConfig::addMachinePasses() { if (EnableMachineOutliner) PM->add(createMachineOutlinerPass(EnableLinkOnceODROutlining)); + // Add passes that directly emit MI after all other MI passes. + addPreEmitPass2(); + AddingMachinePasses = false; } Modified: vendor/llvm/dist-release_60/lib/CodeGen/TargetSubtargetInfo.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/TargetSubtargetInfo.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/CodeGen/TargetSubtargetInfo.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -38,6 +38,10 @@ bool TargetSubtargetInfo::enableAtomicExpand() const { return true; } +bool TargetSubtargetInfo::enableIndirectBrExpand() const { + return false; +} + bool TargetSubtargetInfo::enableMachineScheduler() const { return false; } Modified: vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -3756,36 +3756,45 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) co // FIXME: This isn't safe because the addressing mode doesn't work // correctly if vaddr is negative. // - // FIXME: Handle v_add_u32 and VOP3 form. Also don't rely on immediate - // being in src0. - // // FIXME: Should probably be done somewhere else, maybe SIFoldOperands. // // See if we can extract an immediate offset by recognizing one of these: // V_ADD_I32_e32 dst, imm, src1 // V_ADD_I32_e32 dst, (S_MOV_B32 imm), src1 // V_ADD will be removed by "Remove dead machine instructions". - if (Add && Add->getOpcode() == AMDGPU::V_ADD_I32_e32) { - const MachineOperand *Src = - getNamedOperand(*Add, AMDGPU::OpName::src0); + if (Add && + (Add->getOpcode() == AMDGPU::V_ADD_I32_e32 || + Add->getOpcode() == AMDGPU::V_ADD_U32_e64)) { + static const unsigned SrcNames[2] = { + AMDGPU::OpName::src0, + AMDGPU::OpName::src1, + }; - if (Src->isReg()) { - auto Mov = MRI.getUniqueVRegDef(Src->getReg()); - if (Mov && Mov->getOpcode() == AMDGPU::S_MOV_B32) - Src = &Mov->getOperand(1); - } + // Find a literal offset in one of source operands. + for (int i = 0; i < 2; i++) { + const MachineOperand *Src = + getNamedOperand(*Add, SrcNames[i]); - if (Src) { - if (Src->isImm()) - Offset = Src->getImm(); - else if (Src->isCImm()) - Offset = Src->getCImm()->getZExtValue(); - } + if (Src->isReg()) { + auto Mov = MRI.getUniqueVRegDef(Src->getReg()); + if (Mov && Mov->getOpcode() == AMDGPU::S_MOV_B32) + Src = &Mov->getOperand(1); + } - if (Offset && isLegalMUBUFImmOffset(Offset)) - VAddr = getNamedOperand(*Add, AMDGPU::OpName::src1); - else + if (Src) { + if (Src->isImm()) + Offset = Src->getImm(); + else if (Src->isCImm()) + Offset = Src->getCImm()->getZExtValue(); + } + + if (Offset && isLegalMUBUFImmOffset(Offset)) { + VAddr = getNamedOperand(*Add, SrcNames[!i]); + break; + } + Offset = 0; + } } BuildMI(*MBB, Inst, Inst.getDebugLoc(), Modified: vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -141,3 +141,16 @@ void Thumb1InstrInfo::expandLoadStackGuard( else expandLoadStackGuardBase(MI, ARM::tLDRLIT_ga_abs, ARM::tLDRi); } + +bool Thumb1InstrInfo::canCopyGluedNodeDuringSchedule(SDNode *N) const { + // In Thumb1 the scheduler may need to schedule a cross-copy between GPRS and CPSR + // but this is not always possible there, so allow the Scheduler to clone tADCS and tSBCS + // even if they have glue. + // FIXME. Actually implement the cross-copy where it is possible (post v6) + // because these copies entail more spilling. + unsigned Opcode = N->getMachineOpcode(); + if (Opcode == ARM::tADCS || Opcode == ARM::tSBCS) + return true; + + return false; +} Modified: vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.h ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/ARM/Thumb1InstrInfo.h Fri Feb 2 17:07:53 2018 (r328786) @@ -53,6 +53,7 @@ class Thumb1InstrInfo : public ARMBaseInstrInfo { (pub const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override; + bool canCopyGluedNodeDuringSchedule(SDNode *N) const override; private: void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override; }; Modified: vendor/llvm/dist-release_60/lib/Target/Mips/MipsISelLowering.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/Mips/MipsISelLowering.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/Mips/MipsISelLowering.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -3507,10 +3507,9 @@ MipsTargetLowering::CanLowerReturn(CallingConv::ID Cal bool MipsTargetLowering::shouldSignExtendTypeInLibCall(EVT Type, bool IsSigned) const { - if (Subtarget.hasMips3() && Subtarget.useSoftFloat()) { - if (Type == MVT::i32) + if ((ABI.IsN32() || ABI.IsN64()) && Type == MVT::i32) return true; - } + return IsSigned; } Modified: vendor/llvm/dist-release_60/lib/Target/Mips/MipsTargetObjectFile.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/Mips/MipsTargetObjectFile.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/Mips/MipsTargetObjectFile.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -136,6 +136,13 @@ IsGlobalInSmallSectionImpl(const GlobalObject *GO, return false; Type *Ty = GVA->getValueType(); + + // It is possible that the type of the global is unsized, i.e. a declaration + // of a extern struct. In this case don't presume it is in the small data + // section. This happens e.g. when building the FreeBSD kernel. + if (!Ty->isSized()) + return false; + return IsInSmallSection( GVA->getParent()->getDataLayout().getTypeAllocSize(Ty)); } Modified: vendor/llvm/dist-release_60/lib/Target/Sparc/SparcFrameLowering.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/Sparc/SparcFrameLowering.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/Sparc/SparcFrameLowering.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -88,10 +88,11 @@ void SparcFrameLowering::emitPrologue(MachineFunction assert(&MF.front() == &MBB && "Shrink-wrapping not yet supported"); MachineFrameInfo &MFI = MF.getFrameInfo(); + const SparcSubtarget &Subtarget = MF.getSubtarget(); const SparcInstrInfo &TII = - *static_cast(MF.getSubtarget().getInstrInfo()); + *static_cast(Subtarget.getInstrInfo()); const SparcRegisterInfo &RegInfo = - *static_cast(MF.getSubtarget().getRegisterInfo()); + *static_cast(Subtarget.getRegisterInfo()); MachineBasicBlock::iterator MBBI = MBB.begin(); // Debug location must be unknown since the first debug location is used // to determine the end of the prologue. @@ -141,7 +142,7 @@ void SparcFrameLowering::emitPrologue(MachineFunction // Adds the SPARC subtarget-specific spill area to the stack // size. Also ensures target-required alignment. - NumBytes = MF.getSubtarget().getAdjustedFrameSize(NumBytes); + NumBytes = Subtarget.getAdjustedFrameSize(NumBytes); // Finally, ensure that the size is sufficiently aligned for the // data on the stack. @@ -176,9 +177,27 @@ void SparcFrameLowering::emitPrologue(MachineFunction .addCFIIndex(CFIIndex); if (NeedsStackRealignment) { - // andn %o6, MaxAlign-1, %o6 + int64_t Bias = Subtarget.getStackPointerBias(); + unsigned regUnbiased; + if (Bias) { + // This clobbers G1 which we always know is available here. + regUnbiased = SP::G1; + // add %o6, BIAS, %g1 + BuildMI(MBB, MBBI, dl, TII.get(SP::ADDri), regUnbiased) + .addReg(SP::O6).addImm(Bias); + } else + regUnbiased = SP::O6; + + // andn %regUnbiased, MaxAlign-1, %regUnbiased int MaxAlign = MFI.getMaxAlignment(); - BuildMI(MBB, MBBI, dl, TII.get(SP::ANDNri), SP::O6).addReg(SP::O6).addImm(MaxAlign - 1); + BuildMI(MBB, MBBI, dl, TII.get(SP::ANDNri), regUnbiased) + .addReg(regUnbiased).addImm(MaxAlign - 1); + + if (Bias) { + // add %g1, -BIAS, %o6 + BuildMI(MBB, MBBI, dl, TII.get(SP::ADDri), SP::O6) + .addReg(regUnbiased).addImm(-Bias); + } } } Modified: vendor/llvm/dist-release_60/lib/Target/X86/CMakeLists.txt ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/CMakeLists.txt Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/CMakeLists.txt Fri Feb 2 17:07:53 2018 (r328786) @@ -48,6 +48,7 @@ set(sources X86PadShortFunction.cpp X86RegisterBankInfo.cpp X86RegisterInfo.cpp + X86RetpolineThunks.cpp X86SelectionDAGInfo.cpp X86ShuffleDecodeConstantPool.cpp X86Subtarget.cpp Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86.h ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86.h Fri Feb 2 17:07:53 2018 (r328786) @@ -22,6 +22,7 @@ namespace llvm { class FunctionPass; class ImmutablePass; class InstructionSelector; +class ModulePass; class PassRegistry; class X86RegisterBankInfo; class X86Subtarget; @@ -101,6 +102,9 @@ void initializeFixupBWInstPassPass(PassRegistry &); /// This pass replaces EVEX encoded of AVX-512 instructiosn by VEX /// encoding when possible in order to reduce code size. FunctionPass *createX86EvexToVexInsts(); + +/// This pass creates the thunks for the retpoline feature. +FunctionPass *createX86RetpolineThunksPass(); InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM, X86Subtarget &, Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86.td ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86.td Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86.td Fri Feb 2 17:07:53 2018 (r328786) @@ -329,6 +329,27 @@ def FeatureHasFastGather : SubtargetFeature<"fast-gather", "HasFastGather", "true", "Indicates if gather is reasonably fast.">; +// Enable mitigation of some aspects of speculative execution related +// vulnerabilities by removing speculatable indirect branches. This disables +// jump-table formation, rewrites explicit `indirectbr` instructions into +// `switch` instructions, and uses a special construct called a "retpoline" to +// prevent speculation of the remaining indirect branches (indirect calls and +// tail calls). +def FeatureRetpoline + : SubtargetFeature<"retpoline", "UseRetpoline", "true", + "Remove speculation of indirect branches from the " + "generated code, either by avoiding them entirely or " + "lowering them with a speculation blocking construct.">; + +// Rely on external thunks for the emitted retpoline calls. This allows users +// to provide their own custom thunk definitions in highly specialized +// environments such as a kernel that does boot-time hot patching. +def FeatureRetpolineExternalThunk + : SubtargetFeature< + "retpoline-external-thunk", "UseRetpolineExternalThunk", "true", + "Enable retpoline, but with an externally provided thunk.", + [FeatureRetpoline]>; + //===----------------------------------------------------------------------===// // Register File Description //===----------------------------------------------------------------------===// Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86AsmPrinter.h ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86AsmPrinter.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86AsmPrinter.h Fri Feb 2 17:07:53 2018 (r328786) @@ -32,6 +32,7 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public A FaultMaps FM; std::unique_ptr CodeEmitter; bool EmitFPOData = false; + bool NeedsRetpoline = false; // This utility class tracks the length of a stackmap instruction's 'shadow'. // It is used by the X86AsmPrinter to ensure that the stackmap shadow Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86FastISel.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86FastISel.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86FastISel.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -3172,6 +3172,10 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) (CalledFn && CalledFn->hasFnAttribute("no_caller_saved_registers"))) return false; + // Functions using retpoline should use SDISel for calls. + if (Subtarget->useRetpoline()) + return false; + // Handle only C, fastcc, and webkit_js calling conventions for now. switch (CC) { default: return false; Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86FrameLowering.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86FrameLowering.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86FrameLowering.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -741,6 +741,11 @@ void X86FrameLowering::emitStackProbeCall(MachineFunct bool InProlog) const { bool IsLargeCodeModel = MF.getTarget().getCodeModel() == CodeModel::Large; + // FIXME: Add retpoline support and remove this. + if (Is64Bit && IsLargeCodeModel && STI.useRetpoline()) + report_fatal_error("Emitting stack probe calls on 64-bit with the large " + "code model and retpoline not yet implemented."); + unsigned CallOp; if (Is64Bit) CallOp = IsLargeCodeModel ? X86::CALL64r : X86::CALL64pcrel32; @@ -2345,6 +2350,10 @@ void X86FrameLowering::adjustForSegmentedStacks( // This solution is not perfect, as it assumes that the .rodata section // is laid out within 2^31 bytes of each function body, but this seems // to be sufficient for JIT. + // FIXME: Add retpoline support and remove the error here.. + if (STI.useRetpoline()) + report_fatal_error("Emitting morestack calls on 64-bit with the large " + "code model and retpoline not yet implemented."); BuildMI(allocMBB, DL, TII.get(X86::CALL64m)) .addReg(X86::RIP) .addImm(0) Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -629,11 +629,11 @@ void X86DAGToDAGISel::PreprocessISelDAG() { SDNode *N = &*I++; // Preincrement iterator to avoid invalidation issues. if (OptLevel != CodeGenOpt::None && - // Only does this when target favors doesn't favor register indirect - // call. + // Only do this when the target can fold the load into the call or + // jmp. + !Subtarget->useRetpoline() && ((N->getOpcode() == X86ISD::CALL && !Subtarget->slowTwoMemOps()) || (N->getOpcode() == X86ISD::TC_RETURN && - // Only does this if load can be folded into TC_RETURN. (Subtarget->is64Bit() || !getTargetMachine().isPositionIndependent())))) { /// Also try moving call address load from outside callseq_start to just Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp Fri Feb 2 17:07:53 2018 (r328786) @@ -25767,6 +25767,15 @@ X86TargetLowering::isVectorClearMaskLegal(const SmallV return isShuffleMaskLegal(Mask, VT); } +bool X86TargetLowering::areJTsAllowed(const Function *Fn) const { + // If the subtarget is using retpolines, we need to not generate jump tables. + if (Subtarget.useRetpoline()) + return false; + + // Otherwise, fallback on the generic logic. + return TargetLowering::areJTsAllowed(Fn); +} + //===----------------------------------------------------------------------===// // X86 Scheduler Hooks //===----------------------------------------------------------------------===// @@ -27069,7 +27078,116 @@ X86TargetLowering::EmitLoweredTLSCall(MachineInstr &MI return BB; } +static unsigned getOpcodeForRetpoline(unsigned RPOpc) { + switch (RPOpc) { + case X86::RETPOLINE_CALL32: + return X86::CALLpcrel32; + case X86::RETPOLINE_CALL64: + return X86::CALL64pcrel32; + case X86::RETPOLINE_TCRETURN32: + return X86::TCRETURNdi; + case X86::RETPOLINE_TCRETURN64: + return X86::TCRETURNdi64; + } + llvm_unreachable("not retpoline opcode"); +} + +static const char *getRetpolineSymbol(const X86Subtarget &Subtarget, + unsigned Reg) { + switch (Reg) { + case 0: + assert(!Subtarget.is64Bit() && "R11 should always be available on x64"); + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_push" + : "__llvm_retpoline_push"; + case X86::EAX: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_eax" + : "__llvm_retpoline_eax"; + case X86::ECX: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_ecx" + : "__llvm_retpoline_ecx"; + case X86::EDX: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_edx" + : "__llvm_retpoline_edx"; + case X86::R11: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_r11" + : "__llvm_retpoline_r11"; + } + llvm_unreachable("unexpected reg for retpoline"); +} + MachineBasicBlock * +X86TargetLowering::EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const { + // Copy the virtual register into the R11 physical register and + // call the retpoline thunk. + DebugLoc DL = MI.getDebugLoc(); + const X86InstrInfo *TII = Subtarget.getInstrInfo(); + unsigned CalleeVReg = MI.getOperand(0).getReg(); + unsigned Opc = getOpcodeForRetpoline(MI.getOpcode()); + + // Find an available scratch register to hold the callee. On 64-bit, we can + // just use R11, but we scan for uses anyway to ensure we don't generate + // incorrect code. On 32-bit, we use one of EAX, ECX, or EDX that isn't + // already a register use operand to the call to hold the callee. If none + // are available, push the callee instead. This is less efficient, but is + // necessary for functions using 3 regparms. Such function calls are + // (currently) not eligible for tail call optimization, because there is no + // scratch register available to hold the address of the callee. + SmallVector AvailableRegs; + if (Subtarget.is64Bit()) + AvailableRegs.push_back(X86::R11); + else + AvailableRegs.append({X86::EAX, X86::ECX, X86::EDX}); + + // Zero out any registers that are already used. + for (const auto &MO : MI.operands()) { + if (MO.isReg() && MO.isUse()) + for (unsigned &Reg : AvailableRegs) + if (Reg == MO.getReg()) + Reg = 0; + } + + // Choose the first remaining non-zero available register. + unsigned AvailableReg = 0; + for (unsigned MaybeReg : AvailableRegs) { + if (MaybeReg) { + AvailableReg = MaybeReg; + break; + } + } + + const char *Symbol = getRetpolineSymbol(Subtarget, AvailableReg); + + if (AvailableReg == 0) { + // No register available. Use PUSH. This must not be a tailcall, and this + // must not be x64. + if (Subtarget.is64Bit()) + report_fatal_error( + "Cannot make an indirect call on x86-64 using both retpoline and a " + "calling convention that preservers r11"); + if (Opc != X86::CALLpcrel32) + report_fatal_error("Cannot make an indirect tail call on x86 using " + "retpoline without a preserved register"); + BuildMI(*BB, MI, DL, TII->get(X86::PUSH32r)).addReg(CalleeVReg); + MI.getOperand(0).ChangeToES(Symbol); + MI.setDesc(TII->get(Opc)); + } else { + BuildMI(*BB, MI, DL, TII->get(TargetOpcode::COPY), AvailableReg) + .addReg(CalleeVReg); + MI.getOperand(0).ChangeToES(Symbol); + MI.setDesc(TII->get(Opc)); + MachineInstrBuilder(*BB->getParent(), &MI) + .addReg(AvailableReg, RegState::Implicit | RegState::Kill); + } + return BB; +} + +MachineBasicBlock * X86TargetLowering::emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const { DebugLoc DL = MI.getDebugLoc(); @@ -27584,6 +27702,11 @@ X86TargetLowering::EmitInstrWithCustomInserter(Machine case X86::TLS_base_addr32: case X86::TLS_base_addr64: return EmitLoweredTLSAddr(MI, BB); + case X86::RETPOLINE_CALL32: + case X86::RETPOLINE_CALL64: + case X86::RETPOLINE_TCRETURN32: + case X86::RETPOLINE_TCRETURN64: + return EmitLoweredRetpoline(MI, BB); case X86::CATCHRET: return EmitLoweredCatchRet(MI, BB); case X86::CATCHPAD: Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.h ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.h Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.h Fri Feb 2 17:07:53 2018 (r328786) @@ -982,6 +982,9 @@ namespace llvm { bool isVectorClearMaskLegal(const SmallVectorImpl &Mask, EVT VT) const override; + /// Returns true if lowering to a jump table is allowed. + bool areJTsAllowed(const Function *Fn) const override; + /// If true, then instruction selection should /// seek to shrink the FP constant of the specified type to a smaller type /// in order to save space and / or reduce runtime. @@ -1293,6 +1296,9 @@ namespace llvm { MachineBasicBlock *EmitLoweredTLSCall(MachineInstr &MI, MachineBasicBlock *BB) const; + + MachineBasicBlock *EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const; MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const; Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86InstrCompiler.td ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86InstrCompiler.td Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86InstrCompiler.td Fri Feb 2 17:07:53 2018 (r328786) @@ -1146,14 +1146,14 @@ def X86tcret_6regs : PatFrag<(ops node:$ptr, node:$off def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[Not64BitMode]>; + Requires<[Not64BitMode, NotUseRetpoline]>; // FIXME: This is disabled for 32-bit PIC mode because the global base // register which is part of the address mode may be assigned a // callee-saved register. def : Pat<(X86tcret (load addr:$dst), imm:$off), (TCRETURNmi addr:$dst, imm:$off)>, - Requires<[Not64BitMode, IsNotPIC]>; + Requires<[Not64BitMode, IsNotPIC, NotUseRetpoline]>; def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off), (TCRETURNdi tglobaladdr:$dst, imm:$off)>, @@ -1165,13 +1165,21 @@ def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off) def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri64 ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; // Don't fold loads into X86tcret requiring more than 6 regs. // There wouldn't be enough scratch registers for base+index. def : Pat<(X86tcret_6regs (load addr:$dst), imm:$off), (TCRETURNmi64 addr:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN64 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[In64BitMode, UseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN32 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[Not64BitMode, UseRetpoline]>; def : Pat<(X86tcret (i64 tglobaladdr:$dst), imm:$off), (TCRETURNdi64 tglobaladdr:$dst, imm:$off)>, Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86InstrControl.td ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86InstrControl.td Fri Feb 2 16:47:32 2018 (r328785) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86InstrControl.td Fri Feb 2 17:07:53 2018 (r328786) @@ -211,11 +211,12 @@ let isCall = 1 in Sched<[WriteJumpLd]>; def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst), "call{l}\t{*}$dst", [(X86call GR32:$dst)], IIC_CALL_RI>, - OpSize32, Requires<[Not64BitMode]>, Sched<[WriteJump]>; + OpSize32, Requires<[Not64BitMode,NotUseRetpoline]>, + Sched<[WriteJump]>; def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst), "call{l}\t{*}$dst", [(X86call (loadi32 addr:$dst))], IIC_CALL_MEM>, OpSize32, - Requires<[Not64BitMode,FavorMemIndirectCall]>, + Requires<[Not64BitMode,FavorMemIndirectCall,NotUseRetpoline]>, Sched<[WriteJumpLd]>; let Predicates = [Not64BitMode] in { @@ -298,11 +299,12 @@ let isCall = 1, Uses = [RSP, SSP], SchedRW = [WriteJum def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst), "call{q}\t{*}$dst", [(X86call GR64:$dst)], IIC_CALL_RI>, - Requires<[In64BitMode]>; + Requires<[In64BitMode,NotUseRetpoline]>; def CALL64m : I<0xFF, MRM2m, (outs), (ins i64mem:$dst), "call{q}\t{*}$dst", [(X86call (loadi64 addr:$dst))], IIC_CALL_MEM>, - Requires<[In64BitMode,FavorMemIndirectCall]>; + Requires<[In64BitMode,FavorMemIndirectCall, + NotUseRetpoline]>; def FARCALL64 : RI<0xFF, MRM3m, (outs), (ins opaque80mem:$dst), "lcall{q}\t{*}$dst", [], IIC_CALL_FAR_MEM>; @@ -338,6 +340,27 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarr let mayLoad = 1 in def TAILJMPm64_REX : I<0xFF, MRM4m, (outs), (ins i64mem_TC:$dst), "rex64 jmp{q}\t{*}$dst", [], IIC_JMP_MEM>; + } +} + +let isPseudo = 1, isCall = 1, isCodeGenOnly = 1, + Uses = [RSP, SSP], + usesCustomInserter = 1, + SchedRW = [WriteJump] in { + def RETPOLINE_CALL32 : + PseudoI<(outs), (ins GR32:$dst), [(X86call GR32:$dst)]>, + Requires<[Not64BitMode,UseRetpoline]>; + + def RETPOLINE_CALL64 : + PseudoI<(outs), (ins GR64:$dst), [(X86call GR64:$dst)]>, + Requires<[In64BitMode,UseRetpoline]>; + + // Retpoline variant of indirect tail calls. + let isTerminator = 1, isReturn = 1, isBarrier = 1 in { + def RETPOLINE_TCRETURN64 : + PseudoI<(outs), (ins GR64:$dst, i32imm:$offset), []>; + def RETPOLINE_TCRETURN32 : + PseudoI<(outs), (ins GR32:$dst, i32imm:$offset), []>; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:04 2018 Return-Path: Delivered-To: svn-src-all@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 7DE83EE431C; Fri, 2 Feb 2018 17:08:04 +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 A7A167487B; Fri, 2 Feb 2018 17:08:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74FBA1E802; Fri, 2 Feb 2018 17:08:01 +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 w12H81Na080194; Fri, 2 Feb 2018 17:08:01 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H81xu080193; Fri, 2 Feb 2018 17:08:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H81xu080193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328787 - vendor/llvm/llvm-release_60-r324090 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_60-r324090 X-SVN-Commit-Revision: 328787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:04 -0000 Author: dim Date: Fri Feb 2 17:08:01 2018 New Revision: 328787 URL: https://svnweb.freebsd.org/changeset/base/328787 Log: Tag llvm release_60 branch r324090. Added: vendor/llvm/llvm-release_60-r324090/ - copied from r328786, vendor/llvm/dist-release_60/ From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:12 2018 Return-Path: Delivered-To: svn-src-all@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 8656AEE434B; Fri, 2 Feb 2018 17:08:12 +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 D42F9749A1; Fri, 2 Feb 2018 17:08:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 249031E803; Fri, 2 Feb 2018 17:08:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12H89o4080247; Fri, 2 Feb 2018 17:08:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H898x080243; Fri, 2 Feb 2018 17:08:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H898x080243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328788 - in vendor/clang/dist-release_60: include/clang/Driver lib/Basic/Targets test/Driver X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_60: include/clang/Driver lib/Basic/Targets test/Driver X-SVN-Commit-Revision: 328788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:12 -0000 Author: dim Date: Fri Feb 2 17:08:09 2018 New Revision: 328788 URL: https://svnweb.freebsd.org/changeset/base/328788 Log: Vendor import of clang release_60 branch r324090: https://llvm.org/svn/llvm-project/cfe/branches/release_60@324090 Modified: vendor/clang/dist-release_60/include/clang/Driver/Options.td vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp vendor/clang/dist-release_60/lib/Basic/Targets/X86.h vendor/clang/dist-release_60/test/Driver/x86-target-features.c Modified: vendor/clang/dist-release_60/include/clang/Driver/Options.td ============================================================================== --- vendor/clang/dist-release_60/include/clang/Driver/Options.td Fri Feb 2 17:08:01 2018 (r328787) +++ vendor/clang/dist-release_60/include/clang/Driver/Options.td Fri Feb 2 17:08:09 2018 (r328788) @@ -2583,6 +2583,10 @@ def mshstk : Flag<["-"], "mshstk">, Group, Group; def mibt : Flag<["-"], "mibt">, Group; def mno_ibt : Flag<["-"], "mno-ibt">, Group; +def mretpoline : Flag<["-"], "mretpoline">, Group; +def mno_retpoline : Flag<["-"], "mno-retpoline">, Group; +def mretpoline_external_thunk : Flag<["-"], "mretpoline-external-thunk">, Group; +def mno_retpoline_external_thunk : Flag<["-"], "mno-retpoline-external-thunk">, Group; // These are legacy user-facing driver-level option spellings. They are always // aliases for options that are spelled using the more common Unix / GNU flag Modified: vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp Fri Feb 2 17:08:01 2018 (r328787) +++ vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp Fri Feb 2 17:08:09 2018 (r328788) @@ -763,6 +763,10 @@ bool X86TargetInfo::handleTargetFeatures(std::vector(Feature) @@ -1305,6 +1309,8 @@ bool X86TargetInfo::hasFeature(StringRef Feature) cons .Case("prfchw", HasPRFCHW) .Case("rdrnd", HasRDRND) .Case("rdseed", HasRDSEED) + .Case("retpoline", HasRetpoline) + .Case("retpoline-external-thunk", HasRetpolineExternalThunk) .Case("rtm", HasRTM) .Case("sgx", HasSGX) .Case("sha", HasSHA) Modified: vendor/clang/dist-release_60/lib/Basic/Targets/X86.h ============================================================================== --- vendor/clang/dist-release_60/lib/Basic/Targets/X86.h Fri Feb 2 17:08:01 2018 (r328787) +++ vendor/clang/dist-release_60/lib/Basic/Targets/X86.h Fri Feb 2 17:08:09 2018 (r328788) @@ -96,6 +96,8 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public T bool HasCLWB = false; bool HasMOVBE = false; bool HasPREFETCHWT1 = false; + bool HasRetpoline = false; + bool HasRetpolineExternalThunk = false; /// \brief Enumeration of all of the X86 CPUs supported by Clang. /// Modified: vendor/clang/dist-release_60/test/Driver/x86-target-features.c ============================================================================== --- vendor/clang/dist-release_60/test/Driver/x86-target-features.c Fri Feb 2 17:08:01 2018 (r328787) +++ vendor/clang/dist-release_60/test/Driver/x86-target-features.c Fri Feb 2 17:08:09 2018 (r328788) @@ -125,3 +125,12 @@ // VBMI2: "-target-feature" "+avx512vbmi2" // NO-VBMI2: "-target-feature" "-avx512vbmi2" +// RUN: %clang -target i386-linux-gnu -mretpoline %s -### -o %t.o 2>&1 | FileCheck -check-prefix=RETPOLINE %s +// RUN: %clang -target i386-linux-gnu -mno-retpoline %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-RETPOLINE %s +// RETPOLINE: "-target-feature" "+retpoline" +// NO-RETPOLINE: "-target-feature" "-retpoline" + +// RUN: %clang -target i386-linux-gnu -mretpoline -mretpoline-external-thunk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=RETPOLINE-EXTERNAL-THUNK %s +// RUN: %clang -target i386-linux-gnu -mretpoline -mno-retpoline-external-thunk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-RETPOLINE-EXTERNAL-THUNK %s +// RETPOLINE-EXTERNAL-THUNK: "-target-feature" "+retpoline-external-thunk" +// NO-RETPOLINE-EXTERNAL-THUNK: "-target-feature" "-retpoline-external-thunk" From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:16 2018 Return-Path: Delivered-To: svn-src-all@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 1A3C0EE437D; Fri, 2 Feb 2018 17:08:15 +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 5BE2B749AB; Fri, 2 Feb 2018 17:08:13 +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 3E9181E804; Fri, 2 Feb 2018 17:08:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12H8Dk5080294; Fri, 2 Feb 2018 17:08:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H8DHJ080293; Fri, 2 Feb 2018 17:08:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H8DHJ080293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328789 - vendor/clang/clang-release_60-r324090 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_60-r324090 X-SVN-Commit-Revision: 328789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:16 -0000 Author: dim Date: Fri Feb 2 17:08:12 2018 New Revision: 328789 URL: https://svnweb.freebsd.org/changeset/base/328789 Log: Tag clang release_60 branch r324090. Added: vendor/clang/clang-release_60-r324090/ - copied from r328788, vendor/clang/dist-release_60/ From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:21 2018 Return-Path: Delivered-To: svn-src-all@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 357B7EE43A7; Fri, 2 Feb 2018 17:08:21 +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 06F5074A58; Fri, 2 Feb 2018 17:08:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D51A1E805; Fri, 2 Feb 2018 17:08:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12H8Ivv080342; Fri, 2 Feb 2018 17:08:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H8I9P080341; Fri, 2 Feb 2018 17:08:18 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H8I9P080341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328790 - vendor/compiler-rt/compiler-rt-release_60-r324090 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_60-r324090 X-SVN-Commit-Revision: 328790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:21 -0000 Author: dim Date: Fri Feb 2 17:08:17 2018 New Revision: 328790 URL: https://svnweb.freebsd.org/changeset/base/328790 Log: Tag compiler-rt release_60 branch r324090. Added: vendor/compiler-rt/compiler-rt-release_60-r324090/ - copied from r328789, vendor/compiler-rt/dist-release_60/ From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:30 2018 Return-Path: Delivered-To: svn-src-all@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 EBE22EE43CE; Fri, 2 Feb 2018 17:08:29 +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 EA96074BB9; Fri, 2 Feb 2018 17:08:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC9A11E806; Fri, 2 Feb 2018 17:08:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12H8R72080391; Fri, 2 Feb 2018 17:08:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H8RvC080390; Fri, 2 Feb 2018 17:08:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H8RvC080390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328791 - vendor/libc++/libc++-release_60-r324090 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_60-r324090 X-SVN-Commit-Revision: 328791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:30 -0000 Author: dim Date: Fri Feb 2 17:08:27 2018 New Revision: 328791 URL: https://svnweb.freebsd.org/changeset/base/328791 Log: Tag libc++ release_60 branch r324090. Added: vendor/libc++/libc++-release_60-r324090/ - copied from r328790, vendor/libc++/dist-release_60/ From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:37 2018 Return-Path: Delivered-To: svn-src-all@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 09345EE4402; Fri, 2 Feb 2018 17:08:37 +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 8E19674CDA; Fri, 2 Feb 2018 17:08:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C7C61E808; Fri, 2 Feb 2018 17:08:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12H8aQg080495; Fri, 2 Feb 2018 17:08:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H8aq0080494; Fri, 2 Feb 2018 17:08:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H8aq0080494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328793 - vendor/lld/lld-release_60-r324090 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_60-r324090 X-SVN-Commit-Revision: 328793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:37 -0000 Author: dim Date: Fri Feb 2 17:08:35 2018 New Revision: 328793 URL: https://svnweb.freebsd.org/changeset/base/328793 Log: Tag lld release_60 branch r324090. Added: vendor/lld/lld-release_60-r324090/ - copied from r328792, vendor/lld/dist-release_60/ From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:34 2018 Return-Path: Delivered-To: svn-src-all@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 ED1E3EE43EE; Fri, 2 Feb 2018 17:08:33 +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 B772674C29; Fri, 2 Feb 2018 17:08:31 +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 DEC7A1E807; Fri, 2 Feb 2018 17:08:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12H8UJJ080448; Fri, 2 Feb 2018 17:08:30 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H8UdH080440; Fri, 2 Feb 2018 17:08:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H8UdH080440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328792 - in vendor/lld/dist-release_60: ELF ELF/Arch test/ELF X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist-release_60: ELF ELF/Arch test/ELF X-SVN-Commit-Revision: 328792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:34 -0000 Author: dim Date: Fri Feb 2 17:08:29 2018 New Revision: 328792 URL: https://svnweb.freebsd.org/changeset/base/328792 Log: Vendor import of lld release_60 branch r324090: https://llvm.org/svn/llvm-project/lld/branches/release_60@324090 Added: vendor/lld/dist-release_60/test/ELF/i386-retpoline-nopic.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/i386-retpoline-pic.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/x86-64-retpoline-znow.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/x86-64-retpoline.s (contents, props changed) Modified: vendor/lld/dist-release_60/ELF/Arch/X86.cpp vendor/lld/dist-release_60/ELF/Arch/X86_64.cpp vendor/lld/dist-release_60/ELF/Config.h vendor/lld/dist-release_60/ELF/Driver.cpp Modified: vendor/lld/dist-release_60/ELF/Arch/X86.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/Arch/X86.cpp Fri Feb 2 17:08:27 2018 (r328791) +++ vendor/lld/dist-release_60/ELF/Arch/X86.cpp Fri Feb 2 17:08:29 2018 (r328792) @@ -21,7 +21,7 @@ using namespace lld; using namespace lld::elf; namespace { -class X86 final : public TargetInfo { +class X86 : public TargetInfo { public: X86(); RelExpr getRelExpr(RelType Type, const Symbol &S, @@ -399,7 +399,145 @@ void X86::relaxTlsLdToLe(uint8_t *Loc, RelType Type, u memcpy(Loc - 2, Inst, sizeof(Inst)); } +namespace { +class RetpolinePic : public X86 { +public: + RetpolinePic(); + void writeGotPlt(uint8_t *Buf, const Symbol &S) const override; + void writePltHeader(uint8_t *Buf) const override; + void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, + int32_t Index, unsigned RelOff) const override; +}; + +class RetpolineNoPic : public X86 { +public: + RetpolineNoPic(); + void writeGotPlt(uint8_t *Buf, const Symbol &S) const override; + void writePltHeader(uint8_t *Buf) const override; + void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, + int32_t Index, unsigned RelOff) const override; +}; +} // namespace + +RetpolinePic::RetpolinePic() { + PltHeaderSize = 48; + PltEntrySize = 32; +} + +void RetpolinePic::writeGotPlt(uint8_t *Buf, const Symbol &S) const { + write32le(Buf, S.getPltVA() + 17); +} + +void RetpolinePic::writePltHeader(uint8_t *Buf) const { + const uint8_t Insn[] = { + 0xff, 0xb3, 0, 0, 0, 0, // 0: pushl GOTPLT+4(%ebx) + 0x50, // 6: pushl %eax + 0x8b, 0x83, 0, 0, 0, 0, // 7: mov GOTPLT+8(%ebx), %eax + 0xe8, 0x0e, 0x00, 0x00, 0x00, // d: call next + 0xf3, 0x90, // 12: loop: pause + 0x0f, 0xae, 0xe8, // 14: lfence + 0xeb, 0xf9, // 17: jmp loop + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, // 19: int3; .align 16 + 0x89, 0x0c, 0x24, // 20: next: mov %ecx, (%esp) + 0x8b, 0x4c, 0x24, 0x04, // 23: mov 0x4(%esp), %ecx + 0x89, 0x44, 0x24, 0x04, // 27: mov %eax ,0x4(%esp) + 0x89, 0xc8, // 2b: mov %ecx, %eax + 0x59, // 2d: pop %ecx + 0xc3, // 2e: ret + }; + memcpy(Buf, Insn, sizeof(Insn)); + + uint32_t Ebx = InX::Got->getVA() + InX::Got->getSize(); + uint32_t GotPlt = InX::GotPlt->getVA() - Ebx; + write32le(Buf + 2, GotPlt + 4); + write32le(Buf + 9, GotPlt + 8); +} + +void RetpolinePic::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, + uint64_t PltEntryAddr, int32_t Index, + unsigned RelOff) const { + const uint8_t Insn[] = { + 0x50, // pushl %eax + 0x8b, 0x83, 0, 0, 0, 0, // mov foo@GOT(%ebx), %eax + 0xe8, 0, 0, 0, 0, // call plt+0x20 + 0xe9, 0, 0, 0, 0, // jmp plt+0x12 + 0x68, 0, 0, 0, 0, // pushl $reloc_offset + 0xe9, 0, 0, 0, 0, // jmp plt+0 + }; + memcpy(Buf, Insn, sizeof(Insn)); + + uint32_t Ebx = InX::Got->getVA() + InX::Got->getSize(); + write32le(Buf + 3, GotPltEntryAddr - Ebx); + write32le(Buf + 8, -Index * PltEntrySize - PltHeaderSize - 12 + 32); + write32le(Buf + 13, -Index * PltEntrySize - PltHeaderSize - 17 + 18); + write32le(Buf + 18, RelOff); + write32le(Buf + 23, -Index * PltEntrySize - PltHeaderSize - 27); +} + +RetpolineNoPic::RetpolineNoPic() { + PltHeaderSize = 48; + PltEntrySize = 32; +} + +void RetpolineNoPic::writeGotPlt(uint8_t *Buf, const Symbol &S) const { + write32le(Buf, S.getPltVA() + 16); +} + +void RetpolineNoPic::writePltHeader(uint8_t *Buf) const { + const uint8_t PltData[] = { + 0xff, 0x35, 0, 0, 0, 0, // 0: pushl GOTPLT+4 + 0x50, // 6: pushl %eax + 0xa1, 0, 0, 0, 0, // 7: mov GOTPLT+8, %eax + 0xe8, 0x0f, 0x00, 0x00, 0x00, // c: call next + 0xf3, 0x90, // 11: loop: pause + 0x0f, 0xae, 0xe8, // 13: lfence + 0xeb, 0xf9, // 16: jmp loop + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, // 18: int3 + 0xcc, 0xcc, 0xcc, // 1f: int3; .align 16 + 0x89, 0x0c, 0x24, // 20: next: mov %ecx, (%esp) + 0x8b, 0x4c, 0x24, 0x04, // 23: mov 0x4(%esp), %ecx + 0x89, 0x44, 0x24, 0x04, // 27: mov %eax ,0x4(%esp) + 0x89, 0xc8, // 2b: mov %ecx, %eax + 0x59, // 2d: pop %ecx + 0xc3, // 2e: ret + }; + memcpy(Buf, PltData, sizeof(PltData)); + + uint32_t GotPlt = InX::GotPlt->getVA(); + write32le(Buf + 2, GotPlt + 4); + write32le(Buf + 8, GotPlt + 8); +} + +void RetpolineNoPic::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, + uint64_t PltEntryAddr, int32_t Index, + unsigned RelOff) const { + const uint8_t Insn[] = { + 0x50, // 0: pushl %eax + 0xa1, 0, 0, 0, 0, // 1: mov foo_in_GOT, %eax + 0xe8, 0, 0, 0, 0, // 6: call plt+0x20 + 0xe9, 0, 0, 0, 0, // b: jmp plt+0x11 + 0x68, 0, 0, 0, 0, // 10: pushl $reloc_offset + 0xe9, 0, 0, 0, 0, // 15: jmp plt+0 + }; + memcpy(Buf, Insn, sizeof(Insn)); + + write32le(Buf + 2, GotPltEntryAddr); + write32le(Buf + 7, -Index * PltEntrySize - PltHeaderSize - 11 + 32); + write32le(Buf + 12, -Index * PltEntrySize - PltHeaderSize - 16 + 17); + write32le(Buf + 17, RelOff); + write32le(Buf + 22, -Index * PltEntrySize - PltHeaderSize - 26); +} + TargetInfo *elf::getX86TargetInfo() { - static X86 Target; - return &Target; + if (Config->ZRetpolineplt) { + if (Config->Pic) { + static RetpolinePic T; + return &T; + } + static RetpolineNoPic T; + return &T; + } + + static X86 T; + return &T; } Modified: vendor/lld/dist-release_60/ELF/Arch/X86_64.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/Arch/X86_64.cpp Fri Feb 2 17:08:27 2018 (r328791) +++ vendor/lld/dist-release_60/ELF/Arch/X86_64.cpp Fri Feb 2 17:08:29 2018 (r328792) @@ -23,7 +23,7 @@ using namespace lld; using namespace lld::elf; namespace { -template class X86_64 final : public TargetInfo { +template class X86_64 : public TargetInfo { public: X86_64(); RelExpr getRelExpr(RelType Type, const Symbol &S, @@ -460,12 +460,125 @@ void X86_64::relaxGot(uint8_t *Loc, uint64_t Val write32le(Loc - 1, Val + 1); } -TargetInfo *elf::getX32TargetInfo() { - static X86_64 Target; - return &Target; +namespace { +template class Retpoline : public X86_64 { +public: + Retpoline(); + void writeGotPlt(uint8_t *Buf, const Symbol &S) const override; + void writePltHeader(uint8_t *Buf) const override; + void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, + int32_t Index, unsigned RelOff) const override; +}; + +template class RetpolineZNow : public X86_64 { +public: + RetpolineZNow(); + void writeGotPlt(uint8_t *Buf, const Symbol &S) const override {} + void writePltHeader(uint8_t *Buf) const override; + void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, + int32_t Index, unsigned RelOff) const override; +}; +} // namespace + +template Retpoline::Retpoline() { + TargetInfo::PltHeaderSize = 48; + TargetInfo::PltEntrySize = 32; } -TargetInfo *elf::getX86_64TargetInfo() { - static X86_64 Target; - return &Target; +template +void Retpoline::writeGotPlt(uint8_t *Buf, const Symbol &S) const { + write32le(Buf, S.getPltVA() + 17); } + +template void Retpoline::writePltHeader(uint8_t *Buf) const { + const uint8_t Insn[] = { + 0xff, 0x35, 0, 0, 0, 0, // 0: pushq GOTPLT+8(%rip) + 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, // 6: mov GOTPLT+16(%rip), %r11 + 0xe8, 0x0e, 0x00, 0x00, 0x00, // d: callq next + 0xf3, 0x90, // 12: loop: pause + 0x0f, 0xae, 0xe8, // 14: lfence + 0xeb, 0xf9, // 17: jmp loop + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, // 19: int3; .align 16 + 0x4c, 0x89, 0x1c, 0x24, // 20: next: mov %r11, (%rsp) + 0xc3, // 24: ret + }; + memcpy(Buf, Insn, sizeof(Insn)); + + uint64_t GotPlt = InX::GotPlt->getVA(); + uint64_t Plt = InX::Plt->getVA(); + write32le(Buf + 2, GotPlt - Plt - 6 + 8); + write32le(Buf + 9, GotPlt - Plt - 13 + 16); +} + +template +void Retpoline::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, + uint64_t PltEntryAddr, int32_t Index, + unsigned RelOff) const { + const uint8_t Insn[] = { + 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, // 0: mov foo@GOTPLT(%rip), %r11 + 0xe8, 0, 0, 0, 0, // 7: callq plt+0x20 + 0xe9, 0, 0, 0, 0, // c: jmp plt+0x12 + 0x68, 0, 0, 0, 0, // 11: pushq + 0xe9, 0, 0, 0, 0, // 16: jmp plt+0 + }; + memcpy(Buf, Insn, sizeof(Insn)); + + uint64_t Off = TargetInfo::PltHeaderSize + TargetInfo::PltEntrySize * Index; + + write32le(Buf + 3, GotPltEntryAddr - PltEntryAddr - 7); + write32le(Buf + 8, -Off - 12 + 32); + write32le(Buf + 13, -Off - 17 + 18); + write32le(Buf + 18, Index); + write32le(Buf + 23, -Off - 27); +} + +template RetpolineZNow::RetpolineZNow() { + TargetInfo::PltHeaderSize = 32; + TargetInfo::PltEntrySize = 16; +} + +template +void RetpolineZNow::writePltHeader(uint8_t *Buf) const { + const uint8_t Insn[] = { + 0xe8, 0x0b, 0x00, 0x00, 0x00, // 0: call next + 0xf3, 0x90, // 5: loop: pause + 0x0f, 0xae, 0xe8, // 7: lfence + 0xeb, 0xf9, // a: jmp loop + 0xcc, 0xcc, 0xcc, 0xcc, // c: int3; .align 16 + 0x4c, 0x89, 0x1c, 0x24, // 10: next: mov %r11, (%rsp) + 0xc3, // 14: ret + }; + memcpy(Buf, Insn, sizeof(Insn)); +} + +template +void RetpolineZNow::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, + uint64_t PltEntryAddr, int32_t Index, + unsigned RelOff) const { + const uint8_t Insn[] = { + 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, // mov foo@GOTPLT(%rip), %r11 + 0xe9, 0, 0, 0, 0, // jmp plt+0 + }; + memcpy(Buf, Insn, sizeof(Insn)); + + write32le(Buf + 3, GotPltEntryAddr - PltEntryAddr - 7); + write32le(Buf + 8, + -Index * TargetInfo::PltEntrySize - TargetInfo::PltHeaderSize - 12); +} + +template TargetInfo *getTargetInfo() { + if (Config->ZRetpolineplt) { + if (Config->ZNow) { + static RetpolineZNow T; + return &T; + } + static Retpoline T; + return &T; + } + + static X86_64 T; + return &T; +} + +TargetInfo *elf::getX32TargetInfo() { return getTargetInfo(); } +TargetInfo *elf::getX86_64TargetInfo() { return getTargetInfo(); } Modified: vendor/lld/dist-release_60/ELF/Config.h ============================================================================== --- vendor/lld/dist-release_60/ELF/Config.h Fri Feb 2 17:08:27 2018 (r328791) +++ vendor/lld/dist-release_60/ELF/Config.h Fri Feb 2 17:08:29 2018 (r328792) @@ -159,6 +159,7 @@ struct Configuration { bool ZRelro; bool ZRodynamic; bool ZText; + bool ZRetpolineplt; bool ExitEarly; bool ZWxneeded; DiscardPolicy Discard; Modified: vendor/lld/dist-release_60/ELF/Driver.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/Driver.cpp Fri Feb 2 17:08:27 2018 (r328791) +++ vendor/lld/dist-release_60/ELF/Driver.cpp Fri Feb 2 17:08:29 2018 (r328792) @@ -674,6 +674,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args Config->ZNow = hasZOption(Args, "now"); Config->ZOrigin = hasZOption(Args, "origin"); Config->ZRelro = !hasZOption(Args, "norelro"); + Config->ZRetpolineplt = hasZOption(Args, "retpolineplt"); Config->ZRodynamic = hasZOption(Args, "rodynamic"); Config->ZStackSize = args::getZOptionValue(Args, OPT_z, "stack-size", 0); Config->ZText = !hasZOption(Args, "notext"); Added: vendor/lld/dist-release_60/test/ELF/i386-retpoline-nopic.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/i386-retpoline-nopic.s Fri Feb 2 17:08:29 2018 (r328792) @@ -0,0 +1,65 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %s -o %t1.o +// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %p/Inputs/shared.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so + +// RUN: ld.lld %t1.o %t2.so -o %t.exe -z retpolineplt +// RUN: llvm-objdump -d -s %t.exe | FileCheck %s + +// CHECK: Disassembly of section .plt: +// CHECK-NEXT: .plt: +// CHECK-NEXT: 11010: ff 35 04 20 01 00 pushl 73732 +// CHECK-NEXT: 11016: 50 pushl %eax +// CHECK-NEXT: 11017: a1 08 20 01 00 movl 73736, %eax +// CHECK-NEXT: 1101c: e8 0f 00 00 00 calll 15 <.plt+0x20> +// CHECK-NEXT: 11021: f3 90 pause +// CHECK-NEXT: 11023: 0f ae e8 lfence +// CHECK-NEXT: 11026: eb f9 jmp -7 <.plt+0x11> +// CHECK-NEXT: 11028: cc int3 +// CHECK-NEXT: 11029: cc int3 +// CHECK-NEXT: 1102a: cc int3 +// CHECK-NEXT: 1102b: cc int3 +// CHECK-NEXT: 1102c: cc int3 +// CHECK-NEXT: 1102d: cc int3 +// CHECK-NEXT: 1102e: cc int3 +// CHECK-NEXT: 1102f: cc int3 +// CHECK-NEXT: 11030: 89 0c 24 movl %ecx, (%esp) +// CHECK-NEXT: 11033: 8b 4c 24 04 movl 4(%esp), %ecx +// CHECK-NEXT: 11037: 89 44 24 04 movl %eax, 4(%esp) +// CHECK-NEXT: 1103b: 89 c8 movl %ecx, %eax +// CHECK-NEXT: 1103d: 59 popl %ecx +// CHECK-NEXT: 1103e: c3 retl +// CHECK-NEXT: 1103f: cc int3 +// CHECK-NEXT: 11040: 50 pushl %eax +// CHECK-NEXT: 11041: a1 0c 20 01 00 movl 73740, %eax +// CHECK-NEXT: 11046: e8 e5 ff ff ff calll -27 <.plt+0x20> +// CHECK-NEXT: 1104b: e9 d1 ff ff ff jmp -47 <.plt+0x11> +// CHECK-NEXT: 11050: 68 00 00 00 00 pushl $0 +// CHECK-NEXT: 11055: e9 b6 ff ff ff jmp -74 <.plt> +// CHECK-NEXT: 1105a: cc int3 +// CHECK-NEXT: 1105b: cc int3 +// CHECK-NEXT: 1105c: cc int3 +// CHECK-NEXT: 1105d: cc int3 +// CHECK-NEXT: 1105e: cc int3 +// CHECK-NEXT: 1105f: cc int3 +// CHECK-NEXT: 11060: 50 pushl %eax +// CHECK-NEXT: 11061: a1 10 20 01 00 movl 73744, %eax +// CHECK-NEXT: 11066: e8 c5 ff ff ff calll -59 <.plt+0x20> +// CHECK-NEXT: 1106b: e9 b1 ff ff ff jmp -79 <.plt+0x11> +// CHECK-NEXT: 11070: 68 08 00 00 00 pushl $8 +// CHECK-NEXT: 11075: e9 96 ff ff ff jmp -106 <.plt> +// CHECK-NEXT: 1107a: cc int3 +// CHECK-NEXT: 1107b: cc int3 +// CHECK-NEXT: 1107c: cc int3 +// CHECK-NEXT: 1107d: cc int3 +// CHECK-NEXT: 1107e: cc int3 +// CHECK-NEXT: 1107f: cc int3 + +// CHECK: Contents of section .got.plt: +// CHECK-NEXT: 00300100 00000000 00000000 50100100 +// CHECK-NEXT: 70100100 + +.global _start +_start: + jmp bar@PLT + jmp zed@PLT Added: vendor/lld/dist-release_60/test/ELF/i386-retpoline-pic.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/i386-retpoline-pic.s Fri Feb 2 17:08:29 2018 (r328792) @@ -0,0 +1,62 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux -position-independent %s -o %t1.o +// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux -position-independent %p/Inputs/shared.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so + +// RUN: ld.lld %t1.o %t2.so -o %t.exe -z retpolineplt -pie +// RUN: llvm-objdump -d -s %t.exe | FileCheck %s + +// CHECK: Disassembly of section .plt: +// CHECK-NEXT: .plt: +// CHECK-NEXT: 1010: ff b3 04 20 00 00 pushl 8196(%ebx) +// CHECK-NEXT: 1016: 50 pushl %eax +// CHECK-NEXT: 1017: 8b 83 08 20 00 00 movl 8200(%ebx), %eax +// CHECK-NEXT: 101d: e8 0e 00 00 00 calll 14 <.plt+0x20> +// CHECK-NEXT: 1022: f3 90 pause +// CHECK-NEXT: 1024: 0f ae e8 lfence +// CHECK-NEXT: 1027: eb f9 jmp -7 <.plt+0x12> +// CHECK-NEXT: 1029: cc int3 +// CHECK-NEXT: 102a: cc int3 +// CHECK-NEXT: 102b: cc int3 +// CHECK-NEXT: 102c: cc int3 +// CHECK-NEXT: 102d: cc int3 +// CHECK-NEXT: 102e: cc int3 +// CHECK-NEXT: 102f: cc int3 +// CHECK-NEXT: 1030: 89 0c 24 movl %ecx, (%esp) +// CHECK-NEXT: 1033: 8b 4c 24 04 movl 4(%esp), %ecx +// CHECK-NEXT: 1037: 89 44 24 04 movl %eax, 4(%esp) +// CHECK-NEXT: 103b: 89 c8 movl %ecx, %eax +// CHECK-NEXT: 103d: 59 popl %ecx +// CHECK-NEXT: 103e: c3 retl +// CHECK-NEXT: 103f: cc int3 +// CHECK-NEXT: 1040: 50 pushl %eax +// CHECK-NEXT: 1041: 8b 83 0c 20 00 00 movl 8204(%ebx), %eax +// CHECK-NEXT: 1047: e8 e4 ff ff ff calll -28 <.plt+0x20> +// CHECK-NEXT: 104c: e9 d1 ff ff ff jmp -47 <.plt+0x12> +// CHECK-NEXT: 1051: 68 00 00 00 00 pushl $0 +// CHECK-NEXT: 1056: e9 b5 ff ff ff jmp -75 <.plt> +// CHECK-NEXT: 105b: cc int3 +// CHECK-NEXT: 105c: cc int3 +// CHECK-NEXT: 105d: cc int3 +// CHECK-NEXT: 105e: cc int3 +// CHECK-NEXT: 105f: cc int3 +// CHECK-NEXT: 1060: 50 pushl %eax +// CHECK-NEXT: 1061: 8b 83 10 20 00 00 movl 8208(%ebx), %eax +// CHECK-NEXT: 1067: e8 c4 ff ff ff calll -60 <.plt+0x20> +// CHECK-NEXT: 106c: e9 b1 ff ff ff jmp -79 <.plt+0x12> +// CHECK-NEXT: 1071: 68 08 00 00 00 pushl $8 +// CHECK-NEXT: 1076: e9 95 ff ff ff jmp -107 <.plt> +// CHECK-NEXT: 107b: cc int3 +// CHECK-NEXT: 107c: cc int3 +// CHECK-NEXT: 107d: cc int3 +// CHECK-NEXT: 107e: cc int3 +// CHECK-NEXT: 107f: cc int3 + +// CHECK: Contents of section .got.plt: +// CHECK-NEXT: 2000 00300000 00000000 00000000 51100000 +// CHECK-NEXT: 2010 71100000 + +.global _start +_start: + jmp bar@PLT + jmp zed@PLT Added: vendor/lld/dist-release_60/test/ELF/x86-64-retpoline-znow.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/x86-64-retpoline-znow.s Fri Feb 2 17:08:29 2018 (r328792) @@ -0,0 +1,53 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so + +// RUN: ld.lld -shared %t1.o %t2.so -o %t.exe -z retpolineplt -z now +// RUN: llvm-objdump -d -s %t.exe | FileCheck %s + +// CHECK: Disassembly of section .plt: +// CHECK-NEXT: .plt: +// CHECK-NEXT: 1010: e8 0b 00 00 00 callq 11 <.plt+0x10> +// CHECK-NEXT: 1015: f3 90 pause +// CHECK-NEXT: 1017: 0f ae e8 lfence +// CHECK-NEXT: 101a: eb f9 jmp -7 <.plt+0x5> +// CHECK-NEXT: 101c: cc int3 +// CHECK-NEXT: 101d: cc int3 +// CHECK-NEXT: 101e: cc int3 +// CHECK-NEXT: 101f: cc int3 +// CHECK-NEXT: 1020: 4c 89 1c 24 movq %r11, (%rsp) +// CHECK-NEXT: 1024: c3 retq +// CHECK-NEXT: 1025: cc int3 +// CHECK-NEXT: 1026: cc int3 +// CHECK-NEXT: 1027: cc int3 +// CHECK-NEXT: 1028: cc int3 +// CHECK-NEXT: 1029: cc int3 +// CHECK-NEXT: 102a: cc int3 +// CHECK-NEXT: 102b: cc int3 +// CHECK-NEXT: 102c: cc int3 +// CHECK-NEXT: 102d: cc int3 +// CHECK-NEXT: 102e: cc int3 +// CHECK-NEXT: 102f: cc int3 +// CHECK-NEXT: 1030: 4c 8b 1d c1 10 00 00 movq 4289(%rip), %r11 +// CHECK-NEXT: 1037: e9 d4 ff ff ff jmp -44 <.plt> +// CHECK-NEXT: 103c: cc int3 +// CHECK-NEXT: 103d: cc int3 +// CHECK-NEXT: 103e: cc int3 +// CHECK-NEXT: 103f: cc int3 +// CHECK-NEXT: 1040: 4c 8b 1d b9 10 00 00 movq 4281(%rip), %r11 +// CHECK-NEXT: 1047: e9 c4 ff ff ff jmp -60 <.plt> +// CHECK-NEXT: 104c: cc int3 +// CHECK-NEXT: 104d: cc int3 +// CHECK-NEXT: 104e: cc int3 +// CHECK-NEXT: 104f: cc int3 + +// CHECK: Contents of section .got.plt: +// CHECK-NEXT: 20e0 00200000 00000000 00000000 00000000 +// CHECK-NEXT: 20f0 00000000 00000000 00000000 00000000 +// CHECK-NEXT: 2100 00000000 00000000 + +.global _start +_start: + jmp bar@PLT + jmp zed@PLT Added: vendor/lld/dist-release_60/test/ELF/x86-64-retpoline.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/x86-64-retpoline.s Fri Feb 2 17:08:29 2018 (r328792) @@ -0,0 +1,66 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so + +// RUN: ld.lld -shared %t1.o %t2.so -o %t.exe -z retpolineplt +// RUN: llvm-objdump -d -s %t.exe | FileCheck %s + +// CHECK: Disassembly of section .plt: +// CHECK-NEXT: .plt: +// CHECK-NEXT: 1010: ff 35 f2 0f 00 00 pushq 4082(%rip) +// CHECK-NEXT: 1016: 4c 8b 1d f3 0f 00 00 movq 4083(%rip), %r11 +// CHECK-NEXT: 101d: e8 0e 00 00 00 callq 14 <.plt+0x20> +// CHECK-NEXT: 1022: f3 90 pause +// CHECK-NEXT: 1024: 0f ae e8 lfence +// CHECK-NEXT: 1027: eb f9 jmp -7 <.plt+0x12> +// CHECK-NEXT: 1029: cc int3 +// CHECK-NEXT: 102a: cc int3 +// CHECK-NEXT: 102b: cc int3 +// CHECK-NEXT: 102c: cc int3 +// CHECK-NEXT: 102d: cc int3 +// CHECK-NEXT: 102e: cc int3 +// CHECK-NEXT: 102f: cc int3 +// CHECK-NEXT: 1030: 4c 89 1c 24 movq %r11, (%rsp) +// CHECK-NEXT: 1034: c3 retq +// CHECK-NEXT: 1035: cc int3 +// CHECK-NEXT: 1036: cc int3 +// CHECK-NEXT: 1037: cc int3 +// CHECK-NEXT: 1038: cc int3 +// CHECK-NEXT: 1039: cc int3 +// CHECK-NEXT: 103a: cc int3 +// CHECK-NEXT: 103b: cc int3 +// CHECK-NEXT: 103c: cc int3 +// CHECK-NEXT: 103d: cc int3 +// CHECK-NEXT: 103e: cc int3 +// CHECK-NEXT: 103f: cc int3 +// CHECK-NEXT: 1040: 4c 8b 1d d1 0f 00 00 movq 4049(%rip), %r11 +// CHECK-NEXT: 1047: e8 e4 ff ff ff callq -28 <.plt+0x20> +// CHECK-NEXT: 104c: e9 d1 ff ff ff jmp -47 <.plt+0x12> +// CHECK-NEXT: 1051: 68 00 00 00 00 pushq $0 +// CHECK-NEXT: 1056: e9 b5 ff ff ff jmp -75 <.plt> +// CHECK-NEXT: 105b: cc int3 +// CHECK-NEXT: 105c: cc int3 +// CHECK-NEXT: 105d: cc int3 +// CHECK-NEXT: 105e: cc int3 +// CHECK-NEXT: 105f: cc int3 +// CHECK-NEXT: 1060: 4c 8b 1d b9 0f 00 00 movq 4025(%rip), %r11 +// CHECK-NEXT: 1067: e8 c4 ff ff ff callq -60 <.plt+0x20> +// CHECK-NEXT: 106c: e9 b1 ff ff ff jmp -79 <.plt+0x12> +// CHECK-NEXT: 1071: 68 01 00 00 00 pushq $1 +// CHECK-NEXT: 1076: e9 95 ff ff ff jmp -107 <.plt> +// CHECK-NEXT: 107b: cc int3 +// CHECK-NEXT: 107c: cc int3 +// CHECK-NEXT: 107d: cc int3 +// CHECK-NEXT: 107e: cc int3 +// CHECK-NEXT: 107f: cc int3 + +// CHECK: Contents of section .got.plt: +// CHECK-NEXT: 2000 00300000 00000000 00000000 00000000 +// CHECK-NEXT: 2010 00000000 00000000 51100000 00000000 +// CHECK-NEXT: 2020 71100000 00000000 + +.global _start +_start: + jmp bar@PLT + jmp zed@PLT From owner-svn-src-all@freebsd.org Fri Feb 2 17:08:44 2018 Return-Path: Delivered-To: svn-src-all@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 48AFCEE4450; Fri, 2 Feb 2018 17:08:44 +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 1846674E00; Fri, 2 Feb 2018 17:08:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B2611E809; Fri, 2 Feb 2018 17:08:40 +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 w12H8eOp080543; Fri, 2 Feb 2018 17:08:40 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12H8eGA080542; Fri, 2 Feb 2018 17:08:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802021708.w12H8eGA080542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 17:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328794 - vendor/lldb/lldb-release_60-r324090 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_60-r324090 X-SVN-Commit-Revision: 328794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:08:44 -0000 Author: dim Date: Fri Feb 2 17:08:39 2018 New Revision: 328794 URL: https://svnweb.freebsd.org/changeset/base/328794 Log: Tag lldb release_60 branch r324090. Added: vendor/lldb/lldb-release_60-r324090/ - copied from r328793, vendor/lldb/dist-release_60/ From owner-svn-src-all@freebsd.org Fri Feb 2 17:52:10 2018 Return-Path: Delivered-To: svn-src-all@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 E62EEEE6627; Fri, 2 Feb 2018 17:52:09 +0000 (UTC) (envelope-from rgrimes@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 9742B76E92; Fri, 2 Feb 2018 17:52:09 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 921411EFF8; Fri, 2 Feb 2018 17:52:09 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12Hq9vH002447; Fri, 2 Feb 2018 17:52:09 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12Hq9FM002446; Fri, 2 Feb 2018 17:52:09 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201802021752.w12Hq9FM002446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 2 Feb 2018 17:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328795 - head/share/examples/bhyve X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/share/examples/bhyve X-SVN-Commit-Revision: 328795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:52:10 -0000 Author: rgrimes Date: Fri Feb 2 17:52:09 2018 New Revision: 328795 URL: https://svnweb.freebsd.org/changeset/base/328795 Log: Fold constants and unify vnc variable names. Approved by: grehan (mentor) MFC after: 3 days Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh ============================================================================== --- head/share/examples/bhyve/vmrun.sh Fri Feb 2 17:08:39 2018 (r328794) +++ head/share/examples/bhyve/vmrun.sh Fri Feb 2 17:52:09 2018 (r328795) @@ -39,9 +39,14 @@ DEFAULT_TAPDEV=tap0 DEFAULT_CONSOLE=stdio DEFAULT_NIC=virtio-net +DEFAULT_DISK=virtio-blk DEFAULT_VIRTIO_DISK="./diskdev" DEFAULT_ISOFILE="./release.iso" +DEFAULT_VNCHOST="127.0.0.1" +DEFAULT_VNCPORT=5900 +DEFAULT_VNCSIZE="w=1024,h=768" + errmsg() { echo "*** $1" } @@ -62,7 +67,7 @@ usage() { echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" - echo " -A: use AHCI disk emulation instead of virtio" + echo " -A: use AHCI disk emulation instead of ${DEFAULT_DISK}" echo " -c: number of virtual cpus (default: ${DEFAULT_CPUS})" echo " -C: console device (default: ${DEFAULT_CONSOLE})" echo " -d: virtio diskdev file (default: ${DEFAULT_VIRTIO_DISK})" @@ -70,7 +75,7 @@ usage() { echo " -E: Use UEFI mode" echo " -f: Use a specific UEFI firmware" echo " -F: Use a custom UEFI GOP framebuffer size" \ - "(default: w=1024,h=768)" + "(default: ${DEFAULT_VNCSIZE}" echo " -g: listen for connection from kgdb at " echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" @@ -78,13 +83,13 @@ usage() { "(default: ${DEFAULT_ISOFILE})" echo " -l: the OS loader to use (default: /boot/userboot.so)" echo " -L: IP address for UEFI GOP VNC server" \ - "(default: 127.0.0.1)" + "(default: ${DEFAULT_VNCHOST}" echo " -m: memory size (default: ${DEFAULT_MEMSIZE})" echo " -n: network adapter emulation type" \ "(default: ${DEFAULT_NIC})" echo " -p: pass-through a host PCI device at bus/slot/func" \ "(e.g. 10/0/0)" - echo " -P: UEFI GOP VNC port (default: 5900)" + echo " -P: UEFI GOP VNC port (default: ${DEFAULT_VNCPORT})" echo " -t: tap device for virtio-net (default: $DEFAULT_TAPDEV)" echo " -T: Enable tablet device (for UEFI GOP)" echo " -u: RTC keeps UTC time" @@ -114,7 +119,7 @@ cpus=${DEFAULT_CPUS} nic=${DEFAULT_NIC} tap_total=0 disk_total=0 -disk_emulation="virtio-blk" +disk_emulation=${DEFAULT_DISK} gdbport=0 loader_opt="" bhyverun_opt="-H -A -P" @@ -124,9 +129,9 @@ pass_total=0 efi_mode=0 efi_firmware="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd" vncwait="" -vnchost="127.0.0.1" -vncport=5900 -fbsize="w=1024,h=768" +vnchost=${DEFAULT_VNCHOST} +vncport=${DEFAULT_VNCPORT} +vncsize=${DEFAULT_VNCSIZE} tablet="" while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:n:p:P:t:Tuvw c ; do @@ -160,7 +165,7 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:n:p:P:t:Tuvw efi_firmware="${OPTARG}" ;; F) - fbsize="${OPTARG}" + vncsize="${OPTARG}" ;; g) gdbport=${OPTARG} @@ -356,7 +361,7 @@ while [ 1 ]; do efiargs="" if [ ${efi_mode} -gt 0 ]; then efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport}," - efiargs="${efiargs}${fbsize}${vncwait}" + efiargs="${efiargs}${vncsize}${vncwait}" efiargs="${efiargs} -l bootrom,${efi_firmware}" efiargs="${efiargs} ${tablet}" fi From owner-svn-src-all@freebsd.org Fri Feb 2 17:56:48 2018 Return-Path: Delivered-To: svn-src-all@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 7B592EE699F; Fri, 2 Feb 2018 17:56:48 +0000 (UTC) (envelope-from mav@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 2CBEF77230; Fri, 2 Feb 2018 17:56:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23AB11F01E; Fri, 2 Feb 2018 17:56:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12HulnB005539; Fri, 2 Feb 2018 17:56:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12Hul06005538; Fri, 2 Feb 2018 17:56:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021756.w12Hul06005538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 17:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328796 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:56:48 -0000 Author: mav Date: Fri Feb 2 17:56:47 2018 New Revision: 328796 URL: https://svnweb.freebsd.org/changeset/base/328796 Log: MFC r307041 (by sbruno): Fix bug where malloc(.., M_NOWAIT) return value is not checked, Change to M_WAITOK and move outside the mutex Modified: stable/11/sys/kern/subr_gtaskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 17:52:09 2018 (r328795) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 17:56:47 2018 (r328796) @@ -729,7 +729,7 @@ taskqgroup_bind(struct taskqgroup *qgroup) * one. */ for (i = 0; i < qgroup->tqg_cnt; i++) { - gtask = malloc(sizeof (*gtask), M_DEVBUF, M_NOWAIT); + gtask = malloc(sizeof (*gtask), M_DEVBUF, M_WAITOK); GTASK_INIT(>ask->bt_task, 0, 0, taskqgroup_binder, gtask); gtask->bt_cpuid = qgroup->tqg_queue[i].tgc_cpu; grouptaskqueue_enqueue(qgroup->tqg_queue[i].tgc_taskq, @@ -828,10 +828,10 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, for (i = cnt; i < old_cnt; i++) taskqgroup_cpu_remove(qgroup, i); + taskqgroup_bind(qgroup); + mtx_lock(&qgroup->tqg_lock); qgroup->tqg_adjusting = 0; - - taskqgroup_bind(qgroup); return (0); } From owner-svn-src-all@freebsd.org Fri Feb 2 17:59:45 2018 Return-Path: Delivered-To: svn-src-all@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 96339EE6B5A; Fri, 2 Feb 2018 17:59:45 +0000 (UTC) (envelope-from mav@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 48AC177402; Fri, 2 Feb 2018 17:59:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4396E1F025; Fri, 2 Feb 2018 17:59:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12HxjCT005723; Fri, 2 Feb 2018 17:59:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12HxjSv005722; Fri, 2 Feb 2018 17:59:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021759.w12HxjSv005722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 17:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328797 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 17:59:45 -0000 Author: mav Date: Fri Feb 2 17:59:44 2018 New Revision: 328797 URL: https://svnweb.freebsd.org/changeset/base/328797 Log: MFC r307561 (by sbruno): Tell gtask to what we've been bound. ref: https://github.com/NextBSD/NextBSD/commit/54414984cfebb920bbc40aadeb601bdce448d8d7 Modified: stable/11/sys/kern/subr_gtaskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 17:56:47 2018 (r328796) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 17:59:44 2018 (r328797) @@ -634,6 +634,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; if (irq != -1 && smp_started) { CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); From owner-svn-src-all@freebsd.org Fri Feb 2 18:02:06 2018 Return-Path: Delivered-To: svn-src-all@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 B2671EE6E46; Fri, 2 Feb 2018 18:02:06 +0000 (UTC) (envelope-from mav@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 65004778E7; Fri, 2 Feb 2018 18:02:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FF401F19B; Fri, 2 Feb 2018 18:02:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12I26MX010663; Fri, 2 Feb 2018 18:02:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12I26st010662; Fri, 2 Feb 2018 18:02:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021802.w12I26st010662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 18:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328798 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:02:07 -0000 Author: mav Date: Fri Feb 2 18:02:06 2018 New Revision: 328798 URL: https://svnweb.freebsd.org/changeset/base/328798 Log: MFC r307566 (by sbruno): Ensure that tasks with a specific cpu set prior to smp starting get re-attached to a thread running on that cpu. ref: https://github.com/NextBSD/NextBSD/commit/fcc20e306bc93ebbbe51f3775d1afb527970a2e9 Modified: stable/11/sys/kern/subr_gtaskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 17:59:44 2018 (r328797) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:02:06 2018 (r328798) @@ -555,7 +555,7 @@ struct taskq_bind_task { }; static void -taskqgroup_cpu_create(struct taskqgroup *qgroup, int idx) +taskqgroup_cpu_create(struct taskqgroup *qgroup, int idx, int cpu) { struct taskqgroup_cpu *qcpu; @@ -565,7 +565,7 @@ taskqgroup_cpu_create(struct taskqgroup *qgroup, int i taskqueue_thread_enqueue, &qcpu->tgc_taskq); gtaskqueue_start_threads(&qcpu->tgc_taskq, 1, PI_SOFT, "%s_%d", qgroup->tqg_name, idx); - qcpu->tgc_cpu = idx * qgroup->tqg_stride; + qcpu->tgc_cpu = cpu; } static void @@ -634,8 +634,8 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; if (irq != -1 && smp_started) { + gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); mtx_unlock(&qgroup->tqg_lock); @@ -644,6 +644,32 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr mtx_unlock(&qgroup->tqg_lock); } +static void +taskqgroup_attach_deferred(struct taskqgroup *qgroup, struct grouptask *gtask) +{ + cpuset_t mask; + int qid, cpu; + + mtx_lock(&qgroup->tqg_lock); + qid = taskqgroup_find(qgroup, gtask->gt_uniq); + cpu = qgroup->tqg_queue[qid].tgc_cpu; + if (gtask->gt_irq != -1) { + mtx_unlock(&qgroup->tqg_lock); + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + intr_setaffinity(gtask->gt_irq, &mask); + + mtx_lock(&qgroup->tqg_lock); + } + qgroup->tqg_queue[qid].tgc_cnt++; + + LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, + gt_list); + gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + mtx_unlock(&qgroup->tqg_lock); +} + int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, void *uniq, int cpu, int irq, char *name) @@ -672,13 +698,46 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && smp_started) { - CPU_ZERO(&mask); - CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); - mtx_unlock(&qgroup->tqg_lock); + cpu = qgroup->tqg_queue[qid].tgc_cpu; + mtx_unlock(&qgroup->tqg_lock); + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + if (irq != -1 && smp_started) intr_setaffinity(irq, &mask); - } else + return (0); +} + +static int +taskqgroup_attach_cpu_deferred(struct taskqgroup *qgroup, struct grouptask *gtask) +{ + cpuset_t mask; + int i, qid, irq, cpu; + + qid = -1; + irq = gtask->gt_irq; + cpu = gtask->gt_cpu; + MPASS(smp_started); + mtx_lock(&qgroup->tqg_lock); + for (i = 0; i < qgroup->tqg_cnt; i++) + if (qgroup->tqg_queue[i].tgc_cpu == cpu) { + qid = i; + break; + } + if (qid == -1) { mtx_unlock(&qgroup->tqg_lock); + return (EINVAL); + } + qgroup->tqg_queue[qid].tgc_cnt++; + LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + mtx_unlock(&qgroup->tqg_lock); + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + + if (irq != -1) + intr_setaffinity(irq, &mask); return (0); } @@ -742,9 +801,8 @@ static int _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride) { LIST_HEAD(, grouptask) gtask_head = LIST_HEAD_INITIALIZER(NULL); - cpuset_t mask; struct grouptask *gtask; - int i, k, old_cnt, qid, cpu; + int i, k, old_cnt, old_cpu, cpu; mtx_assert(&qgroup->tqg_lock, MA_OWNED); @@ -759,6 +817,9 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, } qgroup->tqg_adjusting = 1; old_cnt = qgroup->tqg_cnt; + old_cpu = 0; + if (old_cnt < cnt) + old_cpu = qgroup->tqg_queue[old_cnt].tgc_cpu; mtx_unlock(&qgroup->tqg_lock); /* * Set up queue for tasks added before boot. @@ -772,8 +833,13 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, /* * If new taskq threads have been added. */ - for (i = old_cnt; i < cnt; i++) - taskqgroup_cpu_create(qgroup, i); + cpu = old_cpu; + for (i = old_cnt; i < cnt; i++) { + for (k = 0; k < qgroup->tqg_stride; k++) + cpu = CPU_NEXT(cpu); + + taskqgroup_cpu_create(qgroup, i, cpu); + } mtx_lock(&qgroup->tqg_lock); qgroup->tqg_cnt = cnt; qgroup->tqg_stride = stride; @@ -789,39 +855,15 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, } } + mtx_unlock(&qgroup->tqg_lock); + while ((gtask = LIST_FIRST(>ask_head))) { LIST_REMOVE(gtask, gt_list); if (gtask->gt_cpu == -1) - qid = taskqgroup_find(qgroup, gtask->gt_uniq); - else { - for (i = 0; i < qgroup->tqg_cnt; i++) - if (qgroup->tqg_queue[i].tgc_cpu == gtask->gt_cpu) { - qid = i; - break; - } - } - qgroup->tqg_queue[qid].tgc_cnt++; - LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, - gt_list); - gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + taskqgroup_attach_deferred(qgroup, gtask); + else if (taskqgroup_attach_cpu_deferred(qgroup, gtask)) + taskqgroup_attach_deferred(qgroup, gtask); } - /* - * Set new CPU and IRQ affinity - */ - cpu = CPU_FIRST(); - for (i = 0; i < cnt; i++) { - qgroup->tqg_queue[i].tgc_cpu = cpu; - for (k = 0; k < qgroup->tqg_stride; k++) - cpu = CPU_NEXT(cpu); - CPU_ZERO(&mask); - CPU_SET(qgroup->tqg_queue[i].tgc_cpu, &mask); - LIST_FOREACH(gtask, &qgroup->tqg_queue[i].tgc_tasks, gt_list) { - if (gtask->gt_irq == -1) - continue; - intr_setaffinity(gtask->gt_irq, &mask); - } - } - mtx_unlock(&qgroup->tqg_lock); /* * If taskq thread count has been reduced. @@ -838,12 +880,12 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, } int -taskqgroup_adjust(struct taskqgroup *qgroup, int cpu, int stride) +taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride) { int error; mtx_lock(&qgroup->tqg_lock); - error = _taskqgroup_adjust(qgroup, cpu, stride); + error = _taskqgroup_adjust(qgroup, cnt, stride); mtx_unlock(&qgroup->tqg_lock); return (error); From owner-svn-src-all@freebsd.org Fri Feb 2 18:03:14 2018 Return-Path: Delivered-To: svn-src-all@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 E91EBEE6F4E; Fri, 2 Feb 2018 18:03:13 +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 973DF77ABF; Fri, 2 Feb 2018 18:03:13 +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 9202A1F1B9; Fri, 2 Feb 2018 18:03:13 +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 w12I3DGb010772; Fri, 2 Feb 2018 18:03:13 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12I3DZx010768; Fri, 2 Feb 2018 18:03:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802021803.w12I3DZx010768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 2 Feb 2018 18:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328799 - in head/sys: compat/freebsd32 kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 328799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:03:14 -0000 Author: brooks Date: Fri Feb 2 18:03:12 2018 New Revision: 328799 URL: https://svnweb.freebsd.org/changeset/base/328799 Log: Add kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32. Stop leaking kernel pointers though theses sysctls and make sure that the padding in the structures is zeroed on allocation to avoid other leaks. Reviewed by: gordon, kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D13459 Modified: head/sys/compat/freebsd32/freebsd32_ipc.h head/sys/kern/sysv_msg.c head/sys/kern/sysv_sem.c head/sys/kern/sysv_shm.c Modified: head/sys/compat/freebsd32/freebsd32_ipc.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_ipc.h Fri Feb 2 18:02:06 2018 (r328798) +++ head/sys/compat/freebsd32/freebsd32_ipc.h Fri Feb 2 18:03:12 2018 (r328799) @@ -49,6 +49,18 @@ struct semid_ds32 { int32_t sem_ctime; }; +#ifdef _KERNEL +struct semid_kernel32 { + /* Data structure exposed to user space. */ + struct semid_ds32 u; + + /* Kernel-private components of the semaphore. */ + int32_t label; + int32_t cred; +}; +#endif /* _KERNEL */ + + union semun32 { int val; uint32_t buf; @@ -69,6 +81,17 @@ struct msqid_ds32 { int32_t msg_ctime; }; +#ifdef _KERNEL +struct msqid_kernel32 { + /* Data structure exposed to user space. */ + struct msqid_ds32 u; + + /* Kernel-private components of the message queue. */ + uint32_t label; + uint32_t cred; +}; +#endif + struct shmid_ds32 { struct ipc_perm32 shm_perm; int32_t shm_segsz; @@ -79,6 +102,15 @@ struct shmid_ds32 { int32_t shm_dtime; int32_t shm_ctime; }; + +#ifdef _KERNEL +struct shmid_kernel32 { + struct shmid_ds32 u; + int32_t *object; + int32_t *label; + int32_t *cred; +}; +#endif struct shm_info32 { int32_t used_ids; Modified: head/sys/kern/sysv_msg.c ============================================================================== --- head/sys/kern/sysv_msg.c Fri Feb 2 18:02:06 2018 (r328798) +++ head/sys/kern/sysv_msg.c Fri Feb 2 18:03:12 2018 (r328799) @@ -229,7 +229,7 @@ msginit() msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); msqids = malloc(sizeof(struct msqid_kernel) * msginfo.msgmni, M_MSG, - M_WAITOK); + M_WAITOK | M_ZERO); /* * msginfo.msgssz should be a power of two for efficiency reasons. @@ -1418,7 +1418,12 @@ static int sysctl_msqids(SYSCTL_HANDLER_ARGS) { struct msqid_kernel tmsqk; +#ifdef COMPAT_FREEBSD32 + struct msqid_kernel32 tmsqk32; +#endif struct prison *pr, *rpr; + void *outaddr; + size_t outsize; int error, i; pr = req->td->td_ucred->cr_prison; @@ -1435,7 +1440,40 @@ sysctl_msqids(SYSCTL_HANDLER_ARGS) tmsqk.u.msg_perm.key = IPC_PRIVATE; } mtx_unlock(&msq_mtx); - error = SYSCTL_OUT(req, &tmsqk, sizeof(tmsqk)); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(&tmsqk32, sizeof(tmsqk32)); + freebsd32_ipcperm_out(&tmsqk.u.msg_perm, + &tmsqk32.u.msg_perm); + /* Don't copy u.msg_first or u.msg_last */ + CP(tmsqk, tmsqk32, u.msg_cbytes); + CP(tmsqk, tmsqk32, u.msg_qnum); + CP(tmsqk, tmsqk32, u.msg_qbytes); + CP(tmsqk, tmsqk32, u.msg_lspid); + CP(tmsqk, tmsqk32, u.msg_lrpid); + CP(tmsqk, tmsqk32, u.msg_stime); + CP(tmsqk, tmsqk32, u.msg_rtime); + CP(tmsqk, tmsqk32, u.msg_ctime); + /* Don't copy label or cred */ + outaddr = &tmsqk32; + outsize = sizeof(tmsqk32); + } else +#endif + { + /* Don't leak kernel pointers */ + tmsqk.u.msg_first = NULL; + tmsqk.u.msg_last = NULL; + tmsqk.label = NULL; + tmsqk.cred = NULL; + /* + * XXX: some padding also exists, but we take care to + * allocate our pool of msqid_kernel structs with + * zeroed memory so this should be OK. + */ + outaddr = &tmsqk; + outsize = sizeof(tmsqk); + } + error = SYSCTL_OUT(req, outaddr, outsize); if (error != 0) break; } Modified: head/sys/kern/sysv_sem.c ============================================================================== --- head/sys/kern/sysv_sem.c Fri Feb 2 18:02:06 2018 (r328798) +++ head/sys/kern/sysv_sem.c Fri Feb 2 18:03:12 2018 (r328799) @@ -280,7 +280,7 @@ seminit(void) sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); sema = malloc(sizeof(struct semid_kernel) * seminfo.semmni, M_SEM, - M_WAITOK); + M_WAITOK | M_ZERO); sema_mtx = malloc(sizeof(struct mtx) * seminfo.semmni, M_SEM, M_WAITOK | M_ZERO); semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); @@ -1487,6 +1487,11 @@ sysctl_sema(SYSCTL_HANDLER_ARGS) { struct prison *pr, *rpr; struct semid_kernel tsemak; +#ifdef COMPAT_FREEBSD32 + struct semid_kernel32 tsemak32; +#endif + void *outaddr; + size_t outsize; int error, i; pr = req->td->td_ucred->cr_prison; @@ -1503,7 +1508,28 @@ sysctl_sema(SYSCTL_HANDLER_ARGS) tsemak.u.sem_perm.key = IPC_PRIVATE; } mtx_unlock(&sema_mtx[i]); - error = SYSCTL_OUT(req, &tsemak, sizeof(tsemak)); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(&tsemak32, sizeof(tsemak32)); + freebsd32_ipcperm_out(&tsemak.u.sem_perm, + &tsemak32.u.sem_perm); + /* Don't copy u.sem_base */ + CP(tsemak, tsemak32, u.sem_nsems); + CP(tsemak, tsemak32, u.sem_otime); + CP(tsemak, tsemak32, u.sem_ctime); + /* Don't copy label or cred */ + outaddr = &tsemak32; + outsize = sizeof(tsemak32); + } else +#endif + { + tsemak.u.sem_base = NULL; + tsemak.label = NULL; + tsemak.cred = NULL; + outaddr = &tsemak; + outsize = sizeof(tsemak); + } + error = SYSCTL_OUT(req, outaddr, outsize); if (error != 0) break; } Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Fri Feb 2 18:02:06 2018 (r328798) +++ head/sys/kern/sysv_shm.c Fri Feb 2 18:03:12 2018 (r328799) @@ -866,7 +866,8 @@ shmrealloc(void) if (shmalloced >= shminfo.shmmni) return; - newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, M_WAITOK); + newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, + M_WAITOK | M_ZERO); for (i = 0; i < shmalloced; i++) bcopy(&shmsegs[i], &newsegs[i], sizeof(newsegs[0])); for (; i < shminfo.shmmni; i++) { @@ -944,7 +945,8 @@ shminit(void) } } shmalloced = shminfo.shmmni; - shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); + shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, + M_WAITOK|M_ZERO); for (i = 0; i < shmalloced; i++) { shmsegs[i].u.shm_perm.mode = SHMSEG_FREE; shmsegs[i].u.shm_perm.seq = 0; @@ -1031,7 +1033,12 @@ static int sysctl_shmsegs(SYSCTL_HANDLER_ARGS) { struct shmid_kernel tshmseg; +#ifdef COMPAT_FREEBSD32 + struct shmid_kernel32 tshmseg32; +#endif struct prison *pr, *rpr; + void *outaddr; + size_t outsize; int error, i; SYSVSHM_LOCK(); @@ -1048,7 +1055,31 @@ sysctl_shmsegs(SYSCTL_HANDLER_ARGS) if (tshmseg.cred->cr_prison != pr) tshmseg.u.shm_perm.key = IPC_PRIVATE; } - error = SYSCTL_OUT(req, &tshmseg, sizeof(tshmseg)); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(&tshmseg32, sizeof(tshmseg32)); + freebsd32_ipcperm_out(&tshmseg.u.shm_perm, + &tshmseg32.u.shm_perm); + CP(tshmseg, tshmseg32, u.shm_segsz); + CP(tshmseg, tshmseg32, u.shm_lpid); + CP(tshmseg, tshmseg32, u.shm_cpid); + CP(tshmseg, tshmseg32, u.shm_nattch); + CP(tshmseg, tshmseg32, u.shm_atime); + CP(tshmseg, tshmseg32, u.shm_dtime); + CP(tshmseg, tshmseg32, u.shm_ctime); + /* Don't copy object, label, or cred */ + outaddr = &tshmseg32; + outsize = sizeof(tshmseg32); + } else +#endif + { + tshmseg.object = NULL; + tshmseg.label = NULL; + tshmseg.cred = NULL; + outaddr = &tshmseg; + outsize = sizeof(tshmseg); + } + error = SYSCTL_OUT(req, outaddr, outsize); if (error != 0) break; } From owner-svn-src-all@freebsd.org Fri Feb 2 18:03:15 2018 Return-Path: Delivered-To: svn-src-all@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 31185EE6F55; Fri, 2 Feb 2018 18:03:15 +0000 (UTC) (envelope-from mav@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 D337F77AC1; Fri, 2 Feb 2018 18:03:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE2781F1BA; Fri, 2 Feb 2018 18:03:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12I3Exq010819; Fri, 2 Feb 2018 18:03:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12I3EuF010818; Fri, 2 Feb 2018 18:03:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021803.w12I3EuF010818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 18:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328800 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:03:15 -0000 Author: mav Date: Fri Feb 2 18:03:14 2018 New Revision: 328800 URL: https://svnweb.freebsd.org/changeset/base/328800 Log: MFC r307567 (by sbruno): Assert that we're assigning a non-null taskqueue. ref: https://github.com/NextBSD/NextBSD/commit/535865d02c162e415d7436899cd6db5000a0cc7b Fix cpu assignment by assuring stride is non-zero, assert that all tasks have a valid taskqueue. ref: https://github.com/NextBSD/NextBSD/commit/db398176234fe3ce9f8e8b671f56000f8276feba Start cpu assignment from zero. ref: https://github.com/NextBSD/NextBSD/commit/d99d39b6b6c5dfac1eb440c41e36ebf4c897198e Modified: stable/11/sys/kern/subr_gtaskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:03:12 2018 (r328799) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:03:14 2018 (r328800) @@ -666,6 +666,7 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup, LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + MPASS(qgroup->tqg_queue[qid].tgc_taskq != NULL); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; mtx_unlock(&qgroup->tqg_lock); } @@ -730,6 +731,7 @@ taskqgroup_attach_cpu_deferred(struct taskqgroup *qgro } qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + MPASS(qgroup->tqg_queue[qid].tgc_taskq != NULL); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; mtx_unlock(&qgroup->tqg_lock); @@ -835,10 +837,10 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, */ cpu = old_cpu; for (i = old_cnt; i < cnt; i++) { - for (k = 0; k < qgroup->tqg_stride; k++) - cpu = CPU_NEXT(cpu); - taskqgroup_cpu_create(qgroup, i, cpu); + + for (k = 0; k < stride; k++) + cpu = CPU_NEXT(cpu); } mtx_lock(&qgroup->tqg_lock); qgroup->tqg_cnt = cnt; @@ -865,6 +867,15 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, taskqgroup_attach_deferred(qgroup, gtask); } +#ifdef INVARIANTS + mtx_lock(&qgroup->tqg_lock); + for (i = 0; i < qgroup->tqg_cnt; i++) { + MPASS(qgroup->tqg_queue[i].tgc_taskq != NULL); + LIST_FOREACH(gtask, &qgroup->tqg_queue[i].tgc_tasks, gt_list) + MPASS(gtask->gt_taskqueue != NULL); + } + mtx_unlock(&qgroup->tqg_lock); +#endif /* * If taskq thread count has been reduced. */ From owner-svn-src-all@freebsd.org Fri Feb 2 18:04:58 2018 Return-Path: Delivered-To: svn-src-all@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 81A92EE7134; Fri, 2 Feb 2018 18:04:58 +0000 (UTC) (envelope-from mav@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 2CA3A77E7F; Fri, 2 Feb 2018 18:04:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 278901F1C6; Fri, 2 Feb 2018 18:04:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12I4vIk011063; Fri, 2 Feb 2018 18:04:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12I4vgp011062; Fri, 2 Feb 2018 18:04:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021804.w12I4vgp011062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 18:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328801 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:04:58 -0000 Author: mav Date: Fri Feb 2 18:04:57 2018 New Revision: 328801 URL: https://svnweb.freebsd.org/changeset/base/328801 Log: MFC r307657 (by sbruno): Resolve whitespace diff to NextBSD. Check to see that the taskqueue thread count requires us to acutally iterate over the thread count to bind to cpus. Modified: stable/11/sys/kern/subr_gtaskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:03:14 2018 (r328800) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:04:57 2018 (r328801) @@ -656,11 +656,11 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup, if (gtask->gt_irq != -1) { mtx_unlock(&qgroup->tqg_lock); - CPU_ZERO(&mask); - CPU_SET(cpu, &mask); - intr_setaffinity(gtask->gt_irq, &mask); + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + intr_setaffinity(gtask->gt_irq, &mask); - mtx_lock(&qgroup->tqg_lock); + mtx_lock(&qgroup->tqg_lock); } qgroup->tqg_queue[qid].tgc_cnt++; @@ -790,6 +790,9 @@ taskqgroup_bind(struct taskqgroup *qgroup) * Bind taskqueue threads to specific CPUs, if they have been assigned * one. */ + if (qgroup->tqg_cnt == 1) + return; + for (i = 0; i < qgroup->tqg_cnt; i++) { gtask = malloc(sizeof (*gtask), M_DEVBUF, M_WAITOK); GTASK_INIT(>ask->bt_task, 0, 0, taskqgroup_binder, gtask); @@ -856,7 +859,6 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, LIST_INSERT_HEAD(>ask_head, gtask, gt_list); } } - mtx_unlock(&qgroup->tqg_lock); while ((gtask = LIST_FIRST(>ask_head))) { From owner-svn-src-all@freebsd.org Fri Feb 2 18:10:46 2018 Return-Path: Delivered-To: svn-src-all@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 53ACEEE7689; Fri, 2 Feb 2018 18:10:46 +0000 (UTC) (envelope-from mav@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 05AED784D6; Fri, 2 Feb 2018 18:10:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00B2C1F1ED; Fri, 2 Feb 2018 18:10:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12IAjRB014517; Fri, 2 Feb 2018 18:10:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12IAjnQ014516; Fri, 2 Feb 2018 18:10:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021810.w12IAjnQ014516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 18:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328802 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:10:46 -0000 Author: mav Date: Fri Feb 2 18:10:45 2018 New Revision: 328802 URL: https://svnweb.freebsd.org/changeset/base/328802 Log: Partial MFC of r311039 (by sbruno): - add INVARIANTS debugging hooks to gtaskqueue enqueue (mmacy) Modified: stable/11/sys/kern/subr_gtaskqueue.c Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:04:57 2018 (r328801) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:10:45 2018 (r328802) @@ -101,6 +101,15 @@ struct gtaskqueue { } while (0) #define TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_NOTOWNED) +#ifdef INVARIANTS +static void +gtask_dump(struct gtask *gtask) +{ + printf("gtask: %p ta_flags=%x ta_priority=%d ta_func=%p ta_context=%p\n", + gtask, gtask->ta_flags, gtask->ta_priority, gtask->ta_func, gtask->ta_context); +} +#endif + static __inline int TQ_SLEEP(struct gtaskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, int t) @@ -174,6 +183,12 @@ gtaskqueue_free(struct gtaskqueue *queue) int grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *gtask) { +#ifdef INVARIANTS + if (queue == NULL) { + gtask_dump(gtask); + panic("queue == NULL"); + } +#endif TQ_LOCK(queue); if (gtask->ta_flags & TASK_ENQUEUED) { TQ_UNLOCK(queue); From owner-svn-src-all@freebsd.org Fri Feb 2 18:11:56 2018 Return-Path: Delivered-To: svn-src-all@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 AAB7FEE7908; Fri, 2 Feb 2018 18:11:56 +0000 (UTC) (envelope-from oshogbo@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 60C46787B4; Fri, 2 Feb 2018 18:11:56 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5BC321F347; Fri, 2 Feb 2018 18:11:56 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12IBuAk016112; Fri, 2 Feb 2018 18:11:56 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12IBuh6016111; Fri, 2 Feb 2018 18:11:56 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201802021811.w12IBuh6016111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Fri, 2 Feb 2018 18:11:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328803 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 328803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:11:56 -0000 Author: oshogbo Date: Fri Feb 2 18:11:56 2018 New Revision: 328803 URL: https://svnweb.freebsd.org/changeset/base/328803 Log: Use daemonfd(3) in the dhclient(8). Reviewed by: brooks@ Differential Revision: https://reviews.freebsd.org/D13603 Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c ============================================================================== --- head/sbin/dhclient/dhclient.c Fri Feb 2 18:10:45 2018 (r328802) +++ head/sbin/dhclient/dhclient.c Fri Feb 2 18:11:56 2018 (r328803) @@ -2430,7 +2430,7 @@ go_daemon(void) /* Stop logging to stderr... */ log_perror = 0; - if (daemon(1, 1) == -1) + if (daemonfd(-1, nullfd) == -1) error("daemon"); cap_rights_init(&rights); @@ -2443,11 +2443,7 @@ go_daemon(void) } } - /* we are chrooted, daemon(3) fails to open /dev/null */ if (nullfd != -1) { - dup2(nullfd, STDIN_FILENO); - dup2(nullfd, STDOUT_FILENO); - dup2(nullfd, STDERR_FILENO); close(nullfd); nullfd = -1; } From owner-svn-src-all@freebsd.org Fri Feb 2 18:12:09 2018 Return-Path: Delivered-To: svn-src-all@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 C0A18EE795B; Fri, 2 Feb 2018 18:12:09 +0000 (UTC) (envelope-from mav@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 902A3789F2; Fri, 2 Feb 2018 18:12:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B3231F35A; Fri, 2 Feb 2018 18:12:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12IC91o016168; Fri, 2 Feb 2018 18:12:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12IC90r016167; Fri, 2 Feb 2018 18:12:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021812.w12IC90r016167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 18:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328804 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:12:11 -0000 Author: mav Date: Fri Feb 2 18:12:09 2018 New Revision: 328804 URL: https://svnweb.freebsd.org/changeset/base/328804 Log: Partial MFC of r312205 (by sbruno): Skip smp check if we're running UP Modified: stable/11/sys/kern/subr_gtaskqueue.c Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:11:56 2018 (r328803) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:12:09 2018 (r328804) @@ -649,7 +649,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && smp_started) { + if (irq != -1 && (smp_started || mp_ncpus == 1)) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); @@ -699,7 +699,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(&qgroup->tqg_lock); - if (smp_started) { + if (smp_started || mp_ncpus == 1) { for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -719,7 +719,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc CPU_ZERO(&mask); CPU_SET(cpu, &mask); - if (irq != -1 && smp_started) + if (irq != -1 && (smp_started || mp_ncpus == 1)) intr_setaffinity(irq, &mask); return (0); } @@ -733,7 +733,7 @@ taskqgroup_attach_cpu_deferred(struct taskqgroup *qgro qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(smp_started); + MPASS(smp_started || mp_ncpus == 1); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { @@ -826,7 +826,7 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, mtx_assert(&qgroup->tqg_lock, MA_OWNED); - if (cnt < 1 || cnt * stride > mp_ncpus || !smp_started) { + if (cnt < 1 || cnt * stride > mp_ncpus || (!smp_started && (mp_ncpus != 1))) { printf("taskqgroup_adjust failed cnt: %d stride: %d mp_ncpus: %d smp_started: %d\n", cnt, stride, mp_ncpus, smp_started); return (EINVAL); From owner-svn-src-all@freebsd.org Fri Feb 2 18:38:30 2018 Return-Path: Delivered-To: svn-src-all@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 1DA29EE8B85; Fri, 2 Feb 2018 18:38:30 +0000 (UTC) (envelope-from mav@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 BD3C679BE9; Fri, 2 Feb 2018 18:38:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0F951F6E6; Fri, 2 Feb 2018 18:38:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12IcToN027097; Fri, 2 Feb 2018 18:38:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12IcT5P027095; Fri, 2 Feb 2018 18:38:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802021838.w12IcT5P027095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 18:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328805 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 328805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 18:38:30 -0000 Author: mav Date: Fri Feb 2 18:38:29 2018 New Revision: 328805 URL: https://svnweb.freebsd.org/changeset/base/328805 Log: MFC r312293,312305,312434,312698,312759,312760,312814,312815,322672: Synchronize gtaskqueue vs SMP initialization order with head. This should fix panics on boot, caused by recent Linux KPI merges. Modified: stable/11/sys/kern/subr_gtaskqueue.c stable/11/sys/sys/gtaskqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:12:09 2018 (r328804) +++ stable/11/sys/kern/subr_gtaskqueue.c Fri Feb 2 18:38:29 2018 (r328805) @@ -633,6 +633,31 @@ taskqgroup_find(struct taskqgroup *qgroup, void *uniq) return (idx); } +/* + * smp_started is unusable since it is not set for UP kernels or even for + * SMP kernels when there is 1 CPU. This is usually handled by adding a + * (mp_ncpus == 1) test, but that would be broken here since we need to + * to synchronize with the SI_SUB_SMP ordering. Even in the pure SMP case + * smp_started only gives a fuzzy ordering relative to SI_SUB_SMP. + * + * So maintain our own flag. It must be set after all CPUs are started + * and before SI_SUB_SMP:SI_ORDER_ANY so that the SYSINIT for delayed + * adjustment is properly delayed. SI_ORDER_FOURTH is clearly before + * SI_ORDER_ANY and unclearly after the CPUs are started. It would be + * simpler for adjustment to pass a flag indicating if it is delayed. + */ + +static int tqg_smp_started; + +static void +tqg_record_smp_started(void *arg) +{ + tqg_smp_started = 1; +} + +SYSINIT(tqg_record_smp_started, SI_SUB_SMP, SI_ORDER_FOURTH, + tqg_record_smp_started, NULL); + void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, void *uniq, int irq, char *name) @@ -649,7 +674,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && (smp_started || mp_ncpus == 1)) { + if (irq != -1 && tqg_smp_started) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); @@ -699,7 +724,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(&qgroup->tqg_lock); - if (smp_started || mp_ncpus == 1) { + if (tqg_smp_started) { for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -719,7 +744,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc CPU_ZERO(&mask); CPU_SET(cpu, &mask); - if (irq != -1 && (smp_started || mp_ncpus == 1)) + if (irq != -1 && tqg_smp_started) intr_setaffinity(irq, &mask); return (0); } @@ -733,7 +758,7 @@ taskqgroup_attach_cpu_deferred(struct taskqgroup *qgro qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(smp_started || mp_ncpus == 1); + MPASS(tqg_smp_started); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { @@ -826,9 +851,10 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, mtx_assert(&qgroup->tqg_lock, MA_OWNED); - if (cnt < 1 || cnt * stride > mp_ncpus || (!smp_started && (mp_ncpus != 1))) { - printf("taskqgroup_adjust failed cnt: %d stride: %d mp_ncpus: %d smp_started: %d\n", - cnt, stride, mp_ncpus, smp_started); + if (cnt < 1 || cnt * stride > mp_ncpus || !tqg_smp_started) { + printf("%s: failed cnt: %d stride: %d " + "mp_ncpus: %d tqg_smp_started: %d\n", + __func__, cnt, stride, mp_ncpus, tqg_smp_started); return (EINVAL); } if (qgroup->tqg_adjusting) { Modified: stable/11/sys/sys/gtaskqueue.h ============================================================================== --- stable/11/sys/sys/gtaskqueue.h Fri Feb 2 18:12:09 2018 (r328804) +++ stable/11/sys/sys/gtaskqueue.h Fri Feb 2 18:38:29 2018 (r328805) @@ -80,8 +80,6 @@ int taskqgroup_adjust(struct taskqgroup *qgroup, int c #define TASKQGROUP_DECLARE(name) \ extern struct taskqgroup *qgroup_##name - -#ifdef EARLY_AP_STARTUP #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -90,23 +88,9 @@ static void \ taskqgroup_define_##name(void *arg) \ { \ qgroup_##name = taskqgroup_create(#name); \ - taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ -SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ - taskqgroup_define_##name, NULL) -#else -#define TASKQGROUP_DEFINE(name, cnt, stride) \ - \ -struct taskqgroup *qgroup_##name; \ - \ -static void \ -taskqgroup_define_##name(void *arg) \ -{ \ - qgroup_##name = taskqgroup_create(#name); \ -} \ - \ -SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ +SYSINIT(taskqgroup_##name, SI_SUB_TASKQ, SI_ORDER_FIRST, \ taskqgroup_define_##name, NULL); \ \ static void \ @@ -116,10 +100,8 @@ taskqgroup_adjust_##name(void *arg) \ } \ \ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ - taskqgroup_adjust_##name, NULL); \ - \ -struct __hack -#endif + taskqgroup_adjust_##name, NULL) + TASKQGROUP_DECLARE(net); TASKQGROUP_DECLARE(softirq); From owner-svn-src-all@freebsd.org Fri Feb 2 19:42:02 2018 Return-Path: Delivered-To: svn-src-all@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 BE6ECEEB812; Fri, 2 Feb 2018 19:42: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 70A557C56B; Fri, 2 Feb 2018 19:42: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 6B9F920242; Fri, 2 Feb 2018 19:42: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 w12Jg2sd059206; Fri, 2 Feb 2018 19:42:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12Jg2Ye059205; Fri, 2 Feb 2018 19:42:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802021942.w12Jg2Ye059205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 19:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328806 - head/stand/ofw/common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/ofw/common X-SVN-Commit-Revision: 328806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 19:42:02 -0000 Author: imp Date: Fri Feb 2 19:42:02 2018 New Revision: 328806 URL: https://svnweb.freebsd.org/changeset/base/328806 Log: We need more heap space to properly load newer powerpc kernels. PR: 225323 Modified: head/stand/ofw/common/main.c Modified: head/stand/ofw/common/main.c ============================================================================== --- head/stand/ofw/common/main.c Fri Feb 2 18:38:29 2018 (r328805) +++ head/stand/ofw/common/main.c Fri Feb 2 19:42:02 2018 (r328806) @@ -42,7 +42,7 @@ u_int32_t acells, scells; static char bootargs[128]; -#define HEAP_SIZE 0x100000 +#define HEAP_SIZE 0x800000 #define OF_puts(fd, text) OF_write(fd, text, strlen(text)) From owner-svn-src-all@freebsd.org Fri Feb 2 21:00:06 2018 Return-Path: Delivered-To: svn-src-all@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 B8329EC9D8E; Fri, 2 Feb 2018 21:00:06 +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 6DA77800F4; Fri, 2 Feb 2018 21:00:06 +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 646EC20D9E; Fri, 2 Feb 2018 21:00:06 +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 w12L06wN099779; Fri, 2 Feb 2018 21:00:06 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12L06as099778; Fri, 2 Feb 2018 21:00:06 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201802022100.w12L06as099778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Feb 2018 21:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328807 - stable/11/usr.sbin/makefs X-SVN-Group: stable-11 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/11/usr.sbin/makefs X-SVN-Commit-Revision: 328807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 21:00:07 -0000 Author: bdrewery Date: Fri Feb 2 21:00:06 2018 New Revision: 328807 URL: https://svnweb.freebsd.org/changeset/base/328807 Log: MFC r322894: Replace makefs' hand-rolled unescaping with strunvis Sponsored by: Dell EMC Modified: stable/11/usr.sbin/makefs/mtree.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/makefs/mtree.c ============================================================================== --- stable/11/usr.sbin/makefs/mtree.c Fri Feb 2 19:42:02 2018 (r328806) +++ stable/11/usr.sbin/makefs/mtree.c Fri Feb 2 21:00:06 2018 (r328807) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "makefs.h" @@ -359,8 +360,6 @@ read_word(FILE *fp, char *buf, size_t bufsz) break; case '\\': esc++; - if (esc == 1) - continue; break; case '`': case '\'': @@ -405,34 +404,10 @@ read_word(FILE *fp, char *buf, size_t bufsz) fi->line++; } break; - case 'a': + default: if (esc) - c = '\a'; + buf[idx++] = '\\'; break; - case 'b': - if (esc) - c = '\b'; - break; - case 'f': - if (esc) - c = '\f'; - break; - case 'n': - if (esc) - c = '\n'; - break; - case 'r': - if (esc) - c = '\r'; - break; - case 't': - if (esc) - c = '\t'; - break; - case 'v': - if (esc) - c = '\v'; - break; } buf[idx++] = c; esc = 0; @@ -607,7 +582,15 @@ read_mtree_keywords(FILE *fp, fsnode *node) error = ENOATTR; break; } - node->symlink = strdup(value); + node->symlink = malloc(strlen(value) + 1); + if (node->symlink == NULL) { + error = errno; + break; + } + if (strunvis(node->symlink, value) < 0) { + error = errno; + break; + } } else error = ENOSYS; break; @@ -987,13 +970,18 @@ read_mtree_spec1(FILE *fp, bool def, const char *name) static int read_mtree_spec(FILE *fp) { - char pathspec[PATH_MAX]; + char pathspec[PATH_MAX], pathtmp[4*PATH_MAX + 1]; char *cp; int error; - error = read_word(fp, pathspec, sizeof(pathspec)); + error = read_word(fp, pathtmp, sizeof(pathtmp)); if (error) goto out; + if (strnunvis(pathspec, PATH_MAX, pathtmp) == -1) { + error = errno; + goto out; + } + error = 0; cp = strchr(pathspec, '/'); if (cp != NULL) { From owner-svn-src-all@freebsd.org Fri Feb 2 21:18:33 2018 Return-Path: Delivered-To: svn-src-all@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 9F443ECACD7; Fri, 2 Feb 2018 21:18: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 55A4E80B7E; Fri, 2 Feb 2018 21:18:33 +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 4C6BA210D1; Fri, 2 Feb 2018 21:18:33 +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 w12LIXtX009458; Fri, 2 Feb 2018 21:18:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12LIXKG009457; Fri, 2 Feb 2018 21:18:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802022118.w12LIXKG009457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 2 Feb 2018 21:18:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328808 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 21:18:33 -0000 Author: imp Date: Fri Feb 2 21:18:32 2018 New Revision: 328808 URL: https://svnweb.freebsd.org/changeset/base/328808 Log: Implement strcoll as strcmp. Modified: head/stand/libsa/stand.h Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Feb 2 21:00:06 2018 (r328807) +++ head/stand/libsa/stand.h Fri Feb 2 21:18:32 2018 (r328808) @@ -68,6 +68,7 @@ /* this header intentionally exports NULL from */ #include +#define strcoll(a, b) strcmp((a), (b)) #define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args) #define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args); getchar();} From owner-svn-src-all@freebsd.org Fri Feb 2 21:25:34 2018 Return-Path: Delivered-To: svn-src-all@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 EC6D2ECB412; Fri, 2 Feb 2018 21:25:33 +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 97F3A8121D; Fri, 2 Feb 2018 21:25:33 +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 92D8821261; Fri, 2 Feb 2018 21:25:33 +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 w12LPXpq014793; Fri, 2 Feb 2018 21:25:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12LPXW3014789; Fri, 2 Feb 2018 21:25:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802022125.w12LPXW3014789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 2 Feb 2018 21:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328809 - in stable/11/sys/boot: efi/fdt fdt uboot/fdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys/boot: efi/fdt fdt uboot/fdt X-SVN-Commit-Revision: 328809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 21:25:34 -0000 Author: kevans Date: Fri Feb 2 21:25:32 2018 New Revision: 328809 URL: https://svnweb.freebsd.org/changeset/base/328809 Log: MFC r328504: stand/fdt: Consolidate overlay handling a little further [This is effectively a direct commit to stable/11 due to path restructuring in HEAD. The diff against HEAD has simply been applied to the old path] This should have been done as part of r327350, but due to lack of foresight it came later. In the different places we apply overlays, we duplicate the bits that check for fdt_overlays in the environment and supplement that with any other places we need to check for overlays to load. These "other places" will be loader specific and are not candidates for consolidation. Provide an fdt_load_dtb_overlays to capture the common logic, allow passing in an additional list of overlays to be loaded. This additional list of overlays is used in practice for ubldr to pull in any fdt_overlays passed to it from U-Boot environment, but it can be used for any other source of overlays. These additional overlays supplement loader.conf(5) fdt_overlays, rather than replace, so that we're not restricted to specifying overlays in only one place. This is a change from previous behavior where loader.conf(5) supplied fdt_overlays would cause us to ignore U-Boot environment, and this seems nonsensical- user should have sufficient control over both of these aspects, or lack of control for good reasons. A knob could be considered in the future to ignore U-Boot supplied overlays, but the supplemental treatment seems like a good start. Modified: stable/11/sys/boot/efi/fdt/efi_fdt.c stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/sys/boot/fdt/fdt_platform.h stable/11/sys/boot/uboot/fdt/uboot_fdt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/fdt/efi_fdt.c ============================================================================== --- stable/11/sys/boot/efi/fdt/efi_fdt.c Fri Feb 2 21:18:32 2018 (r328808) +++ stable/11/sys/boot/efi/fdt/efi_fdt.c Fri Feb 2 21:25:32 2018 (r328809) @@ -53,12 +53,7 @@ fdt_platform_load_dtb(void) return (1); printf("Using DTB provided by EFI at %p.\n", hdr); - s = getenv("fdt_overlays"); - if (s != NULL && *s != '\0') { - printf("Loading DTB overlays: '%s'\n", s); - fdt_load_dtb_overlays(s); - } - + fdt_load_dtb_overlays(NULL); return (0); } Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Feb 2 21:18:32 2018 (r328808) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Feb 2 21:25:32 2018 (r328809) @@ -76,6 +76,7 @@ static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); static int fdt_cmd_nyi(int argc, char *argv[]); +static int fdt_load_dtb_overlays_string(const char * filenames); static int fdt_cmd_addr(int argc, char *argv[]); static int fdt_cmd_mkprop(int argc, char *argv[]); @@ -330,15 +331,15 @@ fdt_print_overlay_load_error(int err, const char *file } } -int -fdt_load_dtb_overlays(const char * filenames) +static int +fdt_load_dtb_overlays_string(const char * filenames) { char *names; char *name, *name_ext; char *comaptr; int err, namesz; - debugf("fdt_load_dtb_overlay(%s)\n", filenames); + debugf("fdt_load_dtb_overlays_string(%s)\n", filenames); names = strdup(filenames); if (names == NULL) @@ -824,6 +825,25 @@ fdt_fixup_stdout(const char *str) strlen((char *)&tmp) + 1); fdt_setprop(fdtp, no, "stdin", &tmp, strlen((char *)&tmp) + 1); + } +} + +void +fdt_load_dtb_overlays(const char *extras) +{ + const char *s; + + /* Any extra overlays supplied by pre-loader environment */ + if (extras != NULL && *extras != '\0') { + printf("Loading DTB overlays: '%s'\n", extras); + fdt_load_dtb_overlays_string(extras); + } + + /* Any overlays supplied by loader environment */ + s = getenv("fdt_overlays"); + if (s != NULL && *s != '\0') { + printf("Loading DTB overlays: '%s'\n", s); + fdt_load_dtb_overlays_string(s); } } Modified: stable/11/sys/boot/fdt/fdt_platform.h ============================================================================== --- stable/11/sys/boot/fdt/fdt_platform.h Fri Feb 2 21:18:32 2018 (r328808) +++ stable/11/sys/boot/fdt/fdt_platform.h Fri Feb 2 21:25:32 2018 (r328809) @@ -46,7 +46,7 @@ void fdt_fixup_stdout(const char *); void fdt_apply_overlays(void); int fdt_load_dtb_addr(struct fdt_header *); int fdt_load_dtb_file(const char *); -int fdt_load_dtb_overlays(const char *); +void fdt_load_dtb_overlays(const char *); int fdt_setup_fdtp(void); /* The platform library needs to implement these functions */ Modified: stable/11/sys/boot/uboot/fdt/uboot_fdt.c ============================================================================== --- stable/11/sys/boot/uboot/fdt/uboot_fdt.c Fri Feb 2 21:18:32 2018 (r328808) +++ stable/11/sys/boot/uboot/fdt/uboot_fdt.c Fri Feb 2 21:25:32 2018 (r328809) @@ -89,16 +89,8 @@ fdt_platform_load_dtb(void) } exit: - if (rv == 0) { - s = getenv("fdt_overlays"); - if (s == NULL) - s = ub_env_get("fdt_overlays"); - if (s != NULL && *s != '\0') { - printf("Loading DTB overlays: '%s'\n", s); - fdt_load_dtb_overlays(s); - } - } - + if (rv == 0) + fdt_load_dtb_overlays(ub_env_get("fdt_overlays")); return (rv); } From owner-svn-src-all@freebsd.org Fri Feb 2 21:25:47 2018 Return-Path: Delivered-To: svn-src-all@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 11909ECB490; Fri, 2 Feb 2018 21:25:47 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) (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 781B881316; Fri, 2 Feb 2018 21:25:46 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f41.google.com with SMTP id 63so33464352lfv.4; Fri, 02 Feb 2018 13:25:46 -0800 (PST) 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=+EcnQosOM+3xaLsNlPqSrtSsxmUcSqS1opFGaPfMqmQ=; b=sHxGQkn+3BJGZSh5DqMbqGDydAvqB7XWU6sOiGkr5snN1tPvqAYgYSuIGz/JgFxO/G x2IQFICGs3+WAyqwzIffkc/ZhcbZRsC0h+ZUpY0Dhc99r6XXwacLonMmRn33Heks4xAS JYIPoNO7bNeIEh6Zvn25oY34Jj42szNMdz9QMER7aNa+xgsYAL/2STVE18fTOkJfw+/5 eV599Y70zB04r0CDK2qFzN47Kp1r0BRBJZHbKfwIz2vxcw1i00Z8XLwy6qgFzUZG9hFk AMyPf0nSABpcsCxdURehmajjK6WIv2FTz4dC3cerA55TS85UX1+JqljWFTsTj5zoxFSU tUVQ== X-Gm-Message-State: AKwxytexDzpRs9rVxZ9Ev7K8TrlLs7NpeYn/E1Zrt9QVCRHNFOlRp9+a tVDnfWAVOGroj3Pd3NlbYjqUoNx2 X-Google-Smtp-Source: AH8x227VbRY+xeONLu6V4MJznpw8lv5mMbPSTF1ehiX/SxAN6j/mImVnn7nMgl6EEQmj1vV31ylzMw== X-Received: by 10.46.22.30 with SMTP id w30mr11885971ljd.91.1517605358423; Fri, 02 Feb 2018 13:02:38 -0800 (PST) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by smtp.gmail.com with ESMTPSA id d132sm547292lfd.69.2018.02.02.13.02.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Feb 2018 13:02:38 -0800 (PST) Received: by mail-lf0-f50.google.com with SMTP id a204so33403630lfa.2; Fri, 02 Feb 2018 13:02:38 -0800 (PST) X-Received: by 10.25.17.20 with SMTP id g20mr23995885lfi.124.1517605357946; Fri, 02 Feb 2018 13:02:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Fri, 2 Feb 2018 13:02:17 -0800 (PST) In-Reply-To: <201801260058.w0Q0wXXP097695@repo.freebsd.org> References: <201801260058.w0Q0wXXP097695@repo.freebsd.org> From: Kyle Evans Date: Fri, 2 Feb 2018 15:02:17 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328426 - in head: lib/libufs sbin/clri sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/newfs sbin/quotacheck stand/libsa sys/geom sys/geom/journal sys/geom/label sys/ufs/ffs usr.... To: Kirk McKusick Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 21:25:47 -0000 On Thu, Jan 25, 2018 at 6:58 PM, Kirk McKusick wrote: > Author: mckusick > Date: Fri Jan 26 00:58:32 2018 > New Revision: 328426 > URL: https://svnweb.freebsd.org/changeset/base/328426 > > Log: > Refactoring of reading and writing of the UFS/FFS superblock. > Specifically reading is done if ffs_sbget() and writing is done > in ffs_sbput(). These functions are exported to libufs via the > sbget() and sbput() functions which then used in the various > filesystem utilities. This work is in preparation for adding > subperblock check hashes. > > No functional change intended. > > Reviewed by: kib Hi, This change seems to have had some unintended side-effect: $ mdconfig -a -t swap -s 10M $ newfs /dev/md0 $ tunefs -L BUG /dev/md0 This results in a "failed to write superblock." crochet's method of building images also fails with a "failed to write superblock." From owner-svn-src-all@freebsd.org Fri Feb 2 21:52:00 2018 Return-Path: Delivered-To: svn-src-all@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 A7DDFECCFF9; Fri, 2 Feb 2018 21:52:00 +0000 (UTC) (envelope-from emaste@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 5C65D82332; Fri, 2 Feb 2018 21:52:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 575D921713; Fri, 2 Feb 2018 21:52:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12Lq0NU029487; Fri, 2 Feb 2018 21:52:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12Lq0ep029486; Fri, 2 Feb 2018 21:52:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802022152.w12Lq0ep029486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 2 Feb 2018 21:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328810 - head/usr.bin/clang/lld X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/clang/lld X-SVN-Commit-Revision: 328810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 21:52:00 -0000 Author: emaste Date: Fri Feb 2 21:52:00 2018 New Revision: 328810 URL: https://svnweb.freebsd.org/changeset/base/328810 Log: ld.lld.1: miscellaneous style improvements Submitted by: wblock in review D13813 Modified: head/usr.bin/clang/lld/ld.lld.1 Modified: head/usr.bin/clang/lld/ld.lld.1 ============================================================================== --- head/usr.bin/clang/lld/ld.lld.1 Fri Feb 2 21:25:32 2018 (r328809) +++ head/usr.bin/clang/lld/ld.lld.1 Fri Feb 2 21:52:00 2018 (r328810) @@ -36,7 +36,7 @@ .Op Ar options .Ar objfile ... .Sh DESCRIPTION -A linker takes one or more object, archive and library files, and combines +A linker takes one or more object, archive, and library files, and combines them into an output file (an executable, a shared library, or another object file). It relocates code and data from the input files and resolves symbol @@ -47,7 +47,7 @@ is a drop-in replacement for the GNU BFD and gold link It accepts most of the same command line arguments and linker scripts as GNU linkers. .Pp -The following options are available: +These options are available: .Bl -tag -width indent .It Fl -allow-multiple-definition Allow multiple definitions. @@ -218,7 +218,7 @@ Include hotness information in the optimization remark .It Fl O Ar value Optimize output file size. .It Fl o Ar path -Write the output executable, library or object to +Write the output executable, library, or object to .Ar path . If not specified, .Dv a.out @@ -333,7 +333,7 @@ Read a version script. .It Fl V , Fl -version Display the version number and exit. .It Fl v -Display the version number, and proceed with linking if object files are +Display the version number and proceed with linking if object files are specified. .It Fl -warn-common Warn about duplicate common symbols. From owner-svn-src-all@freebsd.org Fri Feb 2 21:57:02 2018 Return-Path: Delivered-To: svn-src-all@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 5543BECD482; Fri, 2 Feb 2018 21:57:02 +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 ED3F98290C; Fri, 2 Feb 2018 21:57:01 +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 DE9C22173F; Fri, 2 Feb 2018 21:57:01 +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 w12Lv1ui030187; Fri, 2 Feb 2018 21:57:01 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12Lv04E030179; Fri, 2 Feb 2018 21:57:00 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802022157.w12Lv04E030179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 2 Feb 2018 21:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328811 - in stable/11: . tests/sys/geom/class/eli X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: . tests/sys/geom/class/eli X-SVN-Commit-Revision: 328811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 21:57:02 -0000 Author: asomers Date: Fri Feb 2 21:57:00 2018 New Revision: 328811 URL: https://svnweb.freebsd.org/changeset/base/328811 Log: MFC geli test suite changes MFC r306188, r306395, r327346-r327347, r327352-r327353, r327662, r327666, r327682-r327683, r327685 r306188 by br: Use bsdlabel as we don't have hardlink disklabel -> bsdlabel on some platforms. Reviewed by: ngie Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D7968 r306395 by br: Increase timeouts for geli tests. It takes 2-3x more time to proceed the tests on MIPS64EB in QEMU. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 r327346: Fix potential TOCTTOU bug in the geli tests This change mostly reverts r293436, which introduced the bug due to a belief that geli(8) would allocate md(4) devices by itself. However, that belief is incorrect. Instead of using linear probing to find available md(4) numbers, it's best to use the existing attach_md function. Reviewed by: ngie Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13666 r327347: geli: factor out some common code in the geli tests No functional change. Sponsored by: Spectra Logic Corp r327352: Fix a harmless typo from r310786 I copy/pasted a reference to an undefined shell variable. r327353: geli: fix the resize test on arm64 The resize test used bsdlabel(8), which is not available on all architectures. Change it to use gpart(8) instead, which should be available everywhere. PR: 221763 Reported by: andrew r327662: geli: convert most tests from TAP to ATF I'm leaving readonly_test and nokey_test alone for now. In a future commit they should be broken up into several smaller test cases and distributed between multiple files. Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D13717 r327666: geli: fix parallel execution of tests The trick is not to destroy an md(4) device during a test. That can create a "double-free" situation, because we also destroy md devices during test cleanup. r327682: Fix typo from r327666 X-MFC-With: 327666 r327683: geli: convert remaining TAP tests to ATF r327685: geli: optimize tests Reduce the geli tests' runtime by about a third: * In integrity_test:copy, use a file-backed md(4) device instead of a malloc'd one. That way we can corrupt the underlying storage without needing to detach and reattach the geli device. * In integrity_test:{copy, hmac, data} and onetime_test:{onetime, onetime_a}, move reads of /dev/random out of the loop. Added: stable/11/tests/sys/geom/class/eli/attach_test.sh - copied, changed from r327662, head/tests/sys/geom/class/eli/attach_test.sh stable/11/tests/sys/geom/class/eli/configure_test.sh - copied unchanged from r327662, head/tests/sys/geom/class/eli/configure_test.sh stable/11/tests/sys/geom/class/eli/detach_test.sh - copied unchanged from r327662, head/tests/sys/geom/class/eli/detach_test.sh stable/11/tests/sys/geom/class/eli/integrity_test.sh - copied, changed from r327662, head/tests/sys/geom/class/eli/integrity_test.sh Deleted: stable/11/tests/sys/geom/class/eli/attach_d_test.sh stable/11/tests/sys/geom/class/eli/configure_b_B_test.sh stable/11/tests/sys/geom/class/eli/detach_l_test.sh stable/11/tests/sys/geom/class/eli/init_B_test.sh stable/11/tests/sys/geom/class/eli/init_J_test.sh stable/11/tests/sys/geom/class/eli/init_a_test.sh stable/11/tests/sys/geom/class/eli/init_alias_test.sh stable/11/tests/sys/geom/class/eli/init_i_P_test.sh stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh stable/11/tests/sys/geom/class/eli/integrity_data_test.sh stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh stable/11/tests/sys/geom/class/eli/nokey_test.sh stable/11/tests/sys/geom/class/eli/onetime_a_test.sh stable/11/tests/sys/geom/class/eli/onetime_d_test.sh stable/11/tests/sys/geom/class/eli/readonly_test.sh Modified: stable/11/ObsoleteFiles.inc stable/11/tests/sys/geom/class/eli/Makefile stable/11/tests/sys/geom/class/eli/conf.sh stable/11/tests/sys/geom/class/eli/delkey_test.sh stable/11/tests/sys/geom/class/eli/init_test.sh stable/11/tests/sys/geom/class/eli/kill_test.sh stable/11/tests/sys/geom/class/eli/onetime_test.sh stable/11/tests/sys/geom/class/eli/resize_test.sh stable/11/tests/sys/geom/class/eli/setkey_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Fri Feb 2 21:52:00 2018 (r328810) +++ stable/11/ObsoleteFiles.inc Fri Feb 2 21:57:00 2018 (r328811) @@ -38,6 +38,22 @@ # xargs -n1 | sort | uniq -d; # done +# 20180202: Convert geli(8) tests to ATF +OLD_FILES+=tests/sys/geom/class/eli/nokey_test.sh +OLD_FILES+=tests/sys/geom/class/eli/readonly_test.sh +OLD_FILES+=tests/sys/geom/class/eli/attach_d_test.sh +OLD_FILES+=tests/sys/geom/class/eli/configure_b_B_test.sh +OLD_FILES+=tests/sys/geom/class/eli/detach_l_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_B_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_J_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_a_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_alias_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_i_P_test.sh +OLD_FILES+=tests/sys/geom/class/eli/integrity_copy_test.sh +OLD_FILES+=tests/sys/geom/class/eli/integrity_data_test.sh +OLD_FILES+=tests/sys/geom/class/eli/integrity_hmac_test.sh +OLD_FILES+=tests/sys/geom/class/eli/onetime_a_test.sh +OLD_FILES+=tests/sys/geom/class/eli/onetime_d_test.sh # 20171226: new clang import which bumps version from 5.0.0 to 5.0.1. OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/asan_interface.h Modified: stable/11/tests/sys/geom/class/eli/Makefile ============================================================================== --- stable/11/tests/sys/geom/class/eli/Makefile Fri Feb 2 21:52:00 2018 (r328810) +++ stable/11/tests/sys/geom/class/eli/Makefile Fri Feb 2 21:57:00 2018 (r328811) @@ -7,36 +7,16 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} ATF_TESTS_C= pbkdf2_test - -TAP_TESTS_SH+= attach_d_test -TAP_TESTS_SH+= configure_b_B_test -TAP_TESTS_SH+= delkey_test -TAP_TESTS_SH+= detach_l_test -TAP_TESTS_SH+= init_B_test -TAP_TESTS_SH+= init_J_test -TAP_TESTS_SH+= init_a_test -TAP_TESTS_SH+= init_alias_test -TAP_TESTS_SH+= init_i_P_test -TAP_TESTS_SH+= init_test -TAP_TESTS_SH+= integrity_copy_test -TAP_TESTS_SH+= integrity_data_test -TAP_TESTS_SH+= integrity_hmac_test -TAP_TESTS_SH+= kill_test -TAP_TESTS_SH+= nokey_test -TAP_TESTS_SH+= onetime_a_test -TAP_TESTS_SH+= onetime_d_test -TAP_TESTS_SH+= onetime_test -TAP_TESTS_SH+= readonly_test -TAP_TESTS_SH+= resize_test -TAP_TESTS_SH+= setkey_test - -TEST_METADATA.init_a_test+= timeout="1200" -TEST_METADATA.init_test+= timeout="300" -TEST_METADATA.integrity_copy_test+= timeout="1200" -TEST_METADATA.integrity_data_test+= timeout="600" -TEST_METADATA.integrity_hmac_test+= timeout="600" -TEST_METADATA.onetime_a_test+= timeout="600" -TEST_METADATA.onetime_test+= timeout="600" +ATF_TESTS_SH+= attach_test +ATF_TESTS_SH+= configure_test +ATF_TESTS_SH+= delkey_test +ATF_TESTS_SH+= detach_test +ATF_TESTS_SH+= init_test +ATF_TESTS_SH+= integrity_test +ATF_TESTS_SH+= kill_test +ATF_TESTS_SH+= onetime_test +ATF_TESTS_SH+= resize_test +ATF_TESTS_SH+= setkey_test ${PACKAGE}FILES+= conf.sh Copied and modified: stable/11/tests/sys/geom/class/eli/attach_test.sh (from r327662, head/tests/sys/geom/class/eli/attach_test.sh) ============================================================================== --- head/tests/sys/geom/class/eli/attach_test.sh Sun Jan 7 00:44:22 2018 (r327662, copy source) +++ stable/11/tests/sys/geom/class/eli/attach_test.sh Fri Feb 2 21:57:00 2018 (r328811) @@ -39,7 +39,62 @@ attach_d_cleanup() geli_test_cleanup } +atf_test_case attach_r cleanup +attach_r_head() +{ + atf_set "descr" "geli attach -r will create a readonly provider" + atf_set "require.user" "root" +} +attach_r_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -r -p -k keyfile ${md} + + atf_check -o match:"^Flags: .*READ-ONLY" geli list ${md}.eli + + # Verify that writes are verbotten + atf_check -s not-exit:0 -e match:"Read-only" \ + dd if=/dev/zero of=/dev/${md}.eli count=1 +} +attach_r_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case nokey cleanup +nokey_head() +{ + atf_set "descr" "geli attach fails if called with no key component" + atf_set "require.user" "root" +} +nokey_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check -s not-exit:0 -e match:"No key components given" \ + geli attach -p ${md} 2>/dev/null +} +nokey_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + atf_init_test_cases() { atf_add_test_case attach_d + atf_add_test_case attach_r + atf_add_test_case nokey } Modified: stable/11/tests/sys/geom/class/eli/conf.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/conf.sh Fri Feb 2 21:52:00 2018 (r328810) +++ stable/11/tests/sys/geom/class/eli/conf.sh Fri Feb 2 21:57:00 2018 (r328811) @@ -2,21 +2,40 @@ # $FreeBSD$ class="eli" -base=`basename $0` +base=$(atf_get ident) +MAX_SECSIZE=8192 +TEST_MDS_FILE=md.devs -# We need to use linear probing in order to detect the first available md(4) -# device instead of using mdconfig -a -t, because geli(8) attachs md(4) devices -no=0 -while [ -c /dev/md$no ]; do - : $(( no += 1 )) -done +attach_md() +{ + local test_md + test_md=$(mdconfig -a "$@") || atf_fail "failed to allocate md(4)" + echo $test_md >> $TEST_MDS_FILE || exit + echo $test_md +} + # Execute `func` for each combination of cipher, sectorsize, and hmac algo # `func` usage should be: # func for_each_geli_config() { func=$1 + backing_filename=$2 + # Double the sector size to allow for the HMACs' storage space. + osecsize=$(( $MAX_SECSIZE * 2 )) + # geli needs 512B for the label. + bytes=`expr $osecsize \* $sectors + 512`b + + if [ -n "$backing_filename" ]; then + # Use a file-backed md(4) device, so we can deliberatly corrupt + # it without detaching the geli device first. + truncate -s $bytes backing_file + md=$(attach_md -t vnode -f backing_file) + else + md=$(attach_md -t malloc -s $bytes) + fi + for cipher in aes-xts:128 aes-xts:256 \ aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des-cbc:192 \ @@ -29,8 +48,9 @@ for_each_geli_config() { keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do + for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do ${func} $cipher $aalgo $secsize + geli detach ${md} 2>/dev/null done done done @@ -42,6 +62,9 @@ for_each_geli_config() { for_each_geli_config_nointegrity() { func=$1 + # geli needs 512B for the label. + bytes=`expr $MAX_SECSIZE \* $sectors + 512`b + md=$(attach_md -t malloc -s $bytes) for cipher in aes-xts:128 aes-xts:256 \ aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des-cbc:192 \ @@ -52,8 +75,9 @@ for_each_geli_config_nointegrity() { camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - ${func} $cipher $aalgo $secsize + for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do + ${func} $cipher $secsize + geli detach ${md} 2>/dev/null done done } @@ -61,9 +85,14 @@ for_each_geli_config_nointegrity() { geli_test_cleanup() { - [ -c /dev/md${no}.eli ] && geli detach md${no}.eli - mdconfig -d -u $no + if [ -f "$TEST_MDS_FILE" ]; then + while read md; do + [ -c /dev/${md}.eli ] && \ + geli detach $md.eli 2>/dev/null + mdconfig -d -u $md 2>/dev/null + done < $TEST_MDS_FILE + fi + true } -trap geli_test_cleanup ABRT EXIT INT TERM . `dirname $0`/../geom_subr.sh Copied: stable/11/tests/sys/geom/class/eli/configure_test.sh (from r327662, head/tests/sys/geom/class/eli/configure_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/eli/configure_test.sh Fri Feb 2 21:57:00 2018 (r328811, copy of r327662, head/tests/sys/geom/class/eli/configure_test.sh) @@ -0,0 +1,59 @@ +# $FreeBSD$ + +atf_test_case configure_b_B cleanup +configure_b_B_head() +{ + atf_set "descr" "geli configure -b will set the BOOT flag" + atf_set "require.user" "root" +} +configure_b_B_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check geli init -B none -P -K /dev/null ${md} + + atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md} + + atf_check geli init -B none -b -P -K /dev/null ${md} + + atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md} + + atf_check geli configure -B ${md} + + atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md} + + atf_check geli configure -b ${md} + + atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md} + + atf_check geli attach -p -k /dev/null ${md} + + atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli + + atf_check geli configure -B ${md} + + atf_check -o not-match:'^Flags: .*BOOT' geli list ${md}.eli + + atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md} + + atf_check geli configure -b ${md} + + atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli + + atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md} + + atf_check geli detach ${md} +} +configure_b_B_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case configure_b_B +} Modified: stable/11/tests/sys/geom/class/eli/delkey_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/delkey_test.sh Fri Feb 2 21:52:00 2018 (r328810) +++ stable/11/tests/sys/geom/class/eli/delkey_test.sh Fri Feb 2 21:57:00 2018 (r328811) @@ -1,140 +1,114 @@ #!/bin/sh # $FreeBSD$ -. $(dirname $0)/conf.sh +atf_test_case delkey cleanup +delkey_head() +{ + atf_set "descr" "geli delkey can destroy the master key" + atf_set "require.user" "root" +} +delkey_body() +{ + . $(atf_get_srcdir)/conf.sh -base=`basename $0` -sectors=100 -keyfile1=`mktemp $base.XXXXXX` || exit 1 -keyfile2=`mktemp $base.XXXXXX` || exit 1 -keyfile3=`mktemp $base.XXXXXX` || exit 1 -keyfile4=`mktemp $base.XXXXXX` || exit 1 -mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) -echo "1..14" + atf_check dd if=/dev/random of=keyfile1 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile2 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile3 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile4 bs=512 count=16 status=none -dd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1 -dd if=/dev/random of=${keyfile2} bs=512 count=16 >/dev/null 2>&1 -dd if=/dev/random of=${keyfile3} bs=512 count=16 >/dev/null 2>&1 -dd if=/dev/random of=${keyfile4} bs=512 count=16 >/dev/null 2>&1 + atf_check geli init -B none -P -K keyfile1 ${md} + atf_check geli attach -p -k keyfile1 ${md} + atf_check -s exit:0 -o ignore geli setkey -n 1 -P -K keyfile2 ${md} -geli init -B none -P -K $keyfile1 md${no} -geli attach -p -k $keyfile1 md${no} -geli setkey -n 1 -P -K $keyfile2 md${no} + # Remove key 0 for attached provider. + atf_check geli delkey -n 0 ${md} + atf_check geli detach ${md} -# Remove key 0 for attached provider. -geli delkey -n 0 md${no} -if [ $? -eq 0 ]; then - echo "ok 1" -else - echo "not ok 1" -fi -geli detach md${no} + # We cannot use keyfile1 anymore. + atf_check -s not-exit:0 -e match:"Wrong key" \ + geli attach -p -k keyfile1 ${md} -# We cannot use keyfile1 anymore. -geli attach -p -k $keyfile1 md${no} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 2" -else - echo "not ok 2" -fi + # Attach with key 1. + atf_check geli attach -p -k keyfile2 ${md} -# Attach with key 1. -geli attach -p -k $keyfile2 md${no} -if [ $? -eq 0 ]; then - echo "ok 3" -else - echo "not ok 3" -fi + # We cannot remove last key without -f option (for attached provider). + atf_check -s not-exit:0 -e match:"This is the last Master Key" \ + geli delkey -n 1 ${md} -# We cannot remove last key without -f option (for attached provider). -geli delkey -n 1 md${no} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 4" -else - echo "not ok 4" -fi + # Remove last key for attached provider. + atf_check geli delkey -f -n 1 ${md} -# Remove last key for attached provider. -geli delkey -f -n 1 md${no} -if [ $? -eq 0 ]; then - echo "ok 5" -else - echo "not ok 5" -fi + # If there are no valid keys, but provider is attached, we can save situation. + atf_check -s exit:0 -o ignore geli setkey -n 0 -P -K keyfile3 ${md} + atf_check geli detach ${md} -# If there are no valid keys, but provider is attached, we can save situation. -geli setkey -n 0 -P -K $keyfile3 md${no} -if [ $? -eq 0 ]; then - echo "ok 6" -else - echo "not ok 6" -fi -geli detach md${no} + # We cannot use keyfile2 anymore. + atf_check -s not-exit:0 -e match:"Wrong key" \ + geli attach -p -k keyfile2 ${md} -# We cannot use keyfile2 anymore. -geli attach -p -k $keyfile2 md${no} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 7" -else - echo "not ok 7" -fi + # Attach with key 0. + atf_check geli attach -p -k keyfile3 ${md} -# Attach with key 0. -geli attach -p -k $keyfile3 md${no} -if [ $? -eq 0 ]; then - echo "ok 8" -else - echo "not ok 8" -fi + # Setup key 1. + atf_check -s exit:0 -o ignore geli setkey -n 1 -P -K keyfile4 ${md} + atf_check geli detach ${md} -# Setup key 1. -geli setkey -n 1 -P -K $keyfile4 md${no} -if [ $? -eq 0 ]; then - echo "ok 9" -else - echo "not ok 9" -fi -geli detach md${no} + # Remove key 1 for detached provider. + atf_check geli delkey -n 1 ${md} -# Remove key 1 for detached provider. -geli delkey -n 1 md${no} -if [ $? -eq 0 ]; then - echo "ok 10" -else - echo "not ok 10" -fi + # We cannot use keyfile4 anymore. + atf_check -s not-exit:0 -e match:"Wrong key" \ + geli attach -p -k keyfile4 ${md} -# We cannot use keyfile4 anymore. -geli attach -p -k $keyfile4 md${no} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 11" -else - echo "not ok 11" -fi + # We cannot remove last key without -f option (for detached provider). + atf_check -s not-exit:0 -e match:"This is the last Master Key" \ + geli delkey -n 0 ${md} -# We cannot remove last key without -f option (for detached provider). -geli delkey -n 0 md${no} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 12" -else - echo "not ok 12" -fi + # Remove last key for detached provider. + atf_check geli delkey -f -n 0 ${md} -# Remove last key for detached provider. -geli delkey -f -n 0 md${no} -if [ $? -eq 0 ]; then - echo "ok 13" -else - echo "not ok 13" -fi + # We cannot use keyfile3 anymore. + atf_check -s not-exit:0 -e match:"No valid keys" \ + geli attach -p -k keyfile3 ${md} +} +delkey_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} -# We cannot use keyfile3 anymore. -geli attach -p -k $keyfile3 md${no} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 14" -else - echo "not ok 14" -fi +atf_test_case delkey_readonly cleanup +delkey_readonly_head() +{ + atf_set "descr" "geli delkey cannot work on a read-only provider" + atf_set "require.user" "root" +} +delkey_readonly_body() +{ + . $(atf_get_srcdir)/conf.sh -rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4 + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -r -p -k keyfile ${md} + + atf_check -s not-exit:0 -e match:"read-only" geli delkey -n 0 ${md} + # Even with -f (force) it should still fail + atf_check -s not-exit:0 -e match:"read-only" geli delkey -f -n 0 ${md} +} +delkey_readonly_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case delkey + atf_add_test_case delkey_readonly +} Copied: stable/11/tests/sys/geom/class/eli/detach_test.sh (from r327662, head/tests/sys/geom/class/eli/detach_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/eli/detach_test.sh Fri Feb 2 21:57:00 2018 (r328811, copy of r327662, head/tests/sys/geom/class/eli/detach_test.sh) @@ -0,0 +1,46 @@ +# $FreeBSD$ + +atf_test_case detach_l cleanup +detach_l_head() +{ + atf_set "descr" "geli detach -l will cause a provider to detach on last close" + atf_set "require.user" "root" +} +detach_l_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -p -k keyfile ${md} + + # Be sure it doesn't detach before 'detach -l'. + atf_check dd if=/dev/${md}.eli of=/dev/null status=none + sleep 1 + if [ ! -c /dev/${md}.eli ]; then + atf_fail "provider detached on last close without detach -l" + fi + atf_check geli detach -l ${md} + if [ ! -c /dev/${md}.eli ]; then + atf_fail "Provider detached before last close" + fi + atf_check dd if=/dev/${md}.eli of=/dev/null status=none + sleep 1 + if [ -c /dev/${md}.eli ]; then + atf_fail "Provider did not detach on last close" + fi +} +detach_l_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case detach_l +} Modified: stable/11/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/init_test.sh Fri Feb 2 21:52:00 2018 (r328810) +++ stable/11/tests/sys/geom/class/eli/init_test.sh Fri Feb 2 21:57:00 2018 (r328811) @@ -1,55 +1,392 @@ #!/bin/sh # $FreeBSD$ -. $(dirname $0)/conf.sh +init_test() +{ + cipher=$1 + secsize=$2 + ealgo=${cipher%%:*} + keylen=${cipher##*:} -base=`basename $0` -sectors=32 -keyfile=`mktemp $base.XXXXXX` || exit 1 -rnd=`mktemp $base.XXXXXX` || exit 1 + atf_check -s exit:0 -e ignore \ + geli init -B none -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md} + atf_check geli attach -p -k keyfile ${md} -echo "1..200" + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} \ + status=none -do_test() { + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? + md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? + + if [ ${md_rnd} != ${md_ddev} ]; then + atf_fail "Miscompare for ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + if [ ${md_rnd} == ${md_edev} ]; then + atf_fail "Data was not encrypted for ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi +} +atf_test_case init cleanup +init_head() +{ + atf_set "descr" "Basic I/O with geli" + atf_set "require.user" "root" + atf_set "timeout" 600 +} +init_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=32 + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \ + status=none + for_each_geli_config_nointegrity init_test +} +init_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case init_B cleanup +init_B_head() +{ + atf_set "descr" "init -B can select an alternate backup metadata file" + atf_set "require.user" "root" +} +init_B_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + md=$(attach_md -t malloc -s $sectors) + + # -B none + rm -f /var/backups/${md}.eli + atf_check -s exit:0 -o ignore geli init -B none -P -K keyfile ${md} + if [ -f /var/backups/${md}.eli ]; then + atf_fail "geli created a backup file even with -B none" + fi + + # no -B + rm -f /var/backups/${md}.eli + atf_check -s exit:0 -o ignore geli init -P -K keyfile ${md} + if [ ! -f /var/backups/${md}.eli ]; then + atf_fail "geli did not create a backup file" + fi + atf_check geli clear ${md} + atf_check -s not-exit:0 -e ignore geli attach -p -k keyfile ${md} + atf_check -s exit:0 -o ignore geli restore /var/backups/${md}.eli ${md} + atf_check -s exit:0 -o ignore geli attach -p -k keyfile ${md} + atf_check geli detach ${md} + rm -f /var/backups/${md}.eli + + # -B file + rm -f backupfile + atf_check -s exit:0 -o ignore \ + geli init -B backupfile -P -K keyfile ${md} + if [ ! -f backupfile ]; then + atf_fail "geli init -B did not create a backup file" + fi + atf_check geli clear ${md} + atf_check -s not-exit:0 -e ignore geli attach -p -k keyfile ${md} + atf_check geli restore backupfile ${md} + atf_check geli attach -p -k keyfile ${md} +} +init_B_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case init_J cleanup +init_J_head() +{ + atf_set "descr" "init -J accepts a passfile" + atf_set "require.user" "root" +} +init_J_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check dd if=/dev/random of=keyfile0 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile1 bs=512 count=16 status=none + dd if=/dev/random bs=512 count=16 status=none | sha1 > passfile0 + atf_check_equal 0 $? + dd if=/dev/random bs=512 count=16 status=none | sha1 > passfile1 + atf_check_equal 0 $? + + for iter in -1 0 64; do + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -P ${md} + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -P -K keyfile0 ${md} + atf_check geli init -i ${iter} -B none -J passfile0 -K keyfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j keyfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k passfile0 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j keyfile0 -k passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j keyfile0 -k keyfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 -k passfile0 ${md} + atf_check -s exit:0 -e ignore \ + geli attach -j passfile0 -k keyfile0 ${md} + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile0 | geli attach -j passfile0 -k - ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile0 | geli attach -j - -k keyfile0 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -J passfile1 -P ${md} + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -J passfile1 -P -K keyfile0 -K keyfile1 ${md} + atf_check -s exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -J passfile1 -K keyfile0 -K keyfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -k keyfile0 -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -j passfile1 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -k keyfile0 -j passfile1 -j passfile0 ${md} + atf_check -s exit:0 -e ignore \ + geli attach -j passfile0 -j passfile1 -k keyfile0 -k keyfile1 ${md} + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile0 | geli attach -j - -j passfile1 -k keyfile0 -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile1 | geli attach -j passfile0 -j - -k keyfile0 -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile0 | geli attach -j passfile0 -j passfile1 -k - -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile1 | geli attach -j passfile0 -j passfile1 -k keyfile0 -k - ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile0 keyfile1 | geli attach -j passfile0 -j passfile1 -k - ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile0 passfile1 | awk '{printf \"%s\", \$0}' | geli attach -j - -k keyfile0 -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + done +} +init_J_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +init_a_test() +{ cipher=$1 - secsize=$2 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md} + atf_check geli attach -p -k keyfile ${md} - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + if [ ${md_rnd} != ${md_ddev} ]; then + atf_fail "Miscompare for aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi +} +atf_test_case init_a cleanup +init_a_head() +{ + atf_set "descr" "I/O with geli and HMACs" + atf_set "require.user" "root" + atf_set "timeout" 3600 +} +init_a_body() +{ + . $(atf_get_srcdir)/conf.sh - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + sectors=100 - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \ + status=none + for_each_geli_config init_a_test + true +} +init_a_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +init_alias_test() { + ealgo=$1 + keylen=$2 + expected_ealgo=$3 + expected_keylen=$4 + + atf_check geli init -B none -e $ealgo -l $keylen -P -K keyfile ${md} + atf_check geli attach -p -k keyfile ${md} + real_ealgo=`geli list ${md}.eli | awk '/EncryptionAlgorithm/ {print $2}'` + real_keylen=`geli list ${md}.eli | awk '/KeyLength/ {print $2}'` + + if [ "${real_ealgo}" != "${expected_ealgo}" ]; then + atf_fail "expected ${expected_ealgo} but got ${real_ealgo}" fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + + if [ "${real_keylen}" != "${expected_keylen}" ]; then + atf_fail "expected ${expected_keylen} but got ${real_keylen}" fi - i=$((i+1)) + atf_check geli detach ${md} +} +atf_test_case init_alias cleanup +init_alias_head() +{ + atf_set "descr" "geli init accepts cipher aliases" + atf_set "require.user" "root" +} +init_alias_body() +{ + . $(atf_get_srcdir)/conf.sh - geli detach md${no} - mdconfig -d -u $no + md=$(attach_md -t malloc -s 1024k) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \ + 3des:0:3DES-CBC:192 3des:192:3DES-CBC:192 \ + blowfish:0:Blowfish-CBC:128 blowfish:128:Blowfish-CBC:128 \ + blowfish:160:Blowfish-CBC:160 blowfish:192:Blowfish-CBC:192 \ + blowfish:224:Blowfish-CBC:224 blowfish:256:Blowfish-CBC:256 \ + blowfish:288:Blowfish-CBC:288 blowfish:352:Blowfish-CBC:352 \ + blowfish:384:Blowfish-CBC:384 blowfish:416:Blowfish-CBC:416 \ + blowfish:448:Blowfish-CBC:448 \ + camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \ + camellia:256:CAMELLIA-CBC:256 ; do + + ealgo=`echo $spec | cut -d : -f 1` + keylen=`echo $spec | cut -d : -f 2` + expected_ealgo=`echo $spec | cut -d : -f 3` + expected_keylen=`echo $spec | cut -d : -f 4` + + init_alias_test $ealgo $keylen $expected_ealgo $expected_keylen + done } +init_alias_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} -i=1 -dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 -for_each_geli_config_nointegrity do_test +atf_test_case init_i_P cleanup +init_i_P_head() +{ + atf_set "descr" "geli: Options -i and -P are mutually exclusive" + atf_set "require.user" "root" +} +init_i_P_body() +{ + . $(atf_get_srcdir)/conf.sh -rm -f $rnd -rm -f $keyfile + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check -s not-exit:0 -e "match:Options -i and -P are mutually exclusive"\ + geli init -B none -i 64 -P -K keyfile $md +} +init_i_P_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case nokey cleanup +nokey_head() +{ + atf_set "descr" "geli init fails if called with no key component" + atf_set "require.user" "root" +} +nokey_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check -s not-exit:0 -e match:"No key components given" \ + geli init -B none -P ${md} +} +nokey_cleanup() *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 2 22:05:38 2018 Return-Path: Delivered-To: svn-src-all@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 05DEDECDF0E; Fri, 2 Feb 2018 22:05:38 +0000 (UTC) (envelope-from adrian@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 AE733830FF; Fri, 2 Feb 2018 22:05:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A55FC218CF; Fri, 2 Feb 2018 22:05:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12M5b5G035206; Fri, 2 Feb 2018 22:05:37 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12M5b4U035199; Fri, 2 Feb 2018 22:05:37 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802022205.w12M5b4U035199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Feb 2018 22:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328812 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/etherswitch/arswitch X-SVN-Commit-Revision: 328812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 22:05:38 -0000 Author: adrian Date: Fri Feb 2 22:05:36 2018 New Revision: 328812 URL: https://svnweb.freebsd.org/changeset/base/328812 Log: [arswitch] begin tidying up the learning and ATU management, introduce ATU APIs. * Refactor the initial learning configuration (port learning, address expiry, handling address moving between ports, etc, etc) into a separate HAL routine * and ensure that it's consistent between switch chips - the AR8216,8316,724x,9331 SoCs all share the same switch code. * .. the AR8327 needs doing - the defaults seem OK for now * .. the AR9340 is different but it's also programmed now. * Add support for flushing a single port worth of ATU entries * Add support for fetching the ATU table from AR8216 and derived chips Tested: * AR9344, Carambola 2 TODO: * Further testing on other chips * Add AR9340 support * Add AR8327 support Modified: head/sys/dev/etherswitch/arswitch/arswitch.c head/sys/dev/etherswitch/arswitch/arswitch_7240.c head/sys/dev/etherswitch/arswitch/arswitch_8316.c head/sys/dev/etherswitch/arswitch/arswitch_8327.c head/sys/dev/etherswitch/arswitch/arswitch_9340.c head/sys/dev/etherswitch/arswitch/arswitchreg.h head/sys/dev/etherswitch/arswitch/arswitchvar.h Modified: head/sys/dev/etherswitch/arswitch/arswitch.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch.c Fri Feb 2 21:57:00 2018 (r328811) +++ head/sys/dev/etherswitch/arswitch/arswitch.c Fri Feb 2 22:05:36 2018 (r328812) @@ -289,16 +289,34 @@ ar8xxx_port_init(struct arswitch_softc *sc, int port) } static int -ar8xxx_atu_flush(struct arswitch_softc *sc) +ar8xxx_atu_wait_ready(struct arswitch_softc *sc) { int ret; + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + ret = arswitch_waitreg(sc->sc_dev, AR8216_REG_ATU, AR8216_ATU_ACTIVE, 0, 1000); + return (ret); +} + +/* + * Flush all ATU entries. + */ +static int +ar8xxx_atu_flush(struct arswitch_softc *sc) +{ + int ret; + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: flushing all ports\n", __func__); + + ret = ar8xxx_atu_wait_ready(sc); if (ret) device_printf(sc->sc_dev, "%s: waitreg failed\n", __func__); @@ -310,7 +328,166 @@ ar8xxx_atu_flush(struct arswitch_softc *sc) return (ret); } +/* + * Flush ATU entries for a single port. + */ static int +ar8xxx_atu_flush_port(struct arswitch_softc *sc, int port) +{ + int ret, val; + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: flushing port %d\n", __func__, + port); + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + /* Flush unicast entries on port */ + val = AR8216_ATU_OP_FLUSH_UNICAST; + + /* TODO: bit 4 indicates whether to flush dynamic (0) or static (1) */ + + /* Which port */ + val |= SM(port, AR8216_ATU_PORT_NUM); + + ret = ar8xxx_atu_wait_ready(sc); + if (ret) + device_printf(sc->sc_dev, "%s: waitreg failed\n", __func__); + + if (!ret) + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU, + val | AR8216_ATU_ACTIVE); + + return (ret); +} + +/* + * XXX TODO: flush a single MAC address. + */ + +/* + * Fetch a single entry from the ATU. + */ +static int +ar8xxx_atu_fetch_table(struct arswitch_softc *sc, etherswitch_atu_entry_t *e, + int atu_fetch_op) +{ + uint32_t ret0, ret1, ret2, val; + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + switch (atu_fetch_op) { + case 0: + /* Initialise things for the first fetch */ + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: initializing\n", __func__); + (void) ar8xxx_atu_wait_ready(sc); + + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU, AR8216_ATU_OP_GET_NEXT); + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU_DATA, 0); + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU_CTRL2, 0); + + return (0); + case 1: + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: reading next\n", __func__); + /* + * Attempt to read the next address entry; don't modify what + * is there in AT_ADDR{4,5} as its used for the next fetch + */ + (void) ar8xxx_atu_wait_ready(sc); + + /* Begin the next read event; not modifying anything */ + val = arswitch_readreg(sc->sc_dev, AR8216_REG_ATU); + val |= AR8216_ATU_ACTIVE; + arswitch_writereg(sc->sc_dev, AR8216_REG_ATU, val); + + /* Wait for it to complete */ + (void) ar8xxx_atu_wait_ready(sc); + + /* Fetch the ethernet address and ATU status */ + ret0 = arswitch_readreg(sc->sc_dev, AR8216_REG_ATU); + ret1 = arswitch_readreg(sc->sc_dev, AR8216_REG_ATU_DATA); + ret2 = arswitch_readreg(sc->sc_dev, AR8216_REG_ATU_CTRL2); + + /* If the status is zero, then we're done */ + if (MS(ret2, AR8216_ATU_CTRL2_AT_STATUS) == 0) + return (-1); + + /* MAC address */ + e->es_macaddr[5] = MS(ret0, AR8216_ATU_ADDR5); + e->es_macaddr[4] = MS(ret0, AR8216_ATU_ADDR4); + e->es_macaddr[3] = MS(ret1, AR8216_ATU_ADDR3); + e->es_macaddr[2] = MS(ret1, AR8216_ATU_ADDR2); + e->es_macaddr[1] = MS(ret1, AR8216_ATU_ADDR1); + e->es_macaddr[0] = MS(ret1, AR8216_ATU_ADDR0); + + /* Bitmask of ports this entry is for */ + e->es_portmask = MS(ret2, AR8216_ATU_CTRL2_DESPORT); + + /* TODO: other flags that are interesting */ + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: MAC %6D portmask 0x%08x\n", + __func__, + e->es_macaddr, ":", e->es_portmask); + return (0); + default: + return (-1); + } + return (-1); +} + +/* + * Configure aging register defaults. + */ +static int +ar8xxx_atu_learn_default(struct arswitch_softc *sc) +{ + int ret; + uint32_t val; + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: resetting learning\n", __func__); + + /* + * For now, configure the aging defaults: + * + * + ARP_EN - enable "acknowledgement" of ARP frames - they are + * forwarded to the CPU port + * + LEARN_CHANGE_EN - hash table violations when learning MAC addresses + * will force an entry to be expired/updated and a new one to be + * programmed in. + * + AGE_EN - enable address table aging + * + AGE_TIME - set to 5 minutes + */ + val = 0; + val |= AR8216_ATU_CTRL_ARP_EN; + val |= AR8216_ATU_CTRL_LEARN_CHANGE; + val |= AR8216_ATU_CTRL_AGE_EN; + val |= 0x2b; /* 5 minutes; bits 15:0 */ + + ret = arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU_CTRL, + val); + + if (ret) + device_printf(sc->sc_dev, "%s: writereg failed\n", __func__); + + return (ret); +} + +/* + * XXX TODO: add another routine to configure the leaky behaviour + * when unknown frames are received. These must be consistent + * between ethernet switches. + */ + +/* + * XXX TODO: this attach routine does NOT free all memory, resources + * upon failure! + */ +static int arswitch_attach(device_t dev) { struct arswitch_softc *sc = device_get_softc(dev); @@ -333,6 +510,18 @@ arswitch_attach(device_t dev) "debug", CTLFLAG_RW, &sc->sc_debug, 0, "control debugging printfs"); + /* Allocate a 128 entry ATU table; hopefully its big enough! */ + /* XXX TODO: make this per chip */ + sc->atu.entries = malloc(sizeof(etherswitch_atu_entry_t) * 128, + M_DEVBUF, M_NOWAIT); + if (sc->atu.entries == NULL) { + device_printf(sc->sc_dev, "%s: failed to allocate ATU table\n", + __func__); + return (ENXIO); + } + sc->atu.count = 0; + sc->atu.size = 128; + /* Default HAL methods */ sc->hal.arswitch_port_init = ar8xxx_port_init; sc->hal.arswitch_port_vlan_setup = ar8xxx_port_vlan_setup; @@ -353,11 +542,13 @@ arswitch_attach(device_t dev) sc->hal.arswitch_set_port_vlan = ar8xxx_set_port_vlan; sc->hal.arswitch_atu_flush = ar8xxx_atu_flush; + sc->hal.arswitch_atu_flush_port = ar8xxx_atu_flush_port; + sc->hal.arswitch_atu_learn_default = ar8xxx_atu_learn_default; + sc->hal.arswitch_atu_fetch_table = ar8xxx_atu_fetch_table; sc->hal.arswitch_phy_read = arswitch_readphy_internal; sc->hal.arswitch_phy_write = arswitch_writephy_internal; - /* * Attach switch related functions */ @@ -424,6 +615,17 @@ arswitch_attach(device_t dev) return (err); } + /* + * Configure the default address table learning parameters for this + * switch. + */ + err = sc->hal.arswitch_atu_learn_default(sc); + if (err != 0) { + DPRINTF(sc, ARSWITCH_DBG_ANY, + "%s: atu_learn_default: err=%d\n", __func__, err); + return (err); + } + /* Initialize the switch ports. */ for (port = 0; port <= sc->numphys; port++) { sc->hal.arswitch_port_init(sc, port); @@ -481,6 +683,8 @@ arswitch_detach(device_t dev) free(sc->ifname[i], M_DEVBUF); } + free(sc->atu.entries, M_DEVBUF); + bus_generic_detach(dev); mtx_destroy(&sc->sc_mtx); @@ -940,6 +1144,86 @@ arswitch_setconf(device_t dev, etherswitch_conf_t *con } static int +arswitch_atu_flush_all(device_t dev) +{ + struct arswitch_softc *sc; + int err; + + sc = device_get_softc(dev); + ARSWITCH_LOCK(sc); + err = sc->hal.arswitch_atu_flush(sc); + /* Invalidate cached ATU */ + sc->atu.count = 0; + ARSWITCH_UNLOCK(sc); + return (err); +} + +static int +arswitch_atu_flush_port(device_t dev, int port) +{ + struct arswitch_softc *sc; + int err; + + sc = device_get_softc(dev); + ARSWITCH_LOCK(sc); + err = sc->hal.arswitch_atu_flush_port(sc, port); + /* Invalidate cached ATU */ + sc->atu.count = 0; + ARSWITCH_UNLOCK(sc); + return (err); +} + +static int +arswitch_atu_fetch_table(device_t dev, etherswitch_atu_table_t *table) +{ + struct arswitch_softc *sc; + int err, nitems; + + sc = device_get_softc(dev); + + ARSWITCH_LOCK(sc); + /* Initial setup */ + nitems = 0; + err = sc->hal.arswitch_atu_fetch_table(sc, NULL, 0); + + /* fetch - ideally yes we'd fetch into a separate table then switch */ + while (err != -1 && nitems < sc->atu.size) { + err = sc->hal.arswitch_atu_fetch_table(sc, + &sc->atu.entries[nitems], 1); + if (err == 0) { + sc->atu.entries[nitems].id = nitems; + nitems++; + } + } + sc->atu.count = nitems; + ARSWITCH_UNLOCK(sc); + + table->es_nitems = nitems; + + return (0); +} + +static int +arswitch_atu_fetch_table_entry(device_t dev, etherswitch_atu_entry_t *e) +{ + struct arswitch_softc *sc; + int id; + + sc = device_get_softc(dev); + id = e->id; + + ARSWITCH_LOCK(sc); + if (id > sc->atu.count) { + ARSWITCH_UNLOCK(sc); + return (ENOENT); + } + + memcpy(e, &sc->atu.entries[id], sizeof(*e)); + ARSWITCH_UNLOCK(sc); + return (0); +} + +static int arswitch_getvgroup(device_t dev, etherswitch_vlangroup_t *e) { struct arswitch_softc *sc = device_get_softc(dev); @@ -1003,6 +1287,10 @@ static device_method_t arswitch_methods[] = { DEVMETHOD(etherswitch_setvgroup, arswitch_setvgroup), DEVMETHOD(etherswitch_getconf, arswitch_getconf), DEVMETHOD(etherswitch_setconf, arswitch_setconf), + DEVMETHOD(etherswitch_flush_all, arswitch_atu_flush_all), + DEVMETHOD(etherswitch_flush_port, arswitch_atu_flush_port), + DEVMETHOD(etherswitch_fetch_table, arswitch_atu_fetch_table), + DEVMETHOD(etherswitch_fetch_table_entry, arswitch_atu_fetch_table_entry), DEVMETHOD_END }; Modified: head/sys/dev/etherswitch/arswitch/arswitch_7240.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_7240.c Fri Feb 2 21:57:00 2018 (r328811) +++ head/sys/dev/etherswitch/arswitch/arswitch_7240.c Fri Feb 2 22:05:36 2018 (r328812) @@ -101,8 +101,6 @@ ar7240_hw_global_setup(struct arswitch_softc *sc) AR7240_GLOBAL_CTRL_MTU_MASK, SM(1536, AR7240_GLOBAL_CTRL_MTU_MASK)); - /* XXX ARP? Frame Age enable? */ - /* Service Tag */ arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG, AR8X16_SERVICE_TAG_MASK, 0); Modified: head/sys/dev/etherswitch/arswitch/arswitch_8316.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8316.c Fri Feb 2 21:57:00 2018 (r328811) +++ head/sys/dev/etherswitch/arswitch/arswitch_8316.c Fri Feb 2 22:05:36 2018 (r328812) @@ -140,11 +140,6 @@ ar8316_hw_global_setup(struct arswitch_softc *sc) /* Setup TAG priority mapping. */ arswitch_writereg(sc->sc_dev, AR8X16_REG_TAG_PRIO, 0xfa50); - /* Enable ARP frame acknowledge. */ - /* XXX TODO: aging? */ - arswitch_modifyreg(sc->sc_dev, AR8X16_REG_AT_CTRL, 0, - AR8X16_AT_CTRL_ARP_EN); - /* * Flood address table misses to all ports, and enable forwarding of * broadcasts to the cpu port. Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8327.c Fri Feb 2 21:57:00 2018 (r328811) +++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c Fri Feb 2 22:05:36 2018 (r328812) @@ -702,6 +702,14 @@ ar8327_hw_setup(struct arswitch_softc *sc) return (0); } +static int +ar8327_atu_learn_default(struct arswitch_softc *sc) +{ + + device_printf(sc->sc_dev, "%s: TODO!\n", __func__); + return (0); +} + /* * Initialise other global values, for the AR8327. */ @@ -1037,9 +1045,8 @@ ar8327_set_pvid(struct arswitch_softc *sc, int port, i } static int -ar8327_atu_flush(struct arswitch_softc *sc) +ar8327_atu_wait_ready(struct arswitch_softc *sc) { - int ret; ret = arswitch_waitreg(sc->sc_dev, @@ -1048,6 +1055,18 @@ ar8327_atu_flush(struct arswitch_softc *sc) 0, 1000); + return (ret); +} + +static int +ar8327_atu_flush(struct arswitch_softc *sc) +{ + + int ret; + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + ret = ar8327_atu_wait_ready(sc); if (ret) device_printf(sc->sc_dev, "%s: waitreg failed\n", __func__); @@ -1059,6 +1078,39 @@ ar8327_atu_flush(struct arswitch_softc *sc) } static int +ar8327_atu_flush_port(struct arswitch_softc *sc, int port) +{ + int ret; + uint32_t val; + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + ret = ar8327_atu_wait_ready(sc); + if (ret) + device_printf(sc->sc_dev, "%s: waitreg failed\n", __func__); + + val = AR8327_ATU_FUNC_OP_FLUSH_UNICAST; + val |= SM(port, AR8327_ATU_FUNC_PORT_NUM); + + if (!ret) + arswitch_writereg(sc->sc_dev, + AR8327_REG_ATU_FUNC, + val | AR8327_ATU_FUNC_BUSY); + + return (ret); +} + +static int +ar8327_atu_fetch_table(struct arswitch_softc *sc, etherswitch_atu_entry_t *e, + int atu_fetch_op) +{ + + /* XXX TODO */ + return (ENXIO); +} + + +static int ar8327_flush_dot1q_vlan(struct arswitch_softc *sc) { @@ -1175,7 +1227,10 @@ ar8327_attach(struct arswitch_softc *sc) sc->hal.arswitch_get_port_vlan = ar8327_vlan_get_port; sc->hal.arswitch_set_port_vlan = ar8327_vlan_set_port; + sc->hal.arswitch_atu_learn_default = ar8327_atu_learn_default; sc->hal.arswitch_atu_flush = ar8327_atu_flush; + sc->hal.arswitch_atu_flush_port = ar8327_atu_flush_port; + sc->hal.arswitch_atu_fetch_table = ar8327_atu_fetch_table; /* * Reading the PHY via the MDIO interface currently doesn't Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_9340.c Fri Feb 2 21:57:00 2018 (r328811) +++ head/sys/dev/etherswitch/arswitch/arswitch_9340.c Fri Feb 2 22:05:36 2018 (r328812) @@ -76,6 +76,27 @@ ar9340_hw_setup(struct arswitch_softc *sc) return (0); } +static int +ar9340_atu_learn_default(struct arswitch_softc *sc) +{ + + /* Enable aging, MAC replacing */ + arswitch_writereg(sc->sc_dev, AR934X_REG_AT_CTRL, + 0x2b /* 5 min age time */ | + AR934X_AT_CTRL_AGE_EN | + AR934X_AT_CTRL_LEARN_CHANGE); + + /* Enable ARP frame acknowledge */ + arswitch_modifyreg(sc->sc_dev, AR934X_REG_QM_CTRL, + AR934X_QM_CTRL_ARP_EN, AR934X_QM_CTRL_ARP_EN); + + /* Copy frame to CPU port, not just redirect it */ + arswitch_modifyreg(sc->sc_dev, AR934X_REG_QM_CTRL, + AR934X_QM_CTRL_ARP_COPY_EN, AR934X_QM_CTRL_ARP_COPY_EN); + + return (0); +} + /* * Initialise other global values for the AR9340. */ @@ -92,16 +113,6 @@ ar9340_hw_global_setup(struct arswitch_softc *sc) /* Setup TAG priority mapping */ arswitch_writereg(sc->sc_dev, AR8X16_REG_TAG_PRIO, 0xfa50); - /* Enable aging, MAC replacing */ - arswitch_writereg(sc->sc_dev, AR934X_REG_AT_CTRL, - 0x2b /* 5 min age time */ | - AR934X_AT_CTRL_AGE_EN | - AR934X_AT_CTRL_LEARN_CHANGE); - - /* Enable ARP frame acknowledge */ - arswitch_modifyreg(sc->sc_dev, AR934X_REG_QM_CTRL, - AR934X_QM_CTRL_ARP_EN, AR934X_QM_CTRL_ARP_EN); - /* Enable Broadcast frames transmitted to the CPU */ arswitch_modifyreg(sc->sc_dev, AR934X_REG_FLOOD_MASK, AR934X_FLOOD_MASK_BC_DP(0), @@ -201,6 +212,7 @@ ar9340_attach(struct arswitch_softc *sc) sc->hal.arswitch_hw_setup = ar9340_hw_setup; sc->hal.arswitch_hw_global_setup = ar9340_hw_global_setup; + sc->hal.arswitch_atu_learn_default = ar9340_atu_learn_default; /* Set the switch vlan capabilities. */ sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q | Modified: head/sys/dev/etherswitch/arswitch/arswitchreg.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchreg.h Fri Feb 2 21:57:00 2018 (r328811) +++ head/sys/dev/etherswitch/arswitch/arswitchreg.h Fri Feb 2 22:05:36 2018 (r328812) @@ -137,26 +137,43 @@ #define AR8216_ATU_OP_GET_NEXT 0x6 #define AR8216_ATU_ACTIVE BIT(3) #define AR8216_ATU_PORT_NUM BITS(8, 4) +#define AR8216_ATU_PORT_NUM_S 8 #define AR8216_ATU_FULL_VIO BIT(12) #define AR8216_ATU_ADDR4 BITS(16, 8) +#define AR8216_ATU_ADDR4_S 16 #define AR8216_ATU_ADDR5 BITS(24, 8) +#define AR8216_ATU_ADDR5_S 24 #define AR8216_REG_ATU_DATA 0x0054 #define AR8216_ATU_ADDR3 BITS(0, 8) +#define AR8216_ATU_ADDR3_S 0 #define AR8216_ATU_ADDR2 BITS(8, 8) +#define AR8216_ATU_ADDR2_S 8 #define AR8216_ATU_ADDR1 BITS(16, 8) +#define AR8216_ATU_ADDR1_S 16 #define AR8216_ATU_ADDR0 BITS(24, 8) +#define AR8216_ATU_ADDR0_S 24 -#define AR8X16_REG_ARL_CTRL2 0x0058 +#define AR8216_REG_ATU_CTRL2 0x0058 +#define AR8216_ATU_CTRL2_DESPORT BITS(0, 5) +#define AR8216_ATU_CTRL2_DESPORT_S 0 +#define AR8216_ATU_CTRL2_AT_PRIORITY BITS(10, 2) +#define AR8216_ATU_CTRL2_AT_PRIORITY_EN BIT(12) +#define AR8216_ATU_CTRL2_MIRROR_EN BIT(13) +#define AR8216_ATU_CTRL2_SA_DROP_EN BIT(14) +#define AR8216_ATU_CTRL2_AT_STATUS BITS(16, 4) +#define AR8216_ATU_CTRL2_AT_STATUS_S 16 +#define AR8216_ATU_CTRL2_VLAN_LEAKY_EN BIT(24) +#define AR8216_ATU_CTRL2_REDIRECT2CPU BIT(25) +#define AR8216_ATU_CTRL2_COPY2CPU BIT(26) #define AR8216_REG_ATU_CTRL 0x005C -#define AR8216_ATU_CTRL_AGE_EN BIT(17) #define AR8216_ATU_CTRL_AGE_TIME BITS(0, 16) #define AR8216_ATU_CTRL_AGE_TIME_S 0 +#define AR8216_ATU_CTRL_AGE_EN BIT(17) +#define AR8216_ATU_CTRL_LEARN_CHANGE BIT(18) +#define AR8216_ATU_CTRL_ARP_EN BIT(20) -#define AR8X16_REG_AT_CTRL 0x005c -#define AR8X16_AT_CTRL_ARP_EN (1 << 20) - #define AR8X16_REG_IP_PRIORITY_1 0x0060 #define AR8X16_REG_IP_PRIORITY_2 0x0064 #define AR8X16_REG_IP_PRIORITY_3 0x0068 @@ -339,6 +356,7 @@ #define AR934X_REG_QM_CTRL 0x3c #define AR934X_QM_CTRL_ARP_EN (1 << 15) +#define AR934X_QM_CTRL_ARP_COPY_EN (1 << 14) #define AR934X_REG_AT_CTRL 0x5c #define AR934X_AT_CTRL_AGE_TIME BITS(0, 15) @@ -471,7 +489,7 @@ #define AR8327_REG_ATU_DATA2 0x608 #define AR8327_REG_ATU_FUNC 0x60c -#define AR8327_ATU_FUNC_OP BITS(0, 4) +#define AR8327_ATU_FUNC_OP BITS(0, 3) #define AR8327_ATU_FUNC_OP_NOOP 0x0 #define AR8327_ATU_FUNC_OP_FLUSH 0x1 #define AR8327_ATU_FUNC_OP_LOAD 0x2 @@ -481,7 +499,9 @@ #define AR8327_ATU_FUNC_OP_GET_NEXT 0x6 #define AR8327_ATU_FUNC_OP_SEARCH_MAC 0x7 #define AR8327_ATU_FUNC_OP_CHANGE_TRUNK 0x8 -#define AR8327_ATU_FUNC_BUSY (1U << 31) +#define AR8327_ATU_FUNC_BUSY BIT(3) +#define AR8327_ATU_FUNC_PORT_NUM BITS(8, 4) +#define AR8327_ATU_FUNC_PORT_NUM_S 8 #define AR8327_REG_VTU_FUNC0 0x0610 #define AR8327_VTU_FUNC0_EG_MODE BITS(4, 14) Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchvar.h Fri Feb 2 21:57:00 2018 (r328811) +++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Fri Feb 2 22:05:36 2018 (r328812) @@ -87,7 +87,14 @@ struct arswitch_softc { int vid[AR8X16_MAX_VLANS]; uint32_t vlan_mode; + /* ATU (address table unit) support */ struct { + int count; + int size; + etherswitch_atu_entry_t *entries; + } atu; + + struct { /* Global setup */ int (* arswitch_hw_setup) (struct arswitch_softc *); int (* arswitch_hw_global_setup) (struct arswitch_softc *); @@ -99,6 +106,8 @@ struct arswitch_softc { int (* arswitch_atu_flush) (struct arswitch_softc *); int (* arswitch_atu_flush_port) (struct arswitch_softc *, int); int (* arswitch_atu_learn_default) (struct arswitch_softc *); + int (* arswitch_atu_fetch_table) (struct arswitch_softc *, + etherswitch_atu_entry_t *, int atu_fetch_op); /* VLAN functions */ int (* arswitch_port_vlan_setup) (struct arswitch_softc *, From owner-svn-src-all@freebsd.org Fri Feb 2 22:06:16 2018 Return-Path: Delivered-To: svn-src-all@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 42F6EECDF7F; Fri, 2 Feb 2018 22:06:16 +0000 (UTC) (envelope-from mckusick@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 EA22983215; Fri, 2 Feb 2018 22:06:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E48CD218D0; Fri, 2 Feb 2018 22:06:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12M6F3P035275; Fri, 2 Feb 2018 22:06:15 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12M6FHg035274; Fri, 2 Feb 2018 22:06:15 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802022206.w12M6FHg035274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 2 Feb 2018 22:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328813 - head/lib/libufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/lib/libufs X-SVN-Commit-Revision: 328813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 22:06:16 -0000 Author: mckusick Date: Fri Feb 2 22:06:15 2018 New Revision: 328813 URL: https://svnweb.freebsd.org/changeset/base/328813 Log: In the sbwrite(3) function, ensure that the file descriptor has been upgraded to writable. Reported by: Kyle Evans Modified: head/lib/libufs/sblock.c Modified: head/lib/libufs/sblock.c ============================================================================== --- head/lib/libufs/sblock.c Fri Feb 2 22:05:36 2018 (r328812) +++ head/lib/libufs/sblock.c Fri Feb 2 22:06:15 2018 (r328813) @@ -96,8 +96,15 @@ int sbwrite(struct uufsd *disk, int all) { struct fs *fs; + int rv; ERROR(disk, NULL); + + rv = ufs_disk_write(disk); + if (rv == -1) { + ERROR(disk, "failed to open disk for writing"); + return (-1); + } fs = &disk->d_fs; if ((errno = sbput(disk->d_fd, fs, all ? fs->fs_ncg : 0)) != 0) { From owner-svn-src-all@freebsd.org Fri Feb 2 22:08:04 2018 Return-Path: Delivered-To: svn-src-all@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 AAA86ECE186; Fri, 2 Feb 2018 22:08:04 +0000 (UTC) (envelope-from adrian@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 520CD83401; Fri, 2 Feb 2018 22:08:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48AAD218D1; Fri, 2 Feb 2018 22:08:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12M84n3035387; Fri, 2 Feb 2018 22:08:04 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12M84Xd035386; Fri, 2 Feb 2018 22:08:04 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802022208.w12M84Xd035386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Feb 2018 22:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328814 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/etherswitch/arswitch X-SVN-Commit-Revision: 328814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 22:08:04 -0000 Author: adrian Date: Fri Feb 2 22:08:03 2018 New Revision: 328814 URL: https://svnweb.freebsd.org/changeset/base/328814 Log: [arswitch] Stub out the ATU table dump in AR9340 switches until I implement this. Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_9340.c Fri Feb 2 22:06:15 2018 (r328813) +++ head/sys/dev/etherswitch/arswitch/arswitch_9340.c Fri Feb 2 22:08:03 2018 (r328814) @@ -183,6 +183,16 @@ ar9340_hw_global_setup(struct arswitch_softc *sc) return (0); } +static int +ar9340_atu_fetch_table(struct arswitch_softc *sc, etherswitch_atu_entry_t *e, + int atu_fetch_op) +{ + + /* XXX TODO */ + return (ENXIO); +} + + /* * The AR9340 switch probes (almost) the same as the AR7240 on-chip switch. * @@ -213,6 +223,7 @@ ar9340_attach(struct arswitch_softc *sc) sc->hal.arswitch_hw_setup = ar9340_hw_setup; sc->hal.arswitch_hw_global_setup = ar9340_hw_global_setup; sc->hal.arswitch_atu_learn_default = ar9340_atu_learn_default; + sc->hal.arswitch_atu_fetch_table = ar9340_atu_fetch_table; /* Set the switch vlan capabilities. */ sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q | From owner-svn-src-all@freebsd.org Fri Feb 2 22:08:36 2018 Return-Path: Delivered-To: svn-src-all@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 D9F45ECE22A; Fri, 2 Feb 2018 22:08:35 +0000 (UTC) (envelope-from adrian@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 8A3AE83543; Fri, 2 Feb 2018 22:08:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85204218D2; Fri, 2 Feb 2018 22:08:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12M8ZXL035446; Fri, 2 Feb 2018 22:08:35 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12M8ZO8035445; Fri, 2 Feb 2018 22:08:35 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802022208.w12M8ZO8035445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Feb 2018 22:08:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328815 - head/sbin/etherswitchcfg X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sbin/etherswitchcfg X-SVN-Commit-Revision: 328815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 22:08:36 -0000 Author: adrian Date: Fri Feb 2 22:08:35 2018 New Revision: 328815 URL: https://svnweb.freebsd.org/changeset/base/328815 Log: [etherswitchcfg] add atu flush and atu dump commands. Extend the argc/argv handling to include variable length commands (like flush all, flush port X). Modified: head/sbin/etherswitchcfg/etherswitchcfg.c Modified: head/sbin/etherswitchcfg/etherswitchcfg.c ============================================================================== --- head/sbin/etherswitchcfg/etherswitchcfg.c Fri Feb 2 22:08:03 2018 (r328814) +++ head/sbin/etherswitchcfg/etherswitchcfg.c Fri Feb 2 22:08:35 2018 (r328815) @@ -63,7 +63,8 @@ enum cmdmode { MODE_CONFIG, MODE_VLANGROUP, MODE_REGISTER, - MODE_PHYREG + MODE_PHYREG, + MODE_ATU }; struct cfg { @@ -79,9 +80,9 @@ struct cfg { struct cmds { enum cmdmode mode; - const char *name; - int args; - void (*f)(struct cfg *, char *argv[]); + const char *name; + int args; + int (*f)(struct cfg *, int argc, char *argv[]); }; static struct cmds cmds[]; @@ -166,12 +167,15 @@ write_phyregister(struct cfg *cfg, int phy, int reg, i err(EX_OSERR, "ioctl(IOETHERSWITCHSETPHYREG)"); } -static void -set_port_vid(struct cfg *cfg, char *argv[]) +static int +set_port_vid(struct cfg *cfg, int argc, char *argv[]) { int v; etherswitch_port_t p; - + + if (argc < 2) + return (-1); + v = strtol(argv[1], NULL, 0); if (v < 0 || v > IEEE802DOT1Q_VID_MAX) errx(EX_USAGE, "pvid must be between 0 and %d", @@ -183,16 +187,20 @@ set_port_vid(struct cfg *cfg, char *argv[]) p.es_pvid = v; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_flag(struct cfg *cfg, char *argv[]) +static int +set_port_flag(struct cfg *cfg, int argc, char *argv[]) { char *flag; int n; uint32_t f; etherswitch_port_t p; + if (argc < 1) + return (-1); + n = 0; f = 0; flag = argv[0]; @@ -224,15 +232,19 @@ set_port_flag(struct cfg *cfg, char *argv[]) p.es_flags |= f; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_media(struct cfg *cfg, char *argv[]) +static int +set_port_media(struct cfg *cfg, int argc, char *argv[]) { etherswitch_port_t p; int ifm_ulist[IFMEDIAREQ_NULISTENTRIES]; int subtype; - + + if (argc < 2) + return (-1); + bzero(&p, sizeof(p)); p.es_port = cfg->unit; p.es_ifmr.ifm_ulist = ifm_ulist; @@ -240,21 +252,25 @@ set_port_media(struct cfg *cfg, char *argv[]) if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)"); if (p.es_ifmr.ifm_count == 0) - return; + return (0); subtype = get_media_subtype(IFM_TYPE(ifm_ulist[0]), argv[1]); p.es_ifr.ifr_media = (p.es_ifmr.ifm_current & IFM_IMASK) | IFM_TYPE(ifm_ulist[0]) | subtype; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_mediaopt(struct cfg *cfg, char *argv[]) +static int +set_port_mediaopt(struct cfg *cfg, int argc, char *argv[]) { etherswitch_port_t p; int ifm_ulist[IFMEDIAREQ_NULISTENTRIES]; int options; - + + if (argc < 2) + return (-1); + bzero(&p, sizeof(p)); p.es_port = cfg->unit; p.es_ifmr.ifm_ulist = ifm_ulist; @@ -271,15 +287,19 @@ set_port_mediaopt(struct cfg *cfg, char *argv[]) p.es_ifr.ifr_media |= options; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_led(struct cfg *cfg, char *argv[]) +static int +set_port_led(struct cfg *cfg, int argc, char *argv[]) { etherswitch_port_t p; int led; int i; - + + if (argc < 3) + return (-1); + bzero(&p, sizeof(p)); p.es_port = cfg->unit; if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) @@ -303,14 +323,19 @@ set_port_led(struct cfg *cfg, char *argv[]) if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + + return (0); } -static void -set_vlangroup_vid(struct cfg *cfg, char *argv[]) +static int +set_vlangroup_vid(struct cfg *cfg, int argc, char *argv[]) { int v; etherswitch_vlangroup_t vg; + if (argc < 2) + return (-1); + memset(&vg, 0, sizeof(vg)); v = strtol(argv[1], NULL, 0); if (v < 0 || v > IEEE802DOT1Q_VID_MAX) @@ -321,16 +346,20 @@ set_vlangroup_vid(struct cfg *cfg, char *argv[]) vg.es_vid = v; if (ioctl(cfg->fd, IOETHERSWITCHSETVLANGROUP, &vg) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETVLANGROUP)"); + return (0); } -static void -set_vlangroup_members(struct cfg *cfg, char *argv[]) +static int +set_vlangroup_members(struct cfg *cfg, int argc, char *argv[]) { etherswitch_vlangroup_t vg; int member, untagged; char *c, *d; int v; + if (argc < 2) + return (-1); + member = untagged = 0; memset(&vg, 0, sizeof(vg)); if (strcmp(argv[1], "none") != 0) { @@ -360,6 +389,7 @@ set_vlangroup_members(struct cfg *cfg, char *argv[]) vg.es_untagged_ports = untagged; if (ioctl(cfg->fd, IOETHERSWITCHSETVLANGROUP, &vg) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETVLANGROUP)"); + return (0); } static int @@ -402,11 +432,14 @@ set_phyregister(struct cfg *cfg, char *arg) return (0); } -static void -set_vlan_mode(struct cfg *cfg, char *argv[]) +static int +set_vlan_mode(struct cfg *cfg, int argc, char *argv[]) { etherswitch_conf_t conf; + if (argc < 2) + return (-1); + bzero(&conf, sizeof(conf)); conf.cmd = ETHERSWITCH_CONF_VLAN_MODE; if (strcasecmp(argv[1], "isl") == 0) @@ -423,8 +456,71 @@ set_vlan_mode(struct cfg *cfg, char *argv[]) conf.vlan_mode = 0; if (ioctl(cfg->fd, IOETHERSWITCHSETCONF, &conf) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETCONF)"); + + return (0); } +static int +atu_flush(struct cfg *cfg, int argc, char *argv[]) +{ + etherswitch_portid_t p; + int i, r; + + bzero(&p, sizeof(p)); + + /* note: argv[0] is "flush" */ + if (argc > 2 && strcasecmp(argv[1], "port") == 0) { + p.es_port = atoi(argv[2]); + i = IOETHERSWITCHFLUSHPORT; + r = 3; + } else if (argc > 1 && strcasecmp(argv[1], "all") == 0) { + p.es_port = 0; + r = 2; + i = IOETHERSWITCHFLUSHALL; + } else { + fprintf(stderr, + "%s: invalid verb (port or all) (got %s)\n", + __func__, argv[1]); + return (-1); + } + + if (ioctl(cfg->fd, i, &p) != 0) + err(EX_OSERR, "ioctl(ATU flush (ioctl %d, port %d))", + i, p.es_port); + return (r); +} + +static int +atu_dump(struct cfg *cfg, int argc, char *argv[]) +{ + etherswitch_atu_table_t p; + etherswitch_atu_entry_t e; + uint32_t i; + + (void) argc; + (void) argv; + + /* Note: argv[0] is "dump" */ + bzero(&p, sizeof(p)); + + if (ioctl(cfg->fd, IOETHERSWITCHGETTABLE, &p) != 0) + err(EX_OSERR, "ioctl(IOETHERSWITCHGETTABLE)"); + + /* And now, iterate to get entries */ + for (i = 0; i < p.es_nitems; i++) { + bzero(&e, sizeof(e)); + e.id = i; + if (ioctl(cfg->fd, IOETHERSWITCHGETTABLEENTRY, &e) != 0) + break; + + printf(" [%d] %s: portmask 0x%08x\n", i, + ether_ntoa((void *) &e.es_macaddr), + e.es_portmask); + } + + return (1); +} + static void print_config(struct cfg *cfg) { @@ -619,6 +715,7 @@ newmode(struct cfg *cfg, enum cmdmode mode) break; case MODE_REGISTER: case MODE_PHYREG: + case MODE_ATU: break; } cfg->mode = mode; @@ -686,6 +783,8 @@ main(int argc, char *argv[]) newmode(&cfg, MODE_REGISTER); } else if (strcmp(argv[0], "help") == 0) { usage(&cfg, argv); + } else if (strcmp(argv[0], "atu") == 0) { + newmode(&cfg, MODE_ATU); } else { errx(EX_USAGE, "Unknown command \"%s\"", argv[0]); } @@ -693,15 +792,33 @@ main(int argc, char *argv[]) case MODE_PORT: case MODE_CONFIG: case MODE_VLANGROUP: + case MODE_ATU: for(i=0; cmds[i].name != NULL; i++) { - if (cfg.mode == cmds[i].mode && strcmp(argv[0], cmds[i].name) == 0) { - if (argc < (cmds[i].args + 1)) { - printf("%s needs %d argument%s\n", cmds[i].name, cmds[i].args, (cmds[i].args==1)?"":","); + int r; + if (cfg.mode == cmds[i].mode && + strcmp(argv[0], cmds[i].name) == 0) { + if ((cmds[i].args != -1) && + (argc < (cmds[i].args + 1))) { + printf("%s needs %d argument%s\n", + cmds[i].name, cmds[i].args, + (cmds[i].args==1)?"":","); break; } - (cmds[i].f)(&cfg, argv); - argc -= cmds[i].args; - argv += cmds[i].args; + + r = (cmds[i].f)(&cfg, argc, argv); + + /* -1 here means "error" */ + if (r == -1) { + argc = 0; + break; + } + + /* Legacy return value */ + if (r == 0) + r = cmds[i].args; + + argc -= r; + argv += r; break; } } @@ -752,5 +869,7 @@ static struct cmds cmds[] = { { MODE_CONFIG, "vlan_mode", 1, set_vlan_mode }, { MODE_VLANGROUP, "vlan", 1, set_vlangroup_vid }, { MODE_VLANGROUP, "members", 1, set_vlangroup_members }, + { MODE_ATU, "flush", -1, atu_flush }, + { MODE_ATU, "dump", -1, atu_dump }, { 0, NULL, 0, NULL } }; From owner-svn-src-all@freebsd.org Fri Feb 2 22:09:37 2018 Return-Path: Delivered-To: svn-src-all@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 68C61ECE36C; Fri, 2 Feb 2018 22:09:37 +0000 (UTC) (envelope-from arichardson@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 1F31A837A4; Fri, 2 Feb 2018 22:09:37 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1A390218D5; Fri, 2 Feb 2018 22:09:37 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12M9alg035531; Fri, 2 Feb 2018 22:09:36 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12M9aB4035530; Fri, 2 Feb 2018 22:09:36 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201802022209.w12M9aB4035530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 2 Feb 2018 22:09:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328816 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 328816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 22:09:37 -0000 Author: arichardson Date: Fri Feb 2 22:09:36 2018 New Revision: 328816 URL: https://svnweb.freebsd.org/changeset/base/328816 Log: Revert r326375 since the warning has been turned off by default in clang See https://reviews.llvm.org/D41512 and https://reviews.llvm.org/rL322901 Approved By: brooks (mentor) Differential Revision: https://reviews.freebsd.org/D14171 Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Fri Feb 2 22:08:35 2018 (r328815) +++ head/share/mk/bsd.sys.mk Fri Feb 2 22:09:36 2018 (r328816) @@ -71,9 +71,6 @@ CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-in .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30400 CWARNFLAGS.clang+= -Wno-unused-const-variable .endif -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 60000 -CWARNFLAGS.clang+= -Wno-error=tautological-constant-compare -.endif .endif # WARNS <= 6 .if ${WARNS} <= 3 CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\ From owner-svn-src-all@freebsd.org Fri Feb 2 22:28:17 2018 Return-Path: Delivered-To: svn-src-all@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 B54EBECF717; Fri, 2 Feb 2018 22:28:16 +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 68014844F1; Fri, 2 Feb 2018 22:28:16 +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 5E76B21C23; Fri, 2 Feb 2018 22:28:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12MSGCd045179; Fri, 2 Feb 2018 22:28:16 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12MSDRQ045147; Fri, 2 Feb 2018 22:28:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802022228.w12MSDRQ045147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 2 Feb 2018 22:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328817 - in head: contrib/llvm/include/llvm contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/lib/Target/AMDGPU contrib/llvm... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/llvm/include/llvm contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/lib/Target/AMDGPU contrib/llvm/lib/Target/ARM contrib/l... X-SVN-Commit-Revision: 328817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 22:28:17 -0000 Author: dim Date: Fri Feb 2 22:28:12 2018 New Revision: 328817 URL: https://svnweb.freebsd.org/changeset/base/328817 Log: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 6.0.0 (branches/release_60 r324090). This introduces retpoline support, with the -mretpoline flag. The upstream initial commit message (r323155 by Chandler Carruth) contains quite a bit of explanation. Quoting: Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre. Summary: First, we need to explain the core of the vulnerability. Note that this is a very incomplete description, please see the Project Zero blog post for details: https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html The basis for branch target injection is to direct speculative execution of the processor to some "gadget" of executable code by poisoning the prediction of indirect branches with the address of that gadget. The gadget in turn contains an operation that provides a side channel for reading data. Most commonly, this will look like a load of secret data followed by a branch on the loaded value and then a load of some predictable cache line. The attacker then uses timing of the processors cache to determine which direction the branch took *in the speculative execution*, and in turn what one bit of the loaded value was. Due to the nature of these timing side channels and the branch predictor on Intel processors, this allows an attacker to leak data only accessible to a privileged domain (like the kernel) back into an unprivileged domain. The goal is simple: avoid generating code which contains an indirect branch that could have its prediction poisoned by an attacker. In many cases, the compiler can simply use directed conditional branches and a small search tree. LLVM already has support for lowering switches in this way and the first step of this patch is to disable jump-table lowering of switches and introduce a pass to rewrite explicit indirectbr sequences into a switch over integers. However, there is no fully general alternative to indirect calls. We introduce a new construct we call a "retpoline" to implement indirect calls in a non-speculatable way. It can be thought of loosely as a trampoline for indirect calls which uses the RET instruction on x86. Further, we arrange for a specific call->ret sequence which ensures the processor predicts the return to go to a controlled, known location. The retpoline then "smashes" the return address pushed onto the stack by the call with the desired target of the original indirect call. The result is a predicted return to the next instruction after a call (which can be used to trap speculative execution within an infinite loop) and an actual indirect branch to an arbitrary address. On 64-bit x86 ABIs, this is especially easily done in the compiler by using a guaranteed scratch register to pass the target into this device. For 32-bit ABIs there isn't a guaranteed scratch register and so several different retpoline variants are introduced to use a scratch register if one is available in the calling convention and to otherwise use direct stack push/pop sequences to pass the target address. This "retpoline" mitigation is fully described in the following blog post: https://support.google.com/faqs/answer/7625886 We also support a target feature that disables emission of the retpoline thunk by the compiler to allow for custom thunks if users want them. These are particularly useful in environments like kernels that routinely do hot-patching on boot and want to hot-patch their thunk to different code sequences. They can write this custom thunk and use `-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this case, on x86-64 thu thunk names must be: ``` __llvm_external_retpoline_r11 ``` or on 32-bit: ``` __llvm_external_retpoline_eax __llvm_external_retpoline_ecx __llvm_external_retpoline_edx __llvm_external_retpoline_push ``` And the target of the retpoline is passed in the named register, or in the case of the `push` suffix on the top of the stack via a `pushl` instruction. There is one other important source of indirect branches in x86 ELF binaries: the PLT. These patches also include support for LLD to generate PLT entries that perform a retpoline-style indirection. The only other indirect branches remaining that we are aware of are from precompiled runtimes (such as crt0.o and similar). The ones we have found are not really attackable, and so we have not focused on them here, but eventually these runtimes should also be replicated for retpoline-ed configurations for completeness. For kernels or other freestanding or fully static executables, the compiler switch `-mretpoline` is sufficient to fully mitigate this particular attack. For dynamic executables, you must compile *all* libraries with `-mretpoline` and additionally link the dynamic executable and all shared libraries with LLD and pass `-z retpolineplt` (or use similar functionality from some other linker). We strongly recommend also using `-z now` as non-lazy binding allows the retpoline-mitigated PLT to be substantially smaller. When manually apply similar transformations to `-mretpoline` to the Linux kernel we observed very small performance hits to applications running typic al workloads, and relatively minor hits (approximately 2%) even for extremely syscall-heavy applications. This is largely due to the small number of indirect branches that occur in performance sensitive paths of the kernel. When using these patches on statically linked applications, especially C++ applications, you should expect to see a much more dramatic performance hit. For microbenchmarks that are switch, indirect-, or virtual-call heavy we have seen overheads ranging from 10% to 50%. However, real-world workloads exhibit substantially lower performance impact. Notably, techniques such as PGO and ThinLTO dramatically reduce the impact of hot indirect calls (by speculatively promoting them to direct calls) and allow optimized search trees to be used to lower switches. If you need to deploy these techniques in C++ applications, we *strongly* recommend that you ensure all hot call targets are statically linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well tuned servers using all of these techniques saw 5% - 10% overhead from the use of retpoline. We will add detailed documentation covering these components in subsequent patches, but wanted to make the core functionality available as soon as possible. Happy for more code review, but we'd really like to get these patches landed and backported ASAP for obvious reasons. We're planning to backport this to both 6.0 and 5.0 release streams and get a 5.0 release with just this cherry picked ASAP for distros and vendors. This patch is the work of a number of people over the past month: Eric, Reid, Rui, and myself. I'm mailing it out as a single commit due to the time sensitive nature of landing this and the need to backport it. Huge thanks to everyone who helped out here, and everyone at Intel who helped out in discussions about how to craft this. Also, credit goes to Paul Turner (at Google, but not an LLVM contributor) for much of the underlying retpoline design. Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D41723 MFC after: 3 months X-MFC-With: r327952 PR: 224669 Added: head/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp - copied unchanged from r328794, vendor/llvm/dist-release_60/lib/CodeGen/IndirectBrExpandPass.cpp head/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp - copied unchanged from r328794, vendor/llvm/dist-release_60/lib/Target/X86/X86RetpolineThunks.cpp Modified: head/contrib/llvm/include/llvm/CodeGen/Passes.h head/contrib/llvm/include/llvm/CodeGen/TargetInstrInfo.h head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h head/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h head/contrib/llvm/include/llvm/CodeGen/TargetSubtargetInfo.h head/contrib/llvm/include/llvm/InitializePasses.h head/contrib/llvm/lib/CodeGen/CodeGen.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp head/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp head/contrib/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.h head/contrib/llvm/lib/Target/Mips/MipsISelLowering.cpp head/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp head/contrib/llvm/lib/Target/Sparc/SparcFrameLowering.cpp head/contrib/llvm/lib/Target/X86/X86.h head/contrib/llvm/lib/Target/X86/X86.td head/contrib/llvm/lib/Target/X86/X86AsmPrinter.h head/contrib/llvm/lib/Target/X86/X86FastISel.cpp head/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.h head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td head/contrib/llvm/lib/Target/X86/X86InstrControl.td head/contrib/llvm/lib/Target/X86/X86InstrInfo.td head/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp head/contrib/llvm/lib/Target/X86/X86Subtarget.cpp head/contrib/llvm/lib/Target/X86/X86Subtarget.h head/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp head/contrib/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp head/contrib/llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.h head/contrib/llvm/tools/lld/ELF/Arch/X86.cpp head/contrib/llvm/tools/lld/ELF/Arch/X86_64.cpp head/contrib/llvm/tools/lld/ELF/Config.h head/contrib/llvm/tools/lld/ELF/Driver.cpp head/contrib/llvm/tools/opt/opt.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Common/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h head/lib/clang/libllvm/Makefile Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/llvm/include/llvm/CodeGen/Passes.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/Passes.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/include/llvm/CodeGen/Passes.h Fri Feb 2 22:28:12 2018 (r328817) @@ -417,6 +417,9 @@ namespace llvm { // This pass expands memcmp() to load/stores. FunctionPass *createExpandMemCmpPass(); + // This pass expands indirectbr instructions. + FunctionPass *createIndirectBrExpandPass(); + } // End llvm namespace #endif Modified: head/contrib/llvm/include/llvm/CodeGen/TargetInstrInfo.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/TargetInstrInfo.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/include/llvm/CodeGen/TargetInstrInfo.h Fri Feb 2 22:28:12 2018 (r328817) @@ -950,6 +950,10 @@ class TargetInstrInfo : public MCInstrInfo { (public) /// Return true when a target supports MachineCombiner. virtual bool useMachineCombiner() const { return false; } + /// Return true if the given SDNode can be copied during scheduling + /// even if it has glue. + virtual bool canCopyGluedNodeDuringSchedule(SDNode *N) const { return false; } + protected: /// Target-dependent implementation for foldMemoryOperand. /// Target-independent code in foldMemoryOperand will Modified: head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h Fri Feb 2 22:28:12 2018 (r328817) @@ -800,7 +800,7 @@ class TargetLoweringBase { (public) } /// Return true if lowering to a jump table is allowed. - bool areJTsAllowed(const Function *Fn) const { + virtual bool areJTsAllowed(const Function *Fn) const { if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true") return false; Modified: head/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h Fri Feb 2 22:28:12 2018 (r328817) @@ -416,6 +416,13 @@ class TargetPassConfig : public ImmutablePass { (prote /// immediately before machine code is emitted. virtual void addPreEmitPass() { } + /// Targets may add passes immediately before machine code is emitted in this + /// callback. This is called even later than `addPreEmitPass`. + // FIXME: Rename `addPreEmitPass` to something more sensible given its actual + // position and remove the `2` suffix here as this callback is what + // `addPreEmitPass` *should* be but in reality isn't. + virtual void addPreEmitPass2() {} + /// Utilities for targets to add passes to the pass manager. /// Modified: head/contrib/llvm/include/llvm/CodeGen/TargetSubtargetInfo.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/TargetSubtargetInfo.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/include/llvm/CodeGen/TargetSubtargetInfo.h Fri Feb 2 22:28:12 2018 (r328817) @@ -174,6 +174,9 @@ class TargetSubtargetInfo : public MCSubtargetInfo { ( /// \brief True if the subtarget should run the atomic expansion pass. virtual bool enableAtomicExpand() const; + /// True if the subtarget should run the indirectbr expansion pass. + virtual bool enableIndirectBrExpand() const; + /// \brief Override generic scheduling policy within a region. /// /// This is a convenient way for targets that don't provide any custom Modified: head/contrib/llvm/include/llvm/InitializePasses.h ============================================================================== --- head/contrib/llvm/include/llvm/InitializePasses.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/include/llvm/InitializePasses.h Fri Feb 2 22:28:12 2018 (r328817) @@ -161,6 +161,7 @@ void initializeIVUsersWrapperPassPass(PassRegistry&); void initializeIfConverterPass(PassRegistry&); void initializeImplicitNullChecksPass(PassRegistry&); void initializeIndVarSimplifyLegacyPassPass(PassRegistry&); +void initializeIndirectBrExpandPassPass(PassRegistry&); void initializeInductiveRangeCheckEliminationPass(PassRegistry&); void initializeInferAddressSpacesPass(PassRegistry&); void initializeInferFunctionAttrsLegacyPassPass(PassRegistry&); Modified: head/contrib/llvm/lib/CodeGen/CodeGen.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/CodeGen.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/CodeGen/CodeGen.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -38,6 +38,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeGCModuleInfoPass(Registry); initializeIfConverterPass(Registry); initializeImplicitNullChecksPass(Registry); + initializeIndirectBrExpandPassPass(Registry); initializeInterleavedAccessPass(Registry); initializeLiveDebugValuesPass(Registry); initializeLiveDebugVariablesPass(Registry); Copied: head/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp (from r328794, vendor/llvm/dist-release_60/lib/CodeGen/IndirectBrExpandPass.cpp) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp Fri Feb 2 22:28:12 2018 (r328817, copy of r328794, vendor/llvm/dist-release_60/lib/CodeGen/IndirectBrExpandPass.cpp) @@ -0,0 +1,221 @@ +//===- IndirectBrExpandPass.cpp - Expand indirectbr to switch -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// Implements an expansion pass to turn `indirectbr` instructions in the IR +/// into `switch` instructions. This works by enumerating the basic blocks in +/// a dense range of integers, replacing each `blockaddr` constant with the +/// corresponding integer constant, and then building a switch that maps from +/// the integers to the actual blocks. All of the indirectbr instructions in the +/// function are redirected to this common switch. +/// +/// While this is generically useful if a target is unable to codegen +/// `indirectbr` natively, it is primarily useful when there is some desire to +/// get the builtin non-jump-table lowering of a switch even when the input +/// source contained an explicit indirect branch construct. +/// +/// Note that it doesn't make any sense to enable this pass unless a target also +/// disables jump-table lowering of switches. Doing that is likely to pessimize +/// the code. +/// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Sequence.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/TargetPassConfig.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/InstIterator.h" +#include "llvm/IR/Instruction.h" +#include "llvm/IR/Instructions.h" +#include "llvm/Pass.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetMachine.h" + +using namespace llvm; + +#define DEBUG_TYPE "indirectbr-expand" + +namespace { + +class IndirectBrExpandPass : public FunctionPass { + const TargetLowering *TLI = nullptr; + +public: + static char ID; // Pass identification, replacement for typeid + + IndirectBrExpandPass() : FunctionPass(ID) { + initializeIndirectBrExpandPassPass(*PassRegistry::getPassRegistry()); + } + + bool runOnFunction(Function &F) override; +}; + +} // end anonymous namespace + +char IndirectBrExpandPass::ID = 0; + +INITIALIZE_PASS(IndirectBrExpandPass, DEBUG_TYPE, + "Expand indirectbr instructions", false, false) + +FunctionPass *llvm::createIndirectBrExpandPass() { + return new IndirectBrExpandPass(); +} + +bool IndirectBrExpandPass::runOnFunction(Function &F) { + auto &DL = F.getParent()->getDataLayout(); + auto *TPC = getAnalysisIfAvailable(); + if (!TPC) + return false; + + auto &TM = TPC->getTM(); + auto &STI = *TM.getSubtargetImpl(F); + if (!STI.enableIndirectBrExpand()) + return false; + TLI = STI.getTargetLowering(); + + SmallVector IndirectBrs; + + // Set of all potential successors for indirectbr instructions. + SmallPtrSet IndirectBrSuccs; + + // Build a list of indirectbrs that we want to rewrite. + for (BasicBlock &BB : F) + if (auto *IBr = dyn_cast(BB.getTerminator())) { + // Handle the degenerate case of no successors by replacing the indirectbr + // with unreachable as there is no successor available. + if (IBr->getNumSuccessors() == 0) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + continue; + } + + IndirectBrs.push_back(IBr); + for (BasicBlock *SuccBB : IBr->successors()) + IndirectBrSuccs.insert(SuccBB); + } + + if (IndirectBrs.empty()) + return false; + + // If we need to replace any indirectbrs we need to establish integer + // constants that will correspond to each of the basic blocks in the function + // whose address escapes. We do that here and rewrite all the blockaddress + // constants to just be those integer constants cast to a pointer type. + SmallVector BBs; + + for (BasicBlock &BB : F) { + // Skip blocks that aren't successors to an indirectbr we're going to + // rewrite. + if (!IndirectBrSuccs.count(&BB)) + continue; + + auto IsBlockAddressUse = [&](const Use &U) { + return isa(U.getUser()); + }; + auto BlockAddressUseIt = llvm::find_if(BB.uses(), IsBlockAddressUse); + if (BlockAddressUseIt == BB.use_end()) + continue; + + assert(std::find_if(std::next(BlockAddressUseIt), BB.use_end(), + IsBlockAddressUse) == BB.use_end() && + "There should only ever be a single blockaddress use because it is " + "a constant and should be uniqued."); + + auto *BA = cast(BlockAddressUseIt->getUser()); + + // Skip if the constant was formed but ended up not being used (due to DCE + // or whatever). + if (!BA->isConstantUsed()) + continue; + + // Compute the index we want to use for this basic block. We can't use zero + // because null can be compared with block addresses. + int BBIndex = BBs.size() + 1; + BBs.push_back(&BB); + + auto *ITy = cast(DL.getIntPtrType(BA->getType())); + ConstantInt *BBIndexC = ConstantInt::get(ITy, BBIndex); + + // Now rewrite the blockaddress to an integer constant based on the index. + // FIXME: We could potentially preserve the uses as arguments to inline asm. + // This would allow some uses such as diagnostic information in crashes to + // have higher quality even when this transform is enabled, but would break + // users that round-trip blockaddresses through inline assembly and then + // back into an indirectbr. + BA->replaceAllUsesWith(ConstantExpr::getIntToPtr(BBIndexC, BA->getType())); + } + + if (BBs.empty()) { + // There are no blocks whose address is taken, so any indirectbr instruction + // cannot get a valid input and we can replace all of them with unreachable. + for (auto *IBr : IndirectBrs) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + } + return true; + } + + BasicBlock *SwitchBB; + Value *SwitchValue; + + // Compute a common integer type across all the indirectbr instructions. + IntegerType *CommonITy = nullptr; + for (auto *IBr : IndirectBrs) { + auto *ITy = + cast(DL.getIntPtrType(IBr->getAddress()->getType())); + if (!CommonITy || ITy->getBitWidth() > CommonITy->getBitWidth()) + CommonITy = ITy; + } + + auto GetSwitchValue = [DL, CommonITy](IndirectBrInst *IBr) { + return CastInst::CreatePointerCast( + IBr->getAddress(), CommonITy, + Twine(IBr->getAddress()->getName()) + ".switch_cast", IBr); + }; + + if (IndirectBrs.size() == 1) { + // If we only have one indirectbr, we can just directly replace it within + // its block. + SwitchBB = IndirectBrs[0]->getParent(); + SwitchValue = GetSwitchValue(IndirectBrs[0]); + IndirectBrs[0]->eraseFromParent(); + } else { + // Otherwise we need to create a new block to hold the switch across BBs, + // jump to that block instead of each indirectbr, and phi together the + // values for the switch. + SwitchBB = BasicBlock::Create(F.getContext(), "switch_bb", &F); + auto *SwitchPN = PHINode::Create(CommonITy, IndirectBrs.size(), + "switch_value_phi", SwitchBB); + SwitchValue = SwitchPN; + + // Now replace the indirectbr instructions with direct branches to the + // switch block and fill out the PHI operands. + for (auto *IBr : IndirectBrs) { + SwitchPN->addIncoming(GetSwitchValue(IBr), IBr->getParent()); + BranchInst::Create(SwitchBB, IBr); + IBr->eraseFromParent(); + } + } + + // Now build the switch in the block. The block will have no terminator + // already. + auto *SI = SwitchInst::Create(SwitchValue, BBs[0], BBs.size(), SwitchBB); + + // Add a case for each block. + for (int i : llvm::seq(1, BBs.size())) + SI->addCase(ConstantInt::get(CommonITy, i + 1), BBs[i]); + + return true; +} Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -1996,14 +1996,15 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Lib Type *ArgTy = ArgVT.getTypeForEVT(*DAG.getContext()); Entry.Node = Op; Entry.Ty = ArgTy; - Entry.IsSExt = isSigned; - Entry.IsZExt = !isSigned; + Entry.IsSExt = TLI.shouldSignExtendTypeInLibCall(ArgVT, isSigned); + Entry.IsZExt = !TLI.shouldSignExtendTypeInLibCall(ArgVT, isSigned); Args.push_back(Entry); } SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC), TLI.getPointerTy(DAG.getDataLayout())); - Type *RetTy = Node->getValueType(0).getTypeForEVT(*DAG.getContext()); + EVT RetVT = Node->getValueType(0); + Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext()); // By default, the input chain to this libcall is the entry node of the // function. If the libcall is going to be emitted as a tail call then @@ -2022,13 +2023,14 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Lib InChain = TCChain; TargetLowering::CallLoweringInfo CLI(DAG); + bool signExtend = TLI.shouldSignExtendTypeInLibCall(RetVT, isSigned); CLI.setDebugLoc(SDLoc(Node)) .setChain(InChain) .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args)) .setTailCall(isTailCall) - .setSExtResult(isSigned) - .setZExtResult(!isSigned) + .setSExtResult(signExtend) + .setZExtResult(!signExtend) .setIsPostTypeLegalization(true); std::pair CallInfo = TLI.LowerCallTo(CLI); Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -1117,22 +1117,34 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit if (!N) return nullptr; - if (SU->getNode()->getGluedNode()) + DEBUG(dbgs() << "Considering duplicating the SU\n"); + DEBUG(SU->dump(this)); + + if (N->getGluedNode() && + !TII->canCopyGluedNodeDuringSchedule(N)) { + DEBUG(dbgs() + << "Giving up because it has incoming glue and the target does not " + "want to copy it\n"); return nullptr; + } SUnit *NewSU; bool TryUnfold = false; for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) { MVT VT = N->getSimpleValueType(i); - if (VT == MVT::Glue) + if (VT == MVT::Glue) { + DEBUG(dbgs() << "Giving up because it has outgoing glue\n"); return nullptr; - else if (VT == MVT::Other) + } else if (VT == MVT::Other) TryUnfold = true; } for (const SDValue &Op : N->op_values()) { MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo()); - if (VT == MVT::Glue) + if (VT == MVT::Glue && !TII->canCopyGluedNodeDuringSchedule(N)) { + DEBUG(dbgs() << "Giving up because it one of the operands is glue and " + "the target does not want to copy it\n"); return nullptr; + } } // If possible unfold instruction. Modified: head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -907,6 +907,9 @@ void TargetPassConfig::addMachinePasses() { if (EnableMachineOutliner) PM->add(createMachineOutlinerPass(EnableLinkOnceODROutlining)); + // Add passes that directly emit MI after all other MI passes. + addPreEmitPass2(); + AddingMachinePasses = false; } Modified: head/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -38,6 +38,10 @@ bool TargetSubtargetInfo::enableAtomicExpand() const { return true; } +bool TargetSubtargetInfo::enableIndirectBrExpand() const { + return false; +} + bool TargetSubtargetInfo::enableMachineScheduler() const { return false; } Modified: head/contrib/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -3756,36 +3756,45 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) co // FIXME: This isn't safe because the addressing mode doesn't work // correctly if vaddr is negative. // - // FIXME: Handle v_add_u32 and VOP3 form. Also don't rely on immediate - // being in src0. - // // FIXME: Should probably be done somewhere else, maybe SIFoldOperands. // // See if we can extract an immediate offset by recognizing one of these: // V_ADD_I32_e32 dst, imm, src1 // V_ADD_I32_e32 dst, (S_MOV_B32 imm), src1 // V_ADD will be removed by "Remove dead machine instructions". - if (Add && Add->getOpcode() == AMDGPU::V_ADD_I32_e32) { - const MachineOperand *Src = - getNamedOperand(*Add, AMDGPU::OpName::src0); + if (Add && + (Add->getOpcode() == AMDGPU::V_ADD_I32_e32 || + Add->getOpcode() == AMDGPU::V_ADD_U32_e64)) { + static const unsigned SrcNames[2] = { + AMDGPU::OpName::src0, + AMDGPU::OpName::src1, + }; - if (Src->isReg()) { - auto Mov = MRI.getUniqueVRegDef(Src->getReg()); - if (Mov && Mov->getOpcode() == AMDGPU::S_MOV_B32) - Src = &Mov->getOperand(1); - } + // Find a literal offset in one of source operands. + for (int i = 0; i < 2; i++) { + const MachineOperand *Src = + getNamedOperand(*Add, SrcNames[i]); - if (Src) { - if (Src->isImm()) - Offset = Src->getImm(); - else if (Src->isCImm()) - Offset = Src->getCImm()->getZExtValue(); - } + if (Src->isReg()) { + auto Mov = MRI.getUniqueVRegDef(Src->getReg()); + if (Mov && Mov->getOpcode() == AMDGPU::S_MOV_B32) + Src = &Mov->getOperand(1); + } - if (Offset && isLegalMUBUFImmOffset(Offset)) - VAddr = getNamedOperand(*Add, AMDGPU::OpName::src1); - else + if (Src) { + if (Src->isImm()) + Offset = Src->getImm(); + else if (Src->isCImm()) + Offset = Src->getCImm()->getZExtValue(); + } + + if (Offset && isLegalMUBUFImmOffset(Offset)) { + VAddr = getNamedOperand(*Add, SrcNames[!i]); + break; + } + Offset = 0; + } } BuildMI(*MBB, Inst, Inst.getDebugLoc(), Modified: head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -141,3 +141,16 @@ void Thumb1InstrInfo::expandLoadStackGuard( else expandLoadStackGuardBase(MI, ARM::tLDRLIT_ga_abs, ARM::tLDRi); } + +bool Thumb1InstrInfo::canCopyGluedNodeDuringSchedule(SDNode *N) const { + // In Thumb1 the scheduler may need to schedule a cross-copy between GPRS and CPSR + // but this is not always possible there, so allow the Scheduler to clone tADCS and tSBCS + // even if they have glue. + // FIXME. Actually implement the cross-copy where it is possible (post v6) + // because these copies entail more spilling. + unsigned Opcode = N->getMachineOpcode(); + if (Opcode == ARM::tADCS || Opcode == ARM::tSBCS) + return true; + + return false; +} Modified: head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.h ============================================================================== --- head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/ARM/Thumb1InstrInfo.h Fri Feb 2 22:28:12 2018 (r328817) @@ -53,6 +53,7 @@ class Thumb1InstrInfo : public ARMBaseInstrInfo { (pub const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override; + bool canCopyGluedNodeDuringSchedule(SDNode *N) const override; private: void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override; }; Modified: head/contrib/llvm/lib/Target/Mips/MipsISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsISelLowering.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/Mips/MipsISelLowering.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -3507,10 +3507,9 @@ MipsTargetLowering::CanLowerReturn(CallingConv::ID Cal bool MipsTargetLowering::shouldSignExtendTypeInLibCall(EVT Type, bool IsSigned) const { - if (Subtarget.hasMips3() && Subtarget.useSoftFloat()) { - if (Type == MVT::i32) + if ((ABI.IsN32() || ABI.IsN64()) && Type == MVT::i32) return true; - } + return IsSigned; } Modified: head/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -136,6 +136,13 @@ IsGlobalInSmallSectionImpl(const GlobalObject *GO, return false; Type *Ty = GVA->getValueType(); + + // It is possible that the type of the global is unsized, i.e. a declaration + // of a extern struct. In this case don't presume it is in the small data + // section. This happens e.g. when building the FreeBSD kernel. + if (!Ty->isSized()) + return false; + return IsInSmallSection( GVA->getParent()->getDataLayout().getTypeAllocSize(Ty)); } Modified: head/contrib/llvm/lib/Target/Sparc/SparcFrameLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Sparc/SparcFrameLowering.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/Sparc/SparcFrameLowering.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -88,10 +88,11 @@ void SparcFrameLowering::emitPrologue(MachineFunction assert(&MF.front() == &MBB && "Shrink-wrapping not yet supported"); MachineFrameInfo &MFI = MF.getFrameInfo(); + const SparcSubtarget &Subtarget = MF.getSubtarget(); const SparcInstrInfo &TII = - *static_cast(MF.getSubtarget().getInstrInfo()); + *static_cast(Subtarget.getInstrInfo()); const SparcRegisterInfo &RegInfo = - *static_cast(MF.getSubtarget().getRegisterInfo()); + *static_cast(Subtarget.getRegisterInfo()); MachineBasicBlock::iterator MBBI = MBB.begin(); // Debug location must be unknown since the first debug location is used // to determine the end of the prologue. @@ -141,7 +142,7 @@ void SparcFrameLowering::emitPrologue(MachineFunction // Adds the SPARC subtarget-specific spill area to the stack // size. Also ensures target-required alignment. - NumBytes = MF.getSubtarget().getAdjustedFrameSize(NumBytes); + NumBytes = Subtarget.getAdjustedFrameSize(NumBytes); // Finally, ensure that the size is sufficiently aligned for the // data on the stack. @@ -176,9 +177,27 @@ void SparcFrameLowering::emitPrologue(MachineFunction .addCFIIndex(CFIIndex); if (NeedsStackRealignment) { - // andn %o6, MaxAlign-1, %o6 + int64_t Bias = Subtarget.getStackPointerBias(); + unsigned regUnbiased; + if (Bias) { + // This clobbers G1 which we always know is available here. + regUnbiased = SP::G1; + // add %o6, BIAS, %g1 + BuildMI(MBB, MBBI, dl, TII.get(SP::ADDri), regUnbiased) + .addReg(SP::O6).addImm(Bias); + } else + regUnbiased = SP::O6; + + // andn %regUnbiased, MaxAlign-1, %regUnbiased int MaxAlign = MFI.getMaxAlignment(); - BuildMI(MBB, MBBI, dl, TII.get(SP::ANDNri), SP::O6).addReg(SP::O6).addImm(MaxAlign - 1); + BuildMI(MBB, MBBI, dl, TII.get(SP::ANDNri), regUnbiased) + .addReg(regUnbiased).addImm(MaxAlign - 1); + + if (Bias) { + // add %g1, -BIAS, %o6 + BuildMI(MBB, MBBI, dl, TII.get(SP::ADDri), SP::O6) + .addReg(regUnbiased).addImm(-Bias); + } } } Modified: head/contrib/llvm/lib/Target/X86/X86.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86.h Fri Feb 2 22:28:12 2018 (r328817) @@ -22,6 +22,7 @@ namespace llvm { class FunctionPass; class ImmutablePass; class InstructionSelector; +class ModulePass; class PassRegistry; class X86RegisterBankInfo; class X86Subtarget; @@ -101,6 +102,9 @@ void initializeFixupBWInstPassPass(PassRegistry &); /// This pass replaces EVEX encoded of AVX-512 instructiosn by VEX /// encoding when possible in order to reduce code size. FunctionPass *createX86EvexToVexInsts(); + +/// This pass creates the thunks for the retpoline feature. +FunctionPass *createX86RetpolineThunksPass(); InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM, X86Subtarget &, Modified: head/contrib/llvm/lib/Target/X86/X86.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86.td Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86.td Fri Feb 2 22:28:12 2018 (r328817) @@ -329,6 +329,27 @@ def FeatureHasFastGather : SubtargetFeature<"fast-gather", "HasFastGather", "true", "Indicates if gather is reasonably fast.">; +// Enable mitigation of some aspects of speculative execution related +// vulnerabilities by removing speculatable indirect branches. This disables +// jump-table formation, rewrites explicit `indirectbr` instructions into +// `switch` instructions, and uses a special construct called a "retpoline" to +// prevent speculation of the remaining indirect branches (indirect calls and +// tail calls). +def FeatureRetpoline + : SubtargetFeature<"retpoline", "UseRetpoline", "true", + "Remove speculation of indirect branches from the " + "generated code, either by avoiding them entirely or " + "lowering them with a speculation blocking construct.">; + +// Rely on external thunks for the emitted retpoline calls. This allows users +// to provide their own custom thunk definitions in highly specialized +// environments such as a kernel that does boot-time hot patching. +def FeatureRetpolineExternalThunk + : SubtargetFeature< + "retpoline-external-thunk", "UseRetpolineExternalThunk", "true", + "Enable retpoline, but with an externally provided thunk.", + [FeatureRetpoline]>; + //===----------------------------------------------------------------------===// // Register File Description //===----------------------------------------------------------------------===// Modified: head/contrib/llvm/lib/Target/X86/X86AsmPrinter.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86AsmPrinter.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86AsmPrinter.h Fri Feb 2 22:28:12 2018 (r328817) @@ -32,6 +32,7 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public A FaultMaps FM; std::unique_ptr CodeEmitter; bool EmitFPOData = false; + bool NeedsRetpoline = false; // This utility class tracks the length of a stackmap instruction's 'shadow'. // It is used by the X86AsmPrinter to ensure that the stackmap shadow Modified: head/contrib/llvm/lib/Target/X86/X86FastISel.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86FastISel.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86FastISel.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -3172,6 +3172,10 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) (CalledFn && CalledFn->hasFnAttribute("no_caller_saved_registers"))) return false; + // Functions using retpoline should use SDISel for calls. + if (Subtarget->useRetpoline()) + return false; + // Handle only C, fastcc, and webkit_js calling conventions for now. switch (CC) { default: return false; Modified: head/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -741,6 +741,11 @@ void X86FrameLowering::emitStackProbeCall(MachineFunct bool InProlog) const { bool IsLargeCodeModel = MF.getTarget().getCodeModel() == CodeModel::Large; + // FIXME: Add retpoline support and remove this. + if (Is64Bit && IsLargeCodeModel && STI.useRetpoline()) + report_fatal_error("Emitting stack probe calls on 64-bit with the large " + "code model and retpoline not yet implemented."); + unsigned CallOp; if (Is64Bit) CallOp = IsLargeCodeModel ? X86::CALL64r : X86::CALL64pcrel32; @@ -2345,6 +2350,10 @@ void X86FrameLowering::adjustForSegmentedStacks( // This solution is not perfect, as it assumes that the .rodata section // is laid out within 2^31 bytes of each function body, but this seems // to be sufficient for JIT. + // FIXME: Add retpoline support and remove the error here.. + if (STI.useRetpoline()) + report_fatal_error("Emitting morestack calls on 64-bit with the large " + "code model and retpoline not yet implemented."); BuildMI(allocMBB, DL, TII.get(X86::CALL64m)) .addReg(X86::RIP) .addImm(0) Modified: head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -629,11 +629,11 @@ void X86DAGToDAGISel::PreprocessISelDAG() { SDNode *N = &*I++; // Preincrement iterator to avoid invalidation issues. if (OptLevel != CodeGenOpt::None && - // Only does this when target favors doesn't favor register indirect - // call. + // Only do this when the target can fold the load into the call or + // jmp. + !Subtarget->useRetpoline() && ((N->getOpcode() == X86ISD::CALL && !Subtarget->slowTwoMemOps()) || (N->getOpcode() == X86ISD::TC_RETURN && - // Only does this if load can be folded into TC_RETURN. (Subtarget->is64Bit() || !getTargetMachine().isPositionIndependent())))) { /// Also try moving call address load from outside callseq_start to just Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -25767,6 +25767,15 @@ X86TargetLowering::isVectorClearMaskLegal(const SmallV return isShuffleMaskLegal(Mask, VT); } +bool X86TargetLowering::areJTsAllowed(const Function *Fn) const { + // If the subtarget is using retpolines, we need to not generate jump tables. + if (Subtarget.useRetpoline()) + return false; + + // Otherwise, fallback on the generic logic. + return TargetLowering::areJTsAllowed(Fn); +} + //===----------------------------------------------------------------------===// // X86 Scheduler Hooks //===----------------------------------------------------------------------===// @@ -27069,7 +27078,116 @@ X86TargetLowering::EmitLoweredTLSCall(MachineInstr &MI return BB; } +static unsigned getOpcodeForRetpoline(unsigned RPOpc) { + switch (RPOpc) { + case X86::RETPOLINE_CALL32: + return X86::CALLpcrel32; + case X86::RETPOLINE_CALL64: + return X86::CALL64pcrel32; + case X86::RETPOLINE_TCRETURN32: + return X86::TCRETURNdi; + case X86::RETPOLINE_TCRETURN64: + return X86::TCRETURNdi64; + } + llvm_unreachable("not retpoline opcode"); +} + +static const char *getRetpolineSymbol(const X86Subtarget &Subtarget, + unsigned Reg) { + switch (Reg) { + case 0: + assert(!Subtarget.is64Bit() && "R11 should always be available on x64"); + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_push" + : "__llvm_retpoline_push"; + case X86::EAX: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_eax" + : "__llvm_retpoline_eax"; + case X86::ECX: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_ecx" + : "__llvm_retpoline_ecx"; + case X86::EDX: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_edx" + : "__llvm_retpoline_edx"; + case X86::R11: + return Subtarget.useRetpolineExternalThunk() + ? "__llvm_external_retpoline_r11" + : "__llvm_retpoline_r11"; + } + llvm_unreachable("unexpected reg for retpoline"); +} + MachineBasicBlock * +X86TargetLowering::EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const { + // Copy the virtual register into the R11 physical register and + // call the retpoline thunk. + DebugLoc DL = MI.getDebugLoc(); + const X86InstrInfo *TII = Subtarget.getInstrInfo(); + unsigned CalleeVReg = MI.getOperand(0).getReg(); + unsigned Opc = getOpcodeForRetpoline(MI.getOpcode()); + + // Find an available scratch register to hold the callee. On 64-bit, we can + // just use R11, but we scan for uses anyway to ensure we don't generate + // incorrect code. On 32-bit, we use one of EAX, ECX, or EDX that isn't + // already a register use operand to the call to hold the callee. If none + // are available, push the callee instead. This is less efficient, but is + // necessary for functions using 3 regparms. Such function calls are + // (currently) not eligible for tail call optimization, because there is no + // scratch register available to hold the address of the callee. + SmallVector AvailableRegs; + if (Subtarget.is64Bit()) + AvailableRegs.push_back(X86::R11); + else + AvailableRegs.append({X86::EAX, X86::ECX, X86::EDX}); + + // Zero out any registers that are already used. + for (const auto &MO : MI.operands()) { + if (MO.isReg() && MO.isUse()) + for (unsigned &Reg : AvailableRegs) + if (Reg == MO.getReg()) + Reg = 0; + } + + // Choose the first remaining non-zero available register. + unsigned AvailableReg = 0; + for (unsigned MaybeReg : AvailableRegs) { + if (MaybeReg) { + AvailableReg = MaybeReg; + break; + } + } + + const char *Symbol = getRetpolineSymbol(Subtarget, AvailableReg); + + if (AvailableReg == 0) { + // No register available. Use PUSH. This must not be a tailcall, and this + // must not be x64. + if (Subtarget.is64Bit()) + report_fatal_error( + "Cannot make an indirect call on x86-64 using both retpoline and a " + "calling convention that preservers r11"); + if (Opc != X86::CALLpcrel32) + report_fatal_error("Cannot make an indirect tail call on x86 using " + "retpoline without a preserved register"); + BuildMI(*BB, MI, DL, TII->get(X86::PUSH32r)).addReg(CalleeVReg); + MI.getOperand(0).ChangeToES(Symbol); + MI.setDesc(TII->get(Opc)); + } else { + BuildMI(*BB, MI, DL, TII->get(TargetOpcode::COPY), AvailableReg) + .addReg(CalleeVReg); + MI.getOperand(0).ChangeToES(Symbol); + MI.setDesc(TII->get(Opc)); + MachineInstrBuilder(*BB->getParent(), &MI) + .addReg(AvailableReg, RegState::Implicit | RegState::Kill); + } + return BB; +} + +MachineBasicBlock * X86TargetLowering::emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const { DebugLoc DL = MI.getDebugLoc(); @@ -27584,6 +27702,11 @@ X86TargetLowering::EmitInstrWithCustomInserter(Machine case X86::TLS_base_addr32: case X86::TLS_base_addr64: return EmitLoweredTLSAddr(MI, BB); + case X86::RETPOLINE_CALL32: + case X86::RETPOLINE_CALL64: + case X86::RETPOLINE_TCRETURN32: + case X86::RETPOLINE_TCRETURN64: + return EmitLoweredRetpoline(MI, BB); case X86::CATCHRET: return EmitLoweredCatchRet(MI, BB); case X86::CATCHPAD: Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.h Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.h Fri Feb 2 22:28:12 2018 (r328817) @@ -982,6 +982,9 @@ namespace llvm { bool isVectorClearMaskLegal(const SmallVectorImpl &Mask, EVT VT) const override; + /// Returns true if lowering to a jump table is allowed. + bool areJTsAllowed(const Function *Fn) const override; + /// If true, then instruction selection should /// seek to shrink the FP constant of the specified type to a smaller type /// in order to save space and / or reduce runtime. @@ -1293,6 +1296,9 @@ namespace llvm { MachineBasicBlock *EmitLoweredTLSCall(MachineInstr &MI, MachineBasicBlock *BB) const; + + MachineBasicBlock *EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const; MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const; Modified: head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Fri Feb 2 22:28:12 2018 (r328817) @@ -1146,14 +1146,14 @@ def X86tcret_6regs : PatFrag<(ops node:$ptr, node:$off def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[Not64BitMode]>; + Requires<[Not64BitMode, NotUseRetpoline]>; // FIXME: This is disabled for 32-bit PIC mode because the global base // register which is part of the address mode may be assigned a // callee-saved register. def : Pat<(X86tcret (load addr:$dst), imm:$off), (TCRETURNmi addr:$dst, imm:$off)>, - Requires<[Not64BitMode, IsNotPIC]>; + Requires<[Not64BitMode, IsNotPIC, NotUseRetpoline]>; def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off), (TCRETURNdi tglobaladdr:$dst, imm:$off)>, @@ -1165,13 +1165,21 @@ def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off) def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri64 ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; // Don't fold loads into X86tcret requiring more than 6 regs. // There wouldn't be enough scratch registers for base+index. def : Pat<(X86tcret_6regs (load addr:$dst), imm:$off), (TCRETURNmi64 addr:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN64 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[In64BitMode, UseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN32 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[Not64BitMode, UseRetpoline]>; def : Pat<(X86tcret (i64 tglobaladdr:$dst), imm:$off), (TCRETURNdi64 tglobaladdr:$dst, imm:$off)>, Modified: head/contrib/llvm/lib/Target/X86/X86InstrControl.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrControl.td Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86InstrControl.td Fri Feb 2 22:28:12 2018 (r328817) @@ -211,11 +211,12 @@ let isCall = 1 in Sched<[WriteJumpLd]>; def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst), "call{l}\t{*}$dst", [(X86call GR32:$dst)], IIC_CALL_RI>, - OpSize32, Requires<[Not64BitMode]>, Sched<[WriteJump]>; + OpSize32, Requires<[Not64BitMode,NotUseRetpoline]>, + Sched<[WriteJump]>; def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst), "call{l}\t{*}$dst", [(X86call (loadi32 addr:$dst))], IIC_CALL_MEM>, OpSize32, - Requires<[Not64BitMode,FavorMemIndirectCall]>, + Requires<[Not64BitMode,FavorMemIndirectCall,NotUseRetpoline]>, Sched<[WriteJumpLd]>; let Predicates = [Not64BitMode] in { @@ -298,11 +299,12 @@ let isCall = 1, Uses = [RSP, SSP], SchedRW = [WriteJum def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst), "call{q}\t{*}$dst", [(X86call GR64:$dst)], IIC_CALL_RI>, - Requires<[In64BitMode]>; + Requires<[In64BitMode,NotUseRetpoline]>; def CALL64m : I<0xFF, MRM2m, (outs), (ins i64mem:$dst), "call{q}\t{*}$dst", [(X86call (loadi64 addr:$dst))], IIC_CALL_MEM>, - Requires<[In64BitMode,FavorMemIndirectCall]>; + Requires<[In64BitMode,FavorMemIndirectCall, + NotUseRetpoline]>; def FARCALL64 : RI<0xFF, MRM3m, (outs), (ins opaque80mem:$dst), "lcall{q}\t{*}$dst", [], IIC_CALL_FAR_MEM>; @@ -338,6 +340,27 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarr let mayLoad = 1 in def TAILJMPm64_REX : I<0xFF, MRM4m, (outs), (ins i64mem_TC:$dst), "rex64 jmp{q}\t{*}$dst", [], IIC_JMP_MEM>; + } +} + +let isPseudo = 1, isCall = 1, isCodeGenOnly = 1, + Uses = [RSP, SSP], + usesCustomInserter = 1, + SchedRW = [WriteJump] in { + def RETPOLINE_CALL32 : + PseudoI<(outs), (ins GR32:$dst), [(X86call GR32:$dst)]>, + Requires<[Not64BitMode,UseRetpoline]>; + + def RETPOLINE_CALL64 : + PseudoI<(outs), (ins GR64:$dst), [(X86call GR64:$dst)]>, + Requires<[In64BitMode,UseRetpoline]>; + + // Retpoline variant of indirect tail calls. + let isTerminator = 1, isReturn = 1, isBarrier = 1 in { + def RETPOLINE_TCRETURN64 : + PseudoI<(outs), (ins GR64:$dst, i32imm:$offset), []>; + def RETPOLINE_TCRETURN32 : + PseudoI<(outs), (ins GR32:$dst, i32imm:$offset), []>; } } Modified: head/contrib/llvm/lib/Target/X86/X86InstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrInfo.td Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86InstrInfo.td Fri Feb 2 22:28:12 2018 (r328817) @@ -938,6 +938,8 @@ def HasFastLZCNT : Predicate<"Subtarget->hasFastLZCNT( def HasFastSHLDRotate : Predicate<"Subtarget->hasFastSHLDRotate()">; def HasERMSB : Predicate<"Subtarget->hasERMSB()">; def HasMFence : Predicate<"Subtarget->hasMFence()">; +def UseRetpoline : Predicate<"Subtarget->useRetpoline()">; +def NotUseRetpoline : Predicate<"!Subtarget->useRetpoline()">; //===----------------------------------------------------------------------===// // X86 Instruction Format Definitions. Modified: head/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp Fri Feb 2 22:09:36 2018 (r328816) +++ head/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp Fri Feb 2 22:28:12 2018 (r328817) @@ -874,6 +874,10 @@ void X86AsmPrinter::LowerSTATEPOINT(const MachineInstr // address is to far away. (TODO: support non-relative addressing) break; case MachineOperand::MO_Register: + // FIXME: Add retpoline support and remove this. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 2 22:53:59 2018 Return-Path: Delivered-To: svn-src-all@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 516CBED0E7D; Fri, 2 Feb 2018 22:53:59 +0000 (UTC) (envelope-from jilles@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 D9A98854BA; Fri, 2 Feb 2018 22:53:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4757220F7; Fri, 2 Feb 2018 22:53:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12Mrwtt059897; Fri, 2 Feb 2018 22:53:58 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12MrwOq059896; Fri, 2 Feb 2018 22:53:58 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201802022253.w12MrwOq059896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 2 Feb 2018 22:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328818 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 328818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 22:53:59 -0000 Author: jilles Date: Fri Feb 2 22:53:58 2018 New Revision: 328818 URL: https://svnweb.freebsd.org/changeset/base/328818 Log: sh: Refactor job status printing, preparing for -o pipefail and similar No functional change is intended. Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Fri Feb 2 22:28:12 2018 (r328817) +++ head/bin/sh/jobs.c Fri Feb 2 22:53:58 2018 (r328818) @@ -362,7 +362,7 @@ showjob(struct job *jp, int mode) const char *statestr, *coredump; struct procstat *ps; struct job *j; - int col, curr, i, jobno, prev, procno; + int col, curr, i, jobno, prev, procno, status; char c; procno = (mode == SHOWJOBS_PGIDS) ? 1 : jp->nprocs; @@ -376,11 +376,12 @@ showjob(struct job *jp, int mode) } #endif coredump = ""; - ps = jp->ps + jp->nprocs - 1; + status = jp->ps[jp->nprocs - 1].status; if (jp->state == 0) { statestr = "Running"; #if JOBS } else if (jp->state == JOBSTOPPED) { + ps = jp->ps + jp->nprocs - 1; while (!WIFSTOPPED(ps->status) && ps > jp->ps) ps--; if (WIFSTOPPED(ps->status)) @@ -391,20 +392,20 @@ showjob(struct job *jp, int mode) if (statestr == NULL) statestr = "Suspended"; #endif - } else if (WIFEXITED(ps->status)) { - if (WEXITSTATUS(ps->status) == 0) + } else if (WIFEXITED(status)) { + if (WEXITSTATUS(status) == 0) statestr = "Done"; else { fmtstr(statebuf, sizeof(statebuf), "Done(%d)", - WEXITSTATUS(ps->status)); + WEXITSTATUS(status)); statestr = statebuf; } } else { - i = WTERMSIG(ps->status); + i = WTERMSIG(status); statestr = strsignal(i); if (statestr == NULL) statestr = "Unknown signal"; - if (WCOREDUMP(ps->status)) + if (WCOREDUMP(status)) coredump = " (core dumped)"; } From owner-svn-src-all@freebsd.org Fri Feb 2 23:19:21 2018 Return-Path: Delivered-To: svn-src-all@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 3674CED22B3; Fri, 2 Feb 2018 23:19:21 +0000 (UTC) (envelope-from mav@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 D76AD861A7; Fri, 2 Feb 2018 23:19:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDD5F22431; Fri, 2 Feb 2018 23:19:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12NJKqq069951; Fri, 2 Feb 2018 23:19:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12NJKto069946; Fri, 2 Feb 2018 23:19:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802022319.w12NJKto069946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 23:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328819 - in stable/11/sys/cam: . ata nvme scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cam: . ata nvme scsi X-SVN-Commit-Revision: 328819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 23:19:21 -0000 Author: mav Date: Fri Feb 2 23:19:20 2018 New Revision: 328819 URL: https://svnweb.freebsd.org/changeset/base/328819 Log: MFC r303467 (by imp): Switch to linker sets to find the xport callback object. This eliminates the need to special case everything in cam_xpt for new transports. It is now a failure to not have a transport object when registering the bus as well. You can still, however, create a transport that's unspecified (XPT_) Modified: stable/11/sys/cam/ata/ata_xpt.c stable/11/sys/cam/cam_xpt.c stable/11/sys/cam/cam_xpt_internal.h stable/11/sys/cam/nvme/nvme_xpt.c stable/11/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/11/sys/cam/ata/ata_xpt.c Fri Feb 2 22:53:58 2018 (r328818) +++ stable/11/sys/cam/ata/ata_xpt.c Fri Feb 2 23:19:20 2018 (r328819) @@ -196,18 +196,24 @@ static int atapi_dma = 1; TUNABLE_INT("hw.ata.ata_dma", &ata_dma); TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma); -static struct xpt_xport ata_xport = { +static struct xpt_xport_ops ata_xport_ops = { .alloc_device = ata_alloc_device, .action = ata_action, .async = ata_dev_async, .announce = ata_announce_periph, }; +#define ATA_XPT_XPORT(x, X) \ +static struct xpt_xport ata_xport_ ## x = { \ + .xport = XPORT_ ## X, \ + .name = #x, \ + .ops = &ata_xport_ops, \ +}; \ +CAM_XPT_XPORT(ata_xport_ ## x); -struct xpt_xport * -ata_get_xport(void) -{ - return (&ata_xport); -} +ATA_XPT_XPORT(ata, ATA); +ATA_XPT_XPORT(sata, SATA); + +#undef ATA_XPORT_XPORT static void probe_periph_init() Modified: stable/11/sys/cam/cam_xpt.c ============================================================================== --- stable/11/sys/cam/cam_xpt.c Fri Feb 2 22:53:58 2018 (r328818) +++ stable/11/sys/cam/cam_xpt.c Fri Feb 2 23:19:20 2018 (r328819) @@ -1044,7 +1044,7 @@ xpt_announce_periph(struct cam_periph *periph, char *a periph->unit_number, path->device->serial_num); } /* Announce transport details. */ - (*(path->bus->xport->announce))(periph); + (*(path->bus->xport->ops->announce))(periph); /* Announce command queueing. */ if (path->device->inq_flags & SID_CmdQue || path->device->flags & CAM_DEV_TAG_AFTER_COUNT) { @@ -2488,7 +2488,7 @@ xpt_action(union ccb *start_ccb) xpt_action_name(start_ccb->ccb_h.func_code))); start_ccb->ccb_h.status = CAM_REQ_INPROG; - (*(start_ccb->ccb_h.path->bus->xport->action))(start_ccb); + (*(start_ccb->ccb_h.path->bus->xport->ops->action))(start_ccb); } void @@ -3507,9 +3507,9 @@ xpt_compile_path(struct cam_path *new_path, struct cam struct cam_ed *new_device; new_device = - (*(bus->xport->alloc_device))(bus, - target, - lun_id); + (*(bus->xport->ops->alloc_device))(bus, + target, + lun_id); if (new_device == NULL) { status = CAM_RESRC_UNAVAIL; } else { @@ -3857,12 +3857,19 @@ xpt_release_ccb(union ccb *free_ccb) /* Functions accessed by SIM drivers */ -static struct xpt_xport xport_default = { +static struct xpt_xport_ops xport_default_ops = { .alloc_device = xpt_alloc_device_default, .action = xpt_action_default, .async = xpt_dev_async_default, }; +static struct xpt_xport xport_default = { + .xport = XPORT_UNKNOWN, + .name = "unknown", + .ops = &xport_default_ops, +}; +CAM_XPT_XPORT(xport_default); + /* * A sim structure, listing the SIM entry points and instance * identification info is passed to xpt_bus_register to hook the SIM @@ -3931,27 +3938,21 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, xpt_action((union ccb *)&cpi); if (cpi.ccb_h.status == CAM_REQ_CMP) { - switch (cpi.transport) { - case XPORT_SPI: - case XPORT_SAS: - case XPORT_FC: - case XPORT_USB: - case XPORT_ISCSI: - case XPORT_SRP: - case XPORT_PPB: - new_bus->xport = scsi_get_xport(); - break; - case XPORT_ATA: - case XPORT_SATA: - new_bus->xport = ata_get_xport(); - break; - case XPORT_NVME: - new_bus->xport = nvme_get_xport(); - break; - default: - new_bus->xport = &xport_default; - break; + struct xpt_xport **xpt; + + SET_FOREACH(xpt, cam_xpt_xport_set) { + if ((*xpt)->xport == cpi.transport) { + new_bus->xport = *xpt; + break; + } } + if (new_bus->xport == NULL) { + xpt_print_path(path); + printf("No transport found for %d\n", cpi.transport); + xpt_release_bus(new_bus); + free(path, M_CAMXPT); + return (CAM_RESRC_UNAVAIL); + } } /* Notify interested parties */ @@ -4160,7 +4161,7 @@ xpt_async_process_dev(struct cam_ed *device, void *arg } else relock = 0; - (*(device->target->bus->xport->async))(async_code, + (*(device->target->bus->xport->ops->async))(async_code, device->target->bus, device->target, device, async_arg); xpt_async_bcast(&device->asyncs, async_code, path, async_arg); Modified: stable/11/sys/cam/cam_xpt_internal.h ============================================================================== --- stable/11/sys/cam/cam_xpt_internal.h Fri Feb 2 22:53:58 2018 (r328818) +++ stable/11/sys/cam/cam_xpt_internal.h Fri Feb 2 23:19:20 2018 (r328819) @@ -48,7 +48,7 @@ typedef void (*xpt_dev_async_func)(u_int32_t async_cod void *async_arg); typedef void (*xpt_announce_periph_func)(struct cam_periph *periph); -struct xpt_xport { +struct xpt_xport_ops { xpt_alloc_device_func alloc_device; xpt_release_device_func reldev; xpt_action_func action; @@ -56,6 +56,16 @@ struct xpt_xport { xpt_announce_periph_func announce; }; +struct xpt_xport { + cam_xport xport; + const char *name; + struct xpt_xport_ops *ops; +}; + +SET_DECLARE(cam_xpt_xport_set, struct xpt_xport); +#define CAM_XPT_XPORT(data) \ + DATA_SET(cam_xpt_xport_set, data) + /* * The CAM EDT (Existing Device Table) contains the device information for * all devices for all busses in the system. The table contains a @@ -166,10 +176,6 @@ struct cam_path { struct cam_et *target; struct cam_ed *device; }; - -struct xpt_xport * scsi_get_xport(void); -struct xpt_xport * ata_get_xport(void); -struct xpt_xport * nvme_get_xport(void); struct cam_ed * xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, Modified: stable/11/sys/cam/nvme/nvme_xpt.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_xpt.c Fri Feb 2 22:53:58 2018 (r328818) +++ stable/11/sys/cam/nvme/nvme_xpt.c Fri Feb 2 23:19:20 2018 (r328819) @@ -153,19 +153,23 @@ static void nvme_dev_async(u_int32_t async_code, static void nvme_action(union ccb *start_ccb); static void nvme_announce_periph(struct cam_periph *periph); -static struct xpt_xport nvme_xport = { +static struct xpt_xport_ops nvme_xport_ops = { .alloc_device = nvme_alloc_device, .action = nvme_action, .async = nvme_dev_async, .announce = nvme_announce_periph, }; +#define NVME_XPT_XPORT(x, X) \ +static struct xpt_xport nvme_xport_ ## x = { \ + .xport = XPORT_ ## X, \ + .name = #x, \ + .ops = &nvme_xport_ops, \ +}; \ +CAM_XPT_XPORT(nvme_xport_ ## x); -struct xpt_xport * -nvme_get_xport(void) -{ +NVME_XPT_XPORT(nvme, NVME); - return (&nvme_xport); -} +#undef NVME_XPT_XPORT static void nvme_probe_periph_init() Modified: stable/11/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_xpt.c Fri Feb 2 22:53:58 2018 (r328818) +++ stable/11/sys/cam/scsi/scsi_xpt.c Fri Feb 2 23:19:20 2018 (r328819) @@ -590,18 +590,29 @@ static void scsi_dev_async(u_int32_t async_code, static void scsi_action(union ccb *start_ccb); static void scsi_announce_periph(struct cam_periph *periph); -static struct xpt_xport scsi_xport = { +static struct xpt_xport_ops scsi_xport_ops = { .alloc_device = scsi_alloc_device, .action = scsi_action, .async = scsi_dev_async, .announce = scsi_announce_periph, }; +#define SCSI_XPT_XPORT(x, X) \ +static struct xpt_xport scsi_xport_ ## x = { \ + .xport = XPORT_ ## X, \ + .name = #x, \ + .ops = &scsi_xport_ops, \ +}; \ +CAM_XPT_XPORT(scsi_xport_ ## x); -struct xpt_xport * -scsi_get_xport(void) -{ - return (&scsi_xport); -} +SCSI_XPT_XPORT(spi, SPI); +SCSI_XPT_XPORT(sas, SAS); +SCSI_XPT_XPORT(fc, FC); +SCSI_XPT_XPORT(usb, USB); +SCSI_XPT_XPORT(iscsi, ISCSI); +SCSI_XPT_XPORT(srp, SRP); +SCSI_XPT_XPORT(ppb, PPB); + +#undef SCSI_XPORT_XPORT static void probe_periph_init() From owner-svn-src-all@freebsd.org Fri Feb 2 23:22:59 2018 Return-Path: Delivered-To: svn-src-all@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 95A72ED26F0; Fri, 2 Feb 2018 23:22:59 +0000 (UTC) (envelope-from mav@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 48D40865F2; Fri, 2 Feb 2018 23:22:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43AE5225C0; Fri, 2 Feb 2018 23:22:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12NMxeq074614; Fri, 2 Feb 2018 23:22:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12NMwnq074609; Fri, 2 Feb 2018 23:22:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802022322.w12NMwnq074609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Feb 2018 23:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328820 - in stable/11/sys/cam: . ata nvme scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cam: . ata nvme scsi X-SVN-Commit-Revision: 328820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 23:22:59 -0000 Author: mav Date: Fri Feb 2 23:22:58 2018 New Revision: 328820 URL: https://svnweb.freebsd.org/changeset/base/328820 Log: MFC r303468 (by imp): Move protocol specific stuff into a linker set object that's per-protocol. This reduces the number scsi symbols references by cam_xpt significantly, and eliminates all ata / nvme symbols. There's still some NVME / ATA specific code for dealing with XPT_NVME_IO and XPT_ATA_IO respectively, and a bunch of scsi-specific code, but this is progress. Modified: stable/11/sys/cam/ata/ata_xpt.c stable/11/sys/cam/cam_xpt.c stable/11/sys/cam/cam_xpt_internal.h stable/11/sys/cam/nvme/nvme_xpt.c stable/11/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/11/sys/cam/ata/ata_xpt.c Fri Feb 2 23:19:20 2018 (r328819) +++ stable/11/sys/cam/ata/ata_xpt.c Fri Feb 2 23:22:58 2018 (r328820) @@ -189,6 +189,11 @@ static void ata_dev_async(u_int32_t async_code, void *async_arg); static void ata_action(union ccb *start_ccb); static void ata_announce_periph(struct cam_periph *periph); +static void ata_proto_announce(struct cam_ed *device); +static void ata_proto_denounce(struct cam_ed *device); +static void ata_proto_debug_out(union ccb *ccb); +static void semb_proto_announce(struct cam_ed *device); +static void semb_proto_denounce(struct cam_ed *device); static int ata_dma = 1; static int atapi_dma = 1; @@ -215,6 +220,43 @@ ATA_XPT_XPORT(sata, SATA); #undef ATA_XPORT_XPORT +static struct xpt_proto_ops ata_proto_ops_ata = { + .announce = ata_proto_announce, + .denounce = ata_proto_denounce, + .debug_out = ata_proto_debug_out, +}; +static struct xpt_proto ata_proto_ata = { + .proto = PROTO_ATA, + .name = "ata", + .ops = &ata_proto_ops_ata, +}; + +static struct xpt_proto_ops ata_proto_ops_satapm = { + .announce = ata_proto_announce, + .denounce = ata_proto_denounce, + .debug_out = ata_proto_debug_out, +}; +static struct xpt_proto ata_proto_satapm = { + .proto = PROTO_SATAPM, + .name = "satapm", + .ops = &ata_proto_ops_satapm, +}; + +static struct xpt_proto_ops ata_proto_ops_semb = { + .announce = semb_proto_announce, + .denounce = semb_proto_denounce, + .debug_out = ata_proto_debug_out, +}; +static struct xpt_proto ata_proto_semb = { + .proto = PROTO_SEMB, + .name = "semb", + .ops = &ata_proto_ops_semb, +}; + +CAM_XPT_PROTO(ata_proto_ata); +CAM_XPT_PROTO(ata_proto_satapm); +CAM_XPT_PROTO(ata_proto_semb); + static void probe_periph_init() { @@ -2116,4 +2158,41 @@ ata_announce_periph(struct cam_periph *periph) printf(")"); } printf("\n"); +} + +static void +ata_proto_announce(struct cam_ed *device) +{ + ata_print_ident(&device->ident_data); +} + +static void +ata_proto_denounce(struct cam_ed *device) +{ + ata_print_ident_short(&device->ident_data); +} + +static void +semb_proto_announce(struct cam_ed *device) +{ + semb_print_ident((struct sep_identify_data *)&device->ident_data); +} + +static void +semb_proto_denounce(struct cam_ed *device) +{ + semb_print_ident_short((struct sep_identify_data *)&device->ident_data); +} + +static void +ata_proto_debug_out(union ccb *ccb) +{ + char cdb_str[(sizeof(struct ata_cmd) * 3) + 1]; + + if (ccb->ccb_h.func_code != XPT_ATA_IO) + return; + + CAM_DEBUG(ccb->ccb_h.path, + CAM_DEBUG_CDB,("%s. ACB: %s\n", ata_op_string(&ccb->ataio.cmd), + ata_cmd_string(&ccb->ataio.cmd, cdb_str, sizeof(cdb_str)))); } Modified: stable/11/sys/cam/cam_xpt.c ============================================================================== --- stable/11/sys/cam/cam_xpt.c Fri Feb 2 23:19:20 2018 (r328819) +++ stable/11/sys/cam/cam_xpt.c Fri Feb 2 23:22:58 2018 (r328820) @@ -747,6 +747,19 @@ cam_module_event_handler(module_t mod, int what, void return 0; } +static struct xpt_proto * +xpt_proto_find(cam_proto proto) +{ + struct xpt_proto **pp; + + SET_FOREACH(pp, cam_xpt_proto_set) { + if ((*pp)->proto == proto) + return *pp; + } + + return NULL; +} + static void xpt_rescan_done(struct cam_periph *periph, union ccb *done_ccb) { @@ -1013,6 +1026,7 @@ void xpt_announce_periph(struct cam_periph *periph, char *announce_string) { struct cam_path *path = periph->path; + struct xpt_proto *proto; cam_periph_assert(periph, MA_OWNED); periph->flags |= CAM_PERIPH_ANNOUNCED; @@ -1026,25 +1040,20 @@ xpt_announce_periph(struct cam_periph *periph, char *a path->target->target_id, (uintmax_t)path->device->lun_id); printf("%s%d: ", periph->periph_name, periph->unit_number); - if (path->device->protocol == PROTO_SCSI) - scsi_print_inquiry(&path->device->inq_data); - else if (path->device->protocol == PROTO_ATA || - path->device->protocol == PROTO_SATAPM) - ata_print_ident(&path->device->ident_data); - else if (path->device->protocol == PROTO_SEMB) - semb_print_ident( - (struct sep_identify_data *)&path->device->ident_data); - else if (path->device->protocol == PROTO_NVME) - nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); + proto = xpt_proto_find(path->device->protocol); + if (proto) + proto->ops->announce(path->device); else - printf("Unknown protocol device\n"); + printf("%s%d: Unknown protocol device %d\n", + periph->periph_name, periph->unit_number, + path->device->protocol); if (path->device->serial_num_len > 0) { /* Don't wrap the screen - print only the first 60 chars */ printf("%s%d: Serial Number %.60s\n", periph->periph_name, periph->unit_number, path->device->serial_num); } /* Announce transport details. */ - (*(path->bus->xport->ops->announce))(periph); + path->bus->xport->ops->announce(periph); /* Announce command queueing. */ if (path->device->inq_flags & SID_CmdQue || path->device->flags & CAM_DEV_TAG_AFTER_COUNT) { @@ -1070,6 +1079,7 @@ void xpt_denounce_periph(struct cam_periph *periph) { struct cam_path *path = periph->path; + struct xpt_proto *proto; cam_periph_assert(periph, MA_OWNED); printf("%s%d at %s%d bus %d scbus%d target %d lun %jx\n", @@ -1081,18 +1091,13 @@ xpt_denounce_periph(struct cam_periph *periph) path->target->target_id, (uintmax_t)path->device->lun_id); printf("%s%d: ", periph->periph_name, periph->unit_number); - if (path->device->protocol == PROTO_SCSI) - scsi_print_inquiry_short(&path->device->inq_data); - else if (path->device->protocol == PROTO_ATA || - path->device->protocol == PROTO_SATAPM) - ata_print_ident_short(&path->device->ident_data); - else if (path->device->protocol == PROTO_SEMB) - semb_print_ident_short( - (struct sep_identify_data *)&path->device->ident_data); - else if (path->device->protocol == PROTO_NVME) - nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); + proto = xpt_proto_find(path->device->protocol); + if (proto) + proto->ops->denounce(path->device); else - printf("Unknown protocol device"); + printf("%s%d: Unknown protocol device %d\n", + periph->periph_name, periph->unit_number, + path->device->protocol); if (path->device->serial_num_len > 0) printf(" s/n %.60s", path->device->serial_num); printf(" detached\n"); @@ -3257,7 +3262,6 @@ restart: static void xpt_run_devq(struct cam_devq *devq) { - char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; struct mtx *mtx; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_devq\n")); @@ -3269,6 +3273,7 @@ xpt_run_devq(struct cam_devq *devq) struct cam_ed *device; union ccb *work_ccb; struct cam_sim *sim; + struct xpt_proto *proto; device = (struct cam_ed *)camq_remove(&devq->send_queue, CAMQ_HEAD); @@ -3334,32 +3339,12 @@ xpt_run_devq(struct cam_devq *devq) work_ccb->ccb_h.flags &= ~CAM_TAG_ACTION_VALID; } - switch (work_ccb->ccb_h.func_code) { - case XPT_SCSI_IO: - CAM_DEBUG(work_ccb->ccb_h.path, - CAM_DEBUG_CDB,("%s. CDB: %s\n", - scsi_op_desc(work_ccb->csio.cdb_io.cdb_bytes[0], - &device->inq_data), - scsi_cdb_string(work_ccb->csio.cdb_io.cdb_bytes, - cdb_str, sizeof(cdb_str)))); - break; - case XPT_ATA_IO: - CAM_DEBUG(work_ccb->ccb_h.path, - CAM_DEBUG_CDB,("%s. ACB: %s\n", - ata_op_string(&work_ccb->ataio.cmd), - ata_cmd_string(&work_ccb->ataio.cmd, - cdb_str, sizeof(cdb_str)))); - break; - case XPT_NVME_IO: - CAM_DEBUG(work_ccb->ccb_h.path, - CAM_DEBUG_CDB,("%s. NCB: %s\n", - nvme_op_string(&work_ccb->nvmeio.cmd), - nvme_cmd_string(&work_ccb->nvmeio.cmd, - cdb_str, sizeof(cdb_str)))); - break; - default: - break; - } + KASSERT(device == work_ccb->ccb_h.path->device, + ("device (%p) / path->device (%p) mismatch", + device, work_ccb->ccb_h.path->device)); + proto = xpt_proto_find(device->protocol); + if (proto && proto->ops->debug_out) + proto->ops->debug_out(work_ccb); /* * Device queues can be shared among multiple SIM instances Modified: stable/11/sys/cam/cam_xpt_internal.h ============================================================================== --- stable/11/sys/cam/cam_xpt_internal.h Fri Feb 2 23:19:20 2018 (r328819) +++ stable/11/sys/cam/cam_xpt_internal.h Fri Feb 2 23:22:58 2018 (r328820) @@ -66,6 +66,26 @@ SET_DECLARE(cam_xpt_xport_set, struct xpt_xport); #define CAM_XPT_XPORT(data) \ DATA_SET(cam_xpt_xport_set, data) +typedef void (*xpt_proto_announce_func)(struct cam_ed *); +typedef void (*xpt_proto_debug_out_func)(union ccb *); + +struct xpt_proto_ops { + xpt_proto_announce_func announce; + xpt_proto_announce_func denounce; + xpt_proto_debug_out_func debug_out; +}; + +struct xpt_proto { + cam_proto proto; + const char *name; + struct xpt_proto_ops *ops; +}; + +SET_DECLARE(cam_xpt_proto_set, struct xpt_proto); +#define CAM_XPT_PROTO(data) \ + DATA_SET(cam_xpt_proto_set, data) + + /* * The CAM EDT (Existing Device Table) contains the device information for * all devices for all busses in the system. The table contains a Modified: stable/11/sys/cam/nvme/nvme_xpt.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_xpt.c Fri Feb 2 23:19:20 2018 (r328819) +++ stable/11/sys/cam/nvme/nvme_xpt.c Fri Feb 2 23:22:58 2018 (r328820) @@ -152,6 +152,9 @@ static void nvme_dev_async(u_int32_t async_code, void *async_arg); static void nvme_action(union ccb *start_ccb); static void nvme_announce_periph(struct cam_periph *periph); +static void nvme_proto_announce(struct cam_ed *device); +static void nvme_proto_denounce(struct cam_ed *device); +static void nvme_proto_debug_out(union ccb *ccb); static struct xpt_xport_ops nvme_xport_ops = { .alloc_device = nvme_alloc_device, @@ -171,6 +174,18 @@ NVME_XPT_XPORT(nvme, NVME); #undef NVME_XPT_XPORT +static struct xpt_proto_ops nvme_proto_ops = { + .announce = nvme_proto_announce, + .denounce = nvme_proto_denounce, + .debug_out = nvme_proto_debug_out, +}; +static struct xpt_proto nvme_proto = { + .proto = PROTO_NVME, + .name = "nvme", + .ops = &nvme_proto_ops, +}; +CAM_XPT_PROTO(nvme_proto); + static void nvme_probe_periph_init() { @@ -620,3 +635,29 @@ nvme_announce_periph(struct cam_periph *periph) /* XXX NVME STUFF HERE */ printf("\n"); } + +static void +nvme_proto_announce(struct cam_ed *device) +{ + nvme_print_ident(device->nvme_cdata, device->nvme_data); +} + +static void +nvme_proto_denounce(struct cam_ed *device) +{ + nvme_print_ident(device->nvme_cdata, device->nvme_data); +} + +static void +nvme_proto_debug_out(union ccb *ccb) +{ + char cdb_str[(sizeof(struct nvme_command) * 3) + 1]; + + if (ccb->ccb_h.func_code != XPT_NVME_IO) + return; + + CAM_DEBUG(ccb->ccb_h.path, + CAM_DEBUG_CDB,("%s. NCB: %s\n", nvme_op_string(&ccb->nvmeio.cmd), + nvme_cmd_string(&ccb->nvmeio.cmd, cdb_str, sizeof(cdb_str)))); +} + Modified: stable/11/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_xpt.c Fri Feb 2 23:19:20 2018 (r328819) +++ stable/11/sys/cam/scsi/scsi_xpt.c Fri Feb 2 23:22:58 2018 (r328820) @@ -589,6 +589,9 @@ static void scsi_dev_async(u_int32_t async_code, void *async_arg); static void scsi_action(union ccb *start_ccb); static void scsi_announce_periph(struct cam_periph *periph); +static void scsi_proto_announce(struct cam_ed *device); +static void scsi_proto_denounce(struct cam_ed *device); +static void scsi_proto_debug_out(union ccb *ccb); static struct xpt_xport_ops scsi_xport_ops = { .alloc_device = scsi_alloc_device, @@ -614,6 +617,18 @@ SCSI_XPT_XPORT(ppb, PPB); #undef SCSI_XPORT_XPORT +static struct xpt_proto_ops scsi_proto_ops = { + .announce = scsi_proto_announce, + .denounce = scsi_proto_denounce, + .debug_out = scsi_proto_debug_out, +}; +static struct xpt_proto scsi_proto = { + .proto = PROTO_SCSI, + .name = "scsi", + .ops = &scsi_proto_ops, +}; +CAM_XPT_PROTO(scsi_proto); + static void probe_periph_init() { @@ -3102,3 +3117,30 @@ scsi_announce_periph(struct cam_periph *periph) printf("\n"); } +static void +scsi_proto_announce(struct cam_ed *device) +{ + scsi_print_inquiry(&device->inq_data); +} + +static void +scsi_proto_denounce(struct cam_ed *device) +{ + scsi_print_inquiry_short(&device->inq_data); +} + +static void +scsi_proto_debug_out(union ccb *ccb) +{ + char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; + struct cam_ed *device; + + if (ccb->ccb_h.func_code != XPT_SCSI_IO) + return; + + device = ccb->ccb_h.path->device; + CAM_DEBUG(ccb->ccb_h.path, + CAM_DEBUG_CDB,("%s. CDB: %s\n", + scsi_op_desc(ccb->csio.cdb_io.cdb_bytes[0], &device->inq_data), + scsi_cdb_string(ccb->csio.cdb_io.cdb_bytes, cdb_str, sizeof(cdb_str)))); +} From owner-svn-src-all@freebsd.org Fri Feb 2 23:26:53 2018 Return-Path: Delivered-To: svn-src-all@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 153A2ED2A4C; Fri, 2 Feb 2018 23:26:53 +0000 (UTC) (envelope-from mckusick@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 BFB8086905; Fri, 2 Feb 2018 23:26:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9F49225C3; Fri, 2 Feb 2018 23:26:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w12NQqIa074920; Fri, 2 Feb 2018 23:26:52 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12NQqwB074919; Fri, 2 Feb 2018 23:26:52 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802022326.w12NQqwB074919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 2 Feb 2018 23:26:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328821 - head/sbin/newfs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/newfs X-SVN-Commit-Revision: 328821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 23:26:53 -0000 Author: mckusick Date: Fri Feb 2 23:26:52 2018 New Revision: 328821 URL: https://svnweb.freebsd.org/changeset/base/328821 Log: Check and report error returns from sbput(3) calls. Convert to using cgput(3) for writing cylinder groups. Check and report error returns from cgput(3). Submitted by: Bruce Evans Modified: head/sbin/newfs/mkfs.c Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Fri Feb 2 23:22:58 2018 (r328820) +++ head/sbin/newfs/mkfs.c Fri Feb 2 23:26:52 2018 (r328821) @@ -101,7 +101,6 @@ static void iput(union dinode *, ino_t); static int makedir(struct direct *, int); static void setblock(struct fs *, unsigned char *, int); static void wtfs(ufs2_daddr_t, int, char *); -static void cgckhash(struct cg *); static u_int32_t newfs_random(void); void @@ -520,24 +519,27 @@ restart: * Wipe out old UFS1 superblock(s) if necessary. */ if (!Nflag && Oflag != 1 && realsectorsize <= SBLOCK_UFS1) { - i = bread(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); + i = bread(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, + SBLOCKSIZE); if (i == -1) - err(1, "can't read old UFS1 superblock: %s", disk.d_error); + err(1, "can't read old UFS1 superblock: %s", + disk.d_error); if (fsdummy.fs_magic == FS_UFS1_MAGIC) { fsdummy.fs_magic = 0; bwrite(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); for (cg = 0; cg < fsdummy.fs_ncg; cg++) { - if (fsbtodb(&fsdummy, cgsblock(&fsdummy, cg)) > fssize) + if (fsbtodb(&fsdummy, cgsblock(&fsdummy, cg)) > + fssize) break; bwrite(&disk, part_ofs + fsbtodb(&fsdummy, cgsblock(&fsdummy, cg)), chdummy, SBLOCKSIZE); } } } - if (!Nflag) - sbput(disk.d_fd, &disk.d_fs, 0); + if (!Nflag && sbput(disk.d_fd, &disk.d_fs, 0) != 0) + err(1, "sbput: %s", disk.d_error); if (Xflag == 1) { printf("** Exiting on Xflag 1\n"); exit(0); @@ -555,10 +557,9 @@ restart: i = 0; width = charsperline(); /* - * Allocate space for cylinder group map and - * two sets of inode blocks. + * Allocate space for two sets of inode blocks. */ - iobufsize = 3 * sblock.fs_bsize; + iobufsize = 2 * sblock.fs_bsize; if ((iobuf = calloc(1, iobufsize)) == 0) { printf("Cannot allocate I/O buffer\n"); exit(38); @@ -604,7 +605,8 @@ restart: * Reference the summary information so it will also be written. */ sblock.fs_csp = fscs; - sbput(disk.d_fd, &disk.d_fs, 0); + if (sbput(disk.d_fd, &disk.d_fs, 0) != 0) + err(1, "sbput: %s", disk.d_error); /* * For UFS1 filesystems with a blocksize of 64K, the first * alternate superblock resides at the location used for @@ -788,7 +790,6 @@ initcg(int cylno, time_t utime) } } *cs = acg.cg_cs; - cgckhash(&acg); /* * Write out the duplicate super block. Then write the cylinder * group map and two blocks worth of inodes in a single write. @@ -796,11 +797,12 @@ initcg(int cylno, time_t utime) savedactualloc = sblock.fs_sblockactualloc; sblock.fs_sblockactualloc = dbtob(fsbtodb(&sblock, cgsblock(&sblock, cylno))); - sbput(disk.d_fd, &disk.d_fs, 0); + if (sbput(disk.d_fd, &disk.d_fs, 0) != 0) + err(1, "sbput: %s", disk.d_error); sblock.fs_sblockactualloc = savedactualloc; + if (cgput(&disk, &acg) != 0) + err(1, "initcg: cgput: %s", disk.d_error); start = 0; - bcopy((char *)&acg, &iobuf[start], sblock.fs_cgsize); - start += sblock.fs_bsize; dp1 = (struct ufs1_dinode *)(&iobuf[start]); dp2 = (struct ufs2_dinode *)(&iobuf[start]); for (i = 0; i < acg.cg_initediblk; i++) { @@ -812,7 +814,7 @@ initcg(int cylno, time_t utime) dp2++; } } - wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), iobufsize, iobuf); + wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno)), iobufsize, iobuf); /* * For the old file system, we have to initialize all the inodes. */ @@ -1008,10 +1010,8 @@ goth: for (i = frag; i < sblock.fs_frag; i++) setbit(cg_blksfree(&acg), d + i); } - /* XXX cgwrite(&disk, 0)??? */ - cgckhash(&acg); - wtfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, - (char *)&acg); + if (cgput(&disk, &acg) != 0) + err(1, "alloc: cgput: %s", disk.d_error); return ((ufs2_daddr_t)d); } @@ -1031,9 +1031,8 @@ iput(union dinode *ip, ino_t ino) } acg.cg_cs.cs_nifree--; setbit(cg_inosused(&acg), ino); - cgckhash(&acg); - wtfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, - (char *)&acg); + if (cgput(&disk, &acg) != 0) + err(1, "iput: cgput: %s", disk.d_error); sblock.fs_cstotal.cs_nifree--; fscs[0].cs_nifree--; if (ino >= (unsigned long)sblock.fs_ipg * sblock.fs_ncg) { @@ -1062,20 +1061,6 @@ wtfs(ufs2_daddr_t bno, int size, char *bf) return; if (bwrite(&disk, part_ofs + bno, bf, size) < 0) err(36, "wtfs: %d bytes at sector %jd", size, (intmax_t)bno); -} - -/* - * Calculate the check-hash of the cylinder group. - */ -static void -cgckhash(cgp) - struct cg *cgp; -{ - - if ((sblock.fs_metackhash & CK_CYLGRP) == 0) - return; - cgp->cg_ckhash = 0; - cgp->cg_ckhash = calculate_crc32c(~0L, (void *)cgp, sblock.fs_cgsize); } /* From owner-svn-src-all@freebsd.org Fri Feb 2 23:34:34 2018 Return-Path: Delivered-To: svn-src-all@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 F0E2DED31F5; Fri, 2 Feb 2018 23:34:33 +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 A722486FBF; Fri, 2 Feb 2018 23:34:33 +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 9DE592276B; Fri, 2 Feb 2018 23:34:33 +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 w12NYXuv080175; Fri, 2 Feb 2018 23:34:33 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w12NYXSd080174; Fri, 2 Feb 2018 23:34:33 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802022334.w12NYXSd080174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 2 Feb 2018 23:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328822 - head/usr.sbin/makefs/tests X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/usr.sbin/makefs/tests X-SVN-Commit-Revision: 328822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 23:34:34 -0000 Author: brooks Date: Fri Feb 2 23:34:33 2018 New Revision: 328822 URL: https://svnweb.freebsd.org/changeset/base/328822 Log: Check for cd9660 support before attempting to mount created images This extends the set in r316028 to allow all tests to pass or be skipped on a system without cd9660 support. A better approach using tar is possible, but this works today. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10516 Modified: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Modified: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh ============================================================================== --- head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Fri Feb 2 23:26:52 2018 (r328821) +++ head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Fri Feb 2 23:34:33 2018 (r328822) @@ -96,8 +96,6 @@ D_flag_cleanup() atf_test_case F_flag cleanup F_flag_body() { - check_cd9660_support - create_test_inputs atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ @@ -106,6 +104,7 @@ F_flag_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -117,8 +116,6 @@ F_flag_cleanup() atf_test_case from_mtree_spec_file cleanup from_mtree_spec_file_body() { - check_cd9660_support - create_test_inputs atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ @@ -128,6 +125,7 @@ from_mtree_spec_file_body() $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE cd - + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -139,8 +137,6 @@ from_mtree_spec_file_cleanup() atf_test_case from_multiple_dirs cleanup from_multiple_dirs_body() { - check_cd9660_support - test_inputs_dir2=$TMPDIR/inputs2 create_test_inputs @@ -152,6 +148,7 @@ from_multiple_dirs_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2 + check_cd9660_support mount_image check_base_iso9660_image_contents -d $test_inputs_dir2 } @@ -163,13 +160,12 @@ from_multiple_dirs_cleanup() atf_test_case from_single_dir cleanup from_single_dir_body() { - check_cd9660_support - create_test_inputs atf_check -e empty -o empty -s exit:0 \ $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -190,6 +186,7 @@ o_flag_allow_deep_trees_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o allow-deep-trees $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -213,6 +210,7 @@ o_flag_allow_max_name_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o allow-max-name $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -231,6 +229,7 @@ o_flag_isolevel_1_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o isolevel=1 $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -247,6 +246,7 @@ o_flag_isolevel_2_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o isolevel=2 $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -267,6 +267,8 @@ o_flag_isolevel_3_body() else atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR + + check_cd9660_support mount_image check_base_iso9660_image_contents fi @@ -334,6 +336,7 @@ o_flag_rockridge_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_image_contents -X .rr_moved @@ -365,6 +368,7 @@ o_flag_rockridge_dev_nodes_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_image_contents } From owner-svn-src-all@freebsd.org Sat Feb 3 00:59:09 2018 Return-Path: Delivered-To: svn-src-all@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 662ABED89B5; Sat, 3 Feb 2018 00:59:09 +0000 (UTC) (envelope-from adrian@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 191296974B; Sat, 3 Feb 2018 00:59:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FAA92341B; Sat, 3 Feb 2018 00:59:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w130x8r7020387; Sat, 3 Feb 2018 00:59:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w130x8eD020385; Sat, 3 Feb 2018 00:59:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201802030059.w130x8eD020385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Feb 2018 00:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328823 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/etherswitch/arswitch X-SVN-Commit-Revision: 328823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 00:59:09 -0000 Author: adrian Date: Sat Feb 3 00:59:08 2018 New Revision: 328823 URL: https://svnweb.freebsd.org/changeset/base/328823 Log: [arswitch] add initial functionality for AR8327 ATU management. * Add the bulk of the ATU table read function * Correct how the ATU function and WAIT bits work TODO: * more testing, figure out how the multi-vlan table stuff works and push that up to userspace Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c head/sys/dev/etherswitch/arswitch/arswitchreg.h Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8327.c Fri Feb 2 23:34:33 2018 (r328822) +++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c Sat Feb 3 00:59:08 2018 (r328823) @@ -1100,16 +1100,78 @@ ar8327_atu_flush_port(struct arswitch_softc *sc, int p return (ret); } +/* + * Fetch a single entry from the ATU. + */ static int ar8327_atu_fetch_table(struct arswitch_softc *sc, etherswitch_atu_entry_t *e, int atu_fetch_op) { + uint32_t ret0, ret1, ret2, val; - /* XXX TODO */ - return (ENXIO); -} + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + switch (atu_fetch_op) { + case 0: + /* Initialise things for the first fetch */ + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: initializing\n", __func__); + (void) ar8327_atu_wait_ready(sc); + + arswitch_writereg(sc->sc_dev, + AR8327_REG_ATU_FUNC, AR8327_ATU_FUNC_OP_GET_NEXT); + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_DATA0, 0); + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_DATA1, 0); + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_DATA2, 0); + + return (0); + case 1: + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: reading next\n", __func__); + /* + * Attempt to read the next address entry; don't modify what + * is there in these registers as its used for the next fetch + */ + (void) ar8327_atu_wait_ready(sc); + + /* Begin the next read event; not modifying anything */ + val = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_FUNC); + val |= AR8327_ATU_FUNC_BUSY; + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_FUNC, val); + + /* Wait for it to complete */ + (void) ar8327_atu_wait_ready(sc); + + /* Fetch the ethernet address and ATU status */ + ret0 = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_DATA0); + ret1 = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_DATA1); + ret2 = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_DATA2); + + /* If the status is zero, then we're done */ + if (MS(ret2, AR8327_ATU_FUNC_DATA2_STATUS) == 0) + return (-1); + + /* MAC address */ + e->es_macaddr[5] = MS(ret1, AR8327_ATU_DATA1_MAC_ADDR5); + e->es_macaddr[4] = MS(ret1, AR8327_ATU_DATA1_MAC_ADDR4); + e->es_macaddr[3] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR3); + e->es_macaddr[2] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR2); + e->es_macaddr[1] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR1); + e->es_macaddr[0] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR0); + + /* Bitmask of ports this entry is for */ + e->es_portmask = MS(ret1, AR8327_ATU_DATA1_DEST_PORT); + + /* TODO: other flags that are interesting */ + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: MAC %6D portmask 0x%08x\n", + __func__, + e->es_macaddr, ":", e->es_portmask); + return (0); + default: + return (-1); + } + return (-1); +} static int ar8327_flush_dot1q_vlan(struct arswitch_softc *sc) { Modified: head/sys/dev/etherswitch/arswitch/arswitchreg.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchreg.h Fri Feb 2 23:34:33 2018 (r328822) +++ head/sys/dev/etherswitch/arswitch/arswitchreg.h Sat Feb 3 00:59:08 2018 (r328823) @@ -485,11 +485,42 @@ #define AR8327_PORT_VLAN1_OUT_MODE_UNTOUCH 3 #define AR8327_REG_ATU_DATA0 0x600 +#define AR8327_ATU_DATA0_MAC_ADDR3 BITS(0, 8) +#define AR8327_ATU_DATA0_MAC_ADDR3_S 0 +#define AR8327_ATU_DATA0_MAC_ADDR2 BITS(8, 8) +#define AR8327_ATU_DATA0_MAC_ADDR2_S 8 +#define AR8327_ATU_DATA0_MAC_ADDR1 BITS(16, 8) +#define AR8327_ATU_DATA0_MAC_ADDR1_S 16 +#define AR8327_ATU_DATA0_MAC_ADDR0 BITS(24, 8) +#define AR8327_ATU_DATA0_MAC_ADDR0_S 24 + #define AR8327_REG_ATU_DATA1 0x604 +#define AR8327_ATU_DATA1_MAC_ADDR4 BITS(0, 8) +#define AR8327_ATU_DATA1_MAC_ADDR4_S 0 +#define AR8327_ATU_DATA1_MAC_ADDR5 BITS(8, 8) +#define AR8327_ATU_DATA1_MAC_ADDR5_S 0 +#define AR8327_ATU_DATA1_DEST_PORT BITS(16, 7) +#define AR8327_ATU_DATA1_DEST_PORT_S 16 +#define AR8327_ATU_DATA1_CROSS_PORT_STATE_EN BIT(23) +#define AR8327_ATU_DATA1_PRI BITS(24, 3) +#define AR8327_ATU_DATA1_SVL_ENTRY BIT(27) +#define AR8327_ATU_DATA1_PRI_OVER_EN BIT(28) +#define AR8327_ATU_DATA1_MIRROR_EN BIT(29) +#define AR8327_ATU_DATA1_SA_DROP_EN BIT(30) +#define AR8327_ATU_DATA1_HASH_HIGH_ADDR BIT(31) + #define AR8327_REG_ATU_DATA2 0x608 +#define AR8327_ATU_FUNC_DATA2_STATUS BITS(0, 4) +#define AR8327_ATU_FUNC_DATA2_STATUS_S 0 +#define AR8327_ATU_FUNC_DATA2_VLAN_LEAKY_EN BIT(4) +#define AR8327_ATU_FUNC_DATA2_REDIRECT_TO_CPU BIT(5) +#define AR8327_ATU_FUNC_DATA2_COPY_TO_CPU BIT(6) +#define AR8327_ATU_FUNC_DATA2_SHORT_LOOP BIT(7) +#define AR8327_ATU_FUNC_DATA2_ATU_VID BITS(8, 12) +#define AR8327_ATU_FUNC_DATA2_ATU_VID_S 8 #define AR8327_REG_ATU_FUNC 0x60c -#define AR8327_ATU_FUNC_OP BITS(0, 3) +#define AR8327_ATU_FUNC_OP BITS(0, 4) #define AR8327_ATU_FUNC_OP_NOOP 0x0 #define AR8327_ATU_FUNC_OP_FLUSH 0x1 #define AR8327_ATU_FUNC_OP_LOAD 0x2 @@ -499,9 +530,19 @@ #define AR8327_ATU_FUNC_OP_GET_NEXT 0x6 #define AR8327_ATU_FUNC_OP_SEARCH_MAC 0x7 #define AR8327_ATU_FUNC_OP_CHANGE_TRUNK 0x8 -#define AR8327_ATU_FUNC_BUSY BIT(3) +#define AR8327_ATU_FUNC_FLUSH_STATIC_EN BIT(4) +#define AR8327_ATU_FUNC_ENTRY_TYPE BIT(5) #define AR8327_ATU_FUNC_PORT_NUM BITS(8, 4) #define AR8327_ATU_FUNC_PORT_NUM_S 8 +#define AR8327_ATU_FUNC_FULL_VIOLATION BIT(12) +#define AR8327_ATU_FUNC_MULTI_EN BIT(13) /* for GET_NEXT */ +#define AR8327_ATU_FUNC_PORT_EN BIT(14) /* for GET_NEXT */ +#define AR8327_ATU_FUNC_VID_EN BIT(15) /* for GET_NEXT */ +#define AR8327_ATU_FUNC_ATU_INDEX BITS(16, 5) +#define AR8327_ATU_FUNC_ATU_INDEX_S 16 +#define AR8327_ATU_FUNC_TRUNK_PORT_NUM BITS(22, 3) /* for CHANGE_TRUNK */ +#define AR8327_ATU_FUNC_TRUNK_PORT_NUM_S 22 +#define AR8327_ATU_FUNC_BUSY BIT(31) #define AR8327_REG_VTU_FUNC0 0x0610 #define AR8327_VTU_FUNC0_EG_MODE BITS(4, 14) From owner-svn-src-all@freebsd.org Sat Feb 3 01:20:02 2018 Return-Path: Delivered-To: svn-src-all@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 63E4EEDA780; Sat, 3 Feb 2018 01:20:02 +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 156816A75B; Sat, 3 Feb 2018 01:20:02 +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 10482237BD; Sat, 3 Feb 2018 01:20:02 +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 w131K1NA030202; Sat, 3 Feb 2018 01:20:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w131K140030201; Sat, 3 Feb 2018 01:20:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802030120.w131K140030201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 3 Feb 2018 01:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328825 - stable/11/usr.bin/dtc X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/dtc X-SVN-Commit-Revision: 328825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 01:20:02 -0000 Author: kevans Date: Sat Feb 3 01:20:01 2018 New Revision: 328825 URL: https://svnweb.freebsd.org/changeset/base/328825 Log: MFC r328641: dtc(1): Revert WARNS change from r328173 WARNS > 3 breaks xtoolchain builds to varying degrees. Revert it. Modified: stable/11/usr.bin/dtc/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/dtc/Makefile ============================================================================== --- stable/11/usr.bin/dtc/Makefile Sat Feb 3 01:18:19 2018 (r328824) +++ stable/11/usr.bin/dtc/Makefile Sat Feb 3 01:20:01 2018 (r328825) @@ -4,6 +4,8 @@ PROG_CXX=dtc SRCS= dtc.cc input_buffer.cc string.cc dtb.cc fdt.cc checking.cc MAN= dtc.1 +WARNS?= 3 + CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions NO_SHARED?=NO From owner-svn-src-all@freebsd.org Sat Feb 3 01:23:49 2018 Return-Path: Delivered-To: svn-src-all@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 9FB25EDAC85; Sat, 3 Feb 2018 01:23:49 +0000 (UTC) (envelope-from emaste@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 4EDCB6AC0A; Sat, 3 Feb 2018 01:23:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49CBD2397D; Sat, 3 Feb 2018 01:23:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w131NniU035214; Sat, 3 Feb 2018 01:23:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w131Nnpm035213; Sat, 3 Feb 2018 01:23:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802030123.w131Nnpm035213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 3 Feb 2018 01:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328826 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 328826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 01:23:49 -0000 Author: emaste Date: Sat Feb 3 01:23:48 2018 New Revision: 328826 URL: https://svnweb.freebsd.org/changeset/base/328826 Log: Make cross-endian loader changes apply only to powerpc The cross-endian loader change in r328536 (review D12422) broke symbol loading on (at least) amd64 kernels. Temporarily paper over the issue by restricting the cross-endian support to only powerpc, until a proper fix arrives. Submitted by: royger Modified: head/stand/common/load_elf.c Modified: head/stand/common/load_elf.c ============================================================================== --- head/stand/common/load_elf.c Sat Feb 3 01:20:01 2018 (r328825) +++ head/stand/common/load_elf.c Sat Feb 3 01:23:48 2018 (r328826) @@ -127,7 +127,10 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) goto error; } +#ifdef __powerpc__ /* + * XXX: should be in a separate helper. + * * Fixup ELF endianness. * * The Xhdr structure was loaded using block read call to @@ -179,6 +182,7 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) ehdr->e_shnum = le16toh(ehdr->e_shnum); ehdr->e_shstrndx = le16toh(ehdr->e_shstrndx); } +#endif if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ err = EFTYPE; @@ -375,15 +379,6 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ u_int fpcopy; Elf_Sym sym; Elf_Addr p_start, p_end; -#if __ELF_WORD_SIZE == 64 - uint64_t scr_ssym; - uint64_t scr_esym; - uint64_t scr; -#else - uint32_t scr_ssym; - uint32_t scr_esym; - uint32_t scr; -#endif dp = NULL; shdr = NULL; @@ -458,7 +453,10 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); for (i = 0; i < ehdr->e_phnum; i++) { +#ifdef __powerpc__ /* + * XXX: should be in a seprate helper. + * * Fixup ELF endianness. * * The Xhdr structure was loaded using block read call to @@ -505,6 +503,7 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ phdr[i].p_align = le32toh(phdr[i].p_align); } } +#endif /* We want to load PT_LOAD segments only.. */ if (phdr[i].p_type != PT_LOAD) @@ -581,7 +580,10 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ goto nosyms; } +#ifdef __powerpc__ /* + * XXX: should be in a seprate helper. + * * Fixup ELF endianness. * * The Xhdr structure was loaded using block read call to @@ -634,6 +636,8 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ } } } +#endif + file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); /* @@ -712,16 +716,15 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ size = shdr[i].sh_size; #if defined(__powerpc__) #if __ELF_WORD_SIZE == 64 - scr = htobe64(size); + size = htobe64(size); #else - scr = htobe32(size); + size = htobe32(size); #endif -#else - scr = size; #endif - archsw.arch_copyin(&scr, lastaddr, sizeof(scr)); - lastaddr += sizeof(scr); + archsw.arch_copyin(&size, lastaddr, sizeof(size)); + lastaddr += sizeof(size); + #ifdef ELF_VERBOSE printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, @@ -762,19 +765,16 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ #if defined(__powerpc__) /* On PowerPC we always need to provide BE data to the kernel */ #if __ELF_WORD_SIZE == 64 - scr_ssym = htobe64((uint64_t)ssym); - scr_esym = htobe64((uint64_t)esym); + ssym = htobe64((uint64_t)ssym); + esym = htobe64((uint64_t)esym); #else - scr_ssym = htobe32((uint32_t)ssym); - scr_esym = htobe32((uint32_t)esym); + ssym = htobe32((uint32_t)ssym); + esym = htobe32((uint32_t)esym); #endif -#else - scr_ssym = ssym; - scr_esym = esym; #endif - file_addmetadata(fp, MODINFOMD_SSYM, sizeof(scr_ssym), &scr_ssym); - file_addmetadata(fp, MODINFOMD_ESYM, sizeof(scr_esym), &scr_esym); + file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); + file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); nosyms: printf("\n"); From owner-svn-src-all@freebsd.org Sat Feb 3 01:18:20 2018 Return-Path: Delivered-To: svn-src-all@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 9B566EDA6BF; Sat, 3 Feb 2018 01:18: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 48E8B6A63B; Sat, 3 Feb 2018 01:18: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 43C34237B1; Sat, 3 Feb 2018 01:18: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 w131IKPM030060; Sat, 3 Feb 2018 01:18:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w131IJXf030056; Sat, 3 Feb 2018 01:18:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802030118.w131IJXf030056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 3 Feb 2018 01:18:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328824 - stable/11/sys/contrib/libfdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/contrib/libfdt X-SVN-Commit-Revision: 328824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 01:18:20 -0000 Author: kevans Date: Sat Feb 3 01:18:19 2018 New Revision: 328824 URL: https://svnweb.freebsd.org/changeset/base/328824 Log: MFC r328491: MFV r328490: Update libfdt to github:f1879e1 Pulls in a patch, now upstreamed, from nwhitehorn to add limited read-only support for older (v2 and v3) FDT blobs. Modified: stable/11/sys/contrib/libfdt/fdt.c stable/11/sys/contrib/libfdt/fdt_overlay.c stable/11/sys/contrib/libfdt/fdt_ro.c stable/11/sys/contrib/libfdt/libfdt.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/contrib/libfdt/fdt.c ============================================================================== --- stable/11/sys/contrib/libfdt/fdt.c Sat Feb 3 00:59:08 2018 (r328823) +++ stable/11/sys/contrib/libfdt/fdt.c Sat Feb 3 01:18:19 2018 (r328824) @@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset /* skip-name offset, length and value */ offset += sizeof(struct fdt_property) - FDT_TAGSIZE + fdt32_to_cpu(*lenp); + if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 && + ((offset - fdt32_to_cpu(*lenp)) % 8) != 0) + offset += 4; break; case FDT_END: Modified: stable/11/sys/contrib/libfdt/fdt_overlay.c ============================================================================== --- stable/11/sys/contrib/libfdt/fdt_overlay.c Sat Feb 3 00:59:08 2018 (r328823) +++ stable/11/sys/contrib/libfdt/fdt_overlay.c Sat Feb 3 01:18:19 2018 (r328824) @@ -1,3 +1,54 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2016 Free Electrons + * Copyright (C) 2016 NextThing Co. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "libfdt_env.h" #include Modified: stable/11/sys/contrib/libfdt/fdt_ro.c ============================================================================== --- stable/11/sys/contrib/libfdt/fdt_ro.c Sat Feb 3 00:59:08 2018 (r328823) +++ stable/11/sys/contrib/libfdt/fdt_ro.c Sat Feb 3 01:18:19 2018 (r328824) @@ -58,9 +58,10 @@ static int fdt_nodename_eq_(const void *fdt, int offset, const char *s, int len) { - const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); + int olen; + const char *p = fdt_get_name(fdt, offset, &olen); - if (!p) + if (!p || olen < len) /* short match */ return 0; @@ -233,16 +234,34 @@ int fdt_path_offset(const void *fdt, const char *path) const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) { const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset); + const char *nameptr; int err; if (((err = fdt_check_header(fdt)) != 0) || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)) goto fail; + nameptr = nh->name; + + if (fdt_version(fdt) < 0x10) { + /* + * For old FDT versions, match the naming conventions of V16: + * give only the leaf name (after all /). The actual tree + * contents are loosely checked. + */ + const char *leaf; + leaf = strrchr(nameptr, '/'); + if (leaf == NULL) { + err = -FDT_ERR_BADSTRUCTURE; + goto fail; + } + nameptr = leaf+1; + } + if (len) - *len = strlen(nh->name); + *len = strlen(nameptr); - return nh->name; + return nameptr; fail: if (len) @@ -268,9 +287,9 @@ int fdt_next_property_offset(const void *fdt, int offs return nextprop_(fdt, offset); } -const struct fdt_property *fdt_get_property_by_offset(const void *fdt, - int offset, - int *lenp) +static const struct fdt_property *fdt_get_property_by_offset_(const void *fdt, + int offset, + int *lenp) { int err; const struct fdt_property *prop; @@ -289,23 +308,44 @@ const struct fdt_property *fdt_get_property_by_offset( return prop; } -const struct fdt_property *fdt_get_property_namelen(const void *fdt, - int offset, - const char *name, - int namelen, int *lenp) +const struct fdt_property *fdt_get_property_by_offset(const void *fdt, + int offset, + int *lenp) { + /* Prior to version 16, properties may need realignment + * and this API does not work. fdt_getprop_*() will, however. */ + + if (fdt_version(fdt) < 0x10) { + if (lenp) + *lenp = -FDT_ERR_BADVERSION; + return NULL; + } + + return fdt_get_property_by_offset_(fdt, offset, lenp); +} + +static const struct fdt_property *fdt_get_property_namelen_(const void *fdt, + int offset, + const char *name, + int namelen, + int *lenp, + int *poffset) +{ for (offset = fdt_first_property_offset(fdt, offset); (offset >= 0); (offset = fdt_next_property_offset(fdt, offset))) { const struct fdt_property *prop; - if (!(prop = fdt_get_property_by_offset(fdt, offset, lenp))) { + if (!(prop = fdt_get_property_by_offset_(fdt, offset, lenp))) { offset = -FDT_ERR_INTERNAL; break; } if (fdt_string_eq_(fdt, fdt32_to_cpu(prop->nameoff), - name, namelen)) + name, namelen)) { + if (poffset) + *poffset = offset; return prop; + } } if (lenp) @@ -313,6 +353,25 @@ const struct fdt_property *fdt_get_property_namelen(co return NULL; } + +const struct fdt_property *fdt_get_property_namelen(const void *fdt, + int offset, + const char *name, + int namelen, int *lenp) +{ + /* Prior to version 16, properties may need realignment + * and this API does not work. fdt_getprop_*() will, however. */ + if (fdt_version(fdt) < 0x10) { + if (lenp) + *lenp = -FDT_ERR_BADVERSION; + return NULL; + } + + return fdt_get_property_namelen_(fdt, offset, name, namelen, lenp, + NULL); +} + + const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, const char *name, int *lenp) @@ -324,12 +383,18 @@ const struct fdt_property *fdt_get_property(const void const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp) { + int poffset; const struct fdt_property *prop; - prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp); + prop = fdt_get_property_namelen_(fdt, nodeoffset, name, namelen, lenp, + &poffset); if (!prop) return NULL; + /* Handle realignment */ + if (fdt_version(fdt) < 0x10 && (poffset + sizeof(*prop)) % 8 && + fdt32_to_cpu(prop->len) >= 8) + return prop->data + 4; return prop->data; } @@ -338,11 +403,16 @@ const void *fdt_getprop_by_offset(const void *fdt, int { const struct fdt_property *prop; - prop = fdt_get_property_by_offset(fdt, offset, lenp); + prop = fdt_get_property_by_offset_(fdt, offset, lenp); if (!prop) return NULL; if (namep) *namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); + + /* Handle realignment */ + if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 && + fdt32_to_cpu(prop->len) >= 8) + return prop->data + 4; return prop->data; } Modified: stable/11/sys/contrib/libfdt/libfdt.h ============================================================================== --- stable/11/sys/contrib/libfdt/libfdt.h Sat Feb 3 00:59:08 2018 (r328823) +++ stable/11/sys/contrib/libfdt/libfdt.h Sat Feb 3 01:18:19 2018 (r328824) @@ -54,7 +54,7 @@ #include #include -#define FDT_FIRST_SUPPORTED_VERSION 0x10 +#define FDT_FIRST_SUPPORTED_VERSION 0x02 #define FDT_LAST_SUPPORTED_VERSION 0x11 /* Error codes: informative error codes */ @@ -526,6 +526,9 @@ int fdt_next_property_offset(const void *fdt, int offs * fdt_property structure within the device tree blob at the given * offset. If lenp is non-NULL, the length of the property value is * also returned, in the integer pointed to by lenp. + * + * Note that this code only works on device tree versions >= 16. fdt_getprop() + * works on all versions. * * returns: * pointer to the structure representing the property From owner-svn-src-all@freebsd.org Sat Feb 3 01:30:45 2018 Return-Path: Delivered-To: svn-src-all@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 651C8EDB4D6; Sat, 3 Feb 2018 01:30:45 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (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 F39BA6B053; Sat, 3 Feb 2018 01:30:44 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22b.google.com with SMTP id x128so10719396ite.0; Fri, 02 Feb 2018 17:30:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=L7uaPzhcLgGTOm0m/7YEU2WIU7JD1Ru0VcZF4m52ONY=; b=qrp8+akNjTcDL2hnR7JyZtqgB2TQDWj+JzvW5tLPSOiyZ2F7NUDg9plqGyk4qfCHye v6z6Inw3nUDsQkszX8uoMEBUo3ZD9z02LriaWI5EmAZhLCEqCoEagXFwFNU/kEUcLwpo pA9GW68ocwNro+oKic8vSEe5pcX/hQjqDqHvudQDn0ItipBggJJ9/oAItP7vLyYv3Tkw VHizM/2aUSh8lYMiQtvDQyQtFWmls8eSRBAekD2Ns6n8Jnl0qEAiLB4ev9Pwc2kkfQU2 WIdsZXqiGwApNjNYJ+gtzpNhD4H68LZi7vV0hHQF0ihScDPakfvgAxRZcZxe0SjFF4nj 9lhw== 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=L7uaPzhcLgGTOm0m/7YEU2WIU7JD1Ru0VcZF4m52ONY=; b=ivfqtU0alcmgE4WhGEbHO8Z5Fi6HvdMXd/kOw4alWltghmftjQn0FPgNH44jtOmLE8 y16CJCSQehVgojU56vvXlmVMJ5G/O6mQ0CGXHY3wySX62BIk4wN0+aOBMM2GL+OFjuJF OedO94iY3bneHyqr+QQwb4Ye9LtFmNhIo8e8jJ+VCecLkrjMpGn++6OaQwSvNpbphZkK pr0BX/dH2eDzqk/Npllm6l1/NKMJtUdJVvrrJYdFu38nYbKMfz7BrBRBbHObYBVIwu9p ChlXsdo7uyFd0QYqv4hOxy4BxZu7SIYC4ZhOdT4+VWMPV1STp84LEJtvWcwH4d5RBwYH +3ww== X-Gm-Message-State: AKwxytfRczTiwqathApa7pzurr0X9Ntnm13qvrMk10xsIv9EMPQw2SPV Ys/3sUIvfdk/WdKXIPx8W69kweE/i4JK5tPp0MgFhtzV X-Google-Smtp-Source: AH8x225G5um1QYIEABQ7w7A/uI6jSZNLP6HW8WUWZIz/b5rrOkQwZQEEvkqSy4m6PxaCX+EWAzCzY99mpu+Da01znVg= X-Received: by 10.36.17.208 with SMTP id 199mr12680196itf.103.1517621444354; Fri, 02 Feb 2018 17:30:44 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.152.9 with HTTP; Fri, 2 Feb 2018 17:30:23 -0800 (PST) In-Reply-To: <201801290924.w0T9OSix008403@repo.freebsd.org> References: <201801290924.w0T9OSix008403@repo.freebsd.org> From: Ed Maste Date: Fri, 2 Feb 2018 20:30:23 -0500 X-Google-Sender-Auth: MsrEUhW8QyLAFuTG1uJgVV3gUDs Message-ID: Subject: Re: svn commit: r328536 - in head/stand: common powerpc/kboot To: Wojciech Macek Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 01:30:45 -0000 On 29 January 2018 at 04:24, Wojciech Macek wrote: > Author: wma > Date: Mon Jan 29 09:24:28 2018 > New Revision: 328536 > URL: https://svnweb.freebsd.org/changeset/base/328536 > > Log: > loader: support for mixed-endianness ELF/loader and POWER8 In r328536 I've committed royger's band-aid to fix kernel symbol loading, and hope that you can revisit it with a proper fix in short order. From owner-svn-src-all@freebsd.org Sat Feb 3 02:17:30 2018 Return-Path: Delivered-To: svn-src-all@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 B36F8EDE319; Sat, 3 Feb 2018 02:17:29 +0000 (UTC) (envelope-from mm@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 654AC6CD90; Sat, 3 Feb 2018 02:17:29 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FFC924295; Sat, 3 Feb 2018 02:17:29 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w132HTrn059744; Sat, 3 Feb 2018 02:17:29 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w132HQoa059711; Sat, 3 Feb 2018 02:17:26 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201802030217.w132HQoa059711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 3 Feb 2018 02:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328828 - in stable/10: contrib/libarchive/cat contrib/libarchive/cat/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/te... X-SVN-Group: stable-10 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/10: contrib/libarchive/cat contrib/libarchive/cat/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/tests usr.bin/bsdcat/tests X-SVN-Commit-Revision: 328828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 02:17:30 -0000 Author: mm Date: Sat Feb 3 02:17:25 2018 New Revision: 328828 URL: https://svnweb.freebsd.org/changeset/base/328828 Log: MFH r328332: Sync libarchive with vendor. Relevant vendor changes: PR #893: delete dead ppmd7 alloc callbacks PR #904: Fix archive freeing bug in bsdcat PR #961: Fix ZIP format names PR #962: Don't modify attributes for existing directories when ARCHIVE_EXTRACT_NO_OVERWRITE is set PR #964: Fix -Werror=implicit-fallthrough= for GCC 7 PR #970: zip: Allow backslash as path separator Added: stable/10/contrib/libarchive/cat/test/test_stdin.c - copied unchanged from r328332, head/contrib/libarchive/cat/test/test_stdin.c stable/10/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu - copied unchanged from r328332, head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu Modified: stable/10/contrib/libarchive/cat/bsdcat.c stable/10/contrib/libarchive/libarchive/archive_acl.c stable/10/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c stable/10/contrib/libarchive/libarchive/archive_match.c stable/10/contrib/libarchive/libarchive/archive_platform.h stable/10/contrib/libarchive/libarchive/archive_ppmd7.c stable/10/contrib/libarchive/libarchive/archive_ppmd7_private.h stable/10/contrib/libarchive/libarchive/archive_ppmd_private.h stable/10/contrib/libarchive/libarchive/archive_read.c stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_7zip.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/10/contrib/libarchive/libarchive/archive_util.c stable/10/contrib/libarchive/libarchive/archive_virtual.c stable/10/contrib/libarchive/libarchive/archive_write.c stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c stable/10/contrib/libarchive/libarchive/archive_write_set_format_7zip.c stable/10/contrib/libarchive/libarchive/test/read_open_memory.c stable/10/contrib/libarchive/libarchive/test/test.h stable/10/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c stable/10/contrib/libarchive/libarchive/test/test_compat_zip.c stable/10/contrib/libarchive/libarchive/test/test_read_format_zip.c stable/10/contrib/libarchive/libarchive/test/test_write_disk_perms.c stable/10/contrib/libarchive/tar/test/test_option_acls.c stable/10/lib/libarchive/tests/Makefile stable/10/usr.bin/bsdcat/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/cat/bsdcat.c ============================================================================== --- stable/10/contrib/libarchive/cat/bsdcat.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/cat/bsdcat.c Sat Feb 3 02:17:25 2018 (r328828) @@ -70,6 +70,12 @@ version(void) void bsdcat_next(void) { + if (a != NULL) { + if (archive_read_close(a) != ARCHIVE_OK) + bsdcat_print_error(); + archive_read_free(a); + } + a = archive_read_new(); archive_read_support_filter_all(a); archive_read_support_format_empty(a); @@ -100,8 +106,10 @@ bsdcat_read_to_stdout(const char* filename) ; else if (archive_read_data_into_fd(a, 1) != ARCHIVE_OK) bsdcat_print_error(); - if (archive_read_free(a) != ARCHIVE_OK) + if (archive_read_close(a) != ARCHIVE_OK) bsdcat_print_error(); + archive_read_free(a); + a = NULL; } int @@ -135,15 +143,14 @@ main(int argc, char **argv) if (*bsdcat->argv == NULL) { bsdcat_current_path = ""; bsdcat_read_to_stdout(NULL); - } else + } else { while (*bsdcat->argv) { bsdcat_current_path = *bsdcat->argv++; bsdcat_read_to_stdout(bsdcat_current_path); bsdcat_next(); } - - if (a != NULL) - archive_read_free(a); + archive_read_free(a); /* Help valgrind & friends */ + } exit(exit_status); } Copied: stable/10/contrib/libarchive/cat/test/test_stdin.c (from r328332, head/contrib/libarchive/cat/test/test_stdin.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/cat/test/test_stdin.c Sat Feb 3 02:17:25 2018 (r328828, copy of r328332, head/contrib/libarchive/cat/test/test_stdin.c) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Sean Purcell + * 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(S) ``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(S) 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 "test.h" + +#if !defined(_WIN32) || defined(__CYGWIN__) +#define DEV_NULL "/dev/null" +#else +#define DEV_NULL "NUL" +#endif + +DEFINE_TEST(test_stdin) +{ + int f; + + f = systemf("%s <%s >test.out 2>test.err", testprog, DEV_NULL); + assertEqualInt(0, f); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); +} + Modified: stable/10/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_acl.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_acl.c Sat Feb 3 02:17:25 2018 (r328828) @@ -1159,6 +1159,7 @@ archive_acl_from_text_w(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; @@ -1626,6 +1627,7 @@ archive_acl_from_text_l(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; Modified: stable/10/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c Sat Feb 3 02:17:25 2018 (r328828) @@ -93,7 +93,9 @@ static const acl_perm_map_t acl_nfs4_flag_map[] = { {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}, {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS}, {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS}, +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED} +#endif }; static const int acl_nfs4_flag_map_size = Modified: stable/10/contrib/libarchive/libarchive/archive_match.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_match.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_match.c Sat Feb 3 02:17:25 2018 (r328828) @@ -1582,7 +1582,7 @@ time_excluded(struct archive_match *a, struct archive_ */ int -archive_match_include_uid(struct archive *_a, int64_t uid) +archive_match_include_uid(struct archive *_a, la_int64_t uid) { struct archive_match *a; @@ -1593,7 +1593,7 @@ archive_match_include_uid(struct archive *_a, int64_t } int -archive_match_include_gid(struct archive *_a, int64_t gid) +archive_match_include_gid(struct archive *_a, la_int64_t gid) { struct archive_match *a; Modified: stable/10/contrib/libarchive/libarchive/archive_platform.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_platform.h Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_platform.h Sat Feb 3 02:17:25 2018 (r328828) @@ -191,4 +191,10 @@ #define ARCHIVE_ERRNO_MISC (-1) #endif +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #endif /* !ARCHIVE_PLATFORM_H_INCLUDED */ Modified: stable/10/contrib/libarchive/libarchive/archive_ppmd7.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_ppmd7.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_ppmd7.c Sat Feb 3 02:17:25 2018 (r328828) @@ -115,14 +115,14 @@ static void Ppmd7_Construct(CPpmd7 *p) memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); } -static void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc) +static void Ppmd7_Free(CPpmd7 *p) { - alloc->Free(alloc, p->Base); + free(p->Base); p->Size = 0; p->Base = 0; } -static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc) +static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size) { if (p->Base == 0 || p->Size != size) { @@ -131,14 +131,14 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAll if (size < UNIT_SIZE) { return False; } - Ppmd7_Free(p, alloc); + Ppmd7_Free(p); p->AlignOffset = #ifdef PPMD_32BIT (4 - size) & 3; #else 4 - (size & 3); #endif - if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size + if ((p->Base = (Byte *)malloc(p->AlignOffset + size #ifndef PPMD_32BIT + UNIT_SIZE #endif Modified: stable/10/contrib/libarchive/libarchive/archive_ppmd7_private.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_ppmd7_private.h Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_ppmd7_private.h Sat Feb 3 02:17:25 2018 (r328828) @@ -95,8 +95,8 @@ typedef struct { /* Base Functions */ void (*Ppmd7_Construct)(CPpmd7 *p); - Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size, ISzAlloc *alloc); - void (*Ppmd7_Free)(CPpmd7 *p, ISzAlloc *alloc); + Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size); + void (*Ppmd7_Free)(CPpmd7 *p); void (*Ppmd7_Init)(CPpmd7 *p, unsigned maxOrder); #define Ppmd7_WasAllocated(p) ((p)->Base != NULL) Modified: stable/10/contrib/libarchive/libarchive/archive_ppmd_private.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_ppmd_private.h Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_ppmd_private.h Sat Feb 3 02:17:25 2018 (r328828) @@ -69,13 +69,6 @@ typedef struct void (*Write)(void *p, Byte b); } IByteOut; - -typedef struct -{ - void *(*Alloc)(void *p, size_t size); - void (*Free)(void *p, void *address); /* address can be 0 */ -} ISzAlloc; - /*** End defined in Types.h ***/ /*** Begin defined in CpuArch.h ***/ Modified: stable/10/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_read.c Sat Feb 3 02:17:25 2018 (r328828) @@ -120,7 +120,8 @@ archive_read_new(void) * Record the do-not-extract-to file. This belongs in archive_read_extract.c. */ void -archive_read_extract_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_read_extract_set_skip_file(struct archive *_a, la_int64_t d, + la_int64_t i) { struct archive_read *a = (struct archive_read *)_a; @@ -747,7 +748,7 @@ choose_format(struct archive_read *a) * Return the file offset (within the uncompressed data stream) where * the last header started. */ -int64_t +la_int64_t archive_read_header_position(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; @@ -943,7 +944,7 @@ archive_read_data_skip(struct archive *_a) return (r); } -int64_t +la_int64_t archive_seek_data(struct archive *_a, int64_t offset, int whence) { struct archive_read *a = (struct archive_read *)_a; @@ -1626,7 +1627,8 @@ __archive_read_filter_seek(struct archive_read_filter switch (whence) { case SEEK_CUR: /* Adjust the offset and use SEEK_SET instead */ - offset += filter->position; + offset += filter->position; + __LA_FALLTHROUGH; case SEEK_SET: cursor = 0; while (1) Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Sat Feb 3 02:17:25 2018 (r328828) @@ -387,7 +387,7 @@ archive_read_disk_vtable(void) } const char * -archive_read_disk_gname(struct archive *_a, int64_t gid) +archive_read_disk_gname(struct archive *_a, la_int64_t gid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -399,7 +399,7 @@ archive_read_disk_gname(struct archive *_a, int64_t gi } const char * -archive_read_disk_uname(struct archive *_a, int64_t uid) +archive_read_disk_uname(struct archive *_a, la_int64_t uid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -413,7 +413,7 @@ archive_read_disk_uname(struct archive *_a, int64_t ui int archive_read_disk_set_gname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_gname)(void *private, int64_t gid), + const char * (*lookup_gname)(void *private, la_int64_t gid), void (*cleanup_gname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; @@ -432,7 +432,7 @@ archive_read_disk_set_gname_lookup(struct archive *_a, int archive_read_disk_set_uname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_uname)(void *private, int64_t uid), + const char * (*lookup_uname)(void *private, la_int64_t uid), void (*cleanup_uname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_7zip.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Sat Feb 3 02:17:25 2018 (r328828) @@ -975,18 +975,6 @@ decode_codec_id(const unsigned char *codecId, size_t i return (id); } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} static Byte ppmd_read(void *p) { @@ -1006,8 +994,6 @@ ppmd_read(void *p) return (b); } -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static int init_decompression(struct archive_read *a, struct _7zip *zip, const struct _7z_coder *coder1, const struct _7z_coder *coder2) @@ -1237,7 +1223,7 @@ init_decompression(struct archive_read *a, struct _7zi if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } @@ -1256,7 +1242,7 @@ init_decompression(struct archive_read *a, struct _7zi } __archive_ppmd7_functions.Ppmd7_Construct(&zip->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &zip->ppmd7_context, msize, &g_szalloc); + &zip->ppmd7_context, msize); if (r == 0) { archive_set_error(&a->archive, ENOMEM, "Coludn't allocate memory for PPMd"); @@ -1636,7 +1622,7 @@ free_decompression(struct archive_read *a, struct _7zi #endif if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } return (r); @@ -2569,6 +2555,7 @@ read_Header(struct archive_read *a, struct _7z_header_ case kDummy: if (ll == 0) break; + __LA_FALLTHROUGH; default: if (header_bytes(a, ll) == NULL) return (-1); Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sat Feb 3 02:17:25 2018 (r328828) @@ -1499,6 +1499,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } if (strcmp(key, "cksum") == 0) break; + __LA_FALLTHROUGH; case 'd': if (strcmp(key, "device") == 0) { /* stat(2) st_rdev field, e.g. the major/minor IDs @@ -1512,12 +1513,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_rdev(entry, dev); return r; } + __LA_FALLTHROUGH; case 'f': if (strcmp(key, "flags") == 0) { *parsed_kws |= MTREE_HAS_FFLAGS; archive_entry_copy_fflags_text(entry, val); break; } + __LA_FALLTHROUGH; case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; @@ -1529,16 +1532,19 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_gname(entry, val); break; } + __LA_FALLTHROUGH; case 'i': if (strcmp(key, "inode") == 0) { archive_entry_set_ino(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(key, "link") == 0) { archive_entry_copy_symlink(entry, val); break; } + __LA_FALLTHROUGH; case 'm': if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) break; @@ -1555,6 +1561,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } break; } + __LA_FALLTHROUGH; case 'n': if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; @@ -1562,6 +1569,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt (unsigned int)mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'r': if (strcmp(key, "resdevice") == 0) { /* stat(2) st_dev field, e.g. the device ID where the @@ -1577,6 +1585,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt if (strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) break; + __LA_FALLTHROUGH; case 's': if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) break; @@ -1593,6 +1602,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_size(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 't': if (strcmp(key, "tags") == 0) { /* @@ -1635,18 +1645,21 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_filetype(entry, AE_IFBLK); break; } + __LA_FALLTHROUGH; case 'c': if (strcmp(val, "char") == 0) { archive_entry_set_filetype(entry, AE_IFCHR); break; } + __LA_FALLTHROUGH; case 'd': if (strcmp(val, "dir") == 0) { archive_entry_set_filetype(entry, AE_IFDIR); break; } + __LA_FALLTHROUGH; case 'f': if (strcmp(val, "fifo") == 0) { archive_entry_set_filetype(entry, @@ -1658,12 +1671,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt AE_IFREG); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(val, "link") == 0) { archive_entry_set_filetype(entry, AE_IFLNK); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, @@ -1675,6 +1690,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt *parsed_kws |= MTREE_HAS_TYPE; break; } + __LA_FALLTHROUGH; case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; @@ -1686,6 +1702,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_uname(entry, val); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized key %s=%s", key, val); Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar.c Sat Feb 3 02:17:25 2018 (r328828) @@ -604,20 +604,6 @@ lzss_emit_match(struct rar *rar, int offset, int lengt rar->lzss.position += length; } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static Byte ppmd_read(void *p) { @@ -1038,7 +1024,7 @@ archive_read_format_rar_read_data(struct archive_read case COMPRESS_METHOD_BEST: ret = read_data_compressed(a, buff, size, offset); if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); break; default: @@ -1253,7 +1239,7 @@ archive_read_format_rar_cleanup(struct archive_read *a free(rar->dbo); free(rar->unp_buffer); free(rar->lzss.window); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); free(rar); (a->format->data) = NULL; return (ARCHIVE_OK); @@ -1658,7 +1644,7 @@ read_header(struct archive_read *a, struct archive_ent rar->unp_offset = 0; rar->unp_buffer_size = UNP_BUFFER_SIZE; memset(rar->lengthtable, 0, sizeof(rar->lengthtable)); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->ppmd_valid = rar->ppmd_eod = 0; /* Don't set any archive entries for non-file header types */ @@ -2122,7 +2108,7 @@ parse_codes(struct archive_read *a) /* Make sure ppmd7_contest is freed before Ppmd7_Construct * because reading a broken file cause this abnormal sequence. */ - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->bytein.a = a; rar->bytein.Read = &ppmd_read; @@ -2137,7 +2123,7 @@ parse_codes(struct archive_read *a) } if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context, - rar->dictionary_size, &g_szalloc)) + rar->dictionary_size)) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c Sat Feb 3 02:17:25 2018 (r328828) @@ -251,15 +251,15 @@ archive_read_support_format_tar(struct archive *_a) ARCHIVE_STATE_NEW, "archive_read_support_format_tar"); tar = (struct tar *)calloc(1, sizeof(*tar)); -#ifdef HAVE_COPYFILE_H - /* Set this by default on Mac OS. */ - tar->process_mac_extensions = 1; -#endif if (tar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate tar data"); return (ARCHIVE_FATAL); } +#ifdef HAVE_COPYFILE_H + /* Set this by default on Mac OS. */ + tar->process_mac_extensions = 1; +#endif r = __archive_read_register_format(a, tar, "tar", archive_read_format_tar_bid, Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sat Feb 3 02:17:25 2018 (r328828) @@ -886,6 +886,24 @@ zip_read_local_file_header(struct archive_read *a, str zip_entry->mode |= 0664; } + /* Windows archivers sometimes use backslash as the directory separator. + Normalize to slash. */ + if (zip_entry->system == 0 && + (wp = archive_entry_pathname_w(entry)) != NULL) { + if (wcschr(wp, L'/') == NULL && wcschr(wp, L'\\') != NULL) { + size_t i; + struct archive_wstring s; + archive_string_init(&s); + archive_wstrcpy(&s, wp); + for (i = 0; i < archive_strlen(&s); i++) { + if (s.s[i] == '\\') + s.s[i] = '/'; + } + archive_entry_copy_pathname_w(entry, s.s); + archive_wstring_free(&s); + } + } + /* Make sure that entries with a trailing '/' are marked as directories * even if the External File Attributes contains bogus values. If this * is not a directory and there is no type, assume regularfile. */ @@ -1061,6 +1079,7 @@ zip_read_local_file_header(struct archive_read *a, str zip->end_of_entry = 1; /* Set up a more descriptive format name. */ + archive_string_empty(&zip->format_name); archive_string_sprintf(&zip->format_name, "ZIP %d.%d (%s)", version / 10, version % 10, compression_name(zip->entry->compression)); Modified: stable/10/contrib/libarchive/libarchive/archive_util.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_util.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_util.c Sat Feb 3 02:17:25 2018 (r328828) @@ -140,7 +140,7 @@ archive_compression_name(struct archive *a) /* * Return a count of the number of compressed bytes processed. */ -int64_t +la_int64_t archive_position_compressed(struct archive *a) { return archive_filter_bytes(a, -1); @@ -149,7 +149,7 @@ archive_position_compressed(struct archive *a) /* * Return a count of the number of uncompressed bytes processed. */ -int64_t +la_int64_t archive_position_uncompressed(struct archive *a) { return archive_filter_bytes(a, 0); Modified: stable/10/contrib/libarchive/libarchive/archive_virtual.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_virtual.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_virtual.c Sat Feb 3 02:17:25 2018 (r328828) @@ -48,7 +48,7 @@ archive_filter_name(struct archive *a, int n) return ((a->vtable->archive_filter_name)(a, n)); } -int64_t +la_int64_t archive_filter_bytes(struct archive *a, int n) { return ((a->vtable->archive_filter_bytes)(a, n)); @@ -131,7 +131,8 @@ archive_write_data(struct archive *a, const void *buff } ssize_t -archive_write_data_block(struct archive *a, const void *buff, size_t s, int64_t o) +archive_write_data_block(struct archive *a, const void *buff, size_t s, + la_int64_t o) { if (a->vtable->archive_write_data_block == NULL) { archive_set_error(a, ARCHIVE_ERRNO_MISC, @@ -156,7 +157,7 @@ archive_read_next_header2(struct archive *a, struct ar int archive_read_data_block(struct archive *a, - const void **buff, size_t *s, int64_t *o) + const void **buff, size_t *s, la_int64_t *o) { return ((a->vtable->archive_read_data_block)(a, buff, s, o)); } Modified: stable/10/contrib/libarchive/libarchive/archive_write.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_write.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_write.c Sat Feb 3 02:17:25 2018 (r328828) @@ -190,7 +190,7 @@ archive_write_get_bytes_in_last_block(struct archive * * an archive to itself recursively. */ int -archive_write_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write *a = (struct archive_write *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, Modified: stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c Sat Feb 3 02:17:25 2018 (r328828) @@ -835,7 +835,7 @@ _archive_write_disk_header(struct archive *_a, struct } int -archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_disk_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1786,7 +1786,7 @@ finish_metadata: int archive_write_disk_set_group_lookup(struct archive *_a, void *private_data, - int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid), + la_int64_t (*lookup_gid)(void *private, const char *gname, la_int64_t gid), void (*cleanup_gid)(void *private)) { struct archive_write_disk *a = (struct archive_write_disk *)_a; @@ -1822,7 +1822,7 @@ archive_write_disk_set_user_lookup(struct archive *_a, } int64_t -archive_write_disk_gid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_gid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1833,7 +1833,7 @@ archive_write_disk_gid(struct archive *_a, const char } int64_t -archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_uid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1981,6 +1981,10 @@ restore_entry(struct archive_write_disk *a) if ((en == EISDIR || en == EEXIST) && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { /* If we're not overwriting, we're done. */ + if (S_ISDIR(a->mode)) { + /* Don't overwrite any settings on existing directories. */ + a->todo = 0; + } archive_entry_unset_size(a->entry); return (ARCHIVE_OK); } Modified: stable/10/contrib/libarchive/libarchive/archive_write_set_format_7zip.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Sat Feb 3 02:17:25 2018 (r328828) @@ -2095,20 +2095,7 @@ compression_init_encoder_lzma2(struct archive *a, /* * _7_PPMD compressor. */ -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; -static void ppmd_write(void *p, Byte b) { struct archive_write *a = ((IByteOut *)p)->a; @@ -2167,7 +2154,7 @@ compression_init_encoder_ppmd(struct archive *a, archive_le32enc(props+1, msize); __archive_ppmd7_functions.Ppmd7_Construct(&strm->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &strm->ppmd7_context, msize, &g_szalloc); + &strm->ppmd7_context, msize); if (r == 0) { free(strm->buff); free(strm); @@ -2243,7 +2230,7 @@ compression_end_ppmd(struct archive *a, struct la_zstr (void)a; /* UNUSED */ strm = (struct ppmd_stream *)lastrm->real_stream; - __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context); free(strm->buff); free(strm); lastrm->real_stream = NULL; Modified: stable/10/contrib/libarchive/libarchive/test/read_open_memory.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/read_open_memory.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/test/read_open_memory.c Sat Feb 3 02:17:25 2018 (r328828) @@ -91,9 +91,11 @@ read_open_memory_internal(struct archive *a, const voi switch (level) { case 3: archive_read_set_seek_callback(a, memory_read_seek); + __LA_FALLTHROUGH; case 2: archive_read_set_open_callback(a, memory_read_open); archive_read_set_skip_callback(a, memory_read_skip); + __LA_FALLTHROUGH; case 1: mine = malloc(sizeof(*mine)); if (mine == NULL) { Modified: stable/10/contrib/libarchive/libarchive/test/test.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test.h Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/test/test.h Sat Feb 3 02:17:25 2018 (r328828) @@ -33,4 +33,10 @@ #define EXTRA_ERRNO(x) archive_errno((struct archive *)(x)) #define EXTRA_VERSION archive_version_details() +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #include "test_common.h" Modified: stable/10/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c Sat Feb 3 02:17:25 2018 (r328828) @@ -408,7 +408,9 @@ acl_flagset_to_bitmap(acl_flagset_t opaque_fs) {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, RICHACE_INHERIT_ONLY_ACE}, {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, RICHACE_INHERITED_ACE} #else /* FreeBSD NFSv4 ACL inheritance flags */ +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}, +#endif {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, Modified: stable/10/contrib/libarchive/libarchive/test/test_compat_zip.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_compat_zip.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/test/test_compat_zip.c Sat Feb 3 02:17:25 2018 (r328828) @@ -422,3 +422,29 @@ DEFINE_TEST(test_compat_zip_7) } free(p); } + +/** + * A file with backslash path separators instead of slashes. + * PowerShell's Compress-Archive cmdlet produces such archives. + */ +DEFINE_TEST(test_compat_zip_8) +{ + const char *refname = "test_compat_zip_8.zip"; + struct archive *a; + struct archive_entry *ae; + void *p; + size_t s; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_minimal(a, p, s, 7)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + /* This file is in the archive as arc\test */ + assertEqualString("arc/test", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + free(p); +} Copied: stable/10/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu (from r328332, head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu Sat Feb 3 02:17:25 2018 (r328828, copy of r328332, head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu) @@ -0,0 +1,6 @@ +begin 666 test_compat_zip_8.zip +M4$L#!!0````(`%A\;TOY6""D$`````X````(````87)C7'1E!BP$`4$L!`A0`%`````@`6'QO2_E8(*00````#@````@````````` +H`````````````&%R8UQT97-T4$L%!@`````!``$`-@```#8````````` +` +end Modified: stable/10/contrib/libarchive/libarchive/test/test_read_format_zip.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_read_format_zip.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_zip.c Sat Feb 3 02:17:25 2018 (r328828) @@ -41,6 +41,7 @@ verify_basic(struct archive *a, int seek_checks) int64_t o; assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 1.0 (uncompressed)", archive_format_name(a)); assertEqualString("dir/", archive_entry_pathname(ae)); assertEqualInt(1179604249, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_size(ae)); @@ -53,6 +54,7 @@ verify_basic(struct archive *a, int seek_checks) assertEqualInt((int)s, 0); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(1179604289, archive_entry_mtime(ae)); if (seek_checks) @@ -72,6 +74,7 @@ verify_basic(struct archive *a, int seek_checks) } assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file2", archive_entry_pathname(ae)); assertEqualInt(1179605932, archive_entry_mtime(ae)); assertEqualInt(archive_entry_is_encrypted(ae), 0); @@ -93,6 +96,7 @@ verify_basic(struct archive *a, int seek_checks) assert(archive_errno(a) != 0); } assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); /* Verify the number of files read. */ failure("the archive file has three files"); assertEqualInt(3, archive_file_count(a)); Modified: stable/10/contrib/libarchive/libarchive/test/test_write_disk_perms.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_write_disk_perms.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/libarchive/test/test_write_disk_perms.c Sat Feb 3 02:17:25 2018 (r328828) @@ -131,6 +131,8 @@ DEFINE_TEST(test_write_disk_perms) struct archive *a; struct archive_entry *ae; struct stat st; + uid_t original_uid; + uid_t try_to_change_uid; assertUmask(UMASK); @@ -200,6 +202,37 @@ DEFINE_TEST(test_write_disk_perms) assertEqualInt(0, stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); assertEqualInt(st.st_mode & 0777, 0744); + + /* For dir, the owner should get left when not overwritting. */ + assertMakeDir("dir_owner", 0744); + + if (getuid() == 0) { + original_uid = getuid() + 1; + try_to_change_uid = getuid(); + assertEqualInt(0, chown("dir_owner", original_uid, getgid())); + } else { + original_uid = getuid(); + try_to_change_uid = getuid() + 1; + } + + /* Check original owner. */ + assertEqualInt(0, stat("dir_owner", &st)); + failure("dir_owner: st.st_uid=%d", st.st_uid); + assertEqualInt(st.st_uid, original_uid); + /* Shouldn't try to edit the owner when no overwrite option is set. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir_owner"); + archive_entry_set_mode(ae, S_IFDIR | 0744); + archive_entry_set_uid(ae, try_to_change_uid); + archive_write_disk_set_options(a, + ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_NO_OVERWRITE); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); + /* Make sure they're unchanged. */ + assertEqualInt(0, stat("dir_owner", &st)); + failure("dir_owner: st.st_uid=%d", st.st_uid); + assertEqualInt(st.st_uid, original_uid); /* Write a regular file with SUID bit, but don't use _EXTRACT_PERM. */ assert((ae = archive_entry_new()) != NULL); Modified: stable/10/contrib/libarchive/tar/test/test_option_acls.c ============================================================================== --- stable/10/contrib/libarchive/tar/test/test_option_acls.c Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/contrib/libarchive/tar/test/test_option_acls.c Sat Feb 3 02:17:25 2018 (r328828) @@ -85,7 +85,9 @@ static const acl_flag_t acl_flags[] = { ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_FAILED_ACCESS, +#ifdef ACL_ENTRY_INHERITED ACL_ENTRY_INHERITED +#endif #endif /* ARCHIVE_ACL_FREEBSD_NFS4 */ }; #endif /* ARCHIVE_ACL_DARWIN || ARCHIVE_ACL_FREEBSD_NFS4 */ Modified: stable/10/lib/libarchive/tests/Makefile ============================================================================== --- stable/10/lib/libarchive/tests/Makefile Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/lib/libarchive/tests/Makefile Sat Feb 3 02:17:25 2018 (r328828) @@ -375,6 +375,7 @@ FILES+= test_compat_zip_4.zip.uu FILES+= test_compat_zip_5.zip.uu FILES+= test_compat_zip_6.zip.uu FILES+= test_compat_zip_7.xps.uu +FILES+= test_compat_zip_8.zip.uu FILES+= test_compat_zstd_1.tar.zst.uu FILES+= test_fuzz.cab.uu FILES+= test_fuzz.lzh.uu Modified: stable/10/usr.bin/bsdcat/tests/Makefile ============================================================================== --- stable/10/usr.bin/bsdcat/tests/Makefile Sat Feb 3 02:17:04 2018 (r328827) +++ stable/10/usr.bin/bsdcat/tests/Makefile Sat Feb 3 02:17:25 2018 (r328828) @@ -38,6 +38,7 @@ TESTS_SRCS= \ test_expand_xz.c \ test_expand_zstd.c \ test_help.c \ + test_stdin.c \ test_version.c SRCS.bsdcat_test= list.h \ From owner-svn-src-all@freebsd.org Sat Feb 3 02:17:08 2018 Return-Path: Delivered-To: svn-src-all@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 BC6DEEDE2C9; Sat, 3 Feb 2018 02:17:07 +0000 (UTC) (envelope-from mm@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 6CDC16CCAF; Sat, 3 Feb 2018 02:17:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 676A724292; Sat, 3 Feb 2018 02:17:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w132H7Aj059655; Sat, 3 Feb 2018 02:17:07 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w132H47P059622; Sat, 3 Feb 2018 02:17:04 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201802030217.w132H47P059622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 3 Feb 2018 02:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328827 - in stable/11: contrib/libarchive/cat contrib/libarchive/cat/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/te... X-SVN-Group: stable-11 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/11: contrib/libarchive/cat contrib/libarchive/cat/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/tests usr.bin/bsdcat/tests X-SVN-Commit-Revision: 328827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 02:17:08 -0000 Author: mm Date: Sat Feb 3 02:17:04 2018 New Revision: 328827 URL: https://svnweb.freebsd.org/changeset/base/328827 Log: MFH r328332: Sync libarchive with vendor. Relevant vendor changes: PR #893: delete dead ppmd7 alloc callbacks PR #904: Fix archive freeing bug in bsdcat PR #961: Fix ZIP format names PR #962: Don't modify attributes for existing directories when ARCHIVE_EXTRACT_NO_OVERWRITE is set PR #964: Fix -Werror=implicit-fallthrough= for GCC 7 PR #970: zip: Allow backslash as path separator Added: stable/11/contrib/libarchive/cat/test/test_stdin.c - copied unchanged from r328332, head/contrib/libarchive/cat/test/test_stdin.c stable/11/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu - copied unchanged from r328332, head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu Modified: stable/11/contrib/libarchive/cat/bsdcat.c stable/11/contrib/libarchive/libarchive/archive_acl.c stable/11/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c stable/11/contrib/libarchive/libarchive/archive_match.c stable/11/contrib/libarchive/libarchive/archive_platform.h stable/11/contrib/libarchive/libarchive/archive_ppmd7.c stable/11/contrib/libarchive/libarchive/archive_ppmd7_private.h stable/11/contrib/libarchive/libarchive/archive_ppmd_private.h stable/11/contrib/libarchive/libarchive/archive_read.c stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_tar.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/11/contrib/libarchive/libarchive/archive_util.c stable/11/contrib/libarchive/libarchive/archive_virtual.c stable/11/contrib/libarchive/libarchive/archive_write.c stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c stable/11/contrib/libarchive/libarchive/archive_write_set_format_7zip.c stable/11/contrib/libarchive/libarchive/test/read_open_memory.c stable/11/contrib/libarchive/libarchive/test/test.h stable/11/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c stable/11/contrib/libarchive/libarchive/test/test_compat_zip.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip.c stable/11/contrib/libarchive/libarchive/test/test_write_disk_perms.c stable/11/contrib/libarchive/tar/test/test_option_acls.c stable/11/lib/libarchive/tests/Makefile stable/11/usr.bin/bsdcat/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libarchive/cat/bsdcat.c ============================================================================== --- stable/11/contrib/libarchive/cat/bsdcat.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/cat/bsdcat.c Sat Feb 3 02:17:04 2018 (r328827) @@ -70,6 +70,12 @@ version(void) void bsdcat_next(void) { + if (a != NULL) { + if (archive_read_close(a) != ARCHIVE_OK) + bsdcat_print_error(); + archive_read_free(a); + } + a = archive_read_new(); archive_read_support_filter_all(a); archive_read_support_format_empty(a); @@ -100,8 +106,10 @@ bsdcat_read_to_stdout(const char* filename) ; else if (archive_read_data_into_fd(a, 1) != ARCHIVE_OK) bsdcat_print_error(); - if (archive_read_free(a) != ARCHIVE_OK) + if (archive_read_close(a) != ARCHIVE_OK) bsdcat_print_error(); + archive_read_free(a); + a = NULL; } int @@ -135,15 +143,14 @@ main(int argc, char **argv) if (*bsdcat->argv == NULL) { bsdcat_current_path = ""; bsdcat_read_to_stdout(NULL); - } else + } else { while (*bsdcat->argv) { bsdcat_current_path = *bsdcat->argv++; bsdcat_read_to_stdout(bsdcat_current_path); bsdcat_next(); } - - if (a != NULL) - archive_read_free(a); + archive_read_free(a); /* Help valgrind & friends */ + } exit(exit_status); } Copied: stable/11/contrib/libarchive/cat/test/test_stdin.c (from r328332, head/contrib/libarchive/cat/test/test_stdin.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libarchive/cat/test/test_stdin.c Sat Feb 3 02:17:04 2018 (r328827, copy of r328332, head/contrib/libarchive/cat/test/test_stdin.c) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Sean Purcell + * 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(S) ``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(S) 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 "test.h" + +#if !defined(_WIN32) || defined(__CYGWIN__) +#define DEV_NULL "/dev/null" +#else +#define DEV_NULL "NUL" +#endif + +DEFINE_TEST(test_stdin) +{ + int f; + + f = systemf("%s <%s >test.out 2>test.err", testprog, DEV_NULL); + assertEqualInt(0, f); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); +} + Modified: stable/11/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_acl.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_acl.c Sat Feb 3 02:17:04 2018 (r328827) @@ -1159,6 +1159,7 @@ archive_acl_from_text_w(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; @@ -1626,6 +1627,7 @@ archive_acl_from_text_l(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; Modified: stable/11/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c Sat Feb 3 02:17:04 2018 (r328827) @@ -93,7 +93,9 @@ static const acl_perm_map_t acl_nfs4_flag_map[] = { {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}, {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS}, {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS}, +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED} +#endif }; static const int acl_nfs4_flag_map_size = Modified: stable/11/contrib/libarchive/libarchive/archive_match.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_match.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_match.c Sat Feb 3 02:17:04 2018 (r328827) @@ -1582,7 +1582,7 @@ time_excluded(struct archive_match *a, struct archive_ */ int -archive_match_include_uid(struct archive *_a, int64_t uid) +archive_match_include_uid(struct archive *_a, la_int64_t uid) { struct archive_match *a; @@ -1593,7 +1593,7 @@ archive_match_include_uid(struct archive *_a, int64_t } int -archive_match_include_gid(struct archive *_a, int64_t gid) +archive_match_include_gid(struct archive *_a, la_int64_t gid) { struct archive_match *a; Modified: stable/11/contrib/libarchive/libarchive/archive_platform.h ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_platform.h Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_platform.h Sat Feb 3 02:17:04 2018 (r328827) @@ -191,4 +191,10 @@ #define ARCHIVE_ERRNO_MISC (-1) #endif +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #endif /* !ARCHIVE_PLATFORM_H_INCLUDED */ Modified: stable/11/contrib/libarchive/libarchive/archive_ppmd7.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_ppmd7.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_ppmd7.c Sat Feb 3 02:17:04 2018 (r328827) @@ -115,14 +115,14 @@ static void Ppmd7_Construct(CPpmd7 *p) memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); } -static void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc) +static void Ppmd7_Free(CPpmd7 *p) { - alloc->Free(alloc, p->Base); + free(p->Base); p->Size = 0; p->Base = 0; } -static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc) +static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size) { if (p->Base == 0 || p->Size != size) { @@ -131,14 +131,14 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAll if (size < UNIT_SIZE) { return False; } - Ppmd7_Free(p, alloc); + Ppmd7_Free(p); p->AlignOffset = #ifdef PPMD_32BIT (4 - size) & 3; #else 4 - (size & 3); #endif - if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size + if ((p->Base = (Byte *)malloc(p->AlignOffset + size #ifndef PPMD_32BIT + UNIT_SIZE #endif Modified: stable/11/contrib/libarchive/libarchive/archive_ppmd7_private.h ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_ppmd7_private.h Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_ppmd7_private.h Sat Feb 3 02:17:04 2018 (r328827) @@ -95,8 +95,8 @@ typedef struct { /* Base Functions */ void (*Ppmd7_Construct)(CPpmd7 *p); - Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size, ISzAlloc *alloc); - void (*Ppmd7_Free)(CPpmd7 *p, ISzAlloc *alloc); + Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size); + void (*Ppmd7_Free)(CPpmd7 *p); void (*Ppmd7_Init)(CPpmd7 *p, unsigned maxOrder); #define Ppmd7_WasAllocated(p) ((p)->Base != NULL) Modified: stable/11/contrib/libarchive/libarchive/archive_ppmd_private.h ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_ppmd_private.h Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_ppmd_private.h Sat Feb 3 02:17:04 2018 (r328827) @@ -69,13 +69,6 @@ typedef struct void (*Write)(void *p, Byte b); } IByteOut; - -typedef struct -{ - void *(*Alloc)(void *p, size_t size); - void (*Free)(void *p, void *address); /* address can be 0 */ -} ISzAlloc; - /*** End defined in Types.h ***/ /*** Begin defined in CpuArch.h ***/ Modified: stable/11/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_read.c Sat Feb 3 02:17:04 2018 (r328827) @@ -120,7 +120,8 @@ archive_read_new(void) * Record the do-not-extract-to file. This belongs in archive_read_extract.c. */ void -archive_read_extract_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_read_extract_set_skip_file(struct archive *_a, la_int64_t d, + la_int64_t i) { struct archive_read *a = (struct archive_read *)_a; @@ -747,7 +748,7 @@ choose_format(struct archive_read *a) * Return the file offset (within the uncompressed data stream) where * the last header started. */ -int64_t +la_int64_t archive_read_header_position(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; @@ -943,7 +944,7 @@ archive_read_data_skip(struct archive *_a) return (r); } -int64_t +la_int64_t archive_seek_data(struct archive *_a, int64_t offset, int whence) { struct archive_read *a = (struct archive_read *)_a; @@ -1626,7 +1627,8 @@ __archive_read_filter_seek(struct archive_read_filter switch (whence) { case SEEK_CUR: /* Adjust the offset and use SEEK_SET instead */ - offset += filter->position; + offset += filter->position; + __LA_FALLTHROUGH; case SEEK_SET: cursor = 0; while (1) Modified: stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Sat Feb 3 02:17:04 2018 (r328827) @@ -387,7 +387,7 @@ archive_read_disk_vtable(void) } const char * -archive_read_disk_gname(struct archive *_a, int64_t gid) +archive_read_disk_gname(struct archive *_a, la_int64_t gid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -399,7 +399,7 @@ archive_read_disk_gname(struct archive *_a, int64_t gi } const char * -archive_read_disk_uname(struct archive *_a, int64_t uid) +archive_read_disk_uname(struct archive *_a, la_int64_t uid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -413,7 +413,7 @@ archive_read_disk_uname(struct archive *_a, int64_t ui int archive_read_disk_set_gname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_gname)(void *private, int64_t gid), + const char * (*lookup_gname)(void *private, la_int64_t gid), void (*cleanup_gname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; @@ -432,7 +432,7 @@ archive_read_disk_set_gname_lookup(struct archive *_a, int archive_read_disk_set_uname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_uname)(void *private, int64_t uid), + const char * (*lookup_uname)(void *private, la_int64_t uid), void (*cleanup_uname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Sat Feb 3 02:17:04 2018 (r328827) @@ -975,18 +975,6 @@ decode_codec_id(const unsigned char *codecId, size_t i return (id); } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} static Byte ppmd_read(void *p) { @@ -1006,8 +994,6 @@ ppmd_read(void *p) return (b); } -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static int init_decompression(struct archive_read *a, struct _7zip *zip, const struct _7z_coder *coder1, const struct _7z_coder *coder2) @@ -1237,7 +1223,7 @@ init_decompression(struct archive_read *a, struct _7zi if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } @@ -1256,7 +1242,7 @@ init_decompression(struct archive_read *a, struct _7zi } __archive_ppmd7_functions.Ppmd7_Construct(&zip->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &zip->ppmd7_context, msize, &g_szalloc); + &zip->ppmd7_context, msize); if (r == 0) { archive_set_error(&a->archive, ENOMEM, "Coludn't allocate memory for PPMd"); @@ -1636,7 +1622,7 @@ free_decompression(struct archive_read *a, struct _7zi #endif if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } return (r); @@ -2569,6 +2555,7 @@ read_Header(struct archive_read *a, struct _7z_header_ case kDummy: if (ll == 0) break; + __LA_FALLTHROUGH; default: if (header_bytes(a, ll) == NULL) return (-1); Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sat Feb 3 02:17:04 2018 (r328827) @@ -1499,6 +1499,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } if (strcmp(key, "cksum") == 0) break; + __LA_FALLTHROUGH; case 'd': if (strcmp(key, "device") == 0) { /* stat(2) st_rdev field, e.g. the major/minor IDs @@ -1512,12 +1513,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_rdev(entry, dev); return r; } + __LA_FALLTHROUGH; case 'f': if (strcmp(key, "flags") == 0) { *parsed_kws |= MTREE_HAS_FFLAGS; archive_entry_copy_fflags_text(entry, val); break; } + __LA_FALLTHROUGH; case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; @@ -1529,16 +1532,19 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_gname(entry, val); break; } + __LA_FALLTHROUGH; case 'i': if (strcmp(key, "inode") == 0) { archive_entry_set_ino(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(key, "link") == 0) { archive_entry_copy_symlink(entry, val); break; } + __LA_FALLTHROUGH; case 'm': if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) break; @@ -1555,6 +1561,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } break; } + __LA_FALLTHROUGH; case 'n': if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; @@ -1562,6 +1569,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt (unsigned int)mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'r': if (strcmp(key, "resdevice") == 0) { /* stat(2) st_dev field, e.g. the device ID where the @@ -1577,6 +1585,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt if (strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) break; + __LA_FALLTHROUGH; case 's': if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) break; @@ -1593,6 +1602,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_size(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 't': if (strcmp(key, "tags") == 0) { /* @@ -1635,18 +1645,21 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_filetype(entry, AE_IFBLK); break; } + __LA_FALLTHROUGH; case 'c': if (strcmp(val, "char") == 0) { archive_entry_set_filetype(entry, AE_IFCHR); break; } + __LA_FALLTHROUGH; case 'd': if (strcmp(val, "dir") == 0) { archive_entry_set_filetype(entry, AE_IFDIR); break; } + __LA_FALLTHROUGH; case 'f': if (strcmp(val, "fifo") == 0) { archive_entry_set_filetype(entry, @@ -1658,12 +1671,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt AE_IFREG); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(val, "link") == 0) { archive_entry_set_filetype(entry, AE_IFLNK); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, @@ -1675,6 +1690,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt *parsed_kws |= MTREE_HAS_TYPE; break; } + __LA_FALLTHROUGH; case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; @@ -1686,6 +1702,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_uname(entry, val); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized key %s=%s", key, val); Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar.c Sat Feb 3 02:17:04 2018 (r328827) @@ -604,20 +604,6 @@ lzss_emit_match(struct rar *rar, int offset, int lengt rar->lzss.position += length; } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static Byte ppmd_read(void *p) { @@ -1038,7 +1024,7 @@ archive_read_format_rar_read_data(struct archive_read case COMPRESS_METHOD_BEST: ret = read_data_compressed(a, buff, size, offset); if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); break; default: @@ -1253,7 +1239,7 @@ archive_read_format_rar_cleanup(struct archive_read *a free(rar->dbo); free(rar->unp_buffer); free(rar->lzss.window); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); free(rar); (a->format->data) = NULL; return (ARCHIVE_OK); @@ -1658,7 +1644,7 @@ read_header(struct archive_read *a, struct archive_ent rar->unp_offset = 0; rar->unp_buffer_size = UNP_BUFFER_SIZE; memset(rar->lengthtable, 0, sizeof(rar->lengthtable)); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->ppmd_valid = rar->ppmd_eod = 0; /* Don't set any archive entries for non-file header types */ @@ -2122,7 +2108,7 @@ parse_codes(struct archive_read *a) /* Make sure ppmd7_contest is freed before Ppmd7_Construct * because reading a broken file cause this abnormal sequence. */ - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->bytein.a = a; rar->bytein.Read = &ppmd_read; @@ -2137,7 +2123,7 @@ parse_codes(struct archive_read *a) } if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context, - rar->dictionary_size, &g_szalloc)) + rar->dictionary_size)) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_tar.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_tar.c Sat Feb 3 02:17:04 2018 (r328827) @@ -251,15 +251,15 @@ archive_read_support_format_tar(struct archive *_a) ARCHIVE_STATE_NEW, "archive_read_support_format_tar"); tar = (struct tar *)calloc(1, sizeof(*tar)); -#ifdef HAVE_COPYFILE_H - /* Set this by default on Mac OS. */ - tar->process_mac_extensions = 1; -#endif if (tar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate tar data"); return (ARCHIVE_FATAL); } +#ifdef HAVE_COPYFILE_H + /* Set this by default on Mac OS. */ + tar->process_mac_extensions = 1; +#endif r = __archive_read_register_format(a, tar, "tar", archive_read_format_tar_bid, Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sat Feb 3 02:17:04 2018 (r328827) @@ -886,6 +886,24 @@ zip_read_local_file_header(struct archive_read *a, str zip_entry->mode |= 0664; } + /* Windows archivers sometimes use backslash as the directory separator. + Normalize to slash. */ + if (zip_entry->system == 0 && + (wp = archive_entry_pathname_w(entry)) != NULL) { + if (wcschr(wp, L'/') == NULL && wcschr(wp, L'\\') != NULL) { + size_t i; + struct archive_wstring s; + archive_string_init(&s); + archive_wstrcpy(&s, wp); + for (i = 0; i < archive_strlen(&s); i++) { + if (s.s[i] == '\\') + s.s[i] = '/'; + } + archive_entry_copy_pathname_w(entry, s.s); + archive_wstring_free(&s); + } + } + /* Make sure that entries with a trailing '/' are marked as directories * even if the External File Attributes contains bogus values. If this * is not a directory and there is no type, assume regularfile. */ @@ -1061,6 +1079,7 @@ zip_read_local_file_header(struct archive_read *a, str zip->end_of_entry = 1; /* Set up a more descriptive format name. */ + archive_string_empty(&zip->format_name); archive_string_sprintf(&zip->format_name, "ZIP %d.%d (%s)", version / 10, version % 10, compression_name(zip->entry->compression)); Modified: stable/11/contrib/libarchive/libarchive/archive_util.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_util.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_util.c Sat Feb 3 02:17:04 2018 (r328827) @@ -140,7 +140,7 @@ archive_compression_name(struct archive *a) /* * Return a count of the number of compressed bytes processed. */ -int64_t +la_int64_t archive_position_compressed(struct archive *a) { return archive_filter_bytes(a, -1); @@ -149,7 +149,7 @@ archive_position_compressed(struct archive *a) /* * Return a count of the number of uncompressed bytes processed. */ -int64_t +la_int64_t archive_position_uncompressed(struct archive *a) { return archive_filter_bytes(a, 0); Modified: stable/11/contrib/libarchive/libarchive/archive_virtual.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_virtual.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_virtual.c Sat Feb 3 02:17:04 2018 (r328827) @@ -48,7 +48,7 @@ archive_filter_name(struct archive *a, int n) return ((a->vtable->archive_filter_name)(a, n)); } -int64_t +la_int64_t archive_filter_bytes(struct archive *a, int n) { return ((a->vtable->archive_filter_bytes)(a, n)); @@ -131,7 +131,8 @@ archive_write_data(struct archive *a, const void *buff } ssize_t -archive_write_data_block(struct archive *a, const void *buff, size_t s, int64_t o) +archive_write_data_block(struct archive *a, const void *buff, size_t s, + la_int64_t o) { if (a->vtable->archive_write_data_block == NULL) { archive_set_error(a, ARCHIVE_ERRNO_MISC, @@ -156,7 +157,7 @@ archive_read_next_header2(struct archive *a, struct ar int archive_read_data_block(struct archive *a, - const void **buff, size_t *s, int64_t *o) + const void **buff, size_t *s, la_int64_t *o) { return ((a->vtable->archive_read_data_block)(a, buff, s, o)); } Modified: stable/11/contrib/libarchive/libarchive/archive_write.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_write.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_write.c Sat Feb 3 02:17:04 2018 (r328827) @@ -190,7 +190,7 @@ archive_write_get_bytes_in_last_block(struct archive * * an archive to itself recursively. */ int -archive_write_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write *a = (struct archive_write *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, Modified: stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c Sat Feb 3 02:17:04 2018 (r328827) @@ -835,7 +835,7 @@ _archive_write_disk_header(struct archive *_a, struct } int -archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_disk_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1786,7 +1786,7 @@ finish_metadata: int archive_write_disk_set_group_lookup(struct archive *_a, void *private_data, - int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid), + la_int64_t (*lookup_gid)(void *private, const char *gname, la_int64_t gid), void (*cleanup_gid)(void *private)) { struct archive_write_disk *a = (struct archive_write_disk *)_a; @@ -1822,7 +1822,7 @@ archive_write_disk_set_user_lookup(struct archive *_a, } int64_t -archive_write_disk_gid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_gid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1833,7 +1833,7 @@ archive_write_disk_gid(struct archive *_a, const char } int64_t -archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_uid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1981,6 +1981,10 @@ restore_entry(struct archive_write_disk *a) if ((en == EISDIR || en == EEXIST) && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { /* If we're not overwriting, we're done. */ + if (S_ISDIR(a->mode)) { + /* Don't overwrite any settings on existing directories. */ + a->todo = 0; + } archive_entry_unset_size(a->entry); return (ARCHIVE_OK); } Modified: stable/11/contrib/libarchive/libarchive/archive_write_set_format_7zip.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Sat Feb 3 02:17:04 2018 (r328827) @@ -2095,20 +2095,7 @@ compression_init_encoder_lzma2(struct archive *a, /* * _7_PPMD compressor. */ -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; -static void ppmd_write(void *p, Byte b) { struct archive_write *a = ((IByteOut *)p)->a; @@ -2167,7 +2154,7 @@ compression_init_encoder_ppmd(struct archive *a, archive_le32enc(props+1, msize); __archive_ppmd7_functions.Ppmd7_Construct(&strm->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &strm->ppmd7_context, msize, &g_szalloc); + &strm->ppmd7_context, msize); if (r == 0) { free(strm->buff); free(strm); @@ -2243,7 +2230,7 @@ compression_end_ppmd(struct archive *a, struct la_zstr (void)a; /* UNUSED */ strm = (struct ppmd_stream *)lastrm->real_stream; - __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context); free(strm->buff); free(strm); lastrm->real_stream = NULL; Modified: stable/11/contrib/libarchive/libarchive/test/read_open_memory.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/read_open_memory.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/test/read_open_memory.c Sat Feb 3 02:17:04 2018 (r328827) @@ -91,9 +91,11 @@ read_open_memory_internal(struct archive *a, const voi switch (level) { case 3: archive_read_set_seek_callback(a, memory_read_seek); + __LA_FALLTHROUGH; case 2: archive_read_set_open_callback(a, memory_read_open); archive_read_set_skip_callback(a, memory_read_skip); + __LA_FALLTHROUGH; case 1: mine = malloc(sizeof(*mine)); if (mine == NULL) { Modified: stable/11/contrib/libarchive/libarchive/test/test.h ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test.h Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/test/test.h Sat Feb 3 02:17:04 2018 (r328827) @@ -33,4 +33,10 @@ #define EXTRA_ERRNO(x) archive_errno((struct archive *)(x)) #define EXTRA_VERSION archive_version_details() +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #include "test_common.h" Modified: stable/11/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c Sat Feb 3 02:17:04 2018 (r328827) @@ -408,7 +408,9 @@ acl_flagset_to_bitmap(acl_flagset_t opaque_fs) {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, RICHACE_INHERIT_ONLY_ACE}, {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, RICHACE_INHERITED_ACE} #else /* FreeBSD NFSv4 ACL inheritance flags */ +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}, +#endif {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, Modified: stable/11/contrib/libarchive/libarchive/test/test_compat_zip.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_compat_zip.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/test/test_compat_zip.c Sat Feb 3 02:17:04 2018 (r328827) @@ -422,3 +422,29 @@ DEFINE_TEST(test_compat_zip_7) } free(p); } + +/** + * A file with backslash path separators instead of slashes. + * PowerShell's Compress-Archive cmdlet produces such archives. + */ +DEFINE_TEST(test_compat_zip_8) +{ + const char *refname = "test_compat_zip_8.zip"; + struct archive *a; + struct archive_entry *ae; + void *p; + size_t s; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_minimal(a, p, s, 7)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + /* This file is in the archive as arc\test */ + assertEqualString("arc/test", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + free(p); +} Copied: stable/11/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu (from r328332, head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu Sat Feb 3 02:17:04 2018 (r328827, copy of r328332, head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu) @@ -0,0 +1,6 @@ +begin 666 test_compat_zip_8.zip +M4$L#!!0````(`%A\;TOY6""D$`````X````(````87)C7'1E!BP$`4$L!`A0`%`````@`6'QO2_E8(*00````#@````@````````` +H`````````````&%R8UQT97-T4$L%!@`````!``$`-@```#8````````` +` +end Modified: stable/11/contrib/libarchive/libarchive/test/test_read_format_zip.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_read_format_zip.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/test/test_read_format_zip.c Sat Feb 3 02:17:04 2018 (r328827) @@ -41,6 +41,7 @@ verify_basic(struct archive *a, int seek_checks) int64_t o; assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 1.0 (uncompressed)", archive_format_name(a)); assertEqualString("dir/", archive_entry_pathname(ae)); assertEqualInt(1179604249, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_size(ae)); @@ -53,6 +54,7 @@ verify_basic(struct archive *a, int seek_checks) assertEqualInt((int)s, 0); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(1179604289, archive_entry_mtime(ae)); if (seek_checks) @@ -72,6 +74,7 @@ verify_basic(struct archive *a, int seek_checks) } assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file2", archive_entry_pathname(ae)); assertEqualInt(1179605932, archive_entry_mtime(ae)); assertEqualInt(archive_entry_is_encrypted(ae), 0); @@ -93,6 +96,7 @@ verify_basic(struct archive *a, int seek_checks) assert(archive_errno(a) != 0); } assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); /* Verify the number of files read. */ failure("the archive file has three files"); assertEqualInt(3, archive_file_count(a)); Modified: stable/11/contrib/libarchive/libarchive/test/test_write_disk_perms.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_write_disk_perms.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/libarchive/test/test_write_disk_perms.c Sat Feb 3 02:17:04 2018 (r328827) @@ -131,6 +131,8 @@ DEFINE_TEST(test_write_disk_perms) struct archive *a; struct archive_entry *ae; struct stat st; + uid_t original_uid; + uid_t try_to_change_uid; assertUmask(UMASK); @@ -200,6 +202,37 @@ DEFINE_TEST(test_write_disk_perms) assertEqualInt(0, stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); assertEqualInt(st.st_mode & 0777, 0744); + + /* For dir, the owner should get left when not overwritting. */ + assertMakeDir("dir_owner", 0744); + + if (getuid() == 0) { + original_uid = getuid() + 1; + try_to_change_uid = getuid(); + assertEqualInt(0, chown("dir_owner", original_uid, getgid())); + } else { + original_uid = getuid(); + try_to_change_uid = getuid() + 1; + } + + /* Check original owner. */ + assertEqualInt(0, stat("dir_owner", &st)); + failure("dir_owner: st.st_uid=%d", st.st_uid); + assertEqualInt(st.st_uid, original_uid); + /* Shouldn't try to edit the owner when no overwrite option is set. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir_owner"); + archive_entry_set_mode(ae, S_IFDIR | 0744); + archive_entry_set_uid(ae, try_to_change_uid); + archive_write_disk_set_options(a, + ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_NO_OVERWRITE); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); + /* Make sure they're unchanged. */ + assertEqualInt(0, stat("dir_owner", &st)); + failure("dir_owner: st.st_uid=%d", st.st_uid); + assertEqualInt(st.st_uid, original_uid); /* Write a regular file with SUID bit, but don't use _EXTRACT_PERM. */ assert((ae = archive_entry_new()) != NULL); Modified: stable/11/contrib/libarchive/tar/test/test_option_acls.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/test_option_acls.c Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/contrib/libarchive/tar/test/test_option_acls.c Sat Feb 3 02:17:04 2018 (r328827) @@ -85,7 +85,9 @@ static const acl_flag_t acl_flags[] = { ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_FAILED_ACCESS, +#ifdef ACL_ENTRY_INHERITED ACL_ENTRY_INHERITED +#endif #endif /* ARCHIVE_ACL_FREEBSD_NFS4 */ }; #endif /* ARCHIVE_ACL_DARWIN || ARCHIVE_ACL_FREEBSD_NFS4 */ Modified: stable/11/lib/libarchive/tests/Makefile ============================================================================== --- stable/11/lib/libarchive/tests/Makefile Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/lib/libarchive/tests/Makefile Sat Feb 3 02:17:04 2018 (r328827) @@ -372,6 +372,7 @@ ${PACKAGE}FILES+= test_compat_zip_4.zip.uu ${PACKAGE}FILES+= test_compat_zip_5.zip.uu ${PACKAGE}FILES+= test_compat_zip_6.zip.uu ${PACKAGE}FILES+= test_compat_zip_7.xps.uu +${PACKAGE}FILES+= test_compat_zip_8.zip.uu ${PACKAGE}FILES+= test_compat_zstd_1.tar.zst.uu ${PACKAGE}FILES+= test_fuzz.cab.uu ${PACKAGE}FILES+= test_fuzz.lzh.uu Modified: stable/11/usr.bin/bsdcat/tests/Makefile ============================================================================== --- stable/11/usr.bin/bsdcat/tests/Makefile Sat Feb 3 01:23:48 2018 (r328826) +++ stable/11/usr.bin/bsdcat/tests/Makefile Sat Feb 3 02:17:04 2018 (r328827) @@ -40,6 +40,7 @@ TESTS_SRCS= \ test_expand_xz.c \ test_expand_zstd.c \ test_help.c \ + test_stdin.c \ test_version.c SRCS.bsdcat_test= list.h \ From owner-svn-src-all@freebsd.org Sat Feb 3 09:15:14 2018 Return-Path: Delivered-To: svn-src-all@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 1725BED05B1; Sat, 3 Feb 2018 09:15:14 +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 B84617D769; Sat, 3 Feb 2018 09:15:13 +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 B0099BC6; Sat, 3 Feb 2018 09:15:13 +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 w139FD4r071695; Sat, 3 Feb 2018 09:15:13 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w139FDmr071693; Sat, 3 Feb 2018 09:15:13 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201802030915.w139FDmr071693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 3 Feb 2018 09:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328829 - in head/sys: conf geom/label X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head/sys: conf geom/label X-SVN-Commit-Revision: 328829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 09:15:14 -0000 Author: delphij Date: Sat Feb 3 09:15:13 2018 New Revision: 328829 URL: https://svnweb.freebsd.org/changeset/base/328829 Log: After r328426, g_label depends on UFS (option FFS) code to read UFS superblock, and the kernel will fail to link when UFS is not built in. This commit makes it depend on a small portion of FFS bits and thereby fixes build for this situation. This is intended as an interim bandaid, and the actual superblock reading code should probably be made independent of UFS, so we do not need to depend on it (see kib@'s comment in the review for details), and we will revisit this once the superblock check hashes are all in place. Differential Revision: https://reviews.freebsd.org/D14092 Modified: head/sys/conf/files head/sys/geom/label/g_label_ufs.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Feb 3 02:17:25 2018 (r328828) +++ head/sys/conf/files Sat Feb 3 09:15:13 2018 (r328829) @@ -4814,8 +4814,8 @@ ufs/ffs/ffs_balloc.c optional ffs ufs/ffs/ffs_inode.c optional ffs ufs/ffs/ffs_snapshot.c optional ffs ufs/ffs/ffs_softdep.c optional ffs -ufs/ffs/ffs_subr.c optional ffs -ufs/ffs/ffs_tables.c optional ffs +ufs/ffs/ffs_subr.c optional ffs | geom_label +ufs/ffs/ffs_tables.c optional ffs | geom_label ufs/ffs/ffs_vfsops.c optional ffs ufs/ffs/ffs_vnops.c optional ffs ufs/ffs/ffs_rawread.c optional ffs directio Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Sat Feb 3 02:17:25 2018 (r328828) +++ head/sys/geom/label/g_label_ufs.c Sat Feb 3 09:15:13 2018 (r328829) @@ -146,3 +146,5 @@ struct g_label_desc g_label_ufs_id = { G_LABEL_INIT(ufsid, g_label_ufs_id, "Create device nodes for UFS file system IDs"); G_LABEL_INIT(ufs, g_label_ufs_volume, "Create device nodes for UFS volume names"); + +MODULE_DEPEND(g_label, ufs, 1, 1, 1); From owner-svn-src-all@freebsd.org Sat Feb 3 09:43:32 2018 Return-Path: Delivered-To: svn-src-all@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 D968AED2CDE; Sat, 3 Feb 2018 09:43:32 +0000 (UTC) (envelope-from hselasky@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 8C2637E86C; Sat, 3 Feb 2018 09:43:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8721C109C; Sat, 3 Feb 2018 09:43:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w139hWXl086237; Sat, 3 Feb 2018 09:43:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w139hWj5086235; Sat, 3 Feb 2018 09:43:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802030943.w139hWj5086235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 3 Feb 2018 09:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328830 - in head/sys/dev/usb: . serial X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/usb: . serial X-SVN-Commit-Revision: 328830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 09:43:33 -0000 Author: hselasky Date: Sat Feb 3 09:43:32 2018 New Revision: 328830 URL: https://svnweb.freebsd.org/changeset/base/328830 Log: Add new USB ID. PR: 225641 Submitted by: Ryan MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Sat Feb 3 09:15:13 2018 (r328829) +++ head/sys/dev/usb/serial/uslcom.c Sat Feb 3 09:43:32 2018 (r328830) @@ -313,6 +313,7 @@ static const STRUCT_USB_HOST_ID uslcom_devs[] = { USLCOM_DEV(SILABS, EMS_C1007), USLCOM_DEV(SILABS, HAMLINKUSB), USLCOM_DEV(SILABS, HELICOM), + USLCOM_DEV(SILABS, HUBZ), USLCOM_DEV(SILABS, IMS_USB_RS422), USLCOM_DEV(SILABS, INFINITY_MIC), USLCOM_DEV(SILABS, INGENI_ZIGBEE), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sat Feb 3 09:15:13 2018 (r328829) +++ head/sys/dev/usb/usbdevs Sat Feb 3 09:43:32 2018 (r328830) @@ -4238,6 +4238,7 @@ product SILABS AC_SERV_CAN 0x8664 AC-Services CAN Inte product SILABS AC_SERV_OBD 0x8665 AC-Services OBD Interface product SILABS MMB_ZIGBEE 0x88a4 MMB Networks ZigBee product SILABS INGENI_ZIGBEE 0x88a5 Planet Innovation Ingeni ZigBee +product SILABS HUBZ 0x8a2a HubZ dual ZigBee and Z-Wave product SILABS CP2102 0xea60 SILABS USB UART product SILABS CP210X_2 0xea61 CP210x Serial product SILABS CP210X_3 0xea70 CP210x Serial From owner-svn-src-all@freebsd.org Sat Feb 3 15:09:35 2018 Return-Path: Delivered-To: svn-src-all@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 490CBECE35D; Sat, 3 Feb 2018 15:09:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 909236D254; Sat, 3 Feb 2018 15:09:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 9B9BFD4D298; Sun, 4 Feb 2018 01:46:31 +1100 (AEDT) Date: Sun, 4 Feb 2018 01:46:30 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Conrad Meyer cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327495 - head/usr.sbin/rpcbind In-Reply-To: <201801021725.w02HPDaj068477@repo.freebsd.org> Message-ID: <20180203232725.U1389@besplex.bde.org> References: <201801021725.w02HPDaj068477@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DIX/22Fb c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=YYKpOFubKEcKXeeIZhQA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 15:09:35 -0000 On Tue, 2 Jan 2018, Conrad Meyer wrote: > Log: > rpcbind: Fix race in signal termination I have yet to see any application that was correctly converted from using unsafe signal handlers to safe signal handlers that just set a flag. That is without even noticing this race problem before. > If a signal was delivered while the main thread was not in poll(2) and after > check was performed, we could reenter poll and never detect termination. Fix > this with the pipefd trick. (This race was introduced very recently, in > r327482.) poll() at least returns if the signal occurs after it is called. Most other syscalls related to i/o restart after a syscall when SA_RESTART is configured for the syscall. SA_RESTART is the default for BSD since handling EINTR after any syscall is too hard. Simple conversions from using unsafe conversions break i/o by not turning off SA_RESTART (top(1) and rpcbind(8) are examples -- details below). Unsimple conversions do turn off SA_RESTART but this is complicated and tends to give bugs (ping(8) is an example). This race bug shows that even turning off SA_RESTART doesn't help. Since it doesn't help, it just tends to gives bugs from its complications and shouldn't be used. Today I learned from the POSIX list that the pselect() function is designed to avoid this bug. It takes a signal mask arg (like msleep() in the kernel). The flag should only be checked while signals are masked, and signals must not be unmasked before making any syscall that might sleep, but applications rarely bother to mask signals before checking the flag, and there aren't many i/o functions that take a signal mask. I haven't noticed any function related to poll() or kevent that takes a signal mask. Programs broken by buggy conversion: - top(1). Run it interactively and type 's' followed by any non-null valid input (say '1'). Then try to abort it using ^C or ^\. Neither works, because read() restarts. You have to enter a newline to get read() to return. The flag is then checked and top exits with the bogus exit status 0 and no message. top still uses plain signal() so gets the default (SA_RESTART on BSD systems and possibly bugs from !SA_RESTART on non-BSD systems). Races on all systems when the signal arrives between checking the flag and calling read(). - rpcbind(8). This is not interactive and normally doesn't use ttys which might block. However, the -d flag makes it do fprintf() to stderr. This may block forever (e.g., for flow control), and you would like to be able to kill it using a signal. But write() will restart. rpcbind also uses plain signal() and doesn't know anything about SA_RESTART. - ping(8). This does know about SA_RESTART. However, turning off SA_RESTART gives lots of EINTRs that few BSD programs and libraries handle properly and fewer libraries document their handling. This caused hangs for some unreachable addresses. The resolver library handled EINTR (from select() IIRC) by restarting, so ^C didn't work. It is unclear if either returning or restarting after EINTR is correct in a library function. This was fixed long ago and I didn't know of any other similar bugs in ping. It would be hard to check all syscalls in ping and library functions that it calls. Now I know that there must be lots of races because turning off SA_RESTART doesn't really work. I used to think that correct conversion required only the following modest changes: - don't change SA_RESTART or otherwise fiddle with signal handling global - find all syscalls in the program and libraries that might block, and add turn off SA_RESTART around them. Possibly also change other signal handling locally. But this doesn't work since the race can be lost before making the syscalls. Next try: add timeouts using alarm() or itimers to every syscall that might block. I think this fixes the race before calling syscalls too. But this is too hard for most programs. I think it is best to try to write safe signal handlers. Unfortunately, APIs support this negatively. perror() is broken as designed since it uses stdio, so it is unsafe in signal handlers. The err() family copies this bug. Even *s*printf() is not required to be safe in signal handlers. I would fix the latter first. Then try to change the API of warn() and warnx() to be safe. err() can't be change since it has to keep calling exit(), but it is easy to use the safe warn() followed by _exit() stdio is avoided, and important to know that it is avoided. > ... > Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c > ============================================================================== > --- head/usr.sbin/rpcbind/rpcb_svc_com.c Tue Jan 2 16:50:57 2018 (r327494) > +++ head/usr.sbin/rpcbind/rpcb_svc_com.c Tue Jan 2 17:25:13 2018 (r327495) > .... > @@ -1130,23 +1133,26 @@ my_svc_run(void) > fprintf(stderr, ">\n"); > } > #endif > - switch (poll_ret = poll(pollfds, nfds, 30 * 1000)) { > + poll_ret = poll(pollfds, nfds, 30 * 1000); I think this is too specialized and complicated. poll() already has a timeout arg, so it doesn't need the separate timeout that seems to be needed for the general case. 30 seconds is just too long. Plain select() also has a timeout, and its granularity is much lower than poll()'s, so pselect() isn't essential for fixing the race. You just have to use a small timeout which reduces select() to busy-waiting if it is too small. 1 millisecond is usually too small, but 1 second seems reasonable for most cases. The timeout is only used after rarely-lost races unless it is small. > Modified: head/usr.sbin/rpcbind/rpcbind.c > ============================================================================== > --- head/usr.sbin/rpcbind/rpcbind.c Tue Jan 2 16:50:57 2018 (r327494) > +++ head/usr.sbin/rpcbind/rpcbind.c Tue Jan 2 17:25:13 2018 (r327495) > ... > @@ -761,8 +774,13 @@ rbllist_add(rpcprog_t prog, rpcvers_t vers, struct net > static void > terminate(int signum) > { > + char c = '\0'; > + ssize_t wr; > > doterminate = signum; > + wr = write(terminate_wfd, &c, 1); Not async-signal-safe. Acccesses in signal handlers to objects with static storage duration give undefined behaviour except for assignment to objects of type volatile sig_atomic_t, but the access to terminate_wfd is a read and the type is plain int. Using " " for the string would be equally unsafe (very safe in practice :-), but the function already does extra work to create the character array at runtime to avoid this. > + if (wr < 1) > + _exit(2); Best to not check for write errors, since the error handling of using _exit() is worse than none. It loses stdio flushing to handle an almost-harmless error. The main problem with keeping everything in a safe handler is that it is impossible to keep stdio flushing there and we would prefer to not lost the stdio flushing. > } Bruce From owner-svn-src-all@freebsd.org Sat Feb 3 19:31:30 2018 Return-Path: Delivered-To: svn-src-all@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 02647EE621D; Sat, 3 Feb 2018 19:31:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) (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 92FDB76F5B; Sat, 3 Feb 2018 19:31:29 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f180.google.com with SMTP id l17so26403049ioc.3; Sat, 03 Feb 2018 11:31:29 -0800 (PST) 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=Znj6mo+0x6INbwRZR5Tuja8o+VPGY7CdNJm0jaW1R3k=; b=kx3pIjG4KRV58l9G8ZJQjZ5Xx3+4dVLIU+eTw6pQygMjJkK+lJFXSO9MvKJNK85yic pBcGejIp8dPjpHmMqQIAxeHPPHmlmlHJwHEDJw0MwTOUpUM8ZJCYmp/IRBlUxxWDfVjZ 0KlFJ5u1Fky9s0VnB6dOU7EtsiQe4WMT5X98prmB7n2okNvCBaD80eS/Pt+aXs4GZHZA 5zYUAaSzuczDJPpwXwLCZkXqV0LjuZaPQgSLT49Ps1G7boURadoRZv5LEGHG7468wvca eyKF4NERlKgakMV6Y7Kw2aM9fuSi/4PdP4TpQWsNqzEe32qw5mbk1gkG4MevGOIERclm x+Wg== X-Gm-Message-State: AKwxytcb3aaZc5tBBGcDWYdw0yErLMT717zcP9rNr/y4u6xPP2NAOvtk MHyLSg6AXA7j6j5cV9fVG+Ga+aJe X-Google-Smtp-Source: AH8x225r9N0EHjA0hZKVhkScQ6haxTgGDqn7hlVSZ8l2C6W9NPAmHbMhCDX5lWp+yGsz2eR7tc+Qmg== X-Received: by 10.107.178.70 with SMTP id b67mr47140226iof.139.1517684915391; Sat, 03 Feb 2018 11:08:35 -0800 (PST) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com. [209.85.223.176]) by smtp.gmail.com with ESMTPSA id r137sm2795916ita.23.2018.02.03.11.08.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Feb 2018 11:08:35 -0800 (PST) Received: by mail-io0-f176.google.com with SMTP id l17so26369258ioc.3; Sat, 03 Feb 2018 11:08:34 -0800 (PST) X-Received: by 10.107.35.84 with SMTP id j81mr45492009ioj.226.1517684914385; Sat, 03 Feb 2018 11:08:34 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Sat, 3 Feb 2018 11:08:34 -0800 (PST) In-Reply-To: <20180203232725.U1389@besplex.bde.org> References: <201801021725.w02HPDaj068477@repo.freebsd.org> <20180203232725.U1389@besplex.bde.org> From: Conrad Meyer Date: Sat, 3 Feb 2018 11:08:34 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327495 - head/usr.sbin/rpcbind To: Bruce Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 19:31:30 -0000 On Sat, Feb 3, 2018 at 6:46 AM, Bruce Evans wrote: > On Tue, 2 Jan 2018, Conrad Meyer wrote: >> ... > Today I learned from the POSIX list that the pselect() function is designed > to avoid this bug. It takes a signal mask arg (like msleep() in the > kernel). > > I haven't noticed any function related to poll() or kevent that takes a > signal mask. There is the similar function ppoll(), although it complies only with the Linux standard, not POSIX. With kevent, you can simply mask all (or most) signals and watch on a signal event. Conversion to kevent is more complicated, though. > Programs broken by buggy conversion: > ... > - rpcbind(8). This is not interactive and normally doesn't use ttys > which might block. However, the -d flag makes it do fprintf() to > stderr. This may block forever (e.g., for flow control), and you > would like to be able to kill it using a signal. But write() will > restart. rpcbind also uses plain signal() and doesn't know anything > about SA_RESTART. This was not broken by conversion -- it was already broken in this case. If the signal delivery raced with an fprintf, we ended up invoking the stdio atexit handlers via exit(3) call in terminate(), which of course encountered corrupted state. Now it is broken in a slightly different way, yes, if signal delivery races fprintf *and* fprintf is blocked in flow control. This might happen with a slow serial for stderr but seems extraordinarily unlikely otherwise. > ... > But this is too hard for most programs. I think it is best to try to write > safe signal handlers. Unfortunately, APIs support this negatively. Agreed. The signal abstraction is pretty awful. I think the safest way to handle them is to block them entirely, then watch using kqueue()/kevent(). That way you never have to deal with signal context. But that kind of conversion is more work. You also have to deal with EINTR or be ok with blocking signal handling indefinitely. > perror() > is broken as designed since it uses stdio, so it is unsafe in signal > handlers. The err() family copies this bug. Even *s*printf() is not > required to be safe in signal handlers. I would fix the latter first. It does seem like the printf family of routines should be signal-handler safe. Unfortunately, they are implemented in terms of the unsafe stdio streams :-(. > Then > try to change the API of warn() and warnx() to be safe. err() can't be > change since it has to keep calling exit(), but it is easy to use the safe > warn() followed by _exit() stdio is avoided, and important to know that it > is avoided. That sounds nice. I'm on board with that. >> ... Non-functional change highlighted ... > > I think this is too specialized and complicated. > > ... > > 1 millisecond is usually too small, but 1 second seems reasonable for > most cases. The timeout is only used after rarely-lost races unless it > is small. Feel free to change it to 1s yourself, if you think it is important. >> Modified: head/usr.sbin/rpcbind/rpcbind.c >> >> ============================================================================== >> --- head/usr.sbin/rpcbind/rpcbind.c Tue Jan 2 16:50:57 2018 >> (r327494) >> +++ head/usr.sbin/rpcbind/rpcbind.c Tue Jan 2 17:25:13 2018 >> (r327495) >> ... >> @@ -761,8 +774,13 @@ rbllist_add(rpcprog_t prog, rpcvers_t vers, struct >> net >> static void >> terminate(int signum) >> { >> + char c = '\0'; >> + ssize_t wr; >> >> doterminate = signum; >> + wr = write(terminate_wfd, &c, 1); > > > Not async-signal-safe. Acccesses in signal handlers to objects with > static storage duration give undefined behaviour except for assignment to > objects of type volatile sig_atomic_t, but the access to terminate_wfd is > a read and the type is plain int. The type can be changed to volatile sig_atomic_t if you believe plain int will trigger nonsensical compiler behavior. The value is initialized once, before the signal handler is registered, so unless the compiler does something totally insane it should be fine on all architectures FreeBSD runs on. >> + if (wr < 1) >> + _exit(2); > > > Best to not check for write errors, since the error handling of using > _exit() > is worse than none. It loses stdio flushing to handle an almost-harmless > error. The main problem with keeping everything in a safe handler is that > it > is impossible to keep stdio flushing there and we would prefer to not lost > the stdio flushing. I don't necessarily agree. If the write fails, we missed the signal telling us to terminate the program and will never exit. That said, how would the write ever fail? Conrad From owner-svn-src-all@freebsd.org Sat Feb 3 20:50:46 2018 Return-Path: Delivered-To: svn-src-all@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 ACFF0EEB959; Sat, 3 Feb 2018 20:50:46 +0000 (UTC) (envelope-from eadler@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 630A57A4E1; Sat, 3 Feb 2018 20:50:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5E1A2101C6; Sat, 3 Feb 2018 20:50:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w13KokP0018538; Sat, 3 Feb 2018 20:50:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w13KokXM018537; Sat, 3 Feb 2018 20:50:46 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201802032050.w13KokXM018537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 3 Feb 2018 20:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328831 - head/share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/share/man/man3 X-SVN-Commit-Revision: 328831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 20:50:46 -0000 Author: eadler Date: Sat Feb 3 20:50:46 2018 New Revision: 328831 URL: https://svnweb.freebsd.org/changeset/base/328831 Log: pthread: adding missing header to man page Reported by: swildner@DragonFlyBSD.org Modified: head/share/man/man3/pthread_join.3 Modified: head/share/man/man3/pthread_join.3 ============================================================================== --- head/share/man/man3/pthread_join.3 Sat Feb 3 09:43:32 2018 (r328830) +++ head/share/man/man3/pthread_join.3 Sat Feb 3 20:50:46 2018 (r328831) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2010 +.Dd February 3, 2018 .Dt PTHREAD_JOIN 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .In pthread.h .Ft int .Fn pthread_join "pthread_t thread" "void **value_ptr" +.In pthread_np.h .Ft int .Fn pthread_timedjoin_np "pthread_t thread" "void **value_ptr" "const struct timespec *abstime" .Sh DESCRIPTION From owner-svn-src-all@freebsd.org Sat Feb 3 20:53:22 2018 Return-Path: Delivered-To: svn-src-all@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 409E5EEBD33; Sat, 3 Feb 2018 20:53:22 +0000 (UTC) (envelope-from eadler@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 E8C6A7A8FC; Sat, 3 Feb 2018 20:53:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E3BE010343; Sat, 3 Feb 2018 20:53:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w13KrLqJ022996; Sat, 3 Feb 2018 20:53:21 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w13KrL3Y022995; Sat, 3 Feb 2018 20:53:21 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201802032053.w13KrL3Y022995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 3 Feb 2018 20:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328832 - head/usr.sbin/newsyslog X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.sbin/newsyslog X-SVN-Commit-Revision: 328832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 20:53:22 -0000 Author: eadler Date: Sat Feb 3 20:53:21 2018 New Revision: 328832 URL: https://svnweb.freebsd.org/changeset/base/328832 Log: newsyslog: fix typeo for 'zstd' Reported by: swildner@DragonFlyBSD.org MFC After: 1 week Modified: head/usr.sbin/newsyslog/newsyslog.8 Modified: head/usr.sbin/newsyslog/newsyslog.8 ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.8 Sat Feb 3 20:50:46 2018 (r328831) +++ head/usr.sbin/newsyslog/newsyslog.8 Sat Feb 3 20:53:21 2018 (r328832) @@ -17,7 +17,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd May 19, 2017 +.Dd February 3, 2018 .Dt NEWSYSLOG 8 .Os .Sh NAME @@ -289,7 +289,7 @@ accepted for backwards compatibility. .Xr bzip2 1 , .Xr gzip 1 , .Xr xz 1 , -.Xr zst 1 , +.Xr zstd 1 , .Xr syslog 3 , .Xr newsyslog.conf 5 , .Xr chown 8 , From owner-svn-src-all@freebsd.org Sat Feb 3 21:56:39 2018 Return-Path: Delivered-To: svn-src-all@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 8FFDEEEFD7F; Sat, 3 Feb 2018 21:56: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 41B267CF1D; Sat, 3 Feb 2018 21:56: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 3738A10CFD; Sat, 3 Feb 2018 21:56: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 w13LudcS053859; Sat, 3 Feb 2018 21:56:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w13LudI6053858; Sat, 3 Feb 2018 21:56:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802032156.w13LudI6053858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 3 Feb 2018 21:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328833 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 328833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 21:56:39 -0000 Author: imp Date: Sat Feb 3 21:56:38 2018 New Revision: 328833 URL: https://svnweb.freebsd.org/changeset/base/328833 Log: Fix backward conditional. Pointed out by: david boyer Modified: head/tools/tools/nanobsd/legacy.sh Modified: head/tools/tools/nanobsd/legacy.sh ============================================================================== --- head/tools/tools/nanobsd/legacy.sh Sat Feb 3 20:53:21 2018 (r328832) +++ head/tools/tools/nanobsd/legacy.sh Sat Feb 3 21:56:38 2018 (r328833) @@ -29,8 +29,8 @@ # # Media geometry, only relevant if bios doesn't understand LBA. -[ -z "$NANO_SECTS" ] || NANO_SECTS=63 -[ -z "$NANO_HEADS" ] || NANO_HEADS=16 +[ -n "$NANO_SECTS" ] || NANO_SECTS=63 +[ -n "$NANO_HEADS" ] || NANO_HEADS=16 # Functions and variable definitions used by the legacy nanobsd # image building system. From owner-svn-src-all@freebsd.org Sat Feb 3 23:14:13 2018 Return-Path: Delivered-To: svn-src-all@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 1C00AECE0DA; Sat, 3 Feb 2018 23:14:13 +0000 (UTC) (envelope-from marius@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 BFCDC80734; Sat, 3 Feb 2018 23:14:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA9DB119E3; Sat, 3 Feb 2018 23:14:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w13NECMU094443; Sat, 3 Feb 2018 23:14:12 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w13NEBvp094430; Sat, 3 Feb 2018 23:14:11 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201802032314.w13NEBvp094430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 3 Feb 2018 23:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328834 - in head: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/aarch64 libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/mips libexec/rtld-el... X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in head: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/aarch64 libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-el... X-SVN-Commit-Revision: 328834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 23:14:13 -0000 Author: marius Date: Sat Feb 3 23:14:11 2018 New Revision: 328834 URL: https://svnweb.freebsd.org/changeset/base/328834 Log: o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers. o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h. o Sprinkle nitems(). Modified: head/lib/libc/sparc64/sys/__sparc_utrap_setup.c head/libexec/rtld-elf/aarch64/reloc.c head/libexec/rtld-elf/amd64/reloc.c head/libexec/rtld-elf/arm/reloc.c head/libexec/rtld-elf/i386/reloc.c head/libexec/rtld-elf/mips/reloc.c head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc64/reloc.c head/libexec/rtld-elf/riscv/reloc.c head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/libexec/rtld-elf/sparc64/reloc.c Modified: head/lib/libc/sparc64/sys/__sparc_utrap_setup.c ============================================================================== --- head/lib/libc/sparc64/sys/__sparc_utrap_setup.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/lib/libc/sparc64/sys/__sparc_utrap_setup.c Sat Feb 3 23:14:11 2018 (r328834) @@ -29,13 +29,11 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include -#include - #include "__sparc_utrap_private.h" static const struct sparc_utrap_args ua[] = { @@ -47,10 +45,10 @@ static const struct sparc_utrap_args ua[] = { }; static const struct sparc_utrap_install_args uia[] = { - { sizeof (ua) / sizeof (*ua), ua } + { nitems(ua), ua } }; -void __sparc_utrap_setup(void) __attribute__((constructor)); +void __sparc_utrap_setup(void); void __sparc_utrap_setup(void) Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/aarch64/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -306,6 +306,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } /* Modified: head/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- head/libexec/rtld-elf/amd64/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/amd64/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -487,6 +487,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { /* Modified: head/libexec/rtld-elf/arm/reloc.c ============================================================================== --- head/libexec/rtld-elf/arm/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/arm/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -478,6 +478,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: head/libexec/rtld-elf/i386/reloc.c ============================================================================== --- head/libexec/rtld-elf/i386/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/i386/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -473,6 +473,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { void* tls; Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/mips/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -745,6 +745,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/powerpc/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -628,6 +628,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/powerpc64/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -533,6 +533,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: head/libexec/rtld-elf/riscv/reloc.c ============================================================================== --- head/libexec/rtld-elf/riscv/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/riscv/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -368,6 +368,13 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/rtld.c Sat Feb 3 23:14:11 2018 (r328834) @@ -755,6 +755,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr obj_main->fini_array = (Elf_Addr)NULL; } + /* + * Execute MD initializers required before we call the objects' + * init functions. + */ + pre_init(); + wlock_acquire(rtld_bind_lock, &lockstate); if (obj_main->crt_no_init) preinit_main(); Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/rtld.h Sat Feb 3 23:14:11 2018 (r328834) @@ -374,8 +374,6 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_lo unsigned long elf_hash(const char *); const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); -void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]); -void init_pltgot(Obj_Entry *); void lockdflt_init(void); void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr); Obj_Entry *globallist_curr(const Obj_Entry *obj); @@ -405,6 +403,9 @@ int reloc_plt(Obj_Entry *); int reloc_jmpslots(Obj_Entry *, int flags, struct Struct_RtldLockState *); int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); int reloc_gnu_ifunc(Obj_Entry *, int flags, struct Struct_RtldLockState *); +void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]); +void pre_init(void); +void init_pltgot(Obj_Entry *); void allocate_initial_tls(Obj_Entry *); #endif /* } */ Modified: head/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/sparc64/reloc.c Sat Feb 3 21:56:38 2018 (r328833) +++ head/libexec/rtld-elf/sparc64/reloc.c Sat Feb 3 23:14:11 2018 (r328834) @@ -367,8 +367,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *re * Note: R_SPARC_TLS_TPOFF64 must be the numerically largest * relocation type. */ - if (type >= sizeof(reloc_target_bitmask) / - sizeof(*reloc_target_bitmask)) { + if (type >= nitems(reloc_target_bitmask)) { _rtld_error("%s: Unsupported relocation type %d in non-PLT " "object\n", obj->path, type); return (-1); @@ -793,8 +792,18 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + } +extern void __sparc_utrap_setup(void); + +void +pre_init(void) +{ + + __sparc_utrap_setup(); +} + /* * Install rtld function call into this PLT slot. */ @@ -823,6 +832,7 @@ init_pltgot(Obj_Entry *obj) static void install_plt(Elf_Word *pltgot, Elf_Addr proc) { + pltgot[0] = SAVE; flush(pltgot, 0); pltgot[1] = SETHI_l0 | HIVAL(proc, 42); From owner-svn-src-all@freebsd.org Sat Feb 3 23:49:23 2018 Return-Path: Delivered-To: svn-src-all@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 E1C56ED3179; Sat, 3 Feb 2018 23:49:22 +0000 (UTC) (envelope-from nwhitehorn@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 8B26D81B30; Sat, 3 Feb 2018 23:49:22 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8555011EB9; Sat, 3 Feb 2018 23:49:22 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w13NnMCS009792; Sat, 3 Feb 2018 23:49:22 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w13NnLIN009785; Sat, 3 Feb 2018 23:49:21 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201802032349.w13NnLIN009785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 3 Feb 2018 23:49:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328835 - in head/stand: ofw/common ofw/libofw powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: in head/stand: ofw/common ofw/libofw powerpc/ofw X-SVN-Commit-Revision: 328835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2018 23:49:23 -0000 Author: nwhitehorn Date: Sat Feb 3 23:49:21 2018 New Revision: 328835 URL: https://svnweb.freebsd.org/changeset/base/328835 Log: Fix regression introduced in r328806, preventing boot at least on all PowerPC Apple hardware, and likely all Open Firmware systems. The loader would allocate memory for its heap at whatever address Open Firmware gave it, which would in general be the lowest unallocated address, usually starting a page or two above 0. As the kernel is linked at 1 MB, and loader insists on running the kernel at its link address, any heap larger than 1 MB would overlap the kernel, causing loader memory allocations to corrupt the kernel and vice versa. Although r328806 made this problem much worse by increasing the heap size to 8 MB, causing 88% of the loader heap to overlap with the kernel, the problem has always existed. The old heap size was 1 MB and, unless that started exactly at zero, which would cause other problems, some number of pages of the loader heap still overlapped with the kernel. This patch solves the issue in two ways and cleans up some related code: - Moves the loader heap inside of the loader. This guarantees that the heap will be contiguous with the loader and simplifies the heap allocation code at no cost, since the heap lives in BSS. - Moves the loader, previously at 28 MB and dangerously close to the kernel it loads, a bit higher to 44 MB. This has the effect of breaking loader on non-embedded PPC machines with < 48 MB of RAM, but we did not support those anyway. The fundamental problem is that the way loader loads ELF files is incredibly fragile, but that can't be fixed without fundamental architectural changes. MFC after: 10 days Modified: head/stand/ofw/common/main.c head/stand/ofw/libofw/elf_freebsd.c head/stand/ofw/libofw/libofw.h head/stand/ofw/libofw/ofw_copy.c head/stand/ofw/libofw/ofw_memory.c head/stand/ofw/libofw/ppc64_elf_freebsd.c head/stand/powerpc/ofw/ldscript.powerpc Modified: head/stand/ofw/common/main.c ============================================================================== --- head/stand/ofw/common/main.c Sat Feb 3 23:14:11 2018 (r328834) +++ head/stand/ofw/common/main.c Sat Feb 3 23:49:21 2018 (r328835) @@ -43,22 +43,16 @@ u_int32_t acells, scells; static char bootargs[128]; #define HEAP_SIZE 0x800000 +static char heap[HEAP_SIZE]; // In BSS, so uses no space #define OF_puts(fd, text) OF_write(fd, text, strlen(text)) void init_heap(void) { - void *base; - ihandle_t stdout; + bzero(heap, HEAP_SIZE); - if ((base = ofw_alloc_heap(HEAP_SIZE)) == (void *)0xffffffff) { - OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); - OF_puts(stdout, "Heap memory claim failed!\n"); - OF_enter(); - } - - setheap(base, (void *)((int)base + HEAP_SIZE)); + setheap(heap, (void *)((int)heap + HEAP_SIZE)); } uint64_t Modified: head/stand/ofw/libofw/elf_freebsd.c ============================================================================== --- head/stand/ofw/libofw/elf_freebsd.c Sat Feb 3 23:14:11 2018 (r328834) +++ head/stand/ofw/libofw/elf_freebsd.c Sat Feb 3 23:49:21 2018 (r328835) @@ -87,7 +87,6 @@ __elfN(ofw_exec)(struct preloaded_file *fp) printf("Kernel entry at 0x%lx ...\n", e->e_entry); dev_cleanup(); - ofw_release_heap(); if (dtbp != 0) { OF_quiesce(); ((int (*)(u_long, u_long, u_long, void *, u_long))entry)(dtbp, 0, 0, Modified: head/stand/ofw/libofw/libofw.h ============================================================================== --- head/stand/ofw/libofw/libofw.h Sat Feb 3 23:14:11 2018 (r328834) +++ head/stand/ofw/libofw/libofw.h Sat Feb 3 23:49:21 2018 (r328835) @@ -58,8 +58,6 @@ extern int ofw_boot(void); extern int ofw_autoload(void); void ofw_memmap(int); -void *ofw_alloc_heap(unsigned int); -void ofw_release_heap(void); struct preloaded_file; struct file_format; Modified: head/stand/ofw/libofw/ofw_copy.c ============================================================================== --- head/stand/ofw/libofw/ofw_copy.c Sat Feb 3 23:14:11 2018 (r328834) +++ head/stand/ofw/libofw/ofw_copy.c Sat Feb 3 23:49:21 2018 (r328835) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #define READIN_BUF (4 * 1024) #define PAGE_SIZE 0x1000 #define PAGE_MASK 0x0fff -#define MAPMEM_PAGE_INC 16 +#define MAPMEM_PAGE_INC 128 /* Half-MB at a time */ #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) Modified: head/stand/ofw/libofw/ofw_memory.c ============================================================================== --- head/stand/ofw/libofw/ofw_memory.c Sat Feb 3 23:14:11 2018 (r328834) +++ head/stand/ofw/libofw/ofw_memory.c Sat Feb 3 23:49:21 2018 (r328835) @@ -35,9 +35,6 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "openfirm.h" -static void *heap_base = NULL; -static unsigned int heap_size = 0; - struct ofw_mapping { vm_offset_t va; int len; @@ -115,32 +112,3 @@ ofw_memmap(int acells) pager_close(); } -void * -ofw_alloc_heap(unsigned int size) -{ - phandle_t memoryp, root; - cell_t available[4]; - cell_t acells; - - root = OF_finddevice("/"); - acells = 1; - OF_getprop(root, "#address-cells", &acells, sizeof(acells)); - - memoryp = OF_instance_to_package(memory); - OF_getprop(memoryp, "available", available, sizeof(available)); - - heap_base = OF_claim((void *)available[acells-1], size, - sizeof(register_t)); - - if (heap_base != (void *)-1) { - heap_size = size; - } - - return (heap_base); -} - -void -ofw_release_heap(void) -{ - OF_release(heap_base, heap_size); -} Modified: head/stand/ofw/libofw/ppc64_elf_freebsd.c ============================================================================== --- head/stand/ofw/libofw/ppc64_elf_freebsd.c Sat Feb 3 23:14:11 2018 (r328834) +++ head/stand/ofw/libofw/ppc64_elf_freebsd.c Sat Feb 3 23:49:21 2018 (r328835) @@ -90,7 +90,6 @@ ppc64_ofw_elf_exec(struct preloaded_file *fp) printf("Kernel entry at 0x%lx ...\n", entry); dev_cleanup(); - ofw_release_heap(); if (dtbp != 0) { OF_quiesce(); Modified: head/stand/powerpc/ofw/ldscript.powerpc ============================================================================== --- head/stand/powerpc/ofw/ldscript.powerpc Sat Feb 3 23:14:11 2018 (r328834) +++ head/stand/powerpc/ofw/ldscript.powerpc Sat Feb 3 23:49:21 2018 (r328835) @@ -9,7 +9,7 @@ PROVIDE (__stack = 0); SECTIONS { /* Read-only sections, merged into text segment: */ - . = 0x01c00000 + SIZEOF_HEADERS; + . = 0x02c00000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) }