Re: svn commit: r335108 - head/sys/arm64/rockchip/clk

2018-06-13 Thread Emmanuel Vadot
On Thu, 14 Jun 2018 05:43:45 + (UTC)
Emmanuel Vadot  wrote:

> Author: manu
> Date: Thu Jun 14 05:43:45 2018
> New Revision: 335108
> URL: https://svnweb.freebsd.org/changeset/base/335108
> 
> Log:
>   rk_pll: Add support for mode
>   
>   RockChip PLL have two modes controlled by a register, a "slow mode" (the
>   default one) where the frequency is derived from the 24Mhz oscillator on the
>   board, and a "normal" one when the pll take it's input from the real PLL 
> output.
>   
>   Default the mode to normal for all the PLLs.
> 

 Thanks to jmcneill@ for the tip by the way.

-- 
Emmanuel Vadot  
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Warner Losh
So I  found this

https://www.copyright.gov/circs/circ03.pdf

and it states two things:

"A notice consists of three elements that generally appear as a single
continuous statement: • The copyright symbol © (or for phonorecords, the
symbol ℗ ); the word “copyright”; or the abbreviation “copr.”; • The year
of first publication of the work; and • The name of the copyright owner."

But this only required for works published before March 1, 1989. It later
states:

"Copyright notice is optional for unpublished works, foreign works, or
works published on or after March 1, 1989. When notice is optional,
copyright owners can use any form of notice they wish."

The project wishes date ranges. :)

But since we're not lawyers...

Warner

On Wed, Jun 13, 2018 at 11:37 PM, Juli Mallett  wrote:

>
>
> On 13 June 2018 at 22:35, Rodney W. Grimes  > wrote:
>
>> > On 13 June 2018 at 20:28, Rodney W. Grimes <
>> free...@pdx.rh.cn85.dnsmgr.net>
>> > wrote:
>> >
>> > > > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
>> ...
>> > > > > > @@ -1,7 +1,8 @@
>> > > > > >  /*-
>> > > > > > - * Copyright (c) 2017 Netflix, Inc
>> > > > > > - * All rights reserved.
>> > > > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>> > > > > >   *
>> > > > > > + * Copyright (C) 2018 Netflix
>> > > > >
>> > > > > You moved a copyright forward, that is not proper to do.
>> > > > >
>> > > >
>> > > > Thought it was. I honestly don't care where (nor does my employer),
>> so if
>> > > > you want to tweak it to be more conforming, be my guest.
>> > >
>> > > You can add a new date to the end of a list, but you should always
>> > > retain the oldest date, and many opinions are that all dates should
>> > > be retained unless they are continuous.
>> > >
>> >
>> > Do you have a citation for this, Rod?  I ask because my impression was
>> that
>> > although it has often been done, and at one point may legitimately have
>> > been required, it is not any longer so.  I'd love to have a concrete
>> source
>> > on this, though.
>>
>> One place to start is circ15:
>> https://www.copyright.gov/circs/circ15a.pdf
>>
>> Fundemental principle of copyright protections duration are from -first-
>> date of publication, that is covered in USC 17.  If you miss represent
>> that date in your copyright your copyright can be held invalid.
>> The real smoking gun is:
>> 17 USC 401 b (2):
>> the year of first publication of the work; in the
>> case of compilations or derivative works incorporating
>> previously published material, the year date of first
>> publication of the compilation or derivative work is
>> sufficient. The year date may be omitted where a pictorial,
>> graphic, or sculptural work, with accompanying text matter,
>> if any, is reproduced in or on greeting cards, postcards,
>> stationery, jewelry, dolls, toys, or any useful articles; and
>>
>> The interpretation of compilation or derivative does open a grey
>> area here in software, and I can see how one might consider a
>> patch to create a derived work.
>>
>
> Per your quote:
> "the year of first publication of the work; in the
> case of compilations or derivative works incorporating
> previously published material, the year date of first
> publication of the compilation or derivative work is
> sufficient."
>
> It seems to plainly suggest listing one year, not several years, and
> certainly not by some convoluted scheme.
>
> We're not lawyers.  I'm not sure this is a useful discussion.  I'd love a
> citation for the multiple-years scheme you describe, which does not seem to
> be in USC 17.
>
>
> There is case law that putting a date later than first publication
>> appears as an attempt to move the duration of your protection
>> to be longer than it really should be.
>>
>> https://www.copyright.gov/comp3/chap2200/ch2200-notice.pdf
>> At 2202.2(A) Advantages to Using Notice on Post-Berne Works
>> "It identifies the year of first publication,
>> which may be used to determine the term of copyright
>> protection in the case of an anonymous work,
>> a pseudonymous work, or a work made for hire."
>>
>> Much of our work, and in this case of Netflix and these
>> files, they are defanitly works made for hire, so this
>> applies and identifying first date of publication is
>> important.
>>
>> There is also:
>> At 2203.1 Works First Published Between January 1, 1978 and February 28,
>> 1989
>> This Applies to some of our code, as it has First publications
>> in these date ranges, boils down to even though Berne says you dont
>> have to have a notice, if you first published the work in this time
>> frame you had to have a notice then, and you still have to have a
>> notice now.
>>
>> Yes, Disney and others have done fun stuff with copyrights on *movies*,
>> but that has other complications doing with re-mixes and all sorts of
>> other
>> things that make it possible for them to claim 

svn commit: r335109 - head/sys/arm64/rockchip/clk

2018-06-13 Thread Emmanuel Vadot
Author: manu
Date: Thu Jun 14 05:46:57 2018
New Revision: 335109
URL: https://svnweb.freebsd.org/changeset/base/335109

Log:
  rk_armclk: Add the write mask to the register mux value
  
  This was omitted in r334112 and r334996 which cause the PLL to not correctly
  reparent, leaving the armclk to be derived from the APLL instead of the NPLL.
  The arm core clock is now correctly set to 600Mhz via the assigned-clock 
present
  in the DTB.

Modified:
  head/sys/arm64/rockchip/clk/rk_clk_armclk.c

Modified: head/sys/arm64/rockchip/clk/rk_clk_armclk.c
==
--- head/sys/arm64/rockchip/clk/rk_clk_armclk.c Thu Jun 14 05:43:45 2018
(r335108)
+++ head/sys/arm64/rockchip/clk/rk_clk_armclk.c Thu Jun 14 05:46:57 2018
(r335109)
@@ -105,7 +105,7 @@ rk_clk_armclk_set_mux(struct clknode *clk, int index)
DEVICE_LOCK(clk);
READ4(clk, sc->muxdiv_offset, );
val &= ~(sc->mux_mask >> sc->mux_shift);
-   val |= index << sc->mux_shift;
+   val |= index << sc->mux_shift | RK_ARMCLK_WRITE_MASK;
WRITE4(clk, sc->muxdiv_offset, val);
DEVICE_UNLOCK(clk);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335108 - head/sys/arm64/rockchip/clk

2018-06-13 Thread Emmanuel Vadot
Author: manu
Date: Thu Jun 14 05:43:45 2018
New Revision: 335108
URL: https://svnweb.freebsd.org/changeset/base/335108

Log:
  rk_pll: Add support for mode
  
  RockChip PLL have two modes controlled by a register, a "slow mode" (the
  default one) where the frequency is derived from the 24Mhz oscillator on the
  board, and a "normal" one when the pll take it's input from the real PLL 
output.
  
  Default the mode to normal for all the PLLs.

Modified:
  head/sys/arm64/rockchip/clk/rk3328_cru.c
  head/sys/arm64/rockchip/clk/rk_clk_pll.c
  head/sys/arm64/rockchip/clk/rk_clk_pll.h

Modified: head/sys/arm64/rockchip/clk/rk3328_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3328_cru.cThu Jun 14 05:41:16 2018
(r335107)
+++ head/sys/arm64/rockchip/clk/rk3328_cru.cThu Jun 14 05:43:45 2018
(r335108)
@@ -512,6 +512,8 @@ static struct rk_clk_pll_def apll = {
.base_offset = 0x00,
.gate_offset = 0x200,
.gate_shift = 0,
+   .mode_reg = 0x80,
+   .mode_val = 0x1,
.flags = RK_CLK_PLL_HAVE_GATE,
.frac_rates = rk3328_pll_frac_rates,
 };
@@ -526,6 +528,8 @@ static struct rk_clk_pll_def dpll = {
.base_offset = 0x20,
.gate_offset = 0x200,
.gate_shift = 1,
+   .mode_reg = 0x80,
+   .mode_val = 0x8,
.flags = RK_CLK_PLL_HAVE_GATE,
 };
 
@@ -537,6 +541,8 @@ static struct rk_clk_pll_def cpll = {
.parent_cnt = nitems(pll_parents),
},
.base_offset = 0x40,
+   .mode_reg = 0x80,
+   .mode_val = 0x80,
.rates = rk3328_pll_rates,
 };
 
@@ -550,6 +556,8 @@ static struct rk_clk_pll_def gpll = {
.base_offset = 0x60,
.gate_offset = 0x200,
.gate_shift = 2,
+   .mode_reg = 0x80,
+   .mode_val = 0x800,
.flags = RK_CLK_PLL_HAVE_GATE,
.frac_rates = rk3328_pll_frac_rates,
 };
@@ -564,6 +572,8 @@ static struct rk_clk_pll_def npll = {
.base_offset = 0xa0,
.gate_offset = 0x200,
.gate_shift = 12,
+   .mode_reg = 0x80,
+   .mode_val = 0x2,
.flags = RK_CLK_PLL_HAVE_GATE,
.rates = rk3328_pll_rates,
 };

Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.c
==
--- head/sys/arm64/rockchip/clk/rk_clk_pll.cThu Jun 14 05:41:16 2018
(r335107)
+++ head/sys/arm64/rockchip/clk/rk_clk_pll.cThu Jun 14 05:43:45 2018
(r335108)
@@ -47,6 +47,9 @@ struct rk_clk_pll_sc {
uint32_tgate_offset;
uint32_tgate_shift;
 
+   uint32_tmode_reg;
+   uint32_tmode_val;
+
uint32_tflags;
 
struct rk_clk_pll_rate  *rates;
@@ -221,6 +224,11 @@ rk_clk_pll_set_freq(struct clknode *clk, uint64_t fpar
reg |= rates->frac << RK_CLK_PLL_FRAC_SHIFT;
WRITE4(clk, sc->base_offset + 0x8, reg);
 
+   /* Setting to normal mode */
+   READ4(clk, sc->mode_reg, );
+   reg |= sc->mode_val << 16 | sc->mode_val;
+   WRITE4(clk, sc->mode_reg, reg);
+
/* Reading lock */
for (timeout = 1000; timeout; timeout--) {
READ4(clk, sc->base_offset + 0x4, );
@@ -263,6 +271,8 @@ rk_clk_pll_register(struct clkdom *clkdom, struct rk_c
sc->base_offset = clkdef->base_offset;
sc->gate_offset = clkdef->gate_offset;
sc->gate_shift = clkdef->gate_shift;
+   sc->mode_reg = clkdef->mode_reg;
+   sc->mode_val = clkdef->mode_val;
sc->flags = clkdef->flags;
sc->rates = clkdef->rates;
sc->frac_rates = clkdef->frac_rates;

Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.h
==
--- head/sys/arm64/rockchip/clk/rk_clk_pll.hThu Jun 14 05:41:16 2018
(r335107)
+++ head/sys/arm64/rockchip/clk/rk_clk_pll.hThu Jun 14 05:43:45 2018
(r335108)
@@ -50,6 +50,9 @@ struct rk_clk_pll_def {
uint32_tgate_offset;
uint32_tgate_shift;
 
+   uint32_tmode_reg;
+   uint32_tmode_val;
+
uint32_tflags;
 
struct rk_clk_pll_rate  *rates;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335107 - head/sys/arm64/rockchip

2018-06-13 Thread Emmanuel Vadot
Author: manu
Date: Thu Jun 14 05:41:16 2018
New Revision: 335107
URL: https://svnweb.freebsd.org/changeset/base/335107

Log:
  rk_pinctrl: Only add gpio subnode
  
  This is the only node we are interested in so do not waste time to test
  creating device that will be either unused or fail as most of the nodes
  don't have a compatible string.

Modified:
  head/sys/arm64/rockchip/rk_pinctrl.c

Modified: head/sys/arm64/rockchip/rk_pinctrl.c
==
--- head/sys/arm64/rockchip/rk_pinctrl.cThu Jun 14 03:27:42 2018
(r335106)
+++ head/sys/arm64/rockchip/rk_pinctrl.cThu Jun 14 05:41:16 2018
(r335107)
@@ -438,6 +438,8 @@ rk_pinctrl_attach(device_t dev)
 
/* Attach child devices */
for (node = OF_child(node); node > 0; node = OF_peer(node)) {
+   if (!ofw_bus_node_is_compatible(node, "rockchip,gpio-bank"))
+   continue;
cdev = simplebus_add_device(dev, node, 0, NULL, -1, NULL);
if (cdev != NULL)
device_probe_and_attach(cdev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Juli Mallett
On 13 June 2018 at 22:35, Rodney W. Grimes 
wrote:

> > On 13 June 2018 at 20:28, Rodney W. Grimes  net>
> > wrote:
> >
> > > > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
> ...
> > > > > > @@ -1,7 +1,8 @@
> > > > > >  /*-
> > > > > > - * Copyright (c) 2017 Netflix, Inc
> > > > > > - * All rights reserved.
> > > > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> > > > > >   *
> > > > > > + * Copyright (C) 2018 Netflix
> > > > >
> > > > > You moved a copyright forward, that is not proper to do.
> > > > >
> > > >
> > > > Thought it was. I honestly don't care where (nor does my employer),
> so if
> > > > you want to tweak it to be more conforming, be my guest.
> > >
> > > You can add a new date to the end of a list, but you should always
> > > retain the oldest date, and many opinions are that all dates should
> > > be retained unless they are continuous.
> > >
> >
> > Do you have a citation for this, Rod?  I ask because my impression was
> that
> > although it has often been done, and at one point may legitimately have
> > been required, it is not any longer so.  I'd love to have a concrete
> source
> > on this, though.
>
> One place to start is circ15:
> https://www.copyright.gov/circs/circ15a.pdf
>
> Fundemental principle of copyright protections duration are from -first-
> date of publication, that is covered in USC 17.  If you miss represent
> that date in your copyright your copyright can be held invalid.
> The real smoking gun is:
> 17 USC 401 b (2):
> the year of first publication of the work; in the
> case of compilations or derivative works incorporating
> previously published material, the year date of first
> publication of the compilation or derivative work is
> sufficient. The year date may be omitted where a pictorial,
> graphic, or sculptural work, with accompanying text matter,
> if any, is reproduced in or on greeting cards, postcards,
> stationery, jewelry, dolls, toys, or any useful articles; and
>
> The interpretation of compilation or derivative does open a grey
> area here in software, and I can see how one might consider a
> patch to create a derived work.
>

Per your quote:
"the year of first publication of the work; in the
case of compilations or derivative works incorporating
previously published material, the year date of first
publication of the compilation or derivative work is
sufficient."

It seems to plainly suggest listing one year, not several years, and
certainly not by some convoluted scheme.

We're not lawyers.  I'm not sure this is a useful discussion.  I'd love a
citation for the multiple-years scheme you describe, which does not seem to
be in USC 17.


There is case law that putting a date later than first publication
> appears as an attempt to move the duration of your protection
> to be longer than it really should be.
>
> https://www.copyright.gov/comp3/chap2200/ch2200-notice.pdf
> At 2202.2(A) Advantages to Using Notice on Post-Berne Works
> "It identifies the year of first publication,
> which may be used to determine the term of copyright
> protection in the case of an anonymous work,
> a pseudonymous work, or a work made for hire."
>
> Much of our work, and in this case of Netflix and these
> files, they are defanitly works made for hire, so this
> applies and identifying first date of publication is
> important.
>
> There is also:
> At 2203.1 Works First Published Between January 1, 1978 and February 28,
> 1989
> This Applies to some of our code, as it has First publications
> in these date ranges, boils down to even though Berne says you dont
> have to have a notice, if you first published the work in this time
> frame you had to have a notice then, and you still have to have a
> notice now.
>
> Yes, Disney and others have done fun stuff with copyrights on *movies*,
> but that has other complications doing with re-mixes and all sorts of other
> things that make it possible for them to claim it is a new creative
> work, not just a revision of an old work.
>
> I could re research the case law if you really want more.
>
>
> > > It would be much simpler for you to commit:
> > > - * Copyright (C) 2018 Netflix
> > > + * Copyright (C) 2017-2018 Netflix
> > >
> > > Than for me to get approval: bde, phk.
> > >
> > > Thanks.
> > > Rod
> > >
> > > >
> > > > > Not sure about dropping the , Inc either.
> > > >
> > > >
> > > > Doesn't matter. Different Netflix committers do different things and
> I
> > > was
> > > > trying to move towards uniformity.
> > >
> > > Ok
> > >
> > > > Warner
> > >
> > > --
> > > Rod Grimes
> > > rgri...@freebsd.org
> > >
> > >
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Rodney W. Grimes
> On 13 June 2018 at 20:28, Rodney W. Grimes 
> wrote:
> 
> > > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
...
> > > > > @@ -1,7 +1,8 @@
> > > > >  /*-
> > > > > - * Copyright (c) 2017 Netflix, Inc
> > > > > - * All rights reserved.
> > > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> > > > >   *
> > > > > + * Copyright (C) 2018 Netflix
> > > >
> > > > You moved a copyright forward, that is not proper to do.
> > > >
> > >
> > > Thought it was. I honestly don't care where (nor does my employer), so if
> > > you want to tweak it to be more conforming, be my guest.
> >
> > You can add a new date to the end of a list, but you should always
> > retain the oldest date, and many opinions are that all dates should
> > be retained unless they are continuous.
> >
> 
> Do you have a citation for this, Rod?  I ask because my impression was that
> although it has often been done, and at one point may legitimately have
> been required, it is not any longer so.  I'd love to have a concrete source
> on this, though.

One place to start is circ15:
https://www.copyright.gov/circs/circ15a.pdf

Fundemental principle of copyright protections duration are from -first-
date of publication, that is covered in USC 17.  If you miss represent
that date in your copyright your copyright can be held invalid.
The real smoking gun is:
17 USC 401 b (2):
the year of first publication of the work; in the
case of compilations or derivative works incorporating
previously published material, the year date of first
publication of the compilation or derivative work is
sufficient. The year date may be omitted where a pictorial,
graphic, or sculptural work, with accompanying text matter,
if any, is reproduced in or on greeting cards, postcards,
stationery, jewelry, dolls, toys, or any useful articles; and

The interpretation of compilation or derivative does open a grey
area here in software, and I can see how one might consider a
patch to create a derived work.

There is case law that putting a date later than first publication
appears as an attempt to move the duration of your protection
to be longer than it really should be.

https://www.copyright.gov/comp3/chap2200/ch2200-notice.pdf
At 2202.2(A) Advantages to Using Notice on Post-Berne Works
"It identifies the year of first publication,
which may be used to determine the term of copyright
protection in the case of an anonymous work,
a pseudonymous work, or a work made for hire."

Much of our work, and in this case of Netflix and these
files, they are defanitly works made for hire, so this
applies and identifying first date of publication is
important.

There is also:
At 2203.1 Works First Published Between January 1, 1978 and February 28, 1989
This Applies to some of our code, as it has First publications
in these date ranges, boils down to even though Berne says you dont
have to have a notice, if you first published the work in this time
frame you had to have a notice then, and you still have to have a
notice now.

Yes, Disney and others have done fun stuff with copyrights on *movies*,
but that has other complications doing with re-mixes and all sorts of other
things that make it possible for them to claim it is a new creative
work, not just a revision of an old work.

I could re research the case law if you really want more.


> > It would be much simpler for you to commit:
> > - * Copyright (C) 2018 Netflix
> > + * Copyright (C) 2017-2018 Netflix
> >
> > Than for me to get approval: bde, phk.
> >
> > Thanks.
> > Rod
> >
> > >
> > > > Not sure about dropping the , Inc either.
> > >
> > >
> > > Doesn't matter. Different Netflix committers do different things and I
> > was
> > > trying to move towards uniformity.
> >
> > Ok
> >
> > > Warner
> >
> > --
> > Rod Grimes
> > rgri...@freebsd.org
> >
> >

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Warner Losh
On Wed, Jun 13, 2018 at 10:57 PM, Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:

> [ Charset UTF-8 unsupported, converting... ]
> > Actually, that file (nvmecontrol_ext.h) is completely new. I'm not sure
> why
> > it thought I copied it from util.c. Maybe it's a git svn integration
> thing.
>
> If it is a totally new file why is it showing contect diff with
> + and -'s?


Don't know, but the whole contents of this file is 1 line of extern
function statements.

Since util.c is short, and I try to use identical copyright notices, I'm
thinking git thought it was a move through 'magic' and that's where svn got
confused into thinking it was a copy + modification which is where the diff
came from.

Warner


> > Warner
> >
> > On Wed, Jun 13, 2018 at 9:31 PM, Warner Losh  wrote:
> >
> > > Ah, that's what you were talking about. OK. Will do.
> > >
> > > Warner
> > >
> > > On Wed, Jun 13, 2018 at 9:28 PM, Rodney W. Grimes <
> > > free...@pdx.rh.cn85.dnsmgr.net> wrote:
> > >
> > >> > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
> > >> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
> > >> >
> > >> > > > Author: imp
> > >> > > > Date: Wed Jun 13 22:00:02 2018
> > >> > > > New Revision: 335091
> > >> > > > URL: https://svnweb.freebsd.org/changeset/base/335091
> > >> > > >
> > >> > > > Log:
> > >> > > >   Make it possible to use print_controller from another program
> > >> > > >
> > >> > > >   Rename print_controller to nvme_print_controller. Put it in
> its
> > >> > > >   own file for easy inclusion. Move util.c to be nc_util.c to
> not
> > >> > > >   conflict with camcontrol. add nvecontrol_ext.h to define
> shared
> > >> > > >   interfaces.
> > >> > > >
> > >> > > >   Sponsored by: Netflix
> > >> > > >   Differential Revision: https://reviews.freebsd.org/D15371
> > >> > > >
> > >> > > > Added:
> > >> > > >   head/sbin/nvmecontrol/identify_ext.c
> > >> > > >  - copied, changed from r335089,
> head/sbin/nvmecontrol/identify
> > >> .c
> > >> > > >   head/sbin/nvmecontrol/nc_util.c
> > >> > > >  - copied, changed from r335089,
> head/sbin/nvmecontrol/util.c
> > >> > > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props
> > >> changed)
> > >> > > >  - copied, changed from r335089,
> head/sbin/nvmecontrol/util.c
> > >> > > ...
> > >> > >
> > >> > > >
> > >> > > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h
> (from
> > >> > > r335089, head/sbin/nvmecontrol/util.c)
> > >> > > > 
> > >> > > ==
> > >> > > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> > >> > > (r335089, copy source)
> > >> > > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13
> 22:00:02
> > >> 2018
> > >> > >   (r335091)
> > >> > > > @@ -1,7 +1,8 @@
> > >> > > >  /*-
> > >> > > > - * Copyright (c) 2017 Netflix, Inc
> > >> > > > - * All rights reserved.
> > >> > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> > >> > > >   *
> > >> > > > + * Copyright (C) 2018 Netflix
> > >> > >
> > >> > > You moved a copyright forward, that is not proper to do.
> > >> > >
> > >> >
> > >> > Thought it was. I honestly don't care where (nor does my employer),
> so
> > >> if
> > >> > you want to tweak it to be more conforming, be my guest.
> > >>
> > >> You can add a new date to the end of a list, but you should always
> > >> retain the oldest date, and many opinions are that all dates should
> > >> be retained unless they are continuous.
> > >>
> > >> It would be much simpler for you to commit:
> > >> - * Copyright (C) 2018 Netflix
> > >> + * Copyright (C) 2017-2018 Netflix
> > >>
> > >> Than for me to get approval: bde, phk.
> > >>
> > >> Thanks.
> > >> Rod
> > >>
> > >> >
> > >> > > Not sure about dropping the , Inc either.
> > >> >
> > >> >
> > >> > Doesn't matter. Different Netflix committers do different things
> and I
> > >> was
> > >> > trying to move towards uniformity.
> > >>
> > >> Ok
> > >>
> > >> > Warner
> > >>
> > >> --
> > >> Rod Grimes
> > >> rgri...@freebsd.org
> > >>
> > >
> > >
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Rodney W. Grimes
> On Wed, Jun 13, 2018 at 9:31 PM, Juli Mallett  wrote:
> 
> > On 13 June 2018 at 20:28, Rodney W. Grimes  > > wrote:
> >
> >> > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
> >> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
> >> >
> >> > > > Author: imp
> >> > > > Date: Wed Jun 13 22:00:02 2018
> >> > > > New Revision: 335091
> >> > > > URL: https://svnweb.freebsd.org/changeset/base/335091
> >> > > >
> >> > > > Log:
> >> > > >   Make it possible to use print_controller from another program
> >> > > >
> >> > > >   Rename print_controller to nvme_print_controller. Put it in its
> >> > > >   own file for easy inclusion. Move util.c to be nc_util.c to not
> >> > > >   conflict with camcontrol. add nvecontrol_ext.h to define shared
> >> > > >   interfaces.
> >> > > >
> >> > > >   Sponsored by: Netflix
> >> > > >   Differential Revision: https://reviews.freebsd.org/D15371
> >> > > >
> >> > > > Added:
> >> > > >   head/sbin/nvmecontrol/identify_ext.c
> >> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/identify
> >> .c
> >> > > >   head/sbin/nvmecontrol/nc_util.c
> >> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> >> > > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props
> >> changed)
> >> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> >> > > ...
> >> > >
> >> > > >
> >> > > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
> >> > > r335089, head/sbin/nvmecontrol/util.c)
> >> > > > 
> >> > > ==
> >> > > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> >> > > (r335089, copy source)
> >> > > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02
> >> 2018
> >> > >   (r335091)
> >> > > > @@ -1,7 +1,8 @@
> >> > > >  /*-
> >> > > > - * Copyright (c) 2017 Netflix, Inc
> >> > > > - * All rights reserved.
> >> > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> >> > > >   *
> >> > > > + * Copyright (C) 2018 Netflix
> >> > >
> >> > > You moved a copyright forward, that is not proper to do.
> >> > >
> >> >
> >> > Thought it was. I honestly don't care where (nor does my employer), so
> >> if
> >> > you want to tweak it to be more conforming, be my guest.
> >>
> >> You can add a new date to the end of a list, but you should always
> >> retain the oldest date, and many opinions are that all dates should
> >> be retained unless they are continuous.
> >>
> >
> > Do you have a citation for this, Rod?  I ask because my impression was
> > that although it has often been done, and at one point may legitimately
> > have been required, it is not any longer so.  I'd love to have a concrete
> > source on this, though.
> >
> 
> The project just does oldest and newest with a -.
> 
> The US copyright office says you just need the newest. There's some concern
Can you be more specific on where on the US copyright offices site?

> elsewhere is different, but I have nothing concrete on that.
> 
> I've never heard Rod's advice in the 20 years I've been minding the store
> here and at small shops I've worked at.

And have any of these places actually read the text of USC 17?

> Warner
> 
> 
> >
> >
> It would be much simpler for you to commit:
> >> - * Copyright (C) 2018 Netflix
> >> + * Copyright (C) 2017-2018 Netflix
> >>
> >> Than for me to get approval: bde, phk.
> >>
> >> Thanks.
> >> Rod
> >>
> >> >
> >> > > Not sure about dropping the , Inc either.
> >> >
> >> >
> >> > Doesn't matter. Different Netflix committers do different things and I
> >> was
> >> > trying to move towards uniformity.
> >>
> >> Ok
> >>
> >> > Warner
> >>
> >> --
> >> Rod Grimes
> >> rgri...@freebsd.org
> >>
> >>
> >

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Actually, that file (nvmecontrol_ext.h) is completely new. I'm not sure why
> it thought I copied it from util.c. Maybe it's a git svn integration thing.

If it is a totally new file why is it showing contect diff with
+ and -'s?


> Warner
> 
> On Wed, Jun 13, 2018 at 9:31 PM, Warner Losh  wrote:
> 
> > Ah, that's what you were talking about. OK. Will do.
> >
> > Warner
> >
> > On Wed, Jun 13, 2018 at 9:28 PM, Rodney W. Grimes <
> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
> >
> >> > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
> >> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
> >> >
> >> > > > Author: imp
> >> > > > Date: Wed Jun 13 22:00:02 2018
> >> > > > New Revision: 335091
> >> > > > URL: https://svnweb.freebsd.org/changeset/base/335091
> >> > > >
> >> > > > Log:
> >> > > >   Make it possible to use print_controller from another program
> >> > > >
> >> > > >   Rename print_controller to nvme_print_controller. Put it in its
> >> > > >   own file for easy inclusion. Move util.c to be nc_util.c to not
> >> > > >   conflict with camcontrol. add nvecontrol_ext.h to define shared
> >> > > >   interfaces.
> >> > > >
> >> > > >   Sponsored by: Netflix
> >> > > >   Differential Revision: https://reviews.freebsd.org/D15371
> >> > > >
> >> > > > Added:
> >> > > >   head/sbin/nvmecontrol/identify_ext.c
> >> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/identify
> >> .c
> >> > > >   head/sbin/nvmecontrol/nc_util.c
> >> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> >> > > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props
> >> changed)
> >> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> >> > > ...
> >> > >
> >> > > >
> >> > > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
> >> > > r335089, head/sbin/nvmecontrol/util.c)
> >> > > > 
> >> > > ==
> >> > > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> >> > > (r335089, copy source)
> >> > > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02
> >> 2018
> >> > >   (r335091)
> >> > > > @@ -1,7 +1,8 @@
> >> > > >  /*-
> >> > > > - * Copyright (c) 2017 Netflix, Inc
> >> > > > - * All rights reserved.
> >> > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> >> > > >   *
> >> > > > + * Copyright (C) 2018 Netflix
> >> > >
> >> > > You moved a copyright forward, that is not proper to do.
> >> > >
> >> >
> >> > Thought it was. I honestly don't care where (nor does my employer), so
> >> if
> >> > you want to tweak it to be more conforming, be my guest.
> >>
> >> You can add a new date to the end of a list, but you should always
> >> retain the oldest date, and many opinions are that all dates should
> >> be retained unless they are continuous.
> >>
> >> It would be much simpler for you to commit:
> >> - * Copyright (C) 2018 Netflix
> >> + * Copyright (C) 2017-2018 Netflix
> >>
> >> Than for me to get approval: bde, phk.
> >>
> >> Thanks.
> >> Rod
> >>
> >> >
> >> > > Not sure about dropping the , Inc either.
> >> >
> >> >
> >> > Doesn't matter. Different Netflix committers do different things and I
> >> was
> >> > trying to move towards uniformity.
> >>
> >> Ok
> >>
> >> > Warner
> >>
> >> --
> >> Rod Grimes
> >> rgri...@freebsd.org
> >>
> >
> >

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335042 - head/usr.bin/top

2018-06-13 Thread Alexey Dokuchaev
On Wed, Jun 13, 2018 at 05:01:35PM -0700, Bryan Drewery wrote:
> ...
> Also I really abhor rewriting anything that's not broken as it causes
> merge conflict pain downstream and just adds regression risk.

+1.  I'm still having mixed feelings about top(1) de-contrib and rewrite.
At the very least, it should not be MFC'ed until it matures long enough
in -CURRENT and all regressions are found and fixed (they pop up here and
there now).  Currently top(1) is still a pessimization compared to what it
was before, so there's a lot to catch up with.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Warner Losh
On Wed, Jun 13, 2018 at 9:31 PM, Juli Mallett  wrote:

> On 13 June 2018 at 20:28, Rodney W. Grimes  > wrote:
>
>> > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
>> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
>> >
>> > > > Author: imp
>> > > > Date: Wed Jun 13 22:00:02 2018
>> > > > New Revision: 335091
>> > > > URL: https://svnweb.freebsd.org/changeset/base/335091
>> > > >
>> > > > Log:
>> > > >   Make it possible to use print_controller from another program
>> > > >
>> > > >   Rename print_controller to nvme_print_controller. Put it in its
>> > > >   own file for easy inclusion. Move util.c to be nc_util.c to not
>> > > >   conflict with camcontrol. add nvecontrol_ext.h to define shared
>> > > >   interfaces.
>> > > >
>> > > >   Sponsored by: Netflix
>> > > >   Differential Revision: https://reviews.freebsd.org/D15371
>> > > >
>> > > > Added:
>> > > >   head/sbin/nvmecontrol/identify_ext.c
>> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/identify
>> .c
>> > > >   head/sbin/nvmecontrol/nc_util.c
>> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
>> > > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props
>> changed)
>> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
>> > > ...
>> > >
>> > > >
>> > > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
>> > > r335089, head/sbin/nvmecontrol/util.c)
>> > > > 
>> > > ==
>> > > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
>> > > (r335089, copy source)
>> > > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02
>> 2018
>> > >   (r335091)
>> > > > @@ -1,7 +1,8 @@
>> > > >  /*-
>> > > > - * Copyright (c) 2017 Netflix, Inc
>> > > > - * All rights reserved.
>> > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>> > > >   *
>> > > > + * Copyright (C) 2018 Netflix
>> > >
>> > > You moved a copyright forward, that is not proper to do.
>> > >
>> >
>> > Thought it was. I honestly don't care where (nor does my employer), so
>> if
>> > you want to tweak it to be more conforming, be my guest.
>>
>> You can add a new date to the end of a list, but you should always
>> retain the oldest date, and many opinions are that all dates should
>> be retained unless they are continuous.
>>
>
> Do you have a citation for this, Rod?  I ask because my impression was
> that although it has often been done, and at one point may legitimately
> have been required, it is not any longer so.  I'd love to have a concrete
> source on this, though.
>

The project just does oldest and newest with a -.

The US copyright office says you just need the newest. There's some concern
elsewhere is different, but I have nothing concrete on that.

I've never heard Rod's advice in the 20 years I've been minding the store
here and at small shops I've worked at.

Warner


>
>
It would be much simpler for you to commit:
>> - * Copyright (C) 2018 Netflix
>> + * Copyright (C) 2017-2018 Netflix
>>
>> Than for me to get approval: bde, phk.
>>
>> Thanks.
>> Rod
>>
>> >
>> > > Not sure about dropping the , Inc either.
>> >
>> >
>> > Doesn't matter. Different Netflix committers do different things and I
>> was
>> > trying to move towards uniformity.
>>
>> Ok
>>
>> > Warner
>>
>> --
>> Rod Grimes
>> rgri...@freebsd.org
>>
>>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Warner Losh
Actually, that file (nvmecontrol_ext.h) is completely new. I'm not sure why
it thought I copied it from util.c. Maybe it's a git svn integration thing.

Warner

On Wed, Jun 13, 2018 at 9:31 PM, Warner Losh  wrote:

> Ah, that's what you were talking about. OK. Will do.
>
> Warner
>
> On Wed, Jun 13, 2018 at 9:28 PM, Rodney W. Grimes <
> free...@pdx.rh.cn85.dnsmgr.net> wrote:
>
>> > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
>> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
>> >
>> > > > Author: imp
>> > > > Date: Wed Jun 13 22:00:02 2018
>> > > > New Revision: 335091
>> > > > URL: https://svnweb.freebsd.org/changeset/base/335091
>> > > >
>> > > > Log:
>> > > >   Make it possible to use print_controller from another program
>> > > >
>> > > >   Rename print_controller to nvme_print_controller. Put it in its
>> > > >   own file for easy inclusion. Move util.c to be nc_util.c to not
>> > > >   conflict with camcontrol. add nvecontrol_ext.h to define shared
>> > > >   interfaces.
>> > > >
>> > > >   Sponsored by: Netflix
>> > > >   Differential Revision: https://reviews.freebsd.org/D15371
>> > > >
>> > > > Added:
>> > > >   head/sbin/nvmecontrol/identify_ext.c
>> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/identify
>> .c
>> > > >   head/sbin/nvmecontrol/nc_util.c
>> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
>> > > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props
>> changed)
>> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
>> > > ...
>> > >
>> > > >
>> > > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
>> > > r335089, head/sbin/nvmecontrol/util.c)
>> > > > 
>> > > ==
>> > > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
>> > > (r335089, copy source)
>> > > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02
>> 2018
>> > >   (r335091)
>> > > > @@ -1,7 +1,8 @@
>> > > >  /*-
>> > > > - * Copyright (c) 2017 Netflix, Inc
>> > > > - * All rights reserved.
>> > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>> > > >   *
>> > > > + * Copyright (C) 2018 Netflix
>> > >
>> > > You moved a copyright forward, that is not proper to do.
>> > >
>> >
>> > Thought it was. I honestly don't care where (nor does my employer), so
>> if
>> > you want to tweak it to be more conforming, be my guest.
>>
>> You can add a new date to the end of a list, but you should always
>> retain the oldest date, and many opinions are that all dates should
>> be retained unless they are continuous.
>>
>> It would be much simpler for you to commit:
>> - * Copyright (C) 2018 Netflix
>> + * Copyright (C) 2017-2018 Netflix
>>
>> Than for me to get approval: bde, phk.
>>
>> Thanks.
>> Rod
>>
>> >
>> > > Not sure about dropping the , Inc either.
>> >
>> >
>> > Doesn't matter. Different Netflix committers do different things and I
>> was
>> > trying to move towards uniformity.
>>
>> Ok
>>
>> > Warner
>>
>> --
>> Rod Grimes
>> rgri...@freebsd.org
>>
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Juli Mallett
On 13 June 2018 at 20:28, Rodney W. Grimes 
wrote:

> > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
> >
> > > > Author: imp
> > > > Date: Wed Jun 13 22:00:02 2018
> > > > New Revision: 335091
> > > > URL: https://svnweb.freebsd.org/changeset/base/335091
> > > >
> > > > Log:
> > > >   Make it possible to use print_controller from another program
> > > >
> > > >   Rename print_controller to nvme_print_controller. Put it in its
> > > >   own file for easy inclusion. Move util.c to be nc_util.c to not
> > > >   conflict with camcontrol. add nvecontrol_ext.h to define shared
> > > >   interfaces.
> > > >
> > > >   Sponsored by: Netflix
> > > >   Differential Revision: https://reviews.freebsd.org/D15371
> > > >
> > > > Added:
> > > >   head/sbin/nvmecontrol/identify_ext.c
> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/
> identify.c
> > > >   head/sbin/nvmecontrol/nc_util.c
> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> > > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props
> changed)
> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> > > ...
> > >
> > > >
> > > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
> > > r335089, head/sbin/nvmecontrol/util.c)
> > > > 
> > > ==
> > > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> > > (r335089, copy source)
> > > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02
> 2018
> > >   (r335091)
> > > > @@ -1,7 +1,8 @@
> > > >  /*-
> > > > - * Copyright (c) 2017 Netflix, Inc
> > > > - * All rights reserved.
> > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> > > >   *
> > > > + * Copyright (C) 2018 Netflix
> > >
> > > You moved a copyright forward, that is not proper to do.
> > >
> >
> > Thought it was. I honestly don't care where (nor does my employer), so if
> > you want to tweak it to be more conforming, be my guest.
>
> You can add a new date to the end of a list, but you should always
> retain the oldest date, and many opinions are that all dates should
> be retained unless they are continuous.
>

Do you have a citation for this, Rod?  I ask because my impression was that
although it has often been done, and at one point may legitimately have
been required, it is not any longer so.  I'd love to have a concrete source
on this, though.


> It would be much simpler for you to commit:
> - * Copyright (C) 2018 Netflix
> + * Copyright (C) 2017-2018 Netflix
>
> Than for me to get approval: bde, phk.
>
> Thanks.
> Rod
>
> >
> > > Not sure about dropping the , Inc either.
> >
> >
> > Doesn't matter. Different Netflix committers do different things and I
> was
> > trying to move towards uniformity.
>
> Ok
>
> > Warner
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Warner Losh
Ah, that's what you were talking about. OK. Will do.

Warner

On Wed, Jun 13, 2018 at 9:28 PM, Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:

> > On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
> > free...@pdx.rh.cn85.dnsmgr.net> wrote:
> >
> > > > Author: imp
> > > > Date: Wed Jun 13 22:00:02 2018
> > > > New Revision: 335091
> > > > URL: https://svnweb.freebsd.org/changeset/base/335091
> > > >
> > > > Log:
> > > >   Make it possible to use print_controller from another program
> > > >
> > > >   Rename print_controller to nvme_print_controller. Put it in its
> > > >   own file for easy inclusion. Move util.c to be nc_util.c to not
> > > >   conflict with camcontrol. add nvecontrol_ext.h to define shared
> > > >   interfaces.
> > > >
> > > >   Sponsored by: Netflix
> > > >   Differential Revision: https://reviews.freebsd.org/D15371
> > > >
> > > > Added:
> > > >   head/sbin/nvmecontrol/identify_ext.c
> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/
> identify.c
> > > >   head/sbin/nvmecontrol/nc_util.c
> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> > > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props
> changed)
> > > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> > > ...
> > >
> > > >
> > > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
> > > r335089, head/sbin/nvmecontrol/util.c)
> > > > 
> > > ==
> > > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> > > (r335089, copy source)
> > > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02
> 2018
> > >   (r335091)
> > > > @@ -1,7 +1,8 @@
> > > >  /*-
> > > > - * Copyright (c) 2017 Netflix, Inc
> > > > - * All rights reserved.
> > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> > > >   *
> > > > + * Copyright (C) 2018 Netflix
> > >
> > > You moved a copyright forward, that is not proper to do.
> > >
> >
> > Thought it was. I honestly don't care where (nor does my employer), so if
> > you want to tweak it to be more conforming, be my guest.
>
> You can add a new date to the end of a list, but you should always
> retain the oldest date, and many opinions are that all dates should
> be retained unless they are continuous.
>
> It would be much simpler for you to commit:
> - * Copyright (C) 2018 Netflix
> + * Copyright (C) 2017-2018 Netflix
>
> Than for me to get approval: bde, phk.
>
> Thanks.
> Rod
>
> >
> > > Not sure about dropping the , Inc either.
> >
> >
> > Doesn't matter. Different Netflix committers do different things and I
> was
> > trying to move towards uniformity.
>
> Ok
>
> > Warner
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Rodney W. Grimes
> On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
> free...@pdx.rh.cn85.dnsmgr.net> wrote:
> 
> > > Author: imp
> > > Date: Wed Jun 13 22:00:02 2018
> > > New Revision: 335091
> > > URL: https://svnweb.freebsd.org/changeset/base/335091
> > >
> > > Log:
> > >   Make it possible to use print_controller from another program
> > >
> > >   Rename print_controller to nvme_print_controller. Put it in its
> > >   own file for easy inclusion. Move util.c to be nc_util.c to not
> > >   conflict with camcontrol. add nvecontrol_ext.h to define shared
> > >   interfaces.
> > >
> > >   Sponsored by: Netflix
> > >   Differential Revision: https://reviews.freebsd.org/D15371
> > >
> > > Added:
> > >   head/sbin/nvmecontrol/identify_ext.c
> > >  - copied, changed from r335089, head/sbin/nvmecontrol/identify.c
> > >   head/sbin/nvmecontrol/nc_util.c
> > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> > >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props changed)
> > >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> > ...
> >
> > >
> > > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
> > r335089, head/sbin/nvmecontrol/util.c)
> > > 
> > ==
> > > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> > (r335089, copy source)
> > > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02 2018
> >   (r335091)
> > > @@ -1,7 +1,8 @@
> > >  /*-
> > > - * Copyright (c) 2017 Netflix, Inc
> > > - * All rights reserved.
> > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> > >   *
> > > + * Copyright (C) 2018 Netflix
> >
> > You moved a copyright forward, that is not proper to do.
> >
> 
> Thought it was. I honestly don't care where (nor does my employer), so if
> you want to tweak it to be more conforming, be my guest.

You can add a new date to the end of a list, but you should always
retain the oldest date, and many opinions are that all dates should
be retained unless they are continuous.

It would be much simpler for you to commit:
- * Copyright (C) 2018 Netflix
+ * Copyright (C) 2017-2018 Netflix

Than for me to get approval: bde, phk.

Thanks.
Rod

> 
> > Not sure about dropping the , Inc either.
> 
> 
> Doesn't matter. Different Netflix committers do different things and I was
> trying to move towards uniformity.

Ok

> Warner

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335106 - head/sys/netinet/tcp_stacks

2018-06-13 Thread Randall Stewart
Author: rrs
Date: Thu Jun 14 03:27:42 2018
New Revision: 335106
URL: https://svnweb.freebsd.org/changeset/base/335106

Log:
  This fixes several bugs that Larry Rosenman helped me find in
  Rack with respect to its handling of TCP Fast Open. Several
  fixes all related to TFO are included in this commit:
  1) Handling of non-TFO retransmissions
  2) Building the proper send-map when we are doing TFO
  3) Dealing with the ack that comes back that includes the
 SYN and data.
  
  It appears that with this commit TFO now works :-)
  
  Thanks Larry for all your help!!
  
  Sponsored by: Netflix Inc.
  Differential Revision:https://reviews.freebsd.org/D15758

Modified:
  head/sys/netinet/tcp_stacks/rack.c

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Thu Jun 14 02:30:43 2018
(r335105)
+++ head/sys/netinet/tcp_stacks/rack.c  Thu Jun 14 03:27:42 2018
(r335106)
@@ -2083,6 +2083,8 @@ rack_timer_start(struct tcpcb *tp, struct tcp_rack *ra
/* We can't start any timer in persists */
return (rack_get_persists_timer_val(tp, rack));
}
+   if (tp->t_state < TCPS_ESTABLISHED)
+   goto activate_rxt;
rsm = TAILQ_FIRST(>r_ctl.rc_tmap);
if (rsm == NULL) {
/* Nothing on the send map */
@@ -3385,8 +3387,15 @@ again:
rsm->r_tim_lastsent[0] = ts;
rsm->r_rtr_cnt = 1;
rsm->r_rtr_bytes = 0;
-   rsm->r_start = seq_out;
-   rsm->r_end = rsm->r_start + len;
+   if (th_flags & TH_SYN) {
+   /* The data space is one beyond snd_una */
+   rsm->r_start = seq_out + 1;
+   rsm->r_end = rsm->r_start + (len - 1);
+   } else {
+   /* Normal case */
+   rsm->r_start = seq_out;
+   rsm->r_end = rsm->r_start + len;
+   }
rsm->r_sndcnt = 0;
TAILQ_INSERT_TAIL(>r_ctl.rc_map, rsm, r_next);
TAILQ_INSERT_TAIL(>r_ctl.rc_tmap, rsm, r_tnext);
@@ -4657,11 +4666,7 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, s
 * send garbage on first SYN.
 */
int32_t nsegs;
-#ifdef TCP_RFC7413
int32_t tfo_syn;
-#else
-#definetfo_syn (FALSE)
-#endif
struct tcp_rack *rack;
 
rack = (struct tcp_rack *)tp->t_fb_ptr;
@@ -4767,10 +4772,8 @@ dodata:  /* XXX */
 * PRU_RCVD).  If a FIN has already been received on this connection
 * then we just ignore the text.
 */
-#ifdef TCP_RFC7413
tfo_syn = ((tp->t_state == TCPS_SYN_RECEIVED) &&
-   (tp->t_flags & TF_FASTOPEN));
-#endif
+  IS_FASTOPEN(tp->t_flags));
if ((tlen || (thflags & TH_FIN) || tfo_syn) &&
TCPS_HAVERCVDFIN(tp->t_state) == 0) {
tcp_seq save_start = th->th_seq;
@@ -5237,6 +5240,8 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, st
tp->irs = th->th_seq;
tcp_rcvseqinit(tp);
if (thflags & TH_ACK) {
+   int tfo_partial = 0;
+   
TCPSTAT_INC(tcps_connects);
soisconnected(so);
 #ifdef MAC
@@ -5250,10 +5255,19 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, st
tp->rcv_adv += min(tp->rcv_wnd,
TCP_MAXWIN << tp->rcv_scale);
/*
+* If not all the data that was sent in the TFO SYN
+* has been acked, resend the remainder right away.
+*/
+   if (IS_FASTOPEN(tp->t_flags) &&
+   (tp->snd_una != tp->snd_max)) {
+   tp->snd_nxt = th->th_ack;
+   tfo_partial = 1;
+   }
+   /*
 * If there's data, delay ACK; if there's also a FIN ACKNOW
 * will be turned on later.
 */
-   if (DELAY_ACK(tp, tlen) && tlen != 0) {
+   if (DELAY_ACK(tp, tlen) && tlen != 0 && (tfo_partial == 0)) {
rack_timer_cancel(tp, (struct tcp_rack *)tp->t_fb_ptr,
  ((struct tcp_rack 
*)tp->t_fb_ptr)->r_ctl.rc_rcvtime, __LINE__);
tp->t_flags |= TF_DELACK;
@@ -5266,6 +5280,21 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, st
tp->t_flags |= TF_ECN_PERMIT;
TCPSTAT_INC(tcps_ecn_shs);
}
+   if (SEQ_GT(th->th_ack, tp->snd_una)) {
+   /* 
+* We advance snd_una for the 
+* fast open case. If th_ack is
+* acknowledging data beyond 
+* snd_una we can't just call
+ 

Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Warner Losh
On Wed, Jun 13, 2018 at 9:03 PM, Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:

> > Author: imp
> > Date: Wed Jun 13 22:00:02 2018
> > New Revision: 335091
> > URL: https://svnweb.freebsd.org/changeset/base/335091
> >
> > Log:
> >   Make it possible to use print_controller from another program
> >
> >   Rename print_controller to nvme_print_controller. Put it in its
> >   own file for easy inclusion. Move util.c to be nc_util.c to not
> >   conflict with camcontrol. add nvecontrol_ext.h to define shared
> >   interfaces.
> >
> >   Sponsored by: Netflix
> >   Differential Revision: https://reviews.freebsd.org/D15371
> >
> > Added:
> >   head/sbin/nvmecontrol/identify_ext.c
> >  - copied, changed from r335089, head/sbin/nvmecontrol/identify.c
> >   head/sbin/nvmecontrol/nc_util.c
> >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> >   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props changed)
> >  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
> ...
>
> >
> > Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from
> r335089, head/sbin/nvmecontrol/util.c)
> > 
> ==
> > --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> (r335089, copy source)
> > +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02 2018
>   (r335091)
> > @@ -1,7 +1,8 @@
> >  /*-
> > - * Copyright (c) 2017 Netflix, Inc
> > - * All rights reserved.
> > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> >   *
> > + * Copyright (C) 2018 Netflix
>
> You moved a copyright forward, that is not proper to do.
>

Thought it was. I honestly don't care where (nor does my employer), so if
you want to tweak it to be more conforming, be my guest.


> Not sure about dropping the , Inc either.


Doesn't matter. Different Netflix committers do different things and I was
trying to move towards uniformity.

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Rodney W. Grimes
> Author: imp
> Date: Wed Jun 13 22:00:02 2018
> New Revision: 335091
> URL: https://svnweb.freebsd.org/changeset/base/335091
> 
> Log:
>   Make it possible to use print_controller from another program
>   
>   Rename print_controller to nvme_print_controller. Put it in its
>   own file for easy inclusion. Move util.c to be nc_util.c to not
>   conflict with camcontrol. add nvecontrol_ext.h to define shared
>   interfaces.
>   
>   Sponsored by: Netflix
>   Differential Revision: https://reviews.freebsd.org/D15371
> 
> Added:
>   head/sbin/nvmecontrol/identify_ext.c
>  - copied, changed from r335089, head/sbin/nvmecontrol/identify.c
>   head/sbin/nvmecontrol/nc_util.c
>  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
>   head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props changed)
>  - copied, changed from r335089, head/sbin/nvmecontrol/util.c
...

> 
> Copied and modified: head/sbin/nvmecontrol/nvmecontrol_ext.h (from r335089, 
> head/sbin/nvmecontrol/util.c)
> ==
> --- head/sbin/nvmecontrol/util.c  Wed Jun 13 21:10:23 2018
> (r335089, copy source)
> +++ head/sbin/nvmecontrol/nvmecontrol_ext.h   Wed Jun 13 22:00:02 2018
> (r335091)
> @@ -1,7 +1,8 @@
>  /*-
> - * Copyright (c) 2017 Netflix, Inc
> - * All rights reserved.
> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>   *
> + * Copyright (C) 2018 Netflix

You moved a copyright forward, that is not proper to do.
Not sure about dropping the , Inc either.

> + *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions
>   * are met:
> @@ -22,38 +23,8 @@
>   * 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$
>   */
>  

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335105 - head/tests/sys/audit

2018-06-13 Thread Alan Somers
Author: asomers
Date: Thu Jun 14 02:30:43 2018
New Revision: 335105
URL: https://svnweb.freebsd.org/changeset/base/335105

Log:
  audit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15750

Modified:
  head/tests/sys/audit/file-attribute-access.c

Modified: head/tests/sys/audit/file-attribute-access.c
==
--- head/tests/sys/audit/file-attribute-access.cThu Jun 14 01:34:53 
2018(r335104)
+++ head/tests/sys/audit/file-attribute-access.cThu Jun 14 02:30:43 
2018(r335105)
@@ -25,6 +25,9 @@
  * $FreeBSD$
  */
 
+#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -36,9 +39,11 @@
 
 static struct pollfd fds[1];
 static mode_t mode = 0777;
+static pid_t pid;
 static int filedesc;
 static char extregex[80];
 static struct stat statbuff;
+static struct statfs statfsbuff;
 static const char *auclass = "fa";
 static const char *path = "fileforaudit";
 static const char *errpath = "dirdoesnotexist/fileforaudit";
@@ -226,6 +231,145 @@ ATF_TC_CLEANUP(fstatat_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(statfs_success);
+ATF_TC_HEAD(statfs_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "statfs(2) call");
+}
+
+ATF_TC_BODY(statfs_success, tc)
+{
+   /* File needs to exist to call statfs(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, statfs(path, ));
+   check_audit(fds, successreg, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(statfs_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(statfs_failure);
+ATF_TC_HEAD(statfs_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "statfs(2) call");
+}
+
+ATF_TC_BODY(statfs_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: file does not exist */
+   ATF_REQUIRE_EQ(-1, statfs(errpath, ));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(statfs_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fstatfs_success);
+ATF_TC_HEAD(fstatfs_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "fstatfs(2) call");
+}
+
+ATF_TC_BODY(fstatfs_success, tc)
+{
+   /* File needs to exist to call fstat(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT | O_RDWR, mode)) != -1);
+   /* Call stat(2) to store the Inode number of 'path' */
+   ATF_REQUIRE_EQ(0, stat(path, ));
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, fstatfs(filedesc, ));
+
+   snprintf(extregex, sizeof(extregex), "fstatfs.*%jd.*return,success",
+   (intmax_t)statbuff.st_ino);
+   check_audit(fds, extregex, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(fstatfs_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fstatfs_failure);
+ATF_TC_HEAD(fstatfs_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "fstatfs(2) call");
+}
+
+ATF_TC_BODY(fstatfs_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   const char *regex = "fstatfs.*return,failure : Bad file descriptor";
+   /* Failure reason: bad file descriptor */
+   ATF_REQUIRE_EQ(-1, fstatfs(-1, ));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(fstatfs_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(getfsstat_success);
+ATF_TC_HEAD(getfsstat_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "getfsstat(2) call");
+}
+
+ATF_TC_BODY(getfsstat_success, tc)
+{
+   pid = getpid();
+   snprintf(extregex, sizeof(extregex), "getfsstat.*%d.*success", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE(getfsstat(NULL, 0, MNT_NOWAIT) != -1);
+   check_audit(fds, extregex, pipefd);
+}
+
+ATF_TC_CLEANUP(getfsstat_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(getfsstat_failure);
+ATF_TC_HEAD(getfsstat_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "getfsstat(2) call");
+}
+
+ATF_TC_BODY(getfsstat_failure, tc)
+{
+   const char *regex = "getfsstat.*return,failure : Invalid argument";
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Invalid value for mode */
+   ATF_REQUIRE_EQ(-1, getfsstat(NULL, 0, -1));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(getfsstat_failure, tc)
+{
+   cleanup();
+}
+
+
 ATF_TP_ADD_TCS(tp)
 {
 

Re: svn commit: r334514 - head/usr.bin/top

2018-06-13 Thread Eitan Adler
On 13 June 2018 at 17:10, Allan Jude  wrote:
>
> This broke compressed ARC display in top. The sysctl
> vfs.zfs.compressed_arc_enabled is backed by a boolean_t (which is the
> same size as an int), so trying to read it into a bool (1 byte) fails
> and returns ENOMEM.
>
> Fixed in r335099

Sorry for the breakage and thanks for the fix. As discussed on IRC,
the type of the sysctl might change to int (from boolean_t) and we
don't have a great way of asserting that the size is right.



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335104 - head/usr.sbin/bhyve

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Thu Jun 14 01:34:53 2018
New Revision: 335104
URL: https://svnweb.freebsd.org/changeset/base/335104

Log:
  Fix style(9) space vs tab.
  
  Reviewed by:  jhb
  MFC after:3 weeks.
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15768

Modified:
  head/usr.sbin/bhyve/acpi.c
  head/usr.sbin/bhyve/ahci.h
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/bhyve/block_if.c
  head/usr.sbin/bhyve/bootrom.h
  head/usr.sbin/bhyve/console.h
  head/usr.sbin/bhyve/consport.c
  head/usr.sbin/bhyve/inout.c
  head/usr.sbin/bhyve/mem.h
  head/usr.sbin/bhyve/mevent.c
  head/usr.sbin/bhyve/mevent_test.c
  head/usr.sbin/bhyve/pci_e82545.c
  head/usr.sbin/bhyve/pci_emul.c
  head/usr.sbin/bhyve/pci_virtio_net.c
  head/usr.sbin/bhyve/pci_xhci.c
  head/usr.sbin/bhyve/rfb.c
  head/usr.sbin/bhyve/rtc.c
  head/usr.sbin/bhyve/sockstream.c
  head/usr.sbin/bhyve/uart_emul.c
  head/usr.sbin/bhyve/usb_mouse.c
  head/usr.sbin/bhyve/vga.h
  head/usr.sbin/bhyve/virtio.c
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/acpi.c
==
--- head/usr.sbin/bhyve/acpi.c  Thu Jun 14 01:28:55 2018(r335103)
+++ head/usr.sbin/bhyve/acpi.c  Thu Jun 14 01:34:53 2018(r335104)
@@ -885,7 +885,7 @@ basl_make_templates(void)
int len;
 
err = 0;
-   
+
/*
 * 
 */

Modified: head/usr.sbin/bhyve/ahci.h
==
--- head/usr.sbin/bhyve/ahci.h  Thu Jun 14 01:28:55 2018(r335103)
+++ head/usr.sbin/bhyve/ahci.h  Thu Jun 14 01:34:53 2018(r335104)
@@ -33,292 +33,292 @@
 #define_AHCI_H_
 
 /* ATA register defines */
-#define ATA_DATA0   /* (RW) data */
+#defineATA_DATA0   /* (RW) data */
 
-#define ATA_FEATURE 1   /* (W) feature */
-#define ATA_F_DMA   0x01/* enable DMA */
-#define ATA_F_OVL   0x02/* enable overlap */
+#defineATA_FEATURE 1   /* (W) feature */
+#defineATA_F_DMA   0x01/* enable DMA */
+#defineATA_F_OVL   0x02/* enable overlap */
 
-#define ATA_COUNT   2   /* (W) sector count */
+#defineATA_COUNT   2   /* (W) sector count */
 
-#define ATA_SECTOR  3   /* (RW) sector # */
-#define ATA_CYL_LSB 4   /* (RW) cylinder# LSB */
-#define ATA_CYL_MSB 5   /* (RW) cylinder# MSB */
-#define ATA_DRIVE   6   /* (W) Sector/Drive/Head */
-#define ATA_D_LBA   0x40/* use LBA addressing */
-#define ATA_D_IBM   0xa0/* 512 byte sectors, ECC */
+#defineATA_SECTOR  3   /* (RW) sector # */
+#defineATA_CYL_LSB 4   /* (RW) cylinder# LSB */
+#defineATA_CYL_MSB 5   /* (RW) cylinder# MSB */
+#defineATA_DRIVE   6   /* (W) Sector/Drive/Head */
+#defineATA_D_LBA   0x40/* use LBA addressing */
+#defineATA_D_IBM   0xa0/* 512 byte sectors, ECC */
 
-#define ATA_COMMAND 7   /* (W) command */
+#defineATA_COMMAND 7   /* (W) command */
 
-#define ATA_ERROR   8   /* (R) error */
-#define ATA_E_ILI   0x01/* illegal length */
-#define ATA_E_NM0x02/* no media */
-#define ATA_E_ABORT 0x04/* command aborted */
-#define ATA_E_MCR   0x08/* media change request */
-#define ATA_E_IDNF  0x10/* ID not found */
-#define ATA_E_MC0x20/* media changed */
-#define ATA_E_UNC   0x40/* uncorrectable data */
-#define ATA_E_ICRC  0x80/* UDMA crc error */
-#defineATA_E_ATAPI_SENSE_MASK  0xf0/* ATAPI sense key mask 
*/
+#defineATA_ERROR   8   /* (R) error */
+#defineATA_E_ILI   0x01/* illegal length */
+#defineATA_E_NM0x02/* no media */
+#defineATA_E_ABORT 0x04/* command aborted */
+#defineATA_E_MCR   0x08/* media change request */
+#defineATA_E_IDNF  0x10/* ID not found */
+#defineATA_E_MC0x20/* media changed */
+#defineATA_E_UNC   0x40/* uncorrectable data */
+#defineATA_E_ICRC  0x80/* UDMA crc error */
+#defineATA_E_ATAPI_SENSE_MASK  0xf0/* ATAPI sense key mask */
 
-#define ATA_IREASON 9   /* (R) interrupt reason */
-#define ATA_I_CMD  

svn commit: r335102 - head/sys/dev/cxgbe

2018-06-13 Thread Navdeep Parhar
Author: np
Date: Thu Jun 14 01:27:35 2018
New Revision: 335102
URL: https://svnweb.freebsd.org/changeset/base/335102

Log:
  cxgbe(4): Catch up with recent changes in the kernel -- it no longer
  holds non-sleepable locks around any of the driver ioctls.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu Jun 14 01:15:19 2018
(r335101)
+++ head/sys/dev/cxgbe/t4_main.cThu Jun 14 01:27:35 2018
(r335102)
@@ -1663,7 +1663,7 @@ cxgbe_init(void *arg)
 static int
 cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data)
 {
-   int rc = 0, mtu, flags, can_sleep;
+   int rc = 0, mtu, flags;
struct vi_info *vi = ifp->if_softc;
struct port_info *pi = vi->pi;
struct adapter *sc = pi->adapter;
@@ -1689,59 +1689,36 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd
break;
 
case SIOCSIFFLAGS:
-   can_sleep = 0;
-redo_sifflags:
-   rc = begin_synchronized_op(sc, vi,
-   can_sleep ? (SLEEP_OK | INTR_OK) : HOLD_LOCK, "t4flg");
-   if (rc) {
-   if_printf(ifp, "%ssleepable synch operation failed: %d."
-   "  if_flags 0x%08x, if_drv_flags 0x%08x\n",
-   can_sleep ? "" : "non-", rc, ifp->if_flags,
-   ifp->if_drv_flags);
+   rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4flg");
+   if (rc)
return (rc);
-   }
 
if (ifp->if_flags & IFF_UP) {
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
flags = vi->if_flags;
if ((ifp->if_flags ^ flags) &
(IFF_PROMISC | IFF_ALLMULTI)) {
-   if (can_sleep == 1) {
-   end_synchronized_op(sc, 0);
-   can_sleep = 0;
-   goto redo_sifflags;
-   }
rc = update_mac_settings(ifp,
XGMAC_PROMISC | XGMAC_ALLMULTI);
}
} else {
-   if (can_sleep == 0) {
-   end_synchronized_op(sc, LOCK_HELD);
-   can_sleep = 1;
-   goto redo_sifflags;
-   }
rc = cxgbe_init_synchronized(vi);
}
vi->if_flags = ifp->if_flags;
} else if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if (can_sleep == 0) {
-   end_synchronized_op(sc, LOCK_HELD);
-   can_sleep = 1;
-   goto redo_sifflags;
-   }
rc = cxgbe_uninit_synchronized(vi);
}
-   end_synchronized_op(sc, can_sleep ? 0 : LOCK_HELD);
+   end_synchronized_op(sc, 0);
break;
 
case SIOCADDMULTI:
-   case SIOCDELMULTI: /* these two are called with a mutex held :-( */
-   rc = begin_synchronized_op(sc, vi, HOLD_LOCK, "t4multi");
+   case SIOCDELMULTI:
+   rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, 
"t4multi");
if (rc)
return (rc);
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
rc = update_mac_settings(ifp, XGMAC_MCADDRS);
-   end_synchronized_op(sc, LOCK_HELD);
+   end_synchronized_op(sc, 0);
break;
 
case SIOCSIFCAP:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335103 - head/lib/libvmmapi

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Thu Jun 14 01:28:55 2018
New Revision: 335103
URL: https://svnweb.freebsd.org/changeset/base/335103

Log:
  Fix style(9) space vs tab.
  
  Reviewed by:  jhb
  MFC after:3 weeks.
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15774

Modified:
  head/lib/libvmmapi/vmmapi.c

Modified: head/lib/libvmmapi/vmmapi.c
==
--- head/lib/libvmmapi/vmmapi.c Thu Jun 14 01:27:35 2018(r335102)
+++ head/lib/libvmmapi/vmmapi.c Thu Jun 14 01:28:55 2018(r335103)
@@ -85,19 +85,19 @@ struct vmctx {
 static int
 vm_device_open(const char *name)
 {
-int fd, len;
-char *vmfile;
+   int fd, len;
+   char *vmfile;
 
len = strlen("/dev/vmm/") + strlen(name) + 1;
vmfile = malloc(len);
assert(vmfile != NULL);
snprintf(vmfile, len, "/dev/vmm/%s", name);
 
-/* Open the device file */
-fd = open(vmfile, O_RDWR, 0);
+   /* Open the device file */
+   fd = open(vmfile, O_RDWR, 0);
 
free(vmfile);
-return (fd);
+   return (fd);
 }
 
 int
@@ -876,7 +876,7 @@ vm_set_capability(struct vmctx *ctx, int vcpu, enum vm
vmcap.cpuid = vcpu;
vmcap.captype = cap;
vmcap.capval = val;
-   
+
return (ioctl(ctx->fd, VM_SET_CAPABILITY, ));
 }
 
@@ -1580,4 +1580,3 @@ vm_get_ioctls(size_t *len)
*len = nitems(vm_ioctl_cmds);
return (NULL);
 }
-
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335101 - in head: sbin sbin/camcontrol share/mk

2018-06-13 Thread Warner Losh
Author: imp
Date: Thu Jun 14 01:15:19 2018
New Revision: 335101
URL: https://svnweb.freebsd.org/changeset/base/335101

Log:
  NVME support is only for x86 and powerpc64.
  
  Implement MK_NVME now that the expression for where NVMe is
  complicated. Default it to "yes" for x86 and powerpc64 and
  no everywhere else. Use it in camcontrol to define WITH_NVME
  for those platforms where we support nvme.
  
  This should fix the newly introduced nvme files to camcontrol
  which were building everywhere.
  
  Pointy Hat To: imp
  Sponsored by: Netflix

Modified:
  head/sbin/Makefile
  head/sbin/Makefile.amd64
  head/sbin/Makefile.i386
  head/sbin/Makefile.powerpc64
  head/sbin/camcontrol/Makefile
  head/sbin/camcontrol/camcontrol.c
  head/share/mk/src.opts.mk

Modified: head/sbin/Makefile
==
--- head/sbin/Makefile  Thu Jun 14 00:20:55 2018(r335100)
+++ head/sbin/Makefile  Thu Jun 14 01:15:19 2018(r335101)
@@ -82,6 +82,7 @@ SUBDIR.${MK_IPFW}+=   natd
 SUBDIR.${MK_ISCSI}+=   iscontrol
 SUBDIR.${MK_NAND}+=nandfs
 SUBDIR.${MK_NAND}+=newfs_nandfs
+SUBDIR.${MK_NVME}+=nvmecontrol
 SUBDIR.${MK_OPENSSL}+= decryptcore
 SUBDIR.${MK_PF}+=  pfctl
 SUBDIR.${MK_PF}+=  pflogd

Modified: head/sbin/Makefile.amd64
==
--- head/sbin/Makefile.amd64Thu Jun 14 00:20:55 2018(r335100)
+++ head/sbin/Makefile.amd64Thu Jun 14 01:15:19 2018(r335101)
@@ -2,4 +2,3 @@
 
 SUBDIR += bsdlabel
 SUBDIR += fdisk
-SUBDIR += nvmecontrol

Modified: head/sbin/Makefile.i386
==
--- head/sbin/Makefile.i386 Thu Jun 14 00:20:55 2018(r335100)
+++ head/sbin/Makefile.i386 Thu Jun 14 01:15:19 2018(r335101)
@@ -2,5 +2,4 @@
 
 SUBDIR += bsdlabel
 SUBDIR += fdisk
-SUBDIR += nvmecontrol
 SUBDIR += sconfig

Modified: head/sbin/Makefile.powerpc64
==
--- head/sbin/Makefile.powerpc64Thu Jun 14 00:20:55 2018
(r335100)
+++ head/sbin/Makefile.powerpc64Thu Jun 14 01:15:19 2018
(r335101)
@@ -2,4 +2,3 @@
 
 SUBDIR += bsdlabel
 SUBDIR += fdisk
-SUBDIR += nvmecontrol

Modified: head/sbin/camcontrol/Makefile
==
--- head/sbin/camcontrol/Makefile   Thu Jun 14 00:20:55 2018
(r335100)
+++ head/sbin/camcontrol/Makefile   Thu Jun 14 01:15:19 2018
(r335101)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 PACKAGE=runtime
 PROG=  camcontrol
 SRCS=  camcontrol.c util.c
@@ -8,11 +10,13 @@ SRCS+=   attrib.c epc.c fwdownload.c modeedit.c persist.
 .else
 CFLAGS+= -DMINIMALISTIC
 .endif
+.if ${MK_NVME} != "no"
 .PATH: ${SRCTOP}/sbin/nvmecontrol
-CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol
+CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME
 SRCS+= identify_ext.c nc_util.c
 .PATH: ${SRCTOP}/sys/dev/nvme
 SRCS+= nvme_util.c
+.endif
 # This is verboten
 .if ${MACHINE_CPUARCH} == "arm"
 WARNS?= 3

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Thu Jun 14 00:20:55 2018
(r335100)
+++ head/sbin/camcontrol/camcontrol.c   Thu Jun 14 01:15:19 2018
(r335101)
@@ -63,7 +63,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include "camcontrol.h"
+#ifdef WITH_NVME
 #include "nvmecontrol_ext.h"
+#endif
 
 typedef enum {
CAM_CMD_NONE= 0x,
@@ -281,7 +283,9 @@ static int print_dev_ata(struct device_match_result *d
 static int print_dev_semb(struct device_match_result *dev_result, char 
*tmpstr);
 static int print_dev_mmcsd(struct device_match_result *dev_result,
 char *tmpstr);
+#ifdef WITH_NVME
 static int print_dev_nvme(struct device_match_result *dev_result, char 
*tmpstr);
+#endif
 #ifndef MINIMALISTIC
 static int testunitready(struct cam_device *device, int task_attr,
 int retry_count, int timeout, int quiet);
@@ -602,12 +606,14 @@ getdevtree(int argc, char **argv, char *combinedopt)
skip_device = 1;
break;
}
+#ifdef WITH_NVME
} else if (dev_result->protocol == PROTO_NVME) {
if (print_dev_nvme(dev_result,
[0]) != 0) {
skip_device = 1;
break;
}
+#endif
} else {
sprintf(tmpstr, "<>");
}
@@ -763,6 +769,7 @@ print_dev_mmcsd(struct 

Re: svn commit: r335072 - head/sys/amd64/amd64

2018-06-13 Thread Rodney W. Grimes
> Author: kib
> Date: Wed Jun 13 17:55:09 2018
> New Revision: 335072
> URL: https://svnweb.freebsd.org/changeset/base/335072
> 
> Log:
>   Enable eager FPU context switch by default on amd64.
>   
>   With compilers making increasing use of vector instructions the
>   performance benefit of lazily switching FPU state is no longer a
>   desirable tradeoff.  Linux switched to eager FPU context switch some
>   time ago, and the idea was floated on the FreeBSD-current mailing list
>   some years ago[1].
>   
>   Enable eager FPU context switch by default on amd64, with a tunable/sysctl
>   available to turn it back off.
>   
>   [1] 
> https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055198.html
>   
>   Reviewed by:jhb
>   Tested by:  pho
>   Sponsored by:   The FreeBSD Foundation

MFC: ?

...

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334514 - head/usr.bin/top

2018-06-13 Thread Allan Jude
On 2018-06-01 23:25, Eitan Adler wrote:
> Author: eadler
> Date: Sat Jun  2 03:25:15 2018
> New Revision: 334514
> URL: https://svnweb.freebsd.org/changeset/base/334514
> 
> Log:
>   top(1): Use standard boolean rather than homegrown alternative
> 
> Deleted:
>   head/usr.bin/top/boolean.h
> Modified:
>   head/usr.bin/top/commands.c
>   head/usr.bin/top/display.c
>   head/usr.bin/top/machine.c
>   head/usr.bin/top/screen.c
>   head/usr.bin/top/top.1
>   head/usr.bin/top/top.c
> 
> Modified: head/usr.bin/top/machine.c
> ==
> --- head/usr.bin/top/machine.cSat Jun  2 02:06:48 2018
> (r334513)
> +++ head/usr.bin/top/machine.cSat Jun  2 03:25:15 2018
> (r334514)
> @@ -35,6 +35,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -308,7 +309,7 @@ machine_init(struct statics *statics)
>  {
>   int i, j, empty, pagesize;
>   uint64_t arc_size;
> - boolean_t carc_en;
> + bool carc_en;
>   size_t size;
>  
>   size = sizeof(smpmode);
> 

This broke compressed ARC display in top. The sysctl
vfs.zfs.compressed_arc_enabled is backed by a boolean_t (which is the
same size as an int), so trying to read it into a bool (1 byte) fails
and returns ENOMEM.

Fixed in r335099

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r335099 - head/usr.bin/top

2018-06-13 Thread Allan Jude
Author: allanjude
Date: Thu Jun 14 00:10:16 2018
New Revision: 335099
URL: https://svnweb.freebsd.org/changeset/base/335099

Log:
  Fix top(1) support for displaying ZFS Compressed ARC statistics
  
  Broken in r334514
  
  sysctlbyname("vfs.zfs.compressed_arc_enabled", ...) would return ENOMEM
  while trying to read the sysctl (a boolean_t) into a bool, which is too small.
  
  Reviewed by:  jhb (on irc)
  Sponsored by: Klara Systems

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Thu Jun 14 00:03:44 2018(r335098)
+++ head/usr.bin/top/machine.c  Thu Jun 14 00:10:16 2018(r335099)
@@ -304,7 +304,7 @@ machine_init(struct statics *statics)
 {
int i, j, empty, pagesize;
uint64_t arc_size;
-   bool carc_en;
+   int carc_en;
size_t size;
 
size = sizeof(smpmode);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335094 - head/sys/ofed/drivers/infiniband/core

2018-06-13 Thread Matthew Macy
On Wed, Jun 13, 2018 at 4:47 PM, Ryan Libby  wrote:
> On Wed, Jun 13, 2018 at 4:30 PM, Matt Macy  wrote:
>> Author: mmacy
>> Date: Wed Jun 13 23:30:54 2018
>> New Revision: 335094
>> URL: https://svnweb.freebsd.org/changeset/base/335094
>>
>> Log:
>>   fix OFED build after r335053
>>
>> Modified:
>>   head/sys/ofed/drivers/infiniband/core/ib_user_mad.c
>>
>> Modified: head/sys/ofed/drivers/infiniband/core/ib_user_mad.c
>> ==
>> --- head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Jun 13 23:19:54 
>> 2018(r335093)
>> +++ head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Jun 13 23:30:54 
>> 2018(r335094)
>> @@ -130,7 +130,8 @@ struct ib_umad_packet {
>>
>>  static struct class *umad_class;
>>
>> -static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
>> +#define IBMKDEV(x, y)  (((dev_t)(x) << 32) | (unsigned)(y))
>> +static const dev_t base_dev = IBMKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
>>
>>  static DEFINE_SPINLOCK(port_lock);
>>  static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
>>
>
> The scheme for major/minor encoding is different as of r335053.  Won't
> that matter?

Yes.

> In sys/ofed/drivers/infiniband/core/{ib_ucm.c,ib_uverbs_main.c} the
> pattern is to #define the MKDEV().  Following that would in
> ib_user_mad.c would also resolve this.  Or makedev could be
> re-macroized with the new scheme.

That's probably the best course of action.
Will follow up.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335042 - head/usr.bin/top

2018-06-13 Thread Bryan Drewery
On 6/13/2018 1:52 AM, Eitan Adler wrote:
> Author: eadler
> Date: Wed Jun 13 08:52:19 2018
> New Revision: 335042
> URL: https://svnweb.freebsd.org/changeset/base/335042
> 
> Log:
>   top(1): add myself to authors
>   
>   At this point I've mucked enough with top(1) that all bugs should be
>   blamed on me rather than William LeFebvre.
> 

Thank you for all of your work here...

There's not exactly a guideline for this but I don't feel that
non-functional changes qualify as "authors". Especially the sorting
chosen. Perhaps I missed some rewrite you've done? Though none have
'Relnotes: yes' so I am assuming they were all non-functional.

There's been 62 unique committers to usr.bin/top, which does not account
for Submitted By. All of which are also missing from AUTHORS and Copyrights.

I do see some people adding their Copyright on some commits but overall
we haven't done that as a project and I am curious if we should change
in that regard.

Also I really abhor rewriting anything that's not broken as it causes
merge conflict pain downstream and just adds regression risk.

> Modified:
>   head/usr.bin/top/top.1
>   head/usr.bin/top/utils.c
> 
> Modified: head/usr.bin/top/top.1
> ==
> --- head/usr.bin/top/top.1Wed Jun 13 08:52:17 2018(r335041)
> +++ head/usr.bin/top/top.1Wed Jun 13 08:52:19 2018(r335042)
> @@ -360,6 +360,7 @@ process is waiting.
>  Lock names are prefixed with an asterisk \*(lq*\*(rq while sleep events
>  are not.
>  .Sh AUTHORS
> +.An Eitan Adler Aq Mt ead...@freebsd.org
>  .An William LeFebvre, EECS Department, Northwestern University
>  .Sh BUGS
>  The command name for swapped processes should be tracked down, but this
> 
> Modified: head/usr.bin/top/utils.c
> ==
> --- head/usr.bin/top/utils.c  Wed Jun 13 08:52:17 2018(r335041)
> +++ head/usr.bin/top/utils.c  Wed Jun 13 08:52:19 2018(r335042)
> @@ -2,6 +2,7 @@
>   *  This program may be freely redistributed,
>   *  but this entire comment MUST remain intact.
>   *
> + *  Copyright (c) 2018, Eitan Adler
>   *  Copyright (c) 1984, 1989, William LeFebvre, Rice University
>   *  Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
>   *
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r335094 - head/sys/ofed/drivers/infiniband/core

2018-06-13 Thread Ryan Libby
On Wed, Jun 13, 2018 at 4:30 PM, Matt Macy  wrote:
> Author: mmacy
> Date: Wed Jun 13 23:30:54 2018
> New Revision: 335094
> URL: https://svnweb.freebsd.org/changeset/base/335094
>
> Log:
>   fix OFED build after r335053
>
> Modified:
>   head/sys/ofed/drivers/infiniband/core/ib_user_mad.c
>
> Modified: head/sys/ofed/drivers/infiniband/core/ib_user_mad.c
> ==
> --- head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Jun 13 23:19:54 
> 2018(r335093)
> +++ head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Jun 13 23:30:54 
> 2018(r335094)
> @@ -130,7 +130,8 @@ struct ib_umad_packet {
>
>  static struct class *umad_class;
>
> -static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
> +#define IBMKDEV(x, y)  (((dev_t)(x) << 32) | (unsigned)(y))
> +static const dev_t base_dev = IBMKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
>
>  static DEFINE_SPINLOCK(port_lock);
>  static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
>

The scheme for major/minor encoding is different as of r335053.  Won't
that matter?

In sys/ofed/drivers/infiniband/core/{ib_ucm.c,ib_uverbs_main.c} the
pattern is to #define the MKDEV().  Following that would in
ib_user_mad.c would also resolve this.  Or makedev could be
re-macroized with the new scheme.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335094 - head/sys/ofed/drivers/infiniband/core

2018-06-13 Thread Matt Macy
Author: mmacy
Date: Wed Jun 13 23:30:54 2018
New Revision: 335094
URL: https://svnweb.freebsd.org/changeset/base/335094

Log:
  fix OFED build after r335053

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_user_mad.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_user_mad.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Jun 13 23:19:54 
2018(r335093)
+++ head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Jun 13 23:30:54 
2018(r335094)
@@ -130,7 +130,8 @@ struct ib_umad_packet {
 
 static struct class *umad_class;
 
-static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
+#define IBMKDEV(x, y)  (((dev_t)(x) << 32) | (unsigned)(y))
+static const dev_t base_dev = IBMKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
 
 static DEFINE_SPINLOCK(port_lock);
 static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335093 - in head/sys: netinet netinet6

2018-06-13 Thread Matt Macy
Author: mmacy
Date: Wed Jun 13 23:19:54 2018
New Revision: 335093
URL: https://svnweb.freebsd.org/changeset/base/335093

Log:
  Fix PCBGROUPS build post CK conversion of pcbinfo

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/in_pcbgroup.c
  head/sys/netinet6/in6_pcb.c

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Wed Jun 13 22:00:08 2018(r335092)
+++ head/sys/netinet/in_pcb.c   Wed Jun 13 23:19:54 2018(r335093)
@@ -2025,7 +2025,7 @@ in_pcblookup_group(struct inpcbinfo *pcbinfo, struct i
INP_GROUP_LOCK(pcbgroup);
head = >ipg_hashbase[INP_PCBHASH(faddr.s_addr, lport, fport,
pcbgroup->ipg_hashmask)];
-   LIST_FOREACH(inp, head, inp_pcbgrouphash) {
+   CK_LIST_FOREACH(inp, head, inp_pcbgrouphash) {
 #ifdef INET6
/* XXX inp locking */
if ((inp->inp_vflag & INP_IPV4) == 0)
@@ -2075,7 +2075,7 @@ in_pcblookup_group(struct inpcbinfo *pcbinfo, struct i
 
head = >ipg_hashbase[INP_PCBHASH(INADDR_ANY,
lport, 0, pcbgroup->ipg_hashmask)];
-   LIST_FOREACH(inp, head, inp_pcbgrouphash) {
+   CK_LIST_FOREACH(inp, head, inp_pcbgrouphash) {
 #ifdef INET6
/* XXX inp locking */
if ((inp->inp_vflag & INP_IPV4) == 0)
@@ -2149,7 +2149,7 @@ in_pcblookup_group(struct inpcbinfo *pcbinfo, struct i
 */
head = >ipi_wildbase[INP_PCBHASH(INADDR_ANY, lport,
0, pcbinfo->ipi_wildmask)];
-   LIST_FOREACH(inp, head, inp_pcbgroup_wild) {
+   CK_LIST_FOREACH(inp, head, inp_pcbgroup_wild) {
 #ifdef INET6
/* XXX inp locking */
if ((inp->inp_vflag & INP_IPV4) == 0)

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Wed Jun 13 22:00:08 2018(r335092)
+++ head/sys/netinet/in_pcb.h   Wed Jun 13 23:19:54 2018(r335093)
@@ -276,7 +276,7 @@ struct inpcb {
TAILQ_ENTRY(inpcb) inp_input;   /* pacing in  queue next lock(b) */
struct  inpcbinfo *inp_pcbinfo; /* (c) PCB list info */
struct  inpcbgroup *inp_pcbgroup; /* (g/i) PCB group list */
-   LIST_ENTRY(inpcb) inp_pcbgroup_wild; /* (g/i/h) group wildcard entry */
+   CK_LIST_ENTRY(inpcb) inp_pcbgroup_wild; /* (g/i/h) group wildcard entry 
*/
struct  ucred   *inp_cred;  /* (c) cache of socket cred */
u_int32_t inp_flow; /* (i) IPv6 flow information */
u_char  inp_vflag;  /* (i) IP version flag (v4/v6) */

Modified: head/sys/netinet/in_pcbgroup.c
==
--- head/sys/netinet/in_pcbgroup.c  Wed Jun 13 22:00:08 2018
(r335092)
+++ head/sys/netinet/in_pcbgroup.c  Wed Jun 13 23:19:54 2018
(r335093)
@@ -207,7 +207,7 @@ in_pcbgroup_destroy(struct inpcbinfo *pcbinfo)
 
for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) {
pcbgroup = >ipi_pcbgroups[pgn];
-   KASSERT(LIST_EMPTY(pcbinfo->ipi_listhead),
+   KASSERT(CK_LIST_EMPTY(pcbinfo->ipi_listhead),
("in_pcbinfo_destroy: listhead not empty"));
INP_GROUP_LOCK_DESTROY(pcbgroup);
hashdestroy(pcbgroup->ipg_hashbase, M_PCB,
@@ -338,7 +338,7 @@ in_pcbwild_add(struct inpcb *inp)
INP_GROUP_LOCK(>ipi_pcbgroups[pgn]);
head = >ipi_wildbase[INP_PCBHASH(INADDR_ANY, inp->inp_lport,
0, pcbinfo->ipi_wildmask)];
-   LIST_INSERT_HEAD(head, inp, inp_pcbgroup_wild);
+   CK_LIST_INSERT_HEAD(head, inp, inp_pcbgroup_wild);
inp->inp_flags2 |= INP_PCBGROUPWILD;
for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++)
INP_GROUP_UNLOCK(>ipi_pcbgroups[pgn]);
@@ -357,7 +357,7 @@ in_pcbwild_remove(struct inpcb *inp)
pcbinfo = inp->inp_pcbinfo;
for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++)
INP_GROUP_LOCK(>ipi_pcbgroups[pgn]);
-   LIST_REMOVE(inp, inp_pcbgroup_wild);
+   CK_LIST_REMOVE(inp, inp_pcbgroup_wild);
for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++)
INP_GROUP_UNLOCK(>ipi_pcbgroups[pgn]);
inp->inp_flags2 &= ~INP_PCBGROUPWILD;
@@ -415,7 +415,7 @@ in_pcbgroup_update_internal(struct inpcbinfo *pcbinfo,
oldpcbgroup = inp->inp_pcbgroup;
if (oldpcbgroup != NULL && oldpcbgroup != newpcbgroup) {
INP_GROUP_LOCK(oldpcbgroup);
-   LIST_REMOVE(inp, inp_pcbgrouphash);
+   CK_LIST_REMOVE(inp, inp_pcbgrouphash);
inp->inp_pcbgroup = NULL;
INP_GROUP_UNLOCK(oldpcbgroup);
}
@@ -445,7 +445,7 @@ in_pcbgroup_update_internal(struct 

svn commit: r335092 - head/sbin/camcontrol

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 22:00:08 2018
New Revision: 335092
URL: https://svnweb.freebsd.org/changeset/base/335092

Log:
  Make camcontrol identify work with nda devices
  
  Both ATA and NVME have an identify command. They are completely
  different, but to the user they are the same. Leverage nvmecontrol's
  print_controller code to provide that functionality to camcontrol
  identify. Query the path to see what kind of protocol it supports, and
  send the most appropriate command down. Refactor nvme_print_dev a
  little to make it easy to get the nvme cdata.
  
  Sponsored by: Netflix
  Differential Revision: https://reviews.freebsd.org/D15371

Modified:
  head/sbin/camcontrol/Makefile
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/Makefile
==
--- head/sbin/camcontrol/Makefile   Wed Jun 13 22:00:02 2018
(r335091)
+++ head/sbin/camcontrol/Makefile   Wed Jun 13 22:00:08 2018
(r335092)
@@ -8,6 +8,11 @@ SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.
 .else
 CFLAGS+= -DMINIMALISTIC
 .endif
+.PATH: ${SRCTOP}/sbin/nvmecontrol
+CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol
+SRCS+= identify_ext.c nc_util.c
+.PATH: ${SRCTOP}/sys/dev/nvme
+SRCS+= nvme_util.c
 # This is verboten
 .if ${MACHINE_CPUARCH} == "arm"
 WARNS?= 3

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Wed Jun 13 22:00:02 2018
(r335091)
+++ head/sbin/camcontrol/camcontrol.c   Wed Jun 13 22:00:08 2018
(r335092)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include "camcontrol.h"
+#include "nvmecontrol_ext.h"
 
 typedef enum {
CAM_CMD_NONE= 0x,
@@ -763,21 +764,11 @@ print_dev_mmcsd(struct device_match_result *dev_result
 }
 
 static int
-print_dev_nvme(struct device_match_result *dev_result, char *tmpstr)
+nvme_get_cdata(struct cam_device *dev, struct nvme_controller_data *cdata)
 {
union ccb *ccb;
struct ccb_dev_advinfo *advi;
-   struct cam_device *dev;
-   struct nvme_controller_data cdata;
-   char vendor[64], product[64];
 
-   dev = cam_open_btl(dev_result->path_id, dev_result->target_id,
-   dev_result->target_lun, O_RDWR, NULL);
-   if (dev == NULL) {
-   warnx("%s", cam_errbuf);
-   return (1);
-   }
-   
ccb = cam_getccb(dev);
if (ccb == NULL) {
warnx("couldn't allocate CCB");
@@ -791,7 +782,7 @@ print_dev_nvme(struct device_match_result *dev_result,
advi->flags = CDAI_FLAG_NONE;
advi->buftype = CDAI_TYPE_NVME_CNTRL;
advi->bufsiz = sizeof(struct nvme_controller_data);
-   advi->buf = (uint8_t *)
+   advi->buf = (uint8_t *)cdata;
 
if (cam_send_ccb(dev, ccb) < 0) {
warn("error sending CAMIOCOMMAND ioctl");
@@ -805,11 +796,31 @@ print_dev_nvme(struct device_match_result *dev_result,
cam_close_device(dev);
return(1);
}
+   cam_freeccb(ccb);
+   return 0;
+}
+
+static int
+print_dev_nvme(struct device_match_result *dev_result, char *tmpstr)
+{
+   struct cam_device *dev;
+   struct nvme_controller_data cdata;
+   char vendor[64], product[64];
+
+   dev = cam_open_btl(dev_result->path_id, dev_result->target_id,
+   dev_result->target_lun, O_RDWR, NULL);
+   if (dev == NULL) {
+   warnx("%s", cam_errbuf);
+   return (1);
+   }
+
+   if (nvme_get_cdata(dev, ))
+   return (1);
+
cam_strvis(vendor, cdata.mn, sizeof(cdata.mn), sizeof(vendor));
cam_strvis(product, cdata.fr, sizeof(cdata.fr), sizeof(product));
sprintf(tmpstr, "<%s %s>", vendor, product);
 
-   cam_freeccb(ccb);
cam_close_device(dev);
return (0);
 }
@@ -2390,6 +2401,34 @@ ataidentify(struct cam_device *device, int retry_count
 
return (0);
 }
+
+static int
+nvmeidentify(struct cam_device *device, int retry_count __unused, int timeout 
__unused)
+{
+   struct nvme_controller_data cdata;
+
+   if (nvme_get_cdata(device, ))
+   return (1);
+   nvme_print_controller();
+
+   return (0);
+}
+
+static int
+identify(struct cam_device *device, int retry_count, int timeout)
+{
+   struct ccb_pathinq cpi;
+
+   if (get_cpi(device, ) != 0) {
+   warnx("couldn't get CPI");
+   return (-1);
+   }
+
+   if (cpi.protocol == PROTO_NVME) {
+   return (nvmeidentify(device, retry_count, timeout));
+   }
+   return (ataidentify(device, retry_count, timeout));
+}
 #endif /* MINIMALISTIC */
 
 
@@ -10058,7 +10097,7 @@ main(int argc, char **argv)
  task_attr, retry_count, timeout);
break;
case CAM_CMD_IDENTIFY:
-   error = 

svn commit: r335091 - head/sbin/nvmecontrol

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 22:00:02 2018
New Revision: 335091
URL: https://svnweb.freebsd.org/changeset/base/335091

Log:
  Make it possible to use print_controller from another program
  
  Rename print_controller to nvme_print_controller. Put it in its
  own file for easy inclusion. Move util.c to be nc_util.c to not
  conflict with camcontrol. add nvecontrol_ext.h to define shared
  interfaces.
  
  Sponsored by: Netflix
  Differential Revision: https://reviews.freebsd.org/D15371

Added:
  head/sbin/nvmecontrol/identify_ext.c
 - copied, changed from r335089, head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/nc_util.c
 - copied, changed from r335089, head/sbin/nvmecontrol/util.c
  head/sbin/nvmecontrol/nvmecontrol_ext.h   (contents, props changed)
 - copied, changed from r335089, head/sbin/nvmecontrol/util.c
Deleted:
  head/sbin/nvmecontrol/util.c
Modified:
  head/sbin/nvmecontrol/Makefile
  head/sbin/nvmecontrol/identify.c

Modified: head/sbin/nvmecontrol/Makefile
==
--- head/sbin/nvmecontrol/Makefile  Wed Jun 13 21:10:33 2018
(r335090)
+++ head/sbin/nvmecontrol/Makefile  Wed Jun 13 22:00:02 2018
(r335091)
@@ -2,8 +2,8 @@
 
 PACKAGE=runtime
 PROG=  nvmecontrol
-SRCS=  nvmecontrol.c devlist.c firmware.c format.c identify.c logpage.c \
-   perftest.c reset.c ns.c nvme_util.c power.c util.c wdc.c
+SRCS=  nvmecontrol.c devlist.c firmware.c format.c identify.c identify_ext.c 
logpage.c \
+   perftest.c reset.c ns.c nvme_util.c power.c nc_util.c wdc.c
 MAN=   nvmecontrol.8
 
 .PATH: ${SRCTOP}/sys/dev/nvme

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cWed Jun 13 21:10:33 2018
(r335090)
+++ head/sbin/nvmecontrol/identify.cWed Jun 13 22:00:02 2018
(r335091)
@@ -41,187 +41,9 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "nvmecontrol.h"
+#include "nvmecontrol_ext.h"
 
 static void
-print_controller(struct nvme_controller_data *cdata)
-{
-   uint8_t str[128];
-   char cbuf[UINT128_DIG + 1];
-   uint16_t oncs, oacs;
-   uint8_t compare, write_unc, dsm, vwc_present;
-   uint8_t security, fmt, fw, nsmgmt;
-   uint8_t fw_slot1_ro, fw_num_slots;
-   uint8_t ns_smart;
-   uint8_t sqes_max, sqes_min;
-   uint8_t cqes_max, cqes_min;
-
-   oncs = cdata->oncs;
-   compare = (oncs >> NVME_CTRLR_DATA_ONCS_COMPARE_SHIFT) &
-   NVME_CTRLR_DATA_ONCS_COMPARE_MASK;
-   write_unc = (oncs >> NVME_CTRLR_DATA_ONCS_WRITE_UNC_SHIFT) &
-   NVME_CTRLR_DATA_ONCS_WRITE_UNC_MASK;
-   dsm = (oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) &
-   NVME_CTRLR_DATA_ONCS_DSM_MASK;
-   vwc_present = (cdata->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
-   NVME_CTRLR_DATA_VWC_PRESENT_MASK;
-
-   oacs = cdata->oacs;
-   security = (oacs >> NVME_CTRLR_DATA_OACS_SECURITY_SHIFT) &
-   NVME_CTRLR_DATA_OACS_SECURITY_MASK;
-   fmt = (oacs >> NVME_CTRLR_DATA_OACS_FORMAT_SHIFT) &
-   NVME_CTRLR_DATA_OACS_FORMAT_MASK;
-   fw = (oacs >> NVME_CTRLR_DATA_OACS_FIRMWARE_SHIFT) &
-   NVME_CTRLR_DATA_OACS_FIRMWARE_MASK;
-   nsmgmt = (oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) &
-   NVME_CTRLR_DATA_OACS_NSMGMT_MASK;
-
-   fw_num_slots = (cdata->frmw >> NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT) &
-   NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK;
-   fw_slot1_ro = (cdata->frmw >> NVME_CTRLR_DATA_FRMW_SLOT1_RO_SHIFT) &
-   NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK;
-
-   ns_smart = (cdata->lpa >> NVME_CTRLR_DATA_LPA_NS_SMART_SHIFT) &
-   NVME_CTRLR_DATA_LPA_NS_SMART_MASK;
-
-   sqes_min = (cdata->sqes >> NVME_CTRLR_DATA_SQES_MIN_SHIFT) &
-   NVME_CTRLR_DATA_SQES_MIN_MASK;
-   sqes_max = (cdata->sqes >> NVME_CTRLR_DATA_SQES_MAX_SHIFT) &
-   NVME_CTRLR_DATA_SQES_MAX_MASK;
-
-   cqes_min = (cdata->cqes >> NVME_CTRLR_DATA_CQES_MIN_SHIFT) &
-   NVME_CTRLR_DATA_CQES_MIN_MASK;
-   cqes_max = (cdata->cqes >> NVME_CTRLR_DATA_CQES_MAX_SHIFT) &
-   NVME_CTRLR_DATA_CQES_MAX_MASK;
-
-   printf("Controller Capabilities/Features\n");
-   printf("\n");
-   printf("Vendor ID:   %04x\n", cdata->vid);
-   printf("Subsystem Vendor ID: %04x\n", cdata->ssvid);
-   nvme_strvis(str, cdata->sn, sizeof(str), NVME_SERIAL_NUMBER_LENGTH);
-   printf("Serial Number:   %s\n", str);
-   nvme_strvis(str, cdata->mn, sizeof(str), NVME_MODEL_NUMBER_LENGTH);
-   printf("Model Number:%s\n", str);
-   nvme_strvis(str, cdata->fr, sizeof(str), NVME_FIRMWARE_REVISION_LENGTH);
-   printf("Firmware Version:%s\n", str);
-   printf("Recommended Arb Burst:   

Re: svn commit: r335041 - head/lib/libc/stdlib

2018-06-13 Thread Jilles Tjoelker
On Wed, Jun 13, 2018 at 08:03:13PM +1000, Bruce Evans wrote:
> On Wed, 13 Jun 2018, Eitan Adler wrote:

> > Log:
> >  libc: remove explicit cast NULL in atoi

> >  There isn't any reason to cast NULL so just remove it. Noticed when
> >  cleaning up top.

> There are many reasons to cast NULL for all members of the ato*() family:
> - it is required if no prototype is in scope
> - C99 specifies ato*() in terms of strtol*() and uses the cast to NULL,
>probably because this is simplest.  Omitting the cast is just wrong
>if no prototype is in scope.  Writing the explicit cast is simpler than
>writing caveats that the stated equivalence is only valid if a prototype
>is in scope.
> - POSIX specifies ato*() in terms of strtol*() and uses the cast to NULL,
>exactly as in C99, probably because it defers to the C standard and
>doesn't and doesn't risk breaking it by changing its wording except when
>extending it.

These reasons can be summarized to a single reason: the cast is required
if no prototype is in scope.

I think it is unwise to call any function without a prototype in scope,
since this runs a risk of undefined behaviour if you get the types
wrong.

For the code in libc, we ensure a prototype is in scope and no cast is
required. For the code in the man page, I doubt we should allow for
programmers that play tricks by declaring system functions manually
using K declarations or (even worse) call functions without
declaring them at all.

Note that NULL may still need a cast when passed to a function with
variable number of parameters. Ideally these types are also checked
using attributes.

> FreeBSD used to do the same here, and should do the same here and
> elsewhere by copying better wording from POSIX whenever possible.

For some reason, the FreeBSD text does not have the exception about
error handling. This exception permits an implementation like musl's
which calculates using int and hard-codes base 10, even if the compiler
documents a cast from long to int as truncating bits. I don't think we
should take advantage of this, though, since making atoi() faster than
strtol() may encourage people to use atoi().

-- 
Jilles Tjoelker
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335090 - stable/11/sys/amd64/amd64

2018-06-13 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 13 21:10:33 2018
New Revision: 335090
URL: https://svnweb.freebsd.org/changeset/base/335090

Log:
  MFC r335072:
  Enable eager FPU context switch by default on amd64.
  
  Security: CVE-2018-3665

Modified:
  stable/11/sys/amd64/amd64/cpu_switch.S
  stable/11/sys/amd64/amd64/fpu.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/cpu_switch.S
==
--- stable/11/sys/amd64/amd64/cpu_switch.S  Wed Jun 13 21:10:23 2018
(r335089)
+++ stable/11/sys/amd64/amd64/cpu_switch.S  Wed Jun 13 21:10:33 2018
(r335090)
@@ -128,10 +128,10 @@ done_store_dr:
 
/* have we used fp, and need a save? */
cmpq%rdi,PCPU(FPCURTHREAD)
-   jne 3f
+   jne 2f
movqPCB_SAVEFPU(%r8),%r8
clts
-   cmpl$0,use_xsave
+   cmpl$0,use_xsave(%rip)
jne 1f
fxsave  (%r8)
jmp 2f
@@ -143,12 +143,7 @@ ctx_switch_xsave:
/* This is patched to xsaveopt if supported, see fpuinit_bsp1() */
xsave   (%r8)
movq%rcx,%rdx
-2: smsw%ax
-   orb $CR0_TS,%al
-   lmsw%ax
-   xorl%eax,%eax
-   movq%rax,PCPU(FPCURTHREAD)
-3:
+2:
/* Save is done.  Now fire up new thread. Leave old vmspace. */
movq%rsi,%r12
movq%rdi,%r13
@@ -235,6 +230,8 @@ done_load_dr:
movqPCB_RBX(%r8),%rbx
movqPCB_RIP(%r8),%rax
movq%rax,(%rsp)
+   movqPCPU(CURTHREAD),%rdi
+   callfpu_activate_sw
ret
 
/*

Modified: stable/11/sys/amd64/amd64/fpu.c
==
--- stable/11/sys/amd64/amd64/fpu.c Wed Jun 13 21:10:23 2018
(r335089)
+++ stable/11/sys/amd64/amd64/fpu.c Wed Jun 13 21:10:33 2018
(r335090)
@@ -139,6 +139,11 @@ static voidfpu_clean_state(void);
 SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
 SYSCTL_NULL_INT_PTR, 1, "Floating point instructions executed in 
hardware");
 
+int lazy_fpu_switch = 0;
+SYSCTL_INT(_hw, OID_AUTO, lazy_fpu_switch, CTLFLAG_RWTUN | CTLFLAG_NOFETCH,
+_fpu_switch, 0,
+"Lazily load FPU context after context switch");
+
 int use_xsave; /* non-static for cpu_switch.S */
 uint64_t xsave_mask;   /* the same */
 static uma_zone_t fpu_save_area_zone;
@@ -204,6 +209,7 @@ fpuinit_bsp1(void)
u_int cp[4];
uint64_t xsave_mask_user;
 
+   TUNABLE_INT_FETCH("hw.lazy_fpu_switch", _fpu_switch);
if ((cpu_feature2 & CPUID2_XSAVE) != 0) {
use_xsave = 1;
TUNABLE_INT_FETCH("hw.use_xsave", _xsave);
@@ -612,6 +618,45 @@ fputrap_sse(void)
return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]);
 }
 
+static void
+restore_fpu_curthread(struct thread *td)
+{
+   struct pcb *pcb;
+
+   /*
+* Record new context early in case frstor causes a trap.
+*/
+   PCPU_SET(fpcurthread, td);
+
+   stop_emulating();
+   fpu_clean_state();
+   pcb = td->td_pcb;
+
+   if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
+   /*
+* This is the first time this thread has used the FPU or
+* the PCB doesn't contain a clean FPU state.  Explicitly
+* load an initial state.
+*
+* We prefer to restore the state from the actual save
+* area in PCB instead of directly loading from
+* fpu_initialstate, to ignite the XSAVEOPT
+* tracking engine.
+*/
+   bcopy(fpu_initialstate, pcb->pcb_save,
+   cpu_max_ext_state_size);
+   fpurestore(pcb->pcb_save);
+   if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
+   fldcw(pcb->pcb_initial_fpucw);
+   if (PCB_USER_FPU(pcb))
+   set_pcb_flags(pcb, PCB_FPUINITDONE |
+   PCB_USERFPUINITDONE);
+   else
+   set_pcb_flags(pcb, PCB_FPUINITDONE);
+   } else
+   fpurestore(pcb->pcb_save);
+}
+
 /*
  * Device Not Available (DNA, #NM) exception handler.
  *
@@ -622,7 +667,9 @@ fputrap_sse(void)
 void
 fpudna(void)
 {
+   struct thread *td;
 
+   td = curthread;
/*
 * This handler is entered with interrupts enabled, so context
 * switches may occur before critical_enter() is executed.  If
@@ -636,7 +683,7 @@ fpudna(void)
 
KASSERT((curpcb->pcb_flags & PCB_FPUNOSAVE) == 0,
("fpudna while in fpu_kern_enter(FPU_KERN_NOCTX)"));
-   if (PCPU_GET(fpcurthread) == curthread) {
+   if (PCPU_GET(fpcurthread) == td) {
printf("fpudna: fpcurthread == curthread\n");
stop_emulating();
critical_exit();
@@ -645,40 

svn commit: r335089 - head/sys/i386/i386

2018-06-13 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 13 21:10:23 2018
New Revision: 335089
URL: https://svnweb.freebsd.org/changeset/base/335089

Log:
  Enable eager FPU context switch by default on i386 too, based on
  amd64 r335072.
  
  Security: CVE-2018-3665
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/i386/npx.c
  head/sys/i386/i386/swtch.s

Modified: head/sys/i386/i386/npx.c
==
--- head/sys/i386/i386/npx.cWed Jun 13 20:35:56 2018(r335088)
+++ head/sys/i386/i386/npx.cWed Jun 13 21:10:23 2018(r335089)
@@ -191,6 +191,11 @@ inthw_float;
 SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
 _float, 0, "Floating point instructions executed in hardware");
 
+int lazy_fpu_switch = 0;
+SYSCTL_INT(_hw, OID_AUTO, lazy_fpu_switch, CTLFLAG_RWTUN | CTLFLAG_NOFETCH,
+_fpu_switch, 0,
+"Lazily load FPU context after context switch");
+
 int use_xsave;
 uint64_t xsave_mask;
 static uma_zone_t fpu_save_area_zone;
@@ -319,6 +324,7 @@ npxinit_bsp1(void)
u_int cp[4];
uint64_t xsave_mask_user;
 
+   TUNABLE_INT_FETCH("hw.lazy_fpu_switch", _fpu_switch);
if (cpu_fxsr && (cpu_feature2 & CPUID2_XSAVE) != 0) {
use_xsave = 1;
TUNABLE_INT_FETCH("hw.use_xsave", _xsave);
@@ -777,6 +783,42 @@ npxtrap_sse(void)
return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]);
 }
 
+static void
+restore_npx_curthread(struct thread *td, struct pcb *pcb)
+{
+
+   /*
+* Record new context early in case frstor causes a trap.
+*/
+   PCPU_SET(fpcurthread, td);
+
+   stop_emulating();
+   if (cpu_fxsr)
+   fpu_clean_state();
+
+   if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) {
+   /*
+* This is the first time this thread has used the FPU or
+* the PCB doesn't contain a clean FPU state.  Explicitly
+* load an initial state.
+*
+* We prefer to restore the state from the actual save
+* area in PCB instead of directly loading from
+* npx_initialstate, to ignite the XSAVEOPT
+* tracking engine.
+*/
+   bcopy(npx_initialstate, pcb->pcb_save, cpu_max_ext_state_size);
+   fpurstor(pcb->pcb_save);
+   if (pcb->pcb_initial_npxcw != __INITIAL_NPXCW__)
+   fldcw(pcb->pcb_initial_npxcw);
+   pcb->pcb_flags |= PCB_NPXINITDONE;
+   if (PCB_USER_FPU(pcb))
+   pcb->pcb_flags |= PCB_NPXUSERINITDONE;
+   } else {
+   fpurstor(pcb->pcb_save);
+   }
+}
+
 /*
  * Implement device not available (DNA) exception
  *
@@ -790,11 +832,13 @@ static int err_count = 0;
 int
 npxdna(void)
 {
+   struct thread *td;
 
if (!hw_float)
return (0);
+   td = curthread;
critical_enter();
-   if (PCPU_GET(fpcurthread) == curthread) {
+   if (PCPU_GET(fpcurthread) == td) {
printf("npxdna: fpcurthread == curthread %d times\n",
++err_count);
stop_emulating();
@@ -805,39 +849,10 @@ npxdna(void)
printf("npxdna: fpcurthread = %p (%d), curthread = %p (%d)\n",
   PCPU_GET(fpcurthread),
   PCPU_GET(fpcurthread)->td_proc->p_pid,
-  curthread, curthread->td_proc->p_pid);
+  td, td->td_proc->p_pid);
panic("npxdna");
}
-   stop_emulating();
-   /*
-* Record new context early in case frstor causes a trap.
-*/
-   PCPU_SET(fpcurthread, curthread);
-
-   if (cpu_fxsr)
-   fpu_clean_state();
-
-   if ((curpcb->pcb_flags & PCB_NPXINITDONE) == 0) {
-   /*
-* This is the first time this thread has used the FPU or
-* the PCB doesn't contain a clean FPU state.  Explicitly
-* load an initial state.
-*
-* We prefer to restore the state from the actual save
-* area in PCB instead of directly loading from
-* npx_initialstate, to ignite the XSAVEOPT
-* tracking engine.
-*/
-   bcopy(npx_initialstate, curpcb->pcb_save, 
cpu_max_ext_state_size);
-   fpurstor(curpcb->pcb_save);
-   if (curpcb->pcb_initial_npxcw != __INITIAL_NPXCW__)
-   fldcw(curpcb->pcb_initial_npxcw);
-   curpcb->pcb_flags |= PCB_NPXINITDONE;
-   if (PCB_USER_FPU(curpcb))
-   curpcb->pcb_flags |= PCB_NPXUSERINITDONE;
-   } else {
-   fpurstor(curpcb->pcb_save);
-   }
+   restore_npx_curthread(td, td->td_pcb);
critical_exit();
 
return (1);
@@ -861,8 +876,20 @@ npxsave(addr)

svn commit: r335088 - in stable/11: . tools/build/mk

2018-06-13 Thread Dimitry Andric
Author: dim
Date: Wed Jun 13 20:35:56 2018
New Revision: 335088
URL: https://svnweb.freebsd.org/changeset/base/335088

Log:
  MFC r334886:
  
  Add missed libc++ entries to (Optional)ObsoleteFiles.inc
  
  Some of these were removed during the libc++ 5.0.0 import, others were
  added in the libc++ 6.0.0 import.

Modified:
  stable/11/ObsoleteFiles.inc
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/ObsoleteFiles.inc
==
--- stable/11/ObsoleteFiles.inc Wed Jun 13 20:33:52 2018(r335087)
+++ stable/11/ObsoleteFiles.inc Wed Jun 13 20:35:56 2018(r335088)
@@ -38,6 +38,11 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20180613: obsolete libc++ files missed from the 5.0.0 import
+OLD_FILES+=usr/include/c++/v1/__refstring
+OLD_FILES+=usr/include/c++/v1/__undef_min_max
+OLD_FILES+=usr/include/c++/v1/tr1/__refstring
+OLD_FILES+=usr/include/c++/v1/tr1/__undef_min_max
 # 20180513: remove DTrace scripts made obsolete by dwatch(1)
 OLD_FILES+=usr/share/dtrace/watch_execve
 OLD_FILES+=usr/share/dtrace/watch_kill

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Jun 13 20:33:52 
2018(r335087)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Jun 13 20:35:56 
2018(r335088)
@@ -4499,7 +4499,6 @@ OLD_FILES+=usr/include/c++/v1/__libcpp_version
 OLD_FILES+=usr/include/c++/v1/__locale
 OLD_FILES+=usr/include/c++/v1/__mutex_base
 OLD_FILES+=usr/include/c++/v1/__nullptr
-OLD_FILES+=usr/include/c++/v1/__refstring
 OLD_FILES+=usr/include/c++/v1/__split_buffer
 OLD_FILES+=usr/include/c++/v1/__sso_allocator
 OLD_FILES+=usr/include/c++/v1/__std_stream
@@ -4552,6 +4551,7 @@ OLD_FILES+=usr/include/c++/v1/experimental/__memory
 OLD_FILES+=usr/include/c++/v1/experimental/algorithm
 OLD_FILES+=usr/include/c++/v1/experimental/any
 OLD_FILES+=usr/include/c++/v1/experimental/chrono
+OLD_FILES+=usr/include/c++/v1/experimental/coroutine
 OLD_FILES+=usr/include/c++/v1/experimental/deque
 OLD_FILES+=usr/include/c++/v1/experimental/dynarray
 OLD_FILES+=usr/include/c++/v1/experimental/filesystem
@@ -4561,6 +4561,7 @@ OLD_FILES+=usr/include/c++/v1/experimental/iterator
 OLD_FILES+=usr/include/c++/v1/experimental/list
 OLD_FILES+=usr/include/c++/v1/experimental/map
 OLD_FILES+=usr/include/c++/v1/experimental/memory_resource
+OLD_FILES+=usr/include/c++/v1/experimental/numeric
 OLD_FILES+=usr/include/c++/v1/experimental/optional
 OLD_FILES+=usr/include/c++/v1/experimental/propagate_const
 OLD_FILES+=usr/include/c++/v1/experimental/ratio
@@ -4642,7 +4643,6 @@ OLD_FILES+=usr/include/c++/v1/tr1/__libcpp_version
 OLD_FILES+=usr/include/c++/v1/tr1/__locale
 OLD_FILES+=usr/include/c++/v1/tr1/__mutex_base
 OLD_FILES+=usr/include/c++/v1/tr1/__nullptr
-OLD_FILES+=usr/include/c++/v1/tr1/__refstring
 OLD_FILES+=usr/include/c++/v1/tr1/__split_buffer
 OLD_FILES+=usr/include/c++/v1/tr1/__sso_allocator
 OLD_FILES+=usr/include/c++/v1/tr1/__std_stream
@@ -4650,7 +4650,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/__string
 OLD_FILES+=usr/include/c++/v1/tr1/__threading_support
 OLD_FILES+=usr/include/c++/v1/tr1/__tree
 OLD_FILES+=usr/include/c++/v1/tr1/__tuple
-OLD_FILES+=usr/include/c++/v1/tr1/__undef_min_max
+OLD_FILES+=usr/include/c++/v1/tr1/__undef_macros
 OLD_FILES+=usr/include/c++/v1/tr1/algorithm
 OLD_FILES+=usr/include/c++/v1/tr1/any
 OLD_FILES+=usr/include/c++/v1/tr1/array
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335087 - stable/11/sys/dev/si

2018-06-13 Thread Dimitry Andric
Author: dim
Date: Wed Jun 13 20:33:52 2018
New Revision: 335087
URL: https://svnweb.freebsd.org/changeset/base/335087

Log:
  Fix build of si with base gcc on i386
  
  Casting from rman_res_t to a pointer results in "cast to pointer from
  integer of different size" warnings with base gcc on i386, so use
  intermediate casts to uintptr_t to suppress these.
  
  Direct commit to stable/11, since si(4) has been removed from head.
  
  Reviewed by:  jhb
  Differential Revision: https://reviews.freebsd.org/D15752

Modified:
  stable/11/sys/dev/si/si_isa.c
  stable/11/sys/dev/si/si_pci.c

Modified: stable/11/sys/dev/si/si_isa.c
==
--- stable/11/sys/dev/si/si_isa.c   Wed Jun 13 20:25:36 2018
(r335086)
+++ stable/11/sys/dev/si/si_isa.c   Wed Jun 13 20:33:52 2018
(r335087)
@@ -65,7 +65,7 @@ si_isa_probe(device_t dev)
device_printf(dev, "cannot allocate memory resource\n");
return ENXIO;
}
-   paddr = (caddr_t)rman_get_start(sc->sc_mem_res);/* physical */
+   paddr = (caddr_t)(uintptr_t)rman_get_start(sc->sc_mem_res);/* physical 
*/
maddr = rman_get_virtual(sc->sc_mem_res);   /* in kvm */
 
DPRINT((0, DBG_AUTOBOOT, "si%d: probe at virtual=0x%x physical=0x%x\n",
@@ -279,7 +279,7 @@ si_isa_attach(device_t dev)
device_printf(dev, "couldn't map memory\n");
goto fail;
}
-   sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res);
+   sc->sc_paddr = (caddr_t)(uintptr_t)rman_get_start(sc->sc_mem_res);
sc->sc_maddr = rman_get_virtual(sc->sc_mem_res);
 
sc->sc_irq_rid = 0;

Modified: stable/11/sys/dev/si/si_pci.c
==
--- stable/11/sys/dev/si/si_pci.c   Wed Jun 13 20:25:36 2018
(r335086)
+++ stable/11/sys/dev/si/si_pci.c   Wed Jun 13 20:33:52 2018
(r335087)
@@ -86,7 +86,7 @@ si_pci_attach(device_t dev)
device_printf(dev, "couldn't map memory\n");
goto fail;
}
-   sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res);
+   sc->sc_paddr = (caddr_t)(uintptr_t)rman_get_start(sc->sc_mem_res);
sc->sc_maddr = rman_get_virtual(sc->sc_mem_res);
 
sc->sc_irq_rid = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335086 - head/sys/dev/ae

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:36 2018
New Revision: 335086
URL: https://svnweb.freebsd.org/changeset/base/335086

Log:
  Add PNP info to PCI attachment of ae driver
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==
--- head/sys/dev/ae/if_ae.c Wed Jun 13 20:25:32 2018(r335085)
+++ head/sys/dev/ae/if_ae.c Wed Jun 13 20:25:36 2018(r335086)
@@ -177,6 +177,8 @@ static driver_t ae_driver = {
 static devclass_t ae_devclass;
 
 DRIVER_MODULE(ae, pci, ae_driver, ae_devclass, 0, 0);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ae, ae_devs,
+sizeof(ae_devs[0]), nitems(ae_devs));
 DRIVER_MODULE(miibus, ae, miibus_driver, miibus_devclass, 0, 0);
 MODULE_DEPEND(ae, pci, 1, 1, 1);
 MODULE_DEPEND(ae, ether, 1, 1, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335085 - head/sys/dev/age

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:32 2018
New Revision: 335085
URL: https://svnweb.freebsd.org/changeset/base/335085

Log:
  Add PNP info to PCI attachments of age driver
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/age/if_age.c

Modified: head/sys/dev/age/if_age.c
==
--- head/sys/dev/age/if_age.c   Wed Jun 13 20:25:27 2018(r335084)
+++ head/sys/dev/age/if_age.c   Wed Jun 13 20:25:32 2018(r335085)
@@ -183,6 +183,8 @@ static driver_t age_driver = {
 static devclass_t age_devclass;
 
 DRIVER_MODULE(age, pci, age_driver, age_devclass, 0, 0);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, age, age_devs,
+sizeof(age_devs[0]), nitems(age_devs));
 DRIVER_MODULE(miibus, age, miibus_driver, miibus_devclass, 0, 0);
 
 static struct resource_spec age_res_spec_mem[] = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335082 - head/sys/dev/bwi

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:18 2018
New Revision: 335082
URL: https://svnweb.freebsd.org/changeset/base/335082

Log:
  Add PNP info to PCI attachment of bwi driver
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/bwi/if_bwi_pci.c

Modified: head/sys/dev/bwi/if_bwi_pci.c
==
--- head/sys/dev/bwi/if_bwi_pci.c   Wed Jun 13 20:25:13 2018
(r335081)
+++ head/sys/dev/bwi/if_bwi_pci.c   Wed Jun 13 20:25:18 2018
(r335082)
@@ -256,6 +256,8 @@ static driver_t bwi_driver = {
 };
 static devclass_t bwi_devclass;
 DRIVER_MODULE(bwi, pci, bwi_driver, bwi_devclass, 0, 0);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bwi, bwi_devices,
+sizeof(bwi_devices[0]), nitems(bwi_devices) - 1);
 MODULE_DEPEND(bwi, wlan, 1, 1, 1); /* 802.11 media layer */
 MODULE_DEPEND(bwi, firmware, 1, 1, 1); /* firmware support */
 MODULE_DEPEND(bwi, wlan_amrr, 1, 1, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335083 - head/sys/dev/ale

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:23 2018
New Revision: 335083
URL: https://svnweb.freebsd.org/changeset/base/335083

Log:
  Add PNP info to PCI attachment of ale driver
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/ale/if_ale.c

Modified: head/sys/dev/ale/if_ale.c
==
--- head/sys/dev/ale/if_ale.c   Wed Jun 13 20:25:18 2018(r335082)
+++ head/sys/dev/ale/if_ale.c   Wed Jun 13 20:25:23 2018(r335083)
@@ -178,6 +178,8 @@ static driver_t ale_driver = {
 static devclass_t ale_devclass;
 
 DRIVER_MODULE(ale, pci, ale_driver, ale_devclass, NULL, NULL);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ale, ale_devs,
+sizeof(ale_devs[0]), nitems(ale_devs));
 DRIVER_MODULE(miibus, ale, miibus_driver, miibus_devclass, NULL, NULL);
 
 static struct resource_spec ale_res_spec_mem[] = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335084 - head/sys/dev/amr

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:27 2018
New Revision: 335084
URL: https://svnweb.freebsd.org/changeset/base/335084

Log:
  Add PNP info to PCI attachment of amr driver
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/amr/amr_pci.c

Modified: head/sys/dev/amr/amr_pci.c
==
--- head/sys/dev/amr/amr_pci.c  Wed Jun 13 20:25:23 2018(r335083)
+++ head/sys/dev/amr/amr_pci.c  Wed Jun 13 20:25:27 2018(r335084)
@@ -116,15 +116,10 @@ static driver_t amr_pci_driver = {
sizeof(struct amr_softc)
 };
 
-static devclass_t  amr_devclass;
-DRIVER_MODULE(amr, pci, amr_pci_driver, amr_devclass, 0, 0);
-MODULE_DEPEND(amr, pci, 1, 1, 1);
-MODULE_DEPEND(amr, cam, 1, 1, 1);
-
 static struct amr_ident
 {
-intvendor;
-intdevice;
+uint16_t   vendor;
+uint16_t   device;
 intflags;
 #define AMR_ID_PROBE_SIG   (1<<0)  /* generic i960RD, check signature */
 #define AMR_ID_DO_SG64 (1<<1)
@@ -143,6 +138,13 @@ static struct amr_ident
 {0x1028, 0x0013, AMR_ID_QUARTZ | AMR_ID_DO_SG64}, /* perc4/di */
 {0, 0, 0}
 };
+
+static devclass_t  amr_devclass;
+DRIVER_MODULE(amr, pci, amr_pci_driver, amr_devclass, 0, 0);
+MODULE_PNP_INFO("U16:vendor;U16:device", pci, amr, amr_device_ids,
+sizeof(amr_device_ids[0]), nitems(amr_device_ids) - 1);
+MODULE_DEPEND(amr, pci, 1, 1, 1);
+MODULE_DEPEND(amr, cam, 1, 1, 1);
 
 static struct amr_ident *
 amr_find_ident(device_t dev)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335081 - head/sys/dev/bwn

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:13 2018
New Revision: 335081
URL: https://svnweb.freebsd.org/changeset/base/335081

Log:
  Add PNP info to PCI attachment of bwn driver
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/bwn/if_bwn_pci.c

Modified: head/sys/dev/bwn/if_bwn_pci.c
==
--- head/sys/dev/bwn/if_bwn_pci.c   Wed Jun 13 20:25:09 2018
(r335080)
+++ head/sys/dev/bwn/if_bwn_pci.c   Wed Jun 13 20:25:13 2018
(r335081)
@@ -295,6 +295,10 @@ DEFINE_CLASS_0(bwn_pci, bwn_pci_driver, bwn_pci_method
 sizeof(struct bwn_pci_softc));
 DRIVER_MODULE_ORDERED(bwn_pci, pci, bwn_pci_driver, bwn_pci_devclass, NULL,
 NULL, SI_ORDER_ANY);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bwn_siba,
+siba_devices, sizeof(siba_devices[0]), nitems(siba_devices) - 1);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bwn_bcma,
+bcma_devices, sizeof(bcma_devices[0]), nitems(bcma_devices) - 1);
 DRIVER_MODULE(bhndb, bwn_pci, bhndb_pci_driver, bhndb_devclass, NULL, NULL);
 
 MODULE_DEPEND(bwn_pci, bwn, 1, 1, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335077 - head/sys/dev/ncr

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:24:49 2018
New Revision: 335077
URL: https://svnweb.freebsd.org/changeset/base/335077

Log:
  Add PNP info to the PCI attachment of the ncr driver.
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/ncr/ncr.c

Modified: head/sys/dev/ncr/ncr.c
==
--- head/sys/dev/ncr/ncr.c  Wed Jun 13 19:57:03 2018(r335076)
+++ head/sys/dev/ncr/ncr.c  Wed Jun 13 20:24:49 2018(r335077)
@@ -3169,8 +3169,8 @@ u_int32_t ncr_info (int unit)
 **--
 */
 typedef struct {
-   unsigned long   device_id;
-   unsigned short  minrevid;
+   uint32_tdevice_id;
+   uint16_tminrevid;
char   *name;
unsigned char   maxburst;
unsigned char   maxoffs;
@@ -3225,7 +3225,7 @@ static ncr_chip ncr_chip_table[] = {
  FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}
 };
 
-static int ncr_chip_lookup(u_long device_id, u_char revision_id)
+static int ncr_chip_lookup(uint32_t device_id, u_char revision_id)
 {
int i, found;

@@ -7108,6 +7108,8 @@ static driver_t ncr_driver = {
 static devclass_t ncr_devclass;
 
 DRIVER_MODULE(ncr, pci, ncr_driver, ncr_devclass, 0, 0);
+MODULE_PNP_INFO("W32:vendor/device;U16:#;D:#", pci, ncr, ncr_chip_table,
+sizeof(ncr_chip_table[0]), nitems(ncr_chip_table));
 MODULE_DEPEND(ncr, cam, 1, 1, 1);
 MODULE_DEPEND(ncr, pci, 1, 1, 1);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335079 - head/sys/dev/ahci

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:04 2018
New Revision: 335079
URL: https://svnweb.freebsd.org/changeset/base/335079

Log:
  Add PNP info to the PCI attachment of the ahci driver
  
  Mark the PNP table, but still need to handle the CLASS / SUBCLASS /
  REVID matching.
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/ahci/ahci_pci.c

Modified: head/sys/dev/ahci/ahci_pci.c
==
--- head/sys/dev/ahci/ahci_pci.cWed Jun 13 20:25:00 2018
(r335078)
+++ head/sys/dev/ahci/ahci_pci.cWed Jun 13 20:25:04 2018
(r335079)
@@ -664,6 +664,9 @@ static driver_t ahci_driver = {
 sizeof(struct ahci_controller)
 };
 DRIVER_MODULE(ahci, pci, ahci_driver, ahci_devclass, NULL, NULL);
+/* Also matches class / subclass / progid XXX need to add when we have masking 
support */
+MODULE_PNP_INFO("W32:vendor/device", pci, ahci, ahci_ids,
+sizeof(ahci_ids[0]), nitems(ahci_ids) - 1);
 static device_method_t ahci_ata_methods[] = {
DEVMETHOD(device_probe, ahci_ata_probe),
DEVMETHOD(device_attach,ahci_pci_attach),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335080 - head/sys/dev/an

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:09 2018
New Revision: 335080
URL: https://svnweb.freebsd.org/changeset/base/335080

Log:
  Add PNP info to PCI attachment of an driver
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/an/if_an_pci.c

Modified: head/sys/dev/an/if_an_pci.c
==
--- head/sys/dev/an/if_an_pci.c Wed Jun 13 20:25:04 2018(r335079)
+++ head/sys/dev/an/if_an_pci.c Wed Jun 13 20:25:09 2018(r335080)
@@ -273,5 +273,7 @@ static driver_t an_pci_driver = {
 static devclass_t an_devclass;
 
 DRIVER_MODULE(an, pci, an_pci_driver, an_devclass, 0, 0);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, an,
+an_devs, sizeof(an_devs[0]), nitems(an_devs) - 1);
 MODULE_DEPEND(an, pci, 1, 1, 1);
 MODULE_DEPEND(an, wlan, 1, 1, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335078 - head/sys/dev/aacraid

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 20:25:00 2018
New Revision: 335078
URL: https://svnweb.freebsd.org/changeset/base/335078

Log:
  Add PNP info to the PCI attachment of the aacraid driver.
  
  Reviewed by: imp, chuck
  Submitted by: Lakhan Shiva Kamireddy 
  Sponsored by: Google, Inc. (GSoC 2018)

Modified:
  head/sys/dev/aacraid/aacraid_pci.c

Modified: head/sys/dev/aacraid/aacraid_pci.c
==
--- head/sys/dev/aacraid/aacraid_pci.c  Wed Jun 13 20:24:49 2018
(r335077)
+++ head/sys/dev/aacraid/aacraid_pci.c  Wed Jun 13 20:25:00 2018
(r335078)
@@ -85,9 +85,6 @@ static driver_t aacraid_pci_driver = {
 
 static devclass_t  aacraid_devclass;
 
-DRIVER_MODULE(aacraid, pci, aacraid_pci_driver, aacraid_devclass, 0, 0);
-MODULE_DEPEND(aacraid, pci, 1, 1, 1);
-
 struct aac_ident
 {
u_int16_t   vendor;
@@ -106,6 +103,12 @@ struct aac_ident
 "Adaptec RAID Controller"},
{0, 0, 0, 0, 0, 0, 0}
 };
+
+DRIVER_MODULE(aacraid, pci, aacraid_pci_driver, aacraid_devclass, 0, 0);
+MODULE_PNP_INFO("U16:vendor;U16:device", pci, aacraid,
+aacraid_family_identifiers, sizeof(aacraid_family_identifiers[0]),
+nitems(aacraid_family_identifiers) - 1);
+MODULE_DEPEND(aacraid, pci, 1, 1, 1);
 
 static struct aac_ident *
 aac_find_ident(device_t dev)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335076 - head/sys/i386/i386

2018-06-13 Thread Ryan Libby
Author: rlibby
Date: Wed Jun 13 19:57:03 2018
New Revision: 335076
URL: https://svnweb.freebsd.org/changeset/base/335076

Log:
  i386: copyin/copyout error is EFAULT
  
  Discussed with:   kib
  MFC with: r332489
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/i386/i386/copyout.c

Modified: head/sys/i386/i386/copyout.c
==
--- head/sys/i386/i386/copyout.cWed Jun 13 18:58:36 2018
(r335075)
+++ head/sys/i386/i386/copyout.cWed Jun 13 19:57:03 2018
(r335076)
@@ -226,7 +226,7 @@ copyin(const void *udaddr, void *kaddr, size_t len)
 
if ((uintptr_t)udaddr + len < (uintptr_t)udaddr ||
(uintptr_t)udaddr + len > VM_MAXUSER_ADDRESS)
-   return (-1);
+   return (EFAULT);
if (len == 0 || (fast_copyout && len <= TRAMP_COPYOUT_SZ &&
copyin_fast_tramp(udaddr, kaddr, len, KCR3) == 0))
return (0);
@@ -261,7 +261,7 @@ copyout(const void *kaddr, void *udaddr, size_t len)
 
if ((uintptr_t)udaddr + len < (uintptr_t)udaddr ||
(uintptr_t)udaddr + len > VM_MAXUSER_ADDRESS)
-   return (-1);
+   return (EFAULT);
if (len == 0 || (fast_copyout && len <= TRAMP_COPYOUT_SZ &&
copyout_fast_tramp(kaddr, udaddr, len, KCR3) == 0))
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335066 - in head/sys: kern sys

2018-06-13 Thread Ian Lepore
On Wed, 2018-06-13 at 13:22 -0600, Warner Losh wrote:
> So we implement the elevator algorithm, but limit the number of requests
> that we can put in each 'car'. Elevators themselves are sometimes call
> 'cars' for reasons I have no clue about.

An "elevator" is an entire system for moving something vertically. It
includes a lift mechanism, guide system (rails, etc), control
mechanisms, etc. When the portion of the system that moves is an
enclosed space (not a simple platform or bucket) which carries people
and/or goods, that part is called a "carriage" or "car".

-- Ian (who was oddly fascinated by elevators as a child)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335066 - in head/sys: kern sys

2018-06-13 Thread Warner Losh
On Wed, Jun 13, 2018 at 1:12 PM, Ravi Pokala  wrote:

> Hi Warner,
>
> I have many questions...
>
> "Car limit"? I'm not sure what you mean by that?
>

So we implement the elevator algorithm, but limit the number of requests
that we can put in each 'car'. Elevators themselves are sometimes call
'cars' for reasons I have no clue about.

So we only put N requests into the sorting algorithm. We put the next
request at the end, unsorted, and that has the side effect of starting over
so the net request after that is sorted against the last one, but not the
first N.

This is to help bound software queuing latency.


> This change starts tracking the total number of BIOs on the queue, but
> doesn't actually do anything with that value.
>

Oh, you're right. We have a sysctl that counts them, I think, in Netflix's
code base (or did, I can't find it in the current sources)... I should
remove that from here. I'm surprised I didn't notice that before.


> When there are more requests batched than the limit, your comment say you
> "start over", and the code says you bioq_insert_tail(). Why does the latter
> imply "start(ing) over"?
>

Because that also sets a new sorting point for inserting sorted.

Warner



> Thanks,
>
> Ravi (rpokala@)
>
> -Original Message-
> From:  on behalf of Warner Losh
> 
> Date: 2018-06-13, Wednesday at 12:48
> To: , , <
> svn-src-h...@freebsd.org>
> Subject: svn commit: r335066 - in head/sys: kern sys
>
> Author: imp
> Date: Wed Jun 13 16:48:07 2018
> New Revision: 335066
> URL: https://svnweb.freebsd.org/changeset/base/335066
>
> Log:
>   Implement a 'car limit' for bioq.
>
>   Allow one to implement a 'car limit' for
>   bioq_disksort. debug.bioq_batchsize sets the size of car limit. Every
>   time we queue that many requests, we start over so that we limit the
>   latency for requests when the software queue depths are large. A value
>   of '0', the default, means to revert to the old behavior.
>
>   Sponsored by: Netflix
>
> Modified:
>   head/sys/kern/subr_disk.c
>   head/sys/sys/bio.h
>
> Modified: head/sys/kern/subr_disk.c
> 
> ==
> --- head/sys/kern/subr_disk.c   Wed Jun 13 15:58:33 2018(r335065)
> +++ head/sys/kern/subr_disk.c   Wed Jun 13 16:48:07 2018(r335066)
> @@ -23,8 +23,13 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
> +static int bioq_batchsize = 0;
> +SYSCTL_INT(_debug, OID_AUTO, bioq_batchsize, CTLFLAG_RW,
> +_batchsize, 0, "BIOQ batch size");
> +
>  /*-
>   * Disk error is the preface to plaintive error messages
>   * about failing disk transfers.  It prints messages of the form
> @@ -152,6 +157,8 @@ bioq_init(struct bio_queue_head *head)
> TAILQ_INIT(>queue);
> head->last_offset = 0;
> head->insert_point = NULL;
> +   head->total = 0;
> +   head->batched = 0;
>  }
>
>  void
> @@ -165,6 +172,7 @@ bioq_remove(struct bio_queue_head *head, struct bio *b
> head->insert_point = NULL;
>
> TAILQ_REMOVE(>queue, bp, bio_queue);
> +   head->total--;
>  }
>
>  void
> @@ -183,6 +191,8 @@ bioq_insert_head(struct bio_queue_head *head, struct b
> if (head->insert_point == NULL)
> head->last_offset = bp->bio_offset;
> TAILQ_INSERT_HEAD(>queue, bp, bio_queue);
> +   head->total++;
> +   head->batched = 0;
>  }
>
>  void
> @@ -190,6 +200,7 @@ bioq_insert_tail(struct bio_queue_head *head, struct b
>  {
>
> TAILQ_INSERT_TAIL(>queue, bp, bio_queue);
> +   head->total++;
> head->insert_point = bp;
> head->last_offset = bp->bio_offset;
>  }
> @@ -248,6 +259,11 @@ bioq_disksort(struct bio_queue_head *head, struct bio
> return;
> }
>
> +   if (bioq_batchsize > 0 && head->batched > bioq_batchsize) {
> +   bioq_insert_tail(head, bp);
> +   return;
> +   }
> +
> prev = NULL;
> key = bioq_bio_key(head, bp);
> cur = TAILQ_FIRST(>queue);
> @@ -266,4 +282,6 @@ bioq_disksort(struct bio_queue_head *head, struct bio
> TAILQ_INSERT_HEAD(>queue, bp, bio_queue);
> else
> TAILQ_INSERT_AFTER(>queue, prev, bp, bio_queue);
> +   head->total++;
> +   head->batched++;
>  }
>
> Modified: head/sys/sys/bio.h
> 
> ==
> --- head/sys/sys/bio.h  Wed Jun 13 15:58:33 2018(r335065)
> +++ head/sys/sys/bio.h  Wed Jun 13 16:48:07 2018(r335066)
> @@ -138,6 +138,8 @@ struct bio_queue_head {
> TAILQ_HEAD(bio_queue, bio) queue;
> off_t last_offset;
> struct  bio *insert_point;
> +   int total;
> +   int batched;
>  };
>
>  extern struct vm_map *bio_transient_map;
>
>
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all

Re: svn commit: r335066 - in head/sys: kern sys

2018-06-13 Thread Ravi Pokala
Hi Warner,

I have many questions...

"Car limit"? I'm not sure what you mean by that?

This change starts tracking the total number of BIOs on the queue, but doesn't 
actually do anything with that value.

When there are more requests batched than the limit, your comment say you 
"start over", and the code says you bioq_insert_tail(). Why does the latter 
imply "start(ing) over"?

Thanks,

Ravi (rpokala@)

-Original Message-
From:  on behalf of Warner Losh 

Date: 2018-06-13, Wednesday at 12:48
To: , , 

Subject: svn commit: r335066 - in head/sys: kern sys

Author: imp
Date: Wed Jun 13 16:48:07 2018
New Revision: 335066
URL: https://svnweb.freebsd.org/changeset/base/335066

Log:
  Implement a 'car limit' for bioq.
  
  Allow one to implement a 'car limit' for
  bioq_disksort. debug.bioq_batchsize sets the size of car limit. Every
  time we queue that many requests, we start over so that we limit the
  latency for requests when the software queue depths are large. A value
  of '0', the default, means to revert to the old behavior.
  
  Sponsored by: Netflix

Modified:
  head/sys/kern/subr_disk.c
  head/sys/sys/bio.h

Modified: head/sys/kern/subr_disk.c
==
--- head/sys/kern/subr_disk.c   Wed Jun 13 15:58:33 2018(r335065)
+++ head/sys/kern/subr_disk.c   Wed Jun 13 16:48:07 2018(r335066)
@@ -23,8 +23,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
+static int bioq_batchsize = 0;
+SYSCTL_INT(_debug, OID_AUTO, bioq_batchsize, CTLFLAG_RW,
+_batchsize, 0, "BIOQ batch size");
+
 /*-
  * Disk error is the preface to plaintive error messages
  * about failing disk transfers.  It prints messages of the form
@@ -152,6 +157,8 @@ bioq_init(struct bio_queue_head *head)
TAILQ_INIT(>queue);
head->last_offset = 0;
head->insert_point = NULL;
+   head->total = 0;
+   head->batched = 0;
 }
 
 void
@@ -165,6 +172,7 @@ bioq_remove(struct bio_queue_head *head, struct bio *b
head->insert_point = NULL;
 
TAILQ_REMOVE(>queue, bp, bio_queue);
+   head->total--;
 }
 
 void
@@ -183,6 +191,8 @@ bioq_insert_head(struct bio_queue_head *head, struct b
if (head->insert_point == NULL)
head->last_offset = bp->bio_offset;
TAILQ_INSERT_HEAD(>queue, bp, bio_queue);
+   head->total++;
+   head->batched = 0;
 }
 
 void
@@ -190,6 +200,7 @@ bioq_insert_tail(struct bio_queue_head *head, struct b
 {
 
TAILQ_INSERT_TAIL(>queue, bp, bio_queue);
+   head->total++;
head->insert_point = bp;
head->last_offset = bp->bio_offset;
 }
@@ -248,6 +259,11 @@ bioq_disksort(struct bio_queue_head *head, struct bio 
return;
}
 
+   if (bioq_batchsize > 0 && head->batched > bioq_batchsize) {
+   bioq_insert_tail(head, bp);
+   return;
+   }
+
prev = NULL;
key = bioq_bio_key(head, bp);
cur = TAILQ_FIRST(>queue);
@@ -266,4 +282,6 @@ bioq_disksort(struct bio_queue_head *head, struct bio 
TAILQ_INSERT_HEAD(>queue, bp, bio_queue);
else
TAILQ_INSERT_AFTER(>queue, prev, bp, bio_queue);
+   head->total++;
+   head->batched++;
 }

Modified: head/sys/sys/bio.h
==
--- head/sys/sys/bio.h  Wed Jun 13 15:58:33 2018(r335065)
+++ head/sys/sys/bio.h  Wed Jun 13 16:48:07 2018(r335066)
@@ -138,6 +138,8 @@ struct bio_queue_head {
TAILQ_HEAD(bio_queue, bio) queue;
off_t last_offset;
struct  bio *insert_point;
+   int total;
+   int batched;
 };
 
 extern struct vm_map *bio_transient_map;



___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335075 - vendor-crypto/openssl/dist-1.0.2

2018-06-13 Thread Jung-uk Kim
Author: jkim
Date: Wed Jun 13 18:58:36 2018
New Revision: 335075
URL: https://svnweb.freebsd.org/changeset/base/335075

Log:
  Copy over r331625 to create new vendor branch for OpenSSL 1.0.2 maintenance.

Added:
  vendor-crypto/openssl/dist-1.0.2/
 - copied from r335074, vendor-crypto/openssl/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335074 - head/share/man/man7

2018-06-13 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jun 13 18:50:51 2018
New Revision: 335074
URL: https://svnweb.freebsd.org/changeset/base/335074

Log:
  Mention that ports are used to build packages, this fact - obvious
  to the developers, but much less so to users - seems to be rather
  weakly documented.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Wed Jun 13 18:34:49 2018(r335073)
+++ head/share/man/man7/ports.7 Wed Jun 13 18:50:51 2018(r335074)
@@ -37,6 +37,8 @@ The
 Ports Collection
 offers a simple way for users and
 administrators to install applications.
+It is also used to build the packages, to be installed using
+.Xr pkg 8 .
 Each
 .Em port
 contains any patches necessary to make the original
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Edward Napierala
On 0613T0730, Warner Losh wrote:
> On Wed, Jun 13, 2018 at 6:39 AM, Edward Napierala  wrote:
> 
> > 2018-06-13 12:43 GMT+01:00 Emmanuel Vadot :
> >
> >> On 2018-06-12 18:45, Edward Tomasz Napierala wrote:

[..]

> >> +   echo '# USB OTG virtual serial port' \
> >>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
> >>> +   echo 'ttyU0 "/usr/libexec/getty 3wire"  vt100
> >>>  onifconsole  secure' \
> >>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
> >>> +   echo 'ttyU1 "/usr/libexec/getty 3wire"  vt100
> >>>  onifconsole  secure' \
> >>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
> >>>
> >>
> >>  If I have no OTG port and a usb<->uart plugged into my board that will
> >> give weird result no ?
> >>
> >
> > No, because that port won't be marked as console.  This only applies
> > to the "virtual" OTG serial ports.
> >
> 
> Right, and console is an overloaded term.  Here it just means 'tty marked
> by the kernel that gets a getty started on it automatically after it shows
> up' not 'the device that gets all the kernel I/O.'

Yup.  But again - this reuses the functionality that's already there
in init(8), while avoiding the renaming of device nodes.  And eventually,
those ports might become actual consoles, making things nicely aligned.

[..]

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335073 - in head: lib/libc/gen share/man/man7

2018-06-13 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jun 13 18:34:49 2018
New Revision: 335073
URL: https://svnweb.freebsd.org/changeset/base/335073

Log:
  Get rid of references to /usr/share/doc/ from ports(7) and getosreldate(3).
  The handbooks are not installed there anymore. While here, improve the
  URLs markup a bit.
  
  Reviewed by:  allanjude@
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D15793

Modified:
  head/lib/libc/gen/getosreldate.3
  head/share/man/man7/ports.7

Modified: head/lib/libc/gen/getosreldate.3
==
--- head/lib/libc/gen/getosreldate.3Wed Jun 13 17:55:09 2018
(r335072)
+++ head/lib/libc/gen/getosreldate.3Wed Jun 13 18:34:49 2018
(r335073)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 30, 2008
+.Dd June 13, 2018
 .Dt GETOSRELDATE 3
 .Os
 .Sh NAME
@@ -45,9 +45,9 @@ currently running
 .Fx
 kernel.
 Definitions of the values can be found in
-.%B "The Porter's Handbook"
-which is usually installed at
-.Pa /usr/share/doc/en_US.ISO8859-1/books/porters-handbook/ .
+.%B "The Porter's Handbook":
+.Pp
+.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn getosreldate
@@ -77,7 +77,6 @@ for any of the errors specified for the library functi
 .Sh SEE ALSO
 .Rs
 .%B "The Porter's Handbook"
-.%O /usr/share/doc/en_US.ISO8859-1/books/porters\-handbook/
 .Re
 .Sh HISTORY
 The

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Wed Jun 13 17:55:09 2018(r335072)
+++ head/share/man/man7/ports.7 Wed Jun 13 18:34:49 2018(r335073)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2014
+.Dd June 13, 2018
 .Dt PORTS 7
 .Os
 .Sh NAME
@@ -56,18 +56,17 @@ simply type
 .Nm make Cm install
 to install the application.
 .Pp
-For more information about using ports, see
-.Dq "Packages and Ports"
+For more information about using ports, see the
+.Dq "Packages and Ports" section
 in
-.%B "The FreeBSD Handbook" ,
-.Pa ( file:/usr/share/doc/en_US.ISO8859-1/books/handbook/ports.html
-or
-.Pa https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/ports.html ) .
-For information about creating new ports, see
-.%B "The Porter's Handbook"
-.Pa ( file:/usr/share/doc/en_US.ISO8859-1/books/porters-handbook/index.html
-or
-.Pa https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/porters-handbook/ ) .
+.%B "The FreeBSD Handbook":
+.Pp
+.Lk https://www.FreeBSD.org/doc/en/books/handbook/ports.html
+.Pp
+For information about creating new ports, see:
+.%B "The Porter's Handbook":
+.Pp
+.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/
 .Sh TARGETS
 Some of the targets work recursively through subdirectories.
 This lets you, for example, install all of the
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335072 - head/sys/amd64/amd64

2018-06-13 Thread Oliver Pinter
On Wednesday, June 13, 2018, Konstantin Belousov  wrote:

> Author: kib
> Date: Wed Jun 13 17:55:09 2018
> New Revision: 335072
> URL: https://svnweb.freebsd.org/changeset/base/335072
>
> Log:
>   Enable eager FPU context switch by default on amd64.
>
>   With compilers making increasing use of vector instructions the
>   performance benefit of lazily switching FPU state is no longer a
>   desirable tradeoff.  Linux switched to eager FPU context switch some
>   time ago, and the idea was floated on the FreeBSD-current mailing list
>   some years ago[1].
>
>   Enable eager FPU context switch by default on amd64, with a
> tunable/sysctl
>   available to turn it back off.
>
>   [1] https://lists.freebsd.org/pipermail/freebsd-current/
> 2015-March/055198.html
>
>
http://www.openwall.com/lists/oss-security/2018/06/13/7



>   Reviewed by:  jhb
>   Tested by:pho
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/amd64/amd64/cpu_switch.S
>   head/sys/amd64/amd64/fpu.c
>
> Modified: head/sys/amd64/amd64/cpu_switch.S
> 
> ==
> --- head/sys/amd64/amd64/cpu_switch.S   Wed Jun 13 17:42:55 2018
> (r335071)
> +++ head/sys/amd64/amd64/cpu_switch.S   Wed Jun 13 17:55:09 2018
> (r335072)
> @@ -128,10 +128,10 @@ done_store_dr:
>
> /* have we used fp, and need a save? */
> cmpq%rdi,PCPU(FPCURTHREAD)
> -   jne 3f
> +   jne 2f
> movqPCB_SAVEFPU(%r8),%r8
> clts
> -   cmpl$0,use_xsave
> +   cmpl$0,use_xsave(%rip)
> jne 1f
> fxsave  (%r8)
> jmp 2f
> @@ -143,12 +143,7 @@ ctx_switch_xsave:
> /* This is patched to xsaveopt if supported, see fpuinit_bsp1() */
> xsave   (%r8)
> movq%rcx,%rdx
> -2: smsw%ax
> -   orb $CR0_TS,%al
> -   lmsw%ax
> -   xorl%eax,%eax
> -   movq%rax,PCPU(FPCURTHREAD)
> -3:
> +2:
> /* Save is done.  Now fire up new thread. Leave old vmspace. */
> movq%rsi,%r12
> movq%rdi,%r13
> @@ -238,6 +233,8 @@ done_load_dr:
> movqPCB_RBX(%r8),%rbx
> movqPCB_RIP(%r8),%rax
> movq%rax,(%rsp)
> +   movqPCPU(CURTHREAD),%rdi
> +   callfpu_activate_sw
> ret
>
> /*
>
> Modified: head/sys/amd64/amd64/fpu.c
> 
> ==
> --- head/sys/amd64/amd64/fpu.c  Wed Jun 13 17:42:55 2018(r335071)
> +++ head/sys/amd64/amd64/fpu.c  Wed Jun 13 17:55:09 2018(r335072)
> @@ -142,6 +142,11 @@ static voidfpu_clean_state(void);
>  SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
>  SYSCTL_NULL_INT_PTR, 1, "Floating point instructions executed in
> hardware");
>
> +int lazy_fpu_switch = 0;
> +SYSCTL_INT(_hw, OID_AUTO, lazy_fpu_switch, CTLFLAG_RWTUN |
> CTLFLAG_NOFETCH,
> +_fpu_switch, 0,
> +"Lazily load FPU context after context switch");
> +
>  int use_xsave; /* non-static for cpu_switch.S */
>  uint64_t xsave_mask;   /* the same */
>  static uma_zone_t fpu_save_area_zone;
> @@ -242,6 +247,7 @@ fpuinit_bsp1(void)
> uint64_t xsave_mask_user;
> bool old_wp;
>
> +   TUNABLE_INT_FETCH("hw.lazy_fpu_switch", _fpu_switch);
> if (!use_xsave)
> return;
> cpuid_count(0xd, 0x0, cp);
> @@ -651,6 +657,45 @@ fputrap_sse(void)
> return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]);
>  }
>
> +static void
> +restore_fpu_curthread(struct thread *td)
> +{
> +   struct pcb *pcb;
> +
> +   /*
> +* Record new context early in case frstor causes a trap.
> +*/
> +   PCPU_SET(fpcurthread, td);
> +
> +   stop_emulating();
> +   fpu_clean_state();
> +   pcb = td->td_pcb;
> +
> +   if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
> +   /*
> +* This is the first time this thread has used the FPU or
> +* the PCB doesn't contain a clean FPU state.  Explicitly
> +* load an initial state.
> +*
> +* We prefer to restore the state from the actual save
> +* area in PCB instead of directly loading from
> +* fpu_initialstate, to ignite the XSAVEOPT
> +* tracking engine.
> +*/
> +   bcopy(fpu_initialstate, pcb->pcb_save,
> +   cpu_max_ext_state_size);
> +   fpurestore(pcb->pcb_save);
> +   if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
> +   fldcw(pcb->pcb_initial_fpucw);
> +   if (PCB_USER_FPU(pcb))
> +   set_pcb_flags(pcb, PCB_FPUINITDONE |
> +   PCB_USERFPUINITDONE);
> +   else
> +   set_pcb_flags(pcb, PCB_FPUINITDONE);
> +   } else
> +   

svn commit: r335072 - head/sys/amd64/amd64

2018-06-13 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 13 17:55:09 2018
New Revision: 335072
URL: https://svnweb.freebsd.org/changeset/base/335072

Log:
  Enable eager FPU context switch by default on amd64.
  
  With compilers making increasing use of vector instructions the
  performance benefit of lazily switching FPU state is no longer a
  desirable tradeoff.  Linux switched to eager FPU context switch some
  time ago, and the idea was floated on the FreeBSD-current mailing list
  some years ago[1].
  
  Enable eager FPU context switch by default on amd64, with a tunable/sysctl
  available to turn it back off.
  
  [1] https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055198.html
  
  Reviewed by:  jhb
  Tested by:pho
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/amd64/amd64/cpu_switch.S
  head/sys/amd64/amd64/fpu.c

Modified: head/sys/amd64/amd64/cpu_switch.S
==
--- head/sys/amd64/amd64/cpu_switch.S   Wed Jun 13 17:42:55 2018
(r335071)
+++ head/sys/amd64/amd64/cpu_switch.S   Wed Jun 13 17:55:09 2018
(r335072)
@@ -128,10 +128,10 @@ done_store_dr:
 
/* have we used fp, and need a save? */
cmpq%rdi,PCPU(FPCURTHREAD)
-   jne 3f
+   jne 2f
movqPCB_SAVEFPU(%r8),%r8
clts
-   cmpl$0,use_xsave
+   cmpl$0,use_xsave(%rip)
jne 1f
fxsave  (%r8)
jmp 2f
@@ -143,12 +143,7 @@ ctx_switch_xsave:
/* This is patched to xsaveopt if supported, see fpuinit_bsp1() */
xsave   (%r8)
movq%rcx,%rdx
-2: smsw%ax
-   orb $CR0_TS,%al
-   lmsw%ax
-   xorl%eax,%eax
-   movq%rax,PCPU(FPCURTHREAD)
-3:
+2:
/* Save is done.  Now fire up new thread. Leave old vmspace. */
movq%rsi,%r12
movq%rdi,%r13
@@ -238,6 +233,8 @@ done_load_dr:
movqPCB_RBX(%r8),%rbx
movqPCB_RIP(%r8),%rax
movq%rax,(%rsp)
+   movqPCPU(CURTHREAD),%rdi
+   callfpu_activate_sw
ret
 
/*

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Wed Jun 13 17:42:55 2018(r335071)
+++ head/sys/amd64/amd64/fpu.c  Wed Jun 13 17:55:09 2018(r335072)
@@ -142,6 +142,11 @@ static voidfpu_clean_state(void);
 SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
 SYSCTL_NULL_INT_PTR, 1, "Floating point instructions executed in 
hardware");
 
+int lazy_fpu_switch = 0;
+SYSCTL_INT(_hw, OID_AUTO, lazy_fpu_switch, CTLFLAG_RWTUN | CTLFLAG_NOFETCH,
+_fpu_switch, 0,
+"Lazily load FPU context after context switch");
+
 int use_xsave; /* non-static for cpu_switch.S */
 uint64_t xsave_mask;   /* the same */
 static uma_zone_t fpu_save_area_zone;
@@ -242,6 +247,7 @@ fpuinit_bsp1(void)
uint64_t xsave_mask_user;
bool old_wp;
 
+   TUNABLE_INT_FETCH("hw.lazy_fpu_switch", _fpu_switch);
if (!use_xsave)
return;
cpuid_count(0xd, 0x0, cp);
@@ -651,6 +657,45 @@ fputrap_sse(void)
return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]);
 }
 
+static void
+restore_fpu_curthread(struct thread *td)
+{
+   struct pcb *pcb;
+
+   /*
+* Record new context early in case frstor causes a trap.
+*/
+   PCPU_SET(fpcurthread, td);
+
+   stop_emulating();
+   fpu_clean_state();
+   pcb = td->td_pcb;
+
+   if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
+   /*
+* This is the first time this thread has used the FPU or
+* the PCB doesn't contain a clean FPU state.  Explicitly
+* load an initial state.
+*
+* We prefer to restore the state from the actual save
+* area in PCB instead of directly loading from
+* fpu_initialstate, to ignite the XSAVEOPT
+* tracking engine.
+*/
+   bcopy(fpu_initialstate, pcb->pcb_save,
+   cpu_max_ext_state_size);
+   fpurestore(pcb->pcb_save);
+   if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
+   fldcw(pcb->pcb_initial_fpucw);
+   if (PCB_USER_FPU(pcb))
+   set_pcb_flags(pcb, PCB_FPUINITDONE |
+   PCB_USERFPUINITDONE);
+   else
+   set_pcb_flags(pcb, PCB_FPUINITDONE);
+   } else
+   fpurestore(pcb->pcb_save);
+}
+
 /*
  * Device Not Available (DNA, #NM) exception handler.
  *
@@ -661,7 +706,9 @@ fputrap_sse(void)
 void
 fpudna(void)
 {
+   struct thread *td;
 
+   td = curthread;
/*
 * This handler is entered with interrupts enabled, so context
 * switches may occur before critical_enter() is executed.  If
@@ -675,7 +722,7 @@ 

svn commit: r335071 - head/stand/libsa

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 17:42:55 2018
New Revision: 335071
URL: https://svnweb.freebsd.org/changeset/base/335071

Log:
  Initialize variables we later free so they aren't used
  uninitialized in the error path.
  Remove unused variables.
  
  Sponsored by: Netflix

Modified:
  head/stand/libsa/nfs.c

Modified: head/stand/libsa/nfs.c
==
--- head/stand/libsa/nfs.c  Wed Jun 13 17:42:50 2018(r335070)
+++ head/stand/libsa/nfs.c  Wed Jun 13 17:42:55 2018(r335071)
@@ -249,7 +249,7 @@ int
 nfs_lookupfh(struct nfs_iodesc *d, const char *name, struct nfs_iodesc *newfd)
 {
void *pkt = NULL;
-   int len, rlen, pos;
+   int len, pos;
struct args {
uint32_t fhsize;
uint32_t fhplusname[1 +
@@ -465,14 +465,13 @@ int
 nfs_open(const char *upath, struct open_file *f)
 {
struct iodesc *desc;
-   struct nfs_iodesc *currfd;
+   struct nfs_iodesc *currfd = NULL;
char buf[2 * NFS_V3MAXFHSIZE + 3];
u_char *fh;
char *cp;
int i;
 #ifndef NFS_NOSYMLINK
-   struct nfs_iodesc *newfd;
-   struct nfsv3_fattrs *fa;
+   struct nfs_iodesc *newfd = NULL;
char *ncp;
int c;
char namebuf[NFS_MAXPATHLEN + 1];
@@ -480,7 +479,7 @@ nfs_open(const char *upath, struct open_file *f)
int nlinks = 0;
 #endif
int error;
-   char *path;
+   char *path = NULL;
 
if (netproto != NET_NFS)
return (EINVAL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335070 - head/stand/libsa

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 17:42:50 2018
New Revision: 335070
URL: https://svnweb.freebsd.org/changeset/base/335070

Log:
  Remove unused variables.
  
  Sponsored by: Netflix

Modified:
  head/stand/libsa/tftp.c
  head/stand/libsa/ufs.c

Modified: head/stand/libsa/tftp.c
==
--- head/stand/libsa/tftp.c Wed Jun 13 17:28:06 2018(r335069)
+++ head/stand/libsa/tftp.c Wed Jun 13 17:42:50 2018(r335070)
@@ -186,7 +186,6 @@ recvtftp(struct iodesc *d, void **pkt, void **payload,
struct tftprecv_extra *extra;
struct tftp_handle *h;
struct tftphdr *t;
-   unsigned short *rtype;
void *ptr = NULL;
ssize_t len;
 

Modified: head/stand/libsa/ufs.c
==
--- head/stand/libsa/ufs.c  Wed Jun 13 17:28:06 2018(r335069)
+++ head/stand/libsa/ufs.c  Wed Jun 13 17:42:50 2018(r335070)
@@ -506,8 +506,7 @@ ufs_open(upath, f)
ino_t inumber, parent_inumber;
struct file *fp;
struct fs *fs;
-   int i, rc;
-   size_t buf_size;
+   int rc;
int nlinks = 0;
char namebuf[MAXPATHLEN+1];
char *buf = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335069 - head/stand/libsa

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 17:28:06 2018
New Revision: 335069
URL: https://svnweb.freebsd.org/changeset/base/335069

Log:
  Remove fail: label. It's unused.
  
  Sponsored by: Netflix

Modified:
  head/stand/libsa/open.c

Modified: head/stand/libsa/open.c
==
--- head/stand/libsa/open.c Wed Jun 13 17:04:41 2018(r335068)
+++ head/stand/libsa/open.c Wed Jun 13 17:28:06 2018(r335069)
@@ -141,7 +141,6 @@ open(const char *fname, int mode)
 }
 error = besterror;
 
- fail:
 if ((f->f_flags & F_NODEV) == 0 && f->f_dev != NULL)
f->f_dev->dv_close(f);
 if (error)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335068 - in head: share/man/man9 sys/amd64/amd64 sys/i386/i386 sys/kern sys/net sys/sys sys/vm

2018-06-13 Thread Jonathan T. Looney
Author: jtl
Date: Wed Jun 13 17:04:41 2018
New Revision: 335068
URL: https://svnweb.freebsd.org/changeset/base/335068

Log:
  Make UMA and malloc(9) return non-executable memory in most cases.
  
  Most kernel memory that is allocated after boot does not need to be
  executable.  There are a few exceptions.  For example, kernel modules
  do need executable memory, but they don't use UMA or malloc(9).  The
  BPF JIT compiler also needs executable memory and did use malloc(9)
  until r317072.
  
  (Note that a side effect of r316767 was that the "small allocation"
  path in UMA on amd64 already returned non-executable memory.  This
  meant that some calls to malloc(9) or the UMA zone(9) allocator could
  return executable memory, while others could return non-executable
  memory.  This change makes the behavior consistent.)
  
  This change makes malloc(9) return non-executable memory unless the new
  M_EXEC flag is specified.  After this change, the UMA zone(9) allocator
  will always return non-executable memory, and a KASSERT will catch
  attempts to use the M_EXEC flag to allocate executable memory using
  uma_zalloc() or its variants.
  
  Allocations that do need executable memory have various choices.  They
  may use the M_EXEC flag to malloc(9), or they may use a different VM
  interfact to obtain executable pages.
  
  Now that malloc(9) again allows executable allocations, this change also
  reverts most of r317072.
  
  PR:   228927
  Reviewed by:  alc, kib, markj, jhb (previous version)
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D15691

Modified:
  head/share/man/man9/malloc.9
  head/share/man/man9/zone.9
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.c
  head/sys/kern/kern_malloc.c
  head/sys/kern/subr_vmem.c
  head/sys/net/bpf_jitter.c
  head/sys/net/bpf_jitter.h
  head/sys/sys/malloc.h
  head/sys/vm/uma.h
  head/sys/vm/uma_core.c
  head/sys/vm/vm_extern.h
  head/sys/vm/vm_init.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_kern.h
  head/sys/vm/vm_pagequeue.h

Modified: head/share/man/man9/malloc.9
==
--- head/share/man/man9/malloc.9Wed Jun 13 17:01:57 2018
(r335067)
+++ head/share/man/man9/malloc.9Wed Jun 13 17:04:41 2018
(r335068)
@@ -29,7 +29,7 @@
 .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
 .\" $FreeBSD$
 .\"
-.Dd January 24, 2018
+.Dd June 13, 2018
 .Dt MALLOC 9
 .Os
 .Sh NAME
@@ -189,6 +189,11 @@ This option should only be used in combination with
 .Dv M_NOWAIT
 when an allocation failure cannot be tolerated by the caller without
 catastrophic effects on the system.
+.It Dv M_EXEC
+Indicates that the system should allocate executable memory.
+If this flag is not set, the system will not allocate executable memory.
+Not all platforms enforce a distinction between executable and
+non-executable memory.
 .El
 .Pp
 Exactly one of either

Modified: head/share/man/man9/zone.9
==
--- head/share/man/man9/zone.9  Wed Jun 13 17:01:57 2018(r335067)
+++ head/share/man/man9/zone.9  Wed Jun 13 17:04:41 2018(r335068)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 26, 2017
+.Dd June 13, 2018
 .Dt ZONE 9
 .Os
 .Sh NAME
@@ -375,6 +375,15 @@ if the zone ran out of unused items
 and
 .Dv M_NOWAIT
 was specified.
+.Sh IMPLEMENTATION NOTES
+The memory that these allocation calls return is not executable.
+The
+.Fn uma_zalloc
+function does not support the
+.Dv M_EXEC
+flag to allocate executable memory.
+Not all platforms enforce a distinction between executable and
+non-executable memory.
 .Sh SEE ALSO
 .Xr malloc 9
 .Sh HISTORY

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==
--- head/sys/amd64/amd64/bpf_jit_machdep.c  Wed Jun 13 17:01:57 2018
(r335067)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c  Wed Jun 13 17:04:41 2018
(r335068)
@@ -44,9 +44,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
-#include 
-#include 
 #else
 #include 
 #include 
@@ -605,11 +602,7 @@ bpf_jit_compile(struct bpf_insn *prog, u_int nins, siz
 
*size = stream.cur_ip;
 #ifdef _KERNEL
-   /*
-* We cannot use malloc(9) because DMAP is mapped as NX.
-*/
-   stream.ibuf = (void *)kmem_malloc(kernel_arena, *size,
-   M_NOWAIT);
+   stream.ibuf = malloc(*size, M_BPFJIT, M_EXEC | M_NOWAIT);
if (stream.ibuf == NULL)
break;
 #else
@@ -657,15 +650,4 @@ bpf_jit_compile(struct bpf_insn *prog, u_int nins, siz
 #endif
 
return ((bpf_filter_func)(void *)stream.ibuf);
-}
-
-void
-bpf_jit_free(void *func, size_t size)
-{
-
-#ifdef _KERNEL
-   kmem_free(kernel_arena, (vm_offset_t)func, size);

svn commit: r335067 - head/tests/sys/audit

2018-06-13 Thread Alan Somers
Author: asomers
Date: Wed Jun 13 17:01:57 2018
New Revision: 335067
URL: https://svnweb.freebsd.org/changeset/base/335067

Log:
  audit(4): Fix file descriptor leaks in ATF tests
  
  Submitted by: aniketp
  Reported by:  Coverity
  CID:  1393343 1393346 1392695 1392781 1391709 1392078 1392413
  CID:  1392014 1392521 1393344 1393345 1393347 1393348 1393349
  CID:  1393354 1393355 1393356 1393357 1393358 1393360 1393362
  CID:  1393368 1393369 1393370 1393371 1393372 1393373 1393376
  CID:  1393380 1393384 1393387 1393388 1393389
  MFC after:2 weeks
  Sponsored by: Google, Inc (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15782

Modified:
  head/tests/sys/audit/file-attribute-access.c
  head/tests/sys/audit/file-close.c
  head/tests/sys/audit/file-create.c
  head/tests/sys/audit/file-delete.c
  head/tests/sys/audit/file-write.c
  head/tests/sys/audit/open.c
  head/tests/sys/audit/utils.c

Modified: head/tests/sys/audit/file-attribute-access.c
==
--- head/tests/sys/audit/file-attribute-access.cWed Jun 13 16:48:07 
2018(r335066)
+++ head/tests/sys/audit/file-attribute-access.cWed Jun 13 17:01:57 
2018(r335067)
@@ -36,6 +36,7 @@
 
 static struct pollfd fds[1];
 static mode_t mode = 0777;
+static int filedesc;
 static char extregex[80];
 static struct stat statbuff;
 static const char *auclass = "fa";
@@ -55,10 +56,11 @@ ATF_TC_HEAD(stat_success, tc)
 ATF_TC_BODY(stat_success, tc)
 {
/* File needs to exist to call stat(2) */
-   ATF_REQUIRE(open(path, O_CREAT, mode) != -1);
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
FILE *pipefd = setup(fds, auclass);
ATF_REQUIRE_EQ(0, stat(path, ));
check_audit(fds, successreg, pipefd);
+   close(filedesc);
 }
 
 ATF_TC_CLEANUP(stat_success, tc)
@@ -140,7 +142,6 @@ ATF_TC_HEAD(fstat_success, tc)
 
 ATF_TC_BODY(fstat_success, tc)
 {
-   int filedesc;
/* File needs to exist to call fstat(2) */
ATF_REQUIRE((filedesc = open(path, O_CREAT | O_RDWR, mode)) != -1);
FILE *pipefd = setup(fds, auclass);
@@ -149,6 +150,7 @@ ATF_TC_BODY(fstat_success, tc)
snprintf(extregex, sizeof(extregex),
"fstat.*%jd.*return,success", (intmax_t)statbuff.st_ino);
check_audit(fds, extregex, pipefd);
+   close(filedesc);
 }
 
 ATF_TC_CLEANUP(fstat_success, tc)

Modified: head/tests/sys/audit/file-close.c
==
--- head/tests/sys/audit/file-close.c   Wed Jun 13 16:48:07 2018
(r335066)
+++ head/tests/sys/audit/file-close.c   Wed Jun 13 17:01:57 2018
(r335067)
@@ -40,6 +40,7 @@
 static pid_t pid;
 static struct pollfd fds[1];
 static mode_t mode = 0777;
+static int filedesc;
 static char extregex[80];
 static struct stat statbuff;
 static const char *auclass = "cl";
@@ -103,7 +104,6 @@ ATF_TC_HEAD(close_success, tc)
 
 ATF_TC_BODY(close_success, tc)
 {
-   int filedesc;
/* File needs to exist to call close(2) */
ATF_REQUIRE((filedesc = open(path, O_CREAT | O_RDWR, mode)) != -1);
/* Call stat(2) to store the Inode number of 'path' */
@@ -176,7 +176,6 @@ ATF_TC_HEAD(revoke_success, tc)
 
 ATF_TC_BODY(revoke_success, tc)
 {
-   int filedesc;
char *ptyname;
pid = getpid();
snprintf(extregex, sizeof(extregex), "revoke.*%d.*return,success", pid);
@@ -188,9 +187,7 @@ ATF_TC_BODY(revoke_success, tc)
FILE *pipefd = setup(fds, auclass);
ATF_REQUIRE_EQ(0, revoke(ptyname));
check_audit(fds, extregex, pipefd);
-
-   /* Close the file descriptor to pseudo terminal */
-   ATF_REQUIRE_EQ(0, close(filedesc));
+   close(filedesc);
 }
 
 ATF_TC_CLEANUP(revoke_success, tc)

Modified: head/tests/sys/audit/file-create.c
==
--- head/tests/sys/audit/file-create.c  Wed Jun 13 16:48:07 2018
(r335066)
+++ head/tests/sys/audit/file-create.c  Wed Jun 13 17:01:57 2018
(r335067)
@@ -37,6 +37,7 @@
 
 static struct pollfd fds[1];
 static mode_t mode = 0777;
+static int filedesc;
 static dev_t dev =  0;
 static const char *auclass = "fc";
 static const char *path = "fileforaudit";
@@ -305,10 +306,11 @@ ATF_TC_HEAD(rename_success, tc)
 
 ATF_TC_BODY(rename_success, tc)
 {
-   ATF_REQUIRE(open(path, O_CREAT, mode) != -1);
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
FILE *pipefd = setup(fds, auclass);
ATF_REQUIRE_EQ(0, rename(path, "renamed"));
check_audit(fds, successreg, pipefd);
+   close(filedesc);
 }
 
 ATF_TC_CLEANUP(rename_success, tc)
@@ -347,10 +349,11 @@ ATF_TC_HEAD(renameat_success, tc)
 
 ATF_TC_BODY(renameat_success, tc)
 {
-   ATF_REQUIRE(open(path, O_CREAT, mode) != -1);
+   ATF_REQUIRE((filedesc = 

svn commit: r335066 - in head/sys: kern sys

2018-06-13 Thread Warner Losh
Author: imp
Date: Wed Jun 13 16:48:07 2018
New Revision: 335066
URL: https://svnweb.freebsd.org/changeset/base/335066

Log:
  Implement a 'car limit' for bioq.
  
  Allow one to implement a 'car limit' for
  bioq_disksort. debug.bioq_batchsize sets the size of car limit. Every
  time we queue that many requests, we start over so that we limit the
  latency for requests when the software queue depths are large. A value
  of '0', the default, means to revert to the old behavior.
  
  Sponsored by: Netflix

Modified:
  head/sys/kern/subr_disk.c
  head/sys/sys/bio.h

Modified: head/sys/kern/subr_disk.c
==
--- head/sys/kern/subr_disk.c   Wed Jun 13 15:58:33 2018(r335065)
+++ head/sys/kern/subr_disk.c   Wed Jun 13 16:48:07 2018(r335066)
@@ -23,8 +23,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
+static int bioq_batchsize = 0;
+SYSCTL_INT(_debug, OID_AUTO, bioq_batchsize, CTLFLAG_RW,
+_batchsize, 0, "BIOQ batch size");
+
 /*-
  * Disk error is the preface to plaintive error messages
  * about failing disk transfers.  It prints messages of the form
@@ -152,6 +157,8 @@ bioq_init(struct bio_queue_head *head)
TAILQ_INIT(>queue);
head->last_offset = 0;
head->insert_point = NULL;
+   head->total = 0;
+   head->batched = 0;
 }
 
 void
@@ -165,6 +172,7 @@ bioq_remove(struct bio_queue_head *head, struct bio *b
head->insert_point = NULL;
 
TAILQ_REMOVE(>queue, bp, bio_queue);
+   head->total--;
 }
 
 void
@@ -183,6 +191,8 @@ bioq_insert_head(struct bio_queue_head *head, struct b
if (head->insert_point == NULL)
head->last_offset = bp->bio_offset;
TAILQ_INSERT_HEAD(>queue, bp, bio_queue);
+   head->total++;
+   head->batched = 0;
 }
 
 void
@@ -190,6 +200,7 @@ bioq_insert_tail(struct bio_queue_head *head, struct b
 {
 
TAILQ_INSERT_TAIL(>queue, bp, bio_queue);
+   head->total++;
head->insert_point = bp;
head->last_offset = bp->bio_offset;
 }
@@ -248,6 +259,11 @@ bioq_disksort(struct bio_queue_head *head, struct bio 
return;
}
 
+   if (bioq_batchsize > 0 && head->batched > bioq_batchsize) {
+   bioq_insert_tail(head, bp);
+   return;
+   }
+
prev = NULL;
key = bioq_bio_key(head, bp);
cur = TAILQ_FIRST(>queue);
@@ -266,4 +282,6 @@ bioq_disksort(struct bio_queue_head *head, struct bio 
TAILQ_INSERT_HEAD(>queue, bp, bio_queue);
else
TAILQ_INSERT_AFTER(>queue, prev, bp, bio_queue);
+   head->total++;
+   head->batched++;
 }

Modified: head/sys/sys/bio.h
==
--- head/sys/sys/bio.h  Wed Jun 13 15:58:33 2018(r335065)
+++ head/sys/sys/bio.h  Wed Jun 13 16:48:07 2018(r335066)
@@ -138,6 +138,8 @@ struct bio_queue_head {
TAILQ_HEAD(bio_queue, bio) queue;
off_t last_offset;
struct  bio *insert_point;
+   int total;
+   int batched;
 };
 
 extern struct vm_map *bio_transient_map;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335065 - head/sys/arm64/arm64

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 15:58:33 2018
New Revision: 335065
URL: https://svnweb.freebsd.org/changeset/base/335065

Log:
  Add ThunderX2 to the list of CPUs we need to apply the branch predictor
  hardening to.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/cpu_errata.c

Modified: head/sys/arm64/arm64/cpu_errata.c
==
--- head/sys/arm64/arm64/cpu_errata.c   Wed Jun 13 15:56:24 2018
(r335064)
+++ head/sys/arm64/arm64/cpu_errata.c   Wed Jun 13 15:58:33 2018
(r335065)
@@ -73,6 +73,12 @@ static struct cpu_quirks cpu_quirks[] = {
.midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A75,0,0),
.quirk_install = install_psci_bp_hardening,
},
+   {
+   .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK,
+   .midr_value =
+   CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0,0),
+   .quirk_install = install_psci_bp_hardening,
+   },
 };
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335064 - head/sys/arm64/arm64

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 15:56:24 2018
New Revision: 335064
URL: https://svnweb.freebsd.org/changeset/base/335064

Log:
  Switch to the SMCCC function for branch predictor hardening. The previous
  method may not have worked as the firmware checks for the ARCH_WORKAROUND_1
  function ID.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/cpu_errata.c

Modified: head/sys/arm64/arm64/cpu_errata.c
==
--- head/sys/arm64/arm64/cpu_errata.c   Wed Jun 13 15:41:22 2018
(r335063)
+++ head/sys/arm64/arm64/cpu_errata.c   Wed Jun 13 15:56:24 2018
(r335064)
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
+#include 
 
 typedef void (cpu_quirk_install)(void);
 struct cpu_quirks {
@@ -79,7 +79,10 @@ static void
 install_psci_bp_hardening(void)
 {
 
-   PCPU_SET(bp_harden, psci_get_version);
+   if (smccc_arch_features(SMCCC_ARCH_WORKAROUND_1) != SMCCC_RET_SUCCESS)
+   return;
+
+   PCPU_SET(bp_harden, smccc_arch_workaround_1);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335063 - head/sys/dev/psci

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 15:41:22 2018
New Revision: 335063
URL: https://svnweb.freebsd.org/changeset/base/335063

Log:
  Add the SMCCC return codes from ARM DEN 0070A.
  
  While here add a comment with the document the function IDs come from.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/psci/smccc.h

Modified: head/sys/dev/psci/smccc.h
==
--- head/sys/dev/psci/smccc.h   Wed Jun 13 15:32:00 2018(r335062)
+++ head/sys/dev/psci/smccc.h   Wed Jun 13 15:41:22 2018(r335063)
@@ -49,12 +49,21 @@
 #defineSMCCC_32BIT_CALL0
 #defineSMCCC_64BIT_CALL1
 
+/*
+ * Arm Architecture Calls.
+ * These are documented in the document ARM DEN 0070A.
+ */
 #defineSMCCC_VERSION   
\
 SMCCC_FUNC_ID(SMCCC_FAST_CALL, SMCCC_64BIT_CALL, 0, 0)
 #defineSMCCC_ARCH_FEATURES 
\
 SMCCC_FUNC_ID(SMCCC_FAST_CALL, SMCCC_64BIT_CALL, 0, 1)
 #defineSMCCC_ARCH_WORKAROUND_1 
\
 SMCCC_FUNC_ID(SMCCC_FAST_CALL, SMCCC_64BIT_CALL, 0, 0x8000)
+
+/* The return values from ARM DEN 0070A. */
+#defineSMCCC_RET_SUCCESS   0
+#defineSMCCC_RET_NOT_SUPPORTED -1
+#defineSMCCC_RET_NOT_REQUIRED  -2
 
 int32_t smccc_arch_features(uint32_t);
 int smccc_arch_workaround_1(void);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335062 - in head/sys: conf dev/psci

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 15:32:00 2018
New Revision: 335062
URL: https://svnweb.freebsd.org/changeset/base/335062

Log:
  Add support for the ARM SMC Calling Convention (SMCCC). This is a method
  to call into the firmware in a similar way to the existing PSCI, and used
  PSCI to detect when SMCCC is enabled.
  
  There is a function ID space we can use. Currently we only support 3
  functions in the ARM Architecture Calls region, however it is expected we
  will expend these in the future.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/dev/psci/smccc.c   (contents, props changed)
  head/sys/dev/psci/smccc.h   (contents, props changed)
Modified:
  head/sys/conf/files.arm64

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Wed Jun 13 15:24:07 2018(r335061)
+++ head/sys/conf/files.arm64   Wed Jun 13 15:32:00 2018(r335062)
@@ -208,6 +208,7 @@ dev/pci/pci_host_generic_acpi.c optionalpci acpi
 dev/pci/pci_host_generic_fdt.c optionalpci fdt
 dev/psci/psci.cstandard
 dev/psci/psci_arm64.S  standard
+dev/psci/smccc.c   standard
 dev/uart/uart_cpu_arm64.c  optionaluart
 dev/uart/uart_dev_mu.c optionaluart uart_mu
 dev/uart/uart_dev_pl011.c  optionaluart pl011

Added: head/sys/dev/psci/smccc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/psci/smccc.c   Wed Jun 13 15:32:00 2018(r335062)
@@ -0,0 +1,93 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 Andrew Turner
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "opt_acpi.h"
+#include "opt_platform.h"
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#defineSMCCC_VERSION_1_0   0x1
+
+/* Assume 1.0 until we detect a later version */
+static uint32_tsmccc_version = SMCCC_VERSION_1_0;
+
+static void
+smccc_init(void *dummy)
+{
+   int32_t features;
+   uint32_t ret;
+
+   features = psci_features(SMCCC_VERSION);
+   if (features != PSCI_RETVAL_NOT_SUPPORTED) {
+   ret = psci_call(SMCCC_VERSION, 0, 0, 0);
+   /* This should always be the case as we checked it above */
+   if (ret > 0)
+   smccc_version = ret;
+   }
+
+   if (bootverbose) {
+   printf("Found SMCCC version %u.%u\n",
+   SMCCC_VERSION_MAJOR(smccc_version),
+   SMCCC_VERSION_MINOR(smccc_version));
+   }
+}
+SYSINIT(smccc_start, SI_SUB_DRIVERS, SI_ORDER_ANY, smccc_init, NULL);
+
+int32_t
+smccc_arch_features(uint32_t smccc_func_id)
+{
+
+   if (smccc_version == SMCCC_VERSION_1_0)
+   return (PSCI_RETVAL_NOT_SUPPORTED);
+
+   return (psci_call(SMCCC_ARCH_FEATURES, smccc_func_id, 0, 0));
+}
+
+/*
+ * The SMCCC handler for Spectre variant 2: Branch target injection.
+ * (CVE-2017-5715)
+ */
+int
+smccc_arch_workaround_1(void)
+{
+
+   KASSERT(smccc_version != SMCCC_VERSION_1_0,
+   ("SMCCC arch workaround 1 called with an invalid SMCCC interface"));
+   return (psci_call(SMCCC_ARCH_WORKAROUND_1, 0, 0, 0));
+}

Added: head/sys/dev/psci/smccc.h
==
--- /dev/null   

svn commit: r335061 - head/sys/dev/psci

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 15:24:07 2018
New Revision: 335061
URL: https://svnweb.freebsd.org/changeset/base/335061

Log:
  Move psci_call to a header file so we can use it in other files to
  communicate with the firmware.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/psci/psci.c
  head/sys/dev/psci/psci.h

Modified: head/sys/dev/psci/psci.c
==
--- head/sys/dev/psci/psci.cWed Jun 13 14:55:31 2018(r335060)
+++ head/sys/dev/psci/psci.cWed Jun 13 15:24:07 2018(r335061)
@@ -110,14 +110,7 @@ static void psci_shutdown(void *, int);
 static int psci_find_callfn(psci_callfn_t *);
 static int psci_def_callfn(register_t, register_t, register_t, register_t);
 
-static psci_callfn_t psci_callfn = psci_def_callfn;
-
-static inline int
-psci_call(register_t a, register_t b, register_t c, register_t d)
-{
-
-   return (psci_callfn(a, b, c, d));
-}
+psci_callfn_t psci_callfn = psci_def_callfn;
 
 static void
 psci_init(void *dummy)

Modified: head/sys/dev/psci/psci.h
==
--- head/sys/dev/psci/psci.hWed Jun 13 14:55:31 2018(r335060)
+++ head/sys/dev/psci/psci.hWed Jun 13 15:24:07 2018(r335061)
@@ -41,6 +41,14 @@ void psci_reset(void);
 int32_tpsci_features(uint32_t);
 intpsci_get_version(void);
 
+/* Handler to let us call into the PSCI/SMCCC firmware */
+extern psci_callfn_t psci_callfn;
+static inline int
+psci_call(register_t a, register_t b, register_t c, register_t d)
+{
+
+   return (psci_callfn(a, b, c, d));
+}
 /* One of these handlers will be selected during the boot */
 intpsci_hvc_despatch(register_t, register_t, register_t, register_t);
 intpsci_smc_despatch(register_t, register_t, register_t, register_t);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335060 - head/sys/security/audit

2018-06-13 Thread Alan Somers
Author: asomers
Date: Wed Jun 13 14:55:31 2018
New Revision: 335060
URL: https://svnweb.freebsd.org/changeset/base/335060

Log:
  audit(4): fix the definition of ARG_TERMID_ADDR
  
  Due to a copy/paste error in r168688, ARG_TERMID_ADDR has the same
  definition as ARG_SADDRUNIX.  Fix it.
  
  The header change, while publicly visible, is guarded by #ifdef KERNEL, and
  I can't find any kmod ports that use it.  So I'm not bumping
  __FreeBSD_version.
  
  PR:   228820
  Submitted by: aniketp
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15702

Modified:
  head/sys/security/audit/audit_private.h

Modified: head/sys/security/audit/audit_private.h
==
--- head/sys/security/audit/audit_private.h Wed Jun 13 13:41:23 2018
(r335059)
+++ head/sys/security/audit/audit_private.h Wed Jun 13 14:55:31 2018
(r335060)
@@ -275,7 +275,7 @@ struct audit_record {
 #defineARG_SADDRINET   0x0010ULL
 #defineARG_SADDRINET6  0x0020ULL
 #defineARG_SADDRUNIX   0x0040ULL
-#defineARG_TERMID_ADDR 0x0040ULL
+#defineARG_TERMID_ADDR 0x0080ULL
 #defineARG_UNUSED2 0x0100ULL
 #defineARG_UPATH1  0x0200ULL
 #defineARG_UPATH2  0x0400ULL
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335059 - in stable/11: usr.bin/wall usr.sbin/syslogd

2018-06-13 Thread Rodney W. Grimes
> Hi Rodney,
> 
> 2018-06-13 15:57 GMT+02:00 Rodney W. Grimes :
> >> Modified:
> >>   stable/11/usr.bin/wall/ttymsg.c
> >>   stable/11/usr.bin/wall/ttymsg.h
> >
> > I see no mention of any changes to wall in the commit,
> > was this intentional?  The changes don't seem to be
> > related to syslogd directly.
> 
> Good question. syslogd(8) reuses some code from wall(8) to write
> syslog messages to terminals if configured to do so. In one of the RFC
> 5424 support commits, I had to adjust this shared code slightly
> (increase a limit). As the changes to wall(8) were committed together
> with the syslogd(8) changes, I also had to merge them back in one go.
> 
> In other words, this is intentional. :-)

Thank you for the details.

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334046 - head/tools/tools/intel-ucode-split

2018-06-13 Thread Mark Johnston
On Wed, Jun 13, 2018 at 01:46:34AM +0200, Oliver Pinter wrote:
> On Wednesday, June 13, 2018, Ed Maste  wrote:
> 
> > On Tue, 12 Jun 2018 at 18:17, Sean Bruno  wrote:
> > >
> > > On 06/12/18 16:05, Oliver Pinter wrote:
> > > > On 5/22/18, Ed Maste  wrote:
> > > >> Author: emaste
> > > >> Date: Tue May 22 14:35:33 2018
> > > >> New Revision: 334046
> > > >> URL: https://svnweb.freebsd.org/changeset/base/334046
> > > >>
> > > >> Log:
> > > >>   intel-ucode-split: add -n flag to skip creating output files
> > > >>
> > > >>   Sponsored by:  The FreeBSD Foundation
> > > >>
> > > >> Modified:
> > > >>   head/tools/tools/intel-ucode-split/intel-ucode-split.c
> > > >
> > > > Hi!
> > > >
> > > > Could you please MFC the intel-ucode-split related commits to
> > 11-STABLE?
> > > >
> > > > Thanks,
> > > > op
> > >
> > > Do you need it in base for some reason?  This code is already in the
> > > devcpu-data port and is used when the port is built.  Its not needed for
> > > anything AFAIK.
> >
> > Indeed, the real use in FreeBSD is via the devcpu-data port; I
> > committed it to src/tools/ for collaboration and testing. I'll merge
> > it to stable/11 if it will be useful for someone, but am curious about
> > the use case.
> >
> 
> 
> I'm considering to write an in kernel microcode update facility, based on
> firmware(9), and in first idea it would be nice during the generation of
> firmware modules.

FWIW, I'm working on this for 12.0 and was planning to describe my
proposal on -arch in the next couple of weeks.  For my purposes at
least, firmware(9) isn't suitable.  We'd like to ensure that updates are
applied before the kernel does CPU identification, and that happens
quite early during boot.  This places some constraints on the
implementation which exclude firmware(9).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335059 - in stable/11: usr.bin/wall usr.sbin/syslogd

2018-06-13 Thread Ed Schouten
Hi Rodney,

2018-06-13 15:57 GMT+02:00 Rodney W. Grimes :
>> Modified:
>>   stable/11/usr.bin/wall/ttymsg.c
>>   stable/11/usr.bin/wall/ttymsg.h
>
> I see no mention of any changes to wall in the commit,
> was this intentional?  The changes don't seem to be
> related to syslogd directly.

Good question. syslogd(8) reuses some code from wall(8) to write
syslog messages to terminals if configured to do so. In one of the RFC
5424 support commits, I had to adjust this shared code slightly
(increase a limit). As the changes to wall(8) were committed together
with the syslogd(8) changes, I also had to merge them back in one go.

In other words, this is intentional. :-)

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335059 - in stable/11: usr.bin/wall usr.sbin/syslogd

2018-06-13 Thread Rodney W. Grimes
> Author: ed
> Date: Wed Jun 13 13:41:23 2018
> New Revision: 335059
> URL: https://svnweb.freebsd.org/changeset/base/335059
> 
> Log:
>   MFC r309925, r309931, r309933, r310035, r310278, r310310, r310311,
>   r310323, r310349, r310350, r310351, r310352, r310383, r310384,
>   r310385, r310386, r310393, r310453, r310456, r310494, r310504,
>   r310528, r310890, r310893, r310974, r311918, r312921, r313357,
>   r314563, r314585, r314642, r315322, r315618, r315620, r315622,
>   r315643, r316951, r316973, r326338, r326339, r326573, r331270,
>   r332099, r332110, r332111, r332118, r332165, r332510 and r332511.
>   
>   This commit brings syslogd(8) in sync with the copy in HEAD. The key
>   improvement of this change is that it adds support for RFC 5424 log
>   ingestion and exposition (enabled by passing in -O rfc5424). This allows
>   for saner logging in environments with multiple time zones.
>   
>   The list of changes to merge back were obtained by running:
>   
>   svn mergeinfo --show-revs eligible \
>   ^/head/usr.sbin/syslogd ^/stable/11/usr.sbin/syslogd
>   
>   Of the commits listed, r314436, r325188 and r326025 were excluded, as
>   they affect a significant number of unrelated files (SPDX and 4-clause
>   license renumbering). Due to the large number of directly committed

Thank you very much for avoiding the SPDX area!  I have pending
clean up in stable/11 around those.


>   changes on this branch, I had no choice but to perform the merge as
>   follows:
>   
>   svn merge --accept=theirs-full -c  ^/head .
>   
>   This would, however, cause some unrelated changes, such as undoing the
>   r56 (MFC of r332877) and still adding the SPDX tag to syslogd.c.
>   These have been reverted manually.
>   
>   Requested by:   Dave Cottlehuber
>   Thanks to:  dim@ for sharing his insight on hackers@
> 
> Modified:
>   stable/11/usr.bin/wall/ttymsg.c
>   stable/11/usr.bin/wall/ttymsg.h

I see no mention of any changes to wall in the commit,
was this intentional?  The changes don't seem to be
related to syslogd directly.

>   stable/11/usr.sbin/syslogd/Makefile
>   stable/11/usr.sbin/syslogd/syslogd.8
>   stable/11/usr.sbin/syslogd/syslogd.c
> Directory Properties:
>   stable/11/   (props changed)
> 
> Modified: stable/11/usr.bin/wall/ttymsg.c
> ==
> --- stable/11/usr.bin/wall/ttymsg.c   Wed Jun 13 13:15:04 2018
> (r335058)
> +++ stable/11/usr.bin/wall/ttymsg.c   Wed Jun 13 13:41:23 2018
> (r335059)
> @@ -59,7 +59,7 @@ static const char sccsid[] = "@(#)ttymsg.c  8.2 (Berkel
>  const char *
>  ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout)
>  {
> - struct iovec localiov[7];
> + struct iovec localiov[TTYMSG_IOV_MAX];
>   ssize_t left, wret;
>   int cnt, fd;
>   char device[MAXNAMLEN] = _PATH_DEV;
> 
> Modified: stable/11/usr.bin/wall/ttymsg.h
> ==
> --- stable/11/usr.bin/wall/ttymsg.h   Wed Jun 13 13:15:04 2018
> (r335058)
> +++ stable/11/usr.bin/wall/ttymsg.h   Wed Jun 13 13:41:23 2018
> (r335059)
> @@ -1,3 +1,5 @@
>  /* $FreeBSD$ */
>  
> +#define  TTYMSG_IOV_MAX  32
> +
>  const char   *ttymsg(struct iovec *, int, const char *, int);
> 
> Modified: stable/11/usr.sbin/syslogd/Makefile
> ==
> --- stable/11/usr.sbin/syslogd/Makefile   Wed Jun 13 13:15:04 2018
> (r335058)
> +++ stable/11/usr.sbin/syslogd/Makefile   Wed Jun 13 13:41:23 2018
> (r335059)
> @@ -11,8 +11,9 @@ SRCS=   syslogd.c ttymsg.c
>  
>  LIBADD=  util
>  
> -WARNS?= 3
> -
> +.if ${MK_INET_SUPPORT} != "no"
> +CFLAGS+= -DINET
> +.endif
>  .if ${MK_INET6_SUPPORT} != "no"
>  CFLAGS+= -DINET6
>  .endif
> 
> Modified: stable/11/usr.sbin/syslogd/syslogd.8
> ==
> --- stable/11/usr.sbin/syslogd/syslogd.8  Wed Jun 13 13:15:04 2018
> (r335058)
> +++ stable/11/usr.sbin/syslogd/syslogd.8  Wed Jun 13 13:41:23 2018
> (r335059)
> @@ -28,7 +28,7 @@
>  .\" @(#)syslogd.88.1 (Berkeley) 6/6/93
>  .\" $FreeBSD$
>  .\"
> -.Dd June 16, 2015
> +.Dd April 15, 2018
>  .Dt SYSLOGD 8
>  .Os
>  .Sh NAME
> @@ -36,18 +36,22 @@
>  .Nd log systems messages
>  .Sh SYNOPSIS
>  .Nm
> -.Op Fl 468ACcdFkNnosTuv
> +.Op Fl 468ACcdFHkNnosTuv
>  .Op Fl a Ar allowed_peer
>  .Op Fl b Ar bind_address
>  .Op Fl f Ar config_file
> -.Op Fl l Oo Ar mode : Oc Ns Ar path
> +.Op Fl l Oo Ar mode Ns \&: Oc Ns Ar path
>  .Op Fl m Ar mark_interval
> +.Op Fl O Ar format
>  .Op Fl P Ar pid_file
>  .Op Fl p Ar log_socket
> +.Op Fl S Ar logpriv_socket
>  .Sh DESCRIPTION
>  The
>  .Nm
> -utility reads and logs messages to the system console, log files, other
> +utility reads and logs messages to the system console,
> +log 

svn commit: r335059 - in stable/11: usr.bin/wall usr.sbin/syslogd

2018-06-13 Thread Ed Schouten
Author: ed
Date: Wed Jun 13 13:41:23 2018
New Revision: 335059
URL: https://svnweb.freebsd.org/changeset/base/335059

Log:
  MFC r309925, r309931, r309933, r310035, r310278, r310310, r310311,
  r310323, r310349, r310350, r310351, r310352, r310383, r310384,
  r310385, r310386, r310393, r310453, r310456, r310494, r310504,
  r310528, r310890, r310893, r310974, r311918, r312921, r313357,
  r314563, r314585, r314642, r315322, r315618, r315620, r315622,
  r315643, r316951, r316973, r326338, r326339, r326573, r331270,
  r332099, r332110, r332111, r332118, r332165, r332510 and r332511.
  
  This commit brings syslogd(8) in sync with the copy in HEAD. The key
  improvement of this change is that it adds support for RFC 5424 log
  ingestion and exposition (enabled by passing in -O rfc5424). This allows
  for saner logging in environments with multiple time zones.
  
  The list of changes to merge back were obtained by running:
  
  svn mergeinfo --show-revs eligible \
  ^/head/usr.sbin/syslogd ^/stable/11/usr.sbin/syslogd
  
  Of the commits listed, r314436, r325188 and r326025 were excluded, as
  they affect a significant number of unrelated files (SPDX and 4-clause
  license renumbering). Due to the large number of directly committed
  changes on this branch, I had no choice but to perform the merge as
  follows:
  
  svn merge --accept=theirs-full -c  ^/head .
  
  This would, however, cause some unrelated changes, such as undoing the
  r56 (MFC of r332877) and still adding the SPDX tag to syslogd.c.
  These have been reverted manually.
  
  Requested by: Dave Cottlehuber
  Thanks to:dim@ for sharing his insight on hackers@

Modified:
  stable/11/usr.bin/wall/ttymsg.c
  stable/11/usr.bin/wall/ttymsg.h
  stable/11/usr.sbin/syslogd/Makefile
  stable/11/usr.sbin/syslogd/syslogd.8
  stable/11/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/wall/ttymsg.c
==
--- stable/11/usr.bin/wall/ttymsg.c Wed Jun 13 13:15:04 2018
(r335058)
+++ stable/11/usr.bin/wall/ttymsg.c Wed Jun 13 13:41:23 2018
(r335059)
@@ -59,7 +59,7 @@ static const char sccsid[] = "@(#)ttymsg.c8.2 (Berkel
 const char *
 ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout)
 {
-   struct iovec localiov[7];
+   struct iovec localiov[TTYMSG_IOV_MAX];
ssize_t left, wret;
int cnt, fd;
char device[MAXNAMLEN] = _PATH_DEV;

Modified: stable/11/usr.bin/wall/ttymsg.h
==
--- stable/11/usr.bin/wall/ttymsg.h Wed Jun 13 13:15:04 2018
(r335058)
+++ stable/11/usr.bin/wall/ttymsg.h Wed Jun 13 13:41:23 2018
(r335059)
@@ -1,3 +1,5 @@
 /* $FreeBSD$ */
 
+#defineTTYMSG_IOV_MAX  32
+
 const char *ttymsg(struct iovec *, int, const char *, int);

Modified: stable/11/usr.sbin/syslogd/Makefile
==
--- stable/11/usr.sbin/syslogd/Makefile Wed Jun 13 13:15:04 2018
(r335058)
+++ stable/11/usr.sbin/syslogd/Makefile Wed Jun 13 13:41:23 2018
(r335059)
@@ -11,8 +11,9 @@ SRCS= syslogd.c ttymsg.c
 
 LIBADD=util
 
-WARNS?= 3
-
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+= -DINET
+.endif
 .if ${MK_INET6_SUPPORT} != "no"
 CFLAGS+= -DINET6
 .endif

Modified: stable/11/usr.sbin/syslogd/syslogd.8
==
--- stable/11/usr.sbin/syslogd/syslogd.8Wed Jun 13 13:15:04 2018
(r335058)
+++ stable/11/usr.sbin/syslogd/syslogd.8Wed Jun 13 13:41:23 2018
(r335059)
@@ -28,7 +28,7 @@
 .\" @(#)syslogd.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd June 16, 2015
+.Dd April 15, 2018
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -36,18 +36,22 @@
 .Nd log systems messages
 .Sh SYNOPSIS
 .Nm
-.Op Fl 468ACcdFkNnosTuv
+.Op Fl 468ACcdFHkNnosTuv
 .Op Fl a Ar allowed_peer
 .Op Fl b Ar bind_address
 .Op Fl f Ar config_file
-.Op Fl l Oo Ar mode : Oc Ns Ar path
+.Op Fl l Oo Ar mode Ns \&: Oc Ns Ar path
 .Op Fl m Ar mark_interval
+.Op Fl O Ar format
 .Op Fl P Ar pid_file
 .Op Fl p Ar log_socket
+.Op Fl S Ar logpriv_socket
 .Sh DESCRIPTION
 The
 .Nm
-utility reads and logs messages to the system console, log files, other
+utility reads and logs messages to the system console,
+log files,
+other
 machines and/or users as specified by its configuration file.
 .Pp
 The options are as follows:
@@ -63,7 +67,8 @@ to use IPv6 addresses only.
 .It Fl 8
 Tells
 .Nm
-not to interfere with 8-bit data.  Normally
+not to interfere with 8-bit data.
+Normally
 .Nm
 will replace C1 control characters
 .Pq ISO 8859 and Unicode characters
@@ -98,21 +103,23 @@ options may be specified.
 The
 .Ar allowed_peer
 option may be any of the following:
-.Bl -tag -width "ipaddr/masklen[:service]XX"
+.Bl 

Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Warner Losh
On Wed, Jun 13, 2018 at 6:39 AM, Edward Napierala  wrote:

> 2018-06-13 12:43 GMT+01:00 Emmanuel Vadot :
>
>> On 2018-06-12 18:45, Edward Tomasz Napierala wrote:
>>
>>> Author: trasz
>>> Date: Tue Jun 12 16:45:52 2018
>>> New Revision: 335004
>>> URL: https://svnweb.freebsd.org/changeset/base/335004
>>>
>>> Log:
>>>   Enable USB OTG serial terminal on ARM SD card images.  This configures
>>>   the system to make use of USB device mode / USB OTG to provide a
>>> "virtual
>>>   serial port" on release images.
>>>
>>>   Reviewed by:  gjb@
>>>   MFC after:2 weeks
>>>   Relnotes: yes
>>>   Sponsored by: The FreeBSD Foundation
>>>   Differential Revision:https://reviews.freebsd.org/D15602
>>>
>>> Modified:
>>>   head/release/tools/arm.subr
>>>
>>> Modified: head/release/tools/arm.subr
>>> 
>>> ==
>>> --- head/release/tools/arm.subr Tue Jun 12 16:44:13 2018(r335003)
>>> +++ head/release/tools/arm.subr Tue Jun 12 16:45:52 2018(r335004)
>>> @@ -92,6 +92,41 @@ arm_create_user() {
>>> return 0
>>>  }
>>>
>>> +arm_setup_usb_otg() {
>>> +   # Set up virtual serial port over USB OTG / device mode.
>>> +   echo >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '# Required for USB OTG virtual serial port.' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo 'notify 100 {' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "system"  "DEVFS";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "subsystem"   "CDEV";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "type""CREATE";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "cdev""ttyU[0-9]+";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  action "/sbin/init q";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '};' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>>
>>
>>  This will be wiped after the first update, better create
>> /etc/devd/otg_serial.conf
>>
>
> Thanks, I'll look into that.
>
>
>> +   echo '# USB OTG virtual serial port' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>> +   echo 'ttyU0 "/usr/libexec/getty 3wire"  vt100
>>>  onifconsole  secure' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>> +   echo 'ttyU1 "/usr/libexec/getty 3wire"  vt100
>>>  onifconsole  secure' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>>
>>
>>  If I have no OTG port and a usb<->uart plugged into my board that will
>> give weird result no ?
>>
>
> No, because that port won't be marked as console.  This only applies
> to the "virtual" OTG serial ports.
>

Right, and console is an overloaded term.  Here it just means 'tty marked
by the kernel that gets a getty started on it automatically after it shows
up' not 'the device that gets all the kernel I/O.'


> +   echo '# Configure USB OTG; see usb_template(4).' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>> +   echo 'hw.usb.template=3' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>> +   echo 'umodem_load="YES"' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>>
>>
>>  I'm not a big fan of always enabling this functionality. Do you have a
>> board that have no uart but an otg port ?
>>
>
> I don't, but this makes it possible to use OTG-enabled boards without
> using the console cable - having to check the pinouts, making sure the
> voltage
> is right etc.  Do you see some problems this might cause?
>

I don't, but I still have the same reservations at the name overloading...

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335058 - in stable/11: etc/rc.d sbin/pfctl

2018-06-13 Thread Kristof Provost
Author: kp
Date: Wed Jun 13 13:15:04 2018
New Revision: 335058
URL: https://svnweb.freebsd.org/changeset/base/335058

Log:
  MFC r334726:
  
  pf: Return non-zero from 'status' if pf is not enabled
  
  In the pf rc.d script the output of `/etc/rc.d/pf status` or `/etc/rc.d/pf
  onestatus` always provided an exit status of zero. This made it fiddly to
  programmatically determine if pf was running or not.
  
  Return a non-zero status if the pf module is not loaded, extend pfctl to have
  an option to return an error status if pf is not enabled.
  
  PR:   228632
  Submitted by: James Park-Watt 

Modified:
  stable/11/etc/rc.d/pf
  stable/11/sbin/pfctl/pfctl.8
  stable/11/sbin/pfctl/pfctl.c
  stable/11/sbin/pfctl/pfctl_parser.c
  stable/11/sbin/pfctl/pfctl_parser.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/rc.d/pf
==
--- stable/11/etc/rc.d/pf   Wed Jun 13 12:44:45 2018(r335057)
+++ stable/11/etc/rc.d/pf   Wed Jun 13 13:15:04 2018(r335058)
@@ -66,8 +66,10 @@ pf_status()
 {
if ! [ -c /dev/pf ] ; then
echo "pf.ko is not loaded"
+   return 1
else
$pf_program -s info
+   $pf_program -s Running >/dev/null
fi
 }
 

Modified: stable/11/sbin/pfctl/pfctl.8
==
--- stable/11/sbin/pfctl/pfctl.8Wed Jun 13 12:44:45 2018
(r335057)
+++ stable/11/sbin/pfctl/pfctl.8Wed Jun 13 13:15:04 2018
(r335058)
@@ -412,6 +412,8 @@ Show filter information (statistics and counters).
 When used together with
 .Fl v ,
 source tracking statistics are also shown.
+.It Fl s Cm Running
+Show the running status and provide a non-zero exit status when disabled.
 .It Fl s Cm labels
 Show per-rule statistics (label, evaluations, packets total, bytes total,
 packets in, bytes in, packets out, bytes out, state creations) of

Modified: stable/11/sbin/pfctl/pfctl.c
==
--- stable/11/sbin/pfctl/pfctl.cWed Jun 13 12:44:45 2018
(r335057)
+++ stable/11/sbin/pfctl/pfctl.cWed Jun 13 13:15:04 2018
(r335058)
@@ -96,6 +96,7 @@ intpfctl_show_nat(int, int, char *);
 int pfctl_show_src_nodes(int, int);
 int pfctl_show_states(int, const char *, int);
 int pfctl_show_status(int, int);
+int pfctl_show_running(int);
 int pfctl_show_timeouts(int, int);
 int pfctl_show_limits(int, int);
 voidpfctl_debug(int, u_int32_t, int);
@@ -217,7 +218,7 @@ static const char *clearopt_list[] = {
 static const char *showopt_list[] = {
"nat", "queue", "rules", "Anchors", "Sources", "states", "info",
"Interfaces", "labels", "timeouts", "memory", "Tables", "osfp",
-   "all", NULL
+   "Running", "all", NULL
 };
 
 static const char *tblcmdopt_list[] = {
@@ -1155,6 +1156,20 @@ pfctl_show_status(int dev, int opts)
 }
 
 int
+pfctl_show_running(int dev)
+{
+   struct pf_status status;
+
+   if (ioctl(dev, DIOCGETSTATUS, )) {
+   warn("DIOCGETSTATUS");
+   return (-1);
+   }
+
+   print_running();
+   return (!status.running);
+}
+
+int
 pfctl_show_timeouts(int dev, int opts)
 {
struct pfioc_tm pt;
@@ -2271,6 +2286,9 @@ main(int argc, char *argv[])
break;
case 'i':
pfctl_show_status(dev, opts);
+   break;
+   case 'R':
+   error = pfctl_show_running(dev);
break;
case 't':
pfctl_show_timeouts(dev, opts);

Modified: stable/11/sbin/pfctl/pfctl_parser.c
==
--- stable/11/sbin/pfctl/pfctl_parser.c Wed Jun 13 12:44:45 2018
(r335057)
+++ stable/11/sbin/pfctl/pfctl_parser.c Wed Jun 13 13:15:04 2018
(r335058)
@@ -615,6 +615,12 @@ print_status(struct pf_status *s, int opts)
 }
 
 void
+print_running(struct pf_status *status)
+{
+   printf("%s\n", status->running ? "Enabled" : "Disabled");
+}
+
+void
 print_src_node(struct pf_src_node *sn, int opts)
 {
struct pf_addr_wrap aw;

Modified: stable/11/sbin/pfctl/pfctl_parser.h
==
--- stable/11/sbin/pfctl/pfctl_parser.h Wed Jun 13 12:44:45 2018
(r335057)
+++ stable/11/sbin/pfctl/pfctl_parser.h Wed Jun 13 13:15:04 2018
(r335058)
@@ -257,6 +257,7 @@ voidprint_src_node(struct pf_src_node *, int);
 void   print_rule(struct pf_rule *, const char *, int, int);
 void   print_tabledef(const char *, int, int, struct node_tinithead *);
 void   print_status(struct pf_status *, int);
+void   print_running(struct pf_status *);
 
 inteval_pfaltq(struct 

svn commit: r335057 - head/sys/compat/linux

2018-06-13 Thread Bruce Evans
Author: bde
Date: Wed Jun 13 12:44:45 2018
New Revision: 335057
URL: https://svnweb.freebsd.org/changeset/base/335057

Log:
  Oops, r335053 had an old version of the comment about 16-bit linux dev_t
  translation.

Modified:
  head/sys/compat/linux/linux_stats.c

Modified: head/sys/compat/linux/linux_stats.c
==
--- head/sys/compat/linux/linux_stats.c Wed Jun 13 12:33:47 2018
(r335056)
+++ head/sys/compat/linux/linux_stats.c Wed Jun 13 12:44:45 2018
(r335057)
@@ -130,18 +130,20 @@ translate_fd_major_minor(struct thread *td, int fd, st
 
 /*
  * l_dev_t has the same encoding as dev_t in the latter's low 16 bits, so
- * don't bother going through major() and minor().  Keep doing blind
- * truncation, as for other fields.  The previous version didn't even do
- * blind truncation after dev_t was expanded to 64 bits.  It failed to
- * mask out bits 8-15 in minor().  These bits can only be nonzero in th
- * 64-bit version.
+ * truncation of a dev_t to 16 bits gives the same result as unpacking
+ * using major() and minor() and repacking in the l_dev_t format.  This
+ * detail is hidden in dev_to_ldev().  Overflow in conversions of dev_t's
+ * are not checked for, as for other fields.
  *
- * This is only used for st_dev.  st_dev is for the mounted-on device so
- * it can't be a device that needs very special translation.  The translation
- * of blind truncation is done here.  st_rdev is supposed to be specially
- * translated in callers, with the blind truncation done there too and
- * st_rdev in the native struct state abused to hold the linux st_rdev.
- * Callers do the last step using an open-coded Linux makedev().
+ * dev_to_ldev() is only used for translating st_dev.  When we convert
+ * st_rdev for copying it out, it isn't really a dev_t, but has already
+ * been translated to an l_dev_t in a nontrivial way.  Translating it
+ * again would be illogical but would have no effect since the low 16
+ * bits have the same encoding.
+ *
+ * The nontrivial translation for st_rdev renumbers some devices, but not
+ * ones that can be mounted on, so it is consistent with the translation
+ * for st_dev except when the renumbering or truncation causes conflicts.
  */
 #definedev_to_ldev(d)  ((uint16_t)(d))
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Edward Napierala
2018-06-13 12:43 GMT+01:00 Emmanuel Vadot :

> On 2018-06-12 18:45, Edward Tomasz Napierala wrote:
>
>> Author: trasz
>> Date: Tue Jun 12 16:45:52 2018
>> New Revision: 335004
>> URL: https://svnweb.freebsd.org/changeset/base/335004
>>
>> Log:
>>   Enable USB OTG serial terminal on ARM SD card images.  This configures
>>   the system to make use of USB device mode / USB OTG to provide a
>> "virtual
>>   serial port" on release images.
>>
>>   Reviewed by:  gjb@
>>   MFC after:2 weeks
>>   Relnotes: yes
>>   Sponsored by: The FreeBSD Foundation
>>   Differential Revision:https://reviews.freebsd.org/D15602
>>
>> Modified:
>>   head/release/tools/arm.subr
>>
>> Modified: head/release/tools/arm.subr
>> 
>> ==
>> --- head/release/tools/arm.subr Tue Jun 12 16:44:13 2018(r335003)
>> +++ head/release/tools/arm.subr Tue Jun 12 16:45:52 2018(r335004)
>> @@ -92,6 +92,41 @@ arm_create_user() {
>> return 0
>>  }
>>
>> +arm_setup_usb_otg() {
>> +   # Set up virtual serial port over USB OTG / device mode.
>> +   echo >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '# Required for USB OTG virtual serial port.' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo 'notify 100 {' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "system"  "DEVFS";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "subsystem"   "CDEV";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "type""CREATE";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "cdev""ttyU[0-9]+";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  action "/sbin/init q";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '};' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>
>
>  This will be wiped after the first update, better create
> /etc/devd/otg_serial.conf
>

Thanks, I'll look into that.


> +   echo '# USB OTG virtual serial port' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>> +   echo 'ttyU0 "/usr/libexec/getty 3wire"  vt100
>>  onifconsole  secure' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>> +   echo 'ttyU1 "/usr/libexec/getty 3wire"  vt100
>>  onifconsole  secure' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>
>
>  If I have no OTG port and a usb<->uart plugged into my board that will
> give weird result no ?
>

No, because that port won't be marked as console.  This only applies
to the "virtual" OTG serial ports.


> +   echo '# Configure USB OTG; see usb_template(4).' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>> +   echo 'hw.usb.template=3' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>> +   echo 'umodem_load="YES"' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>
>
>  I'm not a big fan of always enabling this functionality. Do you have a
> board that have no uart but an otg port ?
>

I don't, but this makes it possible to use OTG-enabled boards without
using the console cable - having to check the pinouts, making sure the
voltage
is right etc.  Do you see some problems this might cause?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335056 - head/sys/dev/psci

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 12:33:47 2018
New Revision: 335056
URL: https://svnweb.freebsd.org/changeset/base/335056

Log:
  Add a handler for the PSCI_FEATURES function. This needs PSCI 1.0, so
  check for this, returning an error if the version is too old.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/psci/psci.c
  head/sys/dev/psci/psci.h

Modified: head/sys/dev/psci/psci.c
==
--- head/sys/dev/psci/psci.cWed Jun 13 12:32:04 2018(r335055)
+++ head/sys/dev/psci/psci.cWed Jun 13 12:33:47 2018(r335056)
@@ -414,6 +414,20 @@ psci_find_callfn(psci_callfn_t *callfn)
return (PSCI_RETVAL_SUCCESS);
 }
 
+int32_t
+psci_features(uint32_t psci_func_id)
+{
+
+   if (psci_softc == NULL)
+   return (PSCI_RETVAL_NOT_SUPPORTED);
+
+   /* The feature flags were added to PSCI 1.0 */
+   if (PSCI_VER_MAJOR(psci_softc->psci_version) < 1)
+   return (PSCI_RETVAL_NOT_SUPPORTED);
+
+   return (psci_call(PSCI_FNID_FEATURES, psci_func_id, 0, 0));
+}
+
 int
 psci_cpu_on(unsigned long cpu, unsigned long entry, unsigned long context_id)
 {

Modified: head/sys/dev/psci/psci.h
==
--- head/sys/dev/psci/psci.hWed Jun 13 12:32:04 2018(r335055)
+++ head/sys/dev/psci/psci.hWed Jun 13 12:33:47 2018(r335056)
@@ -36,12 +36,15 @@ typedef int (*psci_callfn_t)(register_t, register_t, r
 
 extern int psci_present;
 
-void   psci_reset(void);
 intpsci_cpu_on(unsigned long, unsigned long, unsigned long);
+void   psci_reset(void);
+int32_tpsci_features(uint32_t);
+intpsci_get_version(void);
+
+/* One of these handlers will be selected during the boot */
 intpsci_hvc_despatch(register_t, register_t, register_t, register_t);
 intpsci_smc_despatch(register_t, register_t, register_t, register_t);
 
-intpsci_get_version(void);
 
 /*
  * PSCI return codes.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335055 - head/sys/dev/psci

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 12:32:04 2018
New Revision: 335055
URL: https://svnweb.freebsd.org/changeset/base/335055

Log:
  Find and cache the PSCI version on driver attach.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/psci/psci.c

Modified: head/sys/dev/psci/psci.c
==
--- head/sys/dev/psci/psci.cWed Jun 13 12:26:37 2018(r335054)
+++ head/sys/dev/psci/psci.cWed Jun 13 12:32:04 2018(r335055)
@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
 struct psci_softc {
device_tdev;
 
+   uint32_tpsci_version;
uint32_tpsci_fnids[PSCI_FN_MAX];
 };
 
@@ -493,6 +494,7 @@ psci_v0_1_init(device_t dev)
sc->psci_fnids[PSCI_FN_MIGRATE] = psci_fnid;
}
 
+   sc->psci_version = (0 << 16) | 1;
if (bootverbose)
device_printf(dev, "PSCI version 0.1 available\n");
 
@@ -523,6 +525,7 @@ psci_v0_2_init(device_t dev)
if (version == PSCI_RETVAL_NOT_SUPPORTED)
return (1);
 
+   sc->psci_version = version;
if ((PSCI_VER_MAJOR(version) == 0 && PSCI_VER_MINOR(version) == 2) ||
PSCI_VER_MAJOR(version) == 1) {
if (bootverbose)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335054 - head/sys/dev/psci

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 12:26:37 2018
New Revision: 335054
URL: https://svnweb.freebsd.org/changeset/base/335054

Log:
  Add the PSCI_FEATURES function ID. This is found in PSCI 1.0 and is used
  to query if a given function is implemented and its features.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/psci/psci.h

Modified: head/sys/dev/psci/psci.h
==
--- head/sys/dev/psci/psci.hWed Jun 13 12:22:00 2018(r335053)
+++ head/sys/dev/psci/psci.hWed Jun 13 12:26:37 2018(r335054)
@@ -74,6 +74,7 @@ int   psci_get_version(void);
 #definePSCI_FNID_MIGRATE_INFO_UP_CPU   0xc407
 #definePSCI_FNID_SYSTEM_OFF0x8408
 #definePSCI_FNID_SYSTEM_RESET  0x8409
+#definePSCI_FNID_FEATURES  0x840a
 #else
 #definePSCI_FNID_VERSION   0x8400
 #definePSCI_FNID_CPU_SUSPEND   0x8401
@@ -85,6 +86,7 @@ int   psci_get_version(void);
 #definePSCI_FNID_MIGRATE_INFO_UP_CPU   0x8407
 #definePSCI_FNID_SYSTEM_OFF0x8408
 #definePSCI_FNID_SYSTEM_RESET  0x8409
+#definePSCI_FNID_FEATURES  0x840a
 #endif
 
 #definePSCI_VER_MAJOR(v)   (((v) >> 16) & 0xFF)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335053 - in head/sys: compat/freebsd32 compat/linux fs/nfsclient kern sys

2018-06-13 Thread Bruce Evans
Author: bde
Date: Wed Jun 13 12:22:00 2018
New Revision: 335053
URL: https://svnweb.freebsd.org/changeset/base/335053

Log:
  Fix the encoding of major and minor numbers in 64-bit dev_t by restoring
  the old encodings for the lower 16 and 32 bits and only using the
  higher 32 bits for unusually large major and minor numbers.  This
  change breaks compatibility with the previous encoding (which was only
  used in -current).
  
  Fix truncation to (essentially) 16-bit dev_t in newnfs v3.
  
  Any encoding of device numbers gives an ABI, so it can't be changed
  without translations for compatibility.  Extra bits give the much
  larger complication that the translations need to compress into fewer
  bits.  Fortunately, more than 32 bits are rarely needed, so
  compression is rarely needed except for 16-bit linux dev_t where it
  was always needed but never done.
  
  The previous encoding moved the major number into the top 32 bits.
  Almost no translation code handled this, so the major number was blindly
  truncated away in most 32-bit encodings.  E.g., for ffs, mknod(8) with
  major = 1 and minor = 2 gave dev_t = 0x1002; ffs cannot represent
  this and blindly truncated it to 2.  But if this mknod was run on any
  released version of FreeBSD, it gives dev_t = 0x102.  ffs can represent
  this, but in the previous encoding it was not decoded, giving major = 0,
  minor = 0x102.
  
  The presence of bugs was most obvious for exporting dev_t's from an
  old system to -current, since bugs in newnfs augment them.  I fixed
  oldnfs to support 32-bit dev_t in 1996 (r16634), but this regressed
  to 16-bit dev_t in newnfs, first to the old 16-bit encoding and then
  further in -current.  E.g., old ad0 with major = 234, minor = 0x10002
  had the correct (major, minor) number on the wire, but newnfs truncated
  this to (234, 2) and then the previous encoding shifted the major
  number into oblivion as seen by ffs or old applications.
  
  I first tried to fix this by translating on every ABI/API boundary, but
  there are too many boundaries and too many sloppy translations by blind
  truncation.  So use the old encoding for the low 32 bits so that sloppy
  translations work no worse than before provided the high 32 bits are
  not set.  Add some error checking for when bits are lost.  Keep not
  doing any error checking for translations for almost everything in
  compat/linux.
  
  compat/freebsd32/freebsd32_misc.c:
  Optionally check for losing bits after possibly-truncating assignments as
  before.
  
  compat/linux/linux_stats.c:
  Depend on the representation being compatible with Linux's (or just with
  itself for local use) and spell some of the translations as assignments in
  a macro that hides the details.
  
  fs/nfsclient/nfs_clcomsubs.c:
  Essentially the same fix as in 1996, except there is now no possible
  truncation in makedev() itself.  Also fix nearby style bugs.
  
  kern/vfs_syscalls.c:
  As for freebsd32.  Also update the sysctl description to include file
  numbers, and change it to describe device ids as device numbers.
  
  sys/types.h:
  Use inline functions (wrapped by macros) since the expressions are now
  a bit too complicated for plain macros.  Describe the encoding and
  some of the reasons for it.  16-bit compatibility didn't leave many
  reasonable choices for the 32-bit encoding, and 32-bit compatibility
  doesn't leave many reasonable choices for the 64-bit encoding.  My
  choice is to put the 8 new minor bits in the low 8 bits of the top 32
  bits.  This minimizes discontiguities.
  
  Reviewed by:  kib (except for rewrite of the comment in linux_stats.c)

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/linux/linux_stats.c
  head/sys/fs/nfsclient/nfs_clcomsubs.c
  head/sys/kern/vfs_syscalls.c
  head/sys/sys/types.h

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Wed Jun 13 12:17:11 2018
(r335052)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Wed Jun 13 12:22:00 2018
(r335053)
@@ -2127,11 +2127,27 @@ freebsd11_cvtstat32(struct stat *in, struct freebsd11_
break;
}
}
-   CP(*in, *out, st_dev);
+   out->st_dev = in->st_dev;
+   if (out->st_dev != in->st_dev) {
+   switch (ino64_trunc_error) {
+   default:
+   break;
+   case 1:
+   return (EOVERFLOW);
+   }
+   }
CP(*in, *out, st_mode);
CP(*in, *out, st_uid);
CP(*in, *out, st_gid);
-   CP(*in, *out, st_rdev);
+   out->st_rdev = in->st_rdev;
+   if (out->st_rdev != in->st_rdev) {
+   switch (ino64_trunc_error) {
+   default:
+   break;
+   case 1:
+   return (EOVERFLOW);
+   }
+   }
   

svn commit: r335052 - in head/sys/arm64: arm64 cavium include

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 12:17:11 2018
New Revision: 335052
URL: https://svnweb.freebsd.org/changeset/base/335052

Log:
  Rename the ThunderX CPU identification macros to include the X. This is the
  name people know the product by, and is consistent with the later SoC ID
  macros.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/cavium/thunder_pcie_common.c
  head/sys/arm64/cavium/thunder_pcie_fdt.c
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Wed Jun 13 11:58:41 2018
(r335051)
+++ head/sys/arm64/arm64/gic_v3.c   Wed Jun 13 12:17:11 2018
(r335052)
@@ -418,7 +418,7 @@ arm_gic_v3_intr(void *arg)
pic = sc->gic_pic;
 
while (1) {
-   if (CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1) {
+   if (CPU_MATCH_ERRATA_CAVIUM_THUNDERX_1_1) {
/*
 * Hardware:Cavium ThunderX
 * Chip revision:   Pass 1.0 (early version)

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Wed Jun 13 11:58:41 2018
(r335051)
+++ head/sys/arm64/arm64/identcpu.c Wed Jun 13 12:17:11 2018
(r335052)
@@ -133,7 +133,7 @@ static const struct cpu_parts cpu_parts_arm[] = {
 };
 /* Cavium */
 static const struct cpu_parts cpu_parts_cavium[] = {
-   { CPU_PART_THUNDER, "Thunder" },
+   { CPU_PART_THUNDERX, "ThunderX" },
CPU_PART_NONE,
 };
 
@@ -212,11 +212,11 @@ print_cpu_features(u_int cpu)
 * https://lkml.org/lkml/2016/8/4/722
 */
/*
-* XXX: CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1 on its own also
+* XXX: CPU_MATCH_ERRATA_CAVIUM_THUNDERX_1_1 on its own also
 * triggers on pass 2.0+.
 */
if (cpu == 0 && CPU_VAR(PCPU_GET(midr)) == 0 &&
-   CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1)
+   CPU_MATCH_ERRATA_CAVIUM_THUNDERX_1_1)
printf("WARNING: ThunderX Pass 1.1 detected.\nThis has known "
"hardware bugs that may cause the incorrect operation of "
"atomic operations.\n");

Modified: head/sys/arm64/cavium/thunder_pcie_common.c
==
--- head/sys/arm64/cavium/thunder_pcie_common.c Wed Jun 13 11:58:41 2018
(r335051)
+++ head/sys/arm64/cavium/thunder_pcie_common.c Wed Jun 13 12:17:11 2018
(r335052)
@@ -159,7 +159,7 @@ thunder_pcie_identify_ecam(device_t dev, int *ecam)
 
/* Check if we're running on Cavium ThunderX */
if (!CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK,
-   CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, 0))
+   CPU_IMPL_CAVIUM, CPU_PART_THUNDERX, 0, 0))
return (EINVAL);
 
start = bus_get_resource_start(dev, SYS_RES_MEMORY, 0);

Modified: head/sys/arm64/cavium/thunder_pcie_fdt.c
==
--- head/sys/arm64/cavium/thunder_pcie_fdt.cWed Jun 13 11:58:41 2018
(r335051)
+++ head/sys/arm64/cavium/thunder_pcie_fdt.cWed Jun 13 12:17:11 2018
(r335052)
@@ -97,7 +97,7 @@ thunder_pcie_fdt_probe(device_t dev)
 
/* Check if we're running on Cavium ThunderX */
if (!CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK,
-   CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, 0))
+   CPU_IMPL_CAVIUM, CPU_PART_THUNDERX, 0, 0))
return (ENXIO);
 
if (!ofw_bus_status_okay(dev))

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hWed Jun 13 11:58:41 2018
(r335051)
+++ head/sys/arm64/include/cpu.hWed Jun 13 12:17:11 2018
(r335052)
@@ -89,13 +89,13 @@
 #defineCPU_PART_CORTEX_A75 0xD0A
 
 /* Cavium Part numbers */
-#defineCPU_PART_THUNDER0x0A1
+#defineCPU_PART_THUNDERX   0x0A1
 #defineCPU_PART_THUNDERX_81XX  0x0A2
 #defineCPU_PART_THUNDERX_83XX  0x0A3
 #defineCPU_PART_THUNDERX2  0x0AF
 
-#defineCPU_REV_THUNDER_1_0 0x00
-#defineCPU_REV_THUNDER_1_1 0x01
+#defineCPU_REV_THUNDERX_1_00x00
+#defineCPU_REV_THUNDERX_1_10x01
 
 #defineCPU_IMPL(midr)  (((midr) >> 24) & 0xff)
 #defineCPU_PART(midr)  (((midr) >> 4) & 0xfff)
@@ -137,13 +137,13 @@
  * Revision(s):Pass 1.0, Pass 1.1
  */
 #ifdef THUNDERX_PASS_1_1_ERRATA
-#defineCPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1 
\
+#defineCPU_MATCH_ERRATA_CAVIUM_THUNDERX_1_1
\
 (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK | CPU_REV_MASK, 

svn commit: r335051 - head/sys/arm64/include

2018-06-13 Thread Andrew Turner
Author: andrew
Date: Wed Jun 13 11:58:41 2018
New Revision: 335051
URL: https://svnweb.freebsd.org/changeset/base/335051

Log:
  Add more Cavium CPU part numbers.
  
  While here split the lists by vendor.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hWed Jun 13 11:49:34 2018
(r335050)
+++ head/sys/arm64/include/cpu.hWed Jun 13 11:58:41 2018
(r335051)
@@ -78,7 +78,7 @@
 #defineCPU_IMPL_MARVELL0x56
 #defineCPU_IMPL_INTEL  0x69
 
-#defineCPU_PART_THUNDER0x0A1
+/* ARM Part numbers */
 #defineCPU_PART_FOUNDATION 0xD00
 #defineCPU_PART_CORTEX_A35 0xD04
 #defineCPU_PART_CORTEX_A53 0xD03
@@ -87,6 +87,12 @@
 #defineCPU_PART_CORTEX_A72 0xD08
 #defineCPU_PART_CORTEX_A73 0xD09
 #defineCPU_PART_CORTEX_A75 0xD0A
+
+/* Cavium Part numbers */
+#defineCPU_PART_THUNDER0x0A1
+#defineCPU_PART_THUNDERX_81XX  0x0A2
+#defineCPU_PART_THUNDERX_83XX  0x0A3
+#defineCPU_PART_THUNDERX2  0x0AF
 
 #defineCPU_REV_THUNDER_1_0 0x00
 #defineCPU_REV_THUNDER_1_1 0x01
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335050 - head/usr.sbin/bhyve

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 13 11:49:34 2018
New Revision: 335050
URL: https://svnweb.freebsd.org/changeset/base/335050

Log:
  While I was investigating CID 1194192 related with a resource leak on mrp 
memory
  allocation, I could identify that actually we use this pointer on pci_emul.c 
as
  well as on vga.c source file.
  
  I have reworked the logic here to make it more readable and also add a warn to
  explicit show the function where the memory allocation error could happen,
  also sort headers.
  
  Also CID 1194192 was marked as "Intentional".
  
  Obtained from:TrueOS
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.

Modified:
  head/usr.sbin/bhyve/mem.c

Modified: head/usr.sbin/bhyve/mem.c
==
--- head/usr.sbin/bhyve/mem.c   Wed Jun 13 11:12:52 2018(r335049)
+++ head/usr.sbin/bhyve/mem.c   Wed Jun 13 11:49:34 2018(r335050)
@@ -38,15 +38,16 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 
-#include 
-#include 
 #include 
+#include 
 #include 
+#include 
+#include 
 
 #include "mem.h"
 
@@ -285,8 +286,11 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_
err = 0;
 
mrp = malloc(sizeof(struct mmio_rb_range));
-   
-   if (mrp != NULL) {
+   if (mrp == NULL) {
+   warn("%s: couldn't allocate memory for mrp\n",
+__func__);
+   err = ENOMEM;
+   } else {
mrp->mr_param = *memp;
mrp->mr_base = memp->base;
mrp->mr_end = memp->base + memp->size - 1;
@@ -297,8 +301,7 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_
assert(perror == 0);
if (err)
free(mrp);
-   } else
-   err = ENOMEM;
+   }
 
return (err);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Emmanuel Vadot

On 2018-06-12 18:45, Edward Tomasz Napierala wrote:

Author: trasz
Date: Tue Jun 12 16:45:52 2018
New Revision: 335004
URL: https://svnweb.freebsd.org/changeset/base/335004

Log:
  Enable USB OTG serial terminal on ARM SD card images.  This 
configures
  the system to make use of USB device mode / USB OTG to provide a 
"virtual

  serial port" on release images.

  Reviewed by:  gjb@
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D15602

Modified:
  head/release/tools/arm.subr

Modified: head/release/tools/arm.subr
==
--- head/release/tools/arm.subr Tue Jun 12 16:44:13 2018(r335003)
+++ head/release/tools/arm.subr Tue Jun 12 16:45:52 2018(r335004)
@@ -92,6 +92,41 @@ arm_create_user() {
return 0
 }

+arm_setup_usb_otg() {
+   # Set up virtual serial port over USB OTG / device mode.
+   echo >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '# Required for USB OTG virtual serial port.' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo 'notify 100 {' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "system""DEVFS";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "subsystem" "CDEV";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "type"  "CREATE";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "cdev"  "ttyU[0-9]+";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  action "/sbin/init q";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '};' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf


 This will be wiped after the first update, better create 
/etc/devd/otg_serial.conf



+   echo '# USB OTG virtual serial port' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
+   echo 'ttyU0 "/usr/libexec/getty 3wire"vt100   onifconsole  
secure' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
+   echo 'ttyU1 "/usr/libexec/getty 3wire"vt100   onifconsole  
secure' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys


 If I have no OTG port and a usb<->uart plugged into my board that will 
give weird result no ?



+   echo '# Configure USB OTG; see usb_template(4).' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
+   echo 'hw.usb.template=3' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
+   echo 'umodem_load="YES"' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf


 I'm not a big fan of always enabling this functionality. Do you have a 
board that have no uart but an otg port ?



+}
+
 arm_install_base() {
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${DESTDIR}
eval chroot ${CHROOTDIR} make -C ${WORLDDIR} \
@@ -102,6 +137,7 @@ arm_install_base() {
chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos

arm_create_user
+   arm_setup_usb_otg

echo '# Custom /etc/fstab for FreeBSD embedded images' \
> ${CHROOTDIR}/${DESTDIR}/etc/fstab


--
Emmanuel Vadot  
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335049 - head/usr.bin/top

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 11:12:52 2018
New Revision: 335049
URL: https://svnweb.freebsd.org/changeset/base/335049

Log:
  top(1): remove unneeded logic
  
  - remove __pure annotations I added earlier for some functions. One
  writes to the the arguments as "out" pointers. The
  other reads from an array, which while const within the function might
  be mutated externally.
  - total_change is modified to be at 1, if previously 0, so no if check
  is needed.

Modified:
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/utils.c
==
--- head/usr.bin/top/utils.cWed Jun 13 11:11:33 2018(r335048)
+++ head/usr.bin/top/utils.cWed Jun 13 11:12:52 2018(r335049)
@@ -122,7 +122,7 @@ digits(int val)
  * string_index(string, array) - find string in array and return index
  */
 
-int __pure
+int
 string_index(const char *string, const char * const *array)
 {
 size_t i = 0;
@@ -175,7 +175,7 @@ argparse(char *line, int *cntp)
  * useful on for calculating cpu state percentages.
  */
 
-long __pure
+long
 percentages(int cnt, int *out, long *new, long *old, long *diffs)
 {
 int i;
@@ -210,13 +210,10 @@ percentages(int cnt, int *out, long *new, long *old, l
 /* calculate percentages based on overall change, rounding up */
 half_total = total_change / 2l;
 
-/* Do not divide by 0. Causes Floating point exception */
-if(total_change) {
-for (i = 0; i < cnt; i++)
-{
-  *out++ = (int)((*diffs++ * 1000 + half_total) / total_change);
-}
-}
+   for (i = 0; i < cnt; i++)
+   {
+   *out++ = (int)((*diffs++ * 1000 + half_total) / total_change);
+   }
 
 /* return the total in case the caller wants to use it */
 return(total_change);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335048 - in head/sys: net netinet netinet6

2018-06-13 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jun 13 11:11:33 2018
New Revision: 335048
URL: https://svnweb.freebsd.org/changeset/base/335048

Log:
  Rework if_gre(4) to use encap_lookup_t method to speedup lookup
  of needed interface when many gre interfaces are present.
  
  Remove rmlock from gre_softc, use epoch(9) and CK_LIST instead.
  Move more AF-related code into AF-related locations. Use hash table to
  speedup lookup of needed softc.

Modified:
  head/sys/net/if_gre.c
  head/sys/net/if_gre.h
  head/sys/netinet/ip_gre.c
  head/sys/netinet6/ip6_gre.c

Modified: head/sys/net/if_gre.c
==
--- head/sys/net/if_gre.c   Wed Jun 13 10:32:21 2018(r335047)
+++ head/sys/net/if_gre.c   Wed Jun 13 11:11:33 2018(r335048)
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * Copyright (c) 2014 Andrey V. Elsukov 
+ * Copyright (c) 2014, 2018 Andrey V. Elsukov 
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -41,17 +41,13 @@ __FBSDID("$FreeBSD$");
 #include "opt_inet6.h"
 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -70,7 +66,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #ifdef INET
-#include 
 #include 
 #include 
 #include 
@@ -80,7 +75,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #endif
 
 #include 
@@ -91,18 +85,10 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #defineGREMTU  1476
+
 static const char grename[] = "gre";
-static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation");
-static VNET_DEFINE(struct mtx, gre_mtx);
-#defineV_gre_mtx   VNET(gre_mtx)
-#defineGRE_LIST_LOCK_INIT(x)   mtx_init(_gre_mtx, "gre_mtx", 
NULL, \
-   MTX_DEF)
-#defineGRE_LIST_LOCK_DESTROY(x)mtx_destroy(_gre_mtx)
-#defineGRE_LIST_LOCK(x)mtx_lock(_gre_mtx)
-#defineGRE_LIST_UNLOCK(x)  mtx_unlock(_gre_mtx)
+MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation");
 
-static VNET_DEFINE(LIST_HEAD(, gre_softc), gre_softc_list);
-#defineV_gre_softc_listVNET(gre_softc_list)
 static struct sx gre_ioctl_sx;
 SX_SYSINIT(gre_ioctl_sx, _ioctl_sx, "gre_ioctl");
 
@@ -116,12 +102,8 @@ static int gre_transmit(struct ifnet *, struct mbuf *)
 static int gre_ioctl(struct ifnet *, u_long, caddr_t);
 static int gre_output(struct ifnet *, struct mbuf *,
const struct sockaddr *, struct route *);
+static voidgre_delete_tunnel(struct gre_softc *);
 
-static voidgre_updatehdr(struct gre_softc *);
-static int gre_set_tunnel(struct ifnet *, struct sockaddr *,
-struct sockaddr *);
-static voidgre_delete_tunnel(struct ifnet *);
-
 SYSCTL_DECL(_net_link);
 static SYSCTL_NODE(_net_link, IFT_TUNNEL, gre, CTLFLAG_RW, 0,
 "Generic Routing Encapsulation");
@@ -145,10 +127,15 @@ SYSCTL_INT(_net_link_gre, OID_AUTO, max_nesting, CTLFL
 static void
 vnet_gre_init(const void *unused __unused)
 {
-   LIST_INIT(_gre_softc_list);
-   GRE_LIST_LOCK_INIT();
+
V_gre_cloner = if_clone_simple(grename, gre_clone_create,
gre_clone_destroy, 0);
+#ifdef INET
+   in_gre_init();
+#endif
+#ifdef INET6
+   in6_gre_init();
+#endif
 }
 VNET_SYSINIT(vnet_gre_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
 vnet_gre_init, NULL);
@@ -158,7 +145,12 @@ vnet_gre_uninit(const void *unused __unused)
 {
 
if_clone_detach(V_gre_cloner);
-   GRE_LIST_LOCK_DESTROY();
+#ifdef INET
+   in_gre_uninit();
+#endif
+#ifdef INET6
+   in6_gre_uninit();
+#endif
 }
 VNET_SYSUNINIT(vnet_gre_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
 vnet_gre_uninit, NULL);
@@ -171,7 +163,6 @@ gre_clone_create(struct if_clone *ifc, int unit, caddr
sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK | M_ZERO);
sc->gre_fibnum = curthread->td_proc->p_fibnum;
GRE2IFP(sc) = if_alloc(IFT_TUNNEL);
-   GRE_LOCK_INIT(sc);
GRE2IFP(sc)->if_softc = sc;
if_initname(GRE2IFP(sc), grename, unit);
 
@@ -185,9 +176,6 @@ gre_clone_create(struct if_clone *ifc, int unit, caddr
GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE;
if_attach(GRE2IFP(sc));
bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t));
-   GRE_LIST_LOCK();
-   LIST_INSERT_HEAD(_gre_softc_list, sc, gre_list);
-   GRE_LIST_UNLOCK();
return (0);
 }
 
@@ -198,33 +186,22 @@ gre_clone_destroy(struct ifnet *ifp)
 
sx_xlock(_ioctl_sx);
sc = ifp->if_softc;
-   gre_delete_tunnel(ifp);
-   GRE_LIST_LOCK();
-   LIST_REMOVE(sc, gre_list);
-   GRE_LIST_UNLOCK();
+   gre_delete_tunnel(sc);
bpfdetach(ifp);

svn commit: r335047 - head/sys/riscv/riscv

2018-06-13 Thread Ruslan Bukin
Author: br
Date: Wed Jun 13 10:32:21 2018
New Revision: 335047
URL: https://svnweb.freebsd.org/changeset/base/335047

Log:
  Don't jump to VA space until kernel is ready.
  
  This fixes the race when first core sets up the pagetables, while
  secondary cores do translating the address of __riscv_boot_ap.
  
  This now allows us to smpboot in QEMU with 8 cores just fine.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/riscv/riscv/locore.S

Modified: head/sys/riscv/riscv/locore.S
==
--- head/sys/riscv/riscv/locore.S   Wed Jun 13 09:28:47 2018
(r335046)
+++ head/sys/riscv/riscv/locore.S   Wed Jun 13 10:32:21 2018
(r335047)
@@ -263,6 +263,21 @@ END(mpentry)
  * Called by a core when it is being brought online.
  */
 ENTRY(mpentry)
+   /*
+* Calculate the offset to __riscv_boot_ap
+* for the current core, cpuid is in a0.
+*/
+   li  t1, 4
+   mulwt1, t1, a0
+   /* Get the pointer */
+   la  t0, __riscv_boot_ap
+   add t0, t0, t1
+
+1:
+   /* Wait the kernel to be ready */
+   lw  t1, 0(t0)
+   beqzt1, 1b
+
/* Setup stack pointer */
la  t0, secondary_stacks
li  t1, (PAGE_SIZE * KSTACK_PAGES)
@@ -296,20 +311,6 @@ mpva:
/* Ensure sscratch is zero */
li  t0, 0
csrwsscratch, t0
-   /*
-* Calculate the offset to __riscv_boot_ap
-* for current core, cpuid in a0.
-*/
-   li  t1, 4
-   mulwt1, t1, a0
-   /* Get pointer */
-   la  t0, __riscv_boot_ap
-   add t0, t0, t1
-
-1:
-   /* Wait the kernel to be ready */
-   lw  t1, 0(t0)
-   beqzt1, 1b
 
callinit_secondary
 END(mpentry)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335041 - head/lib/libc/stdlib

2018-06-13 Thread Bruce Evans

On Wed, 13 Jun 2018, Eitan Adler wrote:


Log:
 libc: remove explicit cast NULL in atoi

 There isn't any reason to cast NULL so just remove it. Noticed when
 cleaning up top.


There are many reasons to cast NULL for all members of the ato*() family:
- it is required if no prototype is in scope
- C99 specifies ato*() in terms of strtol*() and uses the cast to NULL,
  probably because this is simplest.  Omitting the cast is just wrong
  if no prototype is in scope.  Writing the explicit cast is simpler than
  writing caveats that the stated equivalence is only valid if a prototype
  is in scope.
- POSIX specifies ato*() in terms of strtol*() and uses the cast to NULL,
  exactly as in C99, probably because it defers to the C standard and
  doesn't and doesn't risk breaking it by changing its wording except when
  extending it.

FreeBSD used to do the same here, and should do the same here and elsewhere
by copying better wording from POSIX whenever possible.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335046 - head/sbin/dumpon

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 09:28:47 2018
New Revision: 335046
URL: https://svnweb.freebsd.org/changeset/base/335046

Log:
  dumpon(8): improve the examples a bit
  
  While here, remove extraneous extraneous Pp
  
  Reviewed by:  jhb (older version)

Modified:
  head/sbin/dumpon/dumpon.8

Modified: head/sbin/dumpon/dumpon.8
==
--- head/sbin/dumpon/dumpon.8   Wed Jun 13 09:17:04 2018(r335045)
+++ head/sbin/dumpon/dumpon.8   Wed Jun 13 09:28:47 2018(r335046)
@@ -28,7 +28,7 @@
 .\" From: @(#)swapon.8 8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd March 6, 2018
+.Dd June 13, 2018
 .Dt DUMPON 8
 .Os
 .Sh NAME
@@ -181,7 +181,6 @@ or
 .Dv ZSTDIO
 kernel options.
 .Pp
-.Pp
 The
 .Fl l
 flag causes
@@ -311,15 +310,17 @@ The
 can be now examined using
 .Xr kgdb 1 :
 .Pp
-.Dl # kgdb /usr/lib/debug/boot/kernel/kernel.debug vmcore.#
+.Dl # kgdb /boot/kernel/kernel vmcore.#
 .Pp
 or shorter:
 .Pp
-.Dl # kgdb -n # /usr/lib/debug/boot/kernel/kernel.debug
+.Dl # kgdb -n #
 .Pp
 The core was decrypted properly if
 .Xr kgdb 1
 does not print any errors.
+Note that the live kernel might be at a different path
+which can be examined by looking at the kern.bootfile sysctl.
 .Sh SEE ALSO
 .Xr gzip 1 ,
 .Xr kgdb 1 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335045 - head/usr.sbin/pmc

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 09:17:04 2018
New Revision: 335045
URL: https://svnweb.freebsd.org/changeset/base/335045

Log:
  pmc: remove trailing whitespace
  
  Reported by:  swills

Modified:
  head/usr.sbin/pmc/pmc.c

Modified: head/usr.sbin/pmc/pmc.c
==
--- head/usr.sbin/pmc/pmc.c Wed Jun 13 09:07:24 2018(r335044)
+++ head/usr.sbin/pmc/pmc.c Wed Jun 13 09:17:04 2018(r335045)
@@ -71,7 +71,7 @@ static struct cmd_handler disp_table[] = {
 };
 
 static void __dead2
-usage(void) 
+usage(void)
 {
errx(EX_USAGE,
"\t pmc management utility\n"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335044 - head/lib/libc/stdlib

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 09:07:24 2018
New Revision: 335044
URL: https://svnweb.freebsd.org/changeset/base/335044

Log:
  atoi.3: bump .Dd
  
  I touched the man page. Bump Dd by just over 15 years.

Modified:
  head/lib/libc/stdlib/atoi.3

Modified: head/lib/libc/stdlib/atoi.3
==
--- head/lib/libc/stdlib/atoi.3 Wed Jun 13 08:52:22 2018(r335043)
+++ head/lib/libc/stdlib/atoi.3 Wed Jun 13 09:07:24 2018(r335044)
@@ -32,7 +32,7 @@
 .\" @(#)atoi.3 8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd June 13, 2018
 .Dt ATOI 3
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335043 - head/usr.bin/top

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 08:52:22 2018
New Revision: 335043
URL: https://svnweb.freebsd.org/changeset/base/335043

Log:
  top(1): style(9)
  
  - split return type from function name
  - Sprinkle a __pure where possible.

Modified:
  head/usr.bin/top/display.c
  head/usr.bin/top/username.c
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Wed Jun 13 08:52:19 2018(r335042)
+++ head/usr.bin/top/display.c  Wed Jun 13 08:52:22 2018(r335043)
@@ -160,7 +160,8 @@ display_resize(void)
 return(smart_terminal ? lines : Largest);
 }
 
-int display_updatecpus(struct statics *statics)
+int
+display_updatecpus(struct statics *statics)
 {
 int lines;
 int i;
@@ -184,7 +185,8 @@ int display_updatecpus(struct statics *statics)
 return(lines);
 }
 
-int display_init(struct statics * statics)
+int
+display_init(struct statics * statics)
 {
 int lines;
 char **pp;
@@ -1074,7 +1076,8 @@ readline(char *buffer, int size, int numeric)
 
 /* internal support routines */
 
-static void summary_format(char *str, int *numbers, const char * const *names)
+static void
+summary_format(char *str, int *numbers, const char * const *names)
 {
 char *p;
 int num;

Modified: head/usr.bin/top/username.c
==
--- head/usr.bin/top/username.c Wed Jun 13 08:52:19 2018(r335042)
+++ head/usr.bin/top/username.c Wed Jun 13 08:52:22 2018(r335043)
@@ -55,7 +55,8 @@ struct hash_el {
 static struct hash_el hash_table[Table_size];
 
 
-char *username(int uid)
+char *
+username(int uid)
 {
 int hashindex;
 
@@ -68,7 +69,8 @@ char *username(int uid)
 return(hash_table[hashindex].name);
 }
 
-int userid(char username[])
+int
+userid(char username[])
 {
 struct passwd *pwd;
 
@@ -89,7 +91,8 @@ int userid(char username[])
 }
 
 /* wecare 1 = enter it always, 0 = nice to have */
-int enter_user(int uid, char name[], bool wecare)
+int
+enter_user(int uid, char name[], bool wecare)
 {
 int hashindex;
 

Modified: head/usr.bin/top/utils.c
==
--- head/usr.bin/top/utils.cWed Jun 13 08:52:19 2018(r335042)
+++ head/usr.bin/top/utils.cWed Jun 13 08:52:22 2018(r335043)
@@ -122,7 +122,7 @@ digits(int val)
  * string_index(string, array) - find string in array and return index
  */
 
-int
+int __pure
 string_index(const char *string, const char * const *array)
 {
 size_t i = 0;
@@ -175,7 +175,7 @@ argparse(char *line, int *cntp)
  * useful on for calculating cpu state percentages.
  */
 
-long
+long __pure
 percentages(int cnt, int *out, long *new, long *old, long *diffs)
 {
 int i;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335042 - head/usr.bin/top

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 08:52:19 2018
New Revision: 335042
URL: https://svnweb.freebsd.org/changeset/base/335042

Log:
  top(1): add myself to authors
  
  At this point I've mucked enough with top(1) that all bugs should be
  blamed on me rather than William LeFebvre.

Modified:
  head/usr.bin/top/top.1
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/top.1
==
--- head/usr.bin/top/top.1  Wed Jun 13 08:52:17 2018(r335041)
+++ head/usr.bin/top/top.1  Wed Jun 13 08:52:19 2018(r335042)
@@ -360,6 +360,7 @@ process is waiting.
 Lock names are prefixed with an asterisk \*(lq*\*(rq while sleep events
 are not.
 .Sh AUTHORS
+.An Eitan Adler Aq Mt ead...@freebsd.org
 .An William LeFebvre, EECS Department, Northwestern University
 .Sh BUGS
 The command name for swapped processes should be tracked down, but this

Modified: head/usr.bin/top/utils.c
==
--- head/usr.bin/top/utils.cWed Jun 13 08:52:17 2018(r335041)
+++ head/usr.bin/top/utils.cWed Jun 13 08:52:19 2018(r335042)
@@ -2,6 +2,7 @@
  *  This program may be freely redistributed,
  *  but this entire comment MUST remain intact.
  *
+ *  Copyright (c) 2018, Eitan Adler
  *  Copyright (c) 1984, 1989, William LeFebvre, Rice University
  *  Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
  *
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335039 - head/usr.bin/top

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 08:52:12 2018
New Revision: 335039
URL: https://svnweb.freebsd.org/changeset/base/335039

Log:
  top(1): replace homegrown itoa with sprintf
  
  Much of this should be inlined to the callsite, but leave it here for
  now to make it easier to make it easier bisect later.

Modified:
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/utils.c
==
--- head/usr.bin/top/utils.cWed Jun 13 08:52:09 2018(r335038)
+++ head/usr.bin/top/utils.cWed Jun 13 08:52:12 2018(r335039)
@@ -70,24 +70,13 @@ _Static_assert(sizeof(int) <= 4, "buffer too small for
 char *
 itoa(unsigned int val)
 {
-char *ptr;
 static char buffer[16];/* result is built here */
/* 16 is sufficient since the largest number
   we will ever convert will be 2^32-1,
   which is 10 digits. */
 
-ptr = buffer + sizeof(buffer);
-*--ptr = '\0';
-if (val == 0)
-{
-   *--ptr = '0';
-}
-else while (val != 0)
-{
-   *--ptr = (val % 10) + '0';
-   val /= 10;
-}
-return(ptr);
+   sprintf(buffer, "%u", val);
+return (buffer);
 }
 
 /*
@@ -99,28 +88,13 @@ itoa(unsigned int val)
 char *
 itoa7(int val)
 {
-char *ptr;
 static char buffer[16];/* result is built here */
/* 16 is sufficient since the largest number
   we will ever convert will be 2^32-1,
   which is 10 digits. */
 
-ptr = buffer + sizeof(buffer);
-*--ptr = '\0';
-if (val == 0)
-{
-   *--ptr = '0';
-}
-else while (val != 0)
-{
-   *--ptr = (val % 10) + '0';
-   val /= 10;
-}
-while (ptr > buffer + sizeof(buffer) - 7)
-{
-   *--ptr = ' ';
-}
-return(ptr);
+   sprintf(buffer, "%6u", val);
+return (buffer);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335041 - head/lib/libc/stdlib

2018-06-13 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 08:52:17 2018
New Revision: 335041
URL: https://svnweb.freebsd.org/changeset/base/335041

Log:
  libc: remove explicit cast NULL in atoi
  
  There isn't any reason to cast NULL so just remove it. Noticed when
  cleaning up top.
  
  Reviewed by:  pstef

Modified:
  head/lib/libc/stdlib/atoi.3
  head/lib/libc/stdlib/atoi.c

Modified: head/lib/libc/stdlib/atoi.3
==
--- head/lib/libc/stdlib/atoi.3 Wed Jun 13 08:52:14 2018(r335040)
+++ head/lib/libc/stdlib/atoi.3 Wed Jun 13 08:52:17 2018(r335041)
@@ -57,7 +57,7 @@ representation.
 .Pp
 It is equivalent to:
 .Bd -literal -offset indent
-(int)strtol(nptr, (char **)NULL, 10);
+(int)strtol(nptr, NULL, 10);
 .Ed
 .Pp
 The

Modified: head/lib/libc/stdlib/atoi.c
==
--- head/lib/libc/stdlib/atoi.c Wed Jun 13 08:52:14 2018(r335040)
+++ head/lib/libc/stdlib/atoi.c Wed Jun 13 08:52:17 2018(r335041)
@@ -46,11 +46,11 @@ __FBSDID("$FreeBSD$");
 int
 atoi(const char *str)
 {
-   return (int)strtol(str, (char **)NULL, 10);
+   return (int)strtol(str, NULL, 10);
 }
 
 int
 atoi_l(const char *str, locale_t locale)
 {
-   return (int)strtol_l(str, (char **)NULL, 10, locale);
+   return (int)strtol_l(str, NULL, 10, locale);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   >