Re: svn commit: r318336 - head/sys/arm/mv

2017-05-16 Thread Michal Meloun


On 16.05.2017 6:47, Luiz Otavio O Souza wrote:
> Author: loos
> Date: Tue May 16 04:47:50 2017
> New Revision: 318336
> URL: https://svnweb.freebsd.org/changeset/base/318336
> 
> Log:
>   Add the SDHCI Address Decoder registers and routines for ARMADA 38X.
>   
>   Tested on:  ClearFog Pro
>   Reviewed by:Marcin Wojtas 
>   Sponsored by:   Rubicon Communications, LLC (Netgate)
>   Differential Revision:  https://reviews.freebsd.org/D10601
> 
This commit breaks many of ARMv6 kernels. ARMADAXP, DB-78XXX,
DB-88F5XXX, DB-88F6XXX, TS7800, LINT.

Michal


> Modified:
>   head/sys/arm/mv/mv_common.c
>   head/sys/arm/mv/mvwin.h
> 
> Modified: head/sys/arm/mv/mv_common.c
> ==
> --- head/sys/arm/mv/mv_common.c   Tue May 16 03:31:49 2017
> (r318335)
> +++ head/sys/arm/mv/mv_common.c   Tue May 16 04:47:50 2017
> (r318336)
> @@ -82,6 +82,7 @@ static int decode_win_usb3_valid(void);
>  static int decode_win_eth_valid(void);
>  static int decode_win_pcie_valid(void);
>  static int decode_win_sata_valid(void);
> +static int decode_win_sdhci_valid(void);
>  
>  static int decode_win_idma_valid(void);
>  static int decode_win_xor_valid(void);
> @@ -95,6 +96,7 @@ static void decode_win_usb3_setup(u_long
>  static void decode_win_eth_setup(u_long);
>  static void decode_win_sata_setup(u_long);
>  static void decode_win_ahci_setup(u_long);
> +static void decode_win_sdhci_setup(u_long);
>  
>  static void decode_win_idma_setup(u_long);
>  static void decode_win_xor_setup(u_long);
> @@ -105,6 +107,7 @@ static void decode_win_eth_dump(u_long b
>  static void decode_win_idma_dump(u_long base);
>  static void decode_win_xor_dump(u_long base);
>  static void decode_win_ahci_dump(u_long base);
> +static void decode_win_sdhci_dump(u_long);
>  
>  static int fdt_get_ranges(const char *, void *, int, int *, int *);
>  #ifdef SOC_MV_ARMADA38X
> @@ -138,6 +141,7 @@ static struct soc_node_spec soc_nodes[] 
>   { "mrvl,usb-ehci", _win_usb_setup, _win_usb_dump },
>   { "marvell,armada-380-xhci", _win_usb3_setup, 
> _win_usb3_dump },
>   { "marvell,armada-380-ahci", _win_ahci_setup, 
> _win_ahci_dump },
> + { "marvell,armada-380-sdhci", _win_sdhci_setup, 
> _win_sdhci_dump },
>   { "mrvl,sata", _win_sata_setup, NULL },
>   { "mrvl,xor", _win_xor_setup, _win_xor_dump },
>   { "mrvl,idma", _win_idma_setup, _win_idma_dump },
> @@ -568,7 +572,8 @@ soc_decode_win(void)
>   if (!decode_win_cpu_valid() || !decode_win_usb_valid() ||
>   !decode_win_eth_valid() || !decode_win_idma_valid() ||
>   !decode_win_pcie_valid() || !decode_win_sata_valid() ||
> - !decode_win_xor_valid() || !decode_win_usb3_valid())
> + !decode_win_xor_valid() || !decode_win_usb3_valid() ||
> + !decode_win_sdhci_valid())
>   return (EINVAL);
>  
>   decode_win_cpu_setup();
> @@ -659,6 +664,11 @@ WIN_REG_BASE_IDX_RD(win_sata, sz, MV_WIN
>  WIN_REG_BASE_IDX_WR(win_sata, sz, MV_WIN_SATA_SIZE);
>  #endif
>  
> +WIN_REG_BASE_IDX_RD(win_sdhci, cr, MV_WIN_SDHCI_CTRL);
> +WIN_REG_BASE_IDX_RD(win_sdhci, br, MV_WIN_SDHCI_BASE);
> +WIN_REG_BASE_IDX_WR(win_sdhci, cr, MV_WIN_SDHCI_CTRL);
> +WIN_REG_BASE_IDX_WR(win_sdhci, br, MV_WIN_SDHCI_BASE);
> +
>  #ifndef SOC_MV_DOVE
>  WIN_REG_IDX_RD(ddr, br, MV_WIN_DDR_BASE, MV_DDR_CADR_BASE)
>  WIN_REG_IDX_RD(ddr, sz, MV_WIN_DDR_SIZE, MV_DDR_CADR_BASE)
> @@ -2073,6 +2083,60 @@ decode_win_sata_valid(void)
>   return (decode_win_can_cover_ddr(MV_WIN_SATA_MAX));
>  }
>  
> +static void
> +decode_win_sdhci_setup(u_long base)
> +{
> + uint32_t cr, br;
> + int i, j;
> +
> + for (i = 0; i < MV_WIN_SDHCI_MAX; i++) {
> + win_sdhci_cr_write(base, i, 0);
> + win_sdhci_br_write(base, i, 0);
> + }
> +
> + for (i = 0; i < MV_WIN_DDR_MAX; i++)
> + if (ddr_is_active(i)) {
> + br = ddr_base(i);
> + cr = (((ddr_size(i) - 1) &
> + (IO_WIN_SIZE_MASK << IO_WIN_SIZE_SHIFT)) |
> + (ddr_attr(i) << IO_WIN_ATTR_SHIFT) |
> + (ddr_target(i) << IO_WIN_TGT_SHIFT) |
> + IO_WIN_ENA_MASK);
> +
> + /* Use the first available SDHCI window */
> + for (j = 0; j < MV_WIN_SDHCI_MAX; j++) {
> + if (win_sdhci_cr_read(base, j) & 
> IO_WIN_ENA_MASK)
> + continue;
> +
> + win_sdhci_cr_write(base, j, cr);
> + win_sdhci_br_write(base, j, br);
> + break;
> + }
> + }
> +}
> +
> +static void
> +decode_win_sdhci_dump(u_long base)
> +{
> + int i;
> +
> + for (i = 0; i < MV_WIN_SDHCI_MAX; i++)
> + printf("SDHCI window#%d: c 0x%08x, b 0x%08x\n", i,
> + 

Re: svn commit: r318364 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/libxo contrib/libxo/tests/core contrib/libxo/tests/core/saved contrib/libxo/tests/gettext/saved contrib/libxo/xo lib/li

2017-05-16 Thread Phil Shafer
"Ngie Cooper (yaneurabeya)" writes:
>> URL: https://svnweb.freebsd.org/changeset/base/318364
>Relnotes: yes
>Also, what does this upgrade entail, in terms of new features/risk?

It's all documentation and minor fixes (213478, 204651).  There is
also a fix for using "int"s to keep buffer offsets (#55 on github).
No user-visible changes.

Thanks,
 Phil
___
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: r318389 - in head/sys: amd64/amd64 arm/arm arm/include crypto/des ddb dev/cs dev/ixgb dev/lge dev/mse dev/my dev/pcn dev/ppbus dev/ppc dev/qlxgb dev/qlxgbe dev/qlxge dev/rl dev/sound/pc...

2017-05-16 Thread Ed Maste
Author: emaste
Date: Wed May 17 00:34:34 2017
New Revision: 318389
URL: https://svnweb.freebsd.org/changeset/base/318389

Log:
  Remove register keyword from sys/ and ANSIfy prototypes
  
  A long long time ago the register keyword told the compiler to store
  the corresponding variable in a CPU register, but it is not relevant
  for any compiler used in the FreeBSD world today.
  
  ANSIfy related prototypes while here.
  
  Reviewed by:  cem, jhb
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D10193

Modified:
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/arm/arm/sys_machdep.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm/include/atomic-v4.h
  head/sys/crypto/des/des_enc.c
  head/sys/crypto/des/des_setkey.c
  head/sys/ddb/db_access.c
  head/sys/ddb/db_output.c
  head/sys/ddb/db_sym.c
  head/sys/dev/cs/if_cs.c
  head/sys/dev/ixgb/if_ixgb.c
  head/sys/dev/lge/if_lge.c
  head/sys/dev/mse/mse_isa.c
  head/sys/dev/my/if_my.c
  head/sys/dev/pcn/if_pcn.c
  head/sys/dev/ppbus/immio.c
  head/sys/dev/ppbus/vpoio.c
  head/sys/dev/ppc/ppc.c
  head/sys/dev/qlxgb/qla_os.c
  head/sys/dev/qlxgbe/ql_os.c
  head/sys/dev/qlxge/qls_os.c
  head/sys/dev/rl/if_rl.c
  head/sys/dev/sound/pci/fm801.c
  head/sys/dev/speaker/spkr.c
  head/sys/dev/tl/if_tl.c
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/wb/if_wb.c
  head/sys/dev/xl/if_xl.c
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/fs/nandfs/nandfs_vnops.c
  head/sys/i386/i386/in_cksum.c
  head/sys/i386/i386/k6_mem.c
  head/sys/i386/i386/sys_machdep.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/ibcs2/ibcs2_misc.c
  head/sys/i386/ibcs2/ibcs2_other.c
  head/sys/i386/ibcs2/ibcs2_signal.c
  head/sys/i386/ibcs2/ibcs2_socksys.c
  head/sys/i386/isa/ccbque.h
  head/sys/i386/isa/elink.c
  head/sys/kern/inflate.c
  head/sys/kern/kern_clock.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_prot.c
  head/sys/kern/kern_resource.c
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_timeout.c
  head/sys/kern/kern_xxx.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sysv_msg.c
  head/sys/kern/vfs_export.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_syscalls.c
  head/sys/kern/vfs_vnops.c
  head/sys/libkern/zlib.c
  head/sys/mips/cavium/cryptocteon/cavium_crypto.c
  head/sys/mips/mips/vm_machdep.c
  head/sys/net/altq/altq_rio.c
  head/sys/net/altq/altq_rmclass.h
  head/sys/net/bpf_filter.c
  head/sys/net/if_llatbl.c
  head/sys/net/if_media.c
  head/sys/net/slcompress.c
  head/sys/netinet/in.c
  head/sys/netinet/in_cksum.c
  head/sys/netinet/ip_icmp.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/raw_ip6.c
  head/sys/netipsec/ipsec_mbuf.c
  head/sys/rpc/clnt.h
  head/sys/sparc64/include/pcpu.h

Modified: head/sys/amd64/amd64/sys_machdep.c
==
--- head/sys/amd64/amd64/sys_machdep.c  Tue May 16 23:31:52 2017
(r318388)
+++ head/sys/amd64/amd64/sys_machdep.c  Wed May 17 00:34:34 2017
(r318389)
@@ -169,9 +169,7 @@ update_gdt_fsbase(struct thread *td, uin
 }
 
 int
-sysarch(td, uap)
-   struct thread *td;
-   register struct sysarch_args *uap;
+sysarch(struct thread *td, struct sysarch_args *uap)
 {
int error = 0;
struct pcb *pcb = curthread->td_pcb;

Modified: head/sys/amd64/amd64/vm_machdep.c
==
--- head/sys/amd64/amd64/vm_machdep.c   Tue May 16 23:31:52 2017
(r318388)
+++ head/sys/amd64/amd64/vm_machdep.c   Wed May 17 00:34:34 2017
(r318389)
@@ -148,13 +148,9 @@ alloc_fpusave(int flags)
  * ready to run and return to user mode.
  */
 void
-cpu_fork(td1, p2, td2, flags)
-   register struct thread *td1;
-   register struct proc *p2;
-   struct thread *td2;
-   int flags;
+cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 {
-   register struct proc *p1;
+   struct proc *p1;
struct pcb *pcb2;
struct mdproc *mdp1, *mdp2;
struct proc_ldt *pldt;

Modified: head/sys/arm/arm/sys_machdep.c
==
--- head/sys/arm/arm/sys_machdep.c  Tue May 16 23:31:52 2017
(r318388)
+++ head/sys/arm/arm/sys_machdep.c  Wed May 17 00:34:34 2017
(r318389)
@@ -188,9 +188,7 @@ arm32_get_tp(struct thread *td, void *ar
 }
 
 int
-sysarch(td, uap)
-   struct thread *td;
-   register struct sysarch_args *uap;
+sysarch(struct thread *td, struct sysarch_args *uap)
 {
int error;
 

Modified: head/sys/arm/arm/vm_machdep.c
==
--- head/sys/arm/arm/vm_machdep.c   Tue May 16 23:31:52 2017
(r318388)
+++ head/sys/arm/arm/vm_machdep.c   Wed May 17 00:34:34 2017
(r318389)
@@ -93,8 +93,7 @@ uint32_t initial_fpscr = VFPSCR_DN | VFP
  * ready to run and return to 

Re: svn commit: r318364 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/libxo contrib/libxo/tests/core contrib/libxo/tests/core/saved contrib/libxo/tests/gettext/saved contrib/libxo/xo lib/li

2017-05-16 Thread Ngie Cooper (yaneurabeya)

> On May 16, 2017, at 11:46, Phil Shafer  wrote:
> 
> Author: phil
> Date: Tue May 16 18:46:56 2017
> New Revision: 318364
> URL: https://svnweb.freebsd.org/changeset/base/318364
> 
> Log:
>  Import libxo-0.7.2; add xo_options.7.
> 
>  Submitted by:phil
>  Reviewed by: sjg
>  Approved by: sjg (mentor)

Relnotes: yes

Also, what does this upgrade entail, in terms of new features/risk?

Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r318388 - in head: share/man/man9 sys/kern sys/sys

2017-05-16 Thread John Baldwin
Author: jhb
Date: Tue May 16 23:31:52 2017
New Revision: 318388
URL: https://svnweb.freebsd.org/changeset/base/318388

Log:
  Add sglist_append_sglist().
  
  This function permits a range of one scatter/gather list to be appended to
  another sglist.  This can be used to construct a scatter/gather list that
  reorders or duplicates ranges from one or more existing scatter/gather
  lists.
  
  Sponsored by: Chelsio Communications

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/sglist.9
  head/sys/kern/subr_sglist.c
  head/sys/sys/sglist.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue May 16 23:18:50 2017
(r318387)
+++ head/share/man/man9/MakefileTue May 16 23:31:52 2017
(r318388)
@@ -1572,6 +1572,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \
sglist.9 sglist_append_bio.9 \
sglist.9 sglist_append_mbuf.9 \
sglist.9 sglist_append_phys.9 \
+   sglist.9 sglist_append_sglist.9 \
sglist.9 sglist_append_uio.9 \
sglist.9 sglist_append_user.9 \
sglist.9 sglist_append_vmpages.9 \

Modified: head/share/man/man9/sglist.9
==
--- head/share/man/man9/sglist.9Tue May 16 23:18:50 2017
(r318387)
+++ head/share/man/man9/sglist.9Tue May 16 23:31:52 2017
(r318388)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 12, 2014
+.Dd May 16, 2017
 .Dt SGLIST 9
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@
 .Nm sglist_append_bio ,
 .Nm sglist_append_mbuf ,
 .Nm sglist_append_phys ,
+.Nm sglist_append_sglist ,
 .Nm sglist_append_uio ,
 .Nm sglist_append_user ,
 .Nm sglist_append_vmpages ,
@@ -67,6 +68,8 @@
 .Ft int
 .Fn sglist_append_phys "struct sglist *sg" "vm_paddr_t paddr" "size_t len"
 .Ft int
+.Fn sglist_append_sglist "struct sglist *sg" "struct sglist *source" "size_t 
offset" "size_t len"
+.Ft int
 .Fn sglist_append_uio "struct sglist *sg" "struct uio *uio"
 .Ft int
 .Fn sglist_append_user "struct sglist *sg" "void *buf" "size_t len" "struct 
thread *td"
@@ -252,6 +255,20 @@ and is
 bytes long.
 .Pp
 The
+.Nm sglist_append_sglist
+function appends physical address ranges described by the scatter/gather list
+.Fa source
+to the scatter/gather list
+.Fa sg .
+The physical address ranges start at offset
+.Fa offset
+within
+.Fa source
+and continue for
+.Fa len
+bytes.
+.Pp
+The
 .Nm sglist_append_uio
 function appends the physical address ranges described by a
 .Xr uio 9

Modified: head/sys/kern/subr_sglist.c
==
--- head/sys/kern/subr_sglist.c Tue May 16 23:18:50 2017(r318387)
+++ head/sys/kern/subr_sglist.c Tue May 16 23:31:52 2017(r318388)
@@ -413,6 +413,49 @@ sglist_append_user(struct sglist *sg, vo
 }
 
 /*
+ * Append a subset of an existing scatter/gather list 'source' to a
+ * the scatter/gather list 'sg'.  If there are insufficient segments,
+ * then this fails with EFBIG.
+ */
+int
+sglist_append_sglist(struct sglist *sg, struct sglist *source, size_t offset,
+size_t length)
+{
+   struct sgsave save;
+   struct sglist_seg *ss;
+   size_t seglen;
+   int error, i;
+
+   if (sg->sg_maxseg == 0 || length == 0)
+   return (EINVAL);
+   SGLIST_SAVE(sg, save);
+   error = EINVAL;
+   ss = >sg_segs[sg->sg_nseg - 1];
+   for (i = 0; i < source->sg_nseg; i++) {
+   if (offset >= source->sg_segs[i].ss_len) {
+   offset -= source->sg_segs[i].ss_len;
+   continue;
+   }
+   seglen = source->sg_segs[i].ss_len - offset;
+   if (seglen > length)
+   seglen = length;
+   error = _sglist_append_range(sg, ,
+   source->sg_segs[i].ss_paddr + offset, seglen);
+   if (error)
+   break;
+   offset = 0;
+   length -= seglen;
+   if (length == 0)
+   break;
+   }
+   if (length != 0)
+   error = EINVAL;
+   if (error)
+   SGLIST_RESTORE(sg, save);
+   return (error);
+}
+
+/*
  * Append the segments that describe a single uio to a scatter/gather
  * list.  If there are insufficient segments, then this fails with
  * EFBIG.

Modified: head/sys/sys/sglist.h
==
--- head/sys/sys/sglist.h   Tue May 16 23:18:50 2017(r318387)
+++ head/sys/sys/sglist.h   Tue May 16 23:31:52 2017(r318388)
@@ -88,6 +88,8 @@ int   sglist_append_bio(struct sglist *sg,
 intsglist_append_mbuf(struct sglist *sg, struct mbuf *m0);
 intsglist_append_phys(struct sglist *sg, vm_paddr_t paddr,
size_t len);
+intsglist_append_sglist(struct sglist *sg, struct sglist 

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

2017-05-16 Thread John Baldwin
Author: jhb
Date: Tue May 16 23:18:50 2017
New Revision: 318387
URL: https://svnweb.freebsd.org/changeset/base/318387

Log:
  Add support for child devices that aren't ports.
  
  Invoke any identify routines of child drivers during attach before attaching
  children, and delete any remaining devices after deleting ports.
  
  MFC after:1 month
  Sponsored by: Chelsio Communications

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

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cTue May 16 23:15:40 2017
(r318386)
+++ head/sys/dev/cxgbe/t4_main.cTue May 16 23:18:50 2017
(r318387)
@@ -1186,6 +1186,12 @@ t4_attach(device_t dev)
goto done;
}
 
+   rc = bus_generic_probe(dev);
+   if (rc != 0) {
+   device_printf(dev, "failed to probe child drivers: %d\n", rc);
+   goto done;
+   }
+
rc = bus_generic_attach(dev);
if (rc != 0) {
device_printf(dev,
@@ -1339,6 +1345,8 @@ t4_detach_common(device_t dev)
}
}
 
+   device_delete_children(dev);
+
if (sc->flags & FULL_INIT_DONE)
adapter_full_uninit(sc);
 
___
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: r318386 - head/share/man/man7

2017-05-16 Thread John Baldwin
Author: jhb
Date: Tue May 16 23:15:40 2017
New Revision: 318386
URL: https://svnweb.freebsd.org/changeset/base/318386

Log:
  Note that the first release of FreeBSD/alpha was 3.2.
  
  Alpha is explicitly mentioned in the release announcements beginning with
  3.2.

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

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Tue May 16 21:54:51 2017(r318385)
+++ head/share/man/man7/arch.7  Tue May 16 23:15:40 2017(r318386)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2017
+.Dd May 16, 2017
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -90,7 +90,7 @@ architectures, the final release.
 .Pp
 .Bl -column -offset indent "Sy Architecture" "Sy Initial Release" "Sy Final 
Release"
 .It Sy Architecture Ta Sy Initial Release Ta Sy Final Release
-.It alpha   Ta 3.x   Ta 6.4
+.It alpha   Ta 3.2   Ta 6.4
 .It amd64   Ta 5.1
 .It arm Ta 6.0
 .It armeb   Ta 8.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: r318385 - head/bin/sh

2017-05-16 Thread Jilles Tjoelker
Author: jilles
Date: Tue May 16 21:54:51 2017
New Revision: 318385
URL: https://svnweb.freebsd.org/changeset/base/318385

Log:
  sh: Simplify output buffering.
  
  Similarly to how STPUTC was changed, change struct output to store the
  pointer just past the end of the available space instead of the size of the
  available space, so after writing a character it is only necessary to
  increment a pointer and not to decrement a counter.

Modified:
  head/bin/sh/eval.c
  head/bin/sh/output.c
  head/bin/sh/output.h

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Tue May 16 21:50:29 2017(r318384)
+++ head/bin/sh/eval.c  Tue May 16 21:54:51 2017(r318385)
@@ -1080,8 +1080,8 @@ evalcommand(union node *cmd, int flags, 
 #endif
mode = (cmdentry.u.index == EXECCMD)? 0 : REDIR_PUSH;
if (flags == EV_BACKCMD) {
-   memout.nleft = 0;
memout.nextc = memout.buf;
+   memout.bufend = memout.buf;
memout.bufsize = 64;
mode |= REDIR_BACKQ;
}
@@ -1134,8 +1134,11 @@ cmddone:
exitshell(exitstatus);
if (flags == EV_BACKCMD) {
backcmd->buf = memout.buf;
-   backcmd->nleft = memout.nextc - memout.buf;
+   backcmd->nleft = memout.buf != NULL ?
+   memout.nextc - memout.buf : 0;
memout.buf = NULL;
+   memout.nextc = NULL;
+   memout.bufend = NULL;
}
if (cmdentry.u.index != EXECCMD)
popredir();

Modified: head/bin/sh/output.c
==
--- head/bin/sh/output.cTue May 16 21:50:29 2017(r318384)
+++ head/bin/sh/output.cTue May 16 21:54:51 2017(r318385)
@@ -71,9 +71,9 @@ __FBSDID("$FreeBSD$");
 
 static int doformat_wr(void *, const char *, int);
 
-struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
-struct output errout = {NULL, 0, NULL, 256, 2, 0};
-struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
+struct output output = {NULL, NULL, NULL, OUTBUFSIZ, 1, 0};
+struct output errout = {NULL, NULL, NULL, 256, 2, 0};
+struct output memout = {NULL, NULL, NULL, 0, MEM_OUT, 0};
 struct output *out1 = 
 struct output *out2 = 
 
@@ -214,20 +214,19 @@ emptyoutbuf(struct output *dest)
INTOFF;
dest->buf = ckmalloc(dest->bufsize);
dest->nextc = dest->buf;
-   dest->nleft = dest->bufsize;
+   dest->bufend = dest->buf + dest->bufsize;
INTON;
} else if (dest->fd == MEM_OUT) {
-   offset = dest->bufsize;
+   offset = dest->nextc - dest->buf;
INTOFF;
dest->bufsize <<= 1;
dest->buf = ckrealloc(dest->buf, dest->bufsize);
-   dest->nleft = dest->bufsize - offset;
+   dest->bufend = dest->buf + dest->bufsize;
dest->nextc = dest->buf + offset;
INTON;
} else {
flushout(dest);
}
-   dest->nleft--;
 }
 
 
@@ -248,7 +247,6 @@ flushout(struct output *dest)
if (xwrite(dest->fd, dest->buf, dest->nextc - dest->buf) < 0)
dest->flags |= OUTPUT_ERR;
dest->nextc = dest->buf;
-   dest->nleft = dest->bufsize;
 }
 
 
@@ -258,8 +256,9 @@ freestdout(void)
INTOFF;
if (output.buf) {
ckfree(output.buf);
+   output.nextc = NULL;
output.buf = NULL;
-   output.nleft = 0;
+   output.bufend = NULL;
}
INTON;
 }

Modified: head/bin/sh/output.h
==
--- head/bin/sh/output.hTue May 16 21:50:29 2017(r318384)
+++ head/bin/sh/output.hTue May 16 21:54:51 2017(r318385)
@@ -40,7 +40,7 @@
 
 struct output {
char *nextc;
-   int nleft;
+   char *bufend;
char *buf;
int bufsize;
short fd;
@@ -75,7 +75,7 @@ void fmtstr(char *, int, const char *, .
 void doformat(struct output *, const char *, va_list) __printflike(2, 0);
 int xwrite(int, const char *, int);
 
-#define outc(c, file)  (--(file)->nleft < 0? (emptyoutbuf(file), 
*(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
+#define outc(c, file)  ((file)->nextc == (file)->bufend ? (emptyoutbuf(file), 
*(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
 #define out1c(c)   outc(c, out1);
 #define out2c(c)   outcslow(c, out2);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

svn commit: r318383 - head/sys/dev/qlnx/qlnxe

2017-05-16 Thread David C Somayajulu
Author: davidcs
Date: Tue May 16 21:46:30 2017
New Revision: 318383
URL: https://svnweb.freebsd.org/changeset/base/318383

Log:
  QL_DPRINT macro modfied to handle multiple args; print line#.
  
  Submitted by:shminderjit.si...@cavium.com
  MFC after:3 days

Modified:
  head/sys/dev/qlnx/qlnxe/qlnx_def.h
  head/sys/dev/qlnx/qlnxe/qlnx_ioctl.c
  head/sys/dev/qlnx/qlnxe/qlnx_os.c

Modified: head/sys/dev/qlnx/qlnxe/qlnx_def.h
==
--- head/sys/dev/qlnx/qlnxe/qlnx_def.h  Tue May 16 21:34:40 2017
(r318382)
+++ head/sys/dev/qlnx/qlnxe/qlnx_def.h  Tue May 16 21:46:30 2017
(r318383)
@@ -483,35 +483,141 @@ typedef struct qlnx_host qlnx_host_t;
 
 #ifdef QLNX_DEBUG
 
-#define QL_DPRINT1(ha, x)   if (ha->dbg_level & 0x0001) device_printf x
-#define QL_DPRINT2(ha, x)   if (ha->dbg_level & 0x0002) device_printf x
-#define QL_DPRINT3(ha, x)   if (ha->dbg_level & 0x0004) device_printf x
-#define QL_DPRINT4(ha, x)   if (ha->dbg_level & 0x0008) device_printf x
-#define QL_DPRINT5(ha, x)   if (ha->dbg_level & 0x0010) device_printf x
-#define QL_DPRINT6(ha, x)   if (ha->dbg_level & 0x0020) device_printf x
-#define QL_DPRINT7(ha, x)   if (ha->dbg_level & 0x0040) device_printf x
-#define QL_DPRINT8(ha, x)   if (ha->dbg_level & 0x0080) device_printf x
-#define QL_DPRINT9(ha, x)   if (ha->dbg_level & 0x0100) device_printf x
-#define QL_DPRINT11(ha, x)  if (ha->dbg_level & 0x0400) device_printf x
-#define QL_DPRINT12(ha, x)  if (ha->dbg_level & 0x0800) device_printf x
-#define QL_DPRINT13(ha, x)  if (ha->dbg_level & 0x1000) device_printf x
-#define QL_DPRINT14(ha, x)  if (ha->dbg_level & 0x2000) device_printf x
+#define QL_DPRINT1(ha, x, ...) \
+   do {\
+   if ((ha)->dbg_level & 0x0001) { \
+   device_printf ((ha)->pci_dev,   \
+   "[%s:%d]" x,\
+   __func__, __LINE__, \
+   ## __VA_ARGS__);\
+   }   \
+   } while (0)
+
+#define QL_DPRINT2(ha, x, ...) \
+   do {\
+   if ((ha)->dbg_level & 0x0002) { \
+   device_printf ((ha)->pci_dev,   \
+   "[%s:%d]" x,\
+   __func__, __LINE__, \
+   ## __VA_ARGS__);\
+   }   \
+   } while (0)
+
+#define QL_DPRINT3(ha, x, ...) \
+   do {\
+   if ((ha)->dbg_level & 0x0004) { \
+   device_printf ((ha)->pci_dev,   \
+   "[%s:%d]" x,\
+   __func__, __LINE__, \
+   ## __VA_ARGS__);\
+   }   \
+   } while (0)
+
+#define QL_DPRINT4(ha, x, ...) \
+   do {\
+   if ((ha)->dbg_level & 0x0008) { \
+   device_printf ((ha)->pci_dev,   \
+   "[%s:%d]" x,\
+   __func__, __LINE__, \
+   ## __VA_ARGS__);\
+   }   \
+   } while (0)
+
+#define QL_DPRINT5(ha, x, ...) \
+   do {\
+   if ((ha)->dbg_level & 0x0010) { \
+   device_printf ((ha)->pci_dev,   \
+   "[%s:%d]" x,\
+   __func__, __LINE__, \
+   ## __VA_ARGS__);\
+   }   \
+   } while (0)
+
+#define QL_DPRINT6(ha, x, ...) \
+   do {\
+   if ((ha)->dbg_level & 0x0020) { \
+   device_printf ((ha)->pci_dev,   \
+   "[%s:%d]" x,\
+   __func__, __LINE__, \
+   ## __VA_ARGS__);\
+   } 

svn commit: r318382 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe

2017-05-16 Thread David C Somayajulu
Author: davidcs
Date: Tue May 16 21:34:40 2017
New Revision: 318382
URL: https://svnweb.freebsd.org/changeset/base/318382

Log:
  1. Move Rx Processing to fp_taskqueue(). With this CPU utilization for 
processing interrupts drops to around 1% for 100G and under 1% for other speeds.
  2. Use sysctls for TRACE_LRO_CNT and TRACE_TSO_PKT_LEN
  3. remove unused mtx tx_lock
  4. bind taskqueue kernel thread to the appropriate cpu core
  5. when tx_ring is full, stop further transmits till at least 1/16th of the 
Tx Ring is empty. In our case 1K entries. Also if there are rx_pkts to process, 
put the taskqueue thread to sleep for 100ms, before enabling interrupts.
  6. Use rx_pkt_threshold of 128.
  
  MFC after:3 days

Modified:
  head/sys/dev/qlnx/qlnxe/qlnx_def.h
  head/sys/dev/qlnx/qlnxe/qlnx_os.c
  head/sys/dev/qlnx/qlnxe/qlnx_os.h
  head/sys/modules/qlnx/qlnxe/Makefile

Modified: head/sys/dev/qlnx/qlnxe/qlnx_def.h
==
--- head/sys/dev/qlnx/qlnxe/qlnx_def.h  Tue May 16 19:54:47 2017
(r318381)
+++ head/sys/dev/qlnx/qlnxe/qlnx_def.h  Tue May 16 21:34:40 2017
(r318382)
@@ -191,6 +191,7 @@ struct qlnx_fastpath {
struct mtx  tx_mtx;
chartx_mtx_name[32];
struct buf_ring *tx_br;
+   uint32_ttx_ring_full;
 
struct task fp_task;
struct taskqueue*fp_taskqueue;
@@ -364,6 +365,8 @@ struct qlnx_host {
/* debug */
 
uint32_tdbg_level;
+   uint32_tdbg_trace_lro_cnt;
+   uint32_tdbg_trace_tso_pkt_len;
uint32_tdp_level;
uint32_tdp_module;
 
@@ -386,7 +389,6 @@ struct qlnx_host {
 
/* tx related */
struct callout  tx_callout;
-   struct mtx  tx_lock;
uint32_ttxr_idx;
 
/* rx related */

Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c
==
--- head/sys/dev/qlnx/qlnxe/qlnx_os.c   Tue May 16 19:54:47 2017
(r318381)
+++ head/sys/dev/qlnx/qlnxe/qlnx_os.c   Tue May 16 21:34:40 2017
(r318382)
@@ -382,16 +382,77 @@ qlnx_fp_taskqueue(void *context, int pen
 struct ifnet   *ifp;
 struct mbuf*mp;
 intret;
+   int lro_enable, tc;
+   int rx_int = 0, total_rx_count = 0;
+   struct thread   *cthread;
 
 fp = context;
 
 if (fp == NULL)
 return;
 
+   cthread = curthread;
+
+   thread_lock(cthread);
+
+   if (!sched_is_bound(cthread))
+   sched_bind(cthread, fp->rss_id);
+
+   thread_unlock(cthread);
+
 ha = (qlnx_host_t *)fp->edev;
 
 ifp = ha->ifp;
 
+   lro_enable = ha->ifp->if_capenable & IFCAP_LRO;
+
+   rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable);
+
+   if (rx_int) {
+   fp->rx_pkts += rx_int;
+   total_rx_count += rx_int;
+   }
+
+#ifdef QLNX_SOFT_LRO
+   {
+   struct lro_ctrl *lro;
+
+   lro = >rxq->lro;
+
+   if (lro_enable && total_rx_count) {
+
+#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO)
+
+   if (ha->dbg_trace_lro_cnt) {
+   if (lro->lro_mbuf_count & ~1023)
+   fp->lro_cnt_1024++;
+   else if (lro->lro_mbuf_count & ~511)
+   fp->lro_cnt_512++;
+   else if (lro->lro_mbuf_count & ~255)
+   fp->lro_cnt_256++;
+   else if (lro->lro_mbuf_count & ~127)
+   fp->lro_cnt_128++;
+   else if (lro->lro_mbuf_count & ~63)
+   fp->lro_cnt_64++;
+   }
+   tcp_lro_flush_all(lro);
+
+#else
+   struct lro_entry *queued;
+
+   while ((!SLIST_EMPTY(>lro_active))) {
+   queued = SLIST_FIRST(>lro_active);
+   SLIST_REMOVE_HEAD(>lro_active, next);
+   tcp_lro_flush(lro, queued);
+   }
+#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */
+   }
+   }
+#endif /* #ifdef QLNX_SOFT_LRO */
+
+   ecore_sb_update_sb_idx(fp->sb_info);
+   rmb();
+
 mtx_lock(>tx_mtx);
 
 if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
@@ -401,13 +462,19 @@ qlnx_fp_taskqueue(void *context, int pen
 goto qlnx_fp_taskqueue_exit;
 }
 
-(void)qlnx_tx_int(ha, fp, 

Re: svn commit: r317732 - head/usr.bin/truss

2017-05-16 Thread Michael Tuexen
> On 16. May 2017, at 20:28, John Baldwin  wrote:
> 
> On Wednesday, May 03, 2017 09:23:14 AM Michael Tuexen wrote:
>> Author: tuexen
>> Date: Wed May  3 09:23:13 2017
>> New Revision: 317732
>> URL: https://svnweb.freebsd.org/changeset/base/317732
>> 
>> Log:
>>  Decode the third argument of socket().
> 
> This is not quite right for sockets that aren't PF_INET.  Probably this
> warrants a const char *sysdecode_socket_protocol(int domain, int protocol)
> that honors the domain in deciding what protocol value to output.  For now
> this could just handle PF_INET:
> 
> const char *
> sysdecode_socket_protocol(int domain, int protocol)
> {
> 
>switch (domain) {
>case PF_INET:
>return (lookup_value(sockipproto, protocol));
>default:
>return (NULL));
> }
> 
> Then use this in truss.
Yes, you are right. Will fix this tomorrow.

Best regards
Michael
> 
> The socket option stuff currently hardcodes IP protocols and levels only
> because we don't have a good way of obtaining the domain of an existing
> socket in a target process.  For socket()'s protocol argument though we
> readily have the domain available.
> 
> At some point in the future we might address the socket option issue by
> caching the domain argument when sockets are created in a table, and for
> truss when attaching to an existing process using the kinfo_file interface to
> learn about existing sockets, but that's not entirely trivial.
> 
> -- 
> John Baldwin

___
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: r318380 - head/libexec/rtld-elf

2017-05-16 Thread Konstantin Belousov
Author: kib
Date: Tue May 16 19:53:38 2017
New Revision: 318380
URL: https://svnweb.freebsd.org/changeset/base/318380

Log:
  Pretend that there is some security when executing in direct mode.
  
  Do not allow direct exec if we the process is suid. Try to follow Unix
  permission checks for DACs, ignore ACLs.
  
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D10750

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cTue May 16 19:48:07 2017
(r318379)
+++ head/libexec/rtld-elf/rtld.cTue May 16 19:53:38 2017
(r318380)
@@ -345,12 +345,14 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
 const Elf_Phdr *phdr;
 Objlist initlist;
 RtldLockState lockstate;
+struct stat st;
 Elf_Addr *argcp;
 char **argv, *argv0, **env, **envp, *kexecpath, *library_path_rpath;
 caddr_t imgentry;
 char buf[MAXPATHLEN];
 int argc, fd, i, mib[2], phnum;
 size_t len;
+bool dir_enable;
 
 /*
  * On entry, the dynamic linker itself has not been relocated yet.
@@ -419,6 +421,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
assert(aux_info[AT_PHDR] != NULL);
phdr = (const Elf_Phdr *)aux_info[AT_PHDR]->a_un.a_ptr;
if (phdr == obj_rtld.phdr) {
+   if (!trust) {
+   rtld_printf("Tainted process refusing to run binary %s\n",
+ argv0);
+   rtld_die();
+   }
dbg("opening main program in direct exec mode");
if (argc >= 2) {
argv0 = argv[1];
@@ -428,6 +435,37 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
  rtld_strerror(errno));
rtld_die();
}
+   if (fstat(fd, ) == -1) {
+   rtld_printf("Stat %s: %s\n", argv0,
+ rtld_strerror(errno));
+   rtld_die();
+   }
+
+   /*
+* Rough emulation of the permission checks done by
+* execve(2), only Unix DACs are checked, ACLs are
+* ignored.  Preserve the semantic of disabling owner
+* to execute if owner x bit is cleared, even if
+* others x bit is enabled.
+* mmap(2) does not allow to mmap with PROT_EXEC if
+* binary' file comes from noexec mount.  We cannot
+* set VV_TEXT on the binary.
+*/
+   dir_enable = false;
+   if (st.st_uid == geteuid()) {
+   if ((st.st_mode & S_IXUSR) != 0)
+   dir_enable = true;
+   } else if (st.st_gid == getegid()) {
+   if ((st.st_mode & S_IXGRP) != 0)
+   dir_enable = true;
+   } else if ((st.st_mode & S_IXOTH) != 0) {
+   dir_enable = true;
+   }
+   if (!dir_enable) {
+   rtld_printf("No execute permission for binary %s\n",
+ argv0);
+   rtld_die();
+   }
 
/*
 * For direct exec mode, argv[0] is the interpreter
___
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: r318366 - head/sbin/newfs_msdos

2017-05-16 Thread Ed Maste
Author: emaste
Date: Tue May 16 19:03:26 2017
New Revision: 318366
URL: https://svnweb.freebsd.org/changeset/base/318366

Log:
  newfs_msdos: clarify description of -T (timestamp) option
  
  Submitted by: Siva Mahadevan 
  Reported by:  Daniel Shahaf 
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/newfs_msdos/newfs_msdos.8

Modified: head/sbin/newfs_msdos/newfs_msdos.8
==
--- head/sbin/newfs_msdos/newfs_msdos.8 Tue May 16 18:54:25 2017
(r318365)
+++ head/sbin/newfs_msdos/newfs_msdos.8 Tue May 16 19:03:26 2017
(r318366)
@@ -38,10 +38,11 @@
 .Op Fl B Ar boot
 .Op Fl C Ar create-size
 .Op Fl F Ar FAT-type
-.Op Fl I Ar VolumeId
+.Op Fl I Ar VolumeID
 .Op Fl L Ar label
 .Op Fl O Ar OEM
 .Op Fl S Ar sector-size
+.Op Fl T Ar timestamp
 .Op Fl a Ar FAT-size
 .Op Fl b Ar block-size
 .Op Fl c Ar cluster-size
@@ -55,7 +56,6 @@
 .Op Fl o Ar hidden
 .Op Fl r Ar reserved
 .Op Fl s Ar total
-.Op Fl T Ar timestamp
 .Op Fl u Ar track-size
 .Ar special
 .Op Ar disktype
@@ -118,6 +118,14 @@ The default is
 Number of bytes per sector.
 Acceptable values are powers of 2
 in the range 512 through 32768, inclusive.
+.It Fl T Ar timestamp
+Create the filesystem as though the current time is
+.Ar timestamp .
+The default filesystem volume ID is derived from the time.
+.Ar timestamp
+can be a pathname (where the timestamp is derived from
+that file) or an integer value interpreted
+as the number of seconds since the Epoch.
 .It Fl a Ar FAT-size
 Number of sectors per FAT.
 .It Fl b Ar block-size
@@ -160,17 +168,11 @@ Number of hidden sectors.
 Number of reserved sectors.
 .It Fl s Ar total
 File system size.
-.It Fl T Ar timestamp
-Specify a timestamp to be used for filesystem creation so that
-it can be consistent for reproducible builds.
-The timestamp can be a pathname (where the timestamps are derived from
-that file) or an integer value interpreted
-as the number of seconds since the Epoch.
 .It Fl u Ar track-size
 Number of sectors per track.
 .El
 .Sh NOTES
-If some parameters (e.g. size, number of sectors, etc.) are not specified
+If some parameters (e.g., size, number of sectors, etc.) are not specified
 through options or disktype, the program tries to generate them automatically.
 In particular, the size is determined as the device or file size minus the
 offset specified with the
___
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: r318364 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/libxo contrib/libxo/tests/core contrib/libxo/tests/core/saved contrib/libxo/tests/gettext/saved contrib/libxo/xo lib/lib...

2017-05-16 Thread Phil Shafer
Author: phil
Date: Tue May 16 18:46:56 2017
New Revision: 318364
URL: https://svnweb.freebsd.org/changeset/base/318364

Log:
  Import libxo-0.7.2; add xo_options.7.
  
  Submitted by: phil
  Reviewed by:  sjg
  Approved by:  sjg (mentor)

Added:
  head/contrib/libxo/libxo/xo_options.7
 - copied unchanged from r318362, 
vendor/Juniper/libxo/dist/libxo/xo_options.7
Modified:
  head/contrib/libxo/configure.ac
  head/contrib/libxo/doc/Makefile.am
  head/contrib/libxo/doc/libxo-manual.html
  head/contrib/libxo/doc/libxo.txt
  head/contrib/libxo/libxo/Makefile.am
  head/contrib/libxo/libxo/libxo.c
  head/contrib/libxo/libxo/xo.h
  head/contrib/libxo/libxo/xo_buf.h
  head/contrib/libxo/libxo/xo_encoder.c
  head/contrib/libxo/libxo/xo_format.5
  head/contrib/libxo/libxo/xo_syslog.c
  head/contrib/libxo/tests/core/saved/test_01.E.out
  head/contrib/libxo/tests/core/saved/test_01.J.out
  head/contrib/libxo/tests/core/saved/test_01.JP.out
  head/contrib/libxo/tests/core/saved/test_01.X.out
  head/contrib/libxo/tests/core/saved/test_01.XP.out
  head/contrib/libxo/tests/core/saved/test_10.X.out
  head/contrib/libxo/tests/core/saved/test_10.XP.out
  head/contrib/libxo/tests/core/saved/test_11.X.out
  head/contrib/libxo/tests/core/saved/test_11.XP.out
  head/contrib/libxo/tests/core/test_01.c
  head/contrib/libxo/tests/gettext/saved/gt_01.J.out
  head/contrib/libxo/tests/gettext/saved/gt_01.JP.out
  head/contrib/libxo/xo/xo.c
  head/lib/libxo/Makefile
  head/lib/libxo/add.man
  head/lib/libxo/xo_config.h
  head/usr.bin/xo/Makefile
Directory Properties:
  head/contrib/libxo/   (props changed)

Modified: head/contrib/libxo/configure.ac
==
--- head/contrib/libxo/configure.ac Tue May 16 18:42:44 2017
(r318363)
+++ head/contrib/libxo/configure.ac Tue May 16 18:46:56 2017
(r318364)
@@ -12,7 +12,7 @@
 #
 
 AC_PREREQ(2.2)
-AC_INIT([libxo], [0.6.3], [p...@juniper.net])
+AC_INIT([libxo], [0.7.2], [p...@juniper.net])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
 
 # Support silent build rules.  Requires at least automake-1.11.
@@ -20,7 +20,6 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign 
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 AC_PROG_CC
-AM_PROG_AR
 AC_PROG_INSTALL
 AC_CONFIG_MACRO_DIR([m4])
 AC_PROG_LN_S
@@ -135,6 +134,21 @@ if test "$GETTEXT_ENABLE" != "no"; then
 
   AC_MSG_RESULT([$HAVE_GETTEXT])
   fi
+
+  if test "$HAVE_GETTEXT" != "yes"; then
+  GETTEXT_PREFIX=/usr/local
+  AC_MSG_CHECKING([gettext in ${GETTEXT_PREFIX}])
+
+  _save_cflags="$CFLAGS"
+  CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib 
-Werror -lintl"
+  AC_LINK_IFELSE([AC_LANG_SOURCE([[#include ]
+ [int main() {char *cp = dgettext(NULL, "xx"); return 0; }]])],
+ [HAVE_GETTEXT=yes],
+ [HAVE_GETTEXT=no])
+  CFLAGS="$_save_cflags"
+
+  AC_MSG_RESULT([$HAVE_GETTEXT])
+  fi
 fi
 
 if test "$HAVE_GETTEXT" = "yes"; then
@@ -278,6 +292,13 @@ AC_ARG_ENABLE([debug],
 AC_MSG_RESULT([$LIBXO_DEBUG])
 AM_CONDITIONAL([LIBXO_DEBUG], [test "$LIBXO_DEBUG" != "no"])
 
+AC_MSG_CHECKING([whether to use int return codes])
+AC_ARG_ENABLE([int-return-codes],
+[  --enable-int-return-codesUse int return codes (instead of ssize_t)],
+[USE_INT_RETURN_CODES=yes; AC_DEFINE([USE_INT_RETURN_CODES], [1], [Use int 
return codes])],
+[USE_INT_RETURN_CODES=no])
+AC_MSG_RESULT([$USE_INT_RETURN_CODES])
+
 AC_MSG_CHECKING([whether to build with text-only rendering])
 AC_ARG_ENABLE([text-only],
 [  --enable-text-onlyTurn on text-only rendering],

Modified: head/contrib/libxo/doc/Makefile.am
==
--- head/contrib/libxo/doc/Makefile.am  Tue May 16 18:42:44 2017
(r318363)
+++ head/contrib/libxo/doc/Makefile.am  Tue May 16 18:46:56 2017
(r318364)
@@ -61,9 +61,9 @@ xolint.txt: ${top_srcdir}/xolint/xolint.
 CLEANFILES = \
 xolint.txt \
 ${INPUT}.xml \
-${INPUT}.txt \
 ${INPUT}.fxml \
-${INPUT}.html
+${OUTPUT}.txt \
+${OUTPUT}.html
 else
 doc docs:
@${ECHO} "The 'oxtradoc' tool is not installed; see libslax.org"

Modified: head/contrib/libxo/doc/libxo-manual.html
==
--- head/contrib/libxo/doc/libxo-manual.htmlTue May 16 18:42:44 2017
(r318363)
+++ head/contrib/libxo/doc/libxo-manual.htmlTue May 16 18:46:56 2017
(r318364)
@@ -515,7 +515,7 @@ li.indline1 {
  
   } 
   @top-right {
-   content: "May 2016";
+   content: "May 2017";
  
   } 
   @top-center {
@@ -22009,7 +22009,7 @@ jQuery(function ($) {
 
 
 
-May 28, 2016
+May 15, 2017
 
 
 libxo: The Easy Way to Generate text, XML, JSON, 
and HTML outputlibxo-manual
@@ -22271,36 +22271,40 @@ jQuery(function ($) {
 
 
 3.1.4���
-xo_set_style
+xo_set_style
+
+
+3.1.5���
+xo_get_style
 
-3.1.4.1���

svn commit: r318363 - in head/contrib: atf/atf-c/detail netbsd-tests/lib/libc/sys

2017-05-16 Thread John Baldwin
Author: jhb
Date: Tue May 16 18:42:44 2017
New Revision: 318363
URL: https://svnweb.freebsd.org/changeset/base/318363

Log:
  Skip tests depending on coredumps if coredumps are disabled via kern.coredump.
  
  The kern.coredump sysctl can be set to 0 to disable coredumps.  Skip the
  'status_coredump' and 'wait6_coredumped' tests if this sysctl is set to 0
  rather than reporting a failure.
  
  Submitted by: brooks
  Reviewed by:  ngie
  Obtained from:CheriBSD
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D10665

Modified:
  head/contrib/atf/atf-c/detail/process_test.c
  head/contrib/netbsd-tests/lib/libc/sys/t_wait.c

Modified: head/contrib/atf/atf-c/detail/process_test.c
==
--- head/contrib/atf/atf-c/detail/process_test.cTue May 16 18:42:07 
2017(r318362)
+++ head/contrib/atf/atf-c/detail/process_test.cTue May 16 18:42:44 
2017(r318363)
@@ -26,6 +26,9 @@
 #include "atf-c/detail/process.h"
 
 #include 
+#ifdef __FreeBSD__
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -667,6 +670,14 @@ ATF_TC_BODY(status_coredump, tc)
 atf_tc_skip("Cannot unlimit the core file size; check limits "
 "manually");
 
+#ifdef __FreeBSD__
+   int coredump_enabled;
+   size_t ce_len = sizeof(coredump_enabled);
+   if (sysctlbyname("kern.coredump", _enabled, _len, NULL,
+   0) == 0 && !coredump_enabled)
+   atf_tc_skip("Coredumps disabled");
+#endif
+
 const int rawstatus = fork_and_wait_child(child_sigquit);
 atf_process_status_t s;
 RE(atf_process_status_init(, rawstatus));

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_wait.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_wait.c Tue May 16 18:42:07 
2017(r318362)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_wait.c Tue May 16 18:42:44 
2017(r318363)
@@ -31,6 +31,10 @@
 #include 
 __RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $");
 
+#ifdef __FreeBSD__
+#include 
+#include 
+#endif
 #include 
 #include 
 
@@ -147,6 +151,14 @@ ATF_TC_BODY(wait6_coredumped, tc)
pid_t pid;
static const struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
 
+#ifdef __FreeBSD__
+   int coredump_enabled;
+   size_t ce_len = sizeof(coredump_enabled);
+   if (sysctlbyname("kern.coredump", _enabled, _len, NULL,
+   0) == 0 && !coredump_enabled)
+   atf_tc_skip("Coredumps disabled");
+#endif
+
switch (pid = fork()) {
case 0:
ATF_REQUIRE(setrlimit(RLIMIT_CORE, ) == 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: r318360 - head/sys/sys

2017-05-16 Thread John Baldwin
Author: jhb
Date: Tue May 16 18:39:23 2017
New Revision: 318360
URL: https://svnweb.freebsd.org/changeset/base/318360

Log:
  Fix p_endcopy.
  
  For p_endcopy to work correctly, it must be the name of the next element
  in struct proc after the end of the copy region, not the name of the
  last element in the copy region.  Currently, the last element
  (p_elf_flags) is not being copied.  In addition, the p_xexit and
  p_xsig fields should not be copied on fork, so move them out of the
  copy region.
  
  Reviewed by:  kib
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D10677

Modified:
  head/sys/sys/proc.h

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Tue May 16 18:05:34 2017(r318359)
+++ head/sys/sys/proc.h Tue May 16 18:39:23 2017(r318360)
@@ -624,13 +624,13 @@ struct proc {
pid_t   p_reapsubtree;  /* (e) Pid of the direct child of the
   reaper which spawned
   our subtree. */
-   u_int   p_xexit;/* (c) Exit code. */
-   u_int   p_xsig; /* (c) Stop/kill sig. */
uint16_tp_elf_machine;  /* (x) ELF machine type */
uint64_tp_elf_flags;/* (x) ELF flags */
-
 /* End area that is copied on creation. */
-#definep_endcopy   p_elf_flags
+#definep_endcopy   p_xexit
+
+   u_int   p_xexit;/* (c) Exit code. */
+   u_int   p_xsig; /* (c) Stop/kill sig. */
struct pgrp *p_pgrp;/* (c + e) Pointer to process group. */
struct knlist   *p_klist;   /* (c) Knotes attached to this proc. */
int p_numthreads;   /* (c) Number of threads. */
___
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: r317732 - head/usr.bin/truss

2017-05-16 Thread John Baldwin
On Wednesday, May 03, 2017 09:23:14 AM Michael Tuexen wrote:
> Author: tuexen
> Date: Wed May  3 09:23:13 2017
> New Revision: 317732
> URL: https://svnweb.freebsd.org/changeset/base/317732
> 
> Log:
>   Decode the third argument of socket().

This is not quite right for sockets that aren't PF_INET.  Probably this
warrants a const char *sysdecode_socket_protocol(int domain, int protocol)
that honors the domain in deciding what protocol value to output.  For now
this could just handle PF_INET:

const char *
sysdecode_socket_protocol(int domain, int protocol)
{

switch (domain) {
case PF_INET:
return (lookup_value(sockipproto, protocol));
default:
return (NULL));
}

Then use this in truss.

The socket option stuff currently hardcodes IP protocols and levels only
because we don't have a good way of obtaining the domain of an existing
socket in a target process.  For socket()'s protocol argument though we
readily have the domain available.

At some point in the future we might address the socket option issue by
caching the domain argument when sockets are created in a table, and for
truss when attaching to an existing process using the kinfo_file interface to
learn about existing sockets, but that's not entirely trivial.

-- 
John Baldwin
___
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: r318359 - head/sys/dev/bnxt

2017-05-16 Thread Sean Bruno
Author: sbruno
Date: Tue May 16 18:05:34 2017
New Revision: 318359
URL: https://svnweb.freebsd.org/changeset/base/318359

Log:
  Add version tag to the driver.
  
  Start at version 1.0.0.0
  
  Submitted by: bhargava.marre...@broadcom.com
  Reviewed by:  venkatkumar.duvv...@broadcom.com
  Differential Revision:https://reviews.freebsd.org/D10616

Modified:
  head/sys/dev/bnxt/if_bnxt.c

Modified: head/sys/dev/bnxt/if_bnxt.c
==
--- head/sys/dev/bnxt/if_bnxt.c Tue May 16 17:51:30 2017(r318358)
+++ head/sys/dev/bnxt/if_bnxt.c Tue May 16 18:05:34 2017(r318359)
@@ -287,7 +287,8 @@ static driver_t bnxt_iflib_driver = {
  * iflib shared context
  */
 
-char bnxt_driver_version[] = "FreeBSD base";
+#define BNXT_DRIVER_VERSION"1.0.0.0"
+char bnxt_driver_version[] = BNXT_DRIVER_VERSION;
 extern struct if_txrx bnxt_txrx;
 static struct if_shared_ctx bnxt_sctx_init = {
.isc_magic = IFLIB_MAGIC,
___
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: r318356 - in head: lib/libstand sys/boot/i386/pxeldr

2017-05-16 Thread Toomas Soome
Author: tsoome
Date: Tue May 16 17:35:05 2017
New Revision: 318356
URL: https://svnweb.freebsd.org/changeset/base/318356

Log:
  libstand: increase nfs max read size to 16k
  
  With ip fragment reassembly implemented, it makes sense to allow
  larger nfs reads. Note due to loader heap size limit, we do not want
  to set too large maximum read size. Also we do not change default read size.
  
  Reviewed by:  bcr, allanjude
  Differential Revision:https://reviews.freebsd.org/D10754

Modified:
  head/lib/libstand/nfs.c
  head/sys/boot/i386/pxeldr/pxeboot.8

Modified: head/lib/libstand/nfs.c
==
--- head/lib/libstand/nfs.c Tue May 16 17:04:50 2017(r318355)
+++ head/lib/libstand/nfs.c Tue May 16 17:35:05 2017(r318356)
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 #define NFS_DEBUGxx
 
 #define NFSREAD_MIN_SIZE 1024
-#define NFSREAD_MAX_SIZE 4096
+#define NFSREAD_MAX_SIZE 16384
 
 /* NFSv3 definitions */
 #defineNFS_V3MAXFHSIZE 64

Modified: head/sys/boot/i386/pxeldr/pxeboot.8
==
--- head/sys/boot/i386/pxeldr/pxeboot.8 Tue May 16 17:04:50 2017
(r318355)
+++ head/sys/boot/i386/pxeldr/pxeboot.8 Tue May 16 17:35:05 2017
(r318356)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 1, 2000
+.Dd May 16, 2017
 .Dt PXEBOOT 8
 .Os
 .Sh NAME
@@ -91,7 +91,7 @@ This may be changed by setting the
 .Va nfs.read_size
 variable in
 .Pa /boot/loader.conf .
-Valid values range from 1024 to 4096 bytes.
+Valid values range from 1024 to 16384 bytes.
 .Pp
 In all other respects,
 .Nm
___
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: r318355 - head/sbin/newfs_msdos

2017-05-16 Thread Ed Maste
Author: emaste
Date: Tue May 16 17:04:50 2017
New Revision: 318355
URL: https://svnweb.freebsd.org/changeset/base/318355

Log:
  newfs_msdos: add -T (timestamp) option for reproducible builds
  
  This includes some whitespace and minor bug fixes relative to NetBSD,
  which will be submitted upstream at the conclusion of the makefs
  msdos update.
  
  NetBSD revs:
  mkfs_msdos.c  1.11
  mkfs_msdos.h  1.4
  newfs_msdos.8 1.22
  newfs_msdos.c 1.44
  
  Submitted by: Siva Mahadevan 
  Reviewed by:  emaste
  Obtained from:NetBSD
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/newfs_msdos/mkfs_msdos.c
  head/sbin/newfs_msdos/mkfs_msdos.h
  head/sbin/newfs_msdos/newfs_msdos.8
  head/sbin/newfs_msdos/newfs_msdos.c

Modified: head/sbin/newfs_msdos/mkfs_msdos.c
==
--- head/sbin/newfs_msdos/mkfs_msdos.c  Tue May 16 16:20:22 2017
(r318354)
+++ head/sbin/newfs_msdos/mkfs_msdos.c  Tue May 16 17:04:50 2017
(r318355)
@@ -566,9 +566,17 @@ mkfs_msdos(const char *fname, const char
 }
 print_bpb();
 if (!o.no_create) {
-   gettimeofday(, NULL);
-   now = tv.tv_sec;
-   tm = localtime();
+   if (o.timestamp_set) {
+   tv.tv_sec = now = o.timestamp;
+   tv.tv_usec = 0;
+   tm = gmtime();
+   } else {
+   gettimeofday(, NULL);
+   now = tv.tv_sec;
+   tm = localtime();
+   }
+
+
if (!(img = malloc(bpb.bpbBytesPerSec))) {
warn(NULL);
goto done;

Modified: head/sbin/newfs_msdos/mkfs_msdos.h
==
--- head/sbin/newfs_msdos/mkfs_msdos.h  Tue May 16 16:20:22 2017
(r318354)
+++ head/sbin/newfs_msdos/mkfs_msdos.h  Tue May 16 17:04:50 2017
(r318355)
@@ -42,6 +42,7 @@ AOPT('L', const char *, volume_label, -1
 AOPT('N', bool, no_create, -2, "Don't create filesystem, print params only") \
 AOPT('O', const char *, OEM_string, -1, "OEM string") \
 AOPT('S', uint16_t, bytes_per_sector, 1, "Bytes per sector") \
+AOPT('T', time_t, timestamp, 0, "Timestamp") \
 AOPT('a', uint32_t, sectors_per_fat, 1, "Sectors per FAT") \
 AOPT('b', uint32_t, block_size, 1, "Block size") \
 AOPT('c', uint8_t, sectors_per_cluster, 1, "Sectors per cluster") \
@@ -61,6 +62,7 @@ struct msdos_options {
 #define AOPT(_opt, _type, _name, _min, _desc) _type _name;
 ALLOPTS
 #undef AOPT
+   uint32_t timestamp_set:1;
uint32_t volume_id_set:1;
uint32_t media_descriptor_set:1;
uint32_t hidden_sectors_set:1;

Modified: head/sbin/newfs_msdos/newfs_msdos.8
==
--- head/sbin/newfs_msdos/newfs_msdos.8 Tue May 16 16:20:22 2017
(r318354)
+++ head/sbin/newfs_msdos/newfs_msdos.8 Tue May 16 17:04:50 2017
(r318355)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 9, 2015
+.Dd May 16, 2017
 .Dt NEWFS_MSDOS 8
 .Os
 .Sh NAME
@@ -55,6 +55,7 @@
 .Op Fl o Ar hidden
 .Op Fl r Ar reserved
 .Op Fl s Ar total
+.Op Fl T Ar timestamp
 .Op Fl u Ar track-size
 .Ar special
 .Op Ar disktype
@@ -159,6 +160,12 @@ Number of hidden sectors.
 Number of reserved sectors.
 .It Fl s Ar total
 File system size.
+.It Fl T Ar timestamp
+Specify a timestamp to be used for filesystem creation so that
+it can be consistent for reproducible builds.
+The timestamp can be a pathname (where the timestamps are derived from
+that file) or an integer value interpreted
+as the number of seconds since the Epoch.
 .It Fl u Ar track-size
 Number of sectors per track.
 .El

Modified: head/sbin/newfs_msdos/newfs_msdos.c
==
--- head/sbin/newfs_msdos/newfs_msdos.c Tue May 16 16:20:22 2017
(r318354)
+++ head/sbin/newfs_msdos/newfs_msdos.c Tue May 16 17:04:50 2017
(r318355)
@@ -31,7 +31,7 @@ static const char rcsid[] =
 #endif /* not lint */
 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -51,13 +51,30 @@ static u_int argtou(const char *, u_int,
 static off_t argtooff(const char *, const char *);
 static void usage(void);
 
+static time_t
+get_tstamp(const char *b)
+{
+struct stat st;
+char *eb;
+long long l;
+
+if (stat(b, ) != -1)
+return (time_t)st.st_mtime;
+
+errno = 0;
+l = strtoll(b, , 0);
+if (b == eb || *eb || errno)
+errx(EXIT_FAILURE, "Can't parse timestamp '%s'", b);
+return (time_t)l;
+}
+
 /*
  * Construct a FAT12, FAT16, or FAT32 file system.
  */
 int
 main(int argc, char *argv[])
 {
-static const char opts[] = "@:NB:C:F:I:L:O:S:a:b:c:e:f:h:i:k:m:n:o:r:s:u:";
+static const char opts[] = 
"@:NB:C:F:I:L:O:S:a:b:c:e:f:h:i:k:m:n:o:r:s:T:u:";
 struct msdos_options o;
 const char *fname, *dtype;
 char buf[MAXPATHLEN];
@@ -142,6 +159,10 @@ main(int argc, char *argv[])

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

2017-05-16 Thread Ngie Cooper (yaneurabeya)

> On May 16, 2017, at 9:20 AM, Conrad Meyer  wrote:
> 
> Author: cem
> Date: Tue May 16 16:20:22 2017
> New Revision: 318354
> URL: https://svnweb.freebsd.org/changeset/base/318354
> 
> Log:
>  Correct page frame mask constant used in pmap_change_attr_locked
> 
>  This was introduced in r290156.  It's present in 11.0, but not any 10.x
>  release unless someone decided to MFC it.

Hi Conrad,
It wasn’t MFCed according to 
https://svnweb.freebsd.org/base/stable/10/sys/amd64/amd64/pmap.c 
, so that’s 
ok.
Could you please MFC this change since you understand it/made it?
Thank you,
-Ngie


signature.asc
Description: Message signed with OpenPGP


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

2017-05-16 Thread Conrad Meyer
Author: cem
Date: Tue May 16 16:20:22 2017
New Revision: 318354
URL: https://svnweb.freebsd.org/changeset/base/318354

Log:
  Correct page frame mask constant used in pmap_change_attr_locked
  
  This was introduced in r290156.  It's present in 11.0, but not any 10.x
  release unless someone decided to MFC it.
  
  It affects ordinary pages right above the DMAP limit, which is effectively
  system memory rounded up to a 1 GB (3rd level superpage) boundary (or up to
  a minimum of 4 GB, on small systems).
  
  Reported by:  vangyzen
  Reviewed by:  kib, alc
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D4030

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Tue May 16 14:21:37 2017(r318353)
+++ head/sys/amd64/amd64/pmap.c Tue May 16 16:20:22 2017(r318354)
@@ -6691,7 +6691,7 @@ pmap_change_attr_locked(vm_offset_t va, 
changed = TRUE;
}
if (tmpva >= VM_MIN_KERNEL_ADDRESS &&
-   (*pte & PG_PS_FRAME) < dmaplimit) {
+   (*pte & PG_FRAME) < dmaplimit) {
if (pa_start == pa_end) {
/* Start physical address run. */
pa_start = *pte & PG_FRAME;
___
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: r318353 - in head/sys: arm/arm arm64/arm64 mips/mips x86/x86

2017-05-16 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May 16 14:21:37 2017
New Revision: 318353
URL: https://svnweb.freebsd.org/changeset/base/318353

Log:
  Avoid use of contiguous memory allocations in busdma when possible.
  
  This patch improves the boundary checks in busdma to allow more cases
  using the regular page based kernel memory allocator. Especially in
  the case of having a non-zero boundary in the parent DMA tag. For
  example AMD64 based platforms set the PCI DMA tag boundary to
  PCI_DMA_BOUNDARY, 4GB, which before this patch caused contiguous
  memory allocations to be preferred when allocating more than PAGE_SIZE
  bytes. Even if the required alignment was less than PAGE_SIZE bytes.
  
  This patch also fixes the nsegments check for using kmem_alloc_attr()
  when the maximum segment size is less than PAGE_SIZE bytes.
  
  Updated some comments describing the code in question.
  
  Differential Revision:https://reviews.freebsd.org/D10645
  Reviewed by:  kib, jhb, gallatin, scottl
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/arm/arm/busdma_machdep-v4.c
  head/sys/arm/arm/busdma_machdep-v6.c
  head/sys/arm64/arm64/busdma_bounce.c
  head/sys/mips/mips/busdma_machdep.c
  head/sys/x86/x86/busdma_bounce.c

Modified: head/sys/arm/arm/busdma_machdep-v4.c
==
--- head/sys/arm/arm/busdma_machdep-v4.cTue May 16 13:27:44 2017
(r318352)
+++ head/sys/arm/arm/busdma_machdep-v4.cTue May 16 14:21:37 2017
(r318353)
@@ -736,8 +736,10 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
if (bufzone != NULL && dmat->alignment <= bufzone->size &&
!_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) {
*vaddr = uma_zalloc(bufzone->umazone, mflags);
-   } else if (dmat->nsegments >= btoc(dmat->maxsize) &&
-   dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) {
+   } else if (dmat->nsegments >=
+   howmany(dmat->maxsize, MIN(dmat->maxsegsz, PAGE_SIZE)) &&
+   dmat->alignment <= PAGE_SIZE &&
+   (dmat->boundary % PAGE_SIZE) == 0) {
*vaddr = (void *)kmem_alloc_attr(kernel_arena, dmat->maxsize,
mflags, 0, dmat->lowaddr, memattr);
} else {

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cTue May 16 13:27:44 2017
(r318352)
+++ head/sys/arm/arm/busdma_machdep-v6.cTue May 16 14:21:37 2017
(r318353)
@@ -779,7 +779,9 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 *(the allocator aligns buffers to their size boundaries).
 *  - There's no need to handle lowaddr/highaddr exclusion zones.
 * else allocate non-contiguous pages if...
-*  - The page count that could get allocated doesn't exceed nsegments.
+*  - The page count that could get allocated doesn't exceed
+*nsegments also when the maximum segment size is less
+*than PAGE_SIZE.
 *  - The alignment constraint isn't larger than a page boundary.
 *  - There are no boundary-crossing constraints.
 * else allocate a block of contiguous pages because one or more of the
@@ -788,8 +790,10 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
if (bufzone != NULL && dmat->alignment <= bufzone->size &&
!exclusion_bounce(dmat)) {
*vaddr = uma_zalloc(bufzone->umazone, mflags);
-   } else if (dmat->nsegments >= btoc(dmat->maxsize) &&
-   dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) {
+   } else if (dmat->nsegments >=
+   howmany(dmat->maxsize, MIN(dmat->maxsegsz, PAGE_SIZE)) &&
+   dmat->alignment <= PAGE_SIZE &&
+   (dmat->boundary % PAGE_SIZE) == 0) {
*vaddr = (void *)kmem_alloc_attr(kernel_arena, dmat->maxsize,
mflags, 0, dmat->lowaddr, memattr);
} else {

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cTue May 16 13:27:44 2017
(r318352)
+++ head/sys/arm64/arm64/busdma_bounce.cTue May 16 14:21:37 2017
(r318353)
@@ -461,22 +461,35 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dm
(*mapp)->flags = DMAMAP_FROM_DMAMEM;
 
/*
-* XXX:
-* (dmat->alignment <= dmat->maxsize) is just a quick hack; the exact
-* alignment guarantees of malloc need to be nailed down, and the
-* code below should be rewritten to take that into account.
+* Allocate the buffer from the malloc(9) allocator if...
+*  - It's small enough to fit into a single power of two sized bucket.
+*  - The alignment is less than or equal to the maximum size
+*  - The low address requirement is 

svn commit: r318352 - head/libexec/rtld-elf

2017-05-16 Thread Jonathan Anderson
Author: jonathan
Date: Tue May 16 13:27:44 2017
New Revision: 318352
URL: https://svnweb.freebsd.org/changeset/base/318352

Log:
  Rename rtld's parse_libdir to parse_integer.
  
  This is a more accurate name, as the integer doesn't have to be a library
  directory descriptor. It is also a prerequisite for more argument parsing
  coming in the near future (e.g., parsing explicit binary descriptors).
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: NSERC

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cTue May 16 11:52:27 2017
(r318351)
+++ head/libexec/rtld-elf/rtld.cTue May 16 13:27:44 2017
(r318352)
@@ -115,7 +115,7 @@ static void objlist_push_head(Objlist *,
 static void objlist_push_tail(Objlist *, Obj_Entry *);
 static void objlist_put_after(Objlist *, Obj_Entry *, Obj_Entry *);
 static void objlist_remove(Objlist *, Obj_Entry *);
-static int parse_libdir(const char *);
+static int parse_integer(const char *);
 static void *path_enumerate(const char *, path_enum_proc, void *);
 static void release_object(Obj_Entry *);
 static int relocate_object_dag(Obj_Entry *root, bool bind_now,
@@ -3033,9 +3033,12 @@ search_library_pathfds(const char *name,
envcopy = xstrdup(path);
for (fdstr = strtok_r(envcopy, ":", _token); fdstr != NULL;
fdstr = strtok_r(NULL, ":", _token)) {
-   dirfd = parse_libdir(fdstr);
-   if (dirfd < 0)
+   dirfd = parse_integer(fdstr);
+   if (dirfd < 0) {
+   _rtld_error("failed to parse directory FD: '%s'",
+   fdstr);
break;
+   }
fd = __sys_openat(dirfd, name, O_RDONLY | O_CLOEXEC | O_VERIFY);
if (fd >= 0) {
*fdp = fd;
@@ -5236,29 +5239,27 @@ symlook_init_from_req(SymLook *dst, cons
  * Parse a file descriptor number without pulling in more of libc (e.g. atoi).
  */
 static int
-parse_libdir(const char *str)
+parse_integer(const char *str)
 {
static const int RADIX = 10;  /* XXXJA: possibly support hex? */
const char *orig;
-   int fd;
+   int n;
char c;
 
orig = str;
-   fd = 0;
+   n = 0;
for (c = *str; c != '\0'; c = *++str) {
if (c < '0' || c > '9')
return (-1);
 
-   fd *= RADIX;
-   fd += c - '0';
+   n *= RADIX;
+   n += c - '0';
}
 
/* Make sure we actually parsed something. */
-   if (str == orig) {
-   _rtld_error("failed to parse directory FD from '%s'", str);
+   if (str == orig)
return (-1);
-   }
-   return (fd);
+   return (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"