Re: svn commit: r294535 - in head/sys/netinet: . cc tcp_stacks

2016-01-24 Thread Gleb Smirnoff
  Lawrence,

On Sat, Jan 23, 2016 at 05:19:36PM +1100, Lawrence Stewart wrote:
L> > The problem is that cc.h (or tcp_cc.h) is already depening on many
L> > TCP types. So, the structures defined inside are not agnostic, including
L> > tcp headers before cc.h is required.
L> 
L> Not in any significant way that tightly couples the API to TCP from
L> consumers' perspective.
L> 
L> > The old cc.h used to include tcp.h implicitly, which is a bad style.
L> > 
L> > Since many developers sorted netinet/* includes in a .c file using
L> > sort(1), that lead to cc.h always come before actual tcp includes,
L> > hiding the real requirement for tcp.h in a .c file.
L> 
L> To provide some more context, I considered that choice to be a lesser
L> evil at the time. Linux had set the defacto standard macro naming and
L> location so even though I would have put the CC related defines in cc.h
L> given the choice, I wanted third-party software which checked for
L> modular CC the Linux way to work on FreeBSD. The alphabetical ordering
L> of includes is what prompted me to include tcp.h in cc.h so that cc.h
L> could happily sit at the top of the list. I probably could have just
L> moved cc.h to the cc subdir, in which case it would always come
L> logically after the TCP includes as  - perhaps that's
L> the right solution.

Well, if the intent was to provide some sort of compatibility with Linux,
then my rename is even more valid! Look what left in the cc.h in the
Netflix source (which is kinda forward of FreeBSD): almost the whole
file is under _KERNEL. Only the tcp.h pollution left for userland.

If Linux has cc.h and we want to put same definitions in cc.h, then
we should start new cc.h and keep this one renamed. Because if we
provided that one, we won't provide any compatibility, but would
just pollute with tcp.h.

I am fine with netinet/cc/cc.h. If you agree I can run the rename.

-- 
Totus tuus, Glebius.
___
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: r294660 - in head/sys: conf dev/extres dev/extres/clk

2016-01-24 Thread Michal Meloun
Author: mmel
Date: Sun Jan 24 11:00:38 2016
New Revision: 294660
URL: https://svnweb.freebsd.org/changeset/base/294660

Log:
  Add clock framework, a first part of new 'extended resources' family of
  support frameworks(i.e. reset/regulators/phy/tsensors/fuses...).
  
  The clock framework significantly simplifies handling of complex clock
  structures found in modern SoCs. It provides the unified consumers
  interface, holds and manages actual clock topology, frequency and gating.
  
  It's tested on three different ARM boards (Nvidia Tegra TK1, Inforce 6410 and
  Odroid XU2) and on one MIPS board (Creator Ci20) by kan@.
  
  The framework is still far from perfect and probably doesn't have stable
  interface yet, but we want to start testing it on more real boards and
  different architectures.
  
  Reviewed by: ian, kan (earlier version)

Added:
  head/sys/dev/extres/
  head/sys/dev/extres/clk/
  head/sys/dev/extres/clk/clk.c   (contents, props changed)
  head/sys/dev/extres/clk/clk.h   (contents, props changed)
  head/sys/dev/extres/clk/clk_div.c   (contents, props changed)
  head/sys/dev/extres/clk/clk_div.h   (contents, props changed)
  head/sys/dev/extres/clk/clk_fixed.c   (contents, props changed)
  head/sys/dev/extres/clk/clk_fixed.h   (contents, props changed)
  head/sys/dev/extres/clk/clk_gate.c   (contents, props changed)
  head/sys/dev/extres/clk/clk_gate.h   (contents, props changed)
  head/sys/dev/extres/clk/clk_mux.c   (contents, props changed)
  head/sys/dev/extres/clk/clk_mux.h   (contents, props changed)
  head/sys/dev/extres/clk/clkdev_if.m   (contents, props changed)
  head/sys/dev/extres/clk/clknode_if.m   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/conf/options

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Jan 24 09:24:23 2016(r294659)
+++ head/sys/conf/files Sun Jan 24 11:00:38 2016(r294660)
@@ -1410,6 +1410,13 @@ dev/ex/if_ex.c   optional ex
 dev/ex/if_ex_isa.c optional ex isa
 dev/ex/if_ex_pccard.c  optional ex pccard
 dev/exca/exca.coptional cbb
+dev/extres/clk/clk.c   optional ext_resources clk
+dev/extres/clk/clkdev_if.m optional ext_resources clk
+dev/extres/clk/clknode_if.moptional ext_resources clk
+dev/extres/clk/clk_div.c   optional ext_resources clk
+dev/extres/clk/clk_fixed.c optional ext_resources clk
+dev/extres/clk/clk_gate.c  optional ext_resources clk
+dev/extres/clk/clk_mux.c   optional ext_resources clk
 dev/fatm/if_fatm.c optional fatm pci
 dev/fb/fbd.c   optional fbd | vt
 dev/fb/fb_if.m standard

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Sun Jan 24 09:24:23 2016(r294659)
+++ head/sys/conf/options   Sun Jan 24 11:00:38 2016(r294660)
@@ -90,6 +90,7 @@ COMPAT_LINUXKPI   opt_compat.h
 COMPILING_LINT opt_global.h
 CY_PCI_FASTINTR
 DEADLKRES  opt_watchdog.h
+EXT_RESOURCES  opt_global.h
 DIRECTIO
 FILEMONopt_dontuse.h
 FFCLOCK

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

svn commit: r294661 - in head/sys: conf dev/extres/hwreset

2016-01-24 Thread Michal Meloun
Author: mmel
Date: Sun Jan 24 11:03:35 2016
New Revision: 294661
URL: https://svnweb.freebsd.org/changeset/base/294661

Log:
  Add reset framework, a second part of new 'extended resources' family of
  support frameworks (i.e. regulators/phy/tsensors/fuses...).
  
  It provides simple unified consumers interface for manipulations with
  on-chip resets.
  
  Reviewed by: ian, imp (paritaly)

Added:
  head/sys/dev/extres/hwreset/
  head/sys/dev/extres/hwreset/hwreset.c   (contents, props changed)
  head/sys/dev/extres/hwreset/hwreset.h   (contents, props changed)
  head/sys/dev/extres/hwreset/hwreset_if.m   (contents, props changed)
Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Jan 24 11:00:38 2016(r294660)
+++ head/sys/conf/files Sun Jan 24 11:03:35 2016(r294661)
@@ -1417,6 +1417,8 @@ dev/extres/clk/clk_div.c  optional ext_re
 dev/extres/clk/clk_fixed.c optional ext_resources clk
 dev/extres/clk/clk_gate.c  optional ext_resources clk
 dev/extres/clk/clk_mux.c   optional ext_resources clk
+dev/extres/hwreset/hwreset.c   optional ext_resources hwreset
+dev/extres/hwreset/hwreset_if.moptional ext_resources hwreset
 dev/fatm/if_fatm.c optional fatm pci
 dev/fb/fbd.c   optional fbd | vt
 dev/fb/fb_if.m standard

Added: head/sys/dev/extres/hwreset/hwreset.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/extres/hwreset/hwreset.c   Sun Jan 24 11:03:35 2016
(r294661)
@@ -0,0 +1,186 @@
+/*-
+ * Copyright 2016 Michal Meloun 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+#include "opt_platform.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef FDT
+#include 
+#include 
+#endif
+
+#include 
+
+#include "hwreset_if.h"
+
+struct hwreset {
+   device_t consumer_dev;  /* consumer device*/
+   device_t provider_dev;  /* provider device*/
+   int rst_id; /* reset id */
+};
+
+MALLOC_DEFINE(M_HWRESET, "hwreset", "Reset framework");
+
+int
+hwreset_assert(hwreset_t rst)
+{
+
+   return (HWRESET_ASSERT(rst->provider_dev, rst->rst_id, true));
+}
+
+int
+hwreset_deassert(hwreset_t rst)
+{
+
+   return (HWRESET_ASSERT(rst->provider_dev, rst->rst_id, false));
+}
+
+int
+hwreset_is_asserted(hwreset_t rst, bool *value)
+{
+
+   return (HWRESET_IS_ASSERTED(rst->provider_dev, rst->rst_id, value));
+}
+
+void
+hwreset_release(hwreset_t rst)
+{
+   free(rst, M_HWRESET);
+}
+
+int
+hwreset_get_by_id(device_t consumer_dev, device_t provider_dev, intptr_t id,
+hwreset_t *rst_out)
+{
+   hwreset_t rst;
+
+   /* Create handle */
+   rst = malloc(sizeof(struct hwreset), M_HWRESET,
+   M_WAITOK | M_ZERO);
+   rst->consumer_dev = consumer_dev;
+   rst->provider_dev = provider_dev;
+   rst->rst_id = id;
+   *rst_out = rst;
+   return (0);
+}
+
+#ifdef FDT
+int
+hwreset_default_ofw_map(device_t provider_dev, phandle_t xref, int ncells,
+pcell_t *cells, intptr_t *id)
+{
+   if (ncells == 0)
+   *id = 1;
+   else if (ncells == 1)
+   *id = cells[0];
+   else
+   return  (ERANGE);
+
+   return (0);
+}
+
+int
+hwreset_get_by_ofw_idx(device_t consumer_dev, int idx, hwreset_t *rst)
+{
+   phandle_t cnode, xnode;
+   pcell_t *cells;
+   device_t rstdev;
+   int ncells, rv;
+   intptr_t id;
+
+   cnode = ofw_bus_get_node(consumer_d

svn commit: r294662 - head/lib/libproc

2016-01-24 Thread Ruslan Bukin
Author: br
Date: Sun Jan 24 12:10:29 2016
New Revision: 294662
URL: https://svnweb.freebsd.org/changeset/base/294662

Log:
  Add support for RISC-V ISA.
  
  Reviewed by:  andrew
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D5040

Modified:
  head/lib/libproc/proc_bkpt.c
  head/lib/libproc/proc_regs.c

Modified: head/lib/libproc/proc_bkpt.c
==
--- head/lib/libproc/proc_bkpt.cSun Jan 24 11:03:35 2016
(r294661)
+++ head/lib/libproc/proc_bkpt.cSun Jan 24 12:10:29 2016
(r294662)
@@ -61,6 +61,9 @@ __FBSDID("$FreeBSD$");
 #elif defined(__powerpc__)
 #defineBREAKPOINT_INSTR0x7fe8  /* trap */
 #defineBREAKPOINT_INSTR_SZ 4
+#elif defined(__riscv__)
+#defineBREAKPOINT_INSTR0x00100073  /* sbreak */
+#defineBREAKPOINT_INSTR_SZ 4
 #else
 #error "Add support for your architecture"
 #endif

Modified: head/lib/libproc/proc_regs.c
==
--- head/lib/libproc/proc_regs.cSun Jan 24 11:03:35 2016
(r294661)
+++ head/lib/libproc/proc_regs.cSun Jan 24 12:10:29 2016
(r294662)
@@ -66,6 +66,8 @@ proc_regget(struct proc_handle *phdl, pr
*regvalue = regs.r_regs[PC];
 #elif defined(__powerpc__)
*regvalue = regs.pc;
+#elif defined(__riscv__)
+   *regvalue = regs.sepc;
 #endif
break;
case REG_SP:
@@ -81,6 +83,8 @@ proc_regget(struct proc_handle *phdl, pr
*regvalue = regs.r_regs[SP];
 #elif defined(__powerpc__)
*regvalue = regs.fixreg[1];
+#elif defined(__riscv__)
+   *regvalue = regs.sp;
 #endif
break;
default:
@@ -117,6 +121,8 @@ proc_regset(struct proc_handle *phdl, pr
regs.r_regs[PC] = regvalue;
 #elif defined(__powerpc__)
regs.pc = regvalue;
+#elif defined(__riscv__)
+   regs.sepc = regvalue;
 #endif
break;
case REG_SP:
@@ -132,6 +138,8 @@ proc_regset(struct proc_handle *phdl, pr
regs.r_regs[PC] = regvalue;
 #elif defined(__powerpc__)
regs.fixreg[1] = regvalue;
+#elif defined(__riscv__)
+   regs.sp = regvalue;
 #endif
break;
default:
___
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: r294663 - head/sys/vm

2016-01-24 Thread Konstantin Belousov
Author: kib
Date: Sun Jan 24 13:38:41 2016
New Revision: 294663
URL: https://svnweb.freebsd.org/changeset/base/294663

Log:
  Typo in comment.

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cSun Jan 24 12:10:29 2016(r294662)
+++ head/sys/vm/vm_map.cSun Jan 24 13:38:41 2016(r294663)
@@ -1553,7 +1553,7 @@ again:
  *
  * The map must be locked.
  *
- * This routine guarentees that the passed entry remains valid (though
+ * This routine guarantees that the passed entry remains valid (though
  * possibly extended).  When merging, this routine may delete one or
  * both neighbors.
  */
___
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: r293801 - in head: . etc share/examples/ypldap usr.sbin/ypldap

2016-01-24 Thread Antoine Brodin
On Jan 13, 2016 2:49 AM, "Marcelo Araujo"  wrote:
>
> Author: araujo
> Date: Wed Jan 13 01:49:35 2016
> New Revision: 293801
> URL: https://svnweb.freebsd.org/changeset/base/293801
>
> Log:
>   ypldap(8) is a feature ready to be used to translate nis(8) database to
ldap(3).
>
>   This commit, fix a core dump on ypldap(8) related with memory
allocation.
>   Also an example of how to set the ypldap.conf(5) properly is added to
>   examples files.
>
>   A new user _ypldap is required to be able to run ypldap(8) as well as
>   in a chroot mode.
>
>   Reviewed by:  rodrigc (mentor), bjk
>   Approved by:  bapt (mentor)
>   Relnotes: Yes
>   Sponsored by: gandi.net
>   Differential Revision:https://reviews.freebsd.org/D4744
>

Hi,

Uid 93 is already used in the ports tree by jabber.  (/usr/ports/UIDs)

Cheers,

Antoine

> Added:
>   head/share/examples/ypldap/
>   head/share/examples/ypldap/ypldap.conf   (contents, props changed)
> Modified:
>   head/UPDATING
>   head/etc/master.passwd
>   head/usr.sbin/ypldap/yp.c
>   head/usr.sbin/ypldap/ypldap.conf.5
>
> Modified: head/UPDATING
>
==
> --- head/UPDATING   Wed Jan 13 01:32:04 2016(r293800)
> +++ head/UPDATING   Wed Jan 13 01:49:35 2016(r293801)
> @@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
> disable the most expensive debugging functionality run
> "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
>
> +20160113:
> +   With the addition of ypldap(8), a new _ypldap user is now required
> +   during installworld. "mergemaster -p" can be used to add the user
> +   prior to installworld, as documented in the handbook.
> +
>  20151216:
> The tftp loader (pxeboot) now uses the option root-path
directive. As a
> consequence it no longer looks for a pxeboot.4th file on the tftp
>
> Modified: head/etc/master.passwd
>
==
> --- head/etc/master.passwd  Wed Jan 13 01:32:04 2016(r293800)
> +++ head/etc/master.passwd  Wed Jan 13 01:49:35 2016(r293801)
> @@ -22,5 +22,6 @@ uucp:*:66:66::0:0:UUCP pseudo-user:/var/
>  pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin
>  auditdistd:*:78:77::0:0:Auditdistd unprivileged
user:/var/empty:/usr/sbin/nologin
>  www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
> +_ypldap:*:93:93::0:0:YP Ldap unprivileged
user:/var/empty:/usr/sbin/nologin
>  hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
>  nobody:*:65534:65534::0:0:Unprivileged
user:/nonexistent:/usr/sbin/nologin
>
> Added: head/share/examples/ypldap/ypldap.conf
>
==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/share/examples/ypldap/ypldap.conf  Wed Jan 13 01:49:35 2016
  (r293801)
> @@ -0,0 +1,40 @@
> +$FreeBSD$
> +domain "freebsd.org"
> +interval   60
> +provide map"passwd.byname"
> +provide map"passwd.byuid"
> +provide map"group.byname"
> +provide map"group.bygid"
> +provide map"netid.byname"
> +
> +directory "127.0.0.1" {
> +   # directory options
> +   binddn "cn=ldap,dc=freebsd,dc=org"
> +   bindcred "secret"
> +   basedn "dc=freebsd.,dc=org"
> +   # starting point for groups directory search, default to basedn
> +   groupdn "ou=Groups,dc=freebsd,dc=org"
> +
> +   # passwd maps configuration (RFC 2307 posixAccount object class)
> +   passwd filter "(objectClass=posixAccount)"
> +
> +   attribute name maps to "uid"
> +   fixed attribute passwd "*"
> +   attribute uid maps to "uidNumber"
> +   attribute gid maps to "gidNumber"
> +   attribute gecos maps to "cn"
> +   attribute home maps to "homeDirectory"
> +   attribute shell maps to "loginShell"
> +   fixed attribute change "0"
> +   fixed attribute expire "0"
> +   fixed attribute class ""
> +
> +   # group maps configuration (RFC 2307 posixGroup object class)
> +   group filter "(objectClass=posixGroup)"
> +
> +   attribute groupname maps to "cn"
> +   fixed attribute grouppasswd "*"
> +   attribute groupgid maps to "gidNumber"
> +   # memberUid returns multiple group members
> +   list groupmembers maps to "memberUid"
> +}
>
> Modified: head/usr.sbin/ypldap/yp.c
>
==
> --- head/usr.sbin/ypldap/yp.c   Wed Jan 13 01:32:04 2016(r293800)
> +++ head/usr.sbin/ypldap/yp.c   Wed Jan 13 01:49:35 2016(r293801)
> @@ -83,10 +83,10 @@ void
>  yp_enable_events(void)
>  {
> int i;
> -   extern fd_set   svc_fdset;
> +   extern fd_set svc_fdset;
> struct yp_event *ye;
>
> -   for (i = 0; i < getdtablesize(); i++) {
> +   for (i = 0; i < FD_SETSIZE; i++

Re: svn commit: r294329 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-01-24 Thread Shawn Webb
On Tue, Jan 19, 2016 at 05:00:25PM +, Alan Somers wrote:
> Author: asomers
> Date: Tue Jan 19 17:00:25 2016
> New Revision: 294329
> URL: https://svnweb.freebsd.org/changeset/base/294329
> 
> Log:
>   Disallow zvol-backed ZFS pools
>   
>   Using zvols as backing devices for ZFS pools is fraught with panics and
>   deadlocks. For example, attempting to online a missing device in the
>   presence of a zvol can cause a panic when vdev_geom tastes the zvol.  Better
>   to completely disable vdev_geom from ever opening a zvol. The solution
>   relies on setting a thread-local variable during vdev_geom_open, and
>   returning EOPNOTSUPP during zvol_open if that thread-local variable is set.
>   
>   Remove the check for MUTEX_HELD(&zfsdev_state_lock) in zvol_open. Its intent
>   was to prevent a recursive mutex acquisition panic. However, the new check
>   for the thread-local variable also fixes that problem.
>   
>   Also, fix a panic in vdev_geom_taste_orphan. For an unknown reason, this
>   function was set to panic. But it can occur that a device disappears during
>   tasting, and it causes no problems to ignore this departure.
>   
>   Reviewed by:delphij
>   MFC after:  1 week
>   Relnotes:   yes
>   Sponsored by:   Spectra Logic Corp
>   Differential Revision:  https://reviews.freebsd.org/D4986

I've just been bit by this pretty hard. I have a bhyve VM that's backed
by a zvol. The VM is running root-on-zfs. I wrote some experimental code
that's now preventing the VM from booting (kernel panic due to userland
change). Since I can't import the pool, I have no way of fixing the
problem.

I'm probably just going to go revert this commit locally on my box so I
can get some work done.

Thanks,

-- 
Shawn Webb
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r294329 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-01-24 Thread Julian Elischer

On 24/01/2016 10:13 PM, Shawn Webb wrote:

On Tue, Jan 19, 2016 at 05:00:25PM +, Alan Somers wrote:

Author: asomers
Date: Tue Jan 19 17:00:25 2016
New Revision: 294329
URL: https://svnweb.freebsd.org/changeset/base/294329

Log:
   Disallow zvol-backed ZFS pools
   
   Using zvols as backing devices for ZFS pools is fraught with panics and

   deadlocks. For example, attempting to online a missing device in the
   presence of a zvol can cause a panic when vdev_geom tastes the zvol.  Better
   to completely disable vdev_geom from ever opening a zvol. The solution
   relies on setting a thread-local variable during vdev_geom_open, and
   returning EOPNOTSUPP during zvol_open if that thread-local variable is set.
   
   Remove the check for MUTEX_HELD(&zfsdev_state_lock) in zvol_open. Its intent

   was to prevent a recursive mutex acquisition panic. However, the new check
   for the thread-local variable also fixes that problem.
   
   Also, fix a panic in vdev_geom_taste_orphan. For an unknown reason, this

   function was set to panic. But it can occur that a device disappears during
   tasting, and it causes no problems to ignore this departure.
   
   Reviewed by:	delphij

   MFC after:   1 week
   Relnotes:yes
   Sponsored by:Spectra Logic Corp
   Differential Revision:   https://reviews.freebsd.org/D4986

I've just been bit by this pretty hard. I have a bhyve VM that's backed
by a zvol. The VM is running root-on-zfs. I wrote some experimental code
that's now preventing the VM from booting (kernel panic due to userland
change). Since I can't import the pool, I have no way of fixing the
problem.

I'm probably just going to go revert this commit locally on my box so I
can get some work done.

I use an md device to do this in bhyve but I was considering using a zvol.
Populating it in the host system and then presenting it to the VM as a 
disk.

maybe it could be enabled with a sysctl?  Is the problem always present?


Thanks,



___
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: r294329 - inhead/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-01-24 Thread Cy Schubert
A previous email in this thread said that a sysctl will be committed before MFC.

I personally have never encountered this particular problem.

Sent from my cellphone,
~Cy

-Original Message-
From: Julian Elischer
Sent: 24/01/2016 06:20
To: Shawn Webb; Alan Somers
Cc: src-committ...@freebsd.org; svn-src-...@freebsd.org; 
svn-src-head@freebsd.org; Xin LI
Subject: Re: svn commit: r294329 - 
inhead/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

On 24/01/2016 10:13 PM, Shawn Webb wrote:
> On Tue, Jan 19, 2016 at 05:00:25PM +, Alan Somers wrote:
>> Author: asomers
>> Date: Tue Jan 19 17:00:25 2016
>> New Revision: 294329
>> URL: https://svnweb.freebsd.org/changeset/base/294329
>>
>> Log:
>>Disallow zvol-backed ZFS pools
>>
>>Using zvols as backing devices for ZFS pools is fraught with panics and
>>deadlocks. For example, attempting to online a missing device in the
>>presence of a zvol can cause a panic when vdev_geom tastes the zvol.  
>> Better
>>to completely disable vdev_geom from ever opening a zvol. The solution
>>relies on setting a thread-local variable during vdev_geom_open, and
>>returning EOPNOTSUPP during zvol_open if that thread-local variable is 
>> set.
>>
>>Remove the check for MUTEX_HELD(&zfsdev_state_lock) in zvol_open. Its 
>> intent
>>was to prevent a recursive mutex acquisition panic. However, the new check
>>for the thread-local variable also fixes that problem.
>>
>>Also, fix a panic in vdev_geom_taste_orphan. For an unknown reason, this
>>function was set to panic. But it can occur that a device disappears 
>> during
>>tasting, and it causes no problems to ignore this departure.
>>
>>Reviewed by:  delphij
>>MFC after:1 week
>>Relnotes: yes
>>Sponsored by: Spectra Logic Corp
>>Differential Revision:https://reviews.freebsd.org/D4986
> I've just been bit by this pretty hard. I have a bhyve VM that's backed
> by a zvol. The VM is running root-on-zfs. I wrote some experimental code
> that's now preventing the VM from booting (kernel panic due to userland
> change). Since I can't import the pool, I have no way of fixing the
> problem.
>
> I'm probably just going to go revert this commit locally on my box so I
> can get some work done.
I use an md device to do this in bhyve but I was considering using a zvol.
Populating it in the host system and then presenting it to the VM as a 
disk.
maybe it could be enabled with a sysctl?  Is the problem always present?
>
> Thanks,
>


___
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: r294664 - head/contrib/elftoolchain/libelf

2016-01-24 Thread Ruslan Bukin
Author: br
Date: Sun Jan 24 15:12:49 2016
New Revision: 294664
URL: https://svnweb.freebsd.org/changeset/base/294664

Log:
  Add config for RISC-V ISA.
  
  Reviewed by:  emaste
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D5046

Modified:
  head/contrib/elftoolchain/libelf/_libelf_config.h

Modified: head/contrib/elftoolchain/libelf/_libelf_config.h
==
--- head/contrib/elftoolchain/libelf/_libelf_config.h   Sun Jan 24 13:38:41 
2016(r294663)
+++ head/contrib/elftoolchain/libelf/_libelf_config.h   Sun Jan 24 15:12:49 
2016(r294664)
@@ -97,6 +97,12 @@
 #defineLIBELF_BYTEORDERELFDATA2MSB
 #defineLIBELF_CLASSELFCLASS32
 
+#elif  defined(__riscv64)
+
+#defineLIBELF_ARCH EM_RISCV
+#defineLIBELF_BYTEORDERELFDATA2LSB
+#defineLIBELF_CLASSELFCLASS64
+
 #elif  defined(__sparc__)
 
 #defineLIBELF_ARCH EM_SPARCV9
___
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: r294665 - head/usr.bin/ldd

2016-01-24 Thread Ruslan Bukin
Author: br
Date: Sun Jan 24 15:15:57 2016
New Revision: 294665
URL: https://svnweb.freebsd.org/changeset/base/294665

Log:
  We don't support a.out executables on RISC-V.
  
  Reviewed by:  emaste
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D5048

Modified:
  head/usr.bin/ldd/ldd.c

Modified: head/usr.bin/ldd/ldd.c
==
--- head/usr.bin/ldd/ldd.c  Sun Jan 24 15:12:49 2016(r294664)
+++ head/usr.bin/ldd/ldd.c  Sun Jan 24 15:15:57 2016(r294665)
@@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$");
 
 #include "extern.h"
 
-/* We don't support a.out executables on arm64 */
-#ifndef __aarch64__
+/* We don't support a.out executables on arm64 and riscv */
+#if !defined(__aarch64__) && !defined(__riscv__)
 #include 
 #defineAOUT_SUPPORTED
 #endif
___
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: r294667 - head/bin/sh

2016-01-24 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jan 24 17:01:34 2016
New Revision: 294667
URL: https://svnweb.freebsd.org/changeset/base/294667

Log:
  sh: Remove a global variable from cd.c.

Modified:
  head/bin/sh/cd.c

Modified: head/bin/sh/cd.c
==
--- head/bin/sh/cd.cSun Jan 24 15:44:57 2016(r294666)
+++ head/bin/sh/cd.cSun Jan 24 17:01:34 2016(r294667)
@@ -68,14 +68,13 @@ __FBSDID("$FreeBSD$");
 static int cdlogical(char *);
 static int cdphysical(char *);
 static int docd(char *, int, int);
-static char *getcomponent(void);
+static char *getcomponent(char **);
 static char *findcwd(char *);
 static void updatepwd(char *);
 static char *getpwd(void);
 static char *getpwd2(void);
 
 static char *curdir = NULL;/* current working directory */
-static char *cdcomppath;
 
 int
 cdcmd(int argc __unused, char **argv __unused)
@@ -177,6 +176,7 @@ cdlogical(char *dest)
char *p;
char *q;
char *component;
+   char *path;
struct stat statb;
int first;
int badstat;
@@ -187,14 +187,14 @@ cdlogical(char *dest)
 *  next time we get the value of the current directory.
 */
badstat = 0;
-   cdcomppath = stsavestr(dest);
+   path = stsavestr(dest);
STARTSTACKSTR(p);
if (*dest == '/') {
STPUTC('/', p);
-   cdcomppath++;
+   path++;
}
first = 1;
-   while ((q = getcomponent()) != NULL) {
+   while ((q = getcomponent(&path)) != NULL) {
if (q[0] == '\0' || (q[0] == '.' && q[1] == '\0'))
continue;
if (! first)
@@ -243,25 +243,25 @@ cdphysical(char *dest)
 }
 
 /*
- * Get the next component of the path name pointed to by cdcomppath.
- * This routine overwrites the string pointed to by cdcomppath.
+ * Get the next component of the path name pointed to by *path.
+ * This routine overwrites *path and the string pointed to by it.
  */
 static char *
-getcomponent(void)
+getcomponent(char **path)
 {
char *p;
char *start;
 
-   if ((p = cdcomppath) == NULL)
+   if ((p = *path) == NULL)
return NULL;
-   start = cdcomppath;
+   start = *path;
while (*p != '/' && *p != '\0')
p++;
if (*p == '\0') {
-   cdcomppath = NULL;
+   *path = NULL;
} else {
*p++ = '\0';
-   cdcomppath = p;
+   *path = p;
}
return start;
 }
@@ -272,6 +272,7 @@ findcwd(char *dir)
 {
char *new;
char *p;
+   char *path;
 
/*
 * If our argument is NULL, we don't know the current directory
@@ -280,14 +281,14 @@ findcwd(char *dir)
 */
if (dir == NULL || curdir == NULL)
return getpwd2();
-   cdcomppath = stsavestr(dir);
+   path = stsavestr(dir);
STARTSTACKSTR(new);
if (*dir != '/') {
STPUTS(curdir, new);
if (STTOPC(new) == '/')
STUNPUTC(new);
}
-   while ((p = getcomponent()) != NULL) {
+   while ((p = getcomponent(&path)) != NULL) {
if (equal(p, "..")) {
while (new > stackblock() && (STUNPUTC(new), *new) != 
'/');
} else if (*p != '\0' && ! equal(p, ".")) {
___
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: r294668 - head/sys/dev/ofw

2016-01-24 Thread Andrew Turner
Author: andrew
Date: Sun Jan 24 17:09:11 2016
New Revision: 294668
URL: https://svnweb.freebsd.org/changeset/base/294668

Log:
  Fix the style of the reading of a nodes xref to make it readable.

Modified:
  head/sys/dev/ofw/openfirm.c

Modified: head/sys/dev/ofw/openfirm.c
==
--- head/sys/dev/ofw/openfirm.c Sun Jan 24 17:01:34 2016(r294667)
+++ head/sys/dev/ofw/openfirm.c Sun Jan 24 17:09:11 2016(r294668)
@@ -599,10 +599,9 @@ OF_xref_from_node(phandle_t node)
return (xi->xref);
}
 
-   if (OF_getencprop(node, "phandle", &xref, sizeof(xref)) ==
-   -1 && OF_getencprop(node, "ibm,phandle", &xref,
-   sizeof(xref)) == -1 && OF_getencprop(node,
-   "linux,phandle", &xref, sizeof(xref)) == -1)
+   if (OF_getencprop(node, "phandle", &xref, sizeof(xref)) == -1 &&
+   OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 &&
+   OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1)
return (node);
return (xref);
 }
___
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: r294669 - head/usr.sbin/bsdconfig/share

2016-01-24 Thread Devin Teske
Author: dteske
Date: Sun Jan 24 17:15:42 2016
New Revision: 294669
URL: https://svnweb.freebsd.org/changeset/base/294669

Log:
  Fix a typo in a comment
  
  MFC after:3 days
  X-MFC-to: stable/10

Modified:
  head/usr.sbin/bsdconfig/share/strings.subr

Modified: head/usr.sbin/bsdconfig/share/strings.subr
==
--- head/usr.sbin/bsdconfig/share/strings.subr  Sun Jan 24 17:09:11 2016
(r294668)
+++ head/usr.sbin/bsdconfig/share/strings.subr  Sun Jan 24 17:15:42 2016
(r294669)
@@ -110,7 +110,7 @@ f_sprintf()
 # Example 2:
 #
 #  limit=12 format="%s %s"
-#  format_args="   'doghouse'  'foxhound'   "
+#  format_args="   'doghouse'  'fox'   "
 #  # even more spaces added to illustrate escape-method
 #  f_vsnprintf foo $limit "$format" "$format_args" # foo=[doghouse fox]
 #
___
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: r294670 - in head/usr.sbin: autofs iscsid

2016-01-24 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Jan 24 18:11:36 2016
New Revision: 294670
URL: https://svnweb.freebsd.org/changeset/base/294670

Log:
  The  is an ordinary header file; should sort just like any other.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/autofs/automount.c
  head/usr.sbin/autofs/automountd.c
  head/usr.sbin/autofs/autounmountd.c
  head/usr.sbin/autofs/common.c
  head/usr.sbin/autofs/defined.c
  head/usr.sbin/iscsid/iscsid.c

Modified: head/usr.sbin/autofs/automount.c
==
--- head/usr.sbin/autofs/automount.cSun Jan 24 17:15:42 2016
(r294669)
+++ head/usr.sbin/autofs/automount.cSun Jan 24 18:11:36 2016
(r294670)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,8 +56,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include "common.h"
 #include "mntopts.h"
 

Modified: head/usr.sbin/autofs/automountd.c
==
--- head/usr.sbin/autofs/automountd.c   Sun Jan 24 17:15:42 2016
(r294669)
+++ head/usr.sbin/autofs/automountd.c   Sun Jan 24 18:11:36 2016
(r294670)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,8 +56,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include "autofs_ioctl.h"
 
 #include "common.h"

Modified: head/usr.sbin/autofs/autounmountd.c
==
--- head/usr.sbin/autofs/autounmountd.c Sun Jan 24 17:15:42 2016
(r294669)
+++ head/usr.sbin/autofs/autounmountd.c Sun Jan 24 18:11:36 2016
(r294670)
@@ -37,13 +37,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include "common.h"
 

Modified: head/usr.sbin/autofs/common.c
==
--- head/usr.sbin/autofs/common.c   Sun Jan 24 17:15:42 2016
(r294669)
+++ head/usr.sbin/autofs/common.c   Sun Jan 24 18:11:36 2016
(r294670)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -58,8 +59,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include "autofs_ioctl.h"
 
 #include "common.h"

Modified: head/usr.sbin/autofs/defined.c
==
--- head/usr.sbin/autofs/defined.c  Sun Jan 24 17:15:42 2016
(r294669)
+++ head/usr.sbin/autofs/defined.c  Sun Jan 24 18:11:36 2016
(r294670)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -60,8 +61,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include "common.h"
 
 static TAILQ_HEAD(, defined_value) defined_values;

Modified: head/usr.sbin/iscsid/iscsid.c
==
--- head/usr.sbin/iscsid/iscsid.c   Sun Jan 24 17:15:42 2016
(r294669)
+++ head/usr.sbin/iscsid/iscsid.c   Sun Jan 24 18:11:36 2016
(r294670)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,8 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include "iscsid.h"
 
 static volatile bool sigalrm_received = false;
___
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: r294675 - head/sys/arm/allwinner

2016-01-24 Thread Andrew Turner
Author: andrew
Date: Sun Jan 24 19:10:30 2016
New Revision: 294675
URL: https://svnweb.freebsd.org/changeset/base/294675

Log:
  Add support for controlling the clocks for the audio codec and DMA engines.
  
  Submitted by: Jared McNeill 
  Differential Revision:https://reviews.freebsd.org/D5052

Modified:
  head/sys/arm/allwinner/a10_clk.c
  head/sys/arm/allwinner/a10_clk.h

Modified: head/sys/arm/allwinner/a10_clk.c
==
--- head/sys/arm/allwinner/a10_clk.cSun Jan 24 18:54:55 2016
(r294674)
+++ head/sys/arm/allwinner/a10_clk.cSun Jan 24 19:10:30 2016
(r294675)
@@ -255,6 +255,58 @@ a10_clk_pll6_get_rate(void)
return ((CCM_CLK_REF_FREQ * n * k) / 2);
 }
 
+static int
+a10_clk_pll2_set_rate(unsigned int freq)
+{
+   struct a10_ccm_softc *sc;
+   uint32_t reg_value;
+   unsigned int prediv, postdiv, n;
+
+   sc = a10_ccm_sc;
+   if (sc == NULL)
+   return (ENXIO);
+
+
+   reg_value = ccm_read_4(sc, CCM_PLL2_CFG);
+   reg_value &= ~(CCM_PLL2_CFG_PREDIV | CCM_PLL2_CFG_POSTDIV |
+   CCM_PLL_CFG_FACTOR_N);
+
+   /*
+* Audio Codec needs PLL2 to be either 24576000 Hz or 22579200 Hz
+*
+* PLL2 output frequency is 24MHz * n / prediv / postdiv.
+* To get as close as possible to the desired rate, we use a
+* pre-divider of 21 and a post-divider of 4. With these values,
+* a multiplier of 86 or 79 gets us close to the target rates.
+*/
+   prediv = 21;
+   postdiv = 4;
+
+   switch (freq) {
+   case 24576000:
+   n = 86;
+   reg_value |= CCM_PLL_CFG_ENABLE;
+   break;
+   case 22579200:
+   n = 79;
+   reg_value |= CCM_PLL_CFG_ENABLE;
+   break;
+   case 0:
+   n = 1;
+   reg_value &= ~CCM_PLL_CFG_ENABLE;
+   break;
+   default:
+   return (EINVAL);
+   }
+
+   reg_value |= (prediv << CCM_PLL2_CFG_PREDIV_SHIFT);
+   reg_value |= (postdiv << CCM_PLL2_CFG_POSTDIV_SHIFT);
+   reg_value |= (n << CCM_PLL_CFG_FACTOR_N_SHIFT);
+   ccm_write_4(sc, CCM_PLL2_CFG, reg_value);
+
+   return (0);
+}
+
 int
 a10_clk_ahci_activate(void)
 {
@@ -347,3 +399,46 @@ a10_clk_mmc_cfg(int devid, int freq)
 
return (0);
 }
+
+int
+a10_clk_dmac_activate(void)
+{
+   struct a10_ccm_softc *sc;
+   uint32_t reg_value;
+
+   sc = a10_ccm_sc;
+   if (sc == NULL)
+   return (ENXIO);
+
+   /* Gating AHB clock for DMA controller */
+   reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
+   reg_value |= CCM_AHB_GATING_DMA;
+   ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
+
+   return (0);
+}
+
+int
+a10_clk_codec_activate(unsigned int freq)
+{
+   struct a10_ccm_softc *sc;
+   uint32_t reg_value;
+
+   sc = a10_ccm_sc;
+   if (sc == NULL)
+   return (ENXIO);
+
+   a10_clk_pll2_set_rate(freq);
+
+   /* Gating APB clock for ADDA */
+   reg_value = ccm_read_4(sc, CCM_APB0_GATING);
+   reg_value |= CCM_APB0_GATING_ADDA;
+   ccm_write_4(sc, CCM_APB0_GATING, reg_value);
+
+   /* Enable audio codec clock */
+   reg_value = ccm_read_4(sc, CCM_AUDIO_CODEC_CLK);
+   reg_value |= CCM_AUDIO_CODEC_ENABLE;
+   ccm_write_4(sc, CCM_AUDIO_CODEC_CLK, reg_value);
+
+   return (0);
+}

Modified: head/sys/arm/allwinner/a10_clk.h
==
--- head/sys/arm/allwinner/a10_clk.hSun Jan 24 18:54:55 2016
(r294674)
+++ head/sys/arm/allwinner/a10_clk.hSun Jan 24 19:10:30 2016
(r294675)
@@ -106,10 +106,14 @@
 #defineCCM_GMAC_CLK_EXT_RGMII  0x1
 #defineCCM_GMAC_CLK_RGMII  0x2
 
+/* APB0_GATING */
+#defineCCM_APB0_GATING_ADDA(1 << 0)
+
 /* AHB_GATING_REG0 */
 #defineCCM_AHB_GATING_USB0 (1 << 0)
 #defineCCM_AHB_GATING_EHCI0(1 << 1)
 #defineCCM_AHB_GATING_EHCI1(1 << 3)
+#defineCCM_AHB_GATING_DMA  (1 << 6)
 #defineCCM_AHB_GATING_SDMMC0   (1 << 8)
 #defineCCM_AHB_GATING_EMAC (1 << 17)
 #defineCCM_AHB_GATING_SATA (1 << 25)
@@ -132,6 +136,11 @@
 #defineCCM_PLL_CFG_FACTOR_K_SHIFT  4
 #defineCCM_PLL_CFG_FACTOR_M0x3
 
+#defineCCM_PLL2_CFG_POSTDIV0x3c00
+#defineCCM_PLL2_CFG_POSTDIV_SHIFT  26
+#defineCCM_PLL2_CFG_PREDIV 0x1f
+#defineCCM_PLL2_CFG_PREDIV_SHIFT   0
+
 #defineCCM_PLL6_CFG_SATA_CLKEN (1U << 14)
 
 #defineCCM_SD_CLK_SRC_SEL  0x300
@@ -146,6 +155,8 @@
 #defineCCM_SD_CLK_OPHASE_CTR_SHIFT 8
 #defineCCM_SD_CLK_DIV_RATIO_M  0xf
 
+#defineCCM_AUDIO_CODEC_ENABLE  (1U << 31)
+
 #defineCCM_CLK_REF_FREQ2400U

svn commit: r294676 - head/sys/arm/allwinner

2016-01-24 Thread Andrew Turner
Author: andrew
Date: Sun Jan 24 19:12:16 2016
New Revision: 294676
URL: https://svnweb.freebsd.org/changeset/base/294676

Log:
  Remove an extra newline that crept in.

Modified:
  head/sys/arm/allwinner/a10_clk.c

Modified: head/sys/arm/allwinner/a10_clk.c
==
--- head/sys/arm/allwinner/a10_clk.cSun Jan 24 19:10:30 2016
(r294675)
+++ head/sys/arm/allwinner/a10_clk.cSun Jan 24 19:12:16 2016
(r294676)
@@ -266,7 +266,6 @@ a10_clk_pll2_set_rate(unsigned int freq)
if (sc == NULL)
return (ENXIO);
 
-
reg_value = ccm_read_4(sc, CCM_PLL2_CFG);
reg_value &= ~(CCM_PLL2_CFG_PREDIV | CCM_PLL2_CFG_POSTDIV |
CCM_PLL_CFG_FACTOR_N);
___
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: r294684 - head/share/dtrace

2016-01-24 Thread Devin Teske
Author: dteske
Date: Sun Jan 24 21:18:54 2016
New Revision: 294684
URL: https://svnweb.freebsd.org/changeset/base/294684

Log:
  Bump copyright for change from fbt to syscall
  
  MFC after:3 days
  X-MFC-to: stable/10
  X-MFC-with:   r294548 r294556

Modified:
  head/share/dtrace/watch_kill

Modified: head/share/dtrace/watch_kill
==
--- head/share/dtrace/watch_killSun Jan 24 21:04:06 2016
(r294683)
+++ head/share/dtrace/watch_killSun Jan 24 21:18:54 2016
(r294684)
@@ -1,6 +1,6 @@
 #!/usr/sbin/dtrace -s
 /* -
- * Copyright (c) 2014-2015 Devin Teske 
+ * Copyright (c) 2014-2016 Devin Teske 
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
___
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: r290475 - in head: share/man/man9 sys/kern sys/sys

2016-01-24 Thread Oliver Pinter
On 11/8/15, Hans Petter Selasky  wrote:
> On 11/07/15 19:26, Conrad Meyer wrote:
>> Can do — fixed in r290505.
>>
>> Thanks,
>> Conrad
>
> Thank you. Looks good!
>
> --HPS

Hi All!

Is there any way to merge back to 10-STABLE these patches?

>
> ___
> 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-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: r294688 - head/lib/libc/net

2016-01-24 Thread Michael Tuexen
Author: tuexen
Date: Sun Jan 24 22:08:15 2016
New Revision: 294688
URL: https://svnweb.freebsd.org/changeset/base/294688

Log:
  sctp_sendv() needs to fill in the association id on return.
  
  MFC after: 3 days

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==
--- head/lib/libc/net/sctp_sys_calls.c  Sun Jan 24 22:06:56 2016
(r294687)
+++ head/lib/libc/net/sctp_sys_calls.c  Sun Jan 24 22:08:15 2016
(r294688)
@@ -984,6 +984,7 @@ sctp_sendv(int sd,
struct sockaddr *addr;
struct sockaddr_in *addr_in;
struct sockaddr_in6 *addr_in6;
+   sctp_assoc_t *assoc_id;
 
if ((addrcnt < 0) ||
(iovcnt < 0) ||
@@ -1002,6 +1003,7 @@ sctp_sendv(int sd,
errno = ENOMEM;
return (-1);
}
+   assoc_id = NULL;
msg.msg_control = cmsgbuf;
msg.msg_controllen = 0;
cmsg = (struct cmsghdr *)cmsgbuf;
@@ -1025,6 +1027,7 @@ sctp_sendv(int sd,
memcpy(CMSG_DATA(cmsg), info, sizeof(struct sctp_sndinfo));
msg.msg_controllen += CMSG_SPACE(sizeof(struct sctp_sndinfo));
cmsg = (struct cmsghdr *)((caddr_t)cmsg + 
CMSG_SPACE(sizeof(struct sctp_sndinfo)));
+   assoc_id = &(((struct sctp_sndinfo *)info)->snd_assoc_id);
break;
case SCTP_SENDV_PRINFO:
if ((info == NULL) || (infolen < sizeof(struct sctp_prinfo))) {
@@ -1066,6 +1069,7 @@ sctp_sendv(int sd,
memcpy(CMSG_DATA(cmsg), &spa_info->sendv_sndinfo, 
sizeof(struct sctp_sndinfo));
msg.msg_controllen += CMSG_SPACE(sizeof(struct 
sctp_sndinfo));
cmsg = (struct cmsghdr *)((caddr_t)cmsg + 
CMSG_SPACE(sizeof(struct sctp_sndinfo)));
+   assoc_id = &(spa_info->sendv_sndinfo.snd_assoc_id);
}
if (spa_info->sendv_flags & SCTP_SEND_PRINFO_VALID) {
cmsg->cmsg_level = IPPROTO_SCTP;
@@ -1164,6 +1168,9 @@ sctp_sendv(int sd,
msg.msg_flags = 0;
ret = sendmsg(sd, &msg, flags);
free(cmsgbuf);
+   if ((ret >= 0) && (addrs != NULL) && (assoc_id != NULL)) {
+   *assoc_id = sctp_getassocid(sd, addrs);
+   }
return (ret);
 }
 
___
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: r294691 - head/lib/libc/gen

2016-01-24 Thread Maxim Sobolev
Author: sobomax
Date: Sun Jan 24 22:20:13 2016
New Revision: 294691
URL: https://svnweb.freebsd.org/changeset/base/294691

Log:
  Fix bug in the readpassphrase(3) function, which can be exposed
  by application closing its stdin (i.e. STDIN_FILENO) prior to
  calling readpassphrase WITHOUT setting RPP_STDIN. What happens
  then is that the readpassphrase would open /dev/tty, and since
  file descriptors are reused, the call would return first unused
  fd, which is 0 which is also STDIN_FILENO. Then due to the usage
  of "input != STDIN_FILENO" in the code to do its logic, that
  would result in noecho flags not set on that file descriptor,
  which was original issue I've been trying to fix.
  
  In addition to that, the readpassphrase() would leak file
  descriptor on its way out, so fix that one as well.
  
  This problem can be tested with:
  
   $ ssh-add - < /tmp/myprivate.key
  
  The password will not be hidden as it should and ktrace will
  show:
  
   53326 ssh-add  CALL  
open(0x80142443c,0x12,0x165f030)
   53326 ssh-add  NAMI  "/dev/tty"
   53326 ssh-add  RET   open 0
   53326 ssh-add  CALL  sigprocmask(SIG_SETMASK,0x802eb1324,0x7fffd5e0)
   53326 ssh-add  RET   sigprocmask 0
   53326 ssh-add  CALL  sigaction(SIGALRM,0x7fffd630,0x7fffd610)
  
  Instead of:
  
   57690 ssh-add  CALL  
open(0x80142443c,0x12,0x165f030)
   57690 ssh-add  NAMI  "/dev/tty"
   57690 ssh-add  RET   open 4
   57690 ssh-add  CALL  ioctl(0x4,TIOCGETA,0x7fffd860)
   57690 ssh-add  RET   ioctl 0
   57690 ssh-add  CALL  ioctl(0x4,TIOCSETAF,0x7fffd680)
   57690 ssh-add  RET   ioctl 0
   57690 ssh-add  CALL  sigprocmask(SIG_SETMASK,0x802eb1324,0x7fffd620)
   57690 ssh-add  RET   sigprocmask 0
   57690 ssh-add  CALL  sigaction(SIGALRM,0x7fffd670,0x7fffd650)
  
  For the case when the key is read from the file.
  
  Technically this can also be workaround'ed at the application side
  by not closing the STDIN_FILENO in the first place, but readpassphrase(3)
  doesn't need to make any assumptions about that. Plus the file descriptor
  leak confirms that this is an oversight, rather than a deliberate behaviour.
  
  MFC after:1 week

Modified:
  head/lib/libc/gen/readpassphrase.c

Modified: head/lib/libc/gen/readpassphrase.c
==
--- head/lib/libc/gen/readpassphrase.c  Sun Jan 24 22:17:05 2016
(r294690)
+++ head/lib/libc/gen/readpassphrase.c  Sun Jan 24 22:20:13 2016
(r294691)
@@ -46,7 +46,7 @@ char *
 readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
 {
ssize_t nr;
-   int input, output, save_errno, i, need_restart;
+   int input, output, save_errno, i, need_restart, input_is_tty;
char ch, *p, *end;
struct termios term, oterm;
struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm;
@@ -68,12 +68,20 @@ restart:
 * Read and write to /dev/tty if available.  If not, read from
 * stdin and write to stderr unless a tty is required.
 */
-   if ((flags & RPP_STDIN) ||
-   (input = output = _open(_PATH_TTY, O_RDWR | O_CLOEXEC)) == -1) {
-   if (flags & RPP_REQUIRE_TTY) {
-   errno = ENOTTY;
-   return(NULL);
+   input_is_tty = 0;
+   if (!(flags & RPP_STDIN)) {
+   input = output = _open(_PATH_TTY, O_RDWR | O_CLOEXEC);
+   if (input == -1) {
+   if (flags & RPP_REQUIRE_TTY) {
+   errno = ENOTTY;
+   return(NULL);
+   }
+   input = STDIN_FILENO;
+   output = STDERR_FILENO;
+   } else {
+   input_is_tty = 1;
}
+   } else {
input = STDIN_FILENO;
output = STDERR_FILENO;
}
@@ -83,7 +91,7 @@ restart:
 * If we are using a tty but are not the foreground pgrp this will
 * generate SIGTTOU, so do it *before* installing the signal handlers.
 */
-   if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) {
+   if (input_is_tty && tcgetattr(input, &oterm) == 0) {
memcpy(&term, &oterm, sizeof(term));
if (!(flags & RPP_ECHO_ON))
term.c_lflag &= ~(ECHO | ECHONL);
@@ -152,7 +160,7 @@ restart:
(void)__libc_sigaction(SIGTSTP, &savetstp, NULL);
(void)__libc_sigaction(SIGTTIN, &savettin, NULL);
(void)__libc_sigaction(SIGTTOU, &savettou, NULL);
-   if (input != STDIN_FILENO)
+   if (input_is_tty)
(void)_close(input);
 
/*
___
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: r294692 - head/bin/sh

2016-01-24 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jan 24 22:26:25 2016
New Revision: 294692
URL: https://svnweb.freebsd.org/changeset/base/294692

Log:
  sh: Constify internal representation in expand.c.
  
  Forbid (temporary or permanent) modifications of the strings in NARG nodes
  during expansion.
  
  Tilde expansion now needs to copy the username for the terminating '\0'.

Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSun Jan 24 22:20:13 2016(r294691)
+++ head/bin/sh/expand.cSun Jan 24 22:26:25 2016(r294692)
@@ -91,13 +91,13 @@ struct worddest {
 static char *expdest;  /* output of current string */
 static struct nodelist *argbackq;  /* list of back quote expressions */
 
-static char *argstr(char *, int, struct worddest *);
-static char *exptilde(char *, int);
-static char *expari(char *, int, struct worddest *);
+static const char *argstr(const char *, int, struct worddest *);
+static const char *exptilde(const char *, int);
+static const char *expari(const char *, int, struct worddest *);
 static void expbackq(union node *, int, int, struct worddest *);
-static void subevalvar_trim(char *, int, int, int);
-static int subevalvar_misc(char *, const char *, int, int, int);
-static char *evalvar(char *, int, struct worddest *);
+static void subevalvar_trim(const char *, int, int, int);
+static int subevalvar_misc(const char *, const char *, int, int, int);
+static const char *evalvar(const char *, int, struct worddest *);
 static int varisset(const char *, int);
 static void strtodest(const char *, int, int, int, struct worddest *);
 static void reprocess(int, int, int, int, struct worddest *);
@@ -262,8 +262,8 @@ expandarg(union node *arg, struct arglis
  *
  * If EXP_SPLIT is set, dst receives any complete words produced.
  */
-static char *
-argstr(char *p, int flag, struct worddest *dst)
+static const char *
+argstr(const char *p, int flag, struct worddest *dst)
 {
char c;
int quotes = flag & (EXP_GLOB | EXP_CASE);  /* do CTLESC */
@@ -352,12 +352,15 @@ argstr(char *p, int flag, struct worddes
  * Perform tilde expansion, placing the result in the stack string and
  * returning the next position in the input string to process.
  */
-static char *
-exptilde(char *p, int flag)
+static const char *
+exptilde(const char *p, int flag)
 {
-   char c, *startp = p;
+   char c;
+   const char *startp = p;
+   const char *user;
struct passwd *pw;
char *home;
+   int len;
 
for (;;) {
c = *p;
@@ -377,14 +380,17 @@ exptilde(char *p, int flag)
case '\0':
case '/':
case CTLENDVAR:
-   *p = '\0';
-   if (*(startp+1) == '\0') {
+   len = p - startp - 1;
+   STPUTBIN(startp + 1, len, expdest);
+   STACKSTRNUL(expdest);
+   user = expdest - len;
+   if (*user == '\0') {
home = lookupvar("HOME");
} else {
-   pw = getpwnam(startp+1);
+   pw = getpwnam(user);
home = pw != NULL ? pw->pw_dir : NULL;
}
-   *p = c;
+   STADJUST(-len, expdest);
if (home == NULL || *home == '\0')
return (startp);
strtodest(home, flag, VSNORMAL, 1, NULL);
@@ -398,8 +404,8 @@ exptilde(char *p, int flag)
 /*
  * Expand arithmetic expression.
  */
-static char *
-expari(char *p, int flag, struct worddest *dst)
+static const char *
+expari(const char *p, int flag, struct worddest *dst)
 {
char *q, *start;
arith_t result;
@@ -532,7 +538,7 @@ recordleft(const char *str, const char *
 }
 
 static void
-subevalvar_trim(char *p, int strloc, int subtype, int startloc)
+subevalvar_trim(const char *p, int strloc, int subtype, int startloc)
 {
char *startp;
char *loc = NULL;
@@ -606,7 +612,7 @@ subevalvar_trim(char *p, int strloc, int
 
 
 static int
-subevalvar_misc(char *p, const char *var, int subtype, int startloc,
+subevalvar_misc(const char *p, const char *var, int subtype, int startloc,
   int varflags)
 {
char *startp;
@@ -645,12 +651,12 @@ subevalvar_misc(char *p, const char *var
  * input string.
  */
 
-static char *
-evalvar(char *p, int flag, struct worddest *dst)
+static const char *
+evalvar(const char *p, int flag, struct worddest *dst)
 {
int subtype;
int varflags;
-   char *var;
+   const char *var;
const char *val;
int patloc;
int c;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/lis

svn commit: r294694 - head/lib/libc/net

2016-01-24 Thread Michael Tuexen
Author: tuexen
Date: Sun Jan 24 22:31:34 2016
New Revision: 294694
URL: https://svnweb.freebsd.org/changeset/base/294694

Log:
  sctp_sendx() needs to provide the assoc_id back.
  
  MFC after: 3 days

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==
--- head/lib/libc/net/sctp_sys_calls.c  Sun Jan 24 22:28:18 2016
(r294693)
+++ head/lib/libc/net/sctp_sys_calls.c  Sun Jan 24 22:31:34 2016
(r294694)
@@ -700,14 +700,19 @@ sctp_sendx(int sd, const void *msg, size
 #ifdef SYS_sctp_generic_sendmsg
if (addrcnt == 1) {
socklen_t l;
+   ssize_t ret;
 
/*
 * Quick way, we don't need to do a connectx so lets use the
 * syscall directly.
 */
l = addrs->sa_len;
-   return (syscall(SYS_sctp_generic_sendmsg, sd,
-   msg, msg_len, addrs, l, sinfo, flags));
+   ret = syscall(SYS_sctp_generic_sendmsg, sd,
+   msg, msg_len, addrs, l, sinfo, flags);
+   if ((ret >= 0) && (sinfo != NULL)) {
+   sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs);
+   }
+   return (ret);
}
 #endif
 
___
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: r294695 - head/sys/fs/ext2fs

2016-01-24 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jan 24 23:24:47 2016
New Revision: 294695
URL: https://svnweb.freebsd.org/changeset/base/294695

Log:
  ext2fs: passthrough any extra timestamps to the dinode struct.
  
  In general we don't trust any of the extended timestamps unless the
  EXT2F_ROCOMPAT_EXTRA_ISIZE feature is set. However, in the case where
  we freshly allocated a new inode the information is valid and it is
  better to pass it along instead of leaving the value undefined.
  
  This should have no practical effect but should reduce the amount of
  garbage if EXT2F_ROCOMPAT_EXTRA_ISIZE is set, like in cases where the
  filesystem is converted from ext3 to ext4.
  
  MFC after:4 days

Modified:
  head/sys/fs/ext2fs/ext2_inode_cnv.c

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==
--- head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 24 22:31:34 2016
(r294694)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 24 23:24:47 2016
(r294695)
@@ -149,13 +149,11 @@ ext2_i2ei(struct inode *ip, struct ext2f
ei->e2di_atime = ip->i_atime;
ei->e2di_mtime = ip->i_mtime;
ei->e2di_ctime = ip->i_ctime;
-   if (E2DI_HAS_XTIME(ip)) {
-   ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec);
-   ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec);
-   ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec);
-   ei->e2di_crtime = ip->i_birthtime;
-   ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec);
-   }
+   ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec);
+   ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec);
+   ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec);
+   ei->e2di_crtime = ip->i_birthtime;
+   ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec);
ei->e2di_flags = 0;
ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0;
ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0;
___
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: r294696 - head/sys/net80211

2016-01-24 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Jan 24 23:28:14 2016
New Revision: 294696
URL: https://svnweb.freebsd.org/changeset/base/294696

Log:
  net80211: reduce code duplication
  
  Do not duplicate code between IEEE80211_IOC_WPAIE and IEEE80211_IOC_WPAIE2
  switch cases.
  
  Approved by:  adrian (mentor)
  Differential Revision:D5041 (part)

Modified:
  head/sys/net80211/ieee80211_ioctl.c

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Sun Jan 24 23:24:47 2016
(r294695)
+++ head/sys/net80211/ieee80211_ioctl.c Sun Jan 24 23:28:14 2016
(r294696)
@@ -932,8 +932,6 @@ ieee80211_ioctl_get80211(struct ieee8021
ireq->i_len);
break;
case IEEE80211_IOC_WPAIE:
-   error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type);
-   break;
case IEEE80211_IOC_WPAIE2:
error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type);
break;
___
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: r294697 - head/sys/net80211

2016-01-24 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Jan 24 23:35:20 2016
New Revision: 294697
URL: https://svnweb.freebsd.org/changeset/base/294697

Log:
  net80211: reduce stack usage for ieee80211_ioctl*() methods.
  
  Use malloc(9) for
   - struct ieee80211req_wpaie2 (518 bytes, used in
  ieee80211_ioctl_getwpaie())
   - struct ieee80211_scan_req (128 bytes, used in setmlme_assoc_adhoc()
  and ieee80211_ioctl_scanreq())
  
  Also, drop __noinline workarounds; stack overflow is not reproducible
  with recent compilers.
  
  Tested with Clang 3.7.1, GCC 4.2.1 (from 9.3-RELEASE) and 4.9.4
  (with -fstack-usage flag)
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D5041

Modified:
  head/sys/net80211/ieee80211_ioctl.c

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Sun Jan 24 23:28:14 2016
(r294696)
+++ head/sys/net80211/ieee80211_ioctl.c Sun Jan 24 23:35:20 2016
(r294697)
@@ -68,7 +68,7 @@ static struct ieee80211_channel *findcha
 static int ieee80211_scanreq(struct ieee80211vap *,
struct ieee80211_scan_req *);
 
-static __noinline int
+static int
 ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
 {
struct ieee80211com *ic = vap->iv_ic;
@@ -124,7 +124,7 @@ ieee80211_ioctl_getkey(struct ieee80211v
return copyout(&ik, ireq->i_data, sizeof(ik));
 }
 
-static __noinline int
+static int
 ieee80211_ioctl_getchanlist(struct ieee80211vap *vap, struct ieee80211req 
*ireq)
 {
struct ieee80211com *ic = vap->iv_ic;
@@ -134,7 +134,7 @@ ieee80211_ioctl_getchanlist(struct ieee8
return copyout(&ic->ic_chan_active, ireq->i_data, ireq->i_len);
 }
 
-static __noinline int
+static int
 ieee80211_ioctl_getchaninfo(struct ieee80211vap *vap, struct ieee80211req 
*ireq)
 {
struct ieee80211com *ic = vap->iv_ic;
@@ -148,36 +148,40 @@ ieee80211_ioctl_getchaninfo(struct ieee8
return copyout(&ic->ic_nchans, ireq->i_data, space);
 }
 
-static __noinline int
+static int
 ieee80211_ioctl_getwpaie(struct ieee80211vap *vap,
struct ieee80211req *ireq, int req)
 {
struct ieee80211_node *ni;
-   struct ieee80211req_wpaie2 wpaie;
+   struct ieee80211req_wpaie2 *wpaie;
int error;
 
if (ireq->i_len < IEEE80211_ADDR_LEN)
return EINVAL;
-   error = copyin(ireq->i_data, wpaie.wpa_macaddr, IEEE80211_ADDR_LEN);
+   wpaie = IEEE80211_MALLOC(sizeof(*wpaie), M_TEMP,
+   IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
+   if (wpaie == NULL)
+   return ENOMEM;
+   error = copyin(ireq->i_data, wpaie->wpa_macaddr, IEEE80211_ADDR_LEN);
if (error != 0)
-   return error;
-   ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, 
wpaie.wpa_macaddr);
-   if (ni == NULL)
-   return ENOENT;
-   memset(wpaie.wpa_ie, 0, sizeof(wpaie.wpa_ie));
+   goto bad;
+   ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, 
wpaie->wpa_macaddr);
+   if (ni == NULL) {
+   error = ENOENT;
+   goto bad;
+   }
if (ni->ni_ies.wpa_ie != NULL) {
int ielen = ni->ni_ies.wpa_ie[1] + 2;
-   if (ielen > sizeof(wpaie.wpa_ie))
-   ielen = sizeof(wpaie.wpa_ie);
-   memcpy(wpaie.wpa_ie, ni->ni_ies.wpa_ie, ielen);
+   if (ielen > sizeof(wpaie->wpa_ie))
+   ielen = sizeof(wpaie->wpa_ie);
+   memcpy(wpaie->wpa_ie, ni->ni_ies.wpa_ie, ielen);
}
if (req == IEEE80211_IOC_WPAIE2) {
-   memset(wpaie.rsn_ie, 0, sizeof(wpaie.rsn_ie));
if (ni->ni_ies.rsn_ie != NULL) {
int ielen = ni->ni_ies.rsn_ie[1] + 2;
-   if (ielen > sizeof(wpaie.rsn_ie))
-   ielen = sizeof(wpaie.rsn_ie);
-   memcpy(wpaie.rsn_ie, ni->ni_ies.rsn_ie, ielen);
+   if (ielen > sizeof(wpaie->rsn_ie))
+   ielen = sizeof(wpaie->rsn_ie);
+   memcpy(wpaie->rsn_ie, ni->ni_ies.rsn_ie, ielen);
}
if (ireq->i_len > sizeof(struct ieee80211req_wpaie2))
ireq->i_len = sizeof(struct ieee80211req_wpaie2);
@@ -186,18 +190,21 @@ ieee80211_ioctl_getwpaie(struct ieee8021
/* XXX check ic_flags? */
if (ni->ni_ies.rsn_ie != NULL) {
int ielen = ni->ni_ies.rsn_ie[1] + 2;
-   if (ielen > sizeof(wpaie.wpa_ie))
-   ielen = sizeof(wpaie.wpa_ie);
-   memcpy(wpaie.wpa_ie, ni->ni_ies.rsn_ie, ielen);
+   if (ielen > sizeof(wpaie->wpa_ie))
+   ielen = sizeof(wpaie->wpa_ie);
+   memcpy(wpaie->wpa_ie, ni->n

svn commit: r294698 - in head/sys/arm: allwinner conf

2016-01-24 Thread Andrew Turner
Author: andrew
Date: Mon Jan 25 00:24:57 2016
New Revision: 294698
URL: https://svnweb.freebsd.org/changeset/base/294698

Log:
  Update the Allwinner kernels:
   * Use the ARM PLATFORM framework
   * Use ARM_INTRNG on teh A20 as it has a GICv2
   * Add a method to find which Allwinner SoC we are running on
  
  Differential Revision:https://reviews.freebsd.org/D5059

Added:
  head/sys/arm/allwinner/allwinner_machdep.c
 - copied, changed from r294697, head/sys/arm/allwinner/a10_machdep.c
Deleted:
  head/sys/arm/allwinner/a10_machdep.c
Modified:
  head/sys/arm/allwinner/a10_common.c
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/A20
  head/sys/arm/conf/CUBIEBOARD

Modified: head/sys/arm/allwinner/a10_common.c
==
--- head/sys/arm/allwinner/a10_common.c Sun Jan 24 23:35:20 2016
(r294697)
+++ head/sys/arm/allwinner/a10_common.c Mon Jan 25 00:24:57 2016
(r294698)
@@ -42,6 +42,8 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
+#ifndef ARM_INTRNG
+
 static int
 fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
 int *pol)
@@ -66,3 +68,5 @@ fdt_pic_decode_t fdt_pic_table[] = {
&fdt_aintc_decode_ic,
NULL
 };
+
+#endif /* ARM_INTRNG */

Copied and modified: head/sys/arm/allwinner/allwinner_machdep.c (from r294697, 
head/sys/arm/allwinner/a10_machdep.c)
==
--- head/sys/arm/allwinner/a10_machdep.cSun Jan 24 23:35:20 2016
(r294697, copy source)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Mon Jan 25 00:24:57 2016
(r294698)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2012 Ganbold Tsagaankhuu 
+ * Copyright (c) 2015-2016 Emmanuel Vadot 
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe
@@ -45,32 +46,41 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include  
+#include 
 
 #include 
 
 #include 
+#include 
 
-vm_offset_t
-platform_lastaddr(void)
-{
+#include "platform_if.h"
 
-   return (arm_devmap_lastaddr());
-}
+static u_int soc_type;
+static u_int soc_family;
 
-void
-platform_probe_and_attach(void)
+static int
+a10_attach(platform_t plat)
 {
+   soc_type = ALLWINNERSOC_A10;
+   soc_family = ALLWINNERSOC_SUN4I;
+   return (0);
 }
 
-void
-platform_gpio_init(void)
+static int
+a20_attach(platform_t plat)
 {
+   soc_type = ALLWINNERSOC_A20;
+   soc_family = ALLWINNERSOC_SUN7I;
+
+   return (0);
 }
 
-void
-platform_late_init(void)
+
+static vm_offset_t
+allwinner_lastaddr(platform_t plat)
 {
+
+   return (arm_devmap_lastaddr());
 }
 
 /*
@@ -83,8 +93,8 @@ platform_late_init(void)
  * shouldn't be device-mapped.  The original code mapped a 4MB block, but
  * perhaps a 1MB block would be more appropriate.
  */
-int
-platform_devmap_init(void)
+static int
+allwinner_devmap_init(platform_t plat)
 {
 
arm_devmap_add_entry(0x01C0, 0x0040); /* 4MB */
@@ -111,3 +121,34 @@ cpu_reset()
printf("Reset failed!\n");
while (1);
 }
+
+static platform_method_t a10_methods[] = {
+   PLATFORMMETHOD(platform_attach, a10_attach),
+   PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
+   PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+
+   PLATFORMMETHOD_END,
+};
+
+static platform_method_t a20_methods[] = {
+   PLATFORMMETHOD(platform_attach, a20_attach),
+   PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
+   PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+
+   PLATFORMMETHOD_END,
+};
+
+u_int
+allwinner_soc_type(void)
+{
+   return (soc_type);
+}
+
+u_int
+allwinner_soc_family(void)
+{
+   return (soc_family);
+}
+
+FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
+FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Sun Jan 24 23:35:20 2016
(r294697)
+++ head/sys/arm/allwinner/files.allwinner  Mon Jan 25 00:24:57 2016
(r294698)
@@ -6,11 +6,11 @@ arm/allwinner/a10_clk.c   standard
 arm/allwinner/a10_common.c standard
 arm/allwinner/a10_ehci.c   optionalehci
 arm/allwinner/a10_gpio.c   optionalgpio
-arm/allwinner/a10_machdep.cstandard
 arm/allwinner/a10_mmc.coptionalmmc
 arm/allwinner/a10_sramc.c  standard
 arm/allwinner/a10_wdog.c   standard
 arm/allwinner/a20/a20_cpu_cfg.cstandard
+arm/allwinner/allwinner_machdep.c  standard
 arm/allwinner/if_emac.coptionalemac
 arm/allwinner/timer.c  standard
 #arm/allwinner/conso

Re: svn commit: r294698 - in head/sys/arm: allwinner conf

2016-01-24 Thread Andrew Turner
On Mon, 25 Jan 2016 00:24:57 + (UTC)
Andrew Turner  wrote:

> Author: andrew
> Date: Mon Jan 25 00:24:57 2016
> New Revision: 294698
> URL: https://svnweb.freebsd.org/changeset/base/294698
> 
> Log:
>   Update the Allwinner kernels:
>* Use the ARM PLATFORM framework
>* Use ARM_INTRNG on teh A20 as it has a GICv2
>* Add a method to find which Allwinner SoC we are running on
>   
>   Differential Revision:  https://reviews.freebsd.org/D5059

I missed:
Submitted by: Emmanuel Vadot 
___
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: r290475 - in head: share/man/man9 sys/kern sys/sys

2016-01-24 Thread Conrad Meyer
No.  They break ABI.

Best,
Conrad

On Sun, Jan 24, 2016 at 1:45 PM, Oliver Pinter
 wrote:
> On 11/8/15, Hans Petter Selasky  wrote:
>> On 11/07/15 19:26, Conrad Meyer wrote:
>>> Can do — fixed in r290505.
>>>
>>> Thanks,
>>> Conrad
>>
>> Thank you. Looks good!
>>
>> --HPS
>
> Hi All!
>
> Is there any way to merge back to 10-STABLE these patches?
>
>>
>> ___
>> 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-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: r294665 - head/usr.bin/ldd

2016-01-24 Thread Jan Beich
Ruslan Bukin  writes:

> Modified: head/usr.bin/ldd/ldd.c
> ==
> --- head/usr.bin/ldd/ldd.cSun Jan 24 15:12:49 2016(r294664)
> +++ head/usr.bin/ldd/ldd.cSun Jan 24 15:15:57 2016(r294665)
> @@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$");
>  
>  #include "extern.h"
>  
> -/* We don't support a.out executables on arm64 */
> -#ifndef __aarch64__
> +/* We don't support a.out executables on arm64 and riscv */
> +#if !defined(__aarch64__) && !defined(__riscv__)

a.out in userland is only supported by i386. On amd64 it'd mean 32bit jail
after |kldload aout|.

r292623 maybe an example fix if you can ignore whitespace noise.


signature.asc
Description: PGP signature


svn commit: r294699 - head/usr.bin/elfdump

2016-01-24 Thread Ed Maste
Author: emaste
Date: Mon Jan 25 04:22:01 2016
New Revision: 294699
URL: https://svnweb.freebsd.org/changeset/base/294699

Log:
  elfdump: handle STT_SPARC_REGISTER
  
  STT_SPARC_REGISTER is a SPARC-specific symbol type specified by the
  Sparcv9 ABI to provide some information on register use by the object.
  
  Also rework st_info type lookup to avoid out-of-bounds array access.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/elfdump/elfdump.c

Modified: head/usr.bin/elfdump/elfdump.c
==
--- head/usr.bin/elfdump/elfdump.c  Mon Jan 25 00:24:57 2016
(r294698)
+++ head/usr.bin/elfdump/elfdump.c  Mon Jan 25 04:22:01 2016
(r294699)
@@ -408,9 +408,27 @@ static const char *sh_flags[] = {
"SHF_WRITE|SHF_ALLOC|SHF_EXECINSTR"
 };
 
-static const char *st_types[] = {
-   "STT_NOTYPE", "STT_OBJECT", "STT_FUNC", "STT_SECTION", "STT_FILE"
-};
+static const char *
+st_type(unsigned int mach, unsigned int type)
+{
+static char s_type[32];
+
+switch (type) {
+case STT_NOTYPE: return "STT_NOTYPE";
+case STT_OBJECT: return "STT_OBJECT";
+case STT_FUNC: return "STT_FUNC";
+case STT_SECTION: return "STT_SECTION";
+case STT_FILE: return "STT_FILE";
+case STT_COMMON: return "STT_COMMON";
+case STT_TLS: return "STT_TLS";
+case 13:
+if (mach == EM_SPARCV9)
+return "STT_SPARC_REGISTER";
+break;
+}
+snprintf(s_type, sizeof(s_type), "", type);
+return (s_type);
+}
 
 static const char *st_bindings[] = {
"STB_LOCAL", "STB_GLOBAL", "STB_WEAK"
@@ -824,6 +842,7 @@ elf_print_shdr(Elf32_Ehdr *e, void *sh)
 static void
 elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str)
 {
+   u_int64_t machine;
u_int64_t offset;
u_int64_t entsize;
u_int64_t size;
@@ -835,6 +854,7 @@ elf_print_symtab(Elf32_Ehdr *e, void *sh
int len;
int i;
 
+   machine = elf_get_quarter(e, e, E_MACHINE);
offset = elf_get_off(e, sh, SH_OFFSET);
entsize = elf_get_size(e, sh, SH_ENTSIZE);
size = elf_get_size(e, sh, SH_SIZE);
@@ -854,7 +874,7 @@ elf_print_symtab(Elf32_Ehdr *e, void *sh
fprintf(out, "\tst_value: %#jx\n", value);
fprintf(out, "\tst_size: %jd\n", (intmax_t)size);
fprintf(out, "\tst_info: %s %s\n",
-   st_types[ELF32_ST_TYPE(info)],
+   st_type(machine, ELF32_ST_TYPE(info)),
st_bindings[ELF32_ST_BIND(info)]);
fprintf(out, "\tst_shndx: %jd\n", (intmax_t)shndx);
}
___
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: r294700 - head/sys/dev/hyperv/netvsc

2016-01-24 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jan 25 05:01:32 2016
New Revision: 294700
URL: https://svnweb.freebsd.org/changeset/base/294700

Log:
  hyperv/hn: Partly rework transmission path
  
  - Avoid unnecessary malloc/free on transmission path.
  - busdma(9)-fy transmission path.
  - Properly handle IFF_DRV_OACTIVE.  This should fix the network
stalls reported by many.
  - Properly setup TSO parameters.
  - Properly handle bpf(4) tapping.  This 5 times the performance
during TCP sending test, when there is one bpf(4) attached.
  - Allow size of chimney sending be tuned on a running system.
Default value still needs more test to determine.
  
  Reviewed by:  adrian, delphij
  Approved by:  adrian (mentor)
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D4972

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis.h
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Jan 25 04:22:01 2016
(r294699)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Jan 25 05:01:32 2016
(r294700)
@@ -1028,4 +1028,6 @@ hv_nv_on_channel_callback(void *context)
 
if (bufferlen > NETVSC_PACKET_SIZE)
free(buffer, M_NETVSC);
+
+   hv_rf_channel_rollup(net_dev);
 }

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Jan 25 04:22:01 2016
(r294699)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Jan 25 05:01:32 2016
(r294700)
@@ -38,12 +38,16 @@
 #ifndef __HV_NET_VSC_H__
 #define __HV_NET_VSC_H__
 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -984,6 +988,9 @@ typedef struct {
hv_bool_uint8_t link_state;
 } netvsc_device_info;
 
+struct hn_txdesc;
+SLIST_HEAD(hn_txdesc_list, hn_txdesc);
+
 /*
  * Device-specific softc structure
  */
@@ -1001,6 +1008,18 @@ typedef struct hn_softc {
struct hv_device  *hn_dev_obj;
netvsc_dev  *net_dev;
 
+   int hn_txdesc_cnt;
+   struct hn_txdesc *hn_txdesc;
+   bus_dma_tag_t   hn_tx_data_dtag;
+   bus_dma_tag_t   hn_tx_rndis_dtag;
+   int hn_tx_chimney_size;
+   int hn_tx_chimney_max;
+
+   struct mtx  hn_txlist_spin;
+   struct hn_txdesc_list hn_txlist;
+   int hn_txdesc_avail;
+   int hn_txeof;
+
struct lro_ctrl hn_lro;
int hn_lro_hiwat;
 
@@ -1012,6 +1031,11 @@ typedef struct hn_softc {
u_long  hn_csum_trusted;
u_long  hn_lro_tried;
u_long  hn_small_pkts;
+   u_long  hn_no_txdescs;
+   u_long  hn_send_failed;
+   u_long  hn_txdma_failed;
+   u_long  hn_tx_collapsed;
+   u_long  hn_tx_chimney;
 } hn_softc_t;
 
 

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 04:22:01 
2016(r294699)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 05:01:32 
2016(r294700)
@@ -129,6 +129,41 @@ __FBSDID("$FreeBSD$");
 #define HV_NV_SC_PTR_OFFSET_IN_BUF 0
 #define HV_NV_PACKET_OFFSET_IN_BUF 16
 
+/* YYY should get it from the underlying channel */
+#define HN_TX_DESC_CNT 512
+
+#define HN_RNDIS_MSG_LEN   \
+(sizeof(rndis_msg) +   \
+ RNDIS_VLAN_PPI_SIZE + \
+ RNDIS_TSO_PPI_SIZE +  \
+ RNDIS_CSUM_PPI_SIZE)
+#define HN_RNDIS_MSG_BOUNDARY  PAGE_SIZE
+#define HN_RNDIS_MSG_ALIGN CACHE_LINE_SIZE
+
+#define HN_TX_DATA_BOUNDARYPAGE_SIZE
+#define HN_TX_DATA_MAXSIZE IP_MAXPACKET
+#define HN_TX_DATA_SEGSIZE PAGE_SIZE
+#define HN_TX_DATA_SEGCNT_MAX  \
+(NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS)
+
+struct hn_txdesc {
+   SLIST_ENTRY(hn_txdesc) link;
+   struct mbuf *m;
+   struct hn_softc *sc;
+   int refs;
+   uint32_tflags;  /* HN_TXD_FLAG_ */
+   netvsc_packet   netvsc_pkt; /* XXX to be removed */
+
+   bus_dmamap_tdata_dmap;
+
+   bus_addr_t  rndis_msg_paddr;
+   rndis_msg   *rndis_msg;
+   bus_dmamap_trndis_msg_dmap;
+};
+
+#define HN_TXD_FLAG_ONLIST 0x1
+#define HN_TXD_FLAG_DMAMAP 0x2
+
 /*
  * A unified flag for all o

svn commit: r294701 - head/sys/dev/hyperv/netvsc

2016-01-24 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jan 25 05:12:00 2016
New Revision: 294701
URL: https://svnweb.freebsd.org/changeset/base/294701

Log:
  hyperv/hn: Use m_copydata for chimney sending.
  
  While I'm here, move stack variables near their usage.
  
  Reviewed by:  adrian, delphij, Jun Su 
  Approved by:  adrian (mentor)
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D4977

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 05:01:32 
2016(r294700)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 05:12:00 
2016(r294701)
@@ -756,7 +756,6 @@ hn_start_locked(struct ifnet *ifp)
struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev);
netvsc_dev *net_dev = sc->net_dev;
netvsc_packet *packet;
-   struct mbuf *m_head, *m;
struct ether_vlan_header *eh;
rndis_msg *rndis_mesg;
rndis_packet *rndis_pkt;
@@ -767,8 +766,6 @@ hn_start_locked(struct ifnet *ifp)
int ether_len;
uint32_t rndis_msg_size = 0;
uint32_t trans_proto_type;
-   uint32_t send_buf_section_idx =
-   NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX;
 
if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
IFF_DRV_RUNNING)
@@ -778,6 +775,7 @@ hn_start_locked(struct ifnet *ifp)
bus_dma_segment_t segs[HN_TX_DATA_SEGCNT_MAX];
int error, nsegs, i, send_failed = 0;
struct hn_txdesc *txd;
+   struct mbuf *m_head;
 
IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
if (m_head == NULL)
@@ -940,24 +938,21 @@ pre_send:
 
/* send packet with send buffer */
if (packet->tot_data_buf_len < sc->hn_tx_chimney_size) {
+   uint32_t send_buf_section_idx;
+
send_buf_section_idx =
hv_nv_get_next_send_section(net_dev);
if (send_buf_section_idx !=
NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) {
-   char *dest = ((char *)net_dev->send_buf +
-   send_buf_section_idx *
-   net_dev->send_section_size);
+   uint8_t *dest = ((uint8_t *)net_dev->send_buf +
+   (send_buf_section_idx *
+net_dev->send_section_size));
 
memcpy(dest, rndis_mesg, rndis_msg_size);
dest += rndis_msg_size;
-   for (m = m_head; m != NULL; m = m->m_next) {
-   if (m->m_len) {
-   memcpy(dest,
-   (void *)mtod(m, 
vm_offset_t),
-   m->m_len);
-   dest += m->m_len;
-   }
-   }
+
+   m_copydata(m_head, 0, m_head->m_pkthdr.len,
+   dest);
 
packet->send_buf_section_idx =
send_buf_section_idx;
___
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: r294702 - head/sys/dev/hyperv/netvsc

2016-01-24 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jan 25 05:18:57 2016
New Revision: 294702
URL: https://svnweb.freebsd.org/changeset/base/294702

Log:
  hyperv/hn: Remove unnecessary zeroing out the netvsc_packet
  
  All used fields are setup one by one, so there is no need to zero
  out this large struct.
  
  While I'm here, move the stack variable near its usage.
  
  Reviewed by:  adrian, delphij, Jun Su 
  Approved by:  adrian (mentor)
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D4978

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 05:12:00 
2016(r294701)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 05:18:57 
2016(r294702)
@@ -755,7 +755,6 @@ hn_start_locked(struct ifnet *ifp)
hn_softc_t *sc = ifp->if_softc;
struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev);
netvsc_dev *net_dev = sc->net_dev;
-   netvsc_packet *packet;
struct ether_vlan_header *eh;
rndis_msg *rndis_mesg;
rndis_packet *rndis_pkt;
@@ -775,6 +774,7 @@ hn_start_locked(struct ifnet *ifp)
bus_dma_segment_t segs[HN_TX_DATA_SEGCNT_MAX];
int error, nsegs, i, send_failed = 0;
struct hn_txdesc *txd;
+   netvsc_packet *packet;
struct mbuf *m_head;
 
IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
@@ -790,11 +790,7 @@ hn_start_locked(struct ifnet *ifp)
}
 
packet = &txd->netvsc_pkt;
-   /* XXX not necessary */
-   memset(packet, 0, sizeof(*packet));
-
packet->is_data_pkt = TRUE;
-
/* Initialize it from the mbuf */
packet->tot_data_buf_len = m_head->m_pkthdr.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: r294703 - head/sys/dev/hyperv/netvsc

2016-01-24 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jan 25 05:25:39 2016
New Revision: 294703
URL: https://svnweb.freebsd.org/changeset/base/294703

Log:
  hyperv/hn: Trust host TCP segment checksum verification by default.
  
  According to all available information, VMSWITCH always does the
  TCP segment checksum verification before sending the segment to
  guest.
  
  Reviewed by:  adrian, delphij, Hongjiang Zhang 
  Approved by:  adrian (mentor)
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D4991

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 05:18:57 
2016(r294702)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jan 25 05:25:39 
2016(r294703)
@@ -206,7 +206,7 @@ struct hn_txdesc {
 int hv_promisc_mode = 0;/* normal mode by default */
 
 /* Trust tcp segements verification on host side. */
-static int hn_trust_hosttcp = 0;
+static int hn_trust_hosttcp = 1;
 TUNABLE_INT("dev.hn.trust_hosttcp", &hn_trust_hosttcp);
 
 #if __FreeBSD_version >= 1100045
___
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: r294704 - head/sys/net

2016-01-24 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Jan 25 05:28:19 2016
New Revision: 294704
URL: https://svnweb.freebsd.org/changeset/base/294704

Log:
  Remove unused radix_mpath definitions.

Modified:
  head/sys/net/radix_mpath.h

Modified: head/sys/net/radix_mpath.h
==
--- head/sys/net/radix_mpath.h  Mon Jan 25 05:25:39 2016(r294703)
+++ head/sys/net/radix_mpath.h  Mon Jan 25 05:28:19 2016(r294704)
@@ -51,10 +51,7 @@ struct rtentry *rt_mpath_matchgate(struc
 int rt_mpath_conflict(struct radix_node_head *, struct rtentry *,
 struct sockaddr *);
 void rtalloc_mpath_fib(struct route *, u_int32_t, u_int);
-#define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0)
 struct rtentry *rt_mpath_select(struct rtentry *, uint32_t);
-struct radix_node *rn_mpath_lookup(void *, void *,
-struct radix_node_head *);
 int rt_mpath_deldup(struct rtentry *, struct rtentry *);
 intrn4_mpath_inithead(void **, int);
 intrn6_mpath_inithead(void **, int);
___
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: r294705 - head/sys/dev/hyperv/vmbus

2016-01-24 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jan 25 05:33:18 2016
New Revision: 294705
URL: https://svnweb.freebsd.org/changeset/base/294705

Log:
  hyperv/vmbus: Avoid extra copy of page information.
  
  The page information array could contain up to 32 elements (i.e. 512B).
  And on network side w/ TSO, 11+ (176B+) elements, i.e. ~44K TSO packet,
  in the page information array is quite common.
  
  This saves us some cpu cycles.
  
  Reviewed by:  adrian, delphij
  Approved by:  adrian (mentor)
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D4992

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Mon Jan 25 05:28:19 2016
(r294704)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Mon Jan 25 05:33:18 2016
(r294705)
@@ -665,11 +665,11 @@ hv_vmbus_channel_send_packet_pagebuffer(
 {
 
int ret = 0;
-   int i = 0;
boolean_t   need_sig;
uint32_tpacket_len;
+   uint32_tpage_buflen;
uint32_tpacketLen_aligned;
-   hv_vmbus_sg_buffer_list buffer_list[3];
+   hv_vmbus_sg_buffer_list buffer_list[4];
hv_vmbus_channel_packet_page_buffer desc;
uint32_tdescSize;
uint64_talignedData = 0;
@@ -681,36 +681,33 @@ hv_vmbus_channel_send_packet_pagebuffer(
 * Adjust the size down since hv_vmbus_channel_packet_page_buffer
 *  is the largest size we support
 */
-   descSize = sizeof(hv_vmbus_channel_packet_page_buffer) -
-   ((HV_MAX_PAGE_BUFFER_COUNT - page_count) *
-   sizeof(hv_vmbus_page_buffer));
-   packet_len = descSize + buffer_len;
+   descSize = __offsetof(hv_vmbus_channel_packet_page_buffer, range);
+   page_buflen = sizeof(hv_vmbus_page_buffer) * page_count;
+   packet_len = descSize + page_buflen + buffer_len;
packetLen_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t));
 
/* Setup the descriptor */
desc.type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT;
desc.flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
-   desc.data_offset8 = descSize >> 3; /* in 8-bytes granularity */
+   /* in 8-bytes granularity */
+   desc.data_offset8 = (descSize + page_buflen) >> 3;
desc.length8 = (uint16_t) (packetLen_aligned >> 3);
desc.transaction_id = request_id;
desc.range_count = page_count;
 
-   for (i = 0; i < page_count; i++) {
-   desc.range[i].length = page_buffers[i].length;
-   desc.range[i].offset = page_buffers[i].offset;
-   desc.range[i].pfn = page_buffers[i].pfn;
-   }
-
buffer_list[0].data = &desc;
buffer_list[0].length = descSize;
 
-   buffer_list[1].data = buffer;
-   buffer_list[1].length = buffer_len;
+   buffer_list[1].data = page_buffers;
+   buffer_list[1].length = page_buflen;
 
-   buffer_list[2].data = &alignedData;
-   buffer_list[2].length = packetLen_aligned - packet_len;
+   buffer_list[2].data = buffer;
+   buffer_list[2].length = buffer_len;
 
-   ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3,
+   buffer_list[3].data = &alignedData;
+   buffer_list[3].length = packetLen_aligned - packet_len;
+
+   ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 4,
&need_sig);
 
/* TODO: We should determine if this is optional */
___
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: r294706 - in head/sys: kern net netinet netinet6 netpfil/ipfw netpfil/pf nfs

2016-01-24 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Jan 25 06:33:15 2016
New Revision: 294706
URL: https://svnweb.freebsd.org/changeset/base/294706

Log:
  MFP r287070,r287073: split radix implementation and route table structure.
  
  There are number of radix consumers in kernel land (pf,ipfw,nfs,route)
with different requirements. In fact, first 3 don't have _any_ requirements
and first 2 does not use radix locking. On the other hand, routing
structure do have these requirements (rnh_gen, multipath, custom
to-be-added control plane functions, different locking).
  Additionally, radix should not known anything about its consumers internals.
  
  So, radix code now uses tiny 'struct radix_head' structure along with
internal 'struct radix_mask_head' instead of 'struct radix_node_head'.
Existing consumers still uses the same 'struct radix_node_head' with
slight modifications: they need to pass pointer to (embedded)
'struct radix_head' to all radix callbacks.
  
  Routing code now uses new 'struct rib_head' with different locking macro:
RADIX_NODE_HEAD prefix was renamed to RIB_ (which stands for routing
information base).
  
  New net/route_var.h header was added to hold routing subsystem internal
data. 'struct rib_head' was placed there. 'struct rtentry' will also
be moved there soon.

Added:
  head/sys/net/route_var.h   (contents, props changed)
Modified:
  head/sys/kern/vfs_export.c
  head/sys/net/radix.c
  head/sys/net/radix.h
  head/sys/net/radix_mpath.c
  head/sys/net/radix_mpath.h
  head/sys/net/route.c
  head/sys/net/route.h
  head/sys/net/rtsock.c
  head/sys/netinet/in_fib.c
  head/sys/netinet/in_rmx.c
  head/sys/netinet/in_var.h
  head/sys/netinet6/in6_fib.c
  head/sys/netinet6/in6_rmx.c
  head/sys/netinet6/nd6_rtr.c
  head/sys/netpfil/ipfw/ip_fw_table_algo.c
  head/sys/netpfil/pf/pf_table.c
  head/sys/nfs/bootp_subr.c

Modified: head/sys/kern/vfs_export.c
==
--- head/sys/kern/vfs_export.c  Mon Jan 25 05:33:18 2016(r294705)
+++ head/sys/kern/vfs_export.c  Mon Jan 25 06:33:15 2016(r294706)
@@ -199,7 +199,7 @@ vfs_hang_addrlist(struct mount *mp, stru
goto out;
}
RADIX_NODE_HEAD_LOCK(rnh);
-   rn = (*rnh->rnh_addaddr)(saddr, smask, rnh, np->netc_rnodes);
+   rn = (*rnh->rnh_addaddr)(saddr, smask, &rnh->rh, np->netc_rnodes);
RADIX_NODE_HEAD_UNLOCK(rnh);
if (rn == NULL || np != (struct netcred *)rn) { /* already exists */
error = EPERM;
@@ -231,7 +231,7 @@ vfs_free_netcred(struct radix_node *rn, 
struct radix_node_head *rnh = (struct radix_node_head *) w;
struct ucred *cred;
 
-   (*rnh->rnh_deladdr) (rn->rn_key, rn->rn_mask, rnh);
+   (*rnh->rnh_deladdr) (rn->rn_key, rn->rn_mask, &rnh->rh);
cred = ((struct netcred *)rn)->netc_anon;
if (cred != NULL)
crfree(cred);
@@ -256,7 +256,7 @@ vfs_free_addrlist_af(struct radix_node_h
 
rnh = *prnh;
RADIX_NODE_HEAD_LOCK(rnh);
-   (*rnh->rnh_walktree) (rnh, vfs_free_netcred, rnh);
+   (*rnh->rnh_walktree)(&rnh->rh, vfs_free_netcred, &rnh->rh);
RADIX_NODE_HEAD_UNLOCK(rnh);
RADIX_NODE_HEAD_DESTROY(rnh);
free(rnh, M_RTABLE);
@@ -470,7 +470,7 @@ vfs_export_lookup(struct mount *mp, stru
if (rnh != NULL) {
RADIX_NODE_HEAD_RLOCK(rnh);
np = (struct netcred *)
-   (*rnh->rnh_matchaddr)(saddr, rnh);
+   (*rnh->rnh_matchaddr)(saddr, &rnh->rh);
RADIX_NODE_HEAD_RUNLOCK(rnh);
if (np && np->netc_rnodes->rn_flags & RNF_ROOT)
np = NULL;

Modified: head/sys/net/radix.c
==
--- head/sys/net/radix.cMon Jan 25 05:33:18 2016(r294705)
+++ head/sys/net/radix.cMon Jan 25 06:33:15 2016(r294706)
@@ -56,18 +56,15 @@
 #include 
 #endif /* !_KERNEL */
 
-static int rn_walktree_from(struct radix_node_head *h, void *a, void *m,
-   walktree_f_t *f, void *w);
-static int rn_walktree(struct radix_node_head *, walktree_f_t *, void *);
 static struct radix_node
-*rn_insert(void *, struct radix_node_head *, int *,
+*rn_insert(void *, struct radix_head *, int *,
 struct radix_node [2]),
 *rn_newpair(void *, int, struct radix_node[2]),
 *rn_search(void *, struct radix_node *),
 *rn_search_m(void *, struct radix_node *, void *);
+static struct radix_node *rn_addmask(void *, struct radix_mask_head *, 
int,int);
 
-static void rn_detachhead_internal(void **head);
-static int rn_inithead_internal(void **head, int off);
+static void rn_detachhead_internal(struct radix_head *);
 
 #define

Re: svn commit: r293801 - in head: . etc share/examples/ypldap usr.sbin/ypldap

2016-01-24 Thread Marcelo Araujo
Thanks to point it out!
I have sent a patch for review and approve.


Best,

2016-01-24 21:58 GMT+08:00 Antoine Brodin :

>
> On Jan 13, 2016 2:49 AM, "Marcelo Araujo"  wrote:
> >
> > Author: araujo
> > Date: Wed Jan 13 01:49:35 2016
> > New Revision: 293801
> > URL: https://svnweb.freebsd.org/changeset/base/293801
> >
> > Log:
> >   ypldap(8) is a feature ready to be used to translate nis(8) database
> to ldap(3).
> >
> >   This commit, fix a core dump on ypldap(8) related with memory
> allocation.
> >   Also an example of how to set the ypldap.conf(5) properly is added to
> >   examples files.
> >
> >   A new user _ypldap is required to be able to run ypldap(8) as well as
> >   in a chroot mode.
> >
> >   Reviewed by:  rodrigc (mentor), bjk
> >   Approved by:  bapt (mentor)
> >   Relnotes: Yes
> >   Sponsored by: gandi.net
> >   Differential Revision:https://reviews.freebsd.org/D4744
> >
>
> Hi,
>
> Uid 93 is already used in the ports tree by jabber.  (/usr/ports/UIDs)
>
> Cheers,
>
> Antoine
>
> > Added:
> >   head/share/examples/ypldap/
> >   head/share/examples/ypldap/ypldap.conf   (contents, props changed)
> > Modified:
> >   head/UPDATING
> >   head/etc/master.passwd
> >   head/usr.sbin/ypldap/yp.c
> >   head/usr.sbin/ypldap/ypldap.conf.5
> >
> > Modified: head/UPDATING
> >
> ==
> > --- head/UPDATING   Wed Jan 13 01:32:04 2016(r293800)
> > +++ head/UPDATING   Wed Jan 13 01:49:35 2016(r293801)
> > @@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
> > disable the most expensive debugging functionality run
> > "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
> >
> > +20160113:
> > +   With the addition of ypldap(8), a new _ypldap user is now
> required
> > +   during installworld. "mergemaster -p" can be used to add the user
> > +   prior to installworld, as documented in the handbook.
> > +
> >  20151216:
> > The tftp loader (pxeboot) now uses the option root-path
> directive. As a
> > consequence it no longer looks for a pxeboot.4th file on the tftp
> >
> > Modified: head/etc/master.passwd
> >
> ==
> > --- head/etc/master.passwd  Wed Jan 13 01:32:04 2016(r293800)
> > +++ head/etc/master.passwd  Wed Jan 13 01:49:35 2016(r293801)
> > @@ -22,5 +22,6 @@ uucp:*:66:66::0:0:UUCP pseudo-user:/var/
> >  pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin
> >  auditdistd:*:78:77::0:0:Auditdistd unprivileged
> user:/var/empty:/usr/sbin/nologin
> >  www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
> > +_ypldap:*:93:93::0:0:YP Ldap unprivileged
> user:/var/empty:/usr/sbin/nologin
> >  hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
> >  nobody:*:65534:65534::0:0:Unprivileged
> user:/nonexistent:/usr/sbin/nologin
> >
> > Added: head/share/examples/ypldap/ypldap.conf
> >
> ==
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/share/examples/ypldap/ypldap.conf  Wed Jan 13 01:49:35
> 2016(r293801)
> > @@ -0,0 +1,40 @@
> > +$FreeBSD$
> > +domain "freebsd.org"
> > +interval   60
> > +provide map"passwd.byname"
> > +provide map"passwd.byuid"
> > +provide map"group.byname"
> > +provide map"group.bygid"
> > +provide map"netid.byname"
> > +
> > +directory "127.0.0.1" {
> > +   # directory options
> > +   binddn "cn=ldap,dc=freebsd,dc=org"
> > +   bindcred "secret"
> > +   basedn "dc=freebsd.,dc=org"
> > +   # starting point for groups directory search, default to basedn
> > +   groupdn "ou=Groups,dc=freebsd,dc=org"
> > +
> > +   # passwd maps configuration (RFC 2307 posixAccount object class)
> > +   passwd filter "(objectClass=posixAccount)"
> > +
> > +   attribute name maps to "uid"
> > +   fixed attribute passwd "*"
> > +   attribute uid maps to "uidNumber"
> > +   attribute gid maps to "gidNumber"
> > +   attribute gecos maps to "cn"
> > +   attribute home maps to "homeDirectory"
> > +   attribute shell maps to "loginShell"
> > +   fixed attribute change "0"
> > +   fixed attribute expire "0"
> > +   fixed attribute class ""
> > +
> > +   # group maps configuration (RFC 2307 posixGroup object class)
> > +   group filter "(objectClass=posixGroup)"
> > +
> > +   attribute groupname maps to "cn"
> > +   fixed attribute grouppasswd "*"
> > +   attribute groupgid maps to "gidNumber"
> > +   # memberUid returns multiple group members
> > +   list groupmembers maps to "memberUid"
> > +}
> >
> > Modified: head/usr.sbin/ypldap/yp.c
> >
> ==
> > --- head/usr.sbin/ypldap/yp.c   Wed Jan

Re: svn commit: r294697 - head/sys/net80211

2016-01-24 Thread Bruce Evans

On Sun, 24 Jan 2016, Andriy Voskoboinyk wrote:


Log:
 net80211: reduce stack usage for ieee80211_ioctl*() methods.

 Use malloc(9) for
  - struct ieee80211req_wpaie2 (518 bytes, used in
 ieee80211_ioctl_getwpaie())
  - struct ieee80211_scan_req (128 bytes, used in setmlme_assoc_adhoc()
 and ieee80211_ioctl_scanreq())

 Also, drop __noinline workarounds; stack overflow is not reproducible
 with recent compilers.

 Tested with Clang 3.7.1, GCC 4.2.1 (from 9.3-RELEASE) and 4.9.4
 (with -fstack-usage flag)


Inlining also breaks debugging.  It is best avoided generally using gcc
-fnon-inline-functions-called-once.  This flag is broken (not supported)
in clang.


Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Sun Jan 24 23:28:14 2016
(r294696)
+++ head/sys/net80211/ieee80211_ioctl.c Sun Jan 24 23:35:20 2016
(r294697)
-/*
- * When building the kernel with -O2 on the i386 architecture, gcc
- * seems to want to inline this function into ieee80211_ioctl()
- * (which is the only routine that calls it). When this happens,
- * ieee80211_ioctl() ends up consuming an additional 2K of stack
- * space. (Exactly why it needs so much is unclear.) The problem
- * is that it's possible for ieee80211_ioctl() to invoke other
- * routines (including driver init functions) which could then find
- * themselves perilously close to exhausting the stack.
- *
- * To avoid this, we deliberately prevent gcc from inlining this
- * routine. Another way to avoid this is to use less agressive
- * optimization when compiling this file (i.e. -O instead of -O2)
- * but special-casing the compilation of this one module in the
- * build system would be awkward.
- */


Even with -O1 -mtune=i386 -fno-inline-functions-called-once, gcc-4.2.1
still breaks debugging of static functions by using a different calling
convention for them.  The first couple of args are passed in registers.
This breaks ddb stack traces on i386 not quite as badly as they have
always been broken on amd64.  (ddb cannot determine the number of args
or where they are on amd64, and used to print 5 words of stack garbage.
On i386, the args list is still printed and is almost as confusing as
garbage, since it is correct for extern functions but for static
functions it starts at about the third arg).

I use __attribute__((__regparm(0))) to unbreak the ABI for a few
functions designed to be called from within ddb as well as the main
code.  Some older functions like inb_() with this desgn still work
accidentally because they are extern.  I haven't figured out the
command-line flag to fix this yet.  Maybe just -mregparm.  I didn't
try hard to fix this since I was working on optimizations more than
debugging when I added the attribute.

Inlining really should reduce stack usage and thus be an optimization
that is actually useful for kernels.

Compilers are clueless about optimizations that are useful for kernels.
-Os should help, but is very broken in gcc-4.2.1 (it fails to compile
some files due to hitting inlining limits, and after working around
this, gives a negative optimization for space of about 30%).  -Os
works OK for clang -- it reduces the space a little and the time by
almost as much as -O2.  But optimizations like clang -O2 -march=native
are less than 10% faster than pessimizations like gcc-old -O1 -mtune=i386
-fno-inline-functions-called-once -fno-unit-at-a-time in kernels, in
micro-benchmarks that are favourable to the optimizations.  More like
1% for normal use.  (-fno-unit-at-a-time should reduce opportunities
for inlining static functions if -fno-inline-functions-called-once
doesn't work, but is also broken (not supported) in clang.)

Optimizations larger than 1% can possibly be obtained by using compiler
builtins, but compiler builtins are turned off by -ffreestanding.  I
no longer bother to turn some like __builtin_memcpy() back on.

Bruce
___
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"