Re: svn commit: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys s

2018-02-23 Thread Bruce Evans

On Fri, 23 Feb 2018, Bruce Evans wrote:


On Fri, 23 Feb 2018, Warner Losh wrote:


Log:
 Do not include float interfaces when using libsa.

 We don't support float in the boot loaders, so don't include
 interfaces for float or double in systems headers. In addition, take
 the unusual step of spiking double and float to prevent any more
 accidental seepage.


This unimproves all the _types.h headers, probably for no benefits for lua.


Modified: head/sys/arm/include/_types.h
==
--- head/sys/arm/include/_types.h	Fri Feb 23 04:04:18 2018 
(r329858)
+++ head/sys/arm/include/_types.h	Fri Feb 23 04:04:25 2018 
(r329859)

@@ -70,8 +70,10 @@ typedef  unsigned long long  __uint64_t;
 */
typedef __uint32_t  __clock_t;  /* clock()... */
typedef __int32_t   __critical_t;
+#ifndef _STANDALONE
typedef double  __double_t;
typedef float   __float_t;
+#endif
typedef __int32_t   __intfptr_t;
typedef __int64_t   __intmax_t;
typedef __int32_t   __intptr_t;


__types.h headers exist to avoid ifdefs like this.  They only define types
in the implementation namespace.  Nothing except  should use
__double_t or __float_t directly.  There is only a problem if some option
like -fno-float turns off floating point completely, so that 'float' is
a syntax error.


Actually you created the syntax errors by defining float and double in
makefiles.  This gives undefined behaviour.

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: r329863 - stable/11/sys/x86/x86

2018-02-23 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 23 11:17:16 2018
New Revision: 329863
URL: https://svnweb.freebsd.org/changeset/base/329863

Log:
  MFC r329416:
  Remove unused symbols.

Modified:
  stable/11/sys/x86/x86/mp_x86.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/x86/mp_x86.c
==
--- stable/11/sys/x86/x86/mp_x86.c  Fri Feb 23 07:43:52 2018
(r329862)
+++ stable/11/sys/x86/x86/mp_x86.c  Fri Feb 23 11:17:16 2018
(r329863)
@@ -74,15 +74,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define WARMBOOT_TARGET0
-#define WARMBOOT_OFF   (KERNBASE + 0x0467)
-#define WARMBOOT_SEG   (KERNBASE + 0x0469)
-
-#define CMOS_REG   (0x70)
-#define CMOS_DATA  (0x71)
-#define BIOS_RESET (0x0f)
-#define BIOS_WARM  (0x0a)
-
 /* lock region used by kernel profiling */
 intmcount_lock;
 
___
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: r329864 - head/sys/x86/x86

2018-02-23 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 23 11:20:59 2018
New Revision: 329864
URL: https://svnweb.freebsd.org/changeset/base/329864

Log:
  Do not return out of bound pointers from intr_lookup_source().
  
  This hardens the code against driver and upper level bugs causing
  invalid indexes used, e.g. on msi release.
  
  Reported by:  gallatin
  Reviewed by:  gallatin, hselasky
  Sponsored by: Mellanox Technologies
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D14470

Modified:
  head/sys/x86/x86/intr_machdep.c

Modified: head/sys/x86/x86/intr_machdep.c
==
--- head/sys/x86/x86/intr_machdep.c Fri Feb 23 11:17:16 2018
(r329863)
+++ head/sys/x86/x86/intr_machdep.c Fri Feb 23 11:20:59 2018
(r329864)
@@ -178,6 +178,8 @@ struct intsrc *
 intr_lookup_source(int vector)
 {
 
+   if (vector < 0 || vector >= nitems(interrupt_sources))
+   return (NULL);
return (interrupt_sources[vector]);
 }
 
___
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: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys s

2018-02-23 Thread Warner Losh
On Thu, Feb 22, 2018 at 11:12 PM, Bruce Evans  wrote:

> On Fri, 23 Feb 2018, Warner Losh wrote:
>
> Log:
>>  Do not include float interfaces when using libsa.
>>
>>  We don't support float in the boot loaders, so don't include
>>  interfaces for float or double in systems headers. In addition, take
>>  the unusual step of spiking double and float to prevent any more
>>  accidental seepage.
>>
>
> This unimproves all the _types.h headers, probably for no benefits for lua.
>
> Modified: head/sys/arm/include/_types.h
>> 
>> ==
>> --- head/sys/arm/include/_types.h   Fri Feb 23 04:04:18 2018
>> (r329858)
>> +++ head/sys/arm/include/_types.h   Fri Feb 23 04:04:25 2018
>> (r329859)
>> @@ -70,8 +70,10 @@ typedef  unsigned long long  __uint64_t;
>>  */
>> typedef __uint32_t  __clock_t;  /* clock()... */
>> typedef __int32_t   __critical_t;
>> +#ifndef _STANDALONE
>> typedef double  __double_t;
>> typedef float   __float_t;
>> +#endif
>> typedef __int32_t   __intfptr_t;
>> typedef __int64_t   __intmax_t;
>> typedef __int32_t   __intptr_t;
>>
>
> __types.h headers exist to avoid ifdefs like this.  They only define types
> in the implementation namespace.  Nothing except  should use
> __double_t or __float_t directly.  There is only a problem if some option
> like -fno-float turns off floating point completely, so that 'float' is
> a syntax error.


Right. Except, there's no longer a -fno-float option. Then again, these
should almost certainly be in sys/_types instead because they are identical
on every platform and will almost certainly never ever be anything other
than what they are.

For the boot loader, I spiked double and float definitions so that we don't
touch floating point types at all. We do this in the Makefile by
intentionally creating syntax errors. I don't think this is undefined
behavior, I think it is well defined behavior: A syntax error is a syntax
error. We're using a restricted set of C for the loader anyway. It's mostly
to prevent accidental use of floating point.

If we ever support floats and such in the boot loader, I'll revert. This
helps us catch accidents like one of the lua files being compiled
incorrectly, leading to stray references to float/double on arm which
caused float stuff to be referenced and pulled in due to inlining. That's
the real bug, and that's been fixed. Until we need float/double in the
loader, I'll keep this in place to prevent a recurrence.

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: r329853 - in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug

2018-02-23 Thread Rodney W. Grimes
> Author: asomers
> Date: Fri Feb 23 03:11:43 2018
> New Revision: 329853
> URL: https://svnweb.freebsd.org/changeset/base/329853
> 
> Log:
>   libifconfig: multiple feature additions
>   
>   Added the ability to:
>   
>   * Create virtual interfaces
>   * Create vlan interfaces
>   * Get interface fib
>   * Get interface groups
>   * Get interface status
>   * Get nd6 info
>   * Get media status
>   * Get additional ifaddr info in a convenient struct
>   * Get vhids
>   * Get carp info
>   * Get lagg and laggport status
>   * Iterate over all interfaces and ifaddrs

Love that list!!!  
>   
>   And add more examples, too.

Remove MIT 1996 Copyright?
Under what conditions is it that this is being done?
   
>   Note that this is a backwards-incompatible change. But that's ok, because 
> it's
>   a private library.
>   
>   MFC after:  3 weeks
>   Sponsored by:   Spectra Logic Corp
>   Differential Revision:  https://reviews.freebsd.org/D14463

With 0 feed back?  And a ~30 hour life time?  It is not a diffential if
no one looks at, comments on, or accepts the revision.

> Added:
>   head/lib/libifconfig/libifconfig_carp.c   (contents, props changed)
>   head/lib/libifconfig/libifconfig_inet.c   (contents, props changed)
>   head/lib/libifconfig/libifconfig_inet6.c   (contents, props changed)
>   head/lib/libifconfig/libifconfig_lagg.c   (contents, props changed)
>   head/lib/libifconfig/libifconfig_media.c   (contents, props changed)
>   head/share/examples/libifconfig/ifchangevlan.c   (contents, props changed)
>   head/share/examples/libifconfig/ifcreatevlan.c   (contents, props changed)
>   head/share/examples/libifconfig/status.c   (contents, props changed)
> Modified:
>   head/lib/libifconfig/Makefile
>   head/lib/libifconfig/libifconfig.c
>   head/lib/libifconfig/libifconfig.h
>   head/lib/libifconfig/libifconfig_internal.c
>   head/lib/libifconfig/libifconfig_internal.h
>   head/share/examples/libifconfig/Makefile
>   head/share/examples/libifconfig/ifcreate.c
>   head/share/examples/libifconfig/ifdestroy.c
>   head/share/examples/libifconfig/setdescription.c
>   head/share/examples/libifconfig/setmtu.c
>   head/usr.sbin/wlandebug/wlandebug.c
> 
> Modified: head/lib/libifconfig/Makefile
> ==
> --- head/lib/libifconfig/Makefile Fri Feb 23 02:53:50 2018
> (r329852)
> +++ head/lib/libifconfig/Makefile Fri Feb 23 03:11:43 2018
> (r329853)
> @@ -8,7 +8,9 @@ NO_PIC= 
>  
>  SHLIBDIR?=   /lib
>  SHLIB_MAJOR= 1
> -SRCS=libifconfig.c libifconfig_internal.c
> +SRCS=libifconfig.c libifconfig_carp.c libifconfig_inet.c
> +SRCS+=   libifconfig_inet6.c libifconfig_internal.c 
> libifconfig_lagg.c
> +SRCS+=   libifconfig_media.c
>  
>  INCSDIR= ${INCLUDEDIR}
>  INCS=libifconfig.h
> @@ -16,6 +18,6 @@ INCS=   libifconfig.h
>  #MAN=libifconfig.3
>  
>  CFLAGS+= -I${.CURDIR}
> -WARNS?=6
> +NO_WCAST_ALIGN= yes
>  
>  .include 
> 
> Modified: head/lib/libifconfig/libifconfig.c
> ==
> --- head/lib/libifconfig/libifconfig.cFri Feb 23 02:53:50 2018
> (r329852)
> +++ head/lib/libifconfig/libifconfig.cFri Feb 23 03:11:43 2018
> (r329853)
> @@ -1,38 +1,7 @@
>  /*
> - * Copyright (c) 2016, Marie Helene Kvello-Aune
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without 
> modification,
> - * are permitted provided that the following conditions are met:
> - *
> - * 1. Redistributions of source code must retain the above copyright notice,
> - * thislist of conditions and the following disclaimer.
> - *
> - * 2. Redistributions in binary form must reproduce the above copyright 
> notice,
> - * this list of conditions and the following disclaimer in the documentation 
> and/or
> - * other materials provided with the distribution.
> - *
> - * 3. Neither the name of the copyright holder nor the names of its 
> contributors
> - * may be used to endorse or promote products derived from this software 
> without
> - * specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
> - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
> PURPOSE
> - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 AN

Re: svn commit: r329854 - head/stand/lua

2018-02-23 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: kevans
> Date: Fri Feb 23 03:18:24 2018
> New Revision: 329854
> URL: https://svnweb.freebsd.org/changeset/base/329854
> 
> Log:
>   lualoader: shallowCopyTable => deepCopyTable
>   
>   I called it a shallow copy, but it wasn't really a shallow copy at all.

Isnt it really neither shallow nor deep, but just CopyTable?

> Modified:
>   head/stand/lua/core.lua
>   head/stand/lua/menu.lua
> 
> Modified: head/stand/lua/core.lua
> ==
> --- head/stand/lua/core.lua   Fri Feb 23 03:11:43 2018(r329853)
> +++ head/stand/lua/core.lua   Fri Feb 23 03:18:24 2018(r329854)
> @@ -286,11 +286,11 @@ function core.isSystem386()
>  end
>  
>  -- This may be a better candidate for a 'utility' module.
> -function core.shallowCopyTable(tbl)
> +function core.deepCopyTable(tbl)
>   local new_tbl = {}
>   for k, v in pairs(tbl) do
>   if type(v) == "table" then
> - new_tbl[k] = core.shallowCopyTable(v)
> + new_tbl[k] = core.deepCopyTable(v)
>   else
>   new_tbl[k] = v
>   end
> 
> Modified: head/stand/lua/menu.lua
> ==
> --- head/stand/lua/menu.lua   Fri Feb 23 03:11:43 2018(r329853)
> +++ head/stand/lua/menu.lua   Fri Feb 23 03:18:24 2018(r329854)
> @@ -222,7 +222,7 @@ menu.welcome = {
>   return menu.welcome.swapped_menu
>   end
>   -- Shallow copy the table
> - menu_entries = core.shallowCopyTable(menu_entries)
> + menu_entries = core.deepCopyTable(menu_entries)
>  
>   -- Swap the first two menu entries
>   menu_entries[1], menu_entries[2] =
> 
> 

-- 
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: r329853 - in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug

2018-02-23 Thread Alan Somers
On Fri, Feb 23, 2018 at 7:47 AM, Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:

> > Author: asomers
> > Date: Fri Feb 23 03:11:43 2018
> > New Revision: 329853
> > URL: https://svnweb.freebsd.org/changeset/base/329853
> >
> > Log:
> >   libifconfig: multiple feature additions
> >
> >   Added the ability to:
> >
> >   * Create virtual interfaces
> >   * Create vlan interfaces
> >   * Get interface fib
> >   * Get interface groups
> >   * Get interface status
> >   * Get nd6 info
> >   * Get media status
> >   * Get additional ifaddr info in a convenient struct
> >   * Get vhids
> >   * Get carp info
> >   * Get lagg and laggport status
> >   * Iterate over all interfaces and ifaddrs
>
> Love that list!!!
> >
> >   And add more examples, too.
>
> Remove MIT 1996 Copyright?
> Under what conditions is it that this is being done?
>

The file's original author removed the extra license block.  It probably
shouldn't have been there to begin with.
https://github.com/Savagedlight/libifconfig/commit/92fa671bd2451c11c9f1abf68b56295a05af2c85#diff-d2b1298dd60d9c72a5776c8d57a7fe78


> >   Note that this is a backwards-incompatible change. But that's ok,
> because it's
> >   a private library.
> >
> >   MFC after:  3 weeks
> >   Sponsored by:   Spectra Logic Corp
> >   Differential Revision:  https://reviews.freebsd.org/D14463
>
> With 0 feed back?  And a ~30 hour life time?  It is not a diffential if
> no one looks at, comments on, or accepts the revision.
>
>
Actually, it's been under review for nearly nine months, but on Github, not
Phabricator.  You see, the original author lacks a commit bit, and has
developed this library out-of-tree.  It's time we brought it back in,
though.  I know the Phabricator review didn't last very long, but I have a
time limitation on my end.  Feel free to tear it apart in post-commit
review, if you like.

https://github.com/Savagedlight/libifconfig/pull/46

-Alan
___
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: r329854 - head/stand/lua

2018-02-23 Thread Kyle Evans
On Fri, Feb 23, 2018 at 8:49 AM, Rodney W. Grimes
 wrote:
> [ Charset UTF-8 unsupported, converting... ]
>> Author: kevans
>> Date: Fri Feb 23 03:18:24 2018
>> New Revision: 329854
>> URL: https://svnweb.freebsd.org/changeset/base/329854
>>
>> Log:
>>   lualoader: shallowCopyTable => deepCopyTable
>>
>>   I called it a shallow copy, but it wasn't really a shallow copy at all.
>
> Isnt it really neither shallow nor deep, but just CopyTable?
>

I would think (and expect) that CopyTable wouldn't recursively copy
any table values in the table as this version does, opting to
eliminate that entirely and just copying all values as-is.

>> Modified:
>>   head/stand/lua/core.lua
>>   head/stand/lua/menu.lua
>>
>> Modified: head/stand/lua/core.lua
>> ==
>> --- head/stand/lua/core.lua   Fri Feb 23 03:11:43 2018(r329853)
>> +++ head/stand/lua/core.lua   Fri Feb 23 03:18:24 2018(r329854)
>> @@ -286,11 +286,11 @@ function core.isSystem386()
>>  end
>>
>>  -- This may be a better candidate for a 'utility' module.
>> -function core.shallowCopyTable(tbl)
>> +function core.deepCopyTable(tbl)
>>   local new_tbl = {}
>>   for k, v in pairs(tbl) do
>>   if type(v) == "table" then
>> - new_tbl[k] = core.shallowCopyTable(v)
>> + new_tbl[k] = core.deepCopyTable(v)
>>   else
>>   new_tbl[k] = v
>>   end
>>
>> Modified: head/stand/lua/menu.lua
>> ==
>> --- head/stand/lua/menu.lua   Fri Feb 23 03:11:43 2018(r329853)
>> +++ head/stand/lua/menu.lua   Fri Feb 23 03:18:24 2018(r329854)
>> @@ -222,7 +222,7 @@ menu.welcome = {
>>   return menu.welcome.swapped_menu
>>   end
>>   -- Shallow copy the table
>> - menu_entries = core.shallowCopyTable(menu_entries)
>> + menu_entries = core.deepCopyTable(menu_entries)
>>
>>   -- Swap the first two menu entries
>>   menu_entries[1], menu_entries[2] =
>>
>>
>
> --
> 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: r329865 - svnadmin/conf

2018-02-23 Thread Alan Somers
Author: asomers
Date: Fri Feb 23 16:04:44 2018
New Revision: 329865
URL: https://svnweb.freebsd.org/changeset/base/329865

Log:
  Add myself to sizelimits, for the ZFS test suite import

Modified:
  svnadmin/conf/sizelimit.conf

Modified: svnadmin/conf/sizelimit.conf
==
--- svnadmin/conf/sizelimit.confFri Feb 23 11:20:59 2018
(r329864)
+++ svnadmin/conf/sizelimit.confFri Feb 23 16:04:44 2018
(r329865)
@@ -15,6 +15,7 @@
 
 # First field is username, second field is the raised limit required.
 achim
+asomers
 bapt
 davidcs
 dim
___
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: r329866 - head/sys/cam

2018-02-23 Thread Warner Losh
Author: imp
Date: Fri Feb 23 16:06:54 2018
New Revision: 329866
URL: https://svnweb.freebsd.org/changeset/base/329866

Log:
  Use bool instead of int for predicate functions relating to work
  available.

Modified:
  head/sys/cam/cam_iosched.c

Modified: head/sys/cam/cam_iosched.c
==
--- head/sys/cam/cam_iosched.c  Fri Feb 23 16:04:44 2018(r329865)
+++ head/sys/cam/cam_iosched.c  Fri Feb 23 16:06:54 2018(r329866)
@@ -718,22 +718,22 @@ cam_iosched_io_metric_update(struct cam_iosched_softc 
 sbintime_t sim_latency, int cmd, size_t size);
 #endif
 
-static inline int
+static inline bool
 cam_iosched_has_flagged_work(struct cam_iosched_softc *isc)
 {
return !!(isc->flags & CAM_IOSCHED_FLAG_WORK_FLAGS);
 }
 
-static inline int
+static inline bool
 cam_iosched_has_io(struct cam_iosched_softc *isc)
 {
 #ifdef CAM_IOSCHED_DYNAMIC
if (do_dynamic_iosched) {
struct bio *rbp = bioq_first(&isc->bio_queue);
struct bio *wbp = bioq_first(&isc->write_queue);
-   int can_write = wbp != NULL &&
+   bool can_write = wbp != NULL &&
cam_iosched_limiter_caniop(&isc->write_stats, wbp) == 0;
-   int can_read = rbp != NULL &&
+   bool can_read = rbp != NULL &&
cam_iosched_limiter_caniop(&isc->read_stats, rbp) == 0;
if (iosched_debug > 2) {
printf("can write %d: pending_writes %d max_writes 
%d\n", can_write, isc->write_stats.pending, isc->write_stats.max);
@@ -746,7 +746,7 @@ cam_iosched_has_io(struct cam_iosched_softc *isc)
return bioq_first(&isc->bio_queue) != NULL;
 }
 
-static inline int
+static inline bool
 cam_iosched_has_more_trim(struct cam_iosched_softc *isc)
 {
return !(isc->flags & CAM_IOSCHED_FLAG_TRIM_ACTIVE) &&
@@ -757,7 +757,7 @@ cam_iosched_has_more_trim(struct cam_iosched_softc *is
 (isc)->sort_io_queue : cam_sort_io_queues)
 
 
-static inline int
+static inline bool
 cam_iosched_has_work(struct cam_iosched_softc *isc)
 {
 #ifdef CAM_IOSCHED_DYNAMIC
___
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: r329853 - in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug

2018-02-23 Thread Rodney W. Grimes
> On Fri, Feb 23, 2018 at 7:47 AM, Rodney W. Grimes <
> free...@pdx.rh.cn85.dnsmgr.net> wrote:
> 
> > > Author: asomers
> > > Date: Fri Feb 23 03:11:43 2018
> > > New Revision: 329853
> > > URL: https://svnweb.freebsd.org/changeset/base/329853
> > >
> > > Log:
> > >   libifconfig: multiple feature additions
> > >
> > >   Added the ability to:
> > >
> > >   * Create virtual interfaces
> > >   * Create vlan interfaces
> > >   * Get interface fib
> > >   * Get interface groups
> > >   * Get interface status
> > >   * Get nd6 info
> > >   * Get media status
> > >   * Get additional ifaddr info in a convenient struct
> > >   * Get vhids
> > >   * Get carp info
> > >   * Get lagg and laggport status
> > >   * Iterate over all interfaces and ifaddrs
> >
> > Love that list!!!
> > >
> > >   And add more examples, too.
> >
> > Remove MIT 1996 Copyright?
> > Under what conditions is it that this is being done?
> >
> 
> The file's original author removed the extra license block.  It probably
> shouldn't have been there to begin with.
> https://github.com/Savagedlight/libifconfig/commit/92fa671bd2451c11c9f1abf68b56295a05af2c85#diff-d2b1298dd60d9c72a5776c8d57a7fe78

A good commit message summarize ALL changes, sighting the fact
that the MIT copyright was being removed, and with the pointer
to this external source (probalby should of been listed in an
obtained from: line both here in the commit log and in the 
differential.)

> > >   Note that this is a backwards-incompatible change. But that's ok,
> > because it's
> > >   a private library.
> > >
> > >   MFC after:  3 weeks
> > >   Sponsored by:   Spectra Logic Corp
> > >   Differential Revision:  https://reviews.freebsd.org/D14463
> >
> > With 0 feed back?  And a ~30 hour life time?  It is not a diffential if
> > no one looks at, comments on, or accepts the revision.
> >
> >
> Actually, it's been under review for nearly nine months, but on Github, not
> Phabricator.  You see, the original author lacks a commit bit, and has
> developed this library out-of-tree.  It's time we brought it back in,
> though.  I know the Phabricator review didn't last very long, but I have a
> time limitation on my end.  Feel free to tear it apart in post-commit
> review, if you like.
> 
> https://github.com/Savagedlight/libifconfig/pull/46

You failed to sight this external developer as well, that should always
be done in a commit message!

A quick easy fix would be simply add some comments
to the differential that sight both the 2 external links above,
and please appologize to Savageedlight for failing to attribe
them in this commit message.  The commit references the differential,
so that would lead someone down the right road in the future.

Thanks,
-- 
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: r329868 - svnadmin/conf

2018-02-23 Thread Alan Somers
Author: asomers
Date: Fri Feb 23 16:36:55 2018
New Revision: 329868
URL: https://svnweb.freebsd.org/changeset/base/329868

Log:
  Drop privileges taken in r329865

Modified:
  svnadmin/conf/sizelimit.conf

Modified: svnadmin/conf/sizelimit.conf
==
--- svnadmin/conf/sizelimit.confFri Feb 23 16:31:00 2018
(r329867)
+++ svnadmin/conf/sizelimit.confFri Feb 23 16:36:55 2018
(r329868)
@@ -15,7 +15,6 @@
 
 # First field is username, second field is the raised limit required.
 achim
-asomers
 bapt
 davidcs
 dim
___
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: r329869 - stable/11/usr.sbin/bsdinstall/partedit

2018-02-23 Thread Ravi Pokala
Author: rpokala
Date: Fri Feb 23 16:45:59 2018
New Revision: 329869
URL: https://svnweb.freebsd.org/changeset/base/329869

Log:
  MFC r323508:
  
  When doing a non-interactive installation, don't display an interactive
  warning about a filesystem which doesn't have a mountpoint. Presumably, the
  person who wrote the install script knew what they were doing.

Modified:
  stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c

Modified: stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c
==
--- stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c  Fri Feb 23 16:36:55 
2018(r329868)
+++ stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c  Fri Feb 23 16:45:59 
2018(r329869)
@@ -1034,14 +1034,17 @@ addpartform:
/* Warn if no mountpoint set */
if (strcmp(items[0].text, "freebsd-ufs") == 0 &&
items[2].text[0] != '/') {
-   dialog_vars.defaultno = TRUE;
-   choice = dialog_yesno("Warning",
-   "This partition does not have a valid mountpoint "
-   "(for the partition from which you intend to boot the "
-   "operating system, the mountpoint should be /). Are you "
-   "sure you want to continue?"
-   , 0, 0);
-   dialog_vars.defaultno = FALSE;
+   choice = 0;
+   if (interactive) {
+   dialog_vars.defaultno = TRUE;
+   choice = dialog_yesno("Warning",
+   "This partition does not have a valid mountpoint "
+   "(for the partition from which you intend to boot 
the "
+   "operating system, the mountpoint should be /). Are 
you "
+   "sure you want to continue?"
+   , 0, 0);
+   dialog_vars.defaultno = FALSE;
+   }
if (choice == 1) /* cancel */
goto addpartform;
}
___
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: r329870 - stable/10/usr.sbin/bsdinstall/partedit

2018-02-23 Thread Ravi Pokala
Author: rpokala
Date: Fri Feb 23 16:46:49 2018
New Revision: 329870
URL: https://svnweb.freebsd.org/changeset/base/329870

Log:
  MFC r323508:
  
  When doing a non-interactive installation, don't display an interactive
  warning about a filesystem which doesn't have a mountpoint. Presumably, the
  person who wrote the install script knew what they were doing.

Modified:
  stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c
==
--- stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c  Fri Feb 23 16:45:59 
2018(r329869)
+++ stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c  Fri Feb 23 16:46:49 
2018(r329870)
@@ -1034,14 +1034,17 @@ addpartform:
/* Warn if no mountpoint set */
if (strcmp(items[0].text, "freebsd-ufs") == 0 &&
items[2].text[0] != '/') {
-   dialog_vars.defaultno = TRUE;
-   choice = dialog_yesno("Warning",
-   "This partition does not have a valid mountpoint "
-   "(for the partition from which you intend to boot the "
-   "operating system, the mountpoint should be /). Are you "
-   "sure you want to continue?"
-   , 0, 0);
-   dialog_vars.defaultno = FALSE;
+   choice = 0;
+   if (interactive) {
+   dialog_vars.defaultno = TRUE;
+   choice = dialog_yesno("Warning",
+   "This partition does not have a valid mountpoint "
+   "(for the partition from which you intend to boot 
the "
+   "operating system, the mountpoint should be /). Are 
you "
+   "sure you want to continue?"
+   , 0, 0);
+   dialog_vars.defaultno = FALSE;
+   }
if (choice == 1) /* cancel */
goto addpartform;
}
___
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: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys s

2018-02-23 Thread Bruce Evans

On Fri, 23 Feb 2018, Warner Losh wrote:


On Thu, Feb 22, 2018 at 11:12 PM, Bruce Evans  wrote:


On Fri, 23 Feb 2018, Warner Losh wrote:

* ...

Modified: head/sys/arm/include/_types.h


==
--- head/sys/arm/include/_types.h   Fri Feb 23 04:04:18 2018
(r329858)
+++ head/sys/arm/include/_types.h   Fri Feb 23 04:04:25 2018
(r329859)
@@ -70,8 +70,10 @@ typedef  unsigned long long  __uint64_t;
 */
typedef __uint32_t  __clock_t;  /* clock()... */
typedef __int32_t   __critical_t;
+#ifndef _STANDALONE
typedef double  __double_t;
typedef float   __float_t;
+#endif
typedef __int32_t   __intfptr_t;
typedef __int64_t   __intmax_t;
typedef __int32_t   __intptr_t;


__types.h headers exist to avoid ifdefs like this.  They only define types
in the implementation namespace.  Nothing except  should use
__double_t or __float_t directly.  There is only a problem if some option
like -fno-float turns off floating point completely, so that 'float' is
a syntax error.


Right. Except, there's no longer a -fno-float option. Then again, these
should almost certainly be in sys/_types instead because they are identical
on every platform and will almost certainly never ever be anything other
than what they are.

For the boot loader, I spiked double and float definitions so that we don't
touch floating point types at all. We do this in the Makefile by
intentionally creating syntax errors. I don't think this is undefined
behavior, I think it is well defined behavior: A syntax error is a syntax
error. We're using a restricted set of C for the loader anyway. It's mostly
to prevent accidental use of floating point.


It is more undefined than most undefined things.  E.g., C99 7.1.3p2 says:

   If the program ... defines a reserved identifier as a macro name,
   the behavior is undefined.

Even K&R support was much more careful.  E.g., to avoid defining away const,
it spelled const as __const and defined __const as nothing for K&R and as
const for C99 and later.   still has ifdef tangles to support
this, but they are almost useless since other headers no longer use __const
and even  uses plain const in many places.  Also, the
defining away of __const is now under a very confusing condition
(_CC_SUPPORTS___INLINE).  The connection with __inline is that __inline is
gcc's pre-C99 spelling of inline.  gcc also has __const, which is a pre-C90
spelling of const.  The FreeBSD semantics for __const are tangled up with
the gcc semantics (FreeBSD wants to keep __const as itself and not define
it away for gcc with pre-C90 support).

 does define away const, etc under the even more arcane option
(_CC_SUPPORTS___INLINE && NO_ANSI_KEYWORDS.  (Hmm, NO_ANSI_KEYWORDS is
namespace pollution.)

You don't want these complications for float and double.


If we ever support floats and such in the boot loader, I'll revert. This


Kernel programmers have no difficulty not using floats in kernel code.

I actually use doubles in tsc.c to do cperciva's statistics.  This is
much easier than using fixed point.  Compilers don't quite support it.
I have to remove -msoft-float and compile with gcc.  clang refuses
inline __builtin_sqrtl().


helps us catch accidents like one of the lua files being compiled
incorrectly, leading to stray references to float/double on arm which
caused float stuff to be referenced and pulled in due to inlining. That's
the real bug, and that's been fixed. Until we need float/double in the
loader, I'll keep this in place to prevent a recurrence.


Floating point is even easier to use in boot code than in the kernel.
In tsc.c, I don't bother obtaining ownership of the FPU by the thread,
but just use it.  This works because there aren't really any threads
early in the boot.  Similarly in boot code.  The initialization is:

XX   * Since we want this calculation to be as accurate as possible, and
XX   * we cannot use the FPU at this point in the boot cycle, we resort to
XX   * fixed-point arithmetic, shifting everything as far left as we can
XX   * rely on being safe: The mean TSC is bounded by the maximum TSC, and

Above comment by cperciva.

XX  /* Contrary to the comment, we can use the npx especially easily. */
XX  __asm __volatile("clts; fninit");

This wasn't so easy in 1992 when on x86's the FPU might have been separate
or emulated.

Compilers might generate FPU use even if there is no explicit use of
floating point in the program, but this is normally turned off in boot
code and kernels using -msoft-float [-mno-sse -m-no-sse2 -mno-sse3 ...].
That should be enough.  Other errors are very easy to find since they
cause linkage failures like for my __builtin_sqrtl().  (gcc compiles
my FP with -msoft-float on i386, but then there are linkage errors for
the nonexistent soft-float support.  On amd64, -msoft-float is not
supported since it uses an incompatible ABI, so the error

svn commit: r329871 - stable/11

2018-02-23 Thread Ravi Pokala
Author: rpokala
Date: Fri Feb 23 16:51:20 2018
New Revision: 329871
URL: https://svnweb.freebsd.org/changeset/base/329871

Log:
  Somehow r329870 disn't include the mergeinfo...?

Modified:
Directory Properties:
  stable/11/   (props changed)
___
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: r329871 - stable/11

2018-02-23 Thread Ravi Pokala
-Original Message-
From:  on behalf of Ravi Pokala 

Date: 2018-02-23, Friday at 08:51
To: , , 
, 
Subject: svn commit: r329871 - stable/11

> Author: rpokala
> Date: Fri Feb 23 16:51:20 2018
> New Revision: 329871
> URL: https://svnweb.freebsd.org/changeset/base/329871
> 
> Log:
>   Somehow r329870 disn't include the mergeinfo...?

That should be r329869 of course.

> Modified:
> Directory Properties:
>   stable/11/   (props changed)



___
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: r329872 - head/usr.sbin/mptutil

2018-02-23 Thread Alan Somers
Author: asomers
Date: Fri Feb 23 17:20:53 2018
New Revision: 329872
URL: https://svnweb.freebsd.org/changeset/base/329872

Log:
  Delete copypasta
  
  Reported by:  rpokala
  MFC after:20 days
  X-MFC-With:   329845
  Sponsored by: Spectra Logic Corp

Modified:
  head/usr.sbin/mptutil/mpt_config.c

Modified: head/usr.sbin/mptutil/mpt_config.c
==
--- head/usr.sbin/mptutil/mpt_config.c  Fri Feb 23 16:51:20 2018
(r329871)
+++ head/usr.sbin/mptutil/mpt_config.c  Fri Feb 23 17:20:53 2018
(r329872)
@@ -961,7 +961,6 @@ add_spare(int ac, char **av)
if (error != 0) {
warn("Failed to fetch standalone disk list");
mpt_free_pd_list(list);
-   mpt_free_pd_list(list);
close(fd);
return (error);
}
@@ -971,14 +970,12 @@ add_spare(int ac, char **av)
error = errno;
warn("Unable to lookup drive %s", av[1]);
mpt_free_pd_list(list);
-   mpt_free_pd_list(list);
close(fd);
return (error);
}
 
if (mpt_lock_physdisk(&sdisks[i]) < 0) {
mpt_free_pd_list(list);
-   mpt_free_pd_list(list);
close(fd);
return (errno);
}
@@ -986,7 +983,6 @@ add_spare(int ac, char **av)
if (mpt_create_physdisk(fd, &sdisks[i], &PhysDiskNum) < 0) {
error = errno;
warn("Failed to create physical disk page");
-   mpt_free_pd_list(list);
mpt_free_pd_list(list);
close(fd);
return (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: r329873 - in head/sys: amd64/linux amd64/linux32 compat/freebsd32 dev/aic7xxx dev/drm2 dev/xen/blkback dev/xen/netback i386/ibcs2 i386/linux i386/pci kern netgraph x86/include

2018-02-23 Thread Ed Maste
Author: emaste
Date: Fri Feb 23 18:15:50 2018
New Revision: 329873
URL: https://svnweb.freebsd.org/changeset/base/329873

Log:
  Correct pseudo misspelling in sys/ comments
  
  contrib code and #define in intel_ata.h unchanged.

Modified:
  head/sys/amd64/linux/syscalls.master
  head/sys/amd64/linux32/syscalls.master
  head/sys/compat/freebsd32/syscalls.master
  head/sys/dev/aic7xxx/aic7xxx.seq
  head/sys/dev/drm2/drm_fb_helper.c
  head/sys/dev/xen/blkback/blkback.c
  head/sys/dev/xen/netback/netback.c
  head/sys/i386/ibcs2/syscalls.master
  head/sys/i386/linux/syscalls.master
  head/sys/i386/pci/pci_pir.c
  head/sys/kern/syscalls.master
  head/sys/netgraph/ng_atmllc.c
  head/sys/x86/include/apicvar.h

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterFri Feb 23 17:20:53 2018
(r329872)
+++ head/sys/amd64/linux/syscalls.masterFri Feb 23 18:15:50 2018
(r329873)
@@ -12,7 +12,7 @@
 ;  case where the event exists, but we don't want auditing, the
 ;  event should be #defined to AUE_NULL in audit_kevents.h.
 ;  typeone of STD, NOPROTO, UNIMPL
-;  namepsuedo-prototype of syscall routine
+;  namepseudo-prototype of syscall routine
 ;  If one of the following alts is different, then all appear:
 ;  altname name of system call if different
 ;  alttag  name of args struct tag if different from [o]`name'"_args"

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Fri Feb 23 17:20:53 2018
(r329872)
+++ head/sys/amd64/linux32/syscalls.master  Fri Feb 23 18:15:50 2018
(r329873)
@@ -12,7 +12,7 @@
 ;  case where the event exists, but we don't want auditing, the
 ;  event should be #defined to AUE_NULL in audit_kevents.h.
 ;  typeone of STD, NOPROTO, UNIMPL
-;  namepsuedo-prototype of syscall routine
+;  namepseudo-prototype of syscall routine
 ;  If one of the following alts is different, then all appear:
 ;  altname name of system call if different
 ;  alttag  name of args struct tag if different from [o]`name'"_args"

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Fri Feb 23 17:20:53 2018
(r329872)
+++ head/sys/compat/freebsd32/syscalls.master   Fri Feb 23 18:15:50 2018
(r329873)
@@ -16,7 +16,7 @@
 ;  COMPAT7, COMPAT11, NODEF, NOARGS, NOPROTO, NOSTD
 ;  The COMPAT* options may be combined with one or more NO*
 ;  options separated by '|' with no spaces (e.g. COMPAT|NOARGS)
-;  namepsuedo-prototype of syscall routine
+;  namepseudo-prototype of syscall routine
 ;  If one of the following alts is different, then all appear:
 ;  altname name of system call if different
 ;  alttag  name of args struct tag if different from [o]`name'"_args"

Modified: head/sys/dev/aic7xxx/aic7xxx.seq
==
--- head/sys/dev/aic7xxx/aic7xxx.seqFri Feb 23 17:20:53 2018
(r329872)
+++ head/sys/dev/aic7xxx/aic7xxx.seqFri Feb 23 18:15:50 2018
(r329873)
@@ -57,7 +57,7 @@ PREFIX = "ahc_"
  * a later time.  This problem cannot be resolved by holding a single entry
  * in scratch ram since a reconnecting target can request sense and this will
  * create yet another SCB waiting for selection.  The solution used here is to 
- * use byte 27 of the SCB as a psuedo-next pointer and to thread a list
+ * use byte 27 of the SCB as a pseudo-next pointer and to thread a list
  * of SCBs that are awaiting selection.  Since 0-0xfe are valid SCB indexes, 
  * SCB_LIST_NULL is 0xff which is out of range.  An entry is also added to
  * this list every time a request sense occurs or after completing a non-tagged

Modified: head/sys/dev/drm2/drm_fb_helper.c
==
--- head/sys/dev/drm2/drm_fb_helper.c   Fri Feb 23 17:20:53 2018
(r329872)
+++ head/sys/dev/drm2/drm_fb_helper.c   Fri Feb 23 18:15:50 2018
(r329873)
@@ -580,7 +580,7 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u
if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
u32 *palette;
u32 value;
-   /* place color in psuedopalette */
+   /* place color in pseudopalette */
if (regno > 16)
return -EINVAL;
palette = (u32 *)info->pseudo_palette;

Modified: head/sys/dev/xen/blkback/blkback.c
==
--- head/sy

svn commit: r329874 - in head: etc/mtree tests/sys/net

2018-02-23 Thread Alan Somers
Author: asomers
Date: Fri Feb 23 18:18:42 2018
New Revision: 329874
URL: https://svnweb.freebsd.org/changeset/base/329874

Log:
  Add tests for lagg(4) and other cloned network interfaces
  
  Unfortunately, most of the tests are disabled because they fairly frequently
  trigger panics.
  
  MFC after:3 weeks
  Sponsored by: Spectra Logic Corp

Added:
  head/tests/sys/net/
  head/tests/sys/net/Makefile   (contents, props changed)
  head/tests/sys/net/if_clone_test.sh   (contents, props changed)
  head/tests/sys/net/if_lagg_test.sh   (contents, props changed)
  head/tests/sys/net/randsleep.c   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Fri Feb 23 18:15:50 2018
(r329873)
+++ head/etc/mtree/BSD.tests.dist   Fri Feb 23 18:18:42 2018
(r329874)
@@ -730,6 +730,8 @@
 ..
 mqueue
 ..
+net
+..
 netinet
 ..
 netipsec

Added: head/tests/sys/net/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/net/Makefile Fri Feb 23 18:18:42 2018(r329874)
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/sys/net
+BINDIR=${TESTSDIR}
+
+ATF_TESTS_SH+= if_lagg_test
+ATF_TESTS_SH+= if_clone_test
+
+# The tests are written to be run in parallel, but doing so leads to random
+# panics.  I think it's because the kernel's list of interfaces isn't properly
+# locked.
+TEST_METADATA+=is_exclusive=true
+
+MAN=
+PROG=  randsleep
+
+WARNS?=6
+
+.include 

Added: head/tests/sys/net/if_clone_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/net/if_clone_test.sh Fri Feb 23 18:18:42 2018
(r329874)
@@ -0,0 +1,511 @@
+#
+#  Copyright (c) 2014 Spectra Logic Corporation
+#  All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#  1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions, and the following disclaimer,
+# without modification.
+#  2. Redistributions in binary form must reproduce at minimum a disclaimer
+# substantially similar to the "NO WARRANTY" disclaimer below
+# ("Disclaimer") and any redistribution must be conditioned upon
+# including a substantially similar Disclaimer requirement for further
+# binary redistribution.
+#
+#  NO WARRANTY
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#  HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+#
+#  Authors: Alan Somers (Spectra Logic Corporation)
+#
+# $FreeBSD$
+
+# Outline:
+# For each cloned interface type, do three tests
+# 1) Create and destroy it
+# 2) Create, up, and destroy it
+# 3) Create, disable IPv6 auto address assignment, up, and destroy it
+
+TESTLEN=10 # seconds
+
+atf_test_case faith_stress cleanup
+faith_stress_head()
+{
+   atf_set "descr" "Simultaneously create and destroy a faith(4)"
+   atf_set "require.user" "root"
+}
+faith_stress_body()
+{
+   do_stress "faith"
+}
+faith_stress_cleanup()
+{
+   cleanup_ifaces
+}
+
+atf_test_case faith_up_stress cleanup
+faith_up_stress_head()
+{
+   atf_set "descr" "Simultaneously up and destroy a faith(4)"
+   atf_set "require.user" "root"
+}
+faith_up_stress_body()
+{
+   atf_skip "Quickly panics: if_freemulti: protospec not NULL"
+   do_up_stress "faith" "" ""
+}
+faith_up_stress_cleanup()
+{
+   cleanup_ifaces
+}
+
+atf_test_case faith_ipv6_up_stress cleanup
+faith_ipv6_up_stress_head()
+{
+   atf_set "descr" "Simultaneously up and destroy a faith(4) with IPv6"
+   atf_set "require.user" "root"
+}
+faith_ipv6_up_stress_body()
+{
+   atf_skip "Quickly panics: if_freemulti: protospec not NULL"
+   do_up_stress "faith" "6" ""
+}
+faith_ipv6_up_stress_cleanup()
+{
+   cleanup_ifaces
+}
+
+atf_test_case gif_stress cleanup

svn commit: r329875 - head/sys/kern

2018-02-23 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 23 18:26:31 2018
New Revision: 329875
URL: https://svnweb.freebsd.org/changeset/base/329875

Log:
  Restore UP build.
  
  Reviewed by:  truckman
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Fri Feb 23 18:18:42 2018(r329874)
+++ head/sys/kern/sched_ule.c   Fri Feb 23 18:26:31 2018(r329875)
@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio)
td->td_flags |= TDF_NEEDRESCHED;
 }
 
+#ifdef SMP
 /*
  * This tdq is about to idle.  Try to steal a thread from another CPU before
  * choosing the idle thread.
@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq)
}
spinlock_exit();
 }
+#endif
 
 /*
  * Handle migration from sched_switch().  This happens only for
@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd, 
TDQ_LOCK(tdq);
mtx = thread_lock_block(td);
tdq_load_rem(tdq, td);
+#ifdef SMP
if (tdq->tdq_load == 0)
tdq_trysteal(tdq);
+#endif
}
 
 #if (KTR_COMPILE & KTR_SCHED) != 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: r329865 - svnadmin/conf

2018-02-23 Thread Andriy Gapon
On 23/02/2018 18:04, Alan Somers wrote:
> Author: asomers
> Date: Fri Feb 23 16:04:44 2018
> New Revision: 329865
> URL: https://svnweb.freebsd.org/changeset/base/329865
> 
> Log:
>   Add myself to sizelimits, for the ZFS test suite import

Hyper excited!
:-)

> Modified:
>   svnadmin/conf/sizelimit.conf
> 

-- 
Andriy Gapon
___
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: r329876 - head/sys/amd64/linux

2018-02-23 Thread Ed Maste
Author: emaste
Date: Fri Feb 23 19:09:27 2018
New Revision: 329876
URL: https://svnweb.freebsd.org/changeset/base/329876

Log:
  Use linux types for linux-specific syscalls
  
  Sponsored by: Turing Robotic Industries Inc.
  Differential Revision:https://reviews.freebsd.org/D14065

Modified:
  head/sys/amd64/linux/syscalls.master

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterFri Feb 23 18:26:31 2018
(r329875)
+++ head/sys/amd64/linux/syscalls.masterFri Feb 23 19:09:27 2018
(r329876)
@@ -58,8 +58,8 @@
 9  AUE_MMAPSTD { int linux_mmap2(l_ulong addr, l_ulong len, \
l_ulong prot, l_ulong flags, l_ulong fd, \
l_ulong pgoff); }
-10 AUE_MPROTECTSTD { int linux_mprotect(caddr_t addr, int len, \
-   int prot); }
+10 AUE_MPROTECTSTD { int linux_mprotect(caddr_t addr, l_int len, \
+   l_int prot); }
 11 AUE_MUNMAP  NOPROTO { int munmap(caddr_t addr, int len); }
 12 AUE_NULLSTD { int linux_brk(l_ulong dsend); }
 13 AUE_NULLSTD { int linux_rt_sigaction(l_int sig, \
@@ -115,7 +115,7 @@
struct l_itimerval *itv, \
struct l_itimerval *oitv); }
 39 AUE_GETPID  STD { int linux_getpid(void); }
-40 AUE_SENDFILESTD { int linux_sendfile(int out, int in, \
+40 AUE_SENDFILESTD { int linux_sendfile(l_int out, l_int in, \
l_long *offset, l_size_t count); }
 41 AUE_SOCKET  STD { int linux_socket(l_int domain, l_int type, \
l_int protocol); }
@@ -150,12 +150,12 @@
l_int optname, l_uintptr_t optval, \
l_uintptr_t optlen); }
 56 AUE_RFORK   STD { int linux_clone(l_int flags, void *stack, \
-   void *parent_tidptr, void * child_tidptr, 
void *tls ); }
+   void *parent_tidptr, void *child_tidptr, 
void *tls); }
 57 AUE_FORKSTD { int linux_fork(void); }
 58 AUE_VFORK   STD { int linux_vfork(void); }
 59 AUE_EXECVE  STD { int linux_execve(char *path, char **argp, \
char **envp); }
-60 AUE_EXITSTD { void linux_exit(int rval); }
+60 AUE_EXITSTD { void linux_exit(l_int rval); }
 61 AUE_WAIT4   STD { int linux_wait4(l_pid_t pid, \
l_int *status, l_int options, \
struct rusage *rusage); }
@@ -281,7 +281,7 @@
struct l_statfs_buf *buf); }
 139AUE_NULLSTD { int linux_sysfs(l_int option, \
l_ulong arg1, l_ulong arg2); }
-140AUE_GETPRIORITY STD { int linux_getpriority(int which, int who); }
+140AUE_GETPRIORITY STD { int linux_getpriority(l_int which, l_int 
who); }
 141AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \
int prio); }
 142AUE_SCHED_SETPARAM  STD { int linux_sched_setparam(l_pid_t pid, 
\
@@ -359,10 +359,10 @@
 197AUE_NULLSTD { int linux_removexattr(void); }
 198AUE_NULLSTD { int linux_lremovexattr(void); }
 199AUE_NULLSTD { int linux_fremovexattr(void); }
-200AUE_NULLSTD { int linux_tkill(int tid, int sig); }
+200AUE_NULLSTD { int linux_tkill(l_int tid, l_int sig); }
 201AUE_NULLSTD { int linux_time(l_time_t *tm); }
-202AUE_NULLSTD { int linux_sys_futex(void *uaddr, int op, int 
val, \
-   struct l_timespec *timeout, void *uaddr2, 
int val3); }
+202AUE_NULLSTD { int linux_sys_futex(void *uaddr, l_int op, 
l_int val, \
+   struct l_timespec *timeout, void *uaddr2, 
l_int val3); }
 203AUE_NULLSTD { int linux_sched_setaffinity(l_pid_t pid, 
l_uint len, \
l_ulong *user_mask_ptr); }
 204AUE_NULLSTD { int linux_sched_getaffinity(l_pid_t pid, 
l_uint len, \
@@ -381,11 +381,11 @@
 216AUE_NULLSTD { int linux_remap_file_pages(void); }
 217AUE_GETDIRENTRIES   STD { int linux_getdents64(l_uint fd, \
void *dirent, l_uint count); }
-218AUE_NULLSTD { int linux_set_tid_address(int *tidptr); }
+218AUE_NULLSTD { int linux_set_tid_address(l_int *tidptr); }
 219AUE_NULLUNIMPL  restart_syscall
 220AUE_NULLSTD { int linux_semtim

svn commit: r329877 - head/sys/dev/isci/scil

2018-02-23 Thread Ed Maste
Author: emaste
Date: Fri Feb 23 20:01:42 2018
New Revision: 329877
URL: https://svnweb.freebsd.org/changeset/base/329877

Log:
  Correct typo in ATA_WRITE_UNCORRECTABLE_PSEUDO
  
  Also correct a typo in the comment for these values, noted by jimharris.
  
  Reviewed by:  jimharris
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D3715

Modified:
  head/sys/dev/isci/scil/intel_ata.h
  head/sys/dev/isci/scil/sati_write_long.c

Modified: head/sys/dev/isci/scil/intel_ata.h
==
--- head/sys/dev/isci/scil/intel_ata.h  Fri Feb 23 19:09:27 2018
(r329876)
+++ head/sys/dev/isci/scil/intel_ata.h  Fri Feb 23 20:01:42 2018
(r329877)
@@ -301,13 +301,13 @@
 /*@}*/
 
 /**
- * @name ATA_WRITE_UNCORRECTIABLE feature field values
+ * @name ATA_WRITE_UNCORRECTABLE feature field values
  *
  * These constants define the Write Uncorrectable feature values
  * used with the SATI translation.
  */
 /*@{*/
-#define ATA_WRITE_UNCORRECTABLE_PSUEDO0x55
+#define ATA_WRITE_UNCORRECTABLE_PSEUDO0x55
 #define ATA_WRITE_UNCORRECTABLE_FLAGGED   0xAA
 /*@}*/
 

Modified: head/sys/dev/isci/scil/sati_write_long.c
==
--- head/sys/dev/isci/scil/sati_write_long.cFri Feb 23 19:09:27 2018
(r329876)
+++ head/sys/dev/isci/scil/sati_write_long.cFri Feb 23 20:01:42 2018
(r329877)
@@ -176,7 +176,7 @@ SATI_STATUS sati_write_long_translate_command(
 sati_ata_write_uncorrectable_construct(
ata_io,
sequence,
-   ATA_WRITE_UNCORRECTABLE_PSUEDO
+   ATA_WRITE_UNCORRECTABLE_PSEUDO
 );
 sequence->type = SATI_SEQUENCE_WRITE_LONG;
 status = SATI_SUCCESS;
@@ -188,7 +188,7 @@ SATI_STATUS sati_write_long_translate_command(
  sati_ata_write_uncorrectable_construct(
 ata_io,
 sequence,
-ATA_WRITE_UNCORRECTABLE_PSUEDO
+ATA_WRITE_UNCORRECTABLE_PSEUDO
  );
  sequence->type = SATI_SEQUENCE_WRITE_LONG;
  status = SATI_SUCCESS;
___
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: r329878 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include crypto/aesni crypto/armv8 crypto/via dev/efidev dev/random i386/i386 i386/include

2018-02-23 Thread Conrad Meyer
Author: cem
Date: Fri Feb 23 20:15:19 2018
New Revision: 329878
URL: https://svnweb.freebsd.org/changeset/base/329878

Log:
  Remove unused error return from API that cannot fail
  
  No implementation of fpu_kern_enter() can fail, and it was causing needless
  error checking boilerplate and confusion. Change the return code to void to
  match reality.
  
  (This trivial change took nine days to land because of the commit hook on
  sys/dev/random.  Please consider removing the hook or otherwise lowering the
  bar -- secteam never seems to have free time to review patches.)
  
  Reported by:  Lachlan McIlroy 
  Reviewed by:  delphij
  Approved by:  secteam (delphij)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D14380

Modified:
  head/sys/amd64/amd64/fpu.c
  head/sys/amd64/include/fpu.h
  head/sys/arm64/arm64/vfp.c
  head/sys/arm64/include/vfp.h
  head/sys/crypto/aesni/aesni.c
  head/sys/crypto/armv8/armv8_crypto.c
  head/sys/crypto/via/padlock.c
  head/sys/crypto/via/padlock_cipher.c
  head/sys/crypto/via/padlock_hash.c
  head/sys/dev/efidev/efirt.c
  head/sys/dev/random/nehemiah.c
  head/sys/i386/i386/npx.c
  head/sys/i386/include/npx.h

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Fri Feb 23 20:01:42 2018(r329877)
+++ head/sys/amd64/amd64/fpu.c  Fri Feb 23 20:15:19 2018(r329878)
@@ -965,7 +965,7 @@ fpu_kern_ctx_savefpu(struct fpu_kern_ctx *ctx)
return ((struct savefpu *)p);
 }
 
-int
+void
 fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags)
 {
struct pcb *pcb;
@@ -997,11 +997,11 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx 
fpurestore(fpu_initialstate);
set_pcb_flags(pcb, PCB_KERNFPU | PCB_FPUNOSAVE |
PCB_FPUINITDONE);
-   return (0);
+   return;
}
if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) {
ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE;
-   return (0);
+   return;
}
KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save ==
get_pcb_user_save_pcb(pcb), ("mangled pcb_save"));
@@ -1013,7 +1013,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx 
pcb->pcb_save = fpu_kern_ctx_savefpu(ctx);
set_pcb_flags(pcb, PCB_KERNFPU);
clear_pcb_flags(pcb, PCB_FPUINITDONE);
-   return (0);
+   return;
 }
 
 int

Modified: head/sys/amd64/include/fpu.h
==
--- head/sys/amd64/include/fpu.hFri Feb 23 20:01:42 2018
(r329877)
+++ head/sys/amd64/include/fpu.hFri Feb 23 20:15:19 2018
(r329878)
@@ -72,7 +72,7 @@ int   fputrap_x87(void);
 void   fpuuserinited(struct thread *td);
 struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags);
 void   fpu_kern_free_ctx(struct fpu_kern_ctx *ctx);
-intfpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,
+void   fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,
u_int flags);
 intfpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx);
 intfpu_kern_thread(u_int flags);

Modified: head/sys/arm64/arm64/vfp.c
==
--- head/sys/arm64/arm64/vfp.c  Fri Feb 23 20:01:42 2018(r329877)
+++ head/sys/arm64/arm64/vfp.c  Fri Feb 23 20:15:19 2018(r329878)
@@ -256,7 +256,7 @@ fpu_kern_free_ctx(struct fpu_kern_ctx *ctx)
free(ctx, M_FPUKERN_CTX);
 }
 
-int
+void
 fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags)
 {
struct pcb *pcb;
@@ -279,12 +279,12 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx 
vfp_enable();
pcb->pcb_fpflags |= PCB_FP_KERN | PCB_FP_NOSAVE |
PCB_FP_STARTED;
-   return (0);
+   return;
}
 
if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) {
ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE;
-   return (0);
+   return;
}
/*
 * Check either we are already using the VFP in the kernel, or
@@ -300,7 +300,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx 
pcb->pcb_fpflags |= PCB_FP_KERN;
pcb->pcb_fpflags &= ~PCB_FP_STARTED;
 
-   return (0);
+   return;
 }
 
 int

Modified: head/sys/arm64/include/vfp.h
==
--- head/sys/arm64/include/vfp.hFri Feb 23 20:01:42 2018
(r329877)
+++ head/sys/arm64/include/vfp.hFri Feb 23 20:15:19 2018
(r329878)
@@ -60,7 +60,7 @@ struct fpu_kern_ctx;
 
 struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int);
 void fpu_kern_free_ctx(struct fpu_kern_ctx *);
-int fpu_kern_enter(str

svn commit: r329879 - in head/stand: libsa userboot/userboot zfs

2018-02-23 Thread Conrad Meyer
Author: cem
Date: Fri Feb 23 20:18:09 2018
New Revision: 329879
URL: https://svnweb.freebsd.org/changeset/base/329879

Log:
  libsa: Const-ify buffer argument of write(2) analog
  
  Reported by:  kevans
  Reviewed by:  delphij, eadler, imp, kevans
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D14482

Modified:
  head/stand/libsa/cd9660.c
  head/stand/libsa/nfs.c
  head/stand/libsa/nullfs.c
  head/stand/libsa/stand.h
  head/stand/libsa/tftp.c
  head/stand/libsa/ufs.c
  head/stand/libsa/write.c
  head/stand/userboot/userboot/host.c
  head/stand/zfs/zfs.c

Modified: head/stand/libsa/cd9660.c
==
--- head/stand/libsa/cd9660.c   Fri Feb 23 20:15:19 2018(r329878)
+++ head/stand/libsa/cd9660.c   Fri Feb 23 20:18:09 2018(r329879)
@@ -66,7 +66,7 @@ static intcd9660_open(const char *path, struct open_f
 static int cd9660_close(struct open_file *f);
 static int cd9660_read(struct open_file *f, void *buf, size_t size,
size_t *resid);
-static int cd9660_write(struct open_file *f, void *buf, size_t size,
+static int cd9660_write(struct open_file *f, const void *buf, size_t size,
size_t *resid);
 static off_t   cd9660_seek(struct open_file *f, off_t offset, int where);
 static int cd9660_stat(struct open_file *f, struct stat *sb);
@@ -557,7 +557,8 @@ again:
 }
 
 static int
-cd9660_write(struct open_file *f __unused, void *start __unused, size_t size 
__unused, size_t *resid __unused)
+cd9660_write(struct open_file *f __unused, const void *buf __unused,
+size_t size __unused, size_t *resid __unused)
 {
return EROFS;
 }

Modified: head/stand/libsa/nfs.c
==
--- head/stand/libsa/nfs.c  Fri Feb 23 20:15:19 2018(r329878)
+++ head/stand/libsa/nfs.c  Fri Feb 23 20:18:09 2018(r329879)
@@ -126,7 +126,6 @@ struct nfs_iodesc {
 intnfs_open(const char *path, struct open_file *f);
 static int nfs_close(struct open_file *f);
 static int nfs_read(struct open_file *f, void *buf, size_t size, size_t 
*resid);
-static int nfs_write(struct open_file *f, void *buf, size_t size, size_t 
*resid);
 static off_t   nfs_seek(struct open_file *f, off_t offset, int where);
 static int nfs_stat(struct open_file *f, struct stat *sb);
 static int nfs_readdir(struct open_file *f, struct dirent *d);
@@ -138,7 +137,7 @@ struct fs_ops nfs_fsops = {
nfs_open,
nfs_close,
nfs_read,
-   nfs_write,
+   null_write,
nfs_seek,
nfs_stat,
nfs_readdir
@@ -713,15 +712,6 @@ ret:
*resid = size;
 
return (0);
-}
-
-/*
- * Not implemented.
- */
-int
-nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
-{
-   return (EROFS);
 }
 
 off_t

Modified: head/stand/libsa/nullfs.c
==
--- head/stand/libsa/nullfs.c   Fri Feb 23 20:15:19 2018(r329878)
+++ head/stand/libsa/nullfs.c   Fri Feb 23 20:18:09 2018(r329879)
@@ -83,7 +83,7 @@ int   null_read (struct open_file *f, void *buf, size_t 
return EIO;
 }
 
-intnull_write (struct open_file *f, void *buf, size_t size, size_t *resid)
+intnull_write (struct open_file *f, const void *buf, size_t size, size_t 
*resid)
 {
return EIO;
 }

Modified: head/stand/libsa/stand.h
==
--- head/stand/libsa/stand.hFri Feb 23 20:15:19 2018(r329878)
+++ head/stand/libsa/stand.hFri Feb 23 20:18:09 2018(r329879)
@@ -105,7 +105,7 @@ struct fs_ops {
 int(*fo_close)(struct open_file *f);
 int(*fo_read)(struct open_file *f, void *buf,
   size_t size, size_t *resid);
-int(*fo_write)(struct open_file *f, void *buf,
+int(*fo_write)(struct open_file *f, const void *buf,
size_t size, size_t *resid);
 off_t  (*fo_seek)(struct open_file *f, off_t offset, int where);
 int(*fo_stat)(struct open_file *f, struct stat *sb);
@@ -383,7 +383,7 @@ extern void nullsys(void);
 extern int null_open(const char *path, struct open_file *f);
 extern int null_close(struct open_file *f);
 extern int null_read(struct open_file *f, void *buf, size_t size, size_t 
*resid);
-extern int null_write(struct open_file *f, void *buf, size_t size, size_t 
*resid);
+extern int null_write(struct open_file *f, const void *buf, size_t size, 
size_t *resid);
 extern off_t   null_seek(struct open_file *f, off_t offset, int where);
 extern int null_stat(struct open_file *f, struct stat *sb);
 extern int null_readdir(struct open_file *f, struct dirent *d);

Modified:

Re: svn commit: r329866 - head/sys/cam

2018-02-23 Thread Ian Lepore
On Fri, 2018-02-23 at 16:06 +, Warner Losh wrote:
> -static inline int
> +static inline bool
>  cam_iosched_has_flagged_work(struct cam_iosched_softc *isc)
>  {
> return !!(isc->flags & CAM_IOSCHED_FLAG_WORK_FLAGS);
>  }

There should be no need for the ugly !! here, conversion to bool in C99
is like it is for c++, it converts to zero if the expression being
converted has a value of zero, or to one otherwise.

-- Ian
___
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: r329877 - head/sys/dev/isci/scil

2018-02-23 Thread Ed Maste
On 23 February 2018 at 15:01, Ed Maste  wrote:
> Author: emaste
> Date: Fri Feb 23 20:01:42 2018
> New Revision: 329877
> URL: https://svnweb.freebsd.org/changeset/base/329877
>
> Log:
>   Correct typo in ATA_WRITE_UNCORRECTABLE_PSEUDO
>
>   Also correct a typo in the comment for these values, noted by jimharris.
>
>   Reviewed by:  jimharris
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D3715

Oops, I copied and pasted the wrong review link. It should be
https://reviews.freebsd.org/D14489.
___
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: r329880 - head/sys/kern

2018-02-23 Thread Kirk McKusick
Author: mckusick
Date: Fri Feb 23 21:57:10 2018
New Revision: 329880
URL: https://svnweb.freebsd.org/changeset/base/329880

Log:
  Include error number in the "fsync: giving up on dirty" message
  (in case it ever starts happening again in spite of 328444).
  
  Submitted by: Andreas Longwitz 

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Fri Feb 23 20:18:09 2018(r329879)
+++ head/sys/kern/vfs_default.c Fri Feb 23 21:57:10 2018(r329880)
@@ -714,12 +714,13 @@ loop2:
if ((mp != NULL && mp->mnt_secondary_writes > 0) ||
(error == 0 && --maxretry >= 0))
goto loop1;
-   error = EAGAIN;
+   if (error == 0)
+   error = EAGAIN;
}
}
BO_UNLOCK(bo);
-   if (error == EAGAIN)
-   vn_printf(vp, "fsync: giving up on dirty ");
+   if (error != 0)
+   vn_printf(vp, "fsync: giving up on dirty (error = %d) ", error);
 
return (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: r329881 - stable/11/sbin/fsck_ffs

2018-02-23 Thread Kirk McKusick
Author: mckusick
Date: Fri Feb 23 22:23:28 2018
New Revision: 329881
URL: https://svnweb.freebsd.org/changeset/base/329881

Log:
  MFC of 329749.
  
  Fix a read past the end of a buffer in fsck.

Modified:
  stable/11/sbin/fsck_ffs/inode.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/fsck_ffs/inode.c
==
--- stable/11/sbin/fsck_ffs/inode.c Fri Feb 23 21:57:10 2018
(r329880)
+++ stable/11/sbin/fsck_ffs/inode.c Fri Feb 23 22:23:28 2018
(r329881)
@@ -451,8 +451,10 @@ cacheino(union dinode *dp, ino_t inumber)
 
if (howmany(DIP(dp, di_size), sblock.fs_bsize) > NDADDR)
blks = NDADDR + NIADDR;
-   else
+   else if (DIP(dp, di_size) > 0)
blks = howmany(DIP(dp, di_size), sblock.fs_bsize);
+   else
+   blks = 1;
inp = (struct inoinfo *)
Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t));
if (inp == 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"


Re: svn commit: r329875 - head/sys/kern

2018-02-23 Thread Rick Macklem
Konstantin Belousov wrote:
>Author: kib
>Date: Fri Feb 23 18:26:31 2018
>New Revision: 329875
>URL: https://svnweb.freebsd.org/changeset/base/329875
>
>Log:
>  Restore UP build.
>
>  Reviewed by:  truckman
>  Sponsored by: The FreeBSD Foundation
>
>Modified:
>  head/sys/kern/sched_ule.c
>
>Modified: head/sys/kern/sched_ule.c
>==
>--- head/sys/kern/sched_ule.c   Fri Feb 23 18:18:42 2018(r329874)
>+++ head/sys/kern/sched_ule.c   Fri Feb 23 18:26:31 2018(r329875)
>@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio)
>td->td_flags |= TDF_NEEDRESCHED;
> }
>
>+#ifdef SMP
> /*
>  * This tdq is about to idle.  Try to steal a thread from another CPU before
>  * choosing the idle thread.
>@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq)
>}
>spinlock_exit();
 >}
>+#endif
>
> /*
>  * Handle migration from sched_switch().  This happens only for
>@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd,
>TDQ_LOCK(tdq);
>mtx = thread_lock_block(td);
>tdq_load_rem(tdq, td);
>+#ifdef SMP
>if (tdq->tdq_load == 0)
Since the function isn't called for UP, should this "if" also check for ncpus > 
1 by any chance?
(I know nothing about ULE, so please ignore this if it doesn't make sense;-)
>tdq_trysteal(tdq);
>+#endif
>}
>
> #if (KTR_COMPILE & KTR_SCHED) != 0

rick
___
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: r329882 - in head/sys: conf kern sys vm

2018-02-23 Thread Jeff Roberson
Author: jeff
Date: Fri Feb 23 22:51:51 2018
New Revision: 329882
URL: https://svnweb.freebsd.org/changeset/base/329882

Log:
  Add a generic Proportional Integral Derivative (PID) controller algorithm and
  use it to regulate page daemon output.
  
  This provides much smoother and more responsive page daemon output, 
anticipating
  demand and avoiding pageout stalls by increasing the number of pages to match
  the workload.  This is a reimplementation of work done by myself and mlaier at
  Isilon.
  
  Reviewed by:  bsdimp
  Tested by:pho
  Sponsored by: Netflix, Dell/EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D14402

Added:
  head/sys/kern/subr_pidctrl.c   (contents, props changed)
  head/sys/sys/pidctrl.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/vm/vm_meter.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pagequeue.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Feb 23 22:23:28 2018(r329881)
+++ head/sys/conf/files Fri Feb 23 22:51:51 2018(r329882)
@@ -3874,6 +3874,7 @@ kern/subr_msgbuf.cstandard
 kern/subr_param.c  standard
 kern/subr_pcpu.c   standard
 kern/subr_pctrie.c standard
+kern/subr_pidctrl.cstandard
 kern/subr_power.c  standard
 kern/subr_prf.cstandard
 kern/subr_prof.c   standard

Added: head/sys/kern/subr_pidctrl.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/kern/subr_pidctrl.cFri Feb 23 22:51:51 2018
(r329882)
@@ -0,0 +1,157 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2017,  Jeffrey Roberson 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+void
+pidctrl_init(struct pidctrl *pc, int interval, int setpoint, int bound,
+int Kpd, int Kid, int Kdd)
+{
+
+   bzero(pc, sizeof(*pc));
+   pc->pc_setpoint = setpoint;
+   pc->pc_interval = interval;
+   pc->pc_bound = bound * setpoint * Kid;
+   pc->pc_Kpd = Kpd;
+   pc->pc_Kid = Kid;
+   pc->pc_Kdd = Kdd;
+}
+
+void
+pidctrl_init_sysctl(struct pidctrl *pc, struct sysctl_oid_list *parent)
+{
+
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "error", CTLFLAG_RD,
+   &pc->pc_error, 0, "Current difference from setpoint value (P)");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "olderror", CTLFLAG_RD,
+   &pc->pc_olderror, 0, "Error value from last interval");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "integral", CTLFLAG_RD,
+   &pc->pc_integral, 0, "Accumulated error integral (I)");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "derivative",
+   CTLFLAG_RD, &pc->pc_derivative, 0, "Error derivative (I)");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "input", CTLFLAG_RD,
+   &pc->pc_input, 0, "Last controller process variable input");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "output", CTLFLAG_RD,
+   &pc->pc_output, 0, "Last controller output");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "ticks", CTLFLAG_RD,
+   &pc->pc_ticks, 0, "Last controler runtime");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "setpoint", CTLFLAG_RW,
+   &pc->pc_setpoint, 0, "Desired level for process variable");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "interval", CTLFLAG_RD,
+   &pc->pc_interval, 0, "Interval between calculations (ticks)");
+  

Re: svn commit: r329875 - head/sys/kern

2018-02-23 Thread Don Lewis
On 23 Feb, Rick Macklem wrote:
> Konstantin Belousov wrote:
>>Author: kib
>>Date: Fri Feb 23 18:26:31 2018
>>New Revision: 329875
>>URL: https://svnweb.freebsd.org/changeset/base/329875
>>
>>Log:
>>  Restore UP build.
>>
>>  Reviewed by:  truckman
>>  Sponsored by: The FreeBSD Foundation
>>
>>Modified:
>>  head/sys/kern/sched_ule.c
>>
>>Modified: head/sys/kern/sched_ule.c
>>==
>>--- head/sys/kern/sched_ule.c   Fri Feb 23 18:18:42 2018(r329874)
>>+++ head/sys/kern/sched_ule.c   Fri Feb 23 18:26:31 2018(r329875)
>>@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio)
>>td->td_flags |= TDF_NEEDRESCHED;
>> }
>>
>>+#ifdef SMP
>> /*
>>  * This tdq is about to idle.  Try to steal a thread from another CPU before
>>  * choosing the idle thread.
>>@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq)
>>}
>>spinlock_exit();
>  >}
>>+#endif
>>
>> /*
>>  * Handle migration from sched_switch().  This happens only for
>>@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd,
>>TDQ_LOCK(tdq);
>>mtx = thread_lock_block(td);
>>tdq_load_rem(tdq, td);
>>+#ifdef SMP
>>if (tdq->tdq_load == 0)
> Since the function isn't called for UP, should this "if" also check for ncpus 
> > 1 by any chance?
> (I know nothing about ULE, so please ignore this if it doesn't make sense;-)
>>tdq_trysteal(tdq);
>>+#endif
>>}
>>
>> #if (KTR_COMPILE & KTR_SCHED) != 0

That would probably be a microoptimization.  I think one of the tests at
the top of tdq_trysteal() will cause an immediate return.  Basically
you'd be eliminating an extraneous function call in the path to
switching to the idle thread after you have already determined that you
don't have any work to do.

___
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: r329883 - stable/10/sbin/fsck_ffs

2018-02-23 Thread Kirk McKusick
Author: mckusick
Date: Fri Feb 23 23:07:41 2018
New Revision: 329883
URL: https://svnweb.freebsd.org/changeset/base/329883

Log:
  MFC of 329749.
  
  Fix a read past the end of a buffer in fsck.

Modified:
  stable/10/sbin/fsck_ffs/inode.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/fsck_ffs/inode.c
==
--- stable/10/sbin/fsck_ffs/inode.c Fri Feb 23 22:51:51 2018
(r329882)
+++ stable/10/sbin/fsck_ffs/inode.c Fri Feb 23 23:07:41 2018
(r329883)
@@ -451,8 +451,10 @@ cacheino(union dinode *dp, ino_t inumber)
 
if (howmany(DIP(dp, di_size), sblock.fs_bsize) > NDADDR)
blks = NDADDR + NIADDR;
-   else
+   else if (DIP(dp, di_size) > 0)
blks = howmany(DIP(dp, di_size), sblock.fs_bsize);
+   else
+   blks = 1;
inp = (struct inoinfo *)
Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t));
if (inp == 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"


Re: svn commit: r329875 - head/sys/kern

2018-02-23 Thread Konstantin Belousov
On Fri, Feb 23, 2018 at 02:59:11PM -0800, Don Lewis wrote:
> On 23 Feb, Rick Macklem wrote:
> > Konstantin Belousov wrote:
> >>Author: kib
> >>Date: Fri Feb 23 18:26:31 2018
> >>New Revision: 329875
> >>URL: https://svnweb.freebsd.org/changeset/base/329875
> >>
> >>Log:
> >>  Restore UP build.
> >>
> >>  Reviewed by:  truckman
> >>  Sponsored by: The FreeBSD Foundation
> >>
> >>Modified:
> >>  head/sys/kern/sched_ule.c
> >>
> >>Modified: head/sys/kern/sched_ule.c
> >>==
> >>--- head/sys/kern/sched_ule.c   Fri Feb 23 18:18:42 2018(r329874)
> >>+++ head/sys/kern/sched_ule.c   Fri Feb 23 18:26:31 2018(r329875)
> >>@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio)
> >>td->td_flags |= TDF_NEEDRESCHED;
> >> }
> >>
> >>+#ifdef SMP
> >> /*
> >>  * This tdq is about to idle.  Try to steal a thread from another CPU 
> >> before
> >>  * choosing the idle thread.
> >>@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq)
> >>}
> >>spinlock_exit();
> >  >}
> >>+#endif
> >>
> >> /*
> >>  * Handle migration from sched_switch().  This happens only for
> >>@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd,
> >>TDQ_LOCK(tdq);
> >>mtx = thread_lock_block(td);
> >>tdq_load_rem(tdq, td);
> >>+#ifdef SMP
> >>if (tdq->tdq_load == 0)
> > Since the function isn't called for UP, should this "if" also check for 
> > ncpus > 1 by any chance?
> > (I know nothing about ULE, so please ignore this if it doesn't make sense;-)
> >>tdq_trysteal(tdq);
> >>+#endif
> >>}
> >>
> >> #if (KTR_COMPILE & KTR_SCHED) != 0
> 
> That would probably be a microoptimization.  I think one of the tests at
> the top of tdq_trysteal() will cause an immediate return.  Basically
> you'd be eliminating an extraneous function call in the path to
> switching to the idle thread after you have already determined that you
> don't have any work to do.

Yes, smp_started is zero on 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"


svn commit: r329885 - head/sys/vm

2018-02-23 Thread Mark Johnston
Author: markj
Date: Fri Feb 23 23:25:22 2018
New Revision: 329885
URL: https://svnweb.freebsd.org/changeset/base/329885

Log:
  Remove a bogus assertion from vm_page_launder().
  
  After r328977, a wired page m may have m->queue != PQ_NONE.
  
  Reviewed by:  kib
  X-MFC with:   r328977
  Differential Revision:https://reviews.freebsd.org/D14485

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Fri Feb 23 23:16:15 2018(r329884)
+++ head/sys/vm/vm_page.c   Fri Feb 23 23:25:22 2018(r329885)
@@ -3435,14 +3435,11 @@ vm_page_launder(vm_page_t m)
int queue;
 
vm_page_assert_locked(m);
-   if ((queue = m->queue) != PQ_LAUNDRY) {
-   if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) {
-   if (queue != PQ_NONE)
-   vm_page_dequeue(m);
-   vm_page_enqueue(PQ_LAUNDRY, m);
-   } else
-   KASSERT(queue == PQ_NONE,
-   ("wired page %p is queued", m));
+   if ((queue = m->queue) != PQ_LAUNDRY && m->wire_count == 0 &&
+   (m->oflags & VPO_UNMANAGED) == 0) {
+   if (queue != PQ_NONE)
+   vm_page_dequeue(m);
+   vm_page_enqueue(PQ_LAUNDRY, m);
}
 }
 
___
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: r329886 - head/sys/vm

2018-02-23 Thread Mark Johnston
Author: markj
Date: Fri Feb 23 23:27:53 2018
New Revision: 329886
URL: https://svnweb.freebsd.org/changeset/base/329886

Log:
  Correct some comments after r328954.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D14486

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==
--- head/sys/vm/vm_reserv.c Fri Feb 23 23:25:22 2018(r329885)
+++ head/sys/vm/vm_reserv.c Fri Feb 23 23:27:53 2018(r329886)
@@ -511,19 +511,14 @@ vm_reserv_populate(vm_reserv_t rv, int index)
 }
 
 /*
- * Allocates a contiguous set of physical pages of the given size "npages"
- * from existing or newly created reservations.  All of the physical pages
- * must be at or above the given physical address "low" and below the given
- * physical address "high".  The given value "alignment" determines the
- * alignment of the first physical page in the set.  If the given value
- * "boundary" is non-zero, then the set of physical pages cannot cross any
- * physical address boundary that is a multiple of that value.  Both
- * "alignment" and "boundary" must be a power of two.
+ * Attempts to allocate a contiguous set of physical pages from existing
+ * reservations.  See vm_reserv_alloc_contig() for a description of the
+ * function's parameters.
  *
  * The page "mpred" must immediately precede the offset "pindex" within the
  * specified object.
  *
- * The object and free page queue must be locked.
+ * The object must be locked.
  */
 vm_page_t
 vm_reserv_extend_contig(int req, vm_object_t object, vm_pindex_t pindex,
@@ -606,7 +601,7 @@ out:
 
 /*
  * Allocates a contiguous set of physical pages of the given size "npages"
- * from existing or newly created reservations.  All of the physical pages
+ * from newly created reservations.  All of the physical pages
  * must be at or above the given physical address "low" and below the given
  * physical address "high".  The given value "alignment" determines the
  * alignment of the first physical page in the set.  If the given value
@@ -614,6 +609,9 @@ out:
  * physical address boundary that is a multiple of that value.  Both
  * "alignment" and "boundary" must be a power of two.
  *
+ * Callers should first invoke vm_reserv_extend_contig() to attempt an
+ * allocation from existing reservations.
+ *
  * The page "mpred" must immediately precede the offset "pindex" within the
  * specified object.
  *
@@ -836,7 +834,9 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde
 }
 
 /*
- * Allocates a page from an existing reservation.
+ * Attempts to allocate a new reservation for the object, and allocates a
+ * page from that reservation.  Callers should first invoke vm_reserv_extend()
+ * to attempt an allocation from an existing reservation.
  *
  * The page "mpred" must immediately precede the offset "pindex" within the
  * specified object.
___
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: r329887 - stable/11/sys/opencrypto

2018-02-23 Thread John Baldwin
Author: jhb
Date: Fri Feb 23 23:56:33 2018
New Revision: 329887
URL: https://svnweb.freebsd.org/changeset/base/329887

Log:
  MFC 327803: Flesh out static dtrace probes for /dev/crypto ioctl errors.
  
  In particular, no probes were present for AEAD requests, but also for
  some other error cases in other ioctl requests.
  
  Sponsored by: Chelsio Communications

Modified:
  stable/11/sys/opencrypto/cryptodev.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/opencrypto/cryptodev.c
==
--- stable/11/sys/opencrypto/cryptodev.cFri Feb 23 23:27:53 2018
(r329886)
+++ stable/11/sys/opencrypto/cryptodev.cFri Feb 23 23:56:33 2018
(r329887)
@@ -443,6 +443,7 @@ cryptof_ioctl(
 
default:
CRYPTDEB("invalid cipher");
+   SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
return (EINVAL);
}
 
@@ -490,6 +491,7 @@ cryptof_ioctl(
break;
default:
CRYPTDEB("invalid mac");
+   SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
return (EINVAL);
}
 
@@ -503,6 +505,8 @@ cryptof_ioctl(
sop->keylen < txform->minkey) {
CRYPTDEB("invalid cipher parameters");
error = EINVAL;
+   SDT_PROBE1(opencrypto, dev, ioctl, error,
+   __LINE__);
goto bail;
}
 
@@ -511,6 +515,8 @@ cryptof_ioctl(
if ((error = copyin(sop->key, crie.cri_key,
crie.cri_klen / 8))) {
CRYPTDEB("invalid key");
+   SDT_PROBE1(opencrypto, dev, ioctl, error,
+   __LINE__);
goto bail;
}
if (thash)
@@ -523,6 +529,8 @@ cryptof_ioctl(
if (sop->mackeylen != thash->keysize) {
CRYPTDEB("invalid mac key length");
error = EINVAL;
+   SDT_PROBE1(opencrypto, dev, ioctl, error,
+   __LINE__);
goto bail;
}
 
@@ -532,6 +540,8 @@ cryptof_ioctl(
if ((error = copyin(sop->mackey, cria.cri_key,
cria.cri_klen / 8))) {
CRYPTDEB("invalid mac key");
+   SDT_PROBE1(opencrypto, dev, ioctl,
+   error, __LINE__);
goto bail;
}
}
@@ -547,6 +557,8 @@ cryptof_ioctl(
error = checkforsoftware(&crid);
if (error) {
CRYPTDEB("checkforsoftware");
+   SDT_PROBE1(opencrypto, dev, ioctl, error,
+   __LINE__);
goto bail;
}
} else
@@ -554,6 +566,7 @@ cryptof_ioctl(
error = crypto_newsession(&sid, (txform ? &crie : &cria), crid);
if (error) {
CRYPTDEB("crypto_newsession");
+   SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
goto bail;
}
 
@@ -564,6 +577,7 @@ cryptof_ioctl(
if (cse == NULL) {
crypto_freesession(sid);
error = EINVAL;
+   SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
CRYPTDEB("csecreate");
goto bail;
}
@@ -596,8 +610,10 @@ bail:
case CIOCFSESSION:
ses = *(u_int32_t *)data;
cse = csefind(fcr, ses);
-   if (cse == NULL)
+   if (cse == NULL) {
+   SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
return (EINVAL);
+   }
csedelete(fcr, cse);
error = csefree(cse);
break;
@@ -627,8 +643,10 @@ bail:
case CIOCKEY32:
case CIOCKEY232:
 #endif
-   if (!crypto_userasymcrypto)
+   if (!crypto_userasymcrypto) {
+   SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
return (EPERM); /* XXX compat? */
+   }
 #ifdef COMPAT_FREEBSD32
if (cmd == CIOCKEY32 || cmd == CIOCKEY232) {

svn commit: r329888 - head/sys/kern

2018-02-23 Thread Conrad Meyer
Author: cem
Date: Sat Feb 24 01:15:33 2018
New Revision: 329888
URL: https://svnweb.freebsd.org/changeset/base/329888

Log:
  kern/sys_generic.c: style(9) return(foo) -> return (foo)
  
  No functional change.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/sys_generic.c

Modified: head/sys/kern/sys_generic.c
==
--- head/sys/kern/sys_generic.c Fri Feb 23 23:56:33 2018(r329887)
+++ head/sys/kern/sys_generic.c Sat Feb 24 01:15:33 2018(r329888)
@@ -206,7 +206,7 @@ sys_read(td, uap)
auio.uio_resid = uap->nbyte;
auio.uio_segflg = UIO_USERSPACE;
error = kern_readv(td, uap->fd, &auio);
-   return(error);
+   return (error);
 }
 
 /*
@@ -369,7 +369,7 @@ dofileread(td, fd, fp, auio, offset, flags)
/* Finish zero length reads right here */
if (auio->uio_resid == 0) {
td->td_retval[0] = 0;
-   return(0);
+   return (0);
}
auio->uio_rw = UIO_READ;
auio->uio_offset = offset;
@@ -420,7 +420,7 @@ sys_write(td, uap)
auio.uio_resid = uap->nbyte;
auio.uio_segflg = UIO_USERSPACE;
error = kern_writev(td, uap->fd, &auio);
-   return(error);
+   return (error);
 }
 
 /*
@@ -459,7 +459,7 @@ kern_pwrite(struct thread *td, int fd, const void *buf
auio.uio_resid = nbyte;
auio.uio_segflg = UIO_USERSPACE;
error = kern_pwritev(td, fd, &auio, offset);
-   return(error);
+   return (error);
 }
 
 #if defined(COMPAT_FREEBSD6)
___
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: r329890 - head/share/mk

2018-02-23 Thread Bryan Drewery
Author: bdrewery
Date: Sat Feb 24 01:33:17 2018
New Revision: 329890
URL: https://svnweb.freebsd.org/changeset/base/329890

Log:
  Fix installation with read-only OBJDIR.
  
  Reported by:  npn
  Sponsored by: Dell EMC

Modified:
  head/share/mk/src.sys.obj.mk

Modified: head/share/mk/src.sys.obj.mk
==
--- head/share/mk/src.sys.obj.mkSat Feb 24 01:24:57 2018
(r329889)
+++ head/share/mk/src.sys.obj.mkSat Feb 24 01:33:17 2018
(r329890)
@@ -177,7 +177,8 @@ CheckAutoObj() { \
fi; \
 }
 .if !empty(__objdir)
-.if ${.CURDIR} == ${__objdir}
+.if ${.CURDIR} == ${__objdir} || \
+(exists(${__objdir}) && ${.TARGETS:M*install*} == ${.TARGETS})
 __objdir_writable?= yes
 .elif empty(__objdir_writable)
 __objdir_writable!= \
___
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: r329889 - head/sys/amd64/acpica

2018-02-23 Thread Jung-uk Kim
Author: jkim
Date: Sat Feb 24 01:24:57 2018
New Revision: 329889
URL: https://svnweb.freebsd.org/changeset/base/329889

Log:
  Partially revert r197863 to reduce diff against i386.
  
  When I wrote the patch, I wanted to remove SYSINIT() usage from amd64 code.
  There is no reason to keep the divergence any more because iwasaki merged
  most amd64 suspend/resume code to i386 with r235622.  Note this also fixed
  an enge case reported by royger. [1]
  
  Suggested by: jhb
  Reviewed by:  royger
  Tested by:royger [1]
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14400 [1]

Modified:
  head/sys/amd64/acpica/acpi_machdep.c

Modified: head/sys/amd64/acpica/acpi_machdep.c
==
--- head/sys/amd64/acpica/acpi_machdep.cSat Feb 24 01:15:33 2018
(r329888)
+++ head/sys/amd64/acpica/acpi_machdep.cSat Feb 24 01:24:57 2018
(r329889)
@@ -63,6 +63,7 @@ acpi_machdep_init(device_t dev)
sc = device_get_softc(dev);
 
acpi_apm_init(sc);
+   acpi_install_wakeup_handler(sc);
 
if (intr_model != ACPI_INTR_PIC)
acpi_SetIntrModel(intr_model);
@@ -349,20 +350,13 @@ nexus_acpi_probe(device_t dev)
 static int
 nexus_acpi_attach(device_t dev)
 {
-   device_t acpi_dev;
-   int error;
 
nexus_init_resources();
bus_generic_probe(dev);
-   acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0);
-   if (acpi_dev == NULL)
+   if (BUS_ADD_CHILD(dev, 10, "acpi", 0) == NULL)
panic("failed to add acpi0 device");
 
-   error = bus_generic_attach(dev);
-   if (error == 0)
-   acpi_install_wakeup_handler(device_get_softc(acpi_dev));
-
-   return (error);
+   return (bus_generic_attach(dev));
 }
 
 static device_method_t nexus_acpi_methods[] = {
___
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: r329891 - in head/sys/powerpc: include mpc85xx powerpc

2018-02-23 Thread Justin Hibbits
Author: jhibbits
Date: Sat Feb 24 01:46:56 2018
New Revision: 329891
URL: https://svnweb.freebsd.org/changeset/base/329891

Log:
  Remove platform_cpu_idle() and platform_cpu_idle_wakeup() interfaces
  
  These interfaces were put in place to let QorIQ SoCs dictate CPU idling
  semantics, in order to support capabilities such as NAP mode and deep sleep.
  However, this never stabilized, and the idling support reverted back to
  CPU-level rather than SoC level.  Move this code back to cpu.c instead.  If
  at a later date the lower power modes do come to fruition, it should be done
  by overriding the cpu_idle_hook instead of this platform hook.

Modified:
  head/sys/powerpc/include/platform.h
  head/sys/powerpc/mpc85xx/platform_mpc85xx.c
  head/sys/powerpc/powerpc/cpu.c
  head/sys/powerpc/powerpc/platform.c
  head/sys/powerpc/powerpc/platform_if.m

Modified: head/sys/powerpc/include/platform.h
==
--- head/sys/powerpc/include/platform.h Sat Feb 24 01:33:17 2018
(r329890)
+++ head/sys/powerpc/include/platform.h Sat Feb 24 01:46:56 2018
(r329891)
@@ -62,8 +62,6 @@ void  platform_smp_ap_init(void);
 const char *installed_platform(void);
 void platform_probe_and_attach(void);
 
-void   platform_cpu_idle(int);
-
 void platform_sleep(void);
   
 #endif /* _MACHINE_PLATFORM_H_ */

Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Feb 24 01:33:17 2018
(r329890)
+++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Feb 24 01:46:56 2018
(r329891)
@@ -95,8 +95,6 @@ static int mpc85xx_smp_next_cpu(platform_t, struct cpu
 static int mpc85xx_smp_get_bsp(platform_t, struct cpuref *cpuref);
 static int mpc85xx_smp_start_cpu(platform_t, struct pcpu *cpu);
 static void mpc85xx_smp_timebase_sync(platform_t, u_long tb, int ap);
-static void mpc85xx_idle(platform_t, int cpu);
-static int mpc85xx_idle_wakeup(platform_t plat, int cpu);
 
 static void mpc85xx_reset(platform_t);
 
@@ -113,8 +111,6 @@ static platform_method_t mpc85xx_methods[] = {
PLATFORMMETHOD(platform_smp_timebase_sync, mpc85xx_smp_timebase_sync),
 
PLATFORMMETHOD(platform_reset,  mpc85xx_reset),
-   PLATFORMMETHOD(platform_idle,   mpc85xx_idle),
-   PLATFORMMETHOD(platform_idle_wakeup,mpc85xx_idle_wakeup),
 
PLATFORMMETHOD_END
 };
@@ -539,28 +535,3 @@ mpc85xx_smp_timebase_sync(platform_t plat, u_long tb, 
mttb(tb);
 }
 
-static void
-mpc85xx_idle(platform_t plat, int cpu)
-{
-   uint32_t reg;
-
-   if (mpc85xx_is_qoriq()) {
-   /*
-* Base binutils doesn't know what the 'wait' instruction is, so
-* use the opcode encoding here.
-*/
-   __asm __volatile("wrteei 1; .long 0x7c7c");
-   } else {
-   reg = mfmsr();
-   /* Freescale E500 core RM section 6.4.1. */
-   __asm __volatile("msync; mtmsr %0; isync" ::
-   "r" (reg | PSL_WE));
-   }
-}
-
-static int
-mpc85xx_idle_wakeup(platform_t plat, int cpu)
-{
-
-   return (0);
-}

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Sat Feb 24 01:33:17 2018
(r329890)
+++ head/sys/powerpc/powerpc/cpu.c  Sat Feb 24 01:46:56 2018
(r329891)
@@ -719,9 +719,29 @@ cpu_idle_60x(sbintime_t sbt)
 static void
 cpu_idle_booke(sbintime_t sbt)
 {
+   register_t msr;
+   uint16_t vers;
 
-#ifdef BOOKE_E500
-   platform_cpu_idle(PCPU_GET(cpuid));
+   msr = mfmsr();
+   vers = mfpvr() >> 16;
+
+#ifdef BOOKE
+   switch (vers) {
+   case FSL_E500mc:
+   case FSL_E5500:
+   case FSL_E6500:
+   /*
+* Base binutils doesn't know what the 'wait' instruction is, so
+* use the opcode encoding here.
+*/
+   __asm __volatile(".long 0x7c7c");
+   break;
+   default:
+   powerpc_sync();
+   mtmsr(msr | PSL_WE);
+   isync();
+   break;
+   }
 #endif
 }
 

Modified: head/sys/powerpc/powerpc/platform.c
==
--- head/sys/powerpc/powerpc/platform.c Sat Feb 24 01:33:17 2018
(r329890)
+++ head/sys/powerpc/powerpc/platform.c Sat Feb 24 01:46:56 2018
(r329891)
@@ -255,19 +255,6 @@ cpu_reset()
 PLATFORM_RESET(plat_obj);
 }
 
-int
-cpu_idle_wakeup(int cpu)
-{
-   return (PLATFORM_IDLE_WAKEUP(plat_obj, cpu));
-}
-
-void
-platform_cpu_idle(int cpu)
-{
-
-   PLATFORM_IDLE(plat_obj, cpu);
-}
-
 void platform_smp_timebase_sync(u_long tb, int ap)
 {
 

Modified: head/sys/powerpc/powerpc/platform_if.m
==

svn commit: r329892 - head/stand/libsa

2018-02-23 Thread Conrad Meyer
Author: cem
Date: Sat Feb 24 01:58:53 2018
New Revision: 329892
URL: https://svnweb.freebsd.org/changeset/base/329892

Log:
  libsa: Change write(2)-alike prototype to match definition
  
  Broken in r329879.
  
  Apparently old GCC detects this, but modern GCC didn't.  Mea culpa.
  
  Reported by:  np
  Sponsored by: Dell EMC Isilon

Modified:
  head/stand/libsa/stand.h

Modified: head/stand/libsa/stand.h
==
--- head/stand/libsa/stand.hSat Feb 24 01:46:56 2018(r329891)
+++ head/stand/libsa/stand.hSat Feb 24 01:58:53 2018(r329892)
@@ -289,7 +289,7 @@ extern int  open(const char *, int);
 extern int close(int);
 extern voidcloseall(void);
 extern ssize_t read(int, void *, size_t);
-extern ssize_t write(int, void *, size_t);
+extern ssize_t write(int, const void *, size_t);
 extern struct  dirent *readdirfd(int);
 
 extern voidsrandom(unsigned int);
___
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: r329895 - in head/stand: liblua libsa

2018-02-23 Thread Kyle Evans
Author: kevans
Date: Sat Feb 24 02:57:24 2018
New Revision: 329895
URL: https://svnweb.freebsd.org/changeset/base/329895

Log:
  liblua: Implement write support
  
  Write support (even if it only works on UFS) will be needed for nextboot
  functionality.
  
  Reviewed by:  cem, imp
  Differential Revision:https://reviews.freebsd.org/D14478

Modified:
  head/stand/liblua/lstd.c
  head/stand/liblua/lstd.h
  head/stand/liblua/lutils.c
  head/stand/libsa/stand.h

Modified: head/stand/liblua/lstd.c
==
--- head/stand/liblua/lstd.cSat Feb 24 02:52:39 2018(r329894)
+++ head/stand/liblua/lstd.cSat Feb 24 02:57:24 2018(r329895)
@@ -35,13 +35,32 @@ FILE *
 fopen(const char *filename, const char *mode)
 {
struct stat st;
-   int fd;
+   int fd, m, o;
FILE*f;
 
-   if (mode == NULL || mode[0] != 'r')
+   if (mode == NULL)
return NULL;
 
-   fd = open(filename, O_RDONLY);
+   switch (*mode++) {
+   case 'r':   /* open for reading */
+   m = O_RDONLY;
+   o = 0;
+   break;
+
+   case 'w':   /* open for writing */
+   m = O_WRONLY;
+   /* These are not actually implemented yet */
+   o = O_CREAT | O_TRUNC;
+   break;
+
+   default:/* illegal mode */
+   return (NULL);
+   }
+
+   if (*mode == '+')
+   m = O_RDWR;
+
+   fd = open(filename, m | o);
if (fd < 0)
return NULL;
 
@@ -83,6 +102,21 @@ fread(void *ptr, size_t size, size_t count, FILE *stre
stream->offset += r;
 
return (r);
+}
+
+size_t
+fwrite(const void *ptr, size_t size, size_t count, FILE *stream)
+{
+   ssize_t w;
+
+   if (stream == NULL || ptr == NULL)
+   return (0);
+   w = write(stream->fd, ptr, size * count);
+   if (w == -1)
+   return (0);
+
+   stream->offset += w;
+   return ((size_t)w);
 }
 
 int

Modified: head/stand/liblua/lstd.h
==
--- head/stand/liblua/lstd.hSat Feb 24 02:52:39 2018(r329894)
+++ head/stand/liblua/lstd.hSat Feb 24 02:57:24 2018(r329895)
@@ -51,6 +51,7 @@ typedef struct DIR
 FILE *fopen(const char *filename, const char *mode);
 FILE *freopen( const char *filename, const char *mode, FILE *stream);
 size_t fread(void *ptr, size_t size, size_t count, FILE *stream);
+size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream);
 int fclose(FILE *stream);
 int ferror(FILE *stream);
 int feof(FILE *stream);

Modified: head/stand/liblua/lutils.c
==
--- head/stand/liblua/lutils.c  Sat Feb 24 02:52:39 2018(r329894)
+++ head/stand/liblua/lutils.c  Sat Feb 24 02:57:24 2018(r329895)
@@ -165,15 +165,24 @@ lua_printc(lua_State *L)
 static int
 lua_openfile(lua_State *L)
 {
-   const char  *str;
+   const char  *mode, *str;
+   int nargs;
 
-   if (lua_gettop(L) != 1) {
+   nargs = lua_gettop(L);
+   if (nargs < 1 || nargs > 2) {
lua_pushnil(L);
return 1;
}
str = lua_tostring(L, 1);
-
-   FILE * f = fopen(str, "r");
+   mode = "r";
+   if (nargs > 1) {
+   mode = lua_tostring(L, 2);
+   if (mode == NULL) {
+   lua_pushnil(L);
+   return 1;
+   }
+   }
+   FILE * f = fopen(str, mode);
if (f != NULL) {
FILE ** ptr = (FILE**)lua_newuserdata(L, sizeof(FILE**));
*ptr = f;
@@ -237,6 +246,61 @@ lua_readfile(lua_State *L)
return 2;
 }
 
+/*
+ * Implements io.write(file, ...)
+ * Any number of string and number arguments may be passed to it,
+ * and it will return the number of bytes written, or nil, an error string, and
+ * the errno.
+ */
+static int
+lua_writefile(lua_State *L)
+{
+   FILE**f;
+   const char  *buf;
+   int i, nargs;
+   size_t  bufsz, w, wrsz;
+
+   buf = NULL;
+   bufsz = 0;
+   w = 0;
+   wrsz = 0;
+   nargs = lua_gettop(L);
+   if (nargs < 2) {
+   errno = EINVAL;
+   return luaL_fileresult(L, 0, NULL);
+   }
+
+   f = (FILE**)lua_touserdata(L, 1);
+
+   if (f == NULL || *f == NULL) {
+   errno = EINVAL;
+   return luaL_fileresult(L, 0, NULL);
+   }
+
+   /* Do a validation pass first */
+   for (i = 0; i < nargs - 1; i++) {
+   /*
+* With Lua's API, lua_isstring really checks if the argument
+* is a string or a number.  The latter will be implicitly
+* converted to a string by our later call to 

Re: svn commit: r329874 - in head: etc/mtree tests/sys/net

2018-02-23 Thread Kubilay Kocak
On 2/24/18 5:18 AM, Alan Somers wrote:
>   Unfortunately, most of the tests are disabled because they fairly frequently
>   trigger panics.

Do the atf_skip annotations/reasons show up in the output even though
they're not run?

Somewhat related, do the test machines use debug bits and produce good
debug output/backtraces in these situations?

./koobs


___
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: r329874 - in head: etc/mtree tests/sys/net

2018-02-23 Thread Alan Somers
On Fri, Feb 23, 2018 at 7:05 PM, Kubilay Kocak  wrote:

> On 2/24/18 5:18 AM, Alan Somers wrote:
> >   Unfortunately, most of the tests are disabled because they fairly
> frequently
> >   trigger panics.
>
> Do the atf_skip annotations/reasons show up in the output even though
> they're not run?
>

Yep.


>
> Somewhat related, do the test machines use debug bits and produce good
> debug output/backtraces in these situations?
>

Do you mean the test machine at ci.freebsd.org?  AFAIK it's just like any
other head system.  Invariants are on by default.


>
> ./koobs
>
>
>
___
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: r329897 - head/stand/lua

2018-02-23 Thread Kyle Evans
Author: kevans
Date: Sat Feb 24 03:35:35 2018
New Revision: 329897
URL: https://svnweb.freebsd.org/changeset/base/329897

Log:
  lualoader: Add nextboot support
  
  config.parse now takes an extra callback that is invoked on the full text of
  the config file. This callback dictates where we should actually try to
  parse this file or not.
  
  For nextboot, we use this to halt parsing if we see 'nextboot_enable="NO"'.
  If we don't, parse it and write 'nextboot_enable="NO" ' to it. The same
  caveat as with forth still applies- writing is only supported by UFS.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 24 03:33:46 2018(r329896)
+++ head/stand/lua/config.lua   Sat Feb 24 03:35:35 2018(r329897)
@@ -124,6 +124,27 @@ pattern_table = {
}
 }
 
+local function check_nextboot()
+   local nextboot_file = loader.getenv("nextboot_file")
+   if nextboot_file == nil then
+   return
+   end
+
+   local function check_nextboot_disabled(text)
+   return not text:match("^nextboot_enable=\"NO\"")
+   end
+
+   if not config.parse(nextboot_file, true, check_nextboot_disabled) then
+   -- This only fails if it actually hit a parse error
+   print("Failed to parse nextboot configuration: '" ..
+   nextboot_file .. "'")
+   end
+
+   local nfile = io.open(nextboot_file, 'w')
+   io.write(nfile, "nextboot_enable=\"NO\" ")
+   io.close(nfile)
+end
+
 -- Module exports
 -- Which variables we changed
 config.env_changed = {}
@@ -273,7 +294,9 @@ function config.loadmod(mod, silent)
 end
 
 -- silent runs will not return false if we fail to open the file
-function config.parse(name, silent)
+-- check_and_halt, if it's set, will be executed on the full text of the config
+-- file. If it returns false, we are to halt immediately.
+function config.parse(name, silent, check_and_halt)
if silent == nil then
silent = false
end
@@ -294,6 +317,13 @@ function config.parse(name, silent)
return silent
end
 
+
+   if check_and_halt ~= nil then
+   if not check_and_halt(text) then
+   -- We'll just pretend that everything is fine...
+   return true
+   end
+   end
local n = 1
local status = true
 
@@ -438,6 +468,8 @@ function config.load(file)
end
end
end
+
+   check_nextboot()
 
-- Cache the provided module_path at load time for later use
config.module_path = loader.getenv("module_path")
___
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: r329899 - head/stand/lua

2018-02-23 Thread Kyle Evans
Author: kevans
Date: Sat Feb 24 03:43:10 2018
New Revision: 329899
URL: https://svnweb.freebsd.org/changeset/base/329899

Log:
  lualoader: Correct test and name
  
  The functionality was correct, but our style guidelines tend to request that
  we shy away from using boolean operations in place of explicit comparisons
  to nil.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 24 03:38:51 2018(r329898)
+++ head/stand/lua/config.lua   Sat Feb 24 03:43:10 2018(r329899)
@@ -130,11 +130,11 @@ local function check_nextboot()
return
end
 
-   local function check_nextboot_disabled(text)
-   return not text:match("^nextboot_enable=\"NO\"")
+   local function check_nextboot_enabled(text)
+   return text:match("^nextboot_enable=\"NO\"") == nil
end
 
-   if not config.parse(nextboot_file, true, check_nextboot_disabled) then
+   if not config.parse(nextboot_file, true, check_nextboot_enabled) then
-- This only fails if it actually hit a parse error
print("Failed to parse nextboot configuration: '" ..
nextboot_file .. "'")
___
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: r329902 - head/stand/lua

2018-02-23 Thread Kyle Evans
Author: kevans
Date: Sat Feb 24 03:48:52 2018
New Revision: 329902
URL: https://svnweb.freebsd.org/changeset/base/329902

Log:
  lualoader: Remove unused variable; we now use the effective line number

Modified:
  head/stand/lua/drawer.lua

Modified: head/stand/lua/drawer.lua
==
--- head/stand/lua/drawer.lua   Sat Feb 24 03:47:04 2018(r329901)
+++ head/stand/lua/drawer.lua   Sat Feb 24 03:48:52 2018(r329902)
@@ -277,7 +277,7 @@ function drawer.drawmenu(m)
if type(menu_entries) == "function" then
menu_entries = menu_entries()
end
-   for line_num, e in ipairs(menu_entries) do
+   for _, e in ipairs(menu_entries) do
-- Allow menu items to be conditionally visible by specifying
-- a visible function.
if e.visible ~= nil and not e.visible() then
___
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: r329896 - head/sys/ufs/ffs

2018-02-23 Thread Kirk McKusick
Author: mckusick
Date: Sat Feb 24 03:33:46 2018
New Revision: 329896
URL: https://svnweb.freebsd.org/changeset/base/329896

Log:
  Relax the location restraints when validating one of the
  backup superblocks.

Modified:
  head/sys/ufs/ffs/ffs_subr.c

Modified: head/sys/ufs/ffs/ffs_subr.c
==
--- head/sys/ufs/ffs/ffs_subr.c Sat Feb 24 02:57:24 2018(r329895)
+++ head/sys/ufs/ffs/ffs_subr.c Sat Feb 24 03:33:46 2018(r329896)
@@ -162,28 +162,28 @@ static int readsuper(void *, struct fs **, off_t,
  * The administrator must complete newfs before using this volume.
  */
 int
-ffs_sbget(void *devfd, struct fs **fsp, off_t altsuperblock,
+ffs_sbget(void *devfd, struct fs **fsp, off_t altsblock,
 struct malloc_type *filltype,
 int (*readfunc)(void *devfd, off_t loc, void **bufp, int size))
 {
struct fs *fs;
-   int i, ret, size, blks;
+   int i, error, size, blks;
uint8_t *space;
int32_t *lp;
char *buf;
 
*fsp = NULL;
-   if (altsuperblock != -1) {
-   if ((ret = readsuper(devfd, fsp, altsuperblock, readfunc)) != 0)
-   return (ret);
+   if (altsblock != -1) {
+   if ((error = readsuper(devfd, fsp, -altsblock, readfunc)) != 0)
+   return (error);
} else {
for (i = 0; sblock_try[i] != -1; i++) {
-   if ((ret = readsuper(devfd, fsp, sblock_try[i],
+   if ((error = readsuper(devfd, fsp, sblock_try[i],
 readfunc)) == 0)
break;
-   if (ret == ENOENT)
+   if (error == ENOENT)
continue;
-   return (ret);
+   return (error);
}
if (sblock_try[i] == -1)
return (ENOENT);
@@ -209,13 +209,13 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper
if (i + fs->fs_frag > blks)
size = (blks - i) * fs->fs_fsize;
buf = NULL;
-   ret = (*readfunc)(devfd,
+   error = (*readfunc)(devfd,
dbtob(fsbtodb(fs, fs->fs_csaddr + i)), (void **)&buf, size);
-   if (ret) {
+   if (error) {
UFS_FREE(buf, filltype);
UFS_FREE(fs->fs_csp, filltype);
fs->fs_csp = NULL;
-   return (ret);
+   return (error);
}
memcpy(space, buf, size);
UFS_FREE(buf, filltype);
@@ -242,8 +242,13 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo
 int (*readfunc)(void *devfd, off_t loc, void **bufp, int size))
 {
struct fs *fs;
-   int error;
+   int error, altblk;
 
+   altblk = 0;
+   if (sblockloc < 0) {
+   altblk = 1;
+   sblockloc = - sblockloc;
+   }
error = (*readfunc)(devfd, sblockloc, (void **)fsp, SBLOCKSIZE);
if (*fsp != NULL)
(*fsp)->fs_csp = NULL;  /* Not yet any summary information */
@@ -252,9 +257,10 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo
fs = *fsp;
if (fs->fs_magic == FS_BAD_MAGIC)
return (EINVAL);
-   if (((fs->fs_magic == FS_UFS1_MAGIC && sblockloc <= SBLOCK_UFS1) ||
-(fs->fs_magic == FS_UFS2_MAGIC &&
- sblockloc == fs->fs_sblockloc)) &&
+   if (((fs->fs_magic == FS_UFS1_MAGIC && (altblk ||
+ sblockloc <= SBLOCK_UFS1)) ||
+(fs->fs_magic == FS_UFS2_MAGIC && (altblk ||
+ sblockloc == fs->fs_sblockloc))) &&
fs->fs_ncg >= 1 &&
fs->fs_bsize >= MINBSIZE &&
fs->fs_bsize <= MAXBSIZE &&
___
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: r329903 - head/stand/lua

2018-02-23 Thread Kyle Evans
Author: kevans
Date: Sat Feb 24 04:02:06 2018
New Revision: 329903
URL: https://svnweb.freebsd.org/changeset/base/329903

Log:
  lualoader: Explain nextboot stuff a little bit more

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 24 03:48:52 2018(r329902)
+++ head/stand/lua/config.lua   Sat Feb 24 04:02:06 2018(r329903)
@@ -140,12 +140,17 @@ local function check_nextboot()
nextboot_file .. "'")
end
 
+   -- Attempt to rewrite the first line and only the first line of the
+   -- nextboot_file. We overwrite it with nextboot_enable="NO", then
+   -- check for that on load. See: check_nextboot_enabled
+   -- It's worth noting that this won't work on every filesystem, so we
+   -- won't do anything notable if we have any errors in this process.
local nfile = io.open(nextboot_file, 'w')
if nfile ~= nil then
-   -- We're overwriting the first line of the file, so we need the
-   -- trailing space to account for the extra character taken up by
-   -- the string nextboot_enable="YES" -- our new end quotation
-   -- mark lands on the S.
+   -- We need the trailing space here to account for the extra
+   -- character taken up by the string nextboot_enable="YES"
+   -- Or new end quotation mark lands on the S, and we want to
+   -- rewrite the entirety of the first line.
io.write(nfile, "nextboot_enable=\"NO\" ")
io.close(nfile)
end
___
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: r329898 - head/stand/lua

2018-02-23 Thread Kyle Evans
Author: kevans
Date: Sat Feb 24 03:38:51 2018
New Revision: 329898
URL: https://svnweb.freebsd.org/changeset/base/329898

Log:
  lualoader: Plug file handle not properly closed

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 24 03:35:35 2018(r329897)
+++ head/stand/lua/config.lua   Sat Feb 24 03:38:51 2018(r329898)
@@ -309,6 +309,8 @@ function config.parse(name, silent, check_and_halt)
end
 
local text, _ = io.read(f)
+   -- We might have read in the whole file, this won't be needed any more.
+   io.close(f)
 
if text == nil then
if not silent then
___
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: r329901 - head/stand/lua

2018-02-23 Thread Kyle Evans
Author: kevans
Date: Sat Feb 24 03:47:04 2018
New Revision: 329901
URL: https://svnweb.freebsd.org/changeset/base/329901

Log:
  lualoader: Add comment on trailing space, don't operate on nil
  
  Functionally, the latter error wouldn't necessarily hurt anything. io.write
  will just error out as it's not passed a valid file handle. Still, we can do
  better than that.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Feb 24 03:45:50 2018(r329900)
+++ head/stand/lua/config.lua   Sat Feb 24 03:47:04 2018(r329901)
@@ -141,8 +141,14 @@ local function check_nextboot()
end
 
local nfile = io.open(nextboot_file, 'w')
-   io.write(nfile, "nextboot_enable=\"NO\" ")
-   io.close(nfile)
+   if nfile ~= nil then
+   -- We're overwriting the first line of the file, so we need the
+   -- trailing space to account for the extra character taken up by
+   -- the string nextboot_enable="YES" -- our new end quotation
+   -- mark lands on the S.
+   io.write(nfile, "nextboot_enable=\"NO\" ")
+   io.close(nfile)
+   end
 end
 
 -- Module exports
___
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: r329896 - head/sys/ufs/ffs

2018-02-23 Thread Conrad Meyer
On Fri, Feb 23, 2018 at 7:33 PM, Kirk McKusick  wrote:
> Author: mckusick
> Date: Sat Feb 24 03:33:46 2018
> New Revision: 329896
> URL: https://svnweb.freebsd.org/changeset/base/329896
>
> Log:
>   Relax the location restraints when validating one of the
>   backup superblocks.

Hi Kirk,

For future readers, would you mind elaborating a little bit about why
the code was the way it was and why that was too strict?

Thanks,
Conrad
___
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"