Re: svn commit: r328914 - in head/sys: kern ufs/ffs

2018-02-06 Thread Conrad Meyer
Hi Kirk,

On Mon, Feb 5, 2018 at 4:19 PM, Kirk McKusick  wrote:
> Author: mckusick
> Date: Tue Feb  6 00:19:46 2018
> New Revision: 328914
> URL: https://svnweb.freebsd.org/changeset/base/328914
>
> Log:
> ...
>   The second problem was that the check hash computed at the end of the
>   read was incorrect because the calculation of the check hash on
>   completion of the read was being done too soon.
>
>   - When a read completes we had the following sequence:
>
> - bufdone()
> -- b_ckhashcalc (calculates check hash)
> -- bufdone_finish()
> --- vfs_vmio_iodone() (replaces bogus pages with the cached ones)
>
>   - When we are reading a buffer where one or more pages are already
> in memory (but not all pages, or we wouldn't be doing the read),
> the I/O is done with bogus_page mapped in for the pages that exist
> in the VM cache. This mapping is done to avoid corrupting the
> cached pages if there is any I/O overrun. The vfs_vmio_iodone()
> function is responsible for replacing the bogus_page(s) with the
> cached ones. But we were calculating the check hash before the
> bogus_page(s) were replaced. Hence, when we were calculating the
> check hash, we were partly reading from bogus_page, which means
> we calculated a bad check hash (e.g., because multiple pages have
> been mapped to bogus_page, so its contents are indeterminate).
>
>   The second fix is to move the check-hash calculation from bufdone()
>   to bufdone_finish() after the call to vfs_vmio_iodone() so that it
>   computes the check hash over the correct set of pages.

Does the b_iodone callback have a very similar potential problem?  It
is invoked in bufdone(), before bufdone_finish() and
vfs_vmio_iodone().

One example b_iodone is the bdone() callback.  It seems that b_iodone
-> bdone() can then wake bwait()ers before any VMIO cached content has
been filled in.

I don't know that any specific consumers of b_iodone are currently
broken, but it seems like maybe the b_iodone callback should really be
in the later location as well.

Best,
Conrad
___
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: r328922 - head/sys/dev/etherswitch

2018-02-06 Thread Adrian Chadd
Author: adrian
Date: Tue Feb  6 08:34:50 2018
New Revision: 328922
URL: https://svnweb.freebsd.org/changeset/base/328922

Log:
  [etherswitch] add initial support for potentially configuring and fetching 
the switch MAC address.
  
  Switches that originate their own frames (eg obvious ones like Pause frames)
  need a MAC address to use to send those frames from.
  
  This API will hopefully begin to allow that to be configurable.

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

Modified: head/sys/dev/etherswitch/etherswitch.h
==
--- head/sys/dev/etherswitch/etherswitch.h  Tue Feb  6 07:50:30 2018
(r328921)
+++ head/sys/dev/etherswitch/etherswitch.h  Tue Feb  6 08:34:50 2018
(r328922)
@@ -48,10 +48,12 @@ typedef struct etherswitch_info etherswitch_info_t;
 #defineETHERSWITCH_CONF_FLAGS  (1 << 0)
 #defineETHERSWITCH_CONF_MIRROR (1 << 1)
 #defineETHERSWITCH_CONF_VLAN_MODE  (1 << 2)
+#defineETHERSWITCH_CONF_SWITCH_MACADDR (1 << 3)
 
 struct etherswitch_conf {
uint32_tcmd;/* What to configure */
uint32_tvlan_mode;  /* Switch VLAN mode */
+   struct ether_addr switch_macaddr;   /* Switch MAC address */
 };
 typedef struct etherswitch_conf etherswitch_conf_t;
 
___
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: r328923 - head/sbin/etherswitchcfg

2018-02-06 Thread Adrian Chadd
Author: adrian
Date: Tue Feb  6 08:35:09 2018
New Revision: 328923
URL: https://svnweb.freebsd.org/changeset/base/328923

Log:
  [etherswitchcfg] print the switch MAC address if provided.

Modified:
  head/sbin/etherswitchcfg/etherswitchcfg.c

Modified: head/sbin/etherswitchcfg/etherswitchcfg.c
==
--- head/sbin/etherswitchcfg/etherswitchcfg.c   Tue Feb  6 08:34:50 2018
(r328922)
+++ head/sbin/etherswitchcfg/etherswitchcfg.c   Tue Feb  6 08:35:09 2018
(r328923)
@@ -556,6 +556,13 @@ print_config(struct cfg *cfg)
printf("none\n");
}
}
+
+   /* Print switch MAC address. */
+   if (cfg->conf.cmd & ETHERSWITCH_CONF_SWITCH_MACADDR) {
+   printf("%s: Switch MAC address: %s\n",
+   c,
+   ether_ntoa(&cfg->conf.switch_macaddr));
+   }
 }
 
 static void
___
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: r328924 - head/sys/dev/etherswitch/arswitch

2018-02-06 Thread Adrian Chadd
Author: adrian
Date: Tue Feb  6 08:35:49 2018
New Revision: 328924
URL: https://svnweb.freebsd.org/changeset/base/328924

Log:
  [arswitch] Implement the switch MAC address fetch API.
  
  The placeholders are here for some future "set" MAC address API.
  
  Tested:
  
  * AR9340 switch
  * AR8327 switch

Modified:
  head/sys/dev/etherswitch/arswitch/arswitch.c
  head/sys/dev/etherswitch/arswitch/arswitchreg.h
  head/sys/dev/etherswitch/arswitch/arswitchvar.h

Modified: head/sys/dev/etherswitch/arswitch/arswitch.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch.cTue Feb  6 08:35:09 
2018(r328923)
+++ head/sys/dev/etherswitch/arswitch/arswitch.cTue Feb  6 08:35:49 
2018(r328924)
@@ -484,6 +484,41 @@ ar8xxx_atu_learn_default(struct arswitch_softc *sc)
  */
 
 /*
+ * Fetch the configured switch MAC address.
+ */
+static int
+ar8xxx_hw_get_switch_macaddr(struct arswitch_softc *sc, struct ether_addr *ea)
+{
+   uint32_t ret0, ret1;
+   char *s;
+
+   s = (void *) ea;
+
+   ret0 = arswitch_readreg(sc->sc_dev, AR8X16_REG_SW_MAC_ADDR0);
+   ret1 = arswitch_readreg(sc->sc_dev, AR8X16_REG_SW_MAC_ADDR1);
+
+   s[5] = MS(ret0, AR8X16_REG_SW_MAC_ADDR0_BYTE5);
+   s[4] = MS(ret0, AR8X16_REG_SW_MAC_ADDR0_BYTE4);
+   s[3] = MS(ret1, AR8X16_REG_SW_MAC_ADDR1_BYTE3);
+   s[2] = MS(ret1, AR8X16_REG_SW_MAC_ADDR1_BYTE2);
+   s[1] = MS(ret1, AR8X16_REG_SW_MAC_ADDR1_BYTE1);
+   s[0] = MS(ret1, AR8X16_REG_SW_MAC_ADDR1_BYTE0);
+
+   return (0);
+}
+
+/*
+ * Set the switch mac address.
+ */
+static int
+ar8xxx_hw_set_switch_macaddr(struct arswitch_softc *sc,
+const struct ether_addr *ea)
+{
+
+   return (ENXIO);
+}
+
+/*
  * XXX TODO: this attach routine does NOT free all memory, resources
  * upon failure!
  */
@@ -527,6 +562,8 @@ arswitch_attach(device_t dev)
sc->hal.arswitch_port_vlan_setup = ar8xxx_port_vlan_setup;
sc->hal.arswitch_port_vlan_get = ar8xxx_port_vlan_get;
sc->hal.arswitch_vlan_init_hw = ar8xxx_reset_vlans;
+   sc->hal.arswitch_hw_get_switch_macaddr = ar8xxx_hw_get_switch_macaddr;
+   sc->hal.arswitch_hw_set_switch_macaddr = ar8xxx_hw_set_switch_macaddr;
 
sc->hal.arswitch_vlan_getvgroup = ar8xxx_getvgroup;
sc->hal.arswitch_vlan_setvgroup = ar8xxx_setvgroup;
@@ -1115,6 +1152,7 @@ static int
 arswitch_getconf(device_t dev, etherswitch_conf_t *conf)
 {
struct arswitch_softc *sc;
+   int ret;
 
sc = device_get_softc(dev);
 
@@ -1122,6 +1160,13 @@ arswitch_getconf(device_t dev, etherswitch_conf_t *con
conf->cmd = ETHERSWITCH_CONF_VLAN_MODE;
conf->vlan_mode = sc->vlan_mode;
 
+   /* Return the switch ethernet address. */
+   ret = sc->hal.arswitch_hw_get_switch_macaddr(sc,
+   &conf->switch_macaddr);
+   if (ret == 0) {
+   conf->cmd |= ETHERSWITCH_CONF_SWITCH_MACADDR;
+   }
+
return (0);
 }
 
@@ -1139,6 +1184,8 @@ arswitch_setconf(device_t dev, etherswitch_conf_t *con
if (err != 0)
return (err);
}
+
+   /* TODO: Set the switch ethernet address. */
 
return (0);
 }

Modified: head/sys/dev/etherswitch/arswitch/arswitchreg.h
==
--- head/sys/dev/etherswitch/arswitch/arswitchreg.h Tue Feb  6 08:35:09 
2018(r328923)
+++ head/sys/dev/etherswitch/arswitch/arswitchreg.h Tue Feb  6 08:35:49 
2018(r328924)
@@ -88,7 +88,20 @@
 #defineAR8X16_REG_IMR  0x0014
 
 #defineAR8X16_REG_SW_MAC_ADDR0 0x0020
+#defineAR8X16_REG_SW_MAC_ADDR0_BYTE4   BITS(8, 8)
+#defineAR8X16_REG_SW_MAC_ADDR0_BYTE4_S 8
+#defineAR8X16_REG_SW_MAC_ADDR0_BYTE5   BITS(0, 8)
+#defineAR8X16_REG_SW_MAC_ADDR0_BYTE5_S 0
+
 #defineAR8X16_REG_SW_MAC_ADDR1 0x0024
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE0   BITS(24, 8)
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE0_S 24
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE1   BITS(16, 8)
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE1_S 16
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE2   BITS(8, 8)
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE2_S 8
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE3   BITS(0, 8)
+#defineAR8X16_REG_SW_MAC_ADDR1_BYTE3_S 0
 
 #defineAR8X16_REG_FLOOD_MASK   0x002c
 #defineAR8X16_FLOOD_MASK_BCAST_TO_CPU  (1 << 26)

Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h
==
--- head/sys/dev/etherswitch/arswitch/arswitchvar.h Tue Feb  6 08:35:09 
2018(r328923)
+++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Tue Feb  6 08:35:49 
2018(r328924)
@@ -99,6 +99,11 @@ struct arswitch_softc {
int (* arswitch_hw_setup) (struct arswitch

Re: svn commit: r328916 - in head/sys: kern vm

2018-02-06 Thread Andrew Turner

> On 6 Feb 2018, at 04:16, Gleb Smirnoff  wrote:
> 
> Author: glebius
> Date: Tue Feb  6 04:16:00 2018
> New Revision: 328916
> URL: https://svnweb.freebsd.org/changeset/base/328916
> 
> Log:
>  Followup on r302393 by cperciva, improving calculation of boot pages required
>  for UMA startup.
> 
>  o Introduce another stage of UMA startup, which is entered after
>vm_page_startup() finishes. After this stage we don't yet enable buckets,
>but we can ask VM for pages. Rename stages to meaningful names while here.
>New list of stages: BOOT_COLD, BOOT_STRAPPED, BOOT_PAGEALLOC, BOOT_BUCKETS,
>BOOT_RUNNING.
>Enabling page alloc earlier allows us to dramatically reduce number of
>boot pages required. What is more important number of zones becomes
>consistent across different machines, as no MD allocations are done before
>the BOOT_PAGEALLOC stage. Now only UMA internal zones actually need to use
>startup_alloc(), however that may change, so vm_page_startup() provides
>its need for early zones as argument.
>  o Introduce uma_startup_count() function, to avoid code duplication. The
>functions calculates sizes of zones zone and kegs zone, and calculates how
>many pages UMA will need to bootstrap.
>It counts not only of zone structures, but also of kegs, slabs and hashes.
>  o Hide uma_startup_foo() declarations from public file.
>  o Provide several DIAGNOSTIC printfs on boot_pages usage.
>  o Bugfix: when calculating zone of zones size use (mp_maxid + 1) instead of
>mp_ncpus. Use resulting number not only in the size argument to zone_ctor()
>but also as args.size.

With this I’m getting "panic: UMA: Increase vm.boot_pages” on an arm64 
simulator with 4GB of memory. I can increase vm.boot_pages manually, however 
this isn’t useful in the long term.

Andrew

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

2018-02-06 Thread Peter Holm
On Tue, Feb 06, 2018 at 04:16:00AM +, Gleb Smirnoff wrote:
> Author: glebius
> Date: Tue Feb  6 04:16:00 2018
> New Revision: 328916
> URL: https://svnweb.freebsd.org/changeset/base/328916
> 
> Log:
>   Followup on r302393 by cperciva, improving calculation of boot pages 
> required
>   for UMA startup.
>   
>   o Introduce another stage of UMA startup, which is entered after
> vm_page_startup() finishes. After this stage we don't yet enable buckets,
> but we can ask VM for pages. Rename stages to meaningful names while here.
> New list of stages: BOOT_COLD, BOOT_STRAPPED, BOOT_PAGEALLOC, 
> BOOT_BUCKETS,
> BOOT_RUNNING.
> Enabling page alloc earlier allows us to dramatically reduce number of
> boot pages required. What is more important number of zones becomes
> consistent across different machines, as no MD allocations are done before
> the BOOT_PAGEALLOC stage. Now only UMA internal zones actually need to use
> startup_alloc(), however that may change, so vm_page_startup() provides
> its need for early zones as argument.
>   o Introduce uma_startup_count() function, to avoid code duplication. The
> functions calculates sizes of zones zone and kegs zone, and calculates how
> many pages UMA will need to bootstrap.
> It counts not only of zone structures, but also of kegs, slabs and hashes.
>   o Hide uma_startup_foo() declarations from public file.
>   o Provide several DIAGNOSTIC printfs on boot_pages usage.
>   o Bugfix: when calculating zone of zones size use (mp_maxid + 1) instead of
> mp_ncpus. Use resulting number not only in the size argument to 
> zone_ctor()
> but also as args.size.
>   
>   Reviewed by:imp, gallatin (earlier version)
>   Differential Revision:  https://reviews.freebsd.org/D14054
> 
> Modified:
>   head/sys/kern/kern_malloc.c
>   head/sys/vm/uma.h
>   head/sys/vm/uma_core.c
>   head/sys/vm/uma_int.h
>   head/sys/vm/vm_page.c
> 
> Modified: head/sys/kern/kern_malloc.c
> ==
> --- head/sys/kern/kern_malloc.c   Tue Feb  6 02:13:44 2018
> (r328915)

i386 also doesn't boot:

FreeBSD 12.0-CURRENT #1 r328924: Tue Feb  6 11:51:17 CET 2018
p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 6.0.0)
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
Entering uma_startup with 4 boot pages configured
startup_alloc from "UMA Kegs", 3 boot pages left
startup_alloc from "UMA Zones", 2 boot pages left
startup_alloc from "UMA Hash", 1 boot pages left
Entering uma_startup1 with 0 boot pages left
kernel trap 12 with interrupts disabled


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x19c
fault code  = supervisor read, page not present
instruction pointer = 0x20:0xc0cda3f8
stack pointer   = 0x28:0xc2022aac
frame pointer   = 0x28:0xc2022adc
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, def32 1, gran 1
processor eflags= resume, IOPL = 0
current process = 0 ()
[ thread pid 0 tid 0 ]
Stopped at  vmem_alloc+0x88:cmpl%esi,0x19c(%edi)
db> x/s version
version:FreeBSD 12.0-CURRENT #1 r328924: Tue Feb  6 11:51:17 CET 
2018\012p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO\012
db> show registers
cs0x20
ds0x28
es0x28
fs 0x8
gs0x28
ss0x28
eax 0xc2022af8
ecx 0xc2022af8
edx 0xc23b5000
ebx 0x2002
esp 0xc2022aac
ebp 0xc2022adc
esi 0x1000
edi  0
eip 0xc0cda3f8  vmem_alloc+0x88
efl0x10002
vmem_alloc+0x88:cmpl%esi,0x19c(%edi)
db> bt
Tracing pid 0 tid 0 td 0xc1be3f40
vmem_alloc(0,1000,2102,c2022af8,450,...) at vmem_alloc+0x88/frame 0xc2022adc
kmem_malloc_domain(0,1000,102,450,c23b5000,...) at 
kmem_malloc_domain+0x44/frame 0xc2022b08
startup_alloc(c23b4000,1000,0,c2022b63,102,...) at startup_alloc+0xeb/frame 
0xc2022b30
keg_alloc_slab(0,2,c169eb10,984,c169eb10,...) at keg_alloc_slab+0xf6/frame 
0xc2022b78
keg_fetch_slab(,2,c169eb10,9e6,c23b4000,...) at 
keg_fetch_slab+0x10e/frame 0xc2022bd0
zone_fetch_slab(c23b4000,0,,2,ef0,...) at zone_fetch_slab+0x61/frame 
0xc2022bf4
zone_import(c23b4000,c2022c50,1,,2,...) at zone_import+0x3b/frame 
0xc2022c2c
zone_alloc_item(,2,c1655850,c2022c94,c165585f,...) at 
zone_alloc_item+0x3d/frame 0xc2022c60
uma_zcreate(c165585f,1c,0,0,0,...) at uma_zcreate+0xce/frame 0xc2022cbc
vmem_startup(c2157000,c0cc49fb,c12afc4b,c2022d0c,c2022d0c,...) at 
vmem_startup+0xb7/frame 0xc2022ce4
vm_mem_init(0,0,0,0,c18689c0,...) at vm_mem_init+0x24/frame 0xc2022d10
mi_startup

svn commit: r328925 - in head: . gnu/usr.bin/gdb gnu/usr.bin/gdb/gdbtui targets/pseudo/userland/gnu tools/build/mk

2018-02-06 Thread Baptiste Daroussin
Author: bapt
Date: Tue Feb  6 11:54:20 2018
New Revision: 328925
URL: https://svnweb.freebsd.org/changeset/base/328925

Log:
  Remove gdbtui, it was already not installed on every arches
  only installed on arm and sparc64.
  It is the only bits that keeps us having libreadline in base
  The rest of gdb can be switched to libedit and will be in another
  commit

Deleted:
  head/gnu/usr.bin/gdb/gdbtui/
Modified:
  head/ObsoleteFiles.inc
  head/gnu/usr.bin/gdb/Makefile
  head/targets/pseudo/userland/gnu/Makefile.depend
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Feb  6 08:35:49 2018(r328924)
+++ head/ObsoleteFiles.inc  Tue Feb  6 11:54:20 2018(r328925)
@@ -38,10 +38,11 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20180206: remove gdbtui
+OLD_FILES+=usr/bin/gdbtui
 # 20180201: Obsolete forth files
 OLD_FILES+=boot/efi.4th
 OLD_FILES+=boot/pcibios.4th
-
 # 20180114: new clang import which bumps version from 5.0.1 to 6.0.0.
 OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/asan_interface.h

Modified: head/gnu/usr.bin/gdb/Makefile
==
--- head/gnu/usr.bin/gdb/Makefile   Tue Feb  6 08:35:49 2018
(r328924)
+++ head/gnu/usr.bin/gdb/Makefile   Tue Feb  6 11:54:20 2018
(r328925)
@@ -5,8 +5,6 @@
 SUBDIR=libgdb gdb kgdb
 
 .if ${MK_GDB_LIBEXEC} == "no"
-SUBDIR+= gdbtui
-
 .if exists(${.CURDIR}/gdbserver/reg-${MACHINE_CPUARCH}.c)
 SUBDIR+=gdbserver
 .endif

Modified: head/targets/pseudo/userland/gnu/Makefile.depend
==
--- head/targets/pseudo/userland/gnu/Makefile.dependTue Feb  6 08:35:49 
2018(r328924)
+++ head/targets/pseudo/userland/gnu/Makefile.dependTue Feb  6 11:54:20 
2018(r328925)
@@ -32,7 +32,6 @@ DIRDEPS = \
gnu/usr.bin/gdb/doc \
gnu/usr.bin/gdb/gdb \
gnu/usr.bin/gdb/gdbserver \
-   gnu/usr.bin/gdb/gdbtui \
gnu/usr.bin/gdb/kgdb \
gnu/usr.bin/gdb/libgdb \
gnu/usr.bin/gperf \

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Feb  6 08:35:49 
2018(r328924)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Feb  6 11:54:20 
2018(r328925)
@@ -2460,7 +2460,6 @@ OLD_FILES+=usr/share/man/man1/gcov.1.gz
 .if ${MK_GDB} == no || ${MK_GDB_LIBEXEC} == yes
 OLD_FILES+=usr/bin/gdb
 OLD_FILES+=usr/bin/gdbserver
-OLD_FILES+=usr/bin/gdbtui
 OLD_FILES+=usr/bin/kgdb
 OLD_FILES+=usr/share/man/man1/gdb.1.gz
 OLD_FILES+=usr/share/man/man1/gdbserver.1.gz
___
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: r328926 - in head/gnu/usr.bin/gdb: . gdb kgdb

2018-02-06 Thread Baptiste Daroussin
Author: bapt
Date: Tue Feb  6 12:12:44 2018
New Revision: 328926
URL: https://svnweb.freebsd.org/changeset/base/328926

Log:
  Switch to use libedit instead of readline

Modified:
  head/gnu/usr.bin/gdb/Makefile.inc
  head/gnu/usr.bin/gdb/gdb/Makefile
  head/gnu/usr.bin/gdb/kgdb/Makefile

Modified: head/gnu/usr.bin/gdb/Makefile.inc
==
--- head/gnu/usr.bin/gdb/Makefile.inc   Tue Feb  6 11:54:20 2018
(r328925)
+++ head/gnu/usr.bin/gdb/Makefile.inc   Tue Feb  6 12:12:44 2018
(r328926)
@@ -13,11 +13,9 @@ BMAKE_BU= ${BMAKE_ROOT}/binutils
 
 CNTRB_BU= ${SRCTOP}/contrib/binutils
 CNTRB_GDB= ${SRCTOP}/contrib/gdb
-CNTRB_RL= ${SRCTOP}/contrib/libreadline
 
 OBJ_BU= ${OBJTOP}/gnu/usr.bin/binutils
 OBJ_GDB= ${OBJTOP}/gnu/usr.bin/gdb
-OBJ_RL= ${OBJTOP}/gnu/lib/libreadline/readline
 
 # These assignments duplicate much of the functionality of
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
@@ -37,7 +35,7 @@ GDB_CROSS_DEBUGGER=
 .PATH: ${CNTRB_GDB}/gdb ${CNTRB_GDB}/gdb/cli ${CNTRB_GDB}/gdb/mi   \
${CNTRB_GDB}/gdb/signals ${CNTRB_GDB}/gdb/tui ${TARGET_SUBDIR}
 
-CFLAGS+= -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1 -DTUI=1
+CFLAGS+= -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1
 CFLAGS+= -DDEBUGDIR=\"${DEBUGDIR}\"
 CFLAGS+= -I.
 CFLAGS+= -I${TARGET_SUBDIR}
@@ -47,7 +45,7 @@ CFLAGS+= -I${CNTRB_GDB}/gdb/config
 CFLAGS+= -I${CNTRB_BU}/include
 CFLAGS+= -I${CNTRB_GDB}/include
 CFLAGS+= -I${CNTRB_BU}/bfd
-CFLAGS+= -I${OBJ_RL:H}
+CFLAGS+= -I${SRCTOP}/lib/libedit/edit
 
 GENSRCS+= nm.h tm.h
 

Modified: head/gnu/usr.bin/gdb/gdb/Makefile
==
--- head/gnu/usr.bin/gdb/gdb/Makefile   Tue Feb  6 11:54:20 2018
(r328925)
+++ head/gnu/usr.bin/gdb/gdb/Makefile   Tue Feb  6 12:12:44 2018
(r328926)
@@ -13,7 +13,7 @@ LDFLAGS+= -Wl,-E
 
 DPADD= ${GDBLIBS} ${BULIBS}
 LDADD= ${GDBLIBS} ${BULIBS}
-LIBADD+=   m readline ncursesw gnuregex
+LIBADD+=   m edit ncursesw gnuregex
 
 .include 
 CFLAGS+=   -DDEBUGDIR=\"${DEBUGDIR}\"

Modified: head/gnu/usr.bin/gdb/kgdb/Makefile
==
--- head/gnu/usr.bin/gdb/kgdb/Makefile  Tue Feb  6 11:54:20 2018
(r328925)
+++ head/gnu/usr.bin/gdb/kgdb/Makefile  Tue Feb  6 12:12:44 2018
(r328926)
@@ -10,6 +10,6 @@ GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a
 
 DPADD= ${GDBLIBS} ${BULIBS}
 LDADD= ${GDBLIBS} ${BULIBS}
-LIBADD+=   m readline ncursesw gnuregex kvm
+LIBADD+=   m edit ncursesw gnuregex kvm
 
 .include 
___
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: r328489 - head/sys/conf

2018-02-06 Thread David Wolfskill
On Mon, Feb 05, 2018 at 01:32:04PM -0800, Jason Harmening wrote:
> 
> Can you try downloading the raw diff from
> https://reviews.freebsd.org/D14143 and
> applying that to src?
> 

For this morning's update of head (from r328876 to r328924), I reverted
an earlier patch to src/sys/conf/kern.post.mk and applied the
above-cited D14143 -- both on my laptop (which has

PORTS_MODULES=x11/nvidia-driver-340

in /etc/src.conf) and my build machine (which runs mostly-headless, and
has no ports modules).

No issues; everything Just Worked.

Peace,
david
-- 
David H. Wolfskill  da...@catwhisker.org
The circus around that memo helps confirm that Mr. Trump is unfit for office.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.


signature.asc
Description: PGP signature


svn commit: r328927 - head/contrib/gdb/gdb/tui

2018-02-06 Thread Baptiste Daroussin via svn-src-head
Author: bapt
Date: Tue Feb  6 12:17:03 2018
New Revision: 328927
URL: https://svnweb.freebsd.org/changeset/base/328927

Log:
  Commit forgotten change in gdb allowing to use libedit

Modified:
  head/contrib/gdb/gdb/tui/tui-io.c

Modified: head/contrib/gdb/gdb/tui/tui-io.c
==
--- head/contrib/gdb/gdb/tui/tui-io.c   Tue Feb  6 12:12:44 2018
(r328926)
+++ head/contrib/gdb/gdb/tui/tui-io.c   Tue Feb  6 12:17:03 2018
(r328927)
@@ -397,7 +397,7 @@ static void
 tui_rl_display_match_list (char **matches, int len, int max)
 {
   typedef int QSFUNC (const void *, const void *);
-  extern int _rl_qsort_string_compare (const void*, const void*);
+  extern int _rl_qsort_string_compare (char **, char **);
   extern int _rl_print_completions_horizontally;
   
   int count, limit, printed_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: r328928 - in head: contrib/libreadline gnu/lib gnu/lib/libreadline share/mk targets/pseudo/userland/gnu

2018-02-06 Thread Baptiste Daroussin
Author: bapt
Date: Tue Feb  6 12:22:42 2018
New Revision: 328928
URL: https://svnweb.freebsd.org/changeset/base/328928

Log:
  Remove libreadline from the source tree, all consumers but gdb
  has been switched to libedit long ago, libreadline was built as an
  internallib for a while and kept only for gdbtui which was broken using
  libreadline.
  
  Since gdb has been mostly deorbitted in all arches, gdbtui was only installed
  on arm and sparc64, given it has been removed, gdb has been switched to use
  libedit, no consumers are left for libreadline. Thus this removal

Deleted:
  head/contrib/libreadline/
  head/gnu/lib/libreadline/
Modified:
  head/gnu/lib/Makefile
  head/share/mk/src.libnames.mk
  head/targets/pseudo/userland/gnu/Makefile.depend

Modified: head/gnu/lib/Makefile
==
--- head/gnu/lib/Makefile   Tue Feb  6 12:17:03 2018(r328927)
+++ head/gnu/lib/Makefile   Tue Feb  6 12:22:42 2018(r328928)
@@ -7,7 +7,6 @@ SUBDIR.${MK_DIALOG}+=   libdialog
 SUBDIR.${MK_GCC}+= libgcov libgomp
 SUBDIR.${MK_SSP}+= libssp
 SUBDIR.${MK_TESTS}+=   tests
-SUBDIR.${MK_GDB}+= libreadline
 
 .if ${MK_GNU_GREP} != "no" || ${MK_GNU_GREP_COMPAT} != "no" || \
 ${MK_GDB} != "no"

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Tue Feb  6 12:17:03 2018
(r328927)
+++ head/share/mk/src.libnames.mk   Tue Feb  6 12:22:42 2018
(r328928)
@@ -44,7 +44,6 @@ _INTERNALLIBS=\
parse \
pe \
pmcstat \
-   readline \
sl \
sm \
smdb \
@@ -147,7 +146,6 @@ _LIBRARIES= \
procstat \
pthread \
radius \
-   readline \
regex \
roken \
rpcsec_gss \
@@ -290,7 +288,6 @@ _DP_pam+=   ssh
 .if ${MK_NIS} != "no"
 _DP_pam+=  ypclnt
 .endif
-_DP_readline=  ncursesw
 _DP_roken= crypt
 _DP_kadm5clnt= com_err krb5 roken
 _DP_kadm5srv=  com_err hdb krb5 roken
@@ -413,9 +410,6 @@ LIBELFTC?=  ${LIBELFTCDIR}/libelftc.a
 
 LIBPEDIR=  ${OBJTOP}/lib/libpe
 LIBPE?=${LIBPEDIR}/libpe.a
-
-LIBREADLINEDIR=${OBJTOP}/gnu/lib/libreadline/readline
-LIBREADLINE?=  ${LIBREADLINEDIR}/libreadline.a
 
 LIBOPENBSDDIR= ${OBJTOP}/lib/libopenbsd
 LIBOPENBSD?=   ${LIBOPENBSDDIR}/libopenbsd.a

Modified: head/targets/pseudo/userland/gnu/Makefile.depend
==
--- head/targets/pseudo/userland/gnu/Makefile.dependTue Feb  6 12:17:03 
2018(r328927)
+++ head/targets/pseudo/userland/gnu/Makefile.dependTue Feb  6 12:22:42 
2018(r328928)
@@ -11,8 +11,6 @@ DIRDEPS = \
gnu/lib/libdialog \
gnu/lib/libgcov \
gnu/lib/libgomp \
-   gnu/lib/libreadline/history/doc \
-   gnu/lib/libreadline/readline/doc \
gnu/lib/libregex/doc \
gnu/lib/libssp \
gnu/lib/libssp/libssp_nonshared \
___
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: r328930 - head/sys/modules/dtb/allwinner

2018-02-06 Thread Kyle Evans
Author: kevans
Date: Tue Feb  6 14:57:03 2018
New Revision: 328930
URL: https://svnweb.freebsd.org/changeset/base/328930

Log:
  dtb/allwinner: Add sun7i-a20-lamobo-r1.dts (Banana Pi R1)
  
  FreeBSD boots on this board, but the ethernet switch is not currently
  supported, resulting in no ethernet.
  
  A U-Boot port will be added once the ethernet switch is at least basically
  supported, but we add its DTS to the build here to lower the barrier-to-boot
  while work is underway.

Modified:
  head/sys/modules/dtb/allwinner/Makefile

Modified: head/sys/modules/dtb/allwinner/Makefile
==
--- head/sys/modules/dtb/allwinner/Makefile Tue Feb  6 14:04:39 2018
(r328929)
+++ head/sys/modules/dtb/allwinner/Makefile Tue Feb  6 14:57:03 2018
(r328930)
@@ -8,6 +8,7 @@ DTS=\
sun5i-r8-chip.dts \
sun7i-a20-bananapi.dts \
sun7i-a20-cubieboard2.dts \
+   sun7i-a20-lamobo-r1.dts \
sun7i-a20-olimex-som-evb.dts \
sun7i-a20-pcduino3.dts \
sun8i-a83t-bananapi-m3.dts \
___
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: r328914 - in head/sys: kern ufs/ffs

2018-02-06 Thread Warner Losh
On Tue, Feb 6, 2018 at 1:09 AM, Conrad Meyer  wrote:

> Hi Kirk,
>
> On Mon, Feb 5, 2018 at 4:19 PM, Kirk McKusick 
> wrote:
> > Author: mckusick
> > Date: Tue Feb  6 00:19:46 2018
> > New Revision: 328914
> > URL: https://svnweb.freebsd.org/changeset/base/328914
> >
> > Log:
> > ...
> >   The second problem was that the check hash computed at the end of the
> >   read was incorrect because the calculation of the check hash on
> >   completion of the read was being done too soon.
> >
> >   - When a read completes we had the following sequence:
> >
> > - bufdone()
> > -- b_ckhashcalc (calculates check hash)
> > -- bufdone_finish()
> > --- vfs_vmio_iodone() (replaces bogus pages with the cached ones)
> >
> >   - When we are reading a buffer where one or more pages are already
> > in memory (but not all pages, or we wouldn't be doing the read),
> > the I/O is done with bogus_page mapped in for the pages that exist
> > in the VM cache. This mapping is done to avoid corrupting the
> > cached pages if there is any I/O overrun. The vfs_vmio_iodone()
> > function is responsible for replacing the bogus_page(s) with the
> > cached ones. But we were calculating the check hash before the
> > bogus_page(s) were replaced. Hence, when we were calculating the
> > check hash, we were partly reading from bogus_page, which means
> > we calculated a bad check hash (e.g., because multiple pages have
> > been mapped to bogus_page, so its contents are indeterminate).
> >
> >   The second fix is to move the check-hash calculation from bufdone()
> >   to bufdone_finish() after the call to vfs_vmio_iodone() so that it
> >   computes the check hash over the correct set of pages.
>
> Does the b_iodone callback have a very similar potential problem?  It
> is invoked in bufdone(), before bufdone_finish() and
> vfs_vmio_iodone().
>
> One example b_iodone is the bdone() callback.  It seems that b_iodone
> -> bdone() can then wake bwait()ers before any VMIO cached content has
> been filled in.
>
> I don't know that any specific consumers of b_iodone are currently
> broken, but it seems like maybe the b_iodone callback should really be
> in the later location as well.
>

It looks to me like this part of bufdone_finish()

if (bp->b_flags & B_VMIO) {
/*
 * Set B_CACHE if the op was a normal read and no error
 * occurred.  B_CACHE is set for writes in the b*write()
 * routines.
 */
if (bp->b_iocmd == BIO_READ &&
!(bp->b_flags & (B_INVAL|B_NOCACHE)) &&
!(bp->b_ioflags & BIO_ERROR))
bp->b_flags |= B_CACHE;
vfs_vmio_iodone(bp);
}

belongs before the callback to b_iodone() rather than in bufdone_finish().
It appears that bufdone_finish() isn't called elsewhere, despite being
non-static.

I'm curious why this is...

Warner
___
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: r328931 - head/share/man/man8

2018-02-06 Thread Dmitry Marakasov
Author: amdmi3 (ports committer)
Date: Tue Feb  6 15:30:17 2018
New Revision: 328931
URL: https://svnweb.freebsd.org/changeset/base/328931

Log:
  - Document new ${name}_limits rc.conf option
  
  Approved by:  cy
  MFC after:2 weeks (along with 328331 which introduced this option)
  Differential Revision:https://reviews.freebsd.org/D14028

Modified:
  head/share/man/man8/rc.subr.8

Modified: head/share/man/man8/rc.subr.8
==
--- head/share/man/man8/rc.subr.8   Tue Feb  6 14:57:03 2018
(r328930)
+++ head/share/man/man8/rc.subr.8   Tue Feb  6 15:30:17 2018
(r328931)
@@ -551,7 +551,7 @@ is mounted.
 A list of environment variables to run
 .Va command
 with.
-This will be passed as arguments to
+This will be passed as arguments to the
 .Xr env 1
 utility.
 .It Va ${name}_fib
@@ -583,6 +583,13 @@ as.
 Only supported after
 .Pa /usr
 is mounted.
+.It Va ${name}_limits
+.Xr limits 1
+to apply to
+.Va command .
+This will be passed as arguments to the
+.Xr limits 1
+utility.
 .It Va ${name}_oomprotect
 .Xr protect 1
 .Va command
___
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: r328933 - head/usr.bin/find

2018-02-06 Thread Alex Richardson
Author: arichardson
Date: Tue Feb  6 15:41:26 2018
New Revision: 328933
URL: https://svnweb.freebsd.org/changeset/base/328933

Log:
  Allow compiling usr.bin/find on Linux and Mac
  
  When building FreeBSD the makefiles invoke find with various flags such as
  `-s` that aren't supported in the native /usr/bin/find. To fix this I
  build the FreeBSD version of find and use that when crossbuilding.
  
  Inserting lots if #ifdefs in the code is rather ugly but I don't see a
  better solution.
  
  Reviewed By:  brooks (mentor)
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D13306

Modified:
  head/usr.bin/find/Makefile
  head/usr.bin/find/find.h
  head/usr.bin/find/function.c
  head/usr.bin/find/ls.c
  head/usr.bin/find/operator.c
  head/usr.bin/find/option.c

Modified: head/usr.bin/find/Makefile
==
--- head/usr.bin/find/Makefile  Tue Feb  6 15:41:15 2018(r328932)
+++ head/usr.bin/find/Makefile  Tue Feb  6 15:41:26 2018(r328933)
@@ -7,6 +7,7 @@ PROG=   find
 SRCS=  find.c function.c ls.c main.c misc.c operator.c option.c \
getdate.y
 YFLAGS=
+CFLAGS.clang+= -Werror=undef
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 

Modified: head/usr.bin/find/find.h
==
--- head/usr.bin/find/find.hTue Feb  6 15:41:15 2018(r328932)
+++ head/usr.bin/find/find.hTue Feb  6 15:41:26 2018(r328933)
@@ -36,7 +36,32 @@
  */
 
 #include 
+#include 
+#include 
 
+/*
+ * We need to build find during the bootstrap stage when building on a
+ * non-FreeBSD system. Linux does not have the st_flags and st_birthtime
+ * members in struct stat so we need to omit support for tests that depend
+ * on these members. This works fine since none of these flags are used
+ * during the build of world and kernel.
+ */
+#ifdef UF_SETTABLE
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+#else
+#define HAVE_STRUCT_STAT_ST_FLAGS 0
+#endif
+#if defined(st_birthtime) || defined(st_birthtimespec)
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1
+#else
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 0
+#endif
+#if defined(MFSNAMELEN) || defined(MFSTYPENAMELEN)
+#define HAVE_STRUCT_STATFS_F_FSTYPENAME 1
+#else
+#define HAVE_STRUCT_STATFS_F_FSTYPENAME 0
+#endif
+
 /* forward declarations */
 struct _plandata;
 struct _option;
@@ -70,8 +95,10 @@ typedef  struct _plandata *creat_f(struct _option *, ch
 #defineF_IGNCASE   0x0001  /* iname ipath iregex */
 #defineF_EXACTTIME F_IGNCASE   /* -[acm]time units syntax */
 #define F_EXECPLUS 0x0002  /* -exec ... {} + */
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
 #defineF_TIME_B0x0004  /* one of -Btime, -Bnewer, 
-newerB* */
 #defineF_TIME2_B   0x0008  /* one of -newer?B */
+#endif
 #define F_LINK 0x0010  /* lname or ilname */
 
 /* node definition */

Modified: head/usr.bin/find/function.c
==
--- head/usr.bin/find/function.cTue Feb  6 15:41:15 2018
(r328932)
+++ head/usr.bin/find/function.cTue Feb  6 15:41:26 2018
(r328933)
@@ -261,9 +261,11 @@ f_Xmin(PLAN *plan, FTSENT *entry)
} else if (plan->flags & F_TIME_A) {
COMPARE((now - entry->fts_statp->st_atime +
60 - 1) / 60, plan->t_data.tv_sec);
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
} else if (plan->flags & F_TIME_B) {
COMPARE((now - entry->fts_statp->st_birthtime +
60 - 1) / 60, plan->t_data.tv_sec);
+#endif
} else {
COMPARE((now - entry->fts_statp->st_mtime +
60 - 1) / 60, plan->t_data.tv_sec);
@@ -304,8 +306,10 @@ f_Xtime(PLAN *plan, FTSENT *entry)
 
if (plan->flags & F_TIME_A)
xtime = entry->fts_statp->st_atime;
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
else if (plan->flags & F_TIME_B)
xtime = entry->fts_statp->st_birthtime;
+#endif
else if (plan->flags & F_TIME_C)
xtime = entry->fts_statp->st_ctime;
else
@@ -362,6 +366,7 @@ c_mXXdepth(OPTION *option, char ***argvp)
return new;
 }
 
+#ifdef ACL_TYPE_NFS4
 /*
  * -acl function --
  *
@@ -412,6 +417,7 @@ f_acl(PLAN *plan __unused, FTSENT *entry)
return (0);
return (1);
 }
+#endif
 
 PLAN *
 c_acl(OPTION *option, char ***argvp __unused)
@@ -448,12 +454,14 @@ f_delete(PLAN *plan __unused, FTSENT *entry)
errx(1, "-delete: %s: relative path potentially not safe",
entry->fts_accpath);
 
+#if HAVE_STRUCT_STAT_ST_FLAGS
/* Turn off user immutable bits if running as root */
if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
!(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
geteuid() == 0)
 

svn commit: r328932 - head/sys/mips/mips

2018-02-06 Thread Alex Richardson
Author: arichardson
Date: Tue Feb  6 15:41:15 2018
New Revision: 328932
URL: https://svnweb.freebsd.org/changeset/base/328932

Log:
  Make mips_postboot_fixup work when building the kernel with clang+lld
  
  The compiler/linker can align fake_preload anyway it would like. When
  building the kernel with gcc+bfd this always happened to be a multiple of 8.
  When I built the kernel with clang and linked with lld fake_preload
  happened to only be aligned to 4 bytes which caused a an ADDRS trap because
  the compiler will emit sd instructions to store to this buffer.
  
  Reviewed By:  jhb, imp
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D14018

Modified:
  head/sys/mips/mips/machdep.c

Modified: head/sys/mips/mips/machdep.c
==
--- head/sys/mips/mips/machdep.cTue Feb  6 15:30:17 2018
(r328931)
+++ head/sys/mips/mips/machdep.cTue Feb  6 15:41:15 2018
(r328932)
@@ -383,7 +383,11 @@ mips_vector_init(void)
 void
 mips_postboot_fixup(void)
 {
-   static char fake_preload[256];
+   /*
+* We store u_long sized objects into the reload area, so the array
+* must be so aligned. The standard allows any alignment for char data.
+*/
+   static char fake_preload[256] _Alignas(_Alignof(u_long));
caddr_t preload_ptr = (caddr_t)&fake_preload[0];
size_t size = 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: r328934 - in head: . bin/sh

2018-02-06 Thread Alex Richardson
Author: arichardson
Date: Tue Feb  6 15:41:35 2018
New Revision: 328934
URL: https://svnweb.freebsd.org/changeset/base/328934

Log:
  Don't hardcode /usr/bin as the path for mktemp in build tools
  
  It won't work e.g. when crossbuilding from Ubuntu Linux as mktemp is in
  /bin there.
  
  Reviewed By:  bdrewery
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D13937

Modified:
  head/Makefile.inc1
  head/bin/sh/mkbuiltins
  head/bin/sh/mktokens

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Feb  6 15:41:26 2018(r328933)
+++ head/Makefile.inc1  Tue Feb  6 15:41:35 2018(r328934)
@@ -463,7 +463,7 @@ TMPPATH=${STRICTTMPPATH}:${PATH}
 # when in the middle of installing over this system.
 #
 .if make(distributeworld) || make(installworld) || make(stageworld)
-INSTALLTMP!=   /usr/bin/mktemp -d -u -t install
+INSTALLTMP!=   mktemp -d -u -t install
 .endif
 
 .if make(stagekernel) || make(distributekernel)

Modified: head/bin/sh/mkbuiltins
==
--- head/bin/sh/mkbuiltins  Tue Feb  6 15:41:26 2018(r328933)
+++ head/bin/sh/mkbuiltins  Tue Feb  6 15:41:35 2018(r328934)
@@ -34,7 +34,7 @@
 #  @(#)mkbuiltins  8.2 (Berkeley) 5/4/95
 # $FreeBSD$
 
-temp=`/usr/bin/mktemp -t ka`
+temp=`mktemp -t ka`
 havehist=1
 if [ "X$1" = "X-h" ]; then
havehist=0

Modified: head/bin/sh/mktokens
==
--- head/bin/sh/mktokensTue Feb  6 15:41:26 2018(r328933)
+++ head/bin/sh/mktokensTue Feb  6 15:41:35 2018(r328934)
@@ -38,7 +38,7 @@
 # token marks the end of a list.  The third column is the name to print in
 # error messages.
 
-temp=`/usr/bin/mktemp -t ka`
+temp=`mktemp -t ka`
 cat > $temp <<\!
 TEOF   1   end of file
 TNL0   newline
___
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: r328935 - head

2018-02-06 Thread Alex Richardson
Author: arichardson
Date: Tue Feb  6 15:41:45 2018
New Revision: 328935
URL: https://svnweb.freebsd.org/changeset/base/328935

Log:
  crossbuild: Make the CHECK_TIME variable work on Linux
  
  Linux /usr/bin/find doesn't understand the -mtime -0s flag.
  Instead create a temporary file and compare that file's mtime to
  sys/sys/param.h to check whether the clock is correct.
  
  Reviewed By:  jhb, imp
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D14157

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Tue Feb  6 15:41:35 2018(r328934)
+++ head/Makefile   Tue Feb  6 15:41:45 2018(r328935)
@@ -352,7 +352,7 @@ _guard: .PHONY
@false
 
 STARTTIME!= LC_ALL=C date
-CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
+CHECK_TIME!= cmp=`mktemp`; find ${.CURDIR}/sys/sys/param.h -newer "$$cmp" && 
rm "$$cmp"; echo
 .if !empty(CHECK_TIME)
 .error check your date/time: ${STARTTIME}
 .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: r328936 - in head/sys/dev: mpr mps

2018-02-06 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb  6 15:58:22 2018
New Revision: 328936
URL: https://svnweb.freebsd.org/changeset/base/328936

Log:
  Diagnostic buffer fixes for the mps(4) and mpr(4) drivers.
  
  In mp{r,s}_diag_register(), which is used to register diagnostic
  buffers with the mp{r,s}(4) firmware, we allocate DMAable memory.
  
  There were several issues here:
   o No checking of the bus_dmamap_load() return value.  If the load
 failed or got deferred, mp{r,s}_diag_register() continued on as if
 nothing had happened.  We now check the return value and bail
 out if it fails.
  
   o No waiting for a deferred load callback.  bus_dmamap_load()
 calls a supplied callback when the mapping is done.  This is
 generally done immediately, but it can be deferred.
 mp{r,s}_diag_register() did not check to see whether the callback
 was already done before proceeding on.  We now sleep until the
 callback is done if it is deferred.
  
   o No call to bus_dmamap_sync(... BUS_DMASYNC_PREREAD) after the
 memory is allocated and loaded.  This is necessary on some
 platforms to synchronize host memory that is going to be updated
 by a device.
  
  Both drivers would also panic if the firmware was reinitialized while
  a diagnostic buffer operation was in progress.  This fixes that problem
  as well.  (The driver will reinitialize the firmware in various
  circumstances, but the problem I ran into was that the firmware would
  generate an IOC Fault due to a PCIe error.)
  
  mp{r,s}var.h:
Add a new structure, struct mpr_busdma_context, that is
used for deferred busdma load callbacks.
  
Add a prototype for mp{r,s}_memaddr_wait_cb().
  mp{r,s}.c:
Add a new busdma callback function, mp{r,s}_memaddr_wait_cb().
This provides synchronization for callers that want to
wait on a deferred bus_dmamap_load() callback.
  
  mp{r,s}_user.c:
In bus_dmamap_register(), add a call to bus_dmamap_sync()
with the BUS_DMASYNC_PREREAD flag set after an allocation
is loaded.
  
Also, check the return value of bus_dmamap_load().  If it
fails, bail out.  If it is EINPROGRESS, wait for the
callback to happen.  We use an interruptible sleep (msleep
with PCATCH) and let the callback clean things up if we get
interrupted.
  
In mpr_diag_read_buffer() and mps_diag_read_buffer(), call
bus_dmamap_sync(..., BUS_DMASYNC_POSTREAD) before copying
the data out to make sure the data is in stable storage.
  
In mp{r,s}_post_fw_diag_buffer() and
mp{r,s}_release_fw_diag_buffer(), check the reply to see
whether it is NULL.  It can be NULL (and the command non-NULL)
if the controller gets reinitialized while we're waiting for
the command to complete but the driver structures aren't
reallocated.  The driver structures generally won't be
reallocated unless there is a firmware upgrade that changes
one of the IOCFacts.
  
When freeing diagnostic buffers in mp{r,s}_diag_register()
and mp{r,s}_diag_unregister(), zero/NULL out the buffer after
freeing it.  This will prevent a duplicate free in some
situations.
  
  Sponsored by: Spectra Logic
  Reviewed by:  mav, scottl
  MFC after:1 week
  Differential Revision:D13453

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_user.c
  head/sys/dev/mpr/mprvar.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_user.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mpr/mpr.c
==
--- head/sys/dev/mpr/mpr.c  Tue Feb  6 15:41:45 2018(r328935)
+++ head/sys/dev/mpr/mpr.c  Tue Feb  6 15:58:22 2018(r328936)
@@ -1183,6 +1183,42 @@ mpr_memaddr_cb(void *arg, bus_dma_segment_t *segs, int
*addr = segs[0].ds_addr;
 }
 
+void
+mpr_memaddr_wait_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
+{
+   struct mpr_busdma_context *ctx;
+   int need_unload, need_free;
+
+   ctx = (struct mpr_busdma_context *)arg;
+   need_unload = 0;
+   need_free = 0;
+
+   mpr_lock(ctx->softc);
+   ctx->error = error;
+   ctx->completed = 1;
+   if ((error == 0) && (ctx->abandoned == 0)) {
+   *ctx->addr = segs[0].ds_addr;
+   } else {
+   if (nsegs != 0)
+   need_unload = 1;
+   if (ctx->abandoned != 0)
+   need_free = 1;
+   }
+   if (need_free == 0)
+   wakeup(ctx);
+
+   mpr_unlock(ctx->softc);
+
+   if (need_unload != 0) {
+   bus_dmamap_unload(ctx->buffer_dmat,
+ ctx->buffer_dmamap);
+   *ctx->addr = 0;
+   }
+
+   if (need_free != 0)
+   free(ctx, M_MPR);
+}
+
 static int
 mpr_alloc_queues(struct mpr_softc *sc)
 {

Modified: head/sys/dev/mp

svn commit: r328937 - in head/sys/dev: mpr mps

2018-02-06 Thread Alexander Motin
Author: mav
Date: Tue Feb  6 16:02:25 2018
New Revision: 328937
URL: https://svnweb.freebsd.org/changeset/base/328937

Log:
  Fix queue length reporting in mps(4) and mpr(4).
  
  Both drivers were found to report CAM bigger queue depth then they really
  can handle.  It made them later under high load with many disks return
  some of submitted requests back with CAM_REQUEUE_REQ status for later
  resubmission.
  
  Reviewed by:  scottl
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D14215

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mprvar.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mpr/mpr.c
==
--- head/sys/dev/mpr/mpr.c  Tue Feb  6 15:58:22 2018(r328936)
+++ head/sys/dev/mpr/mpr.c  Tue Feb  6 16:02:25 2018(r328937)
@@ -397,6 +397,7 @@ mpr_resize_queues(struct mpr_softc *sc)
reqcr = MIN(reqcr, sc->facts->RequestCredit);
 
sc->num_reqs = prireqcr + reqcr;
+   sc->num_prireqs = prireqcr;
sc->num_replies = MIN(sc->max_replyframes + sc->max_evtframes,
sc->facts->MaxReplyDescriptorPostQueueDepth) - 1;
 
@@ -1507,7 +1508,7 @@ mpr_alloc_requests(struct mpr_softc *sc)
/* XXX Is a failure here a critical problem? */
if (bus_dmamap_create(sc->buffer_dmat, 0, &cm->cm_dmamap)
== 0) {
-   if (i <= sc->facts->HighPriorityCredit)
+   if (i <= sc->num_prireqs)
mpr_free_high_priority_command(sc, cm);
else
mpr_free_command(sc, cm);

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Tue Feb  6 15:58:22 2018(r328936)
+++ head/sys/dev/mpr/mpr_sas.c  Tue Feb  6 16:02:25 2018(r328937)
@@ -728,7 +728,7 @@ mpr_attach_sas(struct mpr_softc *sc)
 {
struct mprsas_softc *sassc;
cam_status status;
-   int unit, error = 0;
+   int unit, error = 0, reqs;
 
MPR_FUNCTRACE(sc);
mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__);
@@ -758,7 +758,8 @@ mpr_attach_sas(struct mpr_softc *sc)
sc->sassc = sassc;
sassc->sc = sc;
 
-   if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) {
+   reqs = sc->num_reqs - sc->num_prireqs - 1;
+   if ((sassc->devq = cam_simq_alloc(reqs)) == NULL) {
mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIMQ\n");
error = ENOMEM;
goto out;
@@ -766,7 +767,7 @@ mpr_attach_sas(struct mpr_softc *sc)
 
unit = device_get_unit(sc->mpr_dev);
sassc->sim = cam_sim_alloc(mprsas_action, mprsas_poll, "mpr", sassc,
-   unit, &sc->mpr_mtx, sc->num_reqs, sc->num_reqs, sassc->devq);
+   unit, &sc->mpr_mtx, reqs, reqs, sassc->devq);
if (sassc->sim == NULL) {
mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIM\n");
error = EINVAL;

Modified: head/sys/dev/mpr/mprvar.h
==
--- head/sys/dev/mpr/mprvar.h   Tue Feb  6 15:58:22 2018(r328936)
+++ head/sys/dev/mpr/mprvar.h   Tue Feb  6 16:02:25 2018(r328937)
@@ -357,6 +357,7 @@ struct mpr_softc {
 
MPI2_IOC_FACTS_REPLY*facts;
int num_reqs;
+   int num_prireqs;
int num_replies;
int fqdepth;/* Free queue */
int pqdepth;/* Post queue */

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Tue Feb  6 15:58:22 2018(r328936)
+++ head/sys/dev/mps/mps.c  Tue Feb  6 16:02:25 2018(r328937)
@@ -394,6 +394,7 @@ mps_resize_queues(struct mps_softc *sc)
reqcr = MIN(reqcr, sc->facts->RequestCredit);
 
sc->num_reqs = prireqcr + reqcr;
+   sc->num_prireqs = prireqcr;
sc->num_replies = MIN(sc->max_replyframes + sc->max_evtframes,
sc->facts->MaxReplyDescriptorPostQueueDepth) - 1;
 
@@ -1453,7 +1454,7 @@ mps_alloc_requests(struct mps_softc *sc)
 
/* XXX Is a failure here a critical problem? */
if (bus_dmamap_create(sc->buffer_dmat, 0, &cm->cm_dmamap) == 0)
-   if (i <= sc->facts->HighPriorityCredit)
+   if (i <= sc->num_prireqs)
mps_free_high_priority_command(sc, cm);
else
mps_free_command(sc, cm);

Modified: head/sys/de

svn commit: r328938 - head/sys/geom/mirror

2018-02-06 Thread Mark Johnston
Author: markj
Date: Tue Feb  6 16:02:33 2018
New Revision: 328938
URL: https://svnweb.freebsd.org/changeset/base/328938

Log:
  Simplify synchronization read error handling.
  
  Since synchronization reads are performed by submitting a request to
  the external mirror provider, we know that the request returns with an
  error only when gmirror was unable to read a copy of the block from any
  mirror. Thus, there is no need to retry the request from the
  synchronization error handler.
  
  Tested by:pho
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Tue Feb  6 16:02:25 2018
(r328937)
+++ head/sys/geom/mirror/g_mirror.c Tue Feb  6 16:02:33 2018
(r328938)
@@ -1336,9 +1336,7 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc
 */
switch (bp->bio_cmd) {
case BIO_READ: {
-   struct g_mirror_disk *d;
struct g_consumer *cp;
-   int readable;
 
KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read,
bp->bio_error);
@@ -1349,31 +1347,17 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc
bp->bio_error);
 
/*
-* If there's at least one other disk from which we can
-* read the block, retry the request.
-*/
-   readable = 0;
-   LIST_FOREACH(d, &sc->sc_disks, d_next)
-   if (d->d_state == G_MIRROR_DISK_STATE_ACTIVE &&
-   !(d->d_flags & G_MIRROR_DISK_FLAG_BROKEN))
-   readable++;
-
-   /*
 * The read error will trigger a syncid bump, so there's
 * no need to do that here.
 *
-* If we can retry the read from another disk, do so.
-* Otherwise, all we can do is kick out the new disk.
+* The read error handling for regular requests will
+* retry the read from all active mirrors before passing
+* the error back up, so there's no need to retry here.
 */
-   if (readable == 0) {
-   g_mirror_sync_request_free(disk, bp);
-   g_mirror_event_send(disk,
-   G_MIRROR_DISK_STATE_DISCONNECTED,
-   G_MIRROR_EVENT_DONTWAIT);
-   } else {
-   g_mirror_sync_reinit(disk, bp, bp->bio_offset);
-   goto retry_read;
-   }
+   g_mirror_sync_request_free(disk, bp);
+   g_mirror_event_send(disk,
+   G_MIRROR_DISK_STATE_DISCONNECTED,
+   G_MIRROR_EVENT_DONTWAIT);
return;
}
G_MIRROR_LOGREQ(3, bp,
@@ -1429,7 +1413,6 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc
g_mirror_sync_reinit(disk, bp, sync->ds_offset);
sync->ds_offset += bp->bio_length;
 
-retry_read:
G_MIRROR_LOGREQ(3, bp, "Sending synchronization request.");
sync->ds_consumer->index++;
 
___
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: r328933 - head/usr.bin/find

2018-02-06 Thread Eric van Gyzen
On 02/06/2018 09:41, Alex Richardson wrote:
> +#if HAVE_STRUCT_STAT_ST_BIRTHTIME
>   else if (plan->flags & F_TIME_A)
>   ft = entry->fts_statp->st_atim;
>   else if (plan->flags & F_TIME_B)
>   ft = entry->fts_statp->st_birthtim;
> +#endif

Did you intend to put st_atim inside the #if?

Eric
___
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: r328939 - head/contrib/gcc/config/mips

2018-02-06 Thread John Baldwin
Author: jhb
Date: Tue Feb  6 17:01:10 2018
New Revision: 328939
URL: https://svnweb.freebsd.org/changeset/base/328939

Log:
  Use a workaround to compile the crt init functions correctly with clang.
  
  The MIPS assembly parser treats forward-declared local symbols as global
  symbols.  This results in CALL16 relocations being used against local
  (private) symbols which then fail to resolve when linking binaries.
  Add .local to force the init and fini functions to be treated as local as
  a workaround.
  
  Submitted by: sbruno
  Sponsored by: DARPA / AFRL

Modified:
  head/contrib/gcc/config/mips/mips.h

Modified: head/contrib/gcc/config/mips/mips.h
==
--- head/contrib/gcc/config/mips/mips.h Tue Feb  6 16:02:33 2018
(r328938)
+++ head/contrib/gcc/config/mips/mips.h Tue Feb  6 17:01:10 2018
(r328939)
@@ -2721,6 +2721,7 @@ while (0)
nop\n\
 1: .cpload $31\n\
.set reorder\n\
+   .local " USER_LABEL_PREFIX #FUNC "\n\
jal " USER_LABEL_PREFIX #FUNC "\n\
" TEXT_SECTION_ASM_OP);
 #endif /* Switch to #elif when we're no longer limited by K&R C.  */
@@ -2733,6 +2734,7 @@ while (0)
nop\n\
 1: .set reorder\n\
.cpsetup $31, $2, 1b\n\
+   .local " USER_LABEL_PREFIX #FUNC "\n\
jal " USER_LABEL_PREFIX #FUNC "\n\
" TEXT_SECTION_ASM_OP);
 #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: r328940 - head/sys/vm

2018-02-06 Thread Mark Johnston
Author: markj
Date: Tue Feb  6 17:26:11 2018
New Revision: 328940
URL: https://svnweb.freebsd.org/changeset/base/328940

Log:
  Delete a declaration for a variable removed in r305362.

Modified:
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Tue Feb  6 17:01:10 2018(r328939)
+++ head/sys/vm/vm_page.h   Tue Feb  6 17:26:11 2018(r328940)
@@ -379,8 +379,6 @@ extern struct mtx_padalign pa_lock[];
  *
  */
 
-extern int vm_page_zero_count;
-
 extern vm_page_t vm_page_array;/* First resident page in table 
*/
 extern long vm_page_array_size;/* number of vm_page_t's */
 extern long first_page;/* first physical page number */
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Gleb Smirnoff
On Tue, Feb 06, 2018 at 10:54:05AM +, Andrew Turner wrote:
A> > Author: glebius
A> > Date: Tue Feb  6 04:16:00 2018
A> > New Revision: 328916
A> > URL: https://svnweb.freebsd.org/changeset/base/328916
A> > 
A> > Log:
A> >  Followup on r302393 by cperciva, improving calculation of boot pages 
required
A> >  for UMA startup.
A> > 
A> >  o Introduce another stage of UMA startup, which is entered after
A> >vm_page_startup() finishes. After this stage we don't yet enable 
buckets,
A> >but we can ask VM for pages. Rename stages to meaningful names while 
here.
A> >New list of stages: BOOT_COLD, BOOT_STRAPPED, BOOT_PAGEALLOC, 
BOOT_BUCKETS,
A> >BOOT_RUNNING.
A> >Enabling page alloc earlier allows us to dramatically reduce number of
A> >boot pages required. What is more important number of zones becomes
A> >consistent across different machines, as no MD allocations are done 
before
A> >the BOOT_PAGEALLOC stage. Now only UMA internal zones actually need to 
use
A> >startup_alloc(), however that may change, so vm_page_startup() provides
A> >its need for early zones as argument.
A> >  o Introduce uma_startup_count() function, to avoid code duplication. The
A> >functions calculates sizes of zones zone and kegs zone, and calculates 
how
A> >many pages UMA will need to bootstrap.
A> >It counts not only of zone structures, but also of kegs, slabs and 
hashes.
A> >  o Hide uma_startup_foo() declarations from public file.
A> >  o Provide several DIAGNOSTIC printfs on boot_pages usage.
A> >  o Bugfix: when calculating zone of zones size use (mp_maxid + 1) instead 
of
A> >mp_ncpus. Use resulting number not only in the size argument to 
zone_ctor()
A> >but also as args.size.
A> 
A> With this I’m getting "panic: UMA: Increase vm.boot_pages” on an arm64 
simulator with 4GB of memory. I can increase vm.boot_pages manually, however 
this isn’t useful in the long term.

Sorry for problems.

Can you please put DIAGNOSTIC into beginning of uma_core.c, and boot with
vm.boot_pages bumped, and provide the dmesg to me?

-- 
Gleb Smirnoff
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Gleb Smirnoff
  Peter,

On Tue, Feb 06, 2018 at 12:30:17PM +0100, Peter Holm wrote:
P> i386 also doesn't boot:
P> 
P> FreeBSD 12.0-CURRENT #1 r328924: Tue Feb  6 11:51:17 CET 2018
P> p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
P> FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 
6.0.0)
P> WARNING: WITNESS option enabled, expect reduced performance.
P> WARNING: DIAGNOSTIC option enabled, expect reduced performance.
P> Entering uma_startup with 4 boot pages configured
P> startup_alloc from "UMA Kegs", 3 boot pages left
P> startup_alloc from "UMA Zones", 2 boot pages left
P> startup_alloc from "UMA Hash", 1 boot pages left
P> Entering uma_startup1 with 0 boot pages left
P> kernel trap 12 with interrupts disabled

Sorry for problems, I'm working on this.

How do you think, is it a good idea to quickly add a one line change
to subversion that would bump boot_pages value to arbitrary +100,
to fixup the head while I'm working on a proper fix?

-- 
Gleb Smirnoff
___
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: r328945 - head/sys/sys

2018-02-06 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Feb  6 19:14:15 2018
New Revision: 328945
URL: https://svnweb.freebsd.org/changeset/base/328945

Log:
  Remove a trailing whitspace.

Modified:
  head/sys/sys/bus_dma.h

Modified: head/sys/sys/bus_dma.h
==
--- head/sys/sys/bus_dma.h  Tue Feb  6 19:13:44 2018(r328944)
+++ head/sys/sys/bus_dma.h  Tue Feb  6 19:14:15 2018(r328945)
@@ -178,7 +178,7 @@ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_
 
 /*
  * Set the memory domain to be used for allocations.
- * 
+ *
  * Automatic for PCI devices.  Must be set prior to creating maps or
  * allocating memory.
  */
___
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: r328934 - in head: . bin/sh

2018-02-06 Thread Rodney W. Grimes
> Author: arichardson
> Date: Tue Feb  6 15:41:35 2018
> New Revision: 328934
> URL: https://svnweb.freebsd.org/changeset/base/328934
> 
> Log:
>   Don't hardcode /usr/bin as the path for mktemp in build tools
>   
>   It won't work e.g. when crossbuilding from Ubuntu Linux as mktemp is in
>   /bin there.
>   
>   Reviewed By:bdrewery
>   Approved By:jhb (mentor)
>   Differential Revision: https://reviews.freebsd.org/D13937

Would it be better to create the variable MKTEMP to point at
either /bin/mktemp or /usr/bin/mktemp dependent on platform,
there are reasons we use full paths in Makefiles, mostly to
stop /usr/local/bin/foo contimaton, which I believe this
change now opens up, though very slight as I dont know of
a third party mktemp binary.


> Modified:
>   head/Makefile.inc1
>   head/bin/sh/mkbuiltins
>   head/bin/sh/mktokens
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Tue Feb  6 15:41:26 2018(r328933)
> +++ head/Makefile.inc1Tue Feb  6 15:41:35 2018(r328934)
> @@ -463,7 +463,7 @@ TMPPATH=  ${STRICTTMPPATH}:${PATH}
>  # when in the middle of installing over this system.
>  #
>  .if make(distributeworld) || make(installworld) || make(stageworld)
> -INSTALLTMP!= /usr/bin/mktemp -d -u -t install
> +INSTALLTMP!= mktemp -d -u -t install
>  .endif
>  
>  .if make(stagekernel) || make(distributekernel)
> 
> Modified: head/bin/sh/mkbuiltins
> ==
> --- head/bin/sh/mkbuiltinsTue Feb  6 15:41:26 2018(r328933)
> +++ head/bin/sh/mkbuiltinsTue Feb  6 15:41:35 2018(r328934)
> @@ -34,7 +34,7 @@
>  #@(#)mkbuiltins  8.2 (Berkeley) 5/4/95
>  # $FreeBSD$
>  
> -temp=`/usr/bin/mktemp -t ka`
> +temp=`mktemp -t ka`
>  havehist=1
>  if [ "X$1" = "X-h" ]; then
>   havehist=0
> 
> Modified: head/bin/sh/mktokens
> ==
> --- head/bin/sh/mktokens  Tue Feb  6 15:41:26 2018(r328933)
> +++ head/bin/sh/mktokens  Tue Feb  6 15:41:35 2018(r328934)
> @@ -38,7 +38,7 @@
>  # token marks the end of a list.  The third column is the name to print in
>  # error messages.
>  
> -temp=`/usr/bin/mktemp -t ka`
> +temp=`mktemp -t ka`
>  cat > $temp <<\!
>  TEOF 1   end of file
>  TNL  0   newline
> 
> 

-- 
Rod Grimes rgri...@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: r328916 - in head/sys: kern vm

2018-02-06 Thread Peter Holm
On Tue, Feb 06, 2018 at 10:28:39AM -0800, Gleb Smirnoff wrote:
>   Peter,
> 
> On Tue, Feb 06, 2018 at 12:30:17PM +0100, Peter Holm wrote:
> P> i386 also doesn't boot:
> P> 
> P> FreeBSD 12.0-CURRENT #1 r328924: Tue Feb  6 11:51:17 CET 2018
> P> p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
> P> FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 
> 6.0.0)
> P> WARNING: WITNESS option enabled, expect reduced performance.
> P> WARNING: DIAGNOSTIC option enabled, expect reduced performance.
> P> Entering uma_startup with 4 boot pages configured
> P> startup_alloc from "UMA Kegs", 3 boot pages left
> P> startup_alloc from "UMA Zones", 2 boot pages left
> P> startup_alloc from "UMA Hash", 1 boot pages left
> P> Entering uma_startup1 with 0 boot pages left
> P> kernel trap 12 with interrupts disabled
> 
> Sorry for problems, I'm working on this.
> 
> How do you think, is it a good idea to quickly add a one line change
> to subversion that would bump boot_pages value to arbitrary +100,
> to fixup the head while I'm working on a proper fix?
> 

Oh, this is not a problem for me.
Increasing boot_pages does however not seem to change anything:

OK set vm.boot_pages=164
OK boot
/boot/kernel/kernel text=0x146eead data=0xf0da0+0x2aa460 
syms=[0x4+0xf0420+0x4+0x1865f5]
/boot/entropy size=0x1000
/boot/kernel/amdtemp.ko text=0x2154 data=0x164+0x4 syms=[0x4+0x600+0x4+0x6d9]
loading required module 'amdsmn'
/boot/kernel/amdsmn.ko text=0xe1c data=0x124+0x4 syms=[0x4+0x4a0+0x4+0x4fd]
Booting...
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2018 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #3 r328941: Tue Feb  6 20:20:12 CET 2018
p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 6.0.0)
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
Entering uma_startup with 164 boot pages configured
startup_alloc from "UMA Kegs", 163 boot pages left
startup_alloc from "UMA Zones", 162 boot pages left
startup_alloc from "UMA Hash", 161 boot pages left
Entering uma_startup1 with 160 boot pages left
kernel trap 12 with interrupts disabled


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x19c
fault code  = supervisor read, page not present
instruction pointer = 0x20:0xc0cdac38
stack pointer   = 0x28:0xc2022bd0
frame pointer   = 0x28:0xc2022c00
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, def32 1, gran 1
processor eflags= resume, IOPL = 0
current process = 0 ()
[ thread pid 0 tid 0 ]
Stopped at  vmem_alloc+0x88:cmpl%esi,0x19c(%edi)
db> bt
Tracing pid 0 tid 0 td 0xc1be3a40
vmem_alloc(0,1000,2102,c2022c1c,c169f490,...) at vmem_alloc+0x88/frame 
0xc2022c00
kmem_malloc_domain(0,1000,102) at kmem_malloc_domain+0x44/frame 0xc2022c2c
page_alloc(c2318000,1000,0,c2022c77,102,...) at page_alloc+0x26/frame 0xc2022c44
keg_alloc_slab(0,2,c169f490,d19,c2315b70,...) at keg_alloc_slab+0xf6/frame 
0xc2022c8c
uma_prealloc(c2318000,4,0,0,0,...) at uma_prealloc+0x95/frame 0xc2022cbc
vmem_startup(c2157000,c0cc523b,c12b048b,c2022d0c,c2022d0c,...) at 
vmem_startup+0xf5/frame 0xc2022ce4
vm_mem_init(0,0,0,0,c1869340,...) at vm_mem_init+0x24/frame 0xc2022d10
mi_startup() at mi_startup+0xf7/frame 0xc2022d38
begin() at begin+0x2f
db> 

- Peter
___
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: r328934 - in head: . bin/sh

2018-02-06 Thread Ian Lepore
On Tue, 2018-02-06 at 11:25 -0800, Rodney W. Grimes wrote:
> > 
> > Author: arichardson
> > Date: Tue Feb  6 15:41:35 2018
> > New Revision: 328934
> > URL: https://svnweb.freebsd.org/changeset/base/328934
> > 
> > Log:
> >   Don't hardcode /usr/bin as the path for mktemp in build tools
> >   
> >   It won't work e.g. when crossbuilding from Ubuntu Linux as mktemp
> > is in
> >   /bin there.
> >   
> >   Reviewed By:  bdrewery
> >   Approved By:  jhb (mentor)
> >   Differential Revision: https://reviews.freebsd.org/D13937
> Would it be better to create the variable MKTEMP to point at
> either /bin/mktemp or /usr/bin/mktemp dependent on platform,
> there are reasons we use full paths in Makefiles, mostly to
> stop /usr/local/bin/foo contimaton, which I believe this
> change now opens up, though very slight as I dont know of
> a third party mktemp binary.
> 

I don't understand this idea of /usr/local "polluting" a system.  It
seems to me exactly the opposite would be the case... if I have found
some 3rd party version of mktemp that I like better, it would be
installed in /usr/local.  If I went out of my way to install that, then
naturally I WANT it to be used.  To me, it's insane that the /usr/local
paths are not in front of the base system paths by default, and it's
even more insane that the base system works so hard to NOT use the
replacements I've installed (even if I've arranged PATH so that the
right versions should be used) so that I have to track down why it's
using the wrong thing and apply ad-hoc fixes.

-- Ian

___
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: r328949 - head/etc

2018-02-06 Thread Mark Felder
Author: feld (ports committer)
Date: Tue Feb  6 20:12:05 2018
New Revision: 328949
URL: https://svnweb.freebsd.org/changeset/base/328949

Log:
  Fix firstboot fs mount logic
  
  The firstboot logic has an error which causes the filesystem to be
  mounted readonly even though root_rw_mount=YES. This fixes the error to
  ensure that the root filesystem is mounted rw as expected after the run
  of the firstboot scripts.
  
  Reviewed by:  imp
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D14226

Modified:
  head/etc/rc

Modified: head/etc/rc
==
--- head/etc/rc Tue Feb  6 19:17:40 2018(r328948)
+++ head/etc/rc Tue Feb  6 20:12:05 2018(r328949)
@@ -141,10 +141,10 @@ if [ -e ${firstboot_sentinel} ]; then
if [ -e ${firstboot_sentinel}-reboot ]; then
chflags -R 0 ${firstboot_sentinel}-reboot
rm -rf ${firstboot_sentinel}-reboot
-   checkyesno root_rw_mount && mount -ur /
+   checkyesno root_rw_mount || mount -ur /
kill -INT 1
fi
-   checkyesno root_rw_mount && mount -ur /
+   checkyesno root_rw_mount || mount -ur /
 fi
 
 echo ''
___
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: r328950 - in head/sys/dev: mpr mps

2018-02-06 Thread Scott Long
Author: scottl
Date: Tue Feb  6 21:01:38 2018
New Revision: 328950
URL: https://svnweb.freebsd.org/changeset/base/328950

Log:
  Cache the value of the request and reply frame size since it's used quite
  a bit in the normal operation of the driver.  Covert it to represent bytes
  instead of 32bit words.  Fix what I believe to be is a bug in this respect
  with the Tri-mode cards.
  
  Sponsored by: Netflix

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_user.c
  head/sys/dev/mpr/mprvar.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mps_user.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mpr/mpr.c
==
--- head/sys/dev/mpr/mpr.c  Tue Feb  6 20:12:05 2018(r328949)
+++ head/sys/dev/mpr/mpr.c  Tue Feb  6 21:01:38 2018(r328950)
@@ -1133,6 +1133,14 @@ mpr_send_iocinit(struct mpr_softc *sc)
MPR_FUNCTRACE(sc);
mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__);
 
+   /* Do a quick sanity check on proper initialization */
+   if ((sc->pqdepth == 0) || (sc->fqdepth == 0) || (sc->reqframesz == 0)
+   || (sc->replyframesz == 0)) {
+   mpr_dprint(sc, MPR_INIT|MPR_ERROR,
+   "Driver not fully initialized for IOCInit\n");
+   return (EINVAL);
+   }
+
req_sz = sizeof(MPI2_IOC_INIT_REQUEST);
reply_sz = sizeof(MPI2_IOC_INIT_REPLY);
bzero(&init, req_sz);
@@ -1147,7 +1155,7 @@ mpr_send_iocinit(struct mpr_softc *sc)
init.WhoInit = MPI2_WHOINIT_HOST_DRIVER;
init.MsgVersion = htole16(MPI2_VERSION);
init.HeaderVersion = htole16(MPI2_HEADER_VERSION);
-   init.SystemRequestFrameSize = htole16(sc->facts->IOCRequestFrameSize);
+   init.SystemRequestFrameSize = htole16((uint16_t)(sc->reqframesz / 4));
init.ReplyDescriptorPostQueueDepth = htole16(sc->pqdepth);
init.ReplyFreeQueueDepth = htole16(sc->fqdepth);
init.SenseBufferAddressHigh = 0;
@@ -1303,6 +1311,9 @@ mpr_alloc_replies(struct mpr_softc *sc)
 {
int rsize, num_replies;
 
+   /* Store the reply frame size in bytes rather than as 32bit words */
+   sc->replyframesz = sc->facts->ReplyFrameSize * 4;
+
/*
 * sc->num_replies should be one less than sc->fqdepth.  We need to
 * allocate space for sc->fqdepth replies, but only sc->num_replies
@@ -1310,7 +1321,7 @@ mpr_alloc_replies(struct mpr_softc *sc)
 */
num_replies = max(sc->fqdepth, sc->num_replies);
 
-   rsize = sc->facts->ReplyFrameSize * num_replies * 4; 
+   rsize = sc->replyframesz * num_replies; 
 if (bus_dma_tag_create( sc->mpr_parent_dmat,/* parent */
4, 0,   /* algnmnt, boundary */
BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
@@ -1344,7 +1355,10 @@ mpr_alloc_requests(struct mpr_softc *sc)
struct mpr_chain *chain;
int i, rsize, nsegs;
 
-   rsize = sc->facts->IOCRequestFrameSize * sc->num_reqs * 4;
+   /* Store the request frame size in bytes rather than as 32bit words */
+   sc->reqframesz = sc->facts->IOCRequestFrameSize * 4;
+
+   rsize = sc->reqframesz * sc->num_reqs;
 if (bus_dma_tag_create( sc->mpr_parent_dmat,/* parent */
16, 0,  /* algnmnt, boundary */
BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
@@ -1387,7 +1401,7 @@ mpr_alloc_requests(struct mpr_softc *sc)
MPR_MAX_CHAIN_ELEMENT_SIZE;
}
} else {
-   sc->chain_frame_size = sc->facts->IOCRequestFrameSize * 4;
+   sc->chain_frame_size = sc->reqframesz;
}
rsize = sc->chain_frame_size * sc->max_chains;
 if (bus_dma_tag_create( sc->mpr_parent_dmat,/* parent */
@@ -1493,10 +1507,8 @@ mpr_alloc_requests(struct mpr_softc *sc)
}
for (i = 1; i < sc->num_reqs; i++) {
cm = &sc->commands[i];
-   cm->cm_req = sc->req_frames +
-   i * sc->facts->IOCRequestFrameSize * 4;
-   cm->cm_req_busaddr = sc->req_busaddr +
-   i * sc->facts->IOCRequestFrameSize * 4;
+   cm->cm_req = sc->req_frames + i * sc->reqframesz;
+   cm->cm_req_busaddr = sc->req_busaddr + i * sc->reqframesz;
cm->cm_sense = &sc->sense_frames[i];
cm->cm_sense_busaddr = sc->sense_busaddr + i * MPR_SENSE_LEN;
cm->cm_desc.Default.SMID = i;
@@ -1621,8 +1633,7 @@ mpr_init_queues(struct mpr_softc *sc)
 * Initialize all of the free queue entries.
 */
for (i = 0; i < sc->fqdepth; i++) {
-   sc->free_queue[i] = sc->reply_busaddr +
-   (i * sc->facts->ReplyFrameSize * 4);
+   sc->free_queue[i] = sc->reply_busaddr + (i * sc->replyframesz);
}
  

svn commit: r328951 - head/etc/rc.d

2018-02-06 Thread Mark Felder
Author: feld (ports committer)
Date: Tue Feb  6 21:35:41 2018
New Revision: 328951
URL: https://svnweb.freebsd.org/changeset/base/328951

Log:
  Refactor cleanvar to remove shell expansion vulnerability
  
  If any process creates a directory named "-P" in /var/run or
  /var/spool/lock it will cause the purgedir function to start to rm -r /.
  
  Simplify a lot of complicated shell logic by leveraging find(1).
  
  Reviewed by:  allanjude
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D13778

Modified:
  head/etc/rc.d/cleanvar

Modified: head/etc/rc.d/cleanvar
==
--- head/etc/rc.d/cleanvar  Tue Feb  6 21:01:38 2018(r328950)
+++ head/etc/rc.d/cleanvar  Tue Feb  6 21:35:41 2018(r328951)
@@ -19,34 +19,6 @@ stop_cmd=":"
 extra_commands="reload"
 reload_cmd="${name}_start"
 
-purgedir()
-{
-   local dir file
-
-   if [ $# -eq 0 ]; then
-   purgedir .
-   else
-   for dir
-   do
-   (
-   cd "$dir" && for file in .* *
-   do
-   # Skip over logging sockets
-   [ -S "$file" -a "$file" = "log" ] && continue
-   [ -S "$file" -a "$file" = "logpriv" ] && 
continue
-   [ ."$file" = .. -o ."$file" = ... ] && continue
-   if [ -d "$file" -a ! -L "$file" ]
-   then
-   purgedir "$file"
-   else
-   rm -f -- "$file"
-   fi
-   done
-   )
-   done
-   fi
-}
-
 cleanvar_prestart()
 {
# These files must be removed only the first time this script is run
@@ -58,14 +30,17 @@ cleanvar_prestart()
 cleanvar_start()
 {
if [ -d /var/run -a ! -f /var/run/clean_var ]; then
-   purgedir /var/run
+   # Skip over logging sockets
+   find /var/run \( -type f -or -type s ! -name log -and ! -name 
logpriv \) -delete
>/var/run/clean_var
fi
if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
-   purgedir /var/spool/lock
+   find /var/spool/lock -type f -delete
>/var/spool/lock/clean_var
fi
-   rm -rf /var/spool/uucp/.Temp/*
+   if [ -d /var/spool/uucp/.Temp ]; then
+   find /var/spool/uucp/.Temp -delete
+   fi
 }
 
 load_rc_config $name
___
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: r328952 - in head/sys: kern vm

2018-02-06 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb  6 22:06:59 2018
New Revision: 328952
URL: https://svnweb.freebsd.org/changeset/base/328952

Log:
  Fix boot_pages calculation for machines that don't have UMA_MD_SMALL_ALLOC.
  
  o Call uma_startup1() after initializing kmem, vmem and domains.
  o Include 8 eight VM startup pages into uma_startup_count() calculation.
  o Account for vmem_startup() and vm_map_startup() preallocating pages.
  o Account for extra two allocations done by kmem_init() and vmem_create().
  o Hardcode the place of execution of vm_radix_reserve_kva(). Using SYSINIT
allowed several other SYSINITs to sneak in before it, thus bumping
requirement for amount of boot pages.

Modified:
  head/sys/kern/subr_vmem.c
  head/sys/vm/vm_init.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_radix.c

Modified: head/sys/kern/subr_vmem.c
==
--- head/sys/kern/subr_vmem.c   Tue Feb  6 21:35:41 2018(r328951)
+++ head/sys/kern/subr_vmem.c   Tue Feb  6 22:06:59 2018(r328952)
@@ -72,7 +72,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
+intvmem_startup_count(void);
+
 #defineVMEM_OPTORDER   5
 #defineVMEM_OPTVALUE   (1 << VMEM_OPTORDER)
 #defineVMEM_MAXORDER   \
@@ -652,6 +655,16 @@ vmem_bt_alloc(uma_zone_t zone, vm_size_t bytes, int do
pause("btalloc", 1);
 
return (NULL);
+}
+
+/*
+ * How many pages do we need to startup_alloc.
+ */
+int
+vmem_startup_count(void)
+{
+
+   return (howmany(BT_MAXALLOC, UMA_SLAB_SIZE / sizeof(struct vmem_btag)));
 }
 #endif
 

Modified: head/sys/vm/vm_init.c
==
--- head/sys/vm/vm_init.c   Tue Feb  6 21:35:41 2018(r328951)
+++ head/sys/vm/vm_init.c   Tue Feb  6 22:06:59 2018(r328952)
@@ -93,6 +93,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+extern voiduma_startup1(void);
+extern voidvm_radix_reserve_kva(void);
 
 #if VM_NRESERVLEVEL > 0
 #defineKVA_QUANTUM (1 << (VM_LEVEL_0_ORDER + PAGE_SHIFT))
@@ -150,7 +152,11 @@ vm_mem_init(dummy)
 */
vm_set_page_size();
virtual_avail = vm_page_startup(virtual_avail);
-   
+
+#ifdef UMA_MD_SMALL_ALLOC
+   /* Announce page availability to UMA. */
+   uma_startup1();
+#endif
/*
 * Initialize other VM packages
 */
@@ -173,6 +179,12 @@ vm_mem_init(dummy)
KVA_QUANTUM);
}
 
+#ifndefUMA_MD_SMALL_ALLOC
+   /* Set up radix zone to use noobj_alloc. */
+   vm_radix_reserve_kva();
+   /* Announce page availability to UMA. */
+   uma_startup1();
+#endif
kmem_init_zero_region();
pmap_init();
vm_pager_init();

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Tue Feb  6 21:35:41 2018(r328951)
+++ head/sys/vm/vm_page.c   Tue Feb  6 22:06:59 2018(r328952)
@@ -112,6 +112,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -127,7 +128,7 @@ __FBSDID("$FreeBSD$");
 
 extern int uma_startup_count(int);
 extern voiduma_startup(void *, int);
-extern voiduma_startup1(void);
+extern int vmem_startup_count(void);
 
 /*
  * Associated with page of user-allocatable memory is a
@@ -501,12 +502,33 @@ vm_page_startup(vm_offset_t vaddr)
 
/*
 * Allocate memory for use when boot strapping the kernel memory
-* allocator.
-*
+* allocator.  Tell UMA how many zones we are going to create
+* before going fully functional.  UMA will add its zones.
+*/
+#ifdef UMA_MD_SMALL_ALLOC
+   boot_pages = uma_startup_count(0);
+#else
+   /*
+* VM startup zones: vmem, vmem_btag, VM OBJECT, RADIX NODE, MAP,
+* KMAP ENTRY, MAP ENTRY, VMSPACE.
+*/
+   boot_pages = uma_startup_count(8);
+
+   /* vmem_startup() calls uma_prealloc(). */
+   boot_pages += vmem_startup_count();
+   /* vm_map_startup() calls uma_prealloc(). */
+   boot_pages += howmany(MAX_KMAP, UMA_SLAB_SIZE / sizeof(struct vm_map));
+
+   /*
+* Before going fully functional kmem_init() does allocation
+* from "KMAP ENTRY" and vmem_create() does allocation from "vmem".
+*/
+   boot_pages += 2;
+#endif
+   /*
 * CTFLAG_RDTUN doesn't work during the early boot process, so we must
 * manually fetch the value.
 */
-   boot_pages = uma_startup_count(0);
TUNABLE_INT_FETCH("vm.boot_pages", &boot_pages);
new_end = end - (boot_pages * UMA_SLAB_SIZE);
new_end = trunc_page(new_end);
@@ -739,9 +761,6 @@ vm_page_startup(vm_offset_t vaddr)
 * can work.
 */
domainset_zero();

svn commit: r328953 - head/sys/vm

2018-02-06 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb  6 22:08:43 2018
New Revision: 328953
URL: https://svnweb.freebsd.org/changeset/base/328953

Log:
  Improve DIAGNOSTIC printf.  Report using a boot page every time regardless
  of booted status.

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Tue Feb  6 22:06:59 2018(r328952)
+++ head/sys/vm/uma_core.c  Tue Feb  6 22:08:43 2018(r328953)
@@ -1088,12 +1088,11 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int do
 * Check our small startup cache to see if it has pages remaining.
 */
mtx_lock(&uma_boot_pages_mtx);
+   if (pages <= boot_pages) {
 #ifdef DIAGNOSTIC
-   if (booted < BOOT_PAGEALLOC)
printf("%s from \"%s\", %d boot pages left\n", __func__,
zone->uz_name, boot_pages);
 #endif
-   if (pages <= boot_pages) {
mem = bootmem;
boot_pages -= pages;
bootmem += pages * PAGE_SIZE;
___
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: r328954 - in head/sys: amd64/amd64 arm/arm cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs compat/linprocfs fs/tmpfs i386/i386 kern mips/mips powerpc/booke powerp...

2018-02-06 Thread Jeff Roberson
Author: jeff
Date: Tue Feb  6 22:10:07 2018
New Revision: 328954
URL: https://svnweb.freebsd.org/changeset/base/328954

Log:
  Use per-domain locks for vm page queue free.  Move paging control from
  global to per-domain state.  Protect reservations with the free lock
  from the domain that they belong to.  Refactor to make vm domains more
  of a first class object.
  
  Reviewed by:markj, kib, gallatin
  Tested by:  pho
  Sponsored by:   Netflix, Dell/EMC Isilon
  Differential Revision:  https://reviews.freebsd.org/D14000

Added:
  head/sys/vm/vm_pagequeue.h   (contents, props changed)
Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/pmap-v4.c
  head/sys/cddl/compat/opensolaris/sys/kmem.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  head/sys/compat/linprocfs/linprocfs.c
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/i386/i386/machdep.c
  head/sys/kern/init_main.c
  head/sys/kern/subr_vmem.c
  head/sys/kern/subr_witness.c
  head/sys/mips/mips/machdep.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/powerpc/machdep.c
  head/sys/sparc64/sparc64/machdep.c
  head/sys/sys/vmmeter.h
  head/sys/vm/swap_pager.c
  head/sys/vm/uma_core.c
  head/sys/vm/vm_extern.h
  head/sys/vm/vm_glue.c
  head/sys/vm/vm_init.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_map.c
  head/sys/vm/vm_meter.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pageout.h
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_phys.h
  head/sys/vm/vm_reserv.c
  head/sys/vm/vm_reserv.h
  head/sys/vm/vm_swapout.c
  head/sys/vm/vnode_pager.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Tue Feb  6 22:08:43 2018
(r328953)
+++ head/sys/amd64/amd64/machdep.c  Tue Feb  6 22:10:07 2018
(r328954)
@@ -282,7 +282,7 @@ cpu_startup(dummy)
memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
freeenv(sysenv);
}
-   if (memsize < ptoa((uintmax_t)vm_cnt.v_free_count))
+   if (memsize < ptoa((uintmax_t)vm_free_count()))
memsize = ptoa((uintmax_t)Maxmem);
printf("real memory  = %ju (%ju MB)\n", memsize, memsize >> 20);
realmem = atop(memsize);
@@ -309,8 +309,8 @@ cpu_startup(dummy)
vm_ksubmap_init(&kmi);
 
printf("avail memory = %ju (%ju MB)\n",
-   ptoa((uintmax_t)vm_cnt.v_free_count),
-   ptoa((uintmax_t)vm_cnt.v_free_count) / 1048576);
+   ptoa((uintmax_t)vm_free_count()),
+   ptoa((uintmax_t)vm_free_count()) / 1048576);
 
/*
 * Set up buffers, so they can be used to read disk labels.

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Tue Feb  6 22:08:43 2018(r328953)
+++ head/sys/arm/arm/machdep.c  Tue Feb  6 22:10:07 2018(r328954)
@@ -228,8 +228,8 @@ cpu_startup(void *dummy)
(uintmax_t)arm32_ptob(realmem),
(uintmax_t)arm32_ptob(realmem) / mbyte);
printf("avail memory = %ju (%ju MB)\n",
-   (uintmax_t)arm32_ptob(vm_cnt.v_free_count),
-   (uintmax_t)arm32_ptob(vm_cnt.v_free_count) / mbyte);
+   (uintmax_t)arm32_ptob(vm_free_count()),
+   (uintmax_t)arm32_ptob(vm_free_count()) / mbyte);
if (bootverbose) {
arm_physmem_print_tables();
devmap_print_table();

Modified: head/sys/arm/arm/pmap-v4.c
==
--- head/sys/arm/arm/pmap-v4.c  Tue Feb  6 22:08:43 2018(r328953)
+++ head/sys/arm/arm/pmap-v4.c  Tue Feb  6 22:10:07 2018(r328954)
@@ -3817,7 +3817,7 @@ pmap_get_pv_entry(void)
 
pv_entry_count++;
if (pv_entry_count > pv_entry_high_water)
-   pagedaemon_wakeup();
+   pagedaemon_wakeup(0); /* XXX ARM NUMA */
ret_value = uma_zalloc(pvzone, M_NOWAIT);
return ret_value;
 }

Modified: head/sys/cddl/compat/opensolaris/sys/kmem.h
==
--- head/sys/cddl/compat/opensolaris/sys/kmem.h Tue Feb  6 22:08:43 2018
(r328953)
+++ head/sys/cddl/compat/opensolaris/sys/kmem.h Tue Feb  6 22:10:07 2018
(r328954)
@@ -78,7 +78,7 @@ void kmem_reap(void);
 int kmem_debugging(void);
 void *calloc(size_t n, size_t s);
 
-#definefreemem vm_cnt.v_free_count
+#definefreemem vm_free_count()
 #defineminfree vm_cnt.v_free_min
 #defineheap_arena  kernel_arena
 #definezio_arena   NULL

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
=

svn commit: r328955 - head/sys/vm

2018-02-06 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb  6 22:13:40 2018
New Revision: 328955
URL: https://svnweb.freebsd.org/changeset/base/328955

Log:
  Use correct arithmetic to calculate how many pages we need for kegs
  and hashes.  There is no functional change with current sizes.

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Tue Feb  6 22:10:07 2018(r328954)
+++ head/sys/vm/uma_core.c  Tue Feb  6 22:13:40 2018(r328955)
@@ -1810,14 +1810,14 @@ uma_startup_count(int zones)
pages += howmany(zones, UMA_SLAB_SIZE / zsize);
 
/* ... and their kegs. */
-   pages += howmany(ksize * zones, UMA_SLAB_SIZE);
+   pages += howmany(zones, UMA_SLAB_SIZE / ksize);
 
/*
 * Take conservative approach that every zone
 * is going to allocate hash.
 */
-   pages += howmany(sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT *
-   zones, UMA_SLAB_SIZE);
+   pages += howmany(zones, UMA_SLAB_SIZE /
+   (sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT));
 
return (pages);
 }
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Gleb Smirnoff
  Peter,

  can you please check post r328952 kernel?

-- 
Gleb Smirnoff
___
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: r328956 - in head/sys: kern sys

2018-02-06 Thread Ian Lepore
Author: ian
Date: Tue Feb  6 22:17:01 2018
New Revision: 328956
URL: https://svnweb.freebsd.org/changeset/base/328956

Log:
  Use const pointers for input data not modified by clock utility functions.

Modified:
  head/sys/kern/subr_clock.c
  head/sys/kern/subr_fattime.c
  head/sys/sys/clock.h

Modified: head/sys/kern/subr_clock.c
==
--- head/sys/kern/subr_clock.c  Tue Feb  6 22:13:40 2018(r328955)
+++ head/sys/kern/subr_clock.c  Tue Feb  6 22:17:01 2018(r328956)
@@ -132,7 +132,7 @@ leapyear(int year)
 }
 
 static void
-print_ct(struct clocktime *ct)
+print_ct(const struct clocktime *ct)
 {
printf("[%04d-%02d-%02d %02d:%02d:%02d]",
ct->year, ct->mon, ct->day,
@@ -140,7 +140,7 @@ print_ct(struct clocktime *ct)
 }
 
 int
-clock_ct_to_ts(struct clocktime *ct, struct timespec *ts)
+clock_ct_to_ts(const struct clocktime *ct, struct timespec *ts)
 {
int i, year, days;
 
@@ -200,7 +200,7 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec *
 }
 
 int
-clock_bcd_to_ts(struct bcd_clocktime *bct, struct timespec *ts, bool ampm)
+clock_bcd_to_ts(const struct bcd_clocktime *bct, struct timespec *ts, bool 
ampm)
 {
struct clocktime ct;
int bcent, byear;
@@ -249,7 +249,7 @@ clock_bcd_to_ts(struct bcd_clocktime *bct, struct time
 }
 
 void
-clock_ts_to_ct(struct timespec *ts, struct clocktime *ct)
+clock_ts_to_ct(const struct timespec *ts, struct clocktime *ct)
 {
time_t i, year, days;
time_t rsec;/* remainder seconds */
@@ -310,7 +310,7 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime *
 }
 
 void
-clock_ts_to_bcd(struct timespec *ts, struct bcd_clocktime *bct, bool ampm)
+clock_ts_to_bcd(const struct timespec *ts, struct bcd_clocktime *bct, bool 
ampm)
 {
struct clocktime ct;
 

Modified: head/sys/kern/subr_fattime.c
==
--- head/sys/kern/subr_fattime.cTue Feb  6 22:13:40 2018
(r328955)
+++ head/sys/kern/subr_fattime.cTue Feb  6 22:17:01 2018
(r328956)
@@ -137,7 +137,8 @@ static const struct {
 
 
 void
-timespec2fattime(struct timespec *tsp, int utc, uint16_t *ddp, uint16_t *dtp, 
uint8_t *dhp)
+timespec2fattime(const struct timespec *tsp, int utc, uint16_t *ddp,
+uint16_t *dtp, uint8_t *dhp)
 {
time_t t1;
unsigned t2, l, m;
@@ -217,7 +218,8 @@ static const uint16_t daytab[64] = {
 };
 
 void
-fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct 
timespec *tsp)
+fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc,
+struct timespec *tsp)
 {
unsigned day;
 

Modified: head/sys/sys/clock.h
==
--- head/sys/sys/clock.hTue Feb  6 22:13:40 2018(r328955)
+++ head/sys/sys/clock.hTue Feb  6 22:17:01 2018(r328956)
@@ -88,8 +88,8 @@ struct clocktime {
longnsec;   /* nano seconds */
 };
 
-int clock_ct_to_ts(struct clocktime *, struct timespec *);
-void clock_ts_to_ct(struct timespec *, struct clocktime *);
+int clock_ct_to_ts(const struct clocktime *, struct timespec *);
+void clock_ts_to_ct(const struct timespec *, struct clocktime *);
 
 /*
  * Structure to hold the values typically reported by time-of-day clocks,
@@ -125,8 +125,8 @@ struct bcd_clocktime {
bool ispm;  /* true if hour represents pm time */
 };
 
-int clock_bcd_to_ts(struct bcd_clocktime *, struct timespec *, bool ampm);
-void clock_ts_to_bcd(struct timespec *, struct bcd_clocktime *, bool ampm);
+int clock_bcd_to_ts(const struct bcd_clocktime *, struct timespec *, bool 
ampm);
+void clock_ts_to_bcd(const struct timespec *, struct bcd_clocktime *, bool 
ampm);
 
 /*
  * Time-of-day clock functions and flags.  These functions might sleep.
@@ -177,8 +177,10 @@ void clock_unregister(device_t _clockdev);
 /* Traditional POSIX base year */
 #definePOSIX_BASE_YEAR 1970
 
-void timespec2fattime(struct timespec *tsp, int utc, u_int16_t *ddp, u_int16_t 
*dtp, u_int8_t *dhp);
-void fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct 
timespec *tsp);
+void timespec2fattime(const struct timespec *tsp, int utc, u_int16_t *ddp,
+u_int16_t *dtp, u_int8_t *dhp);
+void fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc,
+struct timespec *tsp);
 
 #endif /* _KERNEL */
 
___
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: r328957 - in head/sys: fs/ext2fs ufs/ufs

2018-02-06 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  6 22:38:19 2018
New Revision: 328957
URL: https://svnweb.freebsd.org/changeset/base/328957

Log:
  {ext2|ufs}_readdir: Avoid setting negative ncookies.
  
  ncookies cannot be negative or the allocator will fail. This should only
  happen if a caller is very broken but we can still try to survive the
  event.
  
  We should probably also verify for uio_resid > MAXPHYS but in that case
  it is not clear that just clipping the ncookies value is an adequate
  response.
  
  MFC after:2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==
--- head/sys/fs/ext2fs/ext2_lookup.cTue Feb  6 22:17:01 2018
(r328956)
+++ head/sys/fs/ext2fs/ext2_lookup.cTue Feb  6 22:38:19 2018
(r328957)
@@ -153,7 +153,10 @@ ext2_readdir(struct vop_readdir_args *ap)
return (EINVAL);
ip = VTOI(vp);
if (ap->a_ncookies != NULL) {
-   ncookies = uio->uio_resid;
+   if (uio->uio_resid < 0)
+   ncookies = 0;
+   else
+   ncookies = uio->uio_resid;
if (uio->uio_offset >= ip->i_size)
ncookies = 0;
else if (ip->i_size - uio->uio_offset < ncookies)

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cTue Feb  6 22:17:01 2018
(r328956)
+++ head/sys/ufs/ufs/ufs_vnops.cTue Feb  6 22:38:19 2018
(r328957)
@@ -2179,7 +2179,10 @@ ufs_readdir(ap)
if (ip->i_effnlink == 0)
return (0);
if (ap->a_ncookies != NULL) {
-   ncookies = uio->uio_resid;
+   if (uio->uio_resid < 0)
+   ncookies = 0;
+   else
+   ncookies = uio->uio_resid;
if (uio->uio_offset >= ip->i_size)
ncookies = 0;
else if (ip->i_size - uio->uio_offset < ncookies)
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Peter Holm
On Tue, Feb 06, 2018 at 02:15:55PM -0800, Gleb Smirnoff wrote:
>   Peter,
> 
>   can you please check post r328952 kernel?
> 

Sure.

FreeBSD 12.0-CURRENT #0 r328956: Tue Feb  6 23:26:58 CET 2018
p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 6.0.0)
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
Entering uma_startup with 9 boot pages configured
startup_alloc from "UMA Kegs", 8 boot pages left
startup_alloc from "UMA Zones", 7 boot pages left
startup_alloc from "UMA Hash", 6 boot pages left
startup_alloc from "UMA Zones", 5 boot pages left
startup_alloc from "vmem btag", 4 boot pages left
startup_alloc from "MAP", 3 boot pages left
startup_alloc from "UMA Kegs", 2 boot pages left
startup_alloc from "KMAP ENTRY", 1 boot pages left
panic: UMA: Increase vm.boot_pages
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper(c1654440,c23af290,c1be5bc0,8,c1bbec20,...) at 
db_trace_self_wrapper+0x2a/frame 0xc2022a70
kdb_backtrace(c164e477,1,0,c2022b30,0,...) at kdb_backtrace+0x2d/frame 
0xc2022ad8
vpanic(c16a125d,c2022b30,c2022b30,c2022b48,c0fb7933,...) at vpanic+0x133/frame 
0xc2022b10
panic(c16a125d,0,c16a0cb0,44f,c23b0a80,...) at panic+0x1b/frame 0xc2022b24
startup_alloc(c23b1dc0,1000,0,c2022b7b,102,...) at startup_alloc+0x143/frame 
0xc2022b48
keg_alloc_slab(0,2,c16a0cb0,983,c23b7000,...) at keg_alloc_slab+0xf6/frame 
0xc2022b90
keg_fetch_slab(,2,c16a0cb0,9e5,c23b1dc0,...) at 
keg_fetch_slab+0x10e/frame 0xc2022be8
zone_fetch_slab(c23b1dc0,0,,2,c23b5000,...) at 
zone_fetch_slab+0x61/frame 0xc2022c0c
zone_import(c23b1dc0,c2022c68,1,,2,...) at zone_import+0x3b/frame 
0xc2022c44
zone_alloc_item(,2,c16a0cc7,c16357bd,c1b5d050,...) at 
zone_alloc_item+0x3d/frame 0xc2022c78
uma_zalloc_arg(c23b1dc0,0,2,c1b5d050,0,...) at uma_zalloc_arg+0x66c/frame 
0xc2022cb4
vmem_create(c16a1c9a,0,0,1000,0,...) at vmem_create+0x2a/frame 0xc2022ce4
vm_mem_init(0,0,0,0,c186a9d4,...) at vm_mem_init+0xf4/frame 0xc2022d10
mi_startup() at mi_startup+0xf7/frame 0xc2022d38
begin() at begin+0x2f
KDB: enter: panic
[ thread pid 0 tid 0 ]
Stopped at  kdb_enter+0x3a: movl$0,kdb_why
db> 

Setting vm.boot_pages in the loader to 128 fixes this.

- Peter
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Gleb Smirnoff
On Tue, Feb 06, 2018 at 11:52:44PM +0100, Peter Holm wrote:
P> On Tue, Feb 06, 2018 at 02:15:55PM -0800, Gleb Smirnoff wrote:
P> >   Peter,
P> > 
P> >   can you please check post r328952 kernel?
P> > 
P> 
P> Sure.
P> 
P> FreeBSD 12.0-CURRENT #0 r328956: Tue Feb  6 23:26:58 CET 2018
P> p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
P> FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 
6.0.0)
P> WARNING: WITNESS option enabled, expect reduced performance.
P> WARNING: DIAGNOSTIC option enabled, expect reduced performance.
P> Entering uma_startup with 9 boot pages configured
P> startup_alloc from "UMA Kegs", 8 boot pages left
P> startup_alloc from "UMA Zones", 7 boot pages left
P> startup_alloc from "UMA Hash", 6 boot pages left
P> startup_alloc from "UMA Zones", 5 boot pages left
P> startup_alloc from "vmem btag", 4 boot pages left
P> startup_alloc from "MAP", 3 boot pages left
P> startup_alloc from "UMA Kegs", 2 boot pages left
P> startup_alloc from "KMAP ENTRY", 1 boot pages left
P> panic: UMA: Increase vm.boot_pages

Off by one :( Can you please boot with this patch and show dmesg?


-- 
Gleb Smirnoff
Index: sys/vm/uma_core.c
===
--- sys/vm/uma_core.c	(revision 328955)
+++ sys/vm/uma_core.c	(working copy)
@@ -1800,6 +1800,7 @@ uma_startup_count(int zones)
 	/* Memory for the zone of zones and zone of kegs. */
 	pages = howmany(roundup(zsize, CACHE_LINE_SIZE) * 2 +
 	roundup(ksize, CACHE_LINE_SIZE), PAGE_SIZE);
+	printf("boot_pages master %d\n", pages);
 
 	zones += UMA_BOOT_ZONES;
 
@@ -1808,9 +1809,11 @@ uma_startup_count(int zones)
 		pages += zones * howmany(zsize, UMA_SLAB_SIZE);
 	else
 		pages += howmany(zones, UMA_SLAB_SIZE / zsize);
+	printf("boot_pages zones %d\n", pages);
 
 	/* ... and their kegs. */
 	pages += howmany(zones, UMA_SLAB_SIZE / ksize);
+	printf("boot_pages kegs %d\n", pages);
 
 	/*
 	 * Take conservative approach that every zone
@@ -1818,6 +1821,7 @@ uma_startup_count(int zones)
 	 */
 	pages += howmany(zones, UMA_SLAB_SIZE /
 	(sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT));
+	printf("boot_pages hash %d\n", pages);
 
 	return (pages);
 }
Index: sys/vm/vm_page.c
===
--- sys/vm/vm_page.c	(revision 328955)
+++ sys/vm/vm_page.c	(working copy)
@@ -518,8 +518,10 @@ vm_page_startup(vm_offset_t vaddr)
 
 	/* vmem_startup() calls uma_prealloc(). */
 	boot_pages += vmem_startup_count();
+	printf("boot_pages vmem %s\n", boot_pages);
 	/* vm_map_startup() calls uma_prealloc(). */
 	boot_pages += howmany(MAX_KMAP, UMA_SLAB_SIZE / sizeof(struct vm_map));
+	printf("boot_pages kmap %s\n", boot_pages);
 
 	/*
 	 * Before going fully functional kmem_init() does allocation
___
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: r328958 - head/share/zoneinfo

2018-02-06 Thread Warner Losh
Author: imp
Date: Tue Feb  6 23:12:16 2018
New Revision: 328958
URL: https://svnweb.freebsd.org/changeset/base/328958

Log:
  Avoid find -s, use find | sort instead.
  
  find -s was introduced to make the metalog more
  deterministic. However, find -s is not portable. find | sort is
  portable and accomplishes the same goals, even if it isn't
  pedantically the same. TZS is the same before / after the change so
  any fussy differences between the two are moot and there won't be
  METALOG churn across this change.
  
  Differential Revision: https://reviews.freebsd.org/D14231

Modified:
  head/share/zoneinfo/Makefile

Modified: head/share/zoneinfo/Makefile
==
--- head/share/zoneinfo/MakefileTue Feb  6 22:38:19 2018
(r328957)
+++ head/share/zoneinfo/MakefileTue Feb  6 23:12:16 2018
(r328958)
@@ -95,8 +95,13 @@ zoneinfo: yearistype ${TDATA}
zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
 
+#
+# Sort TZS to ensure they are the same every build. find -s might
+# be a shorter way to express this, but it's non-portable. Any
+# differences between the two don't matter for this purpose.
+#
 .if make(*install*)
-TZS!= cd ${TZBUILDDIR} && find -s * -type f
+TZS!= cd ${TZBUILDDIR} && find * -type f | env LC_ALL=C sort
 .endif
 
 beforeinstall: install-zoneinfo
___
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: r328959 - head/lib/libc/sys

2018-02-06 Thread Conrad Meyer
Author: cem
Date: Tue Feb  6 23:12:47 2018
New Revision: 328959
URL: https://svnweb.freebsd.org/changeset/base/328959

Log:
  fsync.2: Cross-reference fsync(1)
  
  Reported by:  rpokala
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/sys/fsync.2

Modified: head/lib/libc/sys/fsync.2
==
--- head/lib/libc/sys/fsync.2   Tue Feb  6 23:12:16 2018(r328958)
+++ head/lib/libc/sys/fsync.2   Tue Feb  6 23:12:47 2018(r328959)
@@ -34,7 +34,7 @@
 .\" @(#)fsync.28.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd May 24, 2017
+.Dd February 6, 2018
 .Dt FSYNC 2
 .Os
 .Sh NAME
@@ -108,6 +108,7 @@ refers to a socket, not to a file.
 An I/O error occurred while reading from or writing to the file system.
 .El
 .Sh SEE ALSO
+.Xr fsync 1 ,
 .Xr sync 2 ,
 .Xr syncer 4 ,
 .Xr sync 8
___
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: r328934 - in head: . bin/sh

2018-02-06 Thread Mark Millard via svn-src-head
Ian Lepore ian at freebsd.org wrote on
Tue Feb 6 19:35:21 UTC 2018 :

> I don't understand this idea of /usr/local "polluting" a system.  It
> seems to me exactly the opposite would be the case... if I have found
> some 3rd party version of mktemp that I like better, it would be
> installed in /usr/local.  If I went out of my way to install that, then
> naturally I WANT it to be used.  To me, it's insane that the /usr/local
> paths are not in front of the base system paths by default, and it's
> even more insane that the base system works so hard to NOT use the
> replacements I've installed (even if I've arranged PATH so that the
> right versions should be used) so that I have to track down why it's
> using the wrong thing and apply ad-hoc fixes.


I've had mixed results over the years. I've had ports install files
for other 'internal' purposes (not my overall goals) that in turned
broke buildworld for powerpc(64) for some alternative compiler/tool
chains that induced /usr/local/ header file usage if a file name
accidentally matched. There was a period of time where I'd rename
some specific header files as I switched activities in order to avoid
systematic problems. (It seemed easier than than other alternatives
that I considered at the time.)

[But I've been doing odd "target powerpc64 and powerpc without gcc
4.2.1" experiments for a few years. Not exactly a typical context.]

As the build system for buildworld has progressed, I've not had such
problems for some time: it became easier to avoid /usr/local/include/
getting involved, at least for what I've been doing. Also, I do
external toolchain activity less often these days.

===
Mark Millard
marklmi at yahoo.com
( markmi at dsl-only.net is
going away in 2018-Feb, late)

___
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: r328960 - head/sys/cam

2018-02-06 Thread Warner Losh
Author: imp
Date: Tue Feb  6 23:21:08 2018
New Revision: 328960
URL: https://svnweb.freebsd.org/changeset/base/328960

Log:
  Keep a counter for number of requests completed with an error.
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_iosched.c

Modified: head/sys/cam/cam_iosched.c
==
--- head/sys/cam/cam_iosched.c  Tue Feb  6 23:12:47 2018(r328959)
+++ head/sys/cam/cam_iosched.c  Tue Feb  6 23:21:08 2018(r328960)
@@ -223,6 +223,7 @@ struct iop_stats {
int total;  /* Total for all time -- wraps */
int in; /* number queued all time -- wraps */
int out;/* number completed all time -- wraps */
+   int errs;   /* Number of I/Os completed with error 
--  wraps */
 
/*
 * Statistics on different bits of the process.
@@ -781,6 +782,7 @@ cam_iosched_iop_stats_init(struct cam_iosched_softc *i
ios->max = ios->current = 30;
ios->min = 1;
ios->out = 0;
+   ios->errs = 0;
ios->pending = 0;
ios->queued = 0;
ios->total = 0;
@@ -971,7 +973,11 @@ cam_iosched_iop_stats_sysctl_init(struct cam_iosched_s
SYSCTL_ADD_INT(ctx, n,
OID_AUTO, "out", CTLFLAG_RD,
&ios->out, 0,
-   "# of transactions completed");
+   "# of transactions completed (including with error)");
+   SYSCTL_ADD_INT(ctx, n,
+   OID_AUTO, "errs", CTLFLAG_RD,
+   &ios->errs, 0,
+   "# of transactions completed with an error");
 
SYSCTL_ADD_PROC(ctx, n,
OID_AUTO, "limiter", CTLTYPE_STRING | CTLFLAG_RW,
@@ -1463,13 +1469,19 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc
printf("done: %p %#x\n", bp, bp->bio_cmd);
if (bp->bio_cmd == BIO_WRITE) {
retval = cam_iosched_limiter_iodone(&isc->write_stats, bp);
+   if (!(bp->bio_flags & BIO_ERROR))
+   isc->write_stats.errs++;
isc->write_stats.out++;
isc->write_stats.pending--;
} else if (bp->bio_cmd == BIO_READ) {
retval = cam_iosched_limiter_iodone(&isc->read_stats, bp);
+   if (!(bp->bio_flags & BIO_ERROR))
+   isc->read_stats.errs++;
isc->read_stats.out++;
isc->read_stats.pending--;
} else if (bp->bio_cmd == BIO_DELETE) {
+   if (!(bp->bio_flags & BIO_ERROR))
+   isc->trim_stats.errs++;
isc->trim_stats.out++;
isc->trim_stats.pending--;
} else if (bp->bio_cmd != BIO_FLUSH) {
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Peter Holm
On Tue, Feb 06, 2018 at 03:06:35PM -0800, Gleb Smirnoff wrote:
> On Tue, Feb 06, 2018 at 11:52:44PM +0100, Peter Holm wrote:
> P> On Tue, Feb 06, 2018 at 02:15:55PM -0800, Gleb Smirnoff wrote:
> P> >   Peter,
> P> > 
> P> >   can you please check post r328952 kernel?
> P> > 
> P> 
> P> Sure.
> P> 
> P> FreeBSD 12.0-CURRENT #0 r328956: Tue Feb  6 23:26:58 CET 2018
> P> p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
> P> FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 
> 6.0.0)
> P> WARNING: WITNESS option enabled, expect reduced performance.
> P> WARNING: DIAGNOSTIC option enabled, expect reduced performance.
> P> Entering uma_startup with 9 boot pages configured
> P> startup_alloc from "UMA Kegs", 8 boot pages left
> P> startup_alloc from "UMA Zones", 7 boot pages left
> P> startup_alloc from "UMA Hash", 6 boot pages left
> P> startup_alloc from "UMA Zones", 5 boot pages left
> P> startup_alloc from "vmem btag", 4 boot pages left
> P> startup_alloc from "MAP", 3 boot pages left
> P> startup_alloc from "UMA Kegs", 2 boot pages left
> P> startup_alloc from "KMAP ENTRY", 1 boot pages left
> P> panic: UMA: Increase vm.boot_pages
> 
> Off by one :( Can you please boot with this patch and show dmesg?
> 

FreeBSD 12.0-CURRENT #2 r328956M: Wed Feb  7 00:20:47 CET 2018
p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 6.0.0)
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
boot_pages master 1
boot_pages zones 3
boot_pages kegs 4
boot_pages hash 5
boot_pages vmem 6
boot_pages kmap 7
Entering uma_startup with 9 boot pages configured
startup_alloc from "UMA Kegs", 8 boot pages left
startup_alloc from "UMA Zones", 7 boot pages left
startup_alloc from "UMA Hash", 6 boot pages left
startup_alloc from "UMA Zones", 5 boot pages left
startup_alloc from "vmem btag", 4 boot pages left
startup_alloc from "MAP", 3 boot pages left
startup_alloc from "UMA Kegs", 2 boot pages left
startup_alloc from "KMAP ENTRY", 1 boot pages left
panic: UMA: Increase vm.boot_pages
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper(c16544c0,c23af290,c1be5bc0,8,c1bbec20,...) at 
db_trace_self_wrapper+0x2a/frame 0xc2022a70
kdb_backtrace(c164e4f7,1,0,c2022b30,0,...) at kdb_backtrace+0x2d/frame 
0xc2022ad8
vpanic(c16a1330,c2022b30,c2022b30,c2022b48,c0fb7983,...) at vpanic+0x133/frame 
0xc2022b10
panic(c16a1330,0,c16a0d83,44f,c23b0a80,...) at panic+0x1b/frame 0xc2022b24
startup_alloc(c23b1dc0,1000,0,c2022b7b,102,...) at startup_alloc+0x143/frame 
0xc2022b48
keg_alloc_slab(0,2,c16a0d83,987,c23b7000,...) at keg_alloc_slab+0xf6/frame 
0xc2022b90
keg_fetch_slab(,2,c16a0d83,9e9,c23b1dc0,...) at 
keg_fetch_slab+0x10e/frame 0xc2022be8
zone_fetch_slab(c23b1dc0,0,,2,c23b5000,...) at 
zone_fetch_slab+0x61/frame 0xc2022c0c
zone_import(c23b1dc0,c2022c68,1,,2,...) at zone_import+0x3b/frame 
0xc2022c44
zone_alloc_item(,2,c16a0d9a,c163583d,c1b5d050,...) at 
zone_alloc_item+0x3d/frame 0xc2022c78
uma_zalloc_arg(c23b1dc0,0,2,c1b5d050,0,...) at uma_zalloc_arg+0x66c/frame 
0xc2022cb4
vmem_create(c16a1d6e,0,0,1000,0,...) at vmem_create+0x2a/frame 0xc2022ce4
vm_mem_init(0,0,0,0,c186aab4,...) at vm_mem_init+0xf4/frame 0xc2022d10
mi_startup() at mi_startup+0xf7/frame 0xc2022d38
begin() at begin+0x2f
KDB: enter: panic
[ thread pid 0 tid 0 ]
Stopped at  kdb_enter+0x3a: movl$0,kdb_why
db> 

- Peter
___
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: r328951 - head/etc/rc.d

2018-02-06 Thread Rodney W. Grimes
> Author: feld (ports committer)
> Date: Tue Feb  6 21:35:41 2018
> New Revision: 328951
> URL: https://svnweb.freebsd.org/changeset/base/328951
> 
> Log:
>   Refactor cleanvar to remove shell expansion vulnerability
>   
>   If any process creates a directory named "-P" in /var/run or
>   /var/spool/lock it will cause the purgedir function to start to rm -r /.
>   
>   Simplify a lot of complicated shell logic by leveraging find(1).
>   
>   Reviewed by:allanjude
>   MFC after:  3 days
>   Differential Revision:  https://reviews.freebsd.org/D13778

Please be careful about use of binaries from /usr/bin in
/etc/rc.d, though in this case it is probably ok as /usr
has been mounted by the time cleanvar runs, that is not
always the case.


> Modified:
>   head/etc/rc.d/cleanvar
> 
> Modified: head/etc/rc.d/cleanvar
> ==
> --- head/etc/rc.d/cleanvarTue Feb  6 21:01:38 2018(r328950)
> +++ head/etc/rc.d/cleanvarTue Feb  6 21:35:41 2018(r328951)
> @@ -19,34 +19,6 @@ stop_cmd=":"
>  extra_commands="reload"
>  reload_cmd="${name}_start"
>  
> -purgedir()
> -{
> - local dir file
> -
> - if [ $# -eq 0 ]; then
> - purgedir .
> - else
> - for dir
> - do
> - (
> - cd "$dir" && for file in .* *
> - do
> - # Skip over logging sockets
> - [ -S "$file" -a "$file" = "log" ] && continue
> - [ -S "$file" -a "$file" = "logpriv" ] && 
> continue
> - [ ."$file" = .. -o ."$file" = ... ] && continue
> - if [ -d "$file" -a ! -L "$file" ]
> - then
> - purgedir "$file"
> - else
> - rm -f -- "$file"
> - fi
> - done
> - )
> - done
> - fi
> -}
> -
>  cleanvar_prestart()
>  {
>   # These files must be removed only the first time this script is run
> @@ -58,14 +30,17 @@ cleanvar_prestart()
>  cleanvar_start()
>  {
>   if [ -d /var/run -a ! -f /var/run/clean_var ]; then
> - purgedir /var/run
> + # Skip over logging sockets
> + find /var/run \( -type f -or -type s ! -name log -and ! -name 
> logpriv \) -delete
>   >/var/run/clean_var
>   fi
>   if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
> - purgedir /var/spool/lock
> + find /var/spool/lock -type f -delete
>   >/var/spool/lock/clean_var
>   fi
> - rm -rf /var/spool/uucp/.Temp/*
> + if [ -d /var/spool/uucp/.Temp ]; then
> + find /var/spool/uucp/.Temp -delete
> + fi
>  }
>  
>  load_rc_config $name
> 
> 

-- 
Rod Grimes rgri...@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: r328934 - in head: . bin/sh

2018-02-06 Thread Rodney W. Grimes
[ Charset ISO-8859-1 unsupported, converting... ]
> On Tue, 2018-02-06 at 11:25 -0800, Rodney W. Grimes wrote:
> > > 
> > > Author: arichardson
> > > Date: Tue Feb??6 15:41:35 2018
> > > New Revision: 328934
> > > URL: https://svnweb.freebsd.org/changeset/base/328934
> > > 
> > > Log:
> > > ? Don't hardcode /usr/bin as the path for mktemp in build tools
> > > ??
> > > ? It won't work e.g. when crossbuilding from Ubuntu Linux as mktemp
> > > is in
> > > ? /bin there.
> > > ??
> > > ? Reviewed By:bdrewery
> > > ? Approved By:jhb (mentor)
> > > ? Differential Revision: https://reviews.freebsd.org/D13937
> > Would it be better to create the variable MKTEMP to point at
> > either /bin/mktemp or /usr/bin/mktemp dependent on platform,
> > there are reasons we use full paths in Makefiles, mostly to
> > stop /usr/local/bin/foo contimaton, which I believe this
> > change now opens up, though very slight as I dont know of
> > a third party mktemp binary.
> > 
> 
> I don't understand this idea of /usr/local "polluting" a system. ?It
> seems to me exactly the opposite would be the case... if I have found
> some 3rd party version of mktemp that I like better, it would be
> installed in /usr/local. ?If I went out of my way to install that, then
> naturally I WANT it to be used. ?To me, it's insane that the /usr/local
> paths are not in front of the base system paths by default, and it's
> even more insane that the base system works so hard to NOT use the
> replacements I've installed (even if I've arranged PATH so that the
> right versions should be used) so that I have to track down why it's
> using the wrong thing and apply ad-hoc fixes.

Your welcome to wonder down that twisty maze of passages, I however
shall not be following you.

If you start to accept what ever the users path is for building
the freebsd /usr/src tree the rate of failed builds and complaints,
and hours spent chasing after oh crap it picked up foo from /usr/local
is not a game I care to par take in. 

You personally, could probably get away with this and be fine,
our user base would probably not be very lucky.w

Oh, and reproducibility goes totally out the window if you fool with that.

> -- Ian

-- 
Rod Grimes rgri...@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: r328916 - in head/sys: kern vm

2018-02-06 Thread Gleb Smirnoff
  Hi Peter,

  can you please try this patch? In either case success
or not, please provide me with dmesg. Thanks a lot!

-- 
Gleb Smirnoff
Index: uma_core.c
===
--- uma_core.c	(revision 328955)
+++ uma_core.c	(working copy)
@@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$");
 #ifdef DEBUG_MEMGUARD
 #include 
 #endif
+#define	DIAGNOSTIC
 
 /*
  * This is the zone and keg from which all zones are spawned.
@@ -1800,6 +1801,7 @@ uma_startup_count(int zones)
 	/* Memory for the zone of zones and zone of kegs. */
 	pages = howmany(roundup(zsize, CACHE_LINE_SIZE) * 2 +
 	roundup(ksize, CACHE_LINE_SIZE), PAGE_SIZE);
+	printf("boot_pages master %d\n", pages);
 
 	zones += UMA_BOOT_ZONES;
 
@@ -1807,17 +1809,20 @@ uma_startup_count(int zones)
 	if (zsize > UMA_SLAB_SIZE)
 		pages += zones * howmany(zsize, UMA_SLAB_SIZE);
 	else
-		pages += howmany(zones, UMA_SLAB_SIZE / zsize);
+		pages += howmany(zones, UMA_SLAB_SPACE / zsize);
+	printf("boot_pages zones %d\n", pages);
 
 	/* ... and their kegs. */
-	pages += howmany(zones, UMA_SLAB_SIZE / ksize);
+	pages += howmany(zones, UMA_SLAB_SPACE / ksize);
+	printf("boot_pages kegs %d\n", pages);
 
 	/*
 	 * Take conservative approach that every zone
 	 * is going to allocate hash.
 	 */
-	pages += howmany(zones, UMA_SLAB_SIZE /
+	pages += howmany(zones, UMA_SLAB_SPACE /
 	(sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT));
+	printf("boot_pages hash %d\n", pages);
 
 	return (pages);
 }
Index: uma_int.h
===
--- uma_int.h	(revision 328955)
+++ uma_int.h	(working copy)
@@ -138,6 +138,11 @@
 #define UMA_MAX_WASTE	10
 
 /*
+ * Size of memory in a not offpage slab available for actual items.
+ */
+#define	UMA_SLAB_SPACE	(UMA_SLAB_SIZE - sizeof(struct uma_slab))
+
+/*
  * I doubt there will be many cases where this is exceeded. This is the initial
  * size of the hash table for uma_slabs that are managed off page. This hash
  * does expand by powers of two.  Currently it doesn't get smaller.
Index: vm_page.c
===
--- vm_page.c	(revision 328955)
+++ vm_page.c	(working copy)
@@ -518,8 +518,11 @@ vm_page_startup(vm_offset_t vaddr)
 
 	/* vmem_startup() calls uma_prealloc(). */
 	boot_pages += vmem_startup_count();
+	printf("boot_pages vmem %d\n", boot_pages);
 	/* vm_map_startup() calls uma_prealloc(). */
-	boot_pages += howmany(MAX_KMAP, UMA_SLAB_SIZE / sizeof(struct vm_map));
+	boot_pages += howmany(MAX_KMAP,
+	UMA_SLAB_SPACE / sizeof(struct vm_map));
+	printf("boot_pages kmap %d\n", boot_pages);
 
 	/*
 	 * Before going fully functional kmem_init() does allocation
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Gleb Smirnoff
On Tue, Feb 06, 2018 at 04:42:13PM -0800, Gleb Smirnoff wrote:
T>   Hi Peter,
T> 
T>   can you please try this patch? In either case success
T> or not, please provide me with dmesg. Thanks a lot!

Sorry, patch was missing one file. 99.9% this is a no-op,
but better use full patch.

-- 
Gleb Smirnoff
Index: sys/kern/subr_vmem.c
===
--- sys/kern/subr_vmem.c	(revision 328955)
+++ sys/kern/subr_vmem.c	(working copy)
@@ -667,7 +667,8 @@ int
 vmem_startup_count(void)
 {
 
-	return (howmany(BT_MAXALLOC, UMA_SLAB_SIZE / sizeof(struct vmem_btag)));
+	return (howmany(BT_MAXALLOC,
+	UMA_SLAB_SPACE / sizeof(struct vmem_btag)));
 }
 #endif
 
Index: sys/vm/uma_core.c
===
--- sys/vm/uma_core.c	(revision 328955)
+++ sys/vm/uma_core.c	(working copy)
@@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$");
 #ifdef DEBUG_MEMGUARD
 #include 
 #endif
+#define	DIAGNOSTIC
 
 /*
  * This is the zone and keg from which all zones are spawned.
@@ -1800,6 +1801,7 @@ uma_startup_count(int zones)
 	/* Memory for the zone of zones and zone of kegs. */
 	pages = howmany(roundup(zsize, CACHE_LINE_SIZE) * 2 +
 	roundup(ksize, CACHE_LINE_SIZE), PAGE_SIZE);
+	printf("boot_pages master %d\n", pages);
 
 	zones += UMA_BOOT_ZONES;
 
@@ -1807,17 +1809,20 @@ uma_startup_count(int zones)
 	if (zsize > UMA_SLAB_SIZE)
 		pages += zones * howmany(zsize, UMA_SLAB_SIZE);
 	else
-		pages += howmany(zones, UMA_SLAB_SIZE / zsize);
+		pages += howmany(zones, UMA_SLAB_SPACE / zsize);
+	printf("boot_pages zones %d\n", pages);
 
 	/* ... and their kegs. */
-	pages += howmany(zones, UMA_SLAB_SIZE / ksize);
+	pages += howmany(zones, UMA_SLAB_SPACE / ksize);
+	printf("boot_pages kegs %d\n", pages);
 
 	/*
 	 * Take conservative approach that every zone
 	 * is going to allocate hash.
 	 */
-	pages += howmany(zones, UMA_SLAB_SIZE /
+	pages += howmany(zones, UMA_SLAB_SPACE /
 	(sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT));
+	printf("boot_pages hash %d\n", pages);
 
 	return (pages);
 }
Index: sys/vm/uma_int.h
===
--- sys/vm/uma_int.h	(revision 328955)
+++ sys/vm/uma_int.h	(working copy)
@@ -138,6 +138,11 @@
 #define UMA_MAX_WASTE	10
 
 /*
+ * Size of memory in a not offpage slab available for actual items.
+ */
+#define	UMA_SLAB_SPACE	(UMA_SLAB_SIZE - sizeof(struct uma_slab))
+
+/*
  * I doubt there will be many cases where this is exceeded. This is the initial
  * size of the hash table for uma_slabs that are managed off page. This hash
  * does expand by powers of two.  Currently it doesn't get smaller.
Index: sys/vm/vm_page.c
===
--- sys/vm/vm_page.c	(revision 328955)
+++ sys/vm/vm_page.c	(working copy)
@@ -518,8 +518,11 @@ vm_page_startup(vm_offset_t vaddr)
 
 	/* vmem_startup() calls uma_prealloc(). */
 	boot_pages += vmem_startup_count();
+	printf("boot_pages vmem %d\n", boot_pages);
 	/* vm_map_startup() calls uma_prealloc(). */
-	boot_pages += howmany(MAX_KMAP, UMA_SLAB_SIZE / sizeof(struct vm_map));
+	boot_pages += howmany(MAX_KMAP,
+	UMA_SLAB_SPACE / sizeof(struct vm_map));
+	printf("boot_pages kmap %d\n", boot_pages);
 
 	/*
 	 * Before going fully functional kmem_init() does allocation
___
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: r328964 - head/sys/arm/allwinner

2018-02-06 Thread Kyle Evans
Author: kevans
Date: Wed Feb  7 01:54:13 2018
New Revision: 328964
URL: https://svnweb.freebsd.org/changeset/base/328964

Log:
  if_awg: Skip emac reset if configured for internal PHY
  
  On the OrangePi One at least, emac reset when an ethernet cable is not
  plugged in seems to break ethernet. Soft reset will fail, even with
  increasing the delay and retries to wait for up to 20 seconds. This can be
  reproduced across at least two different OrangePi One's by simply leaving
  ethernet cable unplugged when awg attaches. Whether it's plugged in or not
  through u-boot process makes no difference.
  
  Skipping the reset in this configuration doesn't seem to cause any problems,
  tried across many many reboots with and without ethernet cable plugged in.
  
  Tested on:OrangePi One
  Tested on:Other boards (manu)
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D13974

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

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Wed Feb  7 01:24:49 2018
(r328963)
+++ head/sys/arm/allwinner/if_awg.c Wed Feb  7 01:54:13 2018
(r328964)
@@ -1834,9 +1834,11 @@ awg_attach(device_t dev)
awg_get_eaddr(dev, eaddr);
 
/* Soft reset EMAC core */
-   error = awg_reset(dev);
-   if (error != 0)
-   return (error);
+   if (!awg_has_internal_phy(dev)) {
+   error = awg_reset(dev);
+   if (error != 0)
+   return (error);
+   }
 
/* Setup DMA descriptors */
error = awg_setup_dma(dev);
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Peter Holm
On Tue, Feb 06, 2018 at 04:45:49PM -0800, Gleb Smirnoff wrote:
> On Tue, Feb 06, 2018 at 04:42:13PM -0800, Gleb Smirnoff wrote:
> T>   Hi Peter,
> T> 
> T>   can you please try this patch? In either case success
> T> or not, please provide me with dmesg. Thanks a lot!
> 
> Sorry, patch was missing one file. 99.9% this is a no-op,
> but better use full patch.
> 

GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2018 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #2 r328956M: Wed Feb  7 00:20:47 CET 2018
p...@x4.osted.lan:/usr/src/sys/i386/compile/PHO i386
FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 6.0.0)
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
boot_pages master 1
boot_pages zones 3
boot_pages kegs 4
boot_pages hash 5
boot_pages vmem 6
boot_pages kmap 7
Entering uma_startup with 9 boot pages configured
startup_alloc from "UMA Kegs", 8 boot pages left
startup_alloc from "UMA Zones", 7 boot pages left
startup_alloc from "UMA Hash", 6 boot pages left
startup_alloc from "UMA Zones", 5 boot pages left
startup_alloc from "vmem btag", 4 boot pages left
startup_alloc from "MAP", 3 boot pages left
startup_alloc from "UMA Kegs", 2 boot pages left
startup_alloc from "KMAP ENTRY", 1 boot pages left
panic: UMA: Increase vm.boot_pages
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper(c16544c0,c23af290,c1be5bc0,8,c1bbec20,...) at 
db_trace_self_wrapper+0x2a/frame 0xc2022a70
kdb_backtrace(c164e4f7,1,0,c2022b30,0,...) at kdb_backtrace+0x2d/frame 
0xc2022ad8
vpanic(c16a1330,c2022b30,c2022b30,c2022b48,c0fb7983,...) at vpanic+0x133/frame 
0xc2022b10
panic(c16a1330,0,c16a0d83,44f,c23b0a80,...) at panic+0x1b/frame 0xc2022b24
startup_alloc(c23b1dc0,1000,0,c2022b7b,102,...) at startup_alloc+0x143/frame 
0xc2022b48
keg_alloc_slab(0,2,c16a0d83,987,c23b7000,...) at keg_alloc_slab+0xf6/frame 
0xc2022b90
keg_fetch_slab(,2,c16a0d83,9e9,c23b1dc0,...) at 
keg_fetch_slab+0x10e/frame 0xc2022be8
zone_fetch_slab(c23b1dc0,0,,2,c23b5000,...) at 
zone_fetch_slab+0x61/frame 0xc2022c0c
zone_import(c23b1dc0,c2022c68,1,,2,...) at zone_import+0x3b/frame 
0xc2022c44
zone_alloc_item(,2,c16a0d9a,c163583d,c1b5d050,...) at 
zone_alloc_item+0x3d/frame 0xc2022c78
uma_zalloc_arg(c23b1dc0,0,2,c1b5d050,0,...) at uma_zalloc_arg+0x66c/frame 
0xc2022cb4
vmem_create(c16a1d6e,0,0,1000,0,...) at vmem_create+0x2a/frame 0xc2022ce4
vm_mem_init(0,0,0,0,c186aab4,...) at vm_mem_init+0xf4/frame 0xc2022d10
mi_startup() at mi_startup+0xf7/frame 0xc2022d38
begin() at begin+0x2f
KDB: enter: panic
[ thread pid 0 tid 0 ]
Stopped at  kdb_enter+0x3a: movl$0,kdb_why
db> 

- Peter
___
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: r328916 - in head/sys: kern vm

2018-02-06 Thread Peter Holm
On Wed, Feb 07, 2018 at 07:46:17AM +0100, Peter Holm wrote:
> On Tue, Feb 06, 2018 at 04:45:49PM -0800, Gleb Smirnoff wrote:
> > On Tue, Feb 06, 2018 at 04:42:13PM -0800, Gleb Smirnoff wrote:
> > T>   Hi Peter,
> > T> 
> > T>   can you please try this patch? In either case success
> > T> or not, please provide me with dmesg. Thanks a lot!
> > 
> > Sorry, patch was missing one file. 99.9% this is a no-op,
> > but better use full patch.
> > 
> 

Here the output with vm.boot_pages=128

https://people.freebsd.org/~pho/gleb011.txt

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