From owner-svn-src-head@freebsd.org  Sun Jan 28 00:08:32 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <brde@optusnet.com.au>
X-X-Sender: bde@besplex.bde.org
To: Ian Lepore <ian@freebsd.org>
cc: Conrad Meyer <cem@freebsd.org>, Pedro Giffuni <pfg@freebsd.org>, 
 src-committers <src-committers@freebsd.org>, 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> 
 <CAG6CVpUOxtE9p8OApL6LsUJWh5tTM_9647M0qe5VNSnTTSEvQw@mail.gmail.com> 
 <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> 
 <CAG6CVpXXUSPwUsxqXhJBfq_f-FwFAWXO4uQu4f2evWet90fBNg@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <stdbool.h>, 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-head@freebsd.org  Sun Jan 28 00:48:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D1EAECE8AC
 for <svn-src-head@mailman.ysv.freebsd.org>;
 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 D90F782BD1
 for <svn-src-head@freebsd.org>; 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 <ian@freebsd.org>, Conrad Meyer <cem@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801271743.w0RHh9io022619@repo.freebsd.org>
 <CAG6CVpUOxtE9p8OApL6LsUJWh5tTM_9647M0qe5VNSnTTSEvQw@mail.gmail.com>
 <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org>
 <CAG6CVpXXUSPwUsxqXhJBfq_f-FwFAWXO4uQu4f2evWet90fBNg@mail.gmail.com>
 <1517094539.1517.9.camel@freebsd.org>
From: Pedro Giffuni <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 00:50:12 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C831ECEA08
 for <svn-src-head@mailman.ysv.freebsd.org>;
 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 C164B82D4B
 for <svn-src-head@freebsd.org>; 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 <brde@optusnet.com.au>, Dimitry Andric <dim@freebsd.org>
Cc: Ed Schouten <ed@nuxi.nl>, src-committers <src-committers@freebsd.org>,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201801272216.w0RMGJwo057492@repo.freebsd.org>
 <CABh_MKn=3pRWyMHUAQkG17dQVBFEwFA2esFixPtgkCt7VE5oCw@mail.gmail.com>
 <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org>
 <20180128093811.G4029@besplex.bde.org>
From: Pedro Giffuni <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <ed@nuxi.nl> wrote:
>>>
>>> 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni <pfg@freebsd.org>:
>>>>        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-head@freebsd.org  Sun Jan 28 01:22:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 01:42:47 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <brde@optusnet.com.au>
X-X-Sender: bde@besplex.bde.org
To: Pedro Giffuni <pfg@freebsd.org>
cc: Bruce Evans <brde@optusnet.com.au>, Dimitry Andric <dim@freebsd.org>, 
 Ed Schouten <ed@nuxi.nl>, src-committers <src-committers@freebsd.org>, 
 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>
 <CABh_MKn=3pRWyMHUAQkG17dQVBFEwFA2esFixPtgkCt7VE5oCw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <ed@nuxi.nl> 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-head@freebsd.org  Sun Jan 28 03:16:55 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 02:26:11 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Mariusz Zaborski <oshogbo@FreeBSD.org>
cc: Cy Schubert <Cy.Schubert@cschubert.com>, 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 <oshogbo@FreeBSD.org>
 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.



From owner-svn-src-head@freebsd.org  Sun Jan 28 02:27:55 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F778ED3055
 for <svn-src-head@mailman.ysv.freebsd.org>;
 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 E672686A6D
 for <svn-src-head@freebsd.org>; 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 <brde@optusnet.com.au>
Cc: Dimitry Andric <dim@freebsd.org>, Ed Schouten <ed@nuxi.nl>,
 src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801272216.w0RMGJwo057492@repo.freebsd.org>
 <CABh_MKn=3pRWyMHUAQkG17dQVBFEwFA2esFixPtgkCt7VE5oCw@mail.gmail.com>
 <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 <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <ed@nuxi.nl> 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-head@freebsd.org  Sun Jan 28 03:07:23 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 05:13:18 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Jan 27 21:51:25 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A2B3EC4D4A
 for <svn-src-head@mailman.ysv.freebsd.org>;
 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 316237B622
 for <svn-src-head@freebsd.org>; Sat, 27 Jan 2018 21:51:23 +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 <ian@freebsd.org>
To: rgrimes@freebsd.org, Emmanuel Vadot <manu@bidouilliste.com>
Cc: Adrian Chadd <adrian.chadd@gmail.com>, Poul-Henning Kamp
 <phk@phk.freebsd.dk>, Warner Losh <imp@bsdimp.com>, John Baldwin
 <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>, src-committers
 <src-committers@freebsd.org>, 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:47 +0000
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <adrian.chadd@gmail.com> 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-head@freebsd.org  Sat Jan 27 21:52:55 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <manu@bidouilliste.com>
To: rgrimes@freebsd.org
Cc: "Rodney W. Grimes" <freebsd@pdx.rh.CN85.dnsmgr.net>, Adrian Chadd
 <adrian.chadd@gmail.com>, Poul-Henning Kamp <phk@phk.freebsd.dk>, Warner
 Losh <imp@bsdimp.com>, John Baldwin <jhb@freebsd.org>, Ravi Pokala
 <rpokala@mac.com>, src-committers <src-committers@freebsd.org>,
 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:48 +0000
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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" <freebsd@pdx.rh.CN85.dnsmgr.net> wrote:

> > On Sat, 27 Jan 2018 12:13:57 -0800
> > Adrian Chadd <adrian.chadd@gmail.com> 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 <manu@bidouilliste.com> <manu@freebsd.org>
> 
> -- 
> Rod Grimes                                                 rgrimes@freebsd.org


-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>

From owner-svn-src-head@freebsd.org  Sun Jan 28 05:13:09 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 05:45:21 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <eadler@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 01:29:46 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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>
 <CABkgQk8eYpqGsJv-BWdsinQFW2FueHfmCuptBbBuJSv+w-24rA@mail.gmail.com>
 <20180127113348.GY55707@kib.kiev.ua>
From: Dexuan-BSD Cui <dexuan.bsd@gmail.com>
Date: Sat, 27 Jan 2018 17:29:43 -0800
Message-ID: <CABkgQk9+oodYS_pLTij1QNkDj3P737F+qb5-dtkoVC1_kB1u0w@mail.gmail.com>
Subject: Re: svn commit: r328166 - in head/sys: amd64/amd64 x86/include x86/x86
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: Ed Maste <emaste@freebsd.org>, markj@freebsd.org, cem@freebsd.org, 
 Mitchell Horne <mhorne063@gmail.com>, 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:44 +0000
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jan 2018 01:29:46 -0000

On Sat, Jan 27, 2018 at 3:33 AM, Konstantin Belousov
<kostikbel@gmail.com> 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-head@freebsd.org  Sun Jan 28 15:02:50 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mmel@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 15:33:33 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mmel@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 15:20:46 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mmel@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 16:10:41 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <dim@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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<bool> 
   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-head@freebsd.org  Sun Jan 28 16:51:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <cem@FreeBSD.org>
cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
From: Mike Karels <mike@karels.net>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <n.deepak at gmail.com>

> 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-head@freebsd.org  Sun Jan 28 17:25:50 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0CE0ED3D74
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Sun, 28 Jan 2018 17:25:49 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: from mail-it0-x231.google.com (mail-it0-x231.google.com
 [IPv6:2607:f8b0:4001:c0b::231])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 6565B86872
 for <svn-src-head@freebsd.org>; Sun, 28 Jan 2018 17:25:49 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: by mail-it0-x231.google.com with SMTP id x128so5658197ite.0
 for <svn-src-head@freebsd.org>; 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=mpiInzooAXHuYDVcsZD3pzlwC6AaGnOyWXMZnwDVQkFdZyIJvAxJ92zoknf1KUEWF2
 HPiEw64Xa77UUA4tCVZJMuk9MRyg3UI89sYM9bKl6M8KRnZCyOnNgbOK/Zd1ljadt/vK
 HMxnQwf98MhZrfUlvOzzzg1WuMWmNvOI14Q7QO6opEtpflc2zHMmFFEL1p4BnlB3Yfah
 CC8jHmnB728MCrL0cFo3EFAdb8qv8Exjs/34P1jt2s9IsYTZk1V1JR0DOstTo8nlPRho
 6UsVYETz+au7pWcCsAcq588QNcHhOA8DaQTcLPGRPcV263HaC3o4UMMyjJsXi/o/wbf6
 VflQ==
X-Gm-Message-State: AKwxytftSqbmuz7qHCeFzU25KobYHfOTb90hIHj1n8WMJnwB945l9lQE
 cgNr2CnJyTuQbZkyliugggRnUfBvn+uB6SSuZYbAgA==
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 <imp@bsdimp.com>
Date: Sun, 28 Jan 2018 10:25:47 -0700
X-Google-Sender-Auth: yz80A7AinFKxBpTHpN63lrYDBfA
Message-ID: <CANCZdfrCDHaUMLOof75+eJz=h4feqMUOus73ymkh+e06KnybTw@mail.gmail.com>
Subject: Re: ps output line length (was: svn commit: r314685 - head/bin/ps)
To: Mike Karels <mike@karels.net>
Cc: "Conrad E. Meyer" <cem@freebsd.org>,
 src-committers <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jan 2018 17:25:50 -0000

On Jan 28, 2018 9:51 AM, "Mike Karels" <mike@karels.net> 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 <n.deepak at gmail.com>

> 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-head@freebsd.org  Sun Jan 28 18:18:04 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mav@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 18:35:02 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <manu@bidouilliste.com>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: Warner Losh <imp@bsdimp.com>, John Baldwin <jhb@freebsd.org>, Ravi
 Pokala <rpokala@mac.com>, src-committers <src-committers@freebsd.org>,
 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>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <manu@bidouilliste.com> <manu@freebsd.org>

From owner-svn-src-head@freebsd.org  Sun Jan 28 19:18:41 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhibbits@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 19:37:31 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 20:04:38 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201801260058.w0Q0wXXP097695@repo.freebsd.org>
From: Xin Li <delphij@delphij.net>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <delphij@delphij.net>
Reply-To: d@delphij.net
To: Kirk McKusick <mckusick@FreeBSD.org>, 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-head@freebsd.org  Sun Jan 28 20:35:49 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhibbits@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 21:01:22 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <93949.1516733748@critter.freebsd.dk>
 <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com>
 <72042.1517094867@critter.freebsd.dk>
 <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org>
From: Adrian Chadd <adrian.chadd@gmail.com>
Date: Sun, 28 Jan 2018 13:01:19 -0800
Message-ID: <CAJ-Vmok_Xk18YOBvnY1QAO2z_Y6ub=aZiTeEVyJdBu=57pHe5A@mail.gmail.com>
Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm
 modules
To: Emmanuel Vadot <manu@bidouilliste.com>
Cc: Poul-Henning Kamp <phk@phk.freebsd.dk>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, 
 Ravi Pokala <rpokala@mac.com>, src-committers <src-committers@freebsd.org>,
 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 21:11:07 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0325EDF551
 for <svn-src-head@mailman.ysv.freebsd.org>;
 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 352A56EAD9
 for <svn-src-head@freebsd.org>; Sun, 28 Jan 2018 21:11:07 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: by mail-it0-x236.google.com with SMTP id w14so7077363itc.3
 for <svn-src-head@freebsd.org>; 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=S6WtK6bZTfLJIgu3xY3iOhwtoVA30ert1lyw34EtNnUjsper34iS4R1u0gHlmphQ3n
 Sfnm+Xagjm0e9wibV63vhsidrA53uY7sEzvpuXqHd2vAuiRf+lx8lAhHEE6ROf66eqwJ
 l03atZ0/Wvw0ovpyLgI9QAaDqQBpQGXTi8gkg+gop6HMMVBX2bn70Gs9LfGI864fL9b8
 BKmYepfnF+9e7tRj8Zyk/PzcC4xLt5vRzaNDTNQA+sGpk10/vGRT93Nsw9Fl0Tv4Pwip
 VMuKatMVfXQ7mjC4Bt0FJVa7g/++8W9oJ0U2EAuZEUMu78NfME08k5LRqtgc2pt/A7Vg
 fUkQ==
X-Gm-Message-State: AKwxyteFJKOsgMurZMAVf7V3UDnDzES98p29KBGWnNR7y5szVn0Sw7Aq
 CGtGkta/vc0srWK8G5hKr7JyT/J3ZOqKzbnlYOJ6Jg==
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: <CAJ-Vmok_Xk18YOBvnY1QAO2z_Y6ub=aZiTeEVyJdBu=57pHe5A@mail.gmail.com>
References: <201801220710.w0M7AUm9091853@repo.freebsd.org>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <93949.1516733748@critter.freebsd.dk>
 <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com>
 <72042.1517094867@critter.freebsd.dk>
 <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org>
 <CAJ-Vmok_Xk18YOBvnY1QAO2z_Y6ub=aZiTeEVyJdBu=57pHe5A@mail.gmail.com>
From: Warner Losh <imp@bsdimp.com>
Date: Sun, 28 Jan 2018 14:11:05 -0700
X-Google-Sender-Auth: XWJbiozyd66xGjXFdx-85gmoyLs
Message-ID: <CANCZdfqSWQ_=gDVnN5TZOGzqsgeNc88-xQ1=e3neuse-1XLotQ@mail.gmail.com>
Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm
 modules
To: Adrian Chadd <adrian.chadd@gmail.com>
Cc: Emmanuel Vadot <manu@bidouilliste.com>,
 Poul-Henning Kamp <phk@phk.freebsd.dk>, 
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>, 
 src-committers <src-committers@freebsd.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jan 2018 21:11:08 -0000

On Sun, Jan 28, 2018 at 2:01 PM, Adrian Chadd <adrian.chadd@gmail.com>
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-head@freebsd.org  Sun Jan 28 21:21:18 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98711EDFC09
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Sun, 28 Jan 2018 21:21:18 +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 B18296F193
 for <svn-src-head@freebsd.org>; Sun, 28 Jan 2018 21:21:17 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: by mail-it0-x22f.google.com with SMTP id k131so6032314ith.4
 for <svn-src-head@freebsd.org>; 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=cJgyjrG7++iG/A0gaG9/EaarInUXvIkLnNu56L3bKyV+BIBfjANQwMWrU+p71X6dWw
 Fq+zL2KyaTMeKX74+vUM/r37DqO6c0paM4PiRK1iF6lNzU70O5QcAvCqyZx38vTOuczc
 uKJOOEDfnDWyOzqOKs2m52pEC7qFqFffyOcDT5yeup9U80pHBt9Mpw2vYzkQcrSfO4fw
 rMoUp0IiBMEtwhEkPn1RxiU9H+pi1LOVtnIMk1JzJEqvjGSCQ8StceXG1cUXeI/oMjLd
 fGyxbCwKqIDNDZbbKeskjAxwAfdKg1NjM38brojTLF+czqIXVAL6yPAuh5fbmT9ytsUG
 E0Mg==
X-Gm-Message-State: AKwxytfU2wstLQxm4Skk5vvJPl0Nwwe04K8Tv05Uo/gxoFFpiLAt0Arn
 ttO23jaTi0OA1w0hKRtwQmIPH7lBeqfP4PprFfOkZw==
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>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <93949.1516733748@critter.freebsd.dk>
 <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com>
 <72042.1517094867@critter.freebsd.dk>
 <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org>
From: Warner Losh <imp@bsdimp.com>
Date: Sun, 28 Jan 2018 14:21:16 -0700
X-Google-Sender-Auth: xiUC-ub-Zjb1mMT26WZ8gm_ub6Y
Message-ID: <CANCZdfpkbKUGos8QV-JhJ39KhQTzG_k3QLoUQdrwUTnMS7W7Pw@mail.gmail.com>
Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm
 modules
To: Emmanuel Vadot <manu@bidouilliste.com>
Cc: Poul-Henning Kamp <phk@phk.freebsd.dk>, John Baldwin <jhb@freebsd.org>,
 Ravi Pokala <rpokala@mac.com>, 
 src-committers <src-committers@freebsd.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jan 2018 21:21:18 -0000

On Sun, Jan 28, 2018 at 10:34 AM, Emmanuel Vadot <manu@bidouilliste.com>
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-head@freebsd.org  Sun Jan 28 21:30:59 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <nwhitehorn@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 22:52:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <manu@bidouilliste.com>
cc: Warner Losh <imp@bsdimp.com>, John Baldwin <jhb@freebsd.org>,
 Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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" <phk@phk.freebsd.dk>
References: <201801220710.w0M7AUm9091853@repo.freebsd.org>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sun Jan 28 23:00:02 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@bsdimp.com>
cc: Adrian Chadd <adrian.chadd@gmail.com>,
 Emmanuel Vadot <manu@bidouilliste.com>, John Baldwin <jhb@freebsd.org>,
 Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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: <CANCZdfqSWQ_=gDVnN5TZOGzqsgeNc88-xQ1=e3neuse-1XLotQ@mail.gmail.com>
From: "Poul-Henning Kamp" <phk@phk.freebsd.dk>
References: <201801220710.w0M7AUm9091853@repo.freebsd.org>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <93949.1516733748@critter.freebsd.dk>
 <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com>
 <72042.1517094867@critter.freebsd.dk>
 <8d8ae9d10058fd72ce3ec467181c9f22@megadrive.org>
 <CAJ-Vmok_Xk18YOBvnY1QAO2z_Y6ub=aZiTeEVyJdBu=57pHe5A@mail.gmail.com>
 <CANCZdfqSWQ_=gDVnN5TZOGzqsgeNc88-xQ1=e3neuse-1XLotQ@mail.gmail.com>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jan 2018 23:00:02 -0000

--------
In message <CANCZdfqSWQ_=3DgDVnN5TZOGzqsgeNc88-xQ1=3De3neuse-1XLotQ@mail.g=
mail.com>, 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-head@freebsd.org  Sun Jan 28 23:58:23 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 00:00:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 00:14:40 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 00:14:48 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 00:22:32 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <isa/isareg.h>
 #include <isa/isavar.h>
 
+#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-head@freebsd.org  Mon Jan 29 01:05:57 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 01:59:05 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 02:29:09 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <lwhsu@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 03:24:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <ian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 04:04:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <lwhsu@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 04:33:42 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <nwhitehorn@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 04:38:12 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <oshogbo@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bsd.lib.mk>

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 <oshogbo@FreeBSD.org>
+.\" 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-head@freebsd.org  Mon Jan 29 05:29:29 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <oshogbo@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 06:39:58 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>)
 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 <gonzo@bluezbox.com>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk>
 <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 06:54:08 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86C0CED97C1
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Mon, 29 Jan 2018 06:54:08 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com
 [IPv6:2607:f8b0:4001:c0b::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 07F7F8229D
 for <svn-src-head@freebsd.org>; Mon, 29 Jan 2018 06:54:08 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: by mail-it0-x22e.google.com with SMTP id 68so8093053ite.4
 for <svn-src-head@freebsd.org>; 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=i5U4bX3NszeZ+4IwGOPPlw4/pAvWkfzZGdszln+SntMrIKj7+MulXPHDZ7iGdOXKNt
 UQUbeTCqSn+drwlPJjy6Cq7DASK5pCHiHU5OwLcKt4mT7e7qBKmm9SfznUKzJ2P0EvIm
 burwwUUS6i112R8WTrG0zCmtOmhsI0N8BfFk4Ok4hyr9mydNgqFQBn2ZKhBNu9Hq7fJq
 /1qgQLMAJUkbrRI4ivTaj9EWXVRKC1MeO5oaRZvbkNrI3j61BVxUBY/ws9zAbS0bzAg9
 s/wwmWx8UmvlxbdfUX5k5TauXhqZH8gvH2LreaC607+TIp2R8+VN9kUzhwVmYIw4KLx8
 72Wg==
X-Gm-Message-State: AKwxytdlwNJKLLz943Gw51OX8GO6t+PYljKgCNvzWhZ9sUKrr3ihXKrV
 hcNyuGJWh7kFnQXexpjyaFI/TyZ1xdEpIMsxYQ2aZg==
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>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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 <imp@bsdimp.com>
Date: Sun, 28 Jan 2018 23:54:06 -0700
X-Google-Sender-Auth: oMRvkGxHB6s4WWIQBEnLKMDp-Zw
Message-ID: <CANCZdfrUT9ZBNqQQo0C=2ydzGHq+=c_KS+kY5krxaiRGfpJLhw@mail.gmail.com>
Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm
 modules
To: Oleksandr Tymoshenko <gonzo@bluezbox.com>
Cc: Poul-Henning Kamp <phk@phk.freebsd.dk>,
 Emmanuel Vadot <manu@bidouilliste.com>, 
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>, 
 src-committers <src-committers@freebsd.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jan 2018 06:54:08 -0000

On Sun, Jan 28, 2018 at 11:39 PM, Oleksandr Tymoshenko <gonzo@bluezbox.com>
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-head@freebsd.org  Mon Jan 29 08:10:04 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <pdk@semihalf.com>
  Submitted by:          Wojciech Macek <wma@semihalf.com>
  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-head@freebsd.org  Mon Jan 29 09:15:39 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <wma@semihalf.com>
  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-head@freebsd.org  Mon Jan 29 09:21:09 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <def@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <Trond.Endrestol@ximalas.info>
  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-head@freebsd.org  Mon Jan 29 09:24:30 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <wma@semihalf.com>
  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 <sys/param.h>
+#include <sys/endian.h>
 #include <sys/exec.h>
 #include <sys/linker.h>
 #include <sys/module.h>
@@ -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 <stand.h>
+#include <sys/endian.h>
 #include <sys/param.h>
 #include <fdt_platform.h>
 
@@ -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 <stand.h>
 #include <sys/param.h>
+#include <sys/endian.h>
 #include <sys/reboot.h>
 #include <sys/linker.h>
 #include <sys/boot.h>
@@ -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 <sys/param.h>
+#include <sys/endian.h>
 #include <sys/linker.h>
 
 #include <machine/metadata.h>
@@ -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-head@freebsd.org  Mon Jan 29 09:27:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <pdk@semihalf.com>
  Submitted by:          Wojciech Macek <wma@semihalf.com>
  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-head@freebsd.org  Mon Jan 29 09:27:33 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <oshogbo@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 09:51:25 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@bsdimp.com>
cc: Oleksandr Tymoshenko <gonzo@bluezbox.com>,
 Emmanuel Vadot <manu@bidouilliste.com>, John Baldwin <jhb@freebsd.org>,
 Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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: <CANCZdfrUT9ZBNqQQo0C=2ydzGHq+=c_KS+kY5krxaiRGfpJLhw@mail.gmail.com>
From: "Poul-Henning Kamp" <phk@phk.freebsd.dk>
References: <201801220710.w0M7AUm9091853@repo.freebsd.org>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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>
 <CANCZdfrUT9ZBNqQQo0C=2ydzGHq+=c_KS+kY5krxaiRGfpJLhw@mail.gmail.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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jan 2018 09:51:25 -0000

--------
In message <CANCZdfrUT9ZBNqQQo0C=3D2ydzGHq+=3Dc_KS+kY5krxaiRGfpJLhw@mail.g=
mail.com>, 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-head@freebsd.org  Mon Jan 29 09:56:07 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <ohartmann@walstatt.org>,
 David Wolfskill <david@catwhisker.org>
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 <jason.harmening@gmail.com>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 10:25:52 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>
cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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" <phk@phk.freebsd.dk>
References: <201801220710.w0M7AUm9091853@repo.freebsd.org>
 <CANCZdfpq2QoG4EAj0VW2FF=4VXRv-qQKFfJTJerWH9YOwVoVBA@mail.gmail.com>
 <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 10:33:56 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <ae@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 11:03:30 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <ae@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 11:07:04 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <bu7cher@yandex.ru>
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: <e7b273cc-7563-ad87-d339-8a18ad2d8387@yandex.ru>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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" <bu7cher@yandex.ru>
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Message-ID: <e7b273cc-7563-ad87-d339-8a18ad2d8387@yandex.ru>
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-head@freebsd.org  Mon Jan 29 13:00:31 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <david@catwhisker.org>
To: Jason Harmening <jason.harmening@gmail.com>
Cc: "O. Hartmann" <ohartmann@walstatt.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 13:27:45 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>)
 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 <gonzo@bluezbox.com>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 13:45:52 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>
cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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" <phk@phk.freebsd.dk>
References: <90451.1516663240@critter.freebsd.dk>
 <2987003.eeGRFBb6N8@ralph.baldwin.cx>
 <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 13:48:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 13:49:10 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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<OutputSection>(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-head@freebsd.org  Mon Jan 29 13:50:29 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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::vector<PhdrEnt
 
 LinkerScript::AddressState::AddressState() {
   for (auto &MRI : Script->MemoryRegions) {
-    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<const MemoryRegion *, uint64_t> MemRegionOffset;
     std::function<uint64_t()> 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<MemoryRegion>();
-    *MR = {Name, Origin, Length, Flags, NegFlags};
+    MemoryRegion *MR =
+        make<MemoryRegion>(Name, Origin, Length, Flags, NegFlags);
     Script->MemoryRegions[Name] = MR;
   }
 }

From owner-svn-src-head@freebsd.org  Mon Jan 29 13:51:13 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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<uint64_t()> LMAOffset;
+    uint64_t LMAOffset = 0;
   };
 
   llvm::DenseMap<StringRef, OutputSection *> NameToOutputSection;

From owner-svn-src-head@freebsd.org  Mon Jan 29 13:52:43 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <class ELFT> std::vector<PhdrEntry *> 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-head@freebsd.org  Mon Jan 29 13:54:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <typename ELFT> 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-head@freebsd.org  Mon Jan 29 13:55:51 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <class ELFT> std::vector<PhdrEntry *> 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-head@freebsd.org  Mon Jan 29 14:00:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 14:15:45 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bsd.prog.mk>

From owner-svn-src-head@freebsd.org  Mon Jan 29 14:23:45 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 15:57:27 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@freebsd.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201801290927.w0T9R2ot008700@repo.freebsd.org>
From: Nathan Whitehorn <nwhitehorn@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <pdk@semihalf.com>
>    Submitted by:          Wojciech Macek <wma@semihalf.com>
>    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-head@freebsd.org  Mon Jan 29 16:12:27 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <vangyzen@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <Farrell_Woods@Dell.com>
  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-head@freebsd.org  Mon Jan 29 17:32:31 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <benno@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 18:07:15 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 18:09:40 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@freebsd.org>
To: mike@karels.net
Cc: Conrad Meyer <cem@freebsd.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <n.deepak at gmail.com>
> 
> > 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-head@freebsd.org  Mon Jan 29 18:09:47 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@freebsd.org>
To: Michal Meloun <mmel@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 18:50:46 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 19:14:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <bdrewery@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 19:46:41 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@freebsd.org>, mike@karels.net
Cc: Conrad Meyer <cem@freebsd.org>, 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 <eric@vangyzen.net>
Message-ID: <b9824bb1-63cd-9472-a6c8-def4f0a0bb24@vangyzen.net>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <n.deepak at gmail.com>
>>
>>> 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-head@freebsd.org  Mon Jan 29 21:54:14 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <fsu@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 22:15:47 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <fsu@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 22:36:02 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <drosih@rpi.edu>
To: "Mike Karels" <mike@karels.net>
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: <B8438213-B733-42B8-B72C-CBEE9425F489@rpi.edu>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Mon Jan 29 22:38:24 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <pfg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 02:51:01 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>)
 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 <gonzo@bluezbox.com>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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: <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 03:31:41 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 04:05:04 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mmel@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <patch>.diff instead of <patch>.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-head@freebsd.org  Tue Jan 30 04:06:30 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mmel@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 04:13:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <melounmichal@gmail.com>
X-Google-Original-From: Michal Meloun <mmel@freebsd.org>
Reply-To: mmel@freebsd.org
Subject: Re: svn commit: r328511 - head/sys/dev/extres/clk
To: John Baldwin <jhb@freebsd.org>
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: <b6c49db7-d6ad-bdb0-c4bc-cc9917591fba@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 05:23:35 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <asomers@freebsd.org>
Date: Mon, 29 Jan 2018 22:23:31 -0700
X-Google-Sender-Auth: jVRbv7H8JCZDtEGqFH6vYa7nv3g
Message-ID: <CAOtMX2gAFDTg898rwWFGifDgr=ypd2CZOCjpANSgFpmF__3E_Q@mail.gmail.com>
Subject: Re: svn commit: r323314 - in head/sbin/geom: class/virstor misc
To: Conrad Meyer <cem@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jan 2018 05:23:35 -0000

On Fri, Sep 8, 2017 at 9:08 AM, Conrad Meyer <cem@freebsd.org> 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 <max AT mxcrypt.com>
>   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-head@freebsd.org  Tue Jan 30 08:31:38 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>
cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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" <phk@phk.freebsd.dk>
References: <CANCZdfrh0NHq7cbkq_genEdzo+B3G4TTAcEzpgh11sr+82e9aw@mail.gmail.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 09:04:44 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id A44A9EE388B
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Tue, 30 Jan 2018 09:04:43 +0000 (UTC)
 (envelope-from wma@semihalf.com)
Received: from mail-qt0-x22a.google.com (mail-qt0-x22a.google.com
 [IPv6:2607:f8b0:400d:c0d::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 3EFBD82E9E
 for <svn-src-head@freebsd.org>; Tue, 30 Jan 2018 09:04:43 +0000 (UTC)
 (envelope-from wma@semihalf.com)
Received: by mail-qt0-x22a.google.com with SMTP id o35so16249551qtj.13
 for <svn-src-head@freebsd.org>; 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=nOfW3zGZhHuQQmaYDqxRDqA0e6nNNu5H2zZGW446MDwI6IkAs2ceshrRjJtENjHC/D
 p6B++mOIJxSqCQlHDfioZ+hMHZq+SjRTwxJQ5GZR25AsO6RLcf8N1ccsJ4KQsOxzsjFi
 uXNXmGmOvPHFbbDy+Sg6bMLirlLfZVEoQ2rCnai+8jm7PsvjkOTbhHGQYXjGRILVzwii
 Um7gaacluHlAypP2jbhc29QojvWVvooHYvNYYD5WPf+XHVipvAl3gMCTM33hgPA+fPcK
 W2PxjmfJM4j87cHY1G63Bo7EaKHhjSj8AFAbB3lyeFW6B50uE6zqkAx8K8+YJ8YZRdkX
 ovQw==
X-Gm-Message-State: AKwxytdFWphhUjG5ehf75kGU6TBAHPNsSPEazjYOy19b71C059VyOe1V
 hZQyTKmiOcfiV0exQDuQf0WaDZZEBpkcaClG8sINofZmNL8=
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 <wma@semihalf.com>
Date: Tue, 30 Jan 2018 10:04:22 +0100
Message-ID: <CANsEV8e1adG00C-L4x+F5r5uRx-ME9VTry=JyaLzOcTPEhO2qw@mail.gmail.com>
Subject: Re: svn commit: r328537 - in head/sys/powerpc: aim powernv
To: Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc: Wojciech Macek <wma@freebsd.org>,
 src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org, Patryk Duda <pdk@semihalf.com>
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.25
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jan 2018 09:04:44 -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 <nwhitehorn@freebsd.org>:

> 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 <pdk@semihalf.com>
>>    Submitted by:          Wojciech Macek <wma@semihalf.com>
>>    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-head@freebsd.org  Tue Jan 30 09:42:58 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>)
 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 <gonzo@bluezbox.com>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 09:48:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gonzo@bluezbox.com>
cc: Emmanuel Vadot <manu@bidouilliste.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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" <phk@phk.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>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 09:58:22 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <manu@bidouilliste.com>
To: "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc: Oleksandr Tymoshenko <gonzo@bluezbox.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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" <phk@phk.freebsd.dk> 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 <manu@bidouilliste.com> <manu@freebsd.org>

From owner-svn-src-head@freebsd.org  Tue Jan 30 09:59:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <manu@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bsd.prog.mk>

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 <devstat.h>
 #include <err.h>
 
+#include <libxo/xo.h>
+
 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-head@freebsd.org  Tue Jan 30 10:08:12 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <trasz@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 10:10:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <trasz@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 10:15:50 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <manu@bidouilliste.com>
cc: Oleksandr Tymoshenko <gonzo@bluezbox.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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" <phk@phk.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>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 10:22:39 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <manu@bidouilliste.com>
To: "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc: Oleksandr Tymoshenko <gonzo@bluezbox.com>, Warner Losh <imp@bsdimp.com>,
 John Baldwin <jhb@freebsd.org>, Ravi Pokala <rpokala@mac.com>,
 src-committers <src-committers@freebsd.org>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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" <phk@phk.freebsd.dk> 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 <manu@bidouilliste.com> <manu@freebsd.org>

From owner-svn-src-head@freebsd.org  Tue Jan 30 12:38:07 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hselasky@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 15:53:11 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@semihalf.com>
Cc: Wojciech Macek <wma@freebsd.org>,
 src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org, Patryk Duda <pdk@semihalf.com>
References: <201801290927.w0T9R2ot008700@repo.freebsd.org>
 <2b1dc9be-493e-57fb-d012-0af52dc7475b@freebsd.org>
 <CANsEV8e1adG00C-L4x+F5r5uRx-ME9VTry=JyaLzOcTPEhO2qw@mail.gmail.com>
From: Nathan Whitehorn <nwhitehorn@freebsd.org>
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: <CANsEV8e1adG00C-L4x+F5r5uRx-ME9VTry=JyaLzOcTPEhO2qw@mail.gmail.com>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <nwhitehorn@freebsd.org 
> <mailto:nwhitehorn@freebsd.org>>:
>
>     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
>         <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 <pdk@semihalf.com
>         <mailto:pdk@semihalf.com>>
>            Submitted by:          Wojciech Macek <wma@semihalf.com
>         <mailto:wma@semihalf.com>>
>            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-head@freebsd.org  Tue Jan 30 16:34:57 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <swills@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 16:41:39 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 16:42:09 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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<MCSymbolCOFF>(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-head@freebsd.org  Tue Jan 30 16:43:22 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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<MCRelaxableFragment>(F).getContents().size();
   case MCFragment::FT_CompactEncodedInst:
     return cast<MCCompactEncodedInstFragment>(F).getContents().size();
-  case MCFragment::FT_Fill:
-    return cast<MCFillFragment>(F).getSize();
+  case MCFragment::FT_Fill: {
+    auto &FF = cast<MCFillFragment>(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<MCLEBFragment>(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<char> &DataBytes,
                                              Align->getMaxBytesToEmit());
       DataBytes.resize(Size, Value);
     } else if (auto *Fill = dyn_cast<MCFillFragment>(&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<MCDataFragment>(Frag);
       const SmallVectorImpl<char> &Contents = DataFrag.getContents();

From owner-svn-src-head@freebsd.org  Tue Jan 30 18:13:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <swills@freebsd.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201801301634.w0UGYur2070901@repo.freebsd.org>
From: Nathan Whitehorn <nwhitehorn@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 18:28:48 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <freebsd@pdx.rh.CN85.dnsmgr.net>
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 <nwhitehorn@freebsd.org>
Date: Tue, 30 Jan 2018 10:28:38 -0800 (PST)
CC: Steve Wills <swills@freebsd.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Reply-To: rgrimes@freebsd.org
X-Mailer: ELM [version 2.4ME+ PL121h (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 18:29:38 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 20:00:13 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <sbruno@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 21:25:43 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <asomers@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Tue Jan 30 23:01:38 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <netinet6/scope6_var.h>
 #define TCPSTATES
 #include <netinet/tcp_fsm.h>
+#include <netinet/tcp_timer.h>
 #include <netinet/tcp_var.h>
 #include <netinet/toecore.h>
 
@@ -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-head@freebsd.org  Tue Jan 30 23:29:27 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 01:04:37 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mav@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 02:02:01 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 03:05:15 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <stdlib.h>
 #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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+#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-head@freebsd.org  Wed Jan 31 04:29:01 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 04:29:09 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 05:07:43 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 06:42:01 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <wma@semihalf.com>
  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-head@freebsd.org  Wed Jan 31 07:20:35 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 07:36:52 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 07:37:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 11:14:26 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <avg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <nbe@renzel.net>
  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-head@freebsd.org  Wed Jan 31 13:40:37 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hselasky@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 14:25:43 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kib@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 14:36:29 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kib@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <machine/asmacros.h>
+#include <machine/specialreg.h>
 #include <machine/pmap.h>
 
 #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-head@freebsd.org  Wed Jan 31 14:44:52 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <avg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 14:52:51 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <rpokala@mac.com>
To: Konstantin Belousov <kib@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Message-id: <E2C0BA07-7CCE-47FB-B735-5E76B3DF9D75@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>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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: <owner-src-committers@freebsd.org> on behalf of Konstantin Belousov <=
kib@FreeBSD.org>
Date: 2018-01-31, Wednesday at 06:36
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/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 <machine/asmacros.h>
+#include <machine/specialreg.h>
 #include <machine/pmap.h>
=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-head@freebsd.org  Wed Jan 31 14:56:29 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <bzeeb-lists@lists.zabbadoz.net>
To: "Konstantin Belousov" <kib@FreeBSD.org>
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: <FF98ADF0-829E-419B-89C3-9717F62CD4A7@lists.zabbadoz.net>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 15:02:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kostikbel@gmail.com>
To: Ravi Pokala <rpokala@mac.com>
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>
 <E2C0BA07-7CCE-47FB-B735-5E76B3DF9D75@mac.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <E2C0BA07-7CCE-47FB-B735-5E76B3DF9D75@mac.com>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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: <owner-src-committers@freebsd.org> on behalf of Konstantin Belousov <kib@FreeBSD.org>
> Date: 2018-01-31, Wednesday at 06:36
> 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
> 
> 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 <machine/asmacros.h>
> +#include <machine/specialreg.h>
>  #include <machine/pmap.h>
>  
>  #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-head@freebsd.org  Wed Jan 31 15:07:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <rpokala@mac.com>
To: Konstantin Belousov <kostikbel@gmail.com>
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>
 <E2C0BA07-7CCE-47FB-B735-5E76B3DF9D75@mac.com>
 <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jan 2018 15:07:54 -0000

-----Original Message-----
From: <owner-src-committers@freebsd.org> on behalf of Konstantin Belousov <kostikbel@gmail.com>
Date: 2018-01-31, Wednesday at 07:02
To: Ravi Pokala <rpokala@mac.com>
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

> 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-head@freebsd.org  Wed Jan 31 15:08:47 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10DB8ED0468
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Wed, 31 Jan 2018 15:08:47 +0000 (UTC)
 (envelope-from shawn.webb@hardenedbsd.org)
Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com
 [IPv6:2a00:1450:400c:c09::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 943AD87BE0
 for <svn-src-head@freebsd.org>; Wed, 31 Jan 2018 15:08:46 +0000 (UTC)
 (envelope-from shawn.webb@hardenedbsd.org)
Received: by mail-wm0-x236.google.com with SMTP id i186so8794732wmi.4
 for <svn-src-head@freebsd.org>; 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=lKLJVFx3yhfpOkPCrjG4cVBWVwKT+AInGonWhZ1aDsdFYBxyg5HRJv67KTCie6+eCg
 rqM+4ec/DdZQ1oWIUTX4NLN1OgIKW4J1T/MuQHlykAagRTrJ2xi6aKEtVv5+kMTE5abR
 I06v/hUGzqP9bAn7yTnROpBU8fV9SOP/Xu7BBCtdKkHO+e8WQeIZvZwnFcHaG5baB2zs
 MsoQKXdpZnjZv2iZ2krGSYfrjnM0pFpXaslE91qXe7W6C99BDb3ZkA6JTcH+2IP/R3zp
 zhqcgw7HWXOjH87I4L5CbvXjVo/hPTvFaqMK8tiyevapvXggpsIZMJZo1lbO+L/Zzbaf
 420g==
X-Gm-Message-State: AKwxytenjEi+WK/fD4Tav6GndIF6G/Z7uOKOeRmYGXgifonrFn5F1fef
 rZ/sK2lA9WnTCLUfeInHmRgh/A==
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 <shawn.webb@hardenedbsd.org>
To: Konstantin Belousov <kib@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 15:18:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wma@freebsd.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201801310642.w0V6g1Am099107@repo.freebsd.org>
From: Nathan Whitehorn <nwhitehorn@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <wma@semihalf.com>
>    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-head@freebsd.org  Wed Jan 31 15:20:52 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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?= <royger@gmail.com>
Date: Wed, 31 Jan 2018 15:20:46 +0000
From: Roger Pau =?iso-8859-1?Q?Monn=E9?= <royger@FreeBSD.org>
To: Wojciech Macek <wma@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <sys/param.h>
> +#include <sys/endian.h>
>  #include <sys/exec.h>
>  #include <sys/linker.h>
>  #include <sys/module.h>
> @@ -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-head@freebsd.org  Wed Jan 31 15:23:56 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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?= <roger.pau@citrix.com>
To: Wojciech Macek <wma@FreeBSD.org>
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: <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <sys/param.h>
> +#include <sys/endian.h>
>  #include <sys/exec.h>
>  #include <sys/linker.h>
>  #include <sys/module.h>
> @@ -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-head@freebsd.org  Wed Jan 31 15:31:58 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@freebsd.org>
Date: Wed, 31 Jan 2018 10:31:36 -0500
X-Google-Sender-Auth: wqJm6-nRg95ZhmoKOt5LQT7jdtI
Message-ID: <CAPyFy2AmU+1pPNU=W_FbG2=u4xKXNQHifaruOH6b=W+n1juw_Q@mail.gmail.com>
Subject: Re: svn commit: r328610 - head/sys/amd64/amd64
To: John Baldwin <jhb@freebsd.org>, Wojciech Macek <wma@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jan 2018 15:31:58 -0000

On 30 January 2018 at 21:01, John Baldwin <jhb@freebsd.org> 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-head@freebsd.org  Wed Jan 31 16:14:09 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@freebsd.org>
To: Ed Maste <emaste@freebsd.org>
Cc: Wojciech Macek <wma@freebsd.org>,
 src-committers <src-committers@freebsd.org>, 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: <CAPyFy2AmU+1pPNU=W_FbG2=u4xKXNQHifaruOH6b=W+n1juw_Q@mail.gmail.com>
References: <201801302329.w0UNTRHn080138@repo.freebsd.org>
 <3195814.6PcFLP86qD@ralph.baldwin.cx>
 <CAPyFy2AmU+1pPNU=W_FbG2=u4xKXNQHifaruOH6b=W+n1juw_Q@mail.gmail.com>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <jhb@freebsd.org> 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-head@freebsd.org  Wed Jan 31 16:45:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kostikbel@gmail.com>
To: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
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>
 <FF98ADF0-829E-419B-89C3-9717F62CD4A7@lists.zabbadoz.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <FF98ADF0-829E-419B-89C3-9717F62CD4A7@lists.zabbadoz.net>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 16:54:06 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kib@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 16:56:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kib@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 16:57:15 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <markjdb@gmail.com>
Date: Wed, 31 Jan 2018 11:57:08 -0500
From: Mark Johnston <markj@FreeBSD.org>
To: Kirk McKusick <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 17:08:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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: <FF98ADF0-829E-419B-89C3-9717F62CD4A7@lists.zabbadoz.net>
References: <201801311436.w0VEaRrZ030839@repo.freebsd.org>
 <FF98ADF0-829E-419B-89C3-9717F62CD4A7@lists.zabbadoz.net>
From: Ed Maste <emaste@freebsd.org>
Date: Wed, 31 Jan 2018 12:07:54 -0500
X-Google-Sender-Auth: VeCstfoyFWWYv7la2cUPbgsH20w
Message-ID: <CAPyFy2B68aFZ5bKfLZVSwG0Pm8DngsL9qofsM7-DKtY3wrUnKA@mail.gmail.com>
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" <bzeeb-lists@lists.zabbadoz.net>
Cc: Konstantin Belousov <kib@freebsd.org>,
 src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jan 2018 17:08:16 -0000

On 31 January 2018 at 09:56, Bjoern A. Zeeb
<bzeeb-lists@lists.zabbadoz.net> 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-head@freebsd.org  Wed Jan 31 17:36:41 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <machine/abi.h> header to hold constants shared between C
    and assembly such as CALLFRAME_SZ.
  - Add a new STACK_ALIGN constant to <machine/abi.h> 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 <sys/param.h>
+#include <machine/abi.h>
 #include <machine/regnum.h>
 
 #include <stdarg.h>
@@ -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 <machine/regdef.h>
-#include <machine/endian.h>
-#include <machine/cdefs.h>
-
-#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 <machine/abi.h>
 #include <machine/regdef.h>
 #include <machine/endian.h>
 #include <machine/cdefs.h>
@@ -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 <vm/vm_extern.h>
 #include <sys/user.h>
 #include <sys/uio.h>
+#include <machine/abi.h>
 #include <machine/cpuinfo.h>
 #include <machine/reg.h>
 #include <machine/md_var.h>
@@ -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 <sys/sysctl.h>
 #include <sys/unistd.h>
 
+#include <machine/abi.h>
 #include <machine/cache.h>
 #include <machine/clock.h>
 #include <machine/cpu.h>
@@ -82,18 +83,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/user.h>
 #include <sys/mbuf.h>
 
-/* 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-head@freebsd.org  Wed Jan 31 17:56:37 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 17:58:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 18:00:23 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 18:02:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <jhb@FreeBSD.org>
+ * 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <atf-c.h>
+#include <ucontext.h>
+
+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-head@freebsd.org  Wed Jan 31 18:03:41 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 18:05:18 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <freebsd@pdx.rh.CN85.dnsmgr.net>
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 <kostikbel@gmail.com>
Date: Wed, 31 Jan 2018 10:05:13 -0800 (PST)
CC: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>,
 src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Reply-To: rgrimes@freebsd.org
X-Mailer: ELM [version 2.4ME+ PL121h (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 18:13:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bsd.lib.mk>

From owner-svn-src-head@freebsd.org  Wed Jan 31 21:06:11 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4ECE4EE1C5C
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Wed, 31 Jan 2018 21:06:11 +0000 (UTC)
 (envelope-from steven@multiplay.co.uk)
Received: from mail-yw0-x22f.google.com (mail-yw0-x22f.google.com
 [IPv6:2607:f8b0:4002:c05::22f])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DBDA4784D4
 for <svn-src-head@freebsd.org>; Wed, 31 Jan 2018 21:06:10 +0000 (UTC)
 (envelope-from steven@multiplay.co.uk)
Received: by mail-yw0-x22f.google.com with SMTP id t201so8692178ywf.1
 for <svn-src-head@freebsd.org>; 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=Pzyt4ZbdeAnEpsLRmrVyhC/Hd6ckLwKNNQBvX8g8txkDkMBqe4OobNcRXdbjRjULRx
 UFA/N41n0olPA7TX8DVnZ58kAqHhiPuskQukjt7U6oZXVzaHxyMKH02OI3E0bnsXnoLb
 1264QTxPvnV33iiCJlGC3AFfuB9B+h1OZNwXvpYsnVha65o5cpdlNjheIj3ipSHrhbm5
 wW3S6HeqBJYr3mdqdzzRuZvLkBXXnid86Toc+HX9mfGrXsFeMVRwARYNHh+Coq08x1PV
 l5/PQVAF4RU/QNaCLtDv9HxxQ4D1D6+ltSSA2g0DUPET7jPBrebc1ZAU4J8FFmcMjJmj
 nnnw==
X-Gm-Message-State: AKwxytfRqSY8QasNqpnSAygtFTi5is34CgGLbjlmwlyRWgEuUKopFn1Z
 Vqgi9HhamPLWXVotpdRbRyFNl/Ty9tuO73lTgVylgbWV
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 <steven.hartland@multiplay.co.uk>
Date: Wed, 31 Jan 2018 21:05:58 +0000
Message-ID: <CAHEMsqa=zGGxZ7+us3wC2cG_85feshNuYXdCUS0qDjuxdg7jNA@mail.gmail.com>
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" <bzeeb-lists@lists.zabbadoz.net>, 
 Konstantin Belousov <kostikbel@gmail.com>, 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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 21:15:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wulf@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <neel@neelc.org>
  Tested by:	Neel Chauhan <neel@neelc.org>
  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-head@freebsd.org  Wed Jan 31 21:41:43 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <gjb@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 21:46:38 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wulf@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 21:56:24 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <marius@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 22:17:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <wulf@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <neel@neelc.org>
  Tested by:	Neel Chauhan <neel@neelc.org>
  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-head@freebsd.org  Wed Jan 31 22:20:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 22:46:06 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <string.h>
 #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 <msmith@freebsd.org>
+ * 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Simple commandline interpreter, toplevel and misc.
+ */
+
+#include <stand.h>
+#include <string.h>
+#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-head@freebsd.org  Wed Jan 31 22:49:51 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <longwitz at incore.de>
  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-head@freebsd.org  Wed Jan 31 22:52:36 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jhb@freebsd.org>
To: Glen Barber <gjb@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 23:13:37 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 23:16:19 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 23:16:55 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Wed Jan 31 23:30:50 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <longwitz at incore.de>
  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-head@freebsd.org  Thu Feb  1 01:12:51 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <jonathan@FreeBSD.org>
To: rgrimes@freebsd.org
Cc: "Nathan Whitehorn" <nwhitehorn@freebsd.org>,
 "Steve Wills" <swills@freebsd.org>, 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: <B0EBD437-55A8-4CD7-AA69-0B8C11E46AC8@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 05:28:02 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <nwhitehorn@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 05:31:26 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <nwhitehorn@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 07:52:07 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 10:26:03 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jbeich@FreeBSD.org>
To: Hans Petter Selasky <hselasky@FreeBSD.org>
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: <h8r1-m2fj-wny@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Feb 2018 10:26:03 -0000

Hans Petter Selasky <hselasky@FreeBSD.org> 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-head@freebsd.org  Thu Feb  1 11:07:29 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jbeich@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801261049.w0QAn2Xt089656@repo.freebsd.org>
 <h8r1-m2fj-wny@FreeBSD.org>
From: Hans Petter Selasky <hps@selasky.org>
Message-ID: <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org>
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: <h8r1-m2fj-wny@FreeBSD.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <hselasky@FreeBSD.org> 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-head@freebsd.org  Thu Feb  1 11:21:06 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jbeich@FreeBSD.org>
To: Hans Petter Selasky <hps@selasky.org>
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>
 <h8r1-m2fj-wny@FreeBSD.org>
 <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org>
Date: Thu, 01 Feb 2018 12:20:59 +0100
In-Reply-To: <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org> (Hans Petter
 Selasky's message of "Thu, 1 Feb 2018 12:04:32 +0100")
Message-ID: <tvv1-ot0k-wny@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Feb 2018 11:21:06 -0000

Hans Petter Selasky <hps@selasky.org> writes:

> On 02/01/18 11:25, Jan Beich wrote:
>
>> Hans Petter Selasky <hselasky@FreeBSD.org> 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-head@freebsd.org  Thu Feb  1 11:16:02 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hps@selasky.org>
To: Jan Beich <jbeich@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801261049.w0QAn2Xt089656@repo.freebsd.org>
 <h8r1-m2fj-wny@FreeBSD.org>
 <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.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: <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <hselasky@FreeBSD.org> 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-head@freebsd.org  Thu Feb  1 11:51:21 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jbeich@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801261049.w0QAn2Xt089656@repo.freebsd.org>
 <h8r1-m2fj-wny@FreeBSD.org>
 <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org>
 <tvv1-ot0k-wny@FreeBSD.org>
From: Hans Petter Selasky <hps@selasky.org>
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: <tvv1-ot0k-wny@FreeBSD.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 14:26:27 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <andrew@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 14:31:13 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 15:05:18 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <andrew@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 17:32:46 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hselasky@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 17:59:15 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <rgrimes@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <johalun0@gmail.com>
  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-head@freebsd.org  Thu Feb  1 18:13:42 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jbeich@FreeBSD.org>
To: Hans Petter Selasky <hps@selasky.org>
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>
 <h8r1-m2fj-wny@FreeBSD.org>
 <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org>
 <4d1d778d-a0e0-0d3a-b37e-19fba10ae86f@selasky.org>
Date: Thu, 01 Feb 2018 19:13:35 +0100
Message-ID: <shak-bmsw-wny@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Feb 2018 18:13:42 -0000

Hans Petter Selasky <hps@selasky.org> writes:

> On 02/01/18 12:04, Hans Petter Selasky wrote:
>
>> On 02/01/18 11:25, Jan Beich wrote:
>>> Hans Petter Selasky <hselasky@FreeBSD.org> 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<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 glxgears RET   mmap 34429681664/0x8042b4000
 glxgears CALL  mmap(0,0x7000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,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<O_RDONLY>)
-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<O_RDONLY>)
-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-head@freebsd.org  Thu Feb  1 18:25:32 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jbeich@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801261049.w0QAn2Xt089656@repo.freebsd.org>
 <h8r1-m2fj-wny@FreeBSD.org>
 <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org>
 <4d1d778d-a0e0-0d3a-b37e-19fba10ae86f@selasky.org>
 <shak-bmsw-wny@FreeBSD.org>
From: Hans Petter Selasky <hps@selasky.org>
Message-ID: <e471f2d6-848e-4241-3070-c283aad20532@selasky.org>
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: <shak-bmsw-wny@FreeBSD.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 19:39:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <rgrimes@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <network device emulation type> 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 <CPUs>] [-C <console>] [-d <disk file>]"
-	echo "                [-e <name=value>] [-f <path of firmware>] [-F <size>]"
+	echo "Usage: vmrun.sh [-aAEhiTv] [-c <CPUs>] [-C <console>]" \
+	    "[-d <disk file>]"
+	echo "                [-e <name=value>] [-f <path of firmware>]" \
+	    "[-F <size>]"
 	echo "                [-g <gdbport> ] [-H <directory>]"
 	echo "                [-I <location of installation iso>] [-l <loader>]"
 	echo "                [-L <VNC IP for UEFI framebuffer>]"
-	echo "                [-m <memsize>] [-P <port>] [-t <tapdev>] <vmname>"
+	echo "                [-m <memsize>]" \
+	    "[-n <network adapter emulation type>]"
+	echo "                [-P <port>] [-t <tapdev>] <vmname>"
 	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 <gdbport>"
 	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-head@freebsd.org  Thu Feb  1 19:57:22 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hselasky@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 19:58:43 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hps@selasky.org>
To: Jan Beich <jbeich@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801261049.w0QAn2Xt089656@repo.freebsd.org>
 <h8r1-m2fj-wny@FreeBSD.org>
 <caa75f3c-2fdb-246d-6a6f-2365bad6b84d@selasky.org>
 <4d1d778d-a0e0-0d3a-b37e-19fba10ae86f@selasky.org>
 <shak-bmsw-wny@FreeBSD.org>
 <e471f2d6-848e-4241-3070-c283aad20532@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: <e471f2d6-848e-4241-3070-c283aad20532@selasky.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 21:41:19 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <dim@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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<SelectInst>(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<CastInst>(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<CastInst>(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<BasicBlock *, 4> Visited = {From};
+  SmallPtrSet<BasicBlock *, 4> 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<RegionNode *> Order;
+  SmallVector<RegionNode *, 8> 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<DivergenceAnalysis>();
     AU.addRequiredID(LowerSwitchID);
     AU.addRequired<DominatorTreeWrapperPass>();
+    AU.addRequired<LoopInfoWrapperPass>();
 
     AU.addPreserved<DominatorTreeWrapperPass>();
     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<Region*> RPOT(ParentRegion);
+  SmallDenseMap<Loop*, unsigned, 8> LoopBlocks;
 
-  // This must be RPO order for the back edge detection to work
-  for (RegionNode *RN : ReversePostOrderTraversal<Region*>(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<DominatorTreeWrapperPass>().getDomTree();
+  LI = &getAnalysis<LoopInfoWrapperPass>().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<Metadata *> MDNodeMapper::tryToMapOperand(con
   return None;
 }
 
+static Metadata *cloneOrBuildODR(const MDNode &N) {
+  auto *CT = dyn_cast<DICompositeType>(&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<DICompositeType *>(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<MDNode>(
-      (M.Flags & RF_MoveDistinctMDs)
-          ? M.mapToSelf(&N)
-          : M.mapToMetadata(&N, MDNode::replaceWithDistinct(N.clone()))));
+  DistinctWorklist.push_back(
+      cast<MDNode>((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<ExperimentalISel>;
+
+def warn_drv_experimental_isel_incomplete_opt : Warning<
+  "-fexperimental-isel support is incomplete for this architecture at the current optimization level">,
+  InGroup<ExperimentalISel>;
 }

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<f_clang_Group>, Flags<[CC1Option]>,
   HelpText<"Inline functions which are (explicitly or implicitly) marked inline">;
 def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>;
+def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group<f_clang_Group>,
+  HelpText<"Enables the experimental global instruction selector">;
 def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">,
   Group<f_clang_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<f_Group>, Flags<[CC1Option]>;
 def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group<f_clang_Group>, Flags<[CC1Option]>;
 def fno_inline : Flag<["-"], "fno-inline">, Group<f_clang_Group>, Flags<[CC1Option]>;
+def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group<f_clang_Group>,
+  HelpText<"Disables the experimental global instruction selector">;
 def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">,
   Group<f_clang_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<const uint32_t *>(Buf + Off);
+  const ulittle32_t *InstBuf = reinterpret_cast<const ulittle32_t *>(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-head@freebsd.org  Thu Feb  1 21:58:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 22:00:05 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 22:00:39 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 22:01:12 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Thu Feb  1 22:01:54 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 00:01:51 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 00:07:39 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <markj@FreeBSD.org>

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-head@freebsd.org  Fri Feb  2 00:11:01 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <cem@freebsd.org>
Date: Thu, 1 Feb 2018 16:10:53 -0800
X-Gmail-Original-Message-ID: <CAG6CVpXus=Vt+OZUTWDV1TqDvLCw1yhKMZSrA9j+2axdv8OONg@mail.gmail.com>
Message-ID: <CAG6CVpXus=Vt+OZUTWDV1TqDvLCw1yhKMZSrA9j+2axdv8OONg@mail.gmail.com>
Subject: Re: svn commit: r328763 - head/sbin/fsck_ffs
To: Kirk McKusick <mckusick@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <mckusick@freebsd.org> 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 <markj@FreeBSD.org>
>
> 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-head@freebsd.org  Fri Feb  2 02:05:15 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <sys/ioccom.h>
+#include <net/ethernet.h>
 
 #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-head@freebsd.org  Fri Feb  2 02:28:25 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <swills@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 03:35:02 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201801310305.w0V35EU4090569@repo.freebsd.org>
From: Steve Wills <swills@FreeBSD.org>
Message-ID: <f756b897-0b97-e033-a007-0aa88b0baae6@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <stdlib.h>
>   #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 <sys/cdefs.h>
> +__FBSDID("$FreeBSD$");
> +
> +#include <stdlib.h>
> +#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-head@freebsd.org  Fri Feb  2 04:09:57 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A918EE2934
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Fri,  2 Feb 2018 04:09:57 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com
 [IPv6:2a00:1450:400c:c09::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 EE664786C0
 for <svn-src-head@freebsd.org>; Fri,  2 Feb 2018 04:09:56 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: by mail-wm0-x22f.google.com with SMTP id f3so9698181wmc.1
 for <svn-src-head@freebsd.org>; 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=IyYksgld2dUo25yfhu2/WMbV+063WyHcURa/IObQKnefGg745Y/YuJN9JS2uFUyhAw
 7IalCmtlppsU1N6cbyKQRfYVcE3+1VqB/mLRH/55FWM8lr628DlKOwDd0r5AwRzVH2h4
 N5MMnlh31rAowJW2/WkQJjNudysMQvL+gxAE13Cz9J1wqgOpVpubPGanOMS5OCZ8WR9d
 sYiToDe8sh46V/9vgO99nmX0dOLkfki5sBTpbyhRse0g2qJz+/5zFJs4z54tmQrodaAl
 vyDyMjIxkB7N7eBiffNqW1PGybgGtjnrAj6bTW+1maiPloMz4m1CbIz9G18FO25dU6Co
 nH0Q==
X-Gm-Message-State: AKwxytdBpXl/W1IQ1vzQVs5Zbp2ogwwZXTLUXTiFoSgfSKBkUpxs5g2X
 6Kswwh+SQEUAGKhFPzkVtP4Z7eIBpYvbiLWpJSTvSQ==
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: <f756b897-0b97-e033-a007-0aa88b0baae6@FreeBSD.org>
References: <201801310305.w0V35EU4090569@repo.freebsd.org>
 <f756b897-0b97-e033-a007-0aa88b0baae6@FreeBSD.org>
From: Warner Losh <imp@bsdimp.com>
Date: Thu, 1 Feb 2018 21:09:54 -0700
X-Google-Sender-Auth: 9dW1JnghCIBf6PiT1E7DeOsFGxo
Message-ID: <CANCZdfp=A4cem5h26NxE-D9+iOyOLc6JU8NzdPcByts-dZ=A6g@mail.gmail.com>
Subject: Re: svn commit: r328612 - head/lib/libc/stdlib
To: Steve Wills <swills@freebsd.org>
Cc: Warner Losh <imp@freebsd.org>, src-committers <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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Feb 2018 04:09:57 -0000

On Thu, Feb 1, 2018 at 8:34 PM, Steve Wills <swills@freebsd.org> 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 <stdlib.h>
>>   #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 <sys/cdefs.h>
>> +__FBSDID("$FreeBSD$");
>> +
>> +#include <stdlib.h>
>> +#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-head@freebsd.org  Fri Feb  2 05:04:44 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 06:32:31 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bsd.init.mk>
-
-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 <bsd.init.mk>
-
-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 <bsd.prog.mk>
 .else
 LIB=		ficl
-INTERNALLIB=
 .include <bsd.lib.mk>
 .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 <bsd.init.mk>
-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 <bsd.init.mk>
 
 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 <bsd.init.mk>
 
 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 <bsd.init.mk>
 
-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 <bsd.init.mk>
 
-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 <bsd.init.mk>
 
-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 <bsd.init.mk>
 
 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 <bsd.init.mk>
-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 <bsd.init.mk>
-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 <bsd.init.mk>
-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 <bsd.init.mk>
-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 <bsd.init.mk>
 
-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 <bsd.init.mk>
 
 LIB=		zfsboot
-INTERNALLIB=
 
 .PATH:		${ZFSSRC}
 SRCS+=		zfs.c skein.c skein_block.c

From owner-svn-src-head@freebsd.org  Fri Feb  2 07:39:35 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <ae@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <max at m00nbsd dot net>
  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-head@freebsd.org  Fri Feb  2 11:56:30 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kib@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 12:42:47 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hselasky@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 12:57:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <avg@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 15:01:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <stand.h>
 #include <string.h>
 #include <bootstrap.h>
-#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-head@freebsd.org  Fri Feb  2 15:01:45 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bsd.init.mk>
 
-.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 <uuid.h>
 #include <stdbool.h>
 #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-head@freebsd.org  Fri Feb  2 15:01:54 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 15:01:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <isapnp.h>
 #include <btxv86.h>
 #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-head@freebsd.org  Fri Feb  2 15:40:51 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bsd.prog.mk>

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 <bsd.prog.mk>

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 <bsd.prog.mk>

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 <bsd.prog.mk>

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 <bsd.prog.mk>

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 <bsd.lib.mk>

From owner-svn-src-head@freebsd.org  Fri Feb  2 16:35:17 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <rgrimes@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 16:47:33 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 17:52:10 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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" <rgrimes@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <gdbport>"
 	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-head@freebsd.org  Fri Feb  2 18:03:14 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <brooks@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 18:11:56 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <oshogbo@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 19:42:02 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 21:18:33 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <string.h> */
 #include <string.h>
+#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-head@freebsd.org  Fri Feb  2 21:25:47 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <kevans@freebsd.org>
Date: Fri, 2 Feb 2018 15:02:17 -0600
X-Gmail-Original-Message-ID: <CACNAnaE-o8iT++aHfeG1i1x3C3sULAhFbAYnx5=3qmQGmpju0A@mail.gmail.com>
Message-ID: <CACNAnaE-o8iT++aHfeG1i1x3C3sULAhFbAYnx5=3qmQGmpju0A@mail.gmail.com>
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 <mckusick@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Feb 2018 21:25:47 -0000

On Thu, Jan 25, 2018 at 6:58 PM, Kirk McKusick <mckusick@freebsd.org> 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-head@freebsd.org  Fri Feb  2 21:52:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 22:05:38 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 22:06:16 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <kevans@freebsd.org>

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-head@freebsd.org  Fri Feb  2 22:08:04 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 22:08:36 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <x> 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-head@freebsd.org  Fri Feb  2 22:09:37 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <arichardson@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 22:28:17 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <dim@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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<TargetPassConfig>();
+  if (!TPC)
+    return false;
+
+  auto &TM = TPC->getTM<TargetMachine>();
+  auto &STI = *TM.getSubtargetImpl(F);
+  if (!STI.enableIndirectBrExpand())
+    return false;
+  TLI = STI.getTargetLowering();
+
+  SmallVector<IndirectBrInst *, 1> IndirectBrs;
+
+  // Set of all potential successors for indirectbr instructions.
+  SmallPtrSet<BasicBlock *, 4> IndirectBrSuccs;
+
+  // Build a list of indirectbrs that we want to rewrite.
+  for (BasicBlock &BB : F)
+    if (auto *IBr = dyn_cast<IndirectBrInst>(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<BasicBlock *, 4> 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<BlockAddress>(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<BlockAddress>(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<IntegerType>(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<IntegerType>(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<int>(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<SDValue, SDValue> 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<SparcSubtarget>();
   const SparcInstrInfo &TII =
-      *static_cast<const SparcInstrInfo *>(MF.getSubtarget().getInstrInfo());
+      *static_cast<const SparcInstrInfo *>(Subtarget.getInstrInfo());
   const SparcRegisterInfo &RegInfo =
-      *static_cast<const SparcRegisterInfo *>(MF.getSubtarget().getRegisterInfo());
+      *static_cast<const SparcRegisterInfo *>(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<SparcSubtarget>().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<MCCodeEmitter> 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<unsigned, 3> 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<int> &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-head@freebsd.org  Fri Feb  2 22:53:59 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <jilles@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Fri Feb  2 23:26:53 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <mckusick@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <bde@freebsd.org>

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-head@freebsd.org  Fri Feb  2 23:34:34 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <brooks@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 00:59:09 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <adrian@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 01:23:49 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 01:30:45 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <emaste@freebsd.org>
Date: Fri, 2 Feb 2018 20:30:23 -0500
X-Google-Sender-Auth: MsrEUhW8QyLAFuTG1uJgVV3gUDs
Message-ID: <CAPyFy2B4EHG8cwh5DKuMF+XFV1=_AM_8fbcLrDxLJ_77sP=JNg@mail.gmail.com>
Subject: Re: svn commit: r328536 - in head/stand: common powerpc/kboot
To: Wojciech Macek <wma@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Feb 2018 01:30:45 -0000

On 29 January 2018 at 04:24, Wojciech Macek <wma@freebsd.org> 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-head@freebsd.org  Sat Feb  3 09:15:14 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <delphij@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 09:43:32 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <hselasky@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <ryanwinter@outlook.com>
  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-head@freebsd.org  Sat Feb  3 15:09:35 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <brde@optusnet.com.au>
X-X-Sender: bde@besplex.bde.org
To: Conrad Meyer <cem@freebsd.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 19:31:30 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <cem@freebsd.org>
Date: Sat, 3 Feb 2018 11:08:34 -0800
X-Gmail-Original-Message-ID: <CAG6CVpXodjf7HfagpaY6K1t69a1jx37FRqvQq2acg5eT0r1Z-A@mail.gmail.com>
Message-ID: <CAG6CVpXodjf7HfagpaY6K1t69a1jx37FRqvQq2acg5eT0r1Z-A@mail.gmail.com>
Subject: Re: svn commit: r327495 - head/usr.sbin/rpcbind
To: Bruce Evans <brde@optusnet.com.au>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Feb 2018 19:31:30 -0000

On Sat, Feb 3, 2018 at 6:46 AM, Bruce Evans <brde@optusnet.com.au> 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-head@freebsd.org  Sat Feb  3 20:50:46 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <eadler@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 20:53:22 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <eadler@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 21:56:39 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <imp@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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-head@freebsd.org  Sat Feb  3 23:14:13 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <marius@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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 <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/types.h>
+#include <sys/param.h>
 
 #include <machine/utrap.h>
 #include <machine/sysarch.h>
 
-#include <stdlib.h>
-
 #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-head@freebsd.org  Sat Feb  3 23:49:23 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 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 <nwhitehorn@FreeBSD.org>
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-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=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)		}