Re: svn commit: r307070 - in head/sys: amd64/amd64 conf dev/efidev i386/include modules/efirt sys

2016-10-12 Thread Warner Losh
Yea, I'd made most of those changes in git and lost them :(

Warner

On Wed, Oct 12, 2016 at 5:49 AM, Konstantin Belousov
 wrote:
> On Tue, Oct 11, 2016 at 10:24:30PM +, Warner Losh wrote:
>
>> Added: head/sys/dev/efidev/efidev.c
>> ==
>> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
>> +++ head/sys/dev/efidev/efidev.c  Tue Oct 11 22:24:30 2016
>> (r307070)
>> @@ -0,0 +1,199 @@
>> +/*-
>> + * Copyright (c) 2016 Netflix, Inc.
>> + * All rights reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + * 1. Redistributions of source code must retain the above copyright
>> + *notice, this list of conditions and the following disclaimer
>> + *in this position and unchanged.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + *notice, this list of conditions and the following disclaimer in the
>> + *documentation and/or other materials provided with the distribution.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
>> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
>> + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
>> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
>> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
>> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> + */
>> +
>> +#include 
>> +__FBSDID("$FreeBSD$");
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
> As I asked in review, please use , not 
>
>> +#include 
>> +
>> +static d_ioctl_t efidev_ioctl;
>> +
>> +static struct cdevsw efi_cdevsw = {
>> + .d_name = "efi",
>> + .d_version = D_VERSION,
>> + .d_ioctl = efidev_ioctl,
>> +};
>> +
>> +/* ARGSUSED */
>> +static int
>> +efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr,
>> +int flags __unused, struct thread *td __unused)
>> +{
>> + int error;
>> +
>> + switch (cmd) {
>> + case EFIIOC_GET_TABLE:
>> + {
>> + struct efi_get_table_ioc *egtioc =
>> + (struct efi_get_table_ioc *)addr;
>> +
>> + error = efi_get_table(>uuid, >ptr);
>> + break;
>> + }
>> + case EFIIOC_GET_TIME:
>> + {
>> + struct efi_tm *tm = (struct efi_tm *)addr;
>> +
>> + error = efi_get_time(tm);
>> + break;
>> + }
>> + case EFIIOC_SET_TIME:
>> + {
>> + struct efi_tm *tm = (struct efi_tm *)addr;
>> +
>> + error = efi_set_time(tm);
>> + break;
>> + }
>> + case EFIIOC_VAR_GET:
>> + {
>> + struct efi_var_ioc *ev = (struct efi_var_ioc *)addr;
>> + void *data;
>> + efi_char *name;
>> +
>> + data = malloc(ev->datasize, M_TEMP, M_WAITOK);
>> + name = malloc(ev->namesize, M_TEMP, M_WAITOK);
>> + error = copyin(ev->name, name, ev->namesize);
>> + if (error)
>> + goto vg_out;
>> + if (name[ev->namesize / sizeof(efi_char) - 1] != 0) {
>> + error = EINVAL;
>> + goto vg_out;
>> + }
>> +
>> + error = efi_var_get(name, >vendor, >attrib,
>> + >datasize, data);
>> +
>> + if (error == 0) {
>> + error = copyout(data, ev->data, ev->datasize);
>> + } else if (error == EOVERFLOW) {
>> + /*
>> +  * Pass back the size we really need, but
>> +  * convert the error to 0 so the copyout
>> +  * happens. datasize was updated in the
>> +  * efi_var_get call.
>> +  */
>> + ev->data = NULL;
>> + error = 0;
>> + }
>> +vg_out:
>> + free(data, M_TEMP);
>> + free(name, M_TEMP);
>> + break;
>> + }
>> + case EFIIOC_VAR_NEXT:
>> + {
>> + struct efi_var_ioc *ev = (struct efi_var_ioc *)addr;
>> + efi_char *name;
>> +
>> + name = malloc(ev->namesize, M_TEMP, M_WAITOK);
>> + if (name == NULL) {
> The check is for impossible condition.
>
>> + error = ENOMEM;
>> + goto vn_out;
>> +

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

2016-10-12 Thread Conrad E. Meyer
Author: cem
Date: Thu Oct 13 02:06:23 2016
New Revision: 307163
URL: https://svnweb.freebsd.org/changeset/base/307163

Log:
  kern_linker: Handle module-loading failures in preloaded .ko files
  
  The runtime kernel loader, linker_load_file, unloads kernel files that
  failed to load all of their modules. For consistency, treat preloaded
  (loader.conf loaded) kernel files in the same way.
  
  Reviewed by:  kib
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D8200

Modified:
  head/sys/kern/kern_linker.c
  head/sys/sys/linker.h

Modified: head/sys/kern/kern_linker.c
==
--- head/sys/kern/kern_linker.c Thu Oct 13 01:58:49 2016(r307162)
+++ head/sys/kern/kern_linker.c Thu Oct 13 02:06:23 2016(r307163)
@@ -1599,7 +1599,6 @@ restart:
if (error)
panic("cannot add dependency");
}
-   lf->userrefs++; /* so we can (try to) kldunload it */
error = linker_file_lookup_set(lf, MDT_SETNAME, ,
, NULL);
if (!error) {
@@ -1637,6 +1636,8 @@ restart:
goto fail;
}
linker_file_register_modules(lf);
+   if (!TAILQ_EMPTY(>modules))
+   lf->flags |= LINKER_FILE_MODULES;
if (linker_file_lookup_set(lf, "sysinit_set", _start,
_stop, NULL) == 0)
sysinit_add(si_start, si_stop);
@@ -1654,6 +1655,41 @@ fail:
 SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, 0);
 
 /*
+ * Handle preload files that failed to load any modules.
+ */
+static void
+linker_preload_finish(void *arg)
+{
+   linker_file_t lf, nlf;
+
+   sx_xlock(_sx);
+   TAILQ_FOREACH_SAFE(lf, _files, link, nlf) {
+   /*
+* If all of the modules in this file failed to load, unload
+* the file and return an error of ENOEXEC.  (Parity with
+* linker_load_file.)
+*/
+   if ((lf->flags & LINKER_FILE_MODULES) != 0 &&
+   TAILQ_EMPTY(>modules)) {
+   linker_file_unload(lf, LINKER_UNLOAD_FORCE);
+   continue;
+   }
+
+   lf->flags &= ~LINKER_FILE_MODULES;
+   lf->userrefs++; /* so we can (try to) kldunload it */
+   }
+   sx_xunlock(_sx);
+}
+
+/*
+ * Attempt to run after all DECLARE_MODULE SYSINITs.  Unfortunately they can be
+ * scheduled at any subsystem and order, so run this as late as possible.  init
+ * becomes runnable in SI_SUB_KTHREAD_INIT, so go slightly before that.
+ */
+SYSINIT(preload_finish, SI_SUB_KTHREAD_INIT - 100, SI_ORDER_MIDDLE,
+linker_preload_finish, 0);
+
+/*
  * Search for a not-loaded module by name.
  *
  * Modules may be found in the following locations:

Modified: head/sys/sys/linker.h
==
--- head/sys/sys/linker.h   Thu Oct 13 01:58:49 2016(r307162)
+++ head/sys/sys/linker.h   Thu Oct 13 02:06:23 2016(r307163)
@@ -73,6 +73,7 @@ struct linker_file {
 intuserrefs;   /* kldload(2) count */
 intflags;
 #define LINKER_FILE_LINKED 0x1 /* file has been fully linked */
+#define LINKER_FILE_MODULES0x2 /* file has >0 modules at preload */
 TAILQ_ENTRY(linker_file) link; /* list of all loaded files */
 char*  filename;   /* file which was loaded */
 char*  pathname;   /* file name with full path */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307148 - in head/lib/libc: gen stdlib

2016-10-12 Thread Bruce Evans

On Wed, 12 Oct 2016, Ed Maste wrote:


Log:
 Add comment on use of abort() in libc

 Suggested by:  jonathan (in review D8133)


It is almost easier to fix the bugs than add the comment.


Modified: head/lib/libc/gen/arc4random.c
==
--- head/lib/libc/gen/arc4random.c  Wed Oct 12 13:51:41 2016
(r307147)
+++ head/lib/libc/gen/arc4random.c  Wed Oct 12 13:56:14 2016
(r307148)
@@ -144,8 +144,15 @@ arc4_stir(void)
arc4_init();
rs_initialized = 1;
}
-   if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE)
-   abort(); /* Random sysctl cannot fail. */
+   if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE) {
+   /*
+* The sysctl cannot fail. If it does fail on some FreeBSD
+* derivative or after some future change, just abort so that
+* the problem will be found and fixed. abort is not normally
+* suitable for a library but makes sense here.
+*/
+   abort();
+   }


The comment starts by being just wrong:

1. "The" sysctl is not used here.  Instead, a wrapper arc4_sysctl() is used.
   The wrapper handles some but not all errors.
2. The sysctl can and does fail.  It fails on:
   - all old kernels mixed with new userlands
   - with new kernels, at boot time, before the random device is seeded.

 I couldn't get this to happen in practice, but it used to be a large
 problem ("Dance fandago on keyboard to unblock"), and source code
 still has large warnings about it.  Apparently des's preseeding based
 on device attach times fixes it for me.  I use the new kernels with
3. The sysctl can, or at least used to, return short reads with nonzero
   counts.  The documentation for this is well hidden, but the
   arc4_sysctl() wrapper exists to support short reads, or perhaps just
   the special case of short reads of 0, which it handles poorly by
   possibly spinning forever.

   I couldn't get this to happen either.  I think it takes O_NONBLOCK.
   With interrupts but without O_NONBLOCK, I just got nice denial of
   service attacks with simple dd tests like "dd bs=200m  silently truncates to 256 bytes.

Then the excuse is wrong.  abort() never makes sense in library functions.
Here it gives very confusing errors for the delicate boot-time fandago
case.

Style bugs:
- sentence breaks are 2 spaces in KNF, and all old code in this file follows
  that rule.
- 'abort' is not marked up


arc4_addrandom(rdat, KEYSIZE);


Modified: head/lib/libc/stdlib/random.c
==
--- head/lib/libc/stdlib/random.c   Wed Oct 12 13:51:41 2016
(r307147)
+++ head/lib/libc/stdlib/random.c   Wed Oct 12 13:56:14 2016
(r307148)
@@ -279,8 +279,15 @@ srandomdev(void)

mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
-   if (sysctl(mib, 2, state, , NULL, 0) == -1 || len != expected)
+   if (sysctl(mib, 2, state, , NULL, 0) == -1 || len != expected) {
+   /*
+* The sysctl cannot fail. If it does fail on some FreeBSD


This is even more broken, since it doesn't have the wrapper.

All the old versions using [_]read() mishandled short reads, but this was
less broken when there was a fallback.  For some reason the sysctl wrapper
in arc4random.c alone handled short reads.


+* derivative or after some future change, just abort so that
+* the problem will be found and fixed. abort is not normally
+* suitable for a library but makes sense here.
+*/
abort();
+   }

if (rand_type != TYPE_0) {
fptr = [rand_sep];


There are also gratuitous namespace differences and bugs.  arc4random()
is less standard than random(), so it can use sysctl() without being
technically broken by namespace pollution.  But it uses __sysctl(),
and has style bugs to declare this.  OTOH, random() is now standard
in POSIX, so it has a reason to use __sysctl(), but it just uses sysctl().
Both should use _sysctlbyname(), and this should be declared in
namespace.h.  Old code used _read() instead of read(), but that seems
to be nonsense since read() is more standard than random().

The old code with the fallback to read() was not wrong (except for the
missing short read heandling).  It gave portability to old kernels.  If
the sysctl were documented, then I think its documentation would say
that it acts like a special case of read (without O_NONBLOCK or EINTR
handling), perhaps on a slightly different device than /dev/random,
except for some technical differences for error reporting.  So the read()
is just as secure as the sysctl.  But with no documentation, we can't
tell what the differences are.

Bruce
___
svn-src-head@freebsd.org mailing list

Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-12 Thread Warner Losh
I'll look into it. It worked just fine for me for all the builds I did
on many different machines. Ugg.

Warner

On Wed, Oct 12, 2016 at 5:41 PM, Cy Schubert  wrote:
> In message  om>
> , Ed Maste writes:
>> On 12 October 2016 at 12:55, Zbigniew Bodek  wrote:
>> > Hello Warner,
>> >
>> > Did you try to build world for ARMv6 on HEAD? I'm not able to do so and the
>> > issues seems to be related to this commit (missing efivar.h file).
>>
>> Indeed, my tinderbox build failed for arm.arm, arm.armeb, arm.armv6,
>> arm64.aarch64, pc98.i386, i386.i386 with
>>
>> /scratch/tmp/emaste/freebsd/usr.sbin/efivar/efivar.c:31:10: fatal
>> error: 'efivar.h' file not found
>> #include 
>>  ^
>>
>> I temporarily unhooked it from the build in r307157.
>>
>>
>
> I had the same on amd64.
>
>
> --
> Cheers,
> Cy Schubert 
> FreeBSD UNIX:     Web:  http://www.FreeBSD.org
>
> The need of the many outweighs the greed of the few.
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-12 Thread Cy Schubert
In message 
, Ed Maste writes:
> On 12 October 2016 at 12:55, Zbigniew Bodek  wrote:
> > Hello Warner,
> >
> > Did you try to build world for ARMv6 on HEAD? I'm not able to do so and the
> > issues seems to be related to this commit (missing efivar.h file).
> 
> Indeed, my tinderbox build failed for arm.arm, arm.armeb, arm.armv6,
> arm64.aarch64, pc98.i386, i386.i386 with
> 
> /scratch/tmp/emaste/freebsd/usr.sbin/efivar/efivar.c:31:10: fatal
> error: 'efivar.h' file not found
> #include 
>  ^
> 
> I temporarily unhooked it from the build in r307157.
> 
> 

I had the same on amd64.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

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


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


svn commit: r307159 - in head/etc: defaults rc.d

2016-10-12 Thread Devin Teske
Author: dteske
Date: Wed Oct 12 20:50:17 2016
New Revision: 307159
URL: https://svnweb.freebsd.org/changeset/base/307159

Log:
  Many shops still prefer rc.conf(5) based jail configuration(s). In-part
  because they can use sysrc in conjunction with ssh and xargs to perform
  en-masse changes in a large distribution with lots of jails spread over
  many hosts on a LAN/WAN.
  
  Provide a mechanism for disabling the warning eschewed by /etc/rc.d/jail
  in said situation. If jail_confwarn="NO" is in rc.conf(5) (default "YES")
  skip the warning that per-jail configurations are obsolete and that the
  user should migrate to jail.conf(5).
  
  Reviewed by:  jelischer
  MFC after:3 days
  Sponsored by: FIS Global, Inc.
  Differential Revision:https://reviews.freebsd.org/D7465

Modified:
  head/etc/defaults/rc.conf
  head/etc/rc.d/jail

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Wed Oct 12 20:50:13 2016(r307158)
+++ head/etc/defaults/rc.conf   Wed Oct 12 20:50:17 2016(r307159)
@@ -695,6 +695,7 @@ iovctl_files="" # Config files for iovc
 ### Jail Configuration (see rc.conf(5) manual page) ##
 ##
 jail_enable="NO"   # Set to NO to disable starting of any jails
+jail_confwarn="YES"# Prevent warning about obsolete per-jail configuration
 jail_parallel_start="NO"   # Start jails in the background
 jail_list=""   # Space separated list of names of jails
 jail_reverse_stop="NO" # Stop jails in reverse order

Modified: head/etc/rc.d/jail
==
--- head/etc/rc.d/jail  Wed Oct 12 20:50:13 2016(r307158)
+++ head/etc/rc.d/jail  Wed Oct 12 20:50:17 2016(r307159)
@@ -147,7 +147,8 @@ parse_options()
#
# To relieve confusion, show a warning message.
#
-   _confwarn=1
+   : ${jail_confwarn:=YES}
+   checkyesno jail_confwarn && _confwarn=1
if [ -r "$jail_conf" -o -r "$_jconf" ]; then
if ! checkyesno jail_parallel_start; then
warn "$_conf is created and used for jail $_j."
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307158 - in head/sys: dev/iwm dev/otus dev/usb/wlan net80211

2016-10-12 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Oct 12 20:50:13 2016
New Revision: 307158
URL: https://svnweb.freebsd.org/changeset/base/307158

Log:
  net80211: convert all ieee80211_input_mimo*() consumers
  to ieee80211_add_rx_params() + drop last (ieee80211_rx_stats) parameter
  
  Note: there is an additional check for ieee80211_get_rx_params()
  return value (which does not exist in the original diff).
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D8207

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/otus/if_otus.c
  head/sys/dev/usb/wlan/if_rsu.c
  head/sys/net80211/ieee80211_input.c
  head/sys/net80211/ieee80211_proto.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Oct 12 20:25:03 2016(r307157)
+++ head/sys/dev/iwm/if_iwm.c   Wed Oct 12 20:50:13 2016(r307158)
@@ -2977,6 +2977,8 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
/* rssi is in 1/2db units */
rxs.c_rssi = rssi * 2;
rxs.c_nf = sc->sc_noise;
+   if (ieee80211_add_rx_params(m, ) == 0)
+   goto fail;
 
if (ieee80211_radiotap_active_vap(vap)) {
struct iwm_rx_radiotap_header *tap = >sc_rxtap;
@@ -3013,11 +3015,11 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
IWM_UNLOCK(sc);
if (ni != NULL) {
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "input m %p\n", m);
-   ieee80211_input_mimo(ni, m, );
+   ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni);
} else {
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "inputall m %p\n", m);
-   ieee80211_input_mimo_all(ic, m, );
+   ieee80211_input_mimo_all(ic, m);
}
IWM_LOCK(sc);
 

Modified: head/sys/dev/otus/if_otus.c
==
--- head/sys/dev/otus/if_otus.c Wed Oct 12 20:25:03 2016(r307157)
+++ head/sys/dev/otus/if_otus.c Wed Oct 12 20:50:13 2016(r307158)
@@ -1713,7 +1713,10 @@ otus_sub_rxeof(struct otus_softc *sc, ui
rxs.c_nf = sc->sc_nf[0];/* XXX chain 0 != combined rssi/nf */
rxs.c_rssi = tail->rssi;
/* XXX TODO: add MIMO RSSI/NF as well */
-   ieee80211_add_rx_params(m, );
+   if (ieee80211_add_rx_params(m, ) == 0) {
+   counter_u64_add(ic->ic_ierrors, 1);
+   return;
+   }
 
/* XXX make a method */
STAILQ_INSERT_TAIL(>mq_head, m, m_stailqpkt);
@@ -1826,10 +1829,10 @@ tr_setup:
if (ni != NULL) {
if (ni->ni_flags & IEEE80211_NODE_HT)
m->m_flags |= M_AMPDU;
-   (void)ieee80211_input_mimo(ni, m, NULL);
+   (void)ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni);
} else
-   (void)ieee80211_input_mimo_all(ic, m, NULL);
+   (void)ieee80211_input_mimo_all(ic, m);
}
 #ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_ff_age_all(ic, 100);

Modified: head/sys/dev/usb/wlan/if_rsu.c
==
--- head/sys/dev/usb/wlan/if_rsu.c  Wed Oct 12 20:25:03 2016
(r307157)
+++ head/sys/dev/usb/wlan/if_rsu.c  Wed Oct 12 20:50:13 2016
(r307158)
@@ -1536,10 +1536,12 @@ rsu_event_survey(struct rsu_softc *sc, u
/* This is a number from 0..100; so let's just divide it down a bit */
rxs.c_rssi = le32toh(bss->rssi) / 2;
rxs.c_nf = -96;
+   if (ieee80211_add_rx_params(m, ) == 0)
+   return;
 
/* XXX avoid a LOR */
RSU_UNLOCK(sc);
-   ieee80211_input_mimo_all(ic, m, );
+   ieee80211_input_mimo_all(ic, m);
RSU_LOCK(sc);
 }
 

Modified: head/sys/net80211/ieee80211_input.c
==
--- head/sys/net80211/ieee80211_input.c Wed Oct 12 20:25:03 2016
(r307157)
+++ head/sys/net80211/ieee80211_input.c Wed Oct 12 20:50:13 2016
(r307158)
@@ -83,18 +83,14 @@ ieee80211_process_mimo(struct ieee80211_
 }
 
 int
-ieee80211_input_mimo(struct ieee80211_node *ni, struct mbuf *m,
-struct ieee80211_rx_stats *rx)
+ieee80211_input_mimo(struct ieee80211_node *ni, struct mbuf *m)
 {
struct ieee80211_rx_stats rxs;
 
-   if (rx) {
-   memcpy(, rx, sizeof(*rx));
-   } else {
-   /* try to read from mbuf */
-   bzero(, sizeof(rxs));
-   ieee80211_get_rx_params(m, );
-   }
+   /* try to read stats from mbuf */
+   bzero(, sizeof(rxs));
+   if (ieee80211_get_rx_params(m, ) != 0)
+   return (-1);
 
/* XXX should assert IEEE80211_R_NF and IEEE80211_R_RSSI are set 

Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-12 Thread Ed Maste
On 12 October 2016 at 12:55, Zbigniew Bodek  wrote:
> Hello Warner,
>
> Did you try to build world for ARMv6 on HEAD? I'm not able to do so and the
> issues seems to be related to this commit (missing efivar.h file).

Indeed, my tinderbox build failed for arm.arm, arm.armeb, arm.armv6,
arm64.aarch64, pc98.i386, i386.i386 with

/scratch/tmp/emaste/freebsd/usr.sbin/efivar/efivar.c:31:10: fatal
error: 'efivar.h' file not found
#include 
 ^

I temporarily unhooked it from the build in r307157.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307157 - head/usr.sbin

2016-10-12 Thread Ed Maste
Author: emaste
Date: Wed Oct 12 20:25:03 2016
New Revision: 307157
URL: https://svnweb.freebsd.org/changeset/base/307157

Log:
  Temporarily disconnect efivar to fix arm and i386 builds

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Wed Oct 12 20:24:33 2016(r307156)
+++ head/usr.sbin/Makefile  Wed Oct 12 20:25:03 2016(r307157)
@@ -123,7 +123,7 @@ SUBDIR.${MK_BSNMP}+=bsnmpd
 SUBDIR.${MK_CTM}+= ctm
 SUBDIR.${MK_DIALOG}+=  tzsetup
 SUBDIR.${MK_DIALOG}+=  bsdconfig
-SUBDIR.${MK_EFI}+= efivar
+#SUBDIR.${MK_EFI}+=efivar
 SUBDIR.${MK_FLOPPY}+=  fdcontrol
 SUBDIR.${MK_FLOPPY}+=  fdformat
 SUBDIR.${MK_FLOPPY}+=  fdread
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307156 - head/usr.sbin/freebsd-update

2016-10-12 Thread Colin Percival
Author: cperciva
Date: Wed Oct 12 20:24:33 2016
New Revision: 307156
URL: https://svnweb.freebsd.org/changeset/base/307156

Log:
  MFportsnap r264740: Use case insensitive match when parsing host(1) output.
  
  Some DNS caches turn "FreeBSD.org" into "freebsd.org", which was causing
  the printed SRV records to not match our regex.
  
  PR:   170503
  MFC after:2 weeks

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Wed Oct 12 20:19:33 
2016(r307155)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Wed Oct 12 20:24:33 
2016(r307156)
@@ -953,7 +953,7 @@ fetch_pick_server_init () {
 # "$name server selection ..."; we allow either format.
MLIST="_http._tcp.${SERVERNAME}"
host -t srv "${MLIST}" |
-   sed -nE "s/${MLIST} (has SRV record|server selection) //p" |
+   sed -nE "s/${MLIST} (has SRV record|server selection) //Ip" |
cut -f 1,2,4 -d ' ' |
sed -e 's/\.$//' |
sort > serverlist_full
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307154 - head/sys/dev/usb/net

2016-10-12 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 19:53:10 2016
New Revision: 307154
URL: https://svnweb.freebsd.org/changeset/base/307154

Log:
  [fdt] Add one more heuristic to determine MAC address of the SMSC device
  
  - If check for net,ethernet/usb,device compatible node fails, try to find
  .../usb/hub/ethernet, where ... is bus path that can depend on actual HW.
  net,ethernet/usb,device compatibity strings are FreeBSD custom invention
  that is used only in RPi DTBs and since there is no other way to tie USB
  device to FDT node we just do our best effort here to work with upstream
  device tree
  
  - Use -1 value to indicate invalid phandle_t, 0 is valid phandle value and
  shouldn't be used as error signal

Modified:
  head/sys/dev/usb/net/if_smsc.c

Modified: head/sys/dev/usb/net/if_smsc.c
==
--- head/sys/dev/usb/net/if_smsc.c  Wed Oct 12 19:06:50 2016
(r307153)
+++ head/sys/dev/usb/net/if_smsc.c  Wed Oct 12 19:53:10 2016
(r307154)
@@ -1556,6 +1556,9 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd
 }
 
 #ifdef FDT
+/*
+ * This is FreeBSD-specific compatibility strings for RPi/RPi2
+ */
 static phandle_t
 smsc_fdt_find_eth_node(phandle_t start)
 {
@@ -1567,11 +1570,68 @@ smsc_fdt_find_eth_node(phandle_t start)
fdt_is_compatible(node, "usb,device"))
return (node);
child = smsc_fdt_find_eth_node(node);
-   if (child != 0)
+   if (child != -1)
return (child);
}
 
-   return (0);
+   return (-1);
+}
+
+/*
+ * Check if node's path is <*>/usb/hub/ethernet
+ */
+static int
+smsc_fdt_is_usb_eth(phandle_t node)
+{
+   char name[16];
+   int len;
+
+   memset(name, 0, sizeof(name));
+   len = OF_getprop(node, "name", name, sizeof(name));
+   if (len <= 0)
+   return (0);
+
+   if (strcmp(name, "ethernet"))
+   return (0);
+
+   node = OF_parent(node);
+   if (node == -1)
+   return (0);
+   len = OF_getprop(node, "name", name, sizeof(name));
+   if (len <= 0)
+   return (0);
+
+   if (strcmp(name, "hub"))
+   return (0);
+
+   node = OF_parent(node);
+   if (node == -1)
+   return (0);
+   len = OF_getprop(node, "name", name, sizeof(name));
+   if (len <= 0)
+   return (0);
+
+   if (strcmp(name, "usb"))
+   return (0);
+
+   return (1);
+}
+
+static phandle_t
+smsc_fdt_find_eth_node_by_path(phandle_t start)
+{
+   phandle_t child, node;
+
+   /* Traverse through entire tree to find usb ethernet nodes. */
+   for (node = OF_child(start); node != 0; node = OF_peer(node)) {
+   if (smsc_fdt_is_usb_eth(node))
+   return (node);
+   child = smsc_fdt_find_eth_node_by_path(node);
+   if (child != -1)
+   return (child);
+   }
+
+   return (-1);
 }
 
 /**
@@ -1587,8 +1647,14 @@ smsc_fdt_find_mac(unsigned char *mac)
 
root = OF_finddevice("/");
node = smsc_fdt_find_eth_node(root);
-   if (node != 0) {
+   /*
+* If it's not FreeBSD FDT blob for RPi, try more
+* generic .../usb/hub/ethernet
+*/
+   if (node == -1)
+   node = smsc_fdt_find_eth_node_by_path(root);
 
+   if (node != -1) {
/* Check if there is property */
if ((len = OF_getproplen(node, "local-mac-address")) > 0) {
if (len != ETHER_ADDR_LEN)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307153 - head/sys/netinet

2016-10-12 Thread Jonathan T. Looney
Author: jtl
Date: Wed Oct 12 19:06:50 2016
New Revision: 307153
URL: https://svnweb.freebsd.org/changeset/base/307153

Log:
  The TFO server-side code contains some changes that are not conditioned on
  the TCP_RFC7413 kernel option. This change removes those few instructions
  from the packet processing path.
  
  While not strictly necessary, for the sake of consistency, I applied the
  new IS_FASTOPEN macro to all places in the packet processing path that
  used the (t_flags & TF_FASTOPEN) check.
  
  Reviewed by:  hiren
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D8219

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Oct 12 18:49:30 2016
(r307152)
+++ head/sys/netinet/tcp_input.cWed Oct 12 19:06:50 2016
(r307153)
@@ -1028,7 +1028,7 @@ relocked:
 #endif
if (!((tp->t_state == TCPS_ESTABLISHED && (thflags & TH_SYN) == 0) ||
  (tp->t_state == TCPS_LISTEN && (thflags & TH_SYN) &&
-  !(tp->t_flags & TF_FASTOPEN {
+  !IS_FASTOPEN(tp->t_flags {
if (ti_locked == TI_UNLOCKED) {
if (INP_INFO_TRY_RLOCK(_tcbinfo) == 0) {
in_pcbref(inp);
@@ -1506,7 +1506,9 @@ tcp_do_segment(struct mbuf *m, struct tc
struct in_conninfo *inc;
struct mbuf *mfree;
struct tcpopt to;
+#ifdef TCP_RFC7413
int tfo_syn;
+#endif

 #ifdef TCPDEBUG
/*
@@ -1964,7 +1966,7 @@ tcp_do_segment(struct mbuf *m, struct tc
goto dropwithreset;
}
 #ifdef TCP_RFC7413
-   if (tp->t_flags & TF_FASTOPEN) {
+   if (IS_FASTOPEN(tp->t_flags)) {
/*
 * When a TFO connection is in SYN_RECEIVED, the
 * only valid packets are the initial SYN, a
@@ -2398,7 +2400,7 @@ tcp_do_segment(struct mbuf *m, struct tc
(tp->t_flags & TF_NEEDSYN)) {
 #ifdef TCP_RFC7413
if (tp->t_state == TCPS_SYN_RECEIVED &&
-   tp->t_flags & TF_FASTOPEN) {
+   IS_FASTOPEN(tp->t_flags)) {
tp->snd_wnd = tiwin;
cc_conn_init(tp);
}
@@ -2461,7 +2463,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 * snd_cwnd reduction that occurs when a TFO SYN|ACK
 * is retransmitted.
 */
-   if (!(tp->t_flags & TF_FASTOPEN))
+   if (!IS_FASTOPEN(tp->t_flags))
 #endif
cc_conn_init(tp);
tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp));
@@ -3028,8 +3030,12 @@ dodata:  
/* XXX */
 * case PRU_RCVD).  If a FIN has already been received on this
 * connection then we just ignore the text.
 */
+#ifdef TCP_RFC7413
tfo_syn = ((tp->t_state == TCPS_SYN_RECEIVED) &&
-  (tp->t_flags & TF_FASTOPEN));
+  IS_FASTOPEN(tp->t_flags));
+#else
+#definetfo_syn (false)
+#endif
if ((tlen || (thflags & TH_FIN) || tfo_syn) &&
TCPS_HAVERCVDFIN(tp->t_state) == 0) {
tcp_seq save_start = th->th_seq;
@@ -3253,6 +3259,9 @@ drop:
if (tp != NULL)
INP_WUNLOCK(tp->t_inpcb);
m_freem(m);
+#ifndef TCP_RFC7413
+#undef tfo_syn
+#endif
 }
 
 /*

Modified: head/sys/netinet/tcp_output.c
==
--- head/sys/netinet/tcp_output.c   Wed Oct 12 18:49:30 2016
(r307152)
+++ head/sys/netinet/tcp_output.c   Wed Oct 12 19:06:50 2016
(r307153)
@@ -230,7 +230,7 @@ tcp_output(struct tcpcb *tp)
 * For TFO connections in SYN_RECEIVED, only allow the initial
 * SYN|ACK and those sent by the retransmit timer.
 */
-   if ((tp->t_flags & TF_FASTOPEN) &&
+   if (IS_FASTOPEN(tp->t_flags) &&
(tp->t_state == TCPS_SYN_RECEIVED) &&
SEQ_GT(tp->snd_max, tp->snd_una) &&/* initial SYN|ACK sent */
(tp->snd_nxt != tp->snd_una))  /* not a retransmit */
@@ -426,7 +426,7 @@ after_sack_rexmit:
 * When sending additional segments following a TFO SYN|ACK,
 * do not include the SYN bit.
 */
-   if ((tp->t_flags & TF_FASTOPEN) &&
+   if (IS_FASTOPEN(tp->t_flags) &&
(tp->t_state == TCPS_SYN_RECEIVED))
flags &= ~TH_SYN;
 #endif
@@ -449,7 

svn commit: r307152 - head/sys/mips/conf

2016-10-12 Thread Ed Maste
Author: emaste
Date: Wed Oct 12 18:49:30 2016
New Revision: 307152
URL: https://svnweb.freebsd.org/changeset/base/307152

Log:
  Add COMPAT_FREEBSD10 to the MIPS ERL kernel config
  
  As of r302092, pipe is a wrapper around pipe2 and the pipe syscall is no
  longer used. It is included only with the COMPAT_FREEBSD10 kernel option.
  Add the compat option to support upgrades from systems with an earlier
  userland.
  
  MFC after:1 week

Modified:
  head/sys/mips/conf/ERL

Modified: head/sys/mips/conf/ERL
==
--- head/sys/mips/conf/ERL  Wed Oct 12 17:10:59 2016(r307151)
+++ head/sys/mips/conf/ERL  Wed Oct 12 18:49:30 2016(r307152)
@@ -74,6 +74,7 @@ options   PSEUDOFS# Pseudo-filesystem f
 optionsGEOM_PART_GPT   # GUID Partition Tables.
 optionsGEOM_LABEL  # Provides labelization
 optionsCOMPAT_FREEBSD32# Compatible with o32 binaries
+optionsCOMPAT_FREEBSD10# Compatible with FreeBSD10
 optionsSCSI_DELAY=5000 # Delay (in ms) before probing SCSI
 optionsKTRACE  # ktrace(1) support
 optionsSTACK   # stack(9) support
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307151 - in head/sys: arm/arm arm64/arm64 mips/mips

2016-10-12 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 17:10:59 2016
New Revision: 307151
URL: https://svnweb.freebsd.org/changeset/base/307151

Log:
  INTRNG: Propagate IRQ activation error to API consumer
  
  Keep resource state consistent with INTRNG state - if intr_activate_irq
  fails - deactivate resource and propagate error to calling function
  
  Reviewed by:  mmel

Modified:
  head/sys/arm/arm/nexus.c
  head/sys/arm64/arm64/nexus.c
  head/sys/mips/mips/nexus.c

Modified: head/sys/arm/arm/nexus.c
==
--- head/sys/arm/arm/nexus.cWed Oct 12 15:49:20 2016(r307150)
+++ head/sys/arm/arm/nexus.cWed Oct 12 17:10:59 2016(r307151)
@@ -383,7 +383,11 @@ nexus_activate_resource(device_t bus, de
return (0);
} else if (type == SYS_RES_IRQ) {
 #ifdef INTRNG
-   intr_activate_irq(child, r);
+   err = intr_activate_irq(child, r);
+   if (err != 0) {
+   rman_deactivate_resource(r);
+   return (err);
+   }
 #endif
}
return (0);

Modified: head/sys/arm64/arm64/nexus.c
==
--- head/sys/arm64/arm64/nexus.cWed Oct 12 15:49:20 2016
(r307150)
+++ head/sys/arm64/arm64/nexus.cWed Oct 12 17:10:59 2016
(r307151)
@@ -347,7 +347,11 @@ nexus_activate_resource(device_t bus, de
rman_set_virtual(r, (void *)vaddr);
rman_set_bushandle(r, vaddr);
} else if (type == SYS_RES_IRQ) {
-   intr_activate_irq(child, r);
+   err = intr_activate_irq(child, r);
+   if (err != 0) {
+   rman_deactivate_resource(r);
+   return (err);
+   }
}
return (0);
 }

Modified: head/sys/mips/mips/nexus.c
==
--- head/sys/mips/mips/nexus.c  Wed Oct 12 15:49:20 2016(r307150)
+++ head/sys/mips/mips/nexus.c  Wed Oct 12 17:10:59 2016(r307151)
@@ -433,7 +433,11 @@ nexus_activate_resource(device_t bus, de
} else if (type == SYS_RES_IRQ) {
 #ifdef INTRNG
 #ifdef FDT
-   intr_activate_irq(child, r);
+   err = intr_activate_irq(child, r);
+   if (err != 0) {
+   rman_deactivate_resource(r);
+   return (err);
+   }
 #else
/*
 * INTRNG without FDT needs to have the interrupt properly
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-12 Thread Zbigniew Bodek
Hello Warner,

Did you try to build world for ARMv6 on HEAD? I'm not able to do so and the
issues seems to be related to this commit (missing efivar.h file).

Kind regards
zbb

2016-10-12 0:31 GMT+02:00 Warner Losh :

> Author: imp
> Date: Tue Oct 11 22:31:45 2016
> New Revision: 307072
> URL: https://svnweb.freebsd.org/changeset/base/307072
>
> Log:
>   Add efivar(1) to manipulate EFI variables. It uses a similar command
>   line interface to the Linux program, as well as adding a number of
>   useful features to make using it in shell scripts easier (since we
>   don't have a filesystem to fall back on interacting with).
>
>   Differential Revision: https://reviews.freebsd.org/D8128
>   Reviewed by: kib@, wblock@, Ganael Laplanche
>
> Added:
>   head/usr.sbin/efivar/
>   head/usr.sbin/efivar/Makefile   (contents, props changed)
>   head/usr.sbin/efivar/efivar.8   (contents, props changed)
>   head/usr.sbin/efivar/efivar.c   (contents, props changed)
> Modified:
>   head/usr.sbin/Makefile
>
> Modified: head/usr.sbin/Makefile
> 
> ==
> --- head/usr.sbin/Makefile  Tue Oct 11 22:30:41 2016(r307071)
> +++ head/usr.sbin/Makefile  Tue Oct 11 22:31:45 2016(r307072)
> @@ -123,6 +123,7 @@ SUBDIR.${MK_BSNMP}+=bsnmpd
>  SUBDIR.${MK_CTM}+= ctm
>  SUBDIR.${MK_DIALOG}+=  tzsetup
>  SUBDIR.${MK_DIALOG}+=  bsdconfig
> +SUBDIR.${MK_EFI}+= efivar
>  SUBDIR.${MK_FLOPPY}+=  fdcontrol
>  SUBDIR.${MK_FLOPPY}+=  fdformat
>  SUBDIR.${MK_FLOPPY}+=  fdread
>
> Added: head/usr.sbin/efivar/Makefile
> 
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/usr.sbin/efivar/Makefile   Tue Oct 11 22:31:45 2016
> (r307072)
> @@ -0,0 +1,8 @@
> +# $FreeBSD$
> +
> +PROG=  efivar
> +MAN=   efivar.8
> +
> +LIBADD= efivar
> +
> +.include 
>
> Added: head/usr.sbin/efivar/efivar.8
> 
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/usr.sbin/efivar/efivar.8   Tue Oct 11 22:31:45 2016
> (r307072)
> @@ -0,0 +1,164 @@
> +.\" Copyright (c) 2003 Netflix, Inc
> +.\" All rights reserved.
> +.\"
> +.\" Redistribution and use in source and binary forms, with or without
> +.\" modification, are permitted provided that the following conditions
> +.\" are met:
> +.\" 1. Redistributions of source code must retain the above copyright
> +.\"notice, this list of conditions and the following disclaimer.
> +.\" 2. Redistributions in binary form must reproduce the above copyright
> +.\"notice, this list of conditions and the following disclaimer in the
> +.\"documentation and/or other materials provided with the
> distribution.
> +.\"
> +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
> AND
> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> +.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
> LIABLE
> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> CONSEQUENTIAL
> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
> GOODS
> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> STRICT
> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
> WAY
> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> +.\" SUCH DAMAGE.
> +.\"
> +.\" $FreeBSD$
> +.\"
> +.Dd September 29, 2016
> +.Dt EFIVAR 8
> +.Os
> +.Sh NAME
> +.Nm efivar
> +.Nd UEFI environemnt variable interaction
> +.Sh SYNOPSIS
> +.Nm
> +.Op Fl abdDHlLNpRtw
> +.Op Fl n Ar name
> +.Op Fl f Ar file
> +.Op Fl -append
> +.Op Fl -ascii
> +.Op Fl -attributes
> +.Op Fl -binary
> +.Op Fl -delete
> +.Op Fl -fromfile Ar file
> +.Op Fl -hex
> +.Op Fl -list-guids
> +.Op Fl -list
> +.Op Fl -name Ar name
> +.Op Fl -no-name
> +.Op Fl -print
> +.Op Fl -print-decimal
> +.Op Fl -raw-guid
> +.Op Fl -write
> +.Ar name Ns Op = Ns Ar value
> +.Sh DESCRIPTION
> +This program manages
> +.Dq Unified Extensible Firmware Interface
> +.Pq UEFI
> +environment variables.
> +UEFI variables have three part: A namespace, a name and a value.
> +The namespace is a GUID that's self assigned by the group defining the
> +variables.
> +The name is a Unicode name for the variable.
> +The value is binary data.
> +All Unicode data is presented to the user as UTF-8.
> +.Pp
> +The following options are available:
> +.Bl -tag -width 20m
> +.It Fl n Ar name Fl -name Ar name
> +Specify the name of the variable to operate on.
> +The
> +.Ar name
> +argument is the GUID of variable, followed by a dash, followed by the
> +UEFI variable name.
> +The GUID may be 

Re: svn commit: r306680 - in head/sys: amd64/amd64 amd64/include i386/include x86/include x86/x86

2016-10-12 Thread Slawa Olhovchenkov
On Wed, Oct 12, 2016 at 06:30:09PM +0300, Andriy Gapon wrote:

> On 12/10/2016 16:45, Konstantin Belousov wrote:
> > On Wed, Oct 12, 2016 at 04:25:00PM +0300, Andriy Gapon wrote:
> >> On 04/10/2016 20:01, Konstantin Belousov wrote:
> >>> Author: kib
> >>> Date: Tue Oct  4 17:01:24 2016
> >>> New Revision: 306680
> >>> URL: https://svnweb.freebsd.org/changeset/base/306680
> >>>
> >>> Log:
> >>>   Re-apply r306516 (by cem):
> >>>   
> >>>   Reduce the cost of TLB invalidation on x86 by using per-CPU completion 
> >>> flags
> >>>   
> >>>   Reduce contention during TLB invalidation operations by using a per-CPU
> >>>   completion flag, rather than a single atomically-updated variable.
> >>
> >> Kostik,
> >>
> >> could this commit cause a problem reported in the below links?
> >> https://bz-attachments.freebsd.org/attachment.cgi?id=175614
> >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213371
> > 
> > If I am reading the report right, the problem appears on the
> > 11.0-RELEASE system. The patch you reference was only applied to HEAD a
> > week ago and was not merged even to stable/11.
> 
> Sorry for the noise, then.  Somehow I thought that this went into the release
> branch, but obviously there was too little time for that.
> 
> > The examination must start with backtracing the thread which owns the
> > smp_ipi_mtx (shown on the screenshot).
> 
> It looks like DDB is not in GENERIC in 11.0?

Yes, DDB is absent in GENERIC 11.0

> Not sure if the reporter would be able to configure a dump device and then 
> save
> the dump given that the panic happens in the installer.
> If anyone could provide them with instructions that would be great.
> 
> -- 
> Andriy Gapon
> ___
> svn-src-...@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-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307150 - head/gnu/usr.bin/groff

2016-10-12 Thread Ed Maste
Author: emaste
Date: Wed Oct 12 15:49:20 2016
New Revision: 307150
URL: https://svnweb.freebsd.org/changeset/base/307150

Log:
  Avoid using 'head' in generating groff doc date
  
  It may not be available in certain cross build cases.
  
  Note that this is a slight change in functionality, in that now only the
  first line of the source ChangeLog file is processed. This is acceptable
  as groff will be retired and we won't encounter a possibly-different
  ChangeLog format.
  
  Reported by:  jhibbits
  Tested by:jhibbits

Modified:
  head/gnu/usr.bin/groff/mdate.sh

Modified: head/gnu/usr.bin/groff/mdate.sh
==
--- head/gnu/usr.bin/groff/mdate.sh Wed Oct 12 15:29:22 2016
(r307149)
+++ head/gnu/usr.bin/groff/mdate.sh Wed Oct 12 15:49:20 2016
(r307150)
@@ -4,6 +4,5 @@
 set -e
 test -r "$1"
 export LC_ALL=C
-changelog_date=$(sed -E -n 's/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/\1/p' "$1" |\
-head -n 1)
+changelog_date=$(sed -E -n '1s/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/\1/p' "$1")
 echo $(date -j -f %Y-%m-%d +"%e %B %Y" $changelog_date)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r306680 - in head/sys: amd64/amd64 amd64/include i386/include x86/include x86/x86

2016-10-12 Thread Andriy Gapon
On 12/10/2016 16:45, Konstantin Belousov wrote:
> On Wed, Oct 12, 2016 at 04:25:00PM +0300, Andriy Gapon wrote:
>> On 04/10/2016 20:01, Konstantin Belousov wrote:
>>> Author: kib
>>> Date: Tue Oct  4 17:01:24 2016
>>> New Revision: 306680
>>> URL: https://svnweb.freebsd.org/changeset/base/306680
>>>
>>> Log:
>>>   Re-apply r306516 (by cem):
>>>   
>>>   Reduce the cost of TLB invalidation on x86 by using per-CPU completion 
>>> flags
>>>   
>>>   Reduce contention during TLB invalidation operations by using a per-CPU
>>>   completion flag, rather than a single atomically-updated variable.
>>
>> Kostik,
>>
>> could this commit cause a problem reported in the below links?
>> https://bz-attachments.freebsd.org/attachment.cgi?id=175614
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213371
> 
> If I am reading the report right, the problem appears on the
> 11.0-RELEASE system. The patch you reference was only applied to HEAD a
> week ago and was not merged even to stable/11.

Sorry for the noise, then.  Somehow I thought that this went into the release
branch, but obviously there was too little time for that.

> The examination must start with backtracing the thread which owns the
> smp_ipi_mtx (shown on the screenshot).

It looks like DDB is not in GENERIC in 11.0?
Not sure if the reporter would be able to configure a dump device and then save
the dump given that the panic happens in the installer.
If anyone could provide them with instructions that would be great.

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


svn commit: r307149 - head/release/arm

2016-10-12 Thread Andrew Turner
Author: andrew
Date: Wed Oct 12 15:29:22 2016
New Revision: 307149
URL: https://svnweb.freebsd.org/changeset/base/307149

Log:
  Use the armv6 GENERIC kernel in the release images on hardware this kernel
  config supports.
  
  Approved by:  gjb
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D8147

Modified:
  head/release/arm/BANANAPI.conf
  head/release/arm/CUBIEBOARD2.conf
  head/release/arm/RPI2.conf

Modified: head/release/arm/BANANAPI.conf
==
--- head/release/arm/BANANAPI.conf  Wed Oct 12 13:56:14 2016
(r307148)
+++ head/release/arm/BANANAPI.conf  Wed Oct 12 15:29:22 2016
(r307149)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv6"
 EMBEDDEDPORTS="sysutils/u-boot-bananapi"
-KERNEL="ALLWINNER"
+KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"
 IMAGE_SIZE="1G"
 PART_SCHEME="MBR"

Modified: head/release/arm/CUBIEBOARD2.conf
==
--- head/release/arm/CUBIEBOARD2.conf   Wed Oct 12 13:56:14 2016
(r307148)
+++ head/release/arm/CUBIEBOARD2.conf   Wed Oct 12 15:29:22 2016
(r307149)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv6"
 EMBEDDEDPORTS="sysutils/u-boot-cubieboard2"
-KERNEL="ALLWINNER"
+KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"
 IMAGE_SIZE="1G"
 PART_SCHEME="MBR"

Modified: head/release/arm/RPI2.conf
==
--- head/release/arm/RPI2.conf  Wed Oct 12 13:56:14 2016(r307148)
+++ head/release/arm/RPI2.conf  Wed Oct 12 15:29:22 2016(r307149)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv6"
 EMBEDDEDPORTS="sysutils/u-boot-rpi2"
-KERNEL="RPI2"
+KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x200"
 IMAGE_SIZE="1G"
 PART_SCHEME="MBR"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307082 - in head: . sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules/cc sys/modules/khelp sys/netinet sys/netinet/tcp_stacks sys/pc98/conf s

2016-10-12 Thread Jonathan Looney
On Wed, Oct 12, 2016 at 5:44 AM, Slawa Olhovchenkov  wrote:

> Do you perform estimate of performane impact of this overhead?
>
>
Somewhat, but not precisely. It will depend on (at least) a few factors:

a. The hardware
   * How fast is your CPU? Your L1/L2/L3 cache?
   * How many CPUs?
   * How smart is the hardware prefetching?
   * How fast is the memory bus?
   * etc.
b. Whether VNET is enabled
   * If VNET is enabled, the hook lookup will require more instructions to
 find the correct list
c. Which TCP stack you are using
   * The hook lookup is implemented as an external function in the
 non-default stacks, so that requires the overhead of a function call
d. The probability that the number of hooks is in your CPU cache
   * This is a combination of the hardware and the exact workload on the
 device

On a test system running a fairly heavy load of TCP traffic using the
default TCP stack, without VNET, and without any TCP hooks installed, the
input/output hhook functions accounted for approximately .075% of the
"busy" CPU cycles during one of my measurements. That certainly is not a
large number, but it is large enough to be measurable. And, I think the
hardware I used for the measurement is tuned for high-performance, so
this may be close to the "best case" measurement.

I suspect that systems with a large number of short-lived sessions will
see a larger improvement from the deletion of khelp_init_osd() from the
session setup path. (I didn't measure this.)

I also suspect that systems with VNET will see a larger improvement.

I also suspect that systems with slower memory busses, smaller caches,
etc. will see a larger improvement.

But, this is very hard to measure precisely in a generic sense. The one
concrete thing we *can* measure is that the functions add some number
of instructions to the session setup, session teardown, input, and
output code paths. If you need those instructions to achieve the desired
functionality (in this case, probably a congestion-control algorithm),
then you probably want those instructions. If not, then you may want to
delete them. This was the impetus to add a kernel option to give you
the ability to decide whether you want to include the functionality.

I hope this answer helps explain some more about the change.

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


svn commit: r307147 - head/sys/conf

2016-10-12 Thread Ruslan Bukin
Author: br
Date: Wed Oct 12 13:51:41 2016
New Revision: 307147
URL: https://svnweb.freebsd.org/changeset/base/307147

Log:
  Keep in-sync MK_SSP=no option both with kernel and userspace.
  
  Pointed out by:   emaste
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Modified:
  head/sys/conf/kern.opts.mk

Modified: head/sys/conf/kern.opts.mk
==
--- head/sys/conf/kern.opts.mk  Wed Oct 12 13:19:21 2016(r307146)
+++ head/sys/conf/kern.opts.mk  Wed Oct 12 13:51:41 2016(r307147)
@@ -65,7 +65,7 @@ BROKEN_OPTIONS+= CDDL ZFS
 .endif
 
 .if ${MACHINE_CPUARCH} == "mips"
-BROKEN_OPTIONS+= CDDL ZFS
+BROKEN_OPTIONS+= CDDL ZFS SSP
 .endif
 
 .if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r306364 - in head: lib/libc/tests share/mk

2016-10-12 Thread Ruslan Bukin
On Wed, Oct 05, 2016 at 08:44:39PM +, Ed Maste wrote:
> On 27 September 2016 at 09:44, Ruslan Bukin  wrote:
> > Author: br
> > Date: Tue Sep 27 09:44:30 2016
> > New Revision: 306364
> > URL: https://svnweb.freebsd.org/changeset/base/306364
> >
> > Log:
> >   Mark SSP broken on MIPS.
> 
> This needs an adjustment in sys/conf/kern.opts.mk as well it seems;
> 'make showconfig' (as used by makeman to generate src.conf.5) now
> reports SSP is both 'no' and 'yes' on mips:
> 
> % make TARGET=mips TARGET_ARCH=mips showconfig | grep SSP
> MK_SSP   = no
> MK_SSP   = yes
> 

I made a change, but for some reason it works from buildenv only:

make TARGET=mips TARGET_ARCH=mips buildenv
% make showconfig  |grep SSP
MK_SSP   = no

It looks like MACHINE_CPUARCH is not exported by showconfig.

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


svn commit: r307148 - in head/lib/libc: gen stdlib

2016-10-12 Thread Ed Maste
Author: emaste
Date: Wed Oct 12 13:56:14 2016
New Revision: 307148
URL: https://svnweb.freebsd.org/changeset/base/307148

Log:
  Add comment on use of abort() in libc
  
  Suggested by: jonathan (in review D8133)

Modified:
  head/lib/libc/gen/arc4random.c
  head/lib/libc/stdlib/random.c

Modified: head/lib/libc/gen/arc4random.c
==
--- head/lib/libc/gen/arc4random.c  Wed Oct 12 13:51:41 2016
(r307147)
+++ head/lib/libc/gen/arc4random.c  Wed Oct 12 13:56:14 2016
(r307148)
@@ -144,8 +144,15 @@ arc4_stir(void)
arc4_init();
rs_initialized = 1;
}
-   if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE)
-   abort(); /* Random sysctl cannot fail. */
+   if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE) {
+   /*
+* The sysctl cannot fail. If it does fail on some FreeBSD
+* derivative or after some future change, just abort so that
+* the problem will be found and fixed. abort is not normally
+* suitable for a library but makes sense here.
+*/
+   abort();
+   }
 
arc4_addrandom(rdat, KEYSIZE);
 

Modified: head/lib/libc/stdlib/random.c
==
--- head/lib/libc/stdlib/random.c   Wed Oct 12 13:51:41 2016
(r307147)
+++ head/lib/libc/stdlib/random.c   Wed Oct 12 13:56:14 2016
(r307148)
@@ -279,8 +279,15 @@ srandomdev(void)
 
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
-   if (sysctl(mib, 2, state, , NULL, 0) == -1 || len != expected)
+   if (sysctl(mib, 2, state, , NULL, 0) == -1 || len != expected) {
+   /*
+* The sysctl cannot fail. If it does fail on some FreeBSD
+* derivative or after some future change, just abort so that
+* the problem will be found and fixed. abort is not normally
+* suitable for a library but makes sense here.
+*/
abort();
+   }
 
if (rand_type != TYPE_0) {
fptr = [rand_sep];
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r306680 - in head/sys: amd64/amd64 amd64/include i386/include x86/include x86/x86

2016-10-12 Thread Konstantin Belousov
On Wed, Oct 12, 2016 at 04:25:00PM +0300, Andriy Gapon wrote:
> On 04/10/2016 20:01, Konstantin Belousov wrote:
> > Author: kib
> > Date: Tue Oct  4 17:01:24 2016
> > New Revision: 306680
> > URL: https://svnweb.freebsd.org/changeset/base/306680
> > 
> > Log:
> >   Re-apply r306516 (by cem):
> >   
> >   Reduce the cost of TLB invalidation on x86 by using per-CPU completion 
> > flags
> >   
> >   Reduce contention during TLB invalidation operations by using a per-CPU
> >   completion flag, rather than a single atomically-updated variable.
> 
> Kostik,
> 
> could this commit cause a problem reported in the below links?
> https://bz-attachments.freebsd.org/attachment.cgi?id=175614
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213371

If I am reading the report right, the problem appears on the
11.0-RELEASE system. The patch you reference was only applied to HEAD a
week ago and was not merged even to stable/11.

The examination must start with backtracing the thread which owns the
smp_ipi_mtx (shown on the screenshot).
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r306680 - in head/sys: amd64/amd64 amd64/include i386/include x86/include x86/x86

2016-10-12 Thread Andriy Gapon
On 04/10/2016 20:01, Konstantin Belousov wrote:
> Author: kib
> Date: Tue Oct  4 17:01:24 2016
> New Revision: 306680
> URL: https://svnweb.freebsd.org/changeset/base/306680
> 
> Log:
>   Re-apply r306516 (by cem):
>   
>   Reduce the cost of TLB invalidation on x86 by using per-CPU completion flags
>   
>   Reduce contention during TLB invalidation operations by using a per-CPU
>   completion flag, rather than a single atomically-updated variable.

Kostik,

could this commit cause a problem reported in the below links?
https://bz-attachments.freebsd.org/attachment.cgi?id=175614
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213371

>   On a Westmere system (2 sockets x 4 cores x 1 threads), dtrace measurements
>   show that smp_tlb_shootdown is about 50% faster with this patch; 
> observations
>   with VTune show that the percentage of time spent in invlrng_single_page on 
> an
>   interrupt (actually doing invalidation, rather than synchronization) 
> increases
>   from 31% with the old mechanism to 71% with the new one.  (Running a basic 
> file
>   server workload.)
>   
>   Submitted by:   Anton Rang 
>   Reviewed by:cem (earlier version)
>   Sponsored by:   Dell EMC Isilon
>   Differential Revision:  https://reviews.freebsd.org/D8041

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


svn commit: r307146 - head/lib/libc

2016-10-12 Thread Ruslan Bukin
Author: br
Date: Wed Oct 12 13:19:21 2016
New Revision: 307146
URL: https://svnweb.freebsd.org/changeset/base/307146

Log:
  Add different libc ldscript: the one without libssp --
  we don't have it when MK_SSP==no.
  
  This fixes compilation on MIPS.
  
  Reviewed by:  imp
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D8212

Added:
  head/lib/libc/libc_nossp.ldscript   (contents, props changed)
Modified:
  head/lib/libc/Makefile

Modified: head/lib/libc/Makefile
==
--- head/lib/libc/Makefile  Wed Oct 12 12:56:18 2016(r307145)
+++ head/lib/libc/Makefile  Wed Oct 12 13:19:21 2016(r307146)
@@ -29,7 +29,11 @@ LIBC_ARCH=${MACHINE_CPUARCH}
 # to CFLAGS below.  -DSYSLIBC_SCCS affects just the system call stubs.
 LIB=c
 SHLIB_MAJOR= 7
+.if ${MK_SSP} != "no"
 SHLIB_LDSCRIPT=libc.ldscript
+.else
+SHLIB_LDSCRIPT=libc_nossp.ldscript
+.endif
 SHLIB_LDSCRIPT_LINKS=libxnet.so
 WARNS?=2
 CFLAGS+=-I${LIBC_SRCTOP}/include -I${LIBC_SRCTOP}/../../include

Added: head/lib/libc/libc_nossp.ldscript
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/libc_nossp.ldscript   Wed Oct 12 13:19:21 2016
(r307146)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+GROUP ( @@SHLIB@@ @@LIBDIR@@/libc_nonshared.a )
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307145 - head/sys/dev/kbd

2016-10-12 Thread Ed Maste
Author: emaste
Date: Wed Oct 12 12:56:18 2016
New Revision: 307145
URL: https://svnweb.freebsd.org/changeset/base/307145

Log:
  Use M_WAITOK in PIO_KEYMAP ioctl
  
  The malloc return value is not checked.
  
  Submitted by: CTurt 
  MFC after:1 week

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

Modified: head/sys/dev/kbd/kbd.c
==
--- head/sys/dev/kbd/kbd.c  Wed Oct 12 12:17:41 2016(r307144)
+++ head/sys/dev/kbd/kbd.c  Wed Oct 12 12:56:18 2016(r307145)
@@ -888,7 +888,7 @@ genkbd_commonioctl(keyboard_t *kbd, u_lo
case PIO_KEYMAP:/* set keyboard translation table */
case OPIO_KEYMAP:   /* set keyboard translation table (compat) */
 #ifndef KBD_DISABLE_KEYMAP_LOAD
-   mapp = malloc(sizeof *mapp, M_TEMP, M_NOWAIT);
+   mapp = malloc(sizeof *mapp, M_TEMP, M_WAITOK);
if (cmd == OPIO_KEYMAP) {
omapp = (okeymap_t *)arg;
mapp->n_keys = omapp->n_keys;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307070 - in head/sys: amd64/amd64 conf dev/efidev i386/include modules/efirt sys

2016-10-12 Thread Konstantin Belousov
On Tue, Oct 11, 2016 at 10:24:30PM +, Warner Losh wrote:

> Added: head/sys/dev/efidev/efidev.c
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/sys/dev/efidev/efidev.c  Tue Oct 11 22:24:30 2016
> (r307070)
> @@ -0,0 +1,199 @@
> +/*-
> + * Copyright (c) 2016 Netflix, Inc.
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer
> + *in this position and unchanged.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#include 
> +__FBSDID("$FreeBSD$");
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
As I asked in review, please use , not 

> +#include 
> +
> +static d_ioctl_t efidev_ioctl;
> +
> +static struct cdevsw efi_cdevsw = {
> + .d_name = "efi",
> + .d_version = D_VERSION,
> + .d_ioctl = efidev_ioctl,
> +};
> + 
> +/* ARGSUSED */
> +static int
> +efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr,
> +int flags __unused, struct thread *td __unused)
> +{
> + int error;
> +
> + switch (cmd) {
> + case EFIIOC_GET_TABLE:
> + {
> + struct efi_get_table_ioc *egtioc =
> + (struct efi_get_table_ioc *)addr;
> +
> + error = efi_get_table(>uuid, >ptr);
> + break;
> + }
> + case EFIIOC_GET_TIME:
> + {
> + struct efi_tm *tm = (struct efi_tm *)addr;
> +
> + error = efi_get_time(tm);
> + break;
> + }
> + case EFIIOC_SET_TIME:
> + {
> + struct efi_tm *tm = (struct efi_tm *)addr;
> +
> + error = efi_set_time(tm);
> + break;
> + }
> + case EFIIOC_VAR_GET:
> + {
> + struct efi_var_ioc *ev = (struct efi_var_ioc *)addr;
> + void *data;
> + efi_char *name;
> +
> + data = malloc(ev->datasize, M_TEMP, M_WAITOK);
> + name = malloc(ev->namesize, M_TEMP, M_WAITOK);
> + error = copyin(ev->name, name, ev->namesize);
> + if (error)
> + goto vg_out;
> + if (name[ev->namesize / sizeof(efi_char) - 1] != 0) {
> + error = EINVAL;
> + goto vg_out;
> + }
> +
> + error = efi_var_get(name, >vendor, >attrib,
> + >datasize, data);
> +
> + if (error == 0) {
> + error = copyout(data, ev->data, ev->datasize);
> + } else if (error == EOVERFLOW) {
> + /*
> +  * Pass back the size we really need, but
> +  * convert the error to 0 so the copyout
> +  * happens. datasize was updated in the
> +  * efi_var_get call.
> +  */
> + ev->data = NULL;
> + error = 0;
> + }
> +vg_out:
> + free(data, M_TEMP);
> + free(name, M_TEMP);
> + break;
> + }
> + case EFIIOC_VAR_NEXT:
> + {
> + struct efi_var_ioc *ev = (struct efi_var_ioc *)addr;
> + efi_char *name;
> +
> + name = malloc(ev->namesize, M_TEMP, M_WAITOK);
> + if (name == NULL) {
The check is for impossible condition.

> + error = ENOMEM;
> + goto vn_out;
> + }
> + error = copyin(ev->name, name, ev->namesize);
> + if (error)
> + goto vn_out;
> + /* Note: namesize is the buffer size, not the string lenght */
> +
> + error = efi_var_nextname(>namesize, name, 

svn commit: r307141 - head/sys/sys

2016-10-12 Thread Andriy Gapon
Author: avg
Date: Wed Oct 12 11:17:10 2016
New Revision: 307141
URL: https://svnweb.freebsd.org/changeset/base/307141

Log:
  remove a few stray spaces from sys/param.h

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hWed Oct 12 11:12:31 2016(r307140)
+++ head/sys/sys/param.hWed Oct 12 11:17:10 2016(r307141)
@@ -44,7 +44,7 @@
 #define BSD4_3 1
 #define BSD4_4 1
 
-/* 
+/*
  * __FreeBSD_version numbers are documented in the Porter's Handbook.
  * If you bump the version for any reason, you should update the documentation
  * there.
@@ -241,7 +241,7 @@
  *
  * BKVASIZE -  Nominal buffer space per buffer, in bytes.  BKVASIZE is the
  * minimum KVM memory reservation the kernel is willing to make.
- * Filesystems can of course request smaller chunks.  Actual 
+ * Filesystems can of course request smaller chunks.  Actual
  * backing memory uses a chunk size of a page (PAGE_SIZE).
  * The default value here can be overridden on a per-architecture
  * basis by defining it in .  This should
@@ -250,8 +250,8 @@
  *
  * If you make BKVASIZE too small you risk seriously fragmenting
  * the buffer KVM map which may slow things down a bit.  If you
- * make it too big the kernel will not be able to optimally use 
- * the KVM memory reserved for the buffer cache and will wind 
+ * make it too big the kernel will not be able to optimally use
+ * the KVM memory reserved for the buffer cache and will wind
  * up with too-few buffers.
  *
  * The default is 16384, roughly 2x the block size used by a
@@ -344,7 +344,7 @@ __END_DECLS
 
 #define dbtoc(db)  /* calculates devblks to pages */ \
((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
- 
+
 #define ctodb(db)  /* calculates pages to devblks */ \
((db) << (PAGE_SHIFT - DEV_BSHIFT))
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307140 - head/sys/sys

2016-10-12 Thread Andriy Gapon
Author: avg
Date: Wed Oct 12 11:12:31 2016
New Revision: 307140
URL: https://svnweb.freebsd.org/changeset/base/307140

Log:
  bump __FreeBSD_version for libzfs_core.h

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hWed Oct 12 10:28:54 2016(r307139)
+++ head/sys/sys/param.hWed Oct 12 11:12:31 2016(r307140)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200012  /* Master, propagated to newvers */
+#define __FreeBSD_version 1200013  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307082 - in head: . sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules/cc sys/modules/khelp sys/netinet sys/netinet/tcp_stacks sys/pc98/conf s

2016-10-12 Thread Slawa Olhovchenkov
On Wed, Oct 12, 2016 at 02:16:42AM +, Jonathan T. Looney wrote:

> Author: jtl
> Date: Wed Oct 12 02:16:42 2016
> New Revision: 307082
> URL: https://svnweb.freebsd.org/changeset/base/307082
> 
> Log:
>   In the TCP stack, the hhook(9) framework provides hooks for kernel modules
>   to add actions that run when a TCP frame is sent or received on a TCP
>   session in the ESTABLISHED state. In the base tree, this functionality is
>   only used for the h_ertt module, which is used by the cc_cdg, cc_chd, cc_hd,
>   and cc_vegas congestion control modules.
>   
>   Presently, we incur overhead to check for hooks each time a TCP frame is
>   sent or received on an ESTABLISHED TCP session.

Do you perform estimate of performane impact of this overhead?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307132 - head/sys/cam/scsi

2016-10-12 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 08:25:13 2016
New Revision: 307132
URL: https://svnweb.freebsd.org/changeset/base/307132

Log:
  Use copyout() instead of pointing sbuf to user-space buffer.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cWed Oct 12 07:08:32 2016
(r307131)
+++ head/sys/cam/scsi/scsi_enc_ses.cWed Oct 12 08:25:13 2016
(r307132)
@@ -2672,13 +2672,13 @@ ses_get_elm_devnames(enc_softc_t *enc, e
if (len < 0)
return (EINVAL);
 
-   sbuf_new(, elmdn->elm_devnames, len, 0);
-
cam_periph_unlock(enc->periph);
+   sbuf_new(, NULL, len, SBUF_FIXEDLEN);
ses_paths_iter(enc, >enc_cache.elm_map[elmdn->elm_idx],
   ses_elmdevname_callback, );
sbuf_finish();
elmdn->elm_names_len = sbuf_len();
+   copyout(sbuf_data(), elmdn->elm_devnames, elmdn->elm_names_len + 1);
cam_periph_lock(enc->periph);
return (elmdn->elm_names_len > 0 ? 0 : ENODEV);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307131 - head/include

2016-10-12 Thread Andriy Gapon
Author: avg
Date: Wed Oct 12 07:08:32 2016
New Revision: 307131
URL: https://svnweb.freebsd.org/changeset/base/307131

Log:
  install header files required development with libzfs_core
  
  libzfs_core provides a rather limited but committed (stable) interface
  for working with ZFS.  We install libzfs_core shared library but we do
  not install header files required for developing programs that use
  the library.  This change is to install the required header files
  libzfs_core.h, libnvpair.h and sys/nvpair.h.
  
  The headers are installed into the same locations as on illumos.
  
  Reviewed by:  mav, markj
  Differential Revision: https://reviews.freebsd.org/D8005

Modified:
  head/include/Makefile

Modified: head/include/Makefile
==
--- head/include/Makefile   Wed Oct 12 06:58:01 2016(r307130)
+++ head/include/Makefile   Wed Oct 12 07:08:32 2016(r307131)
@@ -237,6 +237,17 @@ copies: .PHONY .META
cd ${.CURDIR}/../sys/teken; \
${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
${DESTDIR}${INCLUDEDIR}/teken
+.if ${MK_CDDL} != "no"
+   cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 
libzfs_core.h \
+   ${DESTDIR}${INCLUDEDIR}
+   cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
+   ${DESTDIR}${INCLUDEDIR}
+   cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
+   ${DESTDIR}${INCLUDEDIR}/sys
+.endif
 
 symlinks: .PHONY .META
@${ECHO} "Setting up symlinks to kernel source tree..."
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307130 - head/sys/dev/smbus

2016-10-12 Thread Andriy Gapon
Author: avg
Date: Wed Oct 12 06:58:01 2016
New Revision: 307130
URL: https://svnweb.freebsd.org/changeset/base/307130

Log:
  smbus: allow child devices to be added via hints
  
  This will allow to add slave drivers in the same fashion as for iicbus.
  
  Also, allow other code to add a child device and set its 'addr' ivar.
  The ivar can only be set if it's unset, it can not be changed.
  That could be used, for example, by a platform driver that has
  a precise description of the hardware and, thus, knows what drivers
  can handle what slaves.
  
  The slave auto-probing code is unsafe and broken because it uses
  7-bit slave addresses.  It's going to be removed.
  
  Note: internally the driver uses address of zero as an unset address
  while smbus_get_addr() returns it as -1 for compatibility reasons.
  The address is expected to be unset only for children that do not
  work with slaves like, for example, smb(4).
  
  Reviewed by:  jhb
  Differential Revision: https://reviews.freebsd.org/D8173

Modified:
  head/sys/dev/smbus/smbconf.h
  head/sys/dev/smbus/smbus.c

Modified: head/sys/dev/smbus/smbconf.h
==
--- head/sys/dev/smbus/smbconf.hWed Oct 12 05:50:47 2016
(r307129)
+++ head/sys/dev/smbus/smbconf.hWed Oct 12 06:58:01 2016
(r307130)
@@ -34,6 +34,10 @@
 
 #define n(flags) (~(flags) & (flags))
 
+/* Order constants for smbus children. */
+#define SMBUS_ORDER_HINTED 20
+#define SMBUS_ORDER_PNP40
+
 /*
  * How tsleep() is called in smb_request_bus().
  */

Modified: head/sys/dev/smbus/smbus.c
==
--- head/sys/dev/smbus/smbus.c  Wed Oct 12 05:50:47 2016(r307129)
+++ head/sys/dev/smbus/smbus.c  Wed Oct 12 06:58:01 2016(r307130)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,54 +42,16 @@ __FBSDID("$FreeBSD$");
 #include "smbus_if.h"
 #include "bus_if.h"
 
+struct smbus_ivar
+{
+   uint8_t addr;
+};
 
 /*
  * Autoconfiguration and support routines for System Management bus
  */
+static void smbus_probe_device(device_t dev, u_char addr);
 
-/*
- * Device methods
- */
-static int smbus_probe(device_t);
-static int smbus_attach(device_t);
-static int smbus_detach(device_t);
-
-static int smbus_child_location_str(device_t parent, device_t child,
-   char *buf, size_t buflen);
-static int smbus_print_child(device_t parent, device_t child);
-static void smbus_probe_device(device_t dev, u_char* addr);
-static int smbus_read_ivar(device_t parent, device_t child, int which,
-   uintptr_t *result);
-
-static device_method_t smbus_methods[] = {
-/* device interface */
-DEVMETHOD(device_probe, smbus_probe),
-DEVMETHOD(device_attach,smbus_attach),
-DEVMETHOD(device_detach,smbus_detach),
-
-   /* bus interface */
-   DEVMETHOD(bus_add_child,bus_generic_add_child),
-   DEVMETHOD(bus_child_location_str, smbus_child_location_str),
-   DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-   DEVMETHOD(bus_print_child,  smbus_print_child),
-   DEVMETHOD(bus_read_ivar,smbus_read_ivar),
-
-   DEVMETHOD_END
-};
-
-driver_t smbus_driver = {
-"smbus",
-smbus_methods,
-sizeof(struct smbus_softc),
-};
-
-devclass_t smbus_devclass;
-
-/*
- * At 'probe' time, we add all the devices which we know about to the
- * bus.  The generic attach routine will probe and attach them if they
- * are alive.
- */
 static int
 smbus_probe(device_t dev)
 {
@@ -107,9 +70,9 @@ smbus_attach(device_t dev)
mtx_init(>lock, device_get_nameunit(dev), "smbus", MTX_DEF);
bus_generic_probe(dev);
for (addr = SMBUS_ADDR_MIN; addr < SMBUS_ADDR_MAX; ++addr) {
-   sc->addrs[addr] = addr;
-   smbus_probe_device(dev, >addrs[addr]);
+   smbus_probe_device(dev, addr);
}
+   bus_enumerate_hinted_children(dev);
bus_generic_attach(dev);
 
return (0);
@@ -124,6 +87,7 @@ smbus_detach(device_t dev)
error = bus_generic_detach(dev);
if (error)
return (error);
+   device_delete_children(dev);
mtx_destroy(>lock);
 
return (0);
@@ -135,34 +99,78 @@ smbus_generic_intr(device_t dev, u_char 
 }
 
 static void
-smbus_probe_device(device_t dev, u_char* addr)
+smbus_probe_device(device_t dev, u_char addr)
 {
device_t child;
int error;
u_char cmd;
u_char buf[2];
+   struct smbus_ivar *devi;
 
cmd = 0x01;
-   error = smbus_trans(dev, *addr, cmd,
+   error = smbus_trans(dev, addr, cmd,
SMB_TRANS_NOCNT | SMB_TRANS_NOREPORT,
NULL, 0, buf, 1, NULL);
if (error == 0) {