Re: svn commit: r286948 - head/lib/libc/sys

2015-08-20 Thread Garrett Cooper

 On Aug 19, 2015, at 17:00, Conrad E. Meyer c...@freebsd.org wrote:
 
 Author: cem
 Date: Thu Aug 20 00:00:15 2015
 New Revision: 286948
 URL: https://svnweb.freebsd.org/changeset/base/286948
 
 Log:
  getrlimit.2: Document RSS, AS/VMEM limit behavior more clearly
 
  Alphabetize the RLIMIT_ list while here.
 
  Reviewed by:jilles (previous version), wblock (previous version)
  Approved by:markj (mentor)
  Sponsored by:EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D3433
 
 Modified:
  head/lib/libc/sys/getrlimit.2

Should this be mfced?
___
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: r286951 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-08-20 Thread Alexander Motin
Author: mav
Date: Thu Aug 20 07:41:33 2015
New Revision: 286951
URL: https://svnweb.freebsd.org/changeset/base/286951

Log:
  Restore part of r274628, reverted at r286776.
  
  Submitted by: avg

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Thu Aug 20 
05:13:54 2015(r286950)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Thu Aug 20 
07:41:33 2015(r286951)
@@ -6509,7 +6509,8 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
csize = zio_compress_data(ZIO_COMPRESS_LZ4, hdr-b_l1hdr.b_tmp_cdata,
cdata, l2hdr-b_asize);
 
-   rounded = P2ROUNDUP(csize, (size_t)SPA_MINBLOCKSIZE);
+   rounded = P2ROUNDUP(csize,
+   (size_t)1  l2hdr-b_dev-l2ad_vdev-vdev_ashift);
if (rounded  csize) {
bzero((char *)cdata + csize, rounded - csize);
csize = rounded;
___
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: r286953 - head/lib/libkvm

2015-08-20 Thread Andrew Turner
Author: andrew
Date: Thu Aug 20 11:07:51 2015
New Revision: 286953
URL: https://svnweb.freebsd.org/changeset/base/286953

Log:
  Add support to libkvm for reading minidumps on arm64. The kernel side is
  missing until it can be cleaned up.
  
  Reviewed by:  jhb
  Approved by:  ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D3319

Added:
  head/lib/libkvm/kvm_minidump_aarch64.c   (contents, props changed)
Modified:
  head/lib/libkvm/kvm_aarch64.c
  head/lib/libkvm/kvm_private.h

Modified: head/lib/libkvm/kvm_aarch64.c
==
--- head/lib/libkvm/kvm_aarch64.c   Thu Aug 20 08:34:13 2015
(r286952)
+++ head/lib/libkvm/kvm_aarch64.c   Thu Aug 20 11:07:51 2015
(r286953)
@@ -1,5 +1,6 @@
 /*-
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (C) 2006 Bruce M. Simpson.
+ * Copyright (c) 2015 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by Andrew Turner under
@@ -27,38 +28,78 @@
  * SUCH DAMAGE.
  */
 
+/*
+ * arm64 (AArch64) machine dependent routines for kvm.
+ */
+
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
 #include sys/param.h
+#include sys/mman.h
+
+#include vm/vm.h
+#include vm/vm_param.h
+#include vm/pmap.h
+
+#include machine/pmap.h
 
 #include limits.h
 #include kvm.h
-#include stdio.h
 #include stdlib.h
+#include string.h
+#include unistd.h
 
 #include kvm_private.h
 
+/* minidump must be the first item! */
+struct vmstate {
+   int minidump;   /* 1 = minidump mode */
+   void *mmapbase;
+   size_t mmapsize;
+};
+
 void
 _kvm_freevtop(kvm_t *kd)
 {
 
-   printf(_kvm_freevtop\n);
-   abort();
+   if (kd-vmst != 0) {
+   if (kd-vmst-minidump)
+   return (_kvm_minidump_freevtop(kd));
+   if (kd-vmst-mmapbase != NULL)
+   munmap(kd-vmst-mmapbase, kd-vmst-mmapsize);
+   free(kd-vmst);
+   kd-vmst = NULL;
+   }
 }
 
 int
 _kvm_initvtop(kvm_t *kd)
 {
+   char minihdr[8];
+
+   if (!kd-rawdump) {
+   if (pread(kd-pmfd, minihdr, 8, 0) == 8) {
+   if (memcmp(minihdr, minidump, 8) == 0)
+   return (_kvm_minidump_initvtop(kd));
+   } else {
+   _kvm_err(kd, kd-program, cannot read header);
+   return (-1);
+   }
+   }
 
-   printf(_kvm_initvtop\n);
-   abort();
+   _kvm_err(kd, 0, _kvm_initvtop: Unsupported image type);
+   return (-1);
 }
 
 int
 _kvm_kvatop(kvm_t *kd, u_long va, off_t *pa)
 {
 
-   printf(_kvm_kvatop\n);
-   abort();
+   if (kd-vmst-minidump)
+   return _kvm_minidump_kvatop(kd, va, pa);
+
+
+   _kvm_err(kd, 0, _kvm_kvatop: Unsupported image type);
+   return (0);
 }

Added: head/lib/libkvm/kvm_minidump_aarch64.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libkvm/kvm_minidump_aarch64.c  Thu Aug 20 11:07:51 2015
(r286953)
@@ -0,0 +1,269 @@
+/*-
+ * Copyright (c) 2006 Peter Wemm
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * From: FreeBSD: src/lib/libkvm/kvm_minidump_amd64.c r261799
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+/*
+ * ARM64 (AArch64) machine dependent routines for kvm and minidumps. 
+ */
+
+#include sys/param.h
+#include sys/user.h
+#include sys/proc.h
+#include sys/stat.h
+#include sys/mman.h
+#include sys/fnv_hash.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+#include 

svn commit: r286957 - head/sys/arm64/include

2015-08-20 Thread Andrew Turner
Author: andrew
Date: Thu Aug 20 12:07:44 2015
New Revision: 286957
URL: https://svnweb.freebsd.org/changeset/base/286957

Log:
  Remove pmap_kenter from pmap.h, the function doesn't exist.

Modified:
  head/sys/arm64/include/md_var.h
  head/sys/arm64/include/pmap.h

Modified: head/sys/arm64/include/md_var.h
==
--- head/sys/arm64/include/md_var.h Thu Aug 20 12:05:42 2015
(r286956)
+++ head/sys/arm64/include/md_var.h Thu Aug 20 12:07:44 2015
(r286957)
@@ -36,9 +36,14 @@
 extern long Maxmem;
 extern char sigcode[];
 extern int szsigcode;
+extern uint64_t *vm_page_dump;
+extern int vm_page_dump_size;
 
 struct dumperinfo;
-int minidumpsys(struct dumperinfo *);
+
 void busdma_swi(void);
+void dump_add_page(vm_paddr_t);
+void dump_drop_page(vm_paddr_t);
+int minidumpsys(struct dumperinfo *);
 
 #endif /* !_MACHINE_MD_VAR_H_ */

Modified: head/sys/arm64/include/pmap.h
==
--- head/sys/arm64/include/pmap.h   Thu Aug 20 12:05:42 2015
(r286956)
+++ head/sys/arm64/include/pmap.h   Thu Aug 20 12:07:44 2015
(r286957)
@@ -135,7 +135,6 @@ extern vm_offset_t virtual_end;
va) | (pa))  L1_OFFSET) == 0  (size) = L1_SIZE)
 
 void   pmap_bootstrap(vm_offset_t, vm_paddr_t, vm_size_t);
-void   pmap_kenter(vm_offset_t, vm_paddr_t);
 void   pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t);
 vm_paddr_t pmap_kextract(vm_offset_t va);
 void   pmap_kremove(vm_offset_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: r286955 - in head/sys: net netinet netinet6

2015-08-20 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu Aug 20 12:05:17 2015
New Revision: 286955
URL: https://svnweb.freebsd.org/changeset/base/286955

Log:
  * Split allocation and table linking for lle's.
Before that, the logic besides lle_create() was the following:
return existing if found, create if not. This behaviour was error-prone
since we had to deal with 'sudden' staticdynamic lle changes.
This commit fixes bunch of different issues like:
- refcount leak when lle is converted to static.
  Simple check case:
  console 1:
  while true;
do for i in `arp -an|awk '$4~/incomp/{print$2}'|tr -d '()'`;
  do arp -s $i 00:22:44:66:88:00 ; arp -d $i;
done;
  done
 console 2:
  ping -f any-dead-host-in-L2
 console 3:
  # watch for memory consumption:
  vmstat -m | awk '$1~/lltable/{print$2}'
- possible problems in arptimer() / nd6_timer() when dropping/reacquiring
 lock.
New logic explicitly handles use-or-create cases in every lla_create
user. Basically, most of the changes are purely mechanical. However,
we explicitly avoid using existing lle's for interface/static LLE records.
  * While here, call lle_event handlers on all real table lle change.
  * Create lltable_free_entry() calling existing per-lltable
lle_free_t callback for entry deletion

Modified:
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h
  head/sys/netinet/if_ether.c
  head/sys/netinet/in.c
  head/sys/netinet/toecore.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h

Modified: head/sys/net/if_llatbl.c
==
--- head/sys/net/if_llatbl.cThu Aug 20 11:26:26 2015(r286954)
+++ head/sys/net/if_llatbl.cThu Aug 20 12:05:17 2015(r286955)
@@ -228,7 +228,7 @@ htable_prefix_free(struct lltable *llt, 
IF_AFDATA_WUNLOCK(llt-llt_ifp);
 
LIST_FOREACH_SAFE(lle, pmd.dchain, lle_chain, next)
-   llt-llt_free_entry(llt, lle);
+   lltable_free_entry(llt, lle);
 }
 
 static void
@@ -278,10 +278,13 @@ lltable_drop_entry_queue(struct llentry 
 }
 
 /*
- * Deletes an address from the address table.
- * This function is called by the timer functions
- * such as arptimer() and nd6_llinfo_timer(), and
- * the caller does the locking.
+ *
+ * Performes generic cleanup routines and frees lle.
+ *
+ * Called for non-linked entries, with callouts and
+ * other AF-specific cleanups performed.
+ *
+ * @lle must be passed WLOCK'ed
  *
  * Returns the number of held packets, if any, that were dropped.
  */
@@ -316,21 +319,35 @@ struct llentry *
 llentry_alloc(struct ifnet *ifp, struct lltable *lt,
 struct sockaddr_storage *dst)
 {
-   struct llentry *la;
+   struct llentry *la, *la_tmp;
 
IF_AFDATA_RLOCK(ifp);
la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst);
IF_AFDATA_RUNLOCK(ifp);
-   if ((la == NULL) 
-   (ifp-if_flags  (IFF_NOARP | IFF_STATICARP)) == 0) {
-   IF_AFDATA_WLOCK(ifp);
-   la = lla_create(lt, 0, (struct sockaddr *)dst);
-   IF_AFDATA_WUNLOCK(ifp);
-   }
 
if (la != NULL) {
LLE_ADDREF(la);
LLE_WUNLOCK(la);
+   return (la);
+   }
+
+   if ((ifp-if_flags  (IFF_NOARP | IFF_STATICARP)) == 0) {
+   la = lltable_alloc_entry(lt, 0, (struct sockaddr *)dst);
+   if (la == NULL)
+   return (NULL);
+   IF_AFDATA_WLOCK(ifp);
+   LLE_WLOCK(la);
+   /* Prefer any existing LLE over newly-created one */
+   la_tmp = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst);
+   if (la_tmp == NULL)
+   lltable_link_entry(lt, la);
+   IF_AFDATA_WUNLOCK(ifp);
+   if (la_tmp != NULL) {
+   lltable_free_entry(lt, la);
+   la = la_tmp;
+   }
+   LLE_ADDREF(la);
+   LLE_WUNLOCK(la);
}
 
return (la);
@@ -483,6 +500,21 @@ lltable_foreach_lle(struct lltable *llt,
return (llt-llt_foreach_entry(llt, f, farg));
 }
 
+struct llentry *
+lltable_alloc_entry(struct lltable *llt, u_int flags,
+const struct sockaddr *l3addr)
+{
+
+   return (llt-llt_alloc_entry(llt, flags, l3addr));
+}
+
+void
+lltable_free_entry(struct lltable *llt, struct llentry *lle)
+{
+
+   llt-llt_free_entry(llt, lle);
+}
+
 void
 lltable_link_entry(struct lltable *llt, struct llentry *lle)
 {
@@ -531,7 +563,7 @@ lla_rt_output(struct rt_msghdr *rtm, str
struct sockaddr *dst = (struct sockaddr *)info-rti_info[RTAX_DST];
struct ifnet *ifp;
struct lltable *llt;
-   struct llentry *lle;
+   struct llentry *lle, *lle_tmp;
u_int laflags = 0;
int error;
 
@@ -560,13 +592,9 @@ lla_rt_output(struct rt_msghdr *rtm, str
switch 

svn commit: r286954 - head/sys/arm64/include

2015-08-20 Thread Andrew Turner
Author: andrew
Date: Thu Aug 20 11:26:26 2015
New Revision: 286954
URL: https://svnweb.freebsd.org/changeset/base/286954

Log:
  Add the arm64 minidump header. This was missed from r286953.

Added:
  head/sys/arm64/include/minidump.h
 - copied, changed from r286130, head/sys/i386/include/minidump.h

Copied and modified: head/sys/arm64/include/minidump.h (from r286130, 
head/sys/i386/include/minidump.h)
==
--- head/sys/i386/include/minidump.hFri Jul 31 14:17:26 2015
(r286130, copy source)
+++ head/sys/arm64/include/minidump.h   Thu Aug 20 11:26:26 2015
(r286954)
@@ -23,13 +23,14 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
+ * From i386: FreeBSD:  157909 2006-04-21 04:28:43Z peter
  * $FreeBSD$
  */
 
 #ifndef_MACHINE_MINIDUMP_H_
 #define_MACHINE_MINIDUMP_H_ 1
 
-#defineMINIDUMP_MAGIC  minidump FreeBSD/i386
+#defineMINIDUMP_MAGIC  minidump FreeBSD/arm64
 #defineMINIDUMP_VERSION1
 
 struct minidumphdr {
@@ -37,9 +38,11 @@ struct minidumphdr {
uint32_t version;
uint32_t msgbufsize;
uint32_t bitmapsize;
-   uint32_t ptesize;
-   uint32_t kernbase;
-   uint32_t paemode;
+   uint32_t pmapsize;
+   uint64_t kernbase;
+   uint64_t dmapphys;
+   uint64_t dmapbase;
+   uint64_t dmapend;
 };
 
 #endif /* _MACHINE_MINIDUMP_H_ */
___
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: r286956 - in head/sys/arm64: arm64 include

2015-08-20 Thread Andrew Turner
Author: andrew
Date: Thu Aug 20 12:05:42 2015
New Revision: 286956
URL: https://svnweb.freebsd.org/changeset/base/286956

Log:
  Add pmap_get_tables to get the page tables for a given virtual address. This
  will be used for minidump support.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/pmap.c
  head/sys/arm64/include/pmap.h

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Aug 20 12:05:17 2015(r286955)
+++ head/sys/arm64/arm64/pmap.c Thu Aug 20 12:05:42 2015(r286956)
@@ -314,6 +314,40 @@ pmap_l3(pmap_t pmap, vm_offset_t va)
return (pmap_l2_to_l3(l2, va));
 }
 
+bool
+pmap_get_tables(pmap_t pmap, vm_offset_t va, pd_entry_t **l1, pd_entry_t **l2,
+pt_entry_t **l3)
+{
+   pd_entry_t *l1p, *l2p;
+
+   if (pmap-pm_l1 == NULL)
+   return (false);
+
+   l1p = pmap_l1(pmap, va);
+   *l1 = l1p;
+
+   if ((*l1p  ATTR_DESCR_MASK) == L1_BLOCK) {
+   *l2 = NULL;
+   *l3 = NULL;
+   return (true);
+   }
+
+   if ((*l1p  ATTR_DESCR_MASK) != L1_TABLE)
+   return (false);
+
+   l2p = pmap_l1_to_l2(l1p, va);
+   *l2 = l2p;
+
+   if ((*l2p  ATTR_DESCR_MASK) == L2_BLOCK) {
+   *l3 = NULL;
+   return (true);
+   }
+
+   *l3 = pmap_l2_to_l3(l2p, va);
+
+   return (true);
+}
+
 /*
  * These load the old table data and store the new value.
  * They need to be atomic as the System MMU may write to the table at

Modified: head/sys/arm64/include/pmap.h
==
--- head/sys/arm64/include/pmap.h   Thu Aug 20 12:05:17 2015
(r286955)
+++ head/sys/arm64/include/pmap.h   Thu Aug 20 12:05:42 2015
(r286956)
@@ -149,6 +149,9 @@ voidpmap_unmapbios(vm_offset_t, vm_size
 boolean_t pmap_map_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t);
 void   pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t);
 
+bool   pmap_get_tables(pmap_t, vm_offset_t, pd_entry_t **, pd_entry_t **,
+pt_entry_t **);
+
 #definepmap_page_is_mapped(m)  (!TAILQ_EMPTY((m)-md.pv_list))
 
 #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: r286978 - head/lib/libc/sys

2015-08-20 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Fri Aug 21 02:42:14 2015
New Revision: 286978
URL: https://svnweb.freebsd.org/changeset/base/286978

Log:
  Editing pass on procctl.2
  
  Spell descendant correctly.
  
  Grammar fixes.
  
  Use correct width argument to Bl.
  
  Use Po and Pc to avoid leaving a dangling '(' on the end of a line.

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

Modified: head/lib/libc/sys/procctl.2
==
--- head/lib/libc/sys/procctl.2 Fri Aug 21 02:41:35 2015(r286977)
+++ head/lib/libc/sys/procctl.2 Fri Aug 21 02:42:14 2015(r286978)
@@ -71,11 +71,11 @@ The control request to perform is specif
 .Fa cmd
 argument.
 The following commands are supported:
-.Bl -tag -width Dv PROC_REAP_GETPIDS
+.Bl -tag -width PROC_REAP_GETPIDS
 .It Dv PROC_SPROTECT
 Set process protection state.
 This is used to mark a process as protected from being killed if the system
-exhausts available memory and swap.
+exhausts the available memory and swap.
 The
 .Fa arg
 parameter must point to an integer containing an operation and zero or more
@@ -89,7 +89,7 @@ Clear the protected state of selected pr
 .El
 .Pp
 The following optional flags are supported:
-.Bl -tag -width Dv PPROT_DESCE
+.Bl -tag -width Dv PPROT_DESCEND
 .It Dv PPROT_DESCEND
 Apply the requested operation to all child processes of each selected process
 in addition to each selected process.
@@ -101,18 +101,18 @@ Future child processes will also mark al
 .El
 .It Dv PROC_REAP_ACQUIRE
 Acquires the reaper status for the current process.
-The status means that children orphaned by the reaper's descendants
-that were forked after the acquisition of the status are reparented to the
-reaper.
-After the system initialization,
+Reaper status means that children orphaned by the reaper's descendants
+that were forked after the acquisition of reaper status are reparented to the
+reaper process.
+After system initialization,
 .Xr init 8
 is the default reaper.
 .It Dv PROC_REAP_RELEASE
-Releases the reaper state for the current process.
+Release the reaper state for the current process.
 The reaper of the current process becomes the new reaper of the
 current process's descendants.
 .It Dv PROC_REAP_STATUS
-Provides the information about the reaper of the specified process,
+Provides information about the reaper of the specified process,
 or the process itself when it is a reaper.
 The
 .Fa data
@@ -133,7 +133,7 @@ The
 may have the following flags returned:
 .Bl -tag -width Dv REAPER_STATUS_REALINIT
 .It Dv REAPER_STATUS_OWNED
-The specified process has acquired the reaper status and has not
+The specified process has acquired reaper status and has not
 released it.
 When the flag is returned, the specified process
 .Fa id ,
@@ -142,15 +142,15 @@ pid, identifies the reaper, otherwise th
 field of the structure is set to the pid of the reaper
 for the specified process id.
 .It Dv REAPER_STATUS_REALINIT
-The specified process is the root of the reaper tree, i.e.
+The specified process is the root of the reaper tree, i.e.,
 .Xr init 8 .
 .El
 .Pp
 The
 .Fa rs_children
-field returns the number of children of the reaper among the descendands.
-It is possible to have a child which reaper is not the specified process,
-since the reaper for the existing children is not reset on the
+field returns the number of children of the reaper among the descendants.
+It is possible to have a child whose reaper is not the specified process,
+since the reaper for any existing children is not reset on the
 .Dv PROC_REAP_ACQUIRE
 operation.
 The
@@ -246,7 +246,7 @@ struct procctl_reaper_kill {
 The
 .Fa rk_sig
 field specifies the signal to be delivered.
-Zero is not a valid signal number, unlike
+Zero is not a valid signal number, unlike for
 .Xr kill 2 .
 The
 .Fa rk_flags
@@ -275,20 +275,20 @@ field identifies the number of processes
 The
 .Fa rk_fpid
 field is set to the pid of the first process for which signal
-delivery failed, e.g. due to the permission problems.
-If no such process exist, the
+delivery failed, e.g., due to permission problems.
+If no such process exists, the
 .Fa rk_fpid
 field is set to -1.
 .It Dv PROC_TRACE_CTL
 Enable or disable tracing of the specified process(es), according to the
 value of the integer argument.
-Tracing includes attachment to the process using
+Tracing includes attachment to the process using the
 .Xr ptrace 2
 and
 .Xr ktrace 2 ,
 debugging sysctls,
 .Xr hwpmc 4 ,
-.Xr dtrace 1
+.Xr dtrace 1 ,
 and core dumping.
 Possible values for the
 .Fa data
@@ -301,7 +301,7 @@ Only allowed for self.
 .It Dv PROC_TRACE_CTL_DISABLE
 Disable tracing for the specified process.
 Tracing is re-enabled when the process changes the executing
-program with
+program with the
 .Xr execve 2
 syscall.
 A child inherits the trace settings from the parent on
@@ -309,7 +309,7 @@ A child inherits the trace settings from
 .It Dv PROC_TRACE_CTL_DISABLE_EXEC
 Same as
 .Dv 

svn commit: r286976 - head/sys/powerpc/mpc85xx

2015-08-20 Thread Justin Hibbits
Author: jhibbits
Date: Fri Aug 21 02:22:51 2015
New Revision: 286976
URL: https://svnweb.freebsd.org/changeset/base/286976

Log:
  Simplify the PCI bus scanning logic.
  
  Rather than special casing on PCIC_BRIDGE || PCIC_PROCESSOR, allow all
  HDRTYPE_BRIDGE types.
  
  Obtained from:Semihalf
  Sponsored by: Alex Perez/Intertial Computing

Modified:
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Thu Aug 20 22:44:26 2015
(r286975)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Fri Aug 21 02:22:51 2015
(r286976)
@@ -265,7 +265,7 @@ fsl_pcib_attach(device_t dev)
 */
sc-sc_busnr = 0;
maxslot = (sc-sc_pcie) ? 0 : PCI_SLOTMAX;
-   fsl_pcib_init(sc, sc-sc_busnr, maxslot);
+   sc-sc_busnr = fsl_pcib_init(sc, sc-sc_busnr, maxslot);
 
if (sc-sc_pcie) {
ltssm = fsl_pcib_cfgread(sc, 0, 0, 0, PCIR_LTSSM, 1);
@@ -570,19 +570,8 @@ fsl_pcib_init(struct fsl_pcib_softc *sc,
subclass = fsl_pcib_read_config(sc-sc_dev, bus, slot,
func, PCIR_SUBCLASS, 1);
 
-   /*
-* The PCI Root Complex comes up as a Processor/PowerPC,
-* but is a bridge.
-*/
-   /* Allow only proper PCI-PCI briges */
-   if (class != PCIC_BRIDGE  class != PCIC_PROCESSOR)
-   continue;
-   if (subclass != PCIS_BRIDGE_PCI 
-   subclass != PCIS_PROCESSOR_POWERPC)
-   continue;
-
-   if (subclass == PCIS_PROCESSOR_POWERPC 
-   hdrtype != PCIM_HDRTYPE_BRIDGE)
+   /* Allow all DEVTYPE 1 devices */
+   if (hdrtype != PCIM_HDRTYPE_BRIDGE)
continue;
 
secbus++;
___
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: r286977 - head/sys/powerpc/booke

2015-08-20 Thread Justin Hibbits
Author: jhibbits
Date: Fri Aug 21 02:41:35 2015
New Revision: 286977
URL: https://svnweb.freebsd.org/changeset/base/286977

Log:
  Add initial boot support for e500mc and e5500.
  
  * Since r257190 the kernel must actually be loaded at a 64MB boundary, not 
16MB.
  * Don't program HID1 register on e500mc or e5500, they don't have this SPR.
  * Set proper HID0 defaults for these new architectures.
  
  There is still more work to be done for the various SoCs, and the PMAP code
  still needs to be extended to 36-bit paddr, coming soon.
  
  Obtained from:Semihalf
  Sponsored by: Alex Perez/Inertial Computing

Modified:
  head/sys/powerpc/booke/locore.S

Modified: head/sys/powerpc/booke/locore.S
==
--- head/sys/powerpc/booke/locore.S Fri Aug 21 02:22:51 2015
(r286976)
+++ head/sys/powerpc/booke/locore.S Fri Aug 21 02:41:35 2015
(r286977)
@@ -61,11 +61,11 @@ __start:
 
 /*
  * Assumptions on the boot loader:
- *  - system memory starts from physical address 0
- *  - it's mapped by a single TBL1 entry
+ *  - System memory starts from physical address 0
+ *  - It's mapped by a single TLB1 entry
  *  - TLB1 mapping is 1:1 pa to va
- *  - kernel is loaded at 16MB boundary
- *  - all PID registers are set to the same value
+ *  - Kernel is loaded at 64MB boundary
+ *  - All PID registers are set to the same value
  *  - CPU is running in AS=0
  *
  * Registers contents provided by the loader(8):
@@ -73,14 +73,14 @@ __start:
  * r3  : metadata pointer
  *
  * We rearrange the TLB1 layout as follows:
- *  - find TLB1 entry we started in
- *  - make sure it's protected, ivalidate other entries
- *  - create temp entry in the second AS (make sure it's not TLB[1])
- *  - switch to temp mapping
- *  - map 16MB of RAM in TLB1[1]
- *  - use AS=1, set EPN to KERNBASE and RPN to kernel load address
- *  - switch to to TLB1[1] mapping
- *  - invalidate temp mapping
+ *  - Find TLB1 entry we started in
+ *  - Make sure it's protected, invalidate other entries
+ *  - Create temp entry in the second AS (make sure it's not TLB[1])
+ *  - Switch to temp mapping
+ *  - Map 64MB of RAM in TLB1[1]
+ *  - Use AS=1, set EPN to KERNBASE and RPN to kernel load address
+ *  - Switch to to TLB1[1] mapping
+ *  - Invalidate temp mapping
  *
  * locore registers use:
  * r1  : stack pointer
@@ -104,15 +104,44 @@ __start:
mtmsr   %r3
isync
 
-   lis %r3, HID0_E500_DEFAULT_SET@h
-   ori %r3, %r3, HID0_E500_DEFAULT_SET@l
-   mtspr   SPR_HID0, %r3
+   mfpvr   %r3
+   rlwinm  %r3, %r3, 16, 16, 31
+
+   lis %r4, HID0_E500_DEFAULT_SET@h
+   ori %r4, %r4, HID0_E500_DEFAULT_SET@l
+
+   /* Check for e500mc and e5500 */
+   cmpli   0, 0, %r3, FSL_E500mc
+   bne 2f
+
+   lis %r4, HID0_E500MC_DEFAULT_SET@h
+   ori %r4, %r4, HID0_E500MC_DEFAULT_SET@l
+   b   3f
+2:
+   cmpli   0, 0, %r3, FSL_E5500
+   bne 3f
+
+   lis %r4, HID0_E5500_DEFAULT_SET@h
+   ori %r4, %r4, HID0_E5500_DEFAULT_SET@l
+
+3:
+   mtspr   SPR_HID0, %r4
isync
+
+/*
+ * E500mc and E5500 do not have HID1 register, so skip HID1 setup on
+ * this core.
+ */
+   cmpli   0, 0, %r3, FSL_E500mc
+   beq 1f
+   cmpli   0, 0, %r3, FSL_E5500
+   beq 1f
+
lis %r3, HID1_E500_DEFAULT_SET@h
ori %r3, %r3, HID1_E500_DEFAULT_SET@l
mtspr   SPR_HID1, %r3
isync
-
+1:
/* Invalidate all entries in TLB0 */
li  %r3, 0
bl  tlb_inval_all
@@ -153,10 +182,10 @@ __start:
 /*
  * Setup final mapping in TLB1[1] and switch to it
  */
-   /* Final kernel mapping, map in 16 MB of RAM */
+   /* Final kernel mapping, map in 64 MB of RAM */
lis %r3, MAS0_TLBSEL1@h /* Select TLB1 */
li  %r4, 0  /* Entry 0 */
-   rlwimi  %r3, %r4, 16, 12, 15
+   rlwimi  %r3, %r4, 16, 10, 15
mtspr   SPR_MAS0, %r3
isync
 
@@ -176,10 +205,12 @@ __start:
/* Discover phys load address */
bl  3f
 3: mflr%r4 /* Use current address */
-   rlwinm  %r4, %r4, 0, 0, 7   /* 16MB alignment mask */
+   rlwinm  %r4, %r4, 0, 0, 5   /* 64MB alignment mask */
ori %r4, %r4, (MAS3_SX | MAS3_SW | MAS3_SR)@l
mtspr   SPR_MAS3, %r4   /* Set RPN and protection */
isync
+   bl  zero_mas7
+   bl  zero_mas8
tlbwe
isync
msync
@@ -281,15 +312,40 @@ bp_tlb1_end:
 1: mflr%r31/* r31 hold the address of bp_ntlb1s */
 
/* Set HIDs */
-   lis %r3, HID0_E500_DEFAULT_SET@h
-   ori %r3, %r3, HID0_E500_DEFAULT_SET@l
-   mtspr   SPR_HID0, %r3
-   isync
+   mfpvr   %r3
+   rlwinm  %r3, %r3, 16, 16, 31
+
+   /* HID0 for E500 is default */
+   lis 

svn commit: r286967 - head/sys/boot/efi

2015-08-20 Thread Warner Losh
Author: imp
Date: Thu Aug 20 18:31:05 2015
New Revision: 286967
URL: https://svnweb.freebsd.org/changeset/base/286967

Log:
  The flags -mno-aes -mno-avx only exist for clang, not gcc, so
  add them only to the clang CFLAGS.

Modified:
  head/sys/boot/efi/Makefile.inc

Modified: head/sys/boot/efi/Makefile.inc
==
--- head/sys/boot/efi/Makefile.inc  Thu Aug 20 18:22:06 2015
(r286966)
+++ head/sys/boot/efi/Makefile.inc  Thu Aug 20 18:31:05 2015
(r286967)
@@ -14,7 +14,8 @@ LDFLAGS+= -nostdlib
 .if ${MACHINE_CPUARCH} == amd64
 CFLAGS+=   -fshort-wchar
 CFLAGS+=   -mno-red-zone
-CFLAGS+=   -mno-mmx -mno-sse -mno-aes -mno-avx
+CFLAGS+=   -mno-mmx -mno-sse
+CFLAGS.clang+= -mno-aes -mno-avx
 .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: r286966 - head/share/man/man9

2015-08-20 Thread Bryan Drewery
Author: bdrewery
Date: Thu Aug 20 18:22:06 2015
New Revision: 286966
URL: https://svnweb.freebsd.org/changeset/base/286966

Log:
  Add link for rw_unlock(9) to rwlock(9).
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileThu Aug 20 16:07:51 2015
(r286965)
+++ head/share/man/man9/MakefileThu Aug 20 18:22:06 2015
(r286966)
@@ -1355,6 +1355,7 @@ MLINKS+=rwlock.9 rw_assert.9 \
rwlock.9 rw_initialized.9 \
rwlock.9 rw_rlock.9 \
rwlock.9 rw_runlock.9 \
+   rwlock.9 rw_unlock.9 \
rwlock.9 rw_sleep.9 \
rwlock.9 RW_SYSINIT.9 \
rwlock.9 rw_try_rlock.9 \
___
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: r286955 - in head/sys: net netinet netinet6

2015-08-20 Thread Alexander V . Chernikov
20.08.2015, 16:29, Bjoern A. Zeeb b...@freebsd.org:
  On 20 Aug 2015, at 13:13 , George Neville-Neil g...@neville-neil.com 
 wrote:

  Why was this work not in Phabricator? This is a large change that has not 
 been reviewed,
  as far as I can tell, by anyone else on the project. I am tempted to ask 
 that this be backed out
  and reviewed BEFORE it goes into the tree.

 I probably wouldn’t go as far as backing out.

 Given this seems part of a larger change that seem to be streamed into HEAD 
 and I have probably missed a posting or heads up or something on net@ [if 
 someone could point me at that it would be very helpful], I appreciate things 
 being broken into smaller reviewable bits. I have no clear idea of what the 
 end goal is or will be or look like, which makes it hard to comment on design 
 decisions.
This is really the part of large change. The posting itself is here: 
https://wiki.freebsd.org/ProjectsRoutingProposal
It was actually implemented (in slightly different way) in projects/routing 
branch. Unfortunately, I had to postpone that until recently. HEAD changed 
significantly since then, so merging is a bit complex.
I've got routing part merged (and I'll update projects/routing branch within a 
few days). However, there are bunch of general lle changes, related to code 
cleanup. So, my plan was to merge these, update projects/routing branch so 
anyone can clearly see the difference on fresh HEAD and create a bunch of 
reviews with proposed locking / timer changes for lle (and do the same for 
routing changes). But currently we're here..


 I however, as I have stated in the past, would really really appreciate each 
 change in PB, with the proposed commit message, and allow a few days of 
 review or for people to comment on. I have spend two years on fixing bugs on 
 the previous rewrite of that code. I am not exactly looking forward to see 
 history repeat itself.
I see no problem in sending changes there for design changes and I actually do 
prefer PB for that. I actually not against using PB for everything, but here we 
come very close to exact definition of a few days.
My intentions on the last commits were actually to ease the review of upcoming 
stuff, not to push-everything-without-review.


 Thanks,
 Bjoern
___
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: r286962 - head/usr.bin/truss

2015-08-20 Thread John Baldwin
Author: jhb
Date: Thu Aug 20 14:33:30 2015
New Revision: 286962
URL: https://svnweb.freebsd.org/changeset/base/286962

Log:
  Rework the argv and env string fetching for execve to be more robust.
  Before truss would fetch 100 string pointers and happily walk off the end
  of the array if it never found a NULL.  This also means for a short argv
  list it could fail entirely if the 100 string pointers spanned into an
  unmapped page.
  
  Instead, fetch page-aligned blocks of string pointers in a loop fetching
  each string until a NULL is found.
  
  While here, make use of the open memstream file descriptor instead of
  allocating a temporary array.  This allows us to fetch each string once
  instead of twice.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Thu Aug 20 14:03:03 2015
(r286961)
+++ head/usr.bin/truss/syscalls.c   Thu Aug 20 14:33:30 2015
(r286962)
@@ -913,36 +913,54 @@ print_arg(struct syscall_args *sc, unsig
break;
}
case StringArray: {
-   int num, size, i;
-   char *tmp2;
+   uintptr_t addr;
+   union {
+   char *strarray[0];
+   char buf[PAGE_SIZE];
+   } u;
char *string;
-   char *strarray[100];/* XXX This is ugly. */
+   size_t len;
+   int first, i;
 
-   if (get_struct(pid, (void *)args[sc-offset],
-   (void *)strarray, sizeof(strarray)) == -1)
-   err(1, get_struct %p, (void *)args[sc-offset]);
-   num = 0;
-   size = 0;
-
-   /* Find out how large of a buffer we'll need. */
-   while (strarray[num] != NULL) {
-   string = get_string(pid, (void*)strarray[num], 0);
-   size += strlen(string);
-   free(string);
-   num++;
+   /*
+* Read a page of pointers at a time.  Punt if the top-level
+* pointer is not aligned.  Note that the first read is of
+* a partial page.
+*/
+   addr = args[sc-offset];
+   if (addr % sizeof(char *) != 0) {
+   fprintf(fp, 0x%lx, args[sc-offset]);
+   break;
+   }
+
+   len = PAGE_SIZE - (addr  PAGE_MASK);
+   if (get_struct(pid, (void *)addr, u.buf, len) == -1) {
+   fprintf(fp, 0x%lx, args[sc-offset]);
+   break;
}
-   size += 4 + (num * 4);
-   tmp = (char *)malloc(size);
-   tmp2 = tmp;
-
-   tmp2 += sprintf(tmp2,  [);
-   for (i = 0; i  num; i++) {
-   string = get_string(pid, (void*)strarray[i], 0);
-   tmp2 += sprintf(tmp2,  \%s\%c, string,
-   (i + 1 == num) ? ' ' : ',');
+
+   fputc('[', fp);
+   first = 1;
+   i = 0;
+   while (u.strarray[i] != NULL) {
+   string = get_string(pid, u.strarray[i], 0);
+   fprintf(fp, %s \%s\, first ?  : ,, string);
free(string);
+   first = 0;
+
+   i++;
+   if (i == len / sizeof(char *)) {
+   addr += len;
+   len = PAGE_SIZE;
+   if (get_struct(pid, (void *)addr, u.buf, len) ==
+   -1) {
+   fprintf(fp, , inval);
+   break;
+   }
+   i = 0;
+   }
}
-   tmp2 += sprintf(tmp2, ]);
+   fputs( ], fp);
break;
}
 #ifdef __LP64__
___
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: r286963 - head/usr.bin/truss

2015-08-20 Thread John Baldwin
Author: jhb
Date: Thu Aug 20 14:51:11 2015
New Revision: 286963
URL: https://svnweb.freebsd.org/changeset/base/286963

Log:
  Handle the conditional decoding of execve() argument and environment
  arrays generically rather than duplicating a hack in all of the backends.
  - Add two new system call argument types and use them instead of StringArray
for the argument and environment arguments execve and linux_execve.
  - Honor the -a/-e flags in the handling of these new types.
  - Instead of printing missing argument when the decoding is disabled,
print the raw pointer value.

Modified:
  head/usr.bin/truss/amd64-fbsd.c
  head/usr.bin/truss/amd64-fbsd32.c
  head/usr.bin/truss/amd64-linux32.c
  head/usr.bin/truss/arm-fbsd.c
  head/usr.bin/truss/i386-fbsd.c
  head/usr.bin/truss/i386-linux.c
  head/usr.bin/truss/mips-fbsd.c
  head/usr.bin/truss/powerpc-fbsd.c
  head/usr.bin/truss/powerpc64-fbsd.c
  head/usr.bin/truss/sparc64-fbsd.c
  head/usr.bin/truss/syscall.h
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/amd64-fbsd.c
==
--- head/usr.bin/truss/amd64-fbsd.c Thu Aug 20 14:33:30 2015
(r286962)
+++ head/usr.bin/truss/amd64-fbsd.c Thu Aug 20 14:51:11 2015
(r286963)
@@ -233,28 +233,6 @@ amd64_syscall_entry(struct trussinfo *tr
fprintf(trussinfo-outfile, \n);
 #endif
 
-   if (fsc-name != NULL  (strcmp(fsc-name, execve) == 0 ||
-   strcmp(fsc-name, exit) == 0)) {
-   /*
-* XXX
-* This could be done in a more general
-* manner but it still wouldn't be very pretty.
-*/
-   if (strcmp(fsc-name, execve) == 0) {
-   if ((trussinfo-flags  EXECVEARGS) == 0) {
-   if (fsc-s_args[1]) {
-   free(fsc-s_args[1]);
-   fsc-s_args[1] = NULL;
-   }
-   }
-   if ((trussinfo-flags  EXECVEENVS) == 0) {
-   if (fsc-s_args[2]) {
-   free(fsc-s_args[2]);
-   fsc-s_args[2] = NULL;
-   }
-   }
-   }
-   }
trussinfo-curthread-fsc = fsc;
 }
 

Modified: head/usr.bin/truss/amd64-fbsd32.c
==
--- head/usr.bin/truss/amd64-fbsd32.c   Thu Aug 20 14:33:30 2015
(r286962)
+++ head/usr.bin/truss/amd64-fbsd32.c   Thu Aug 20 14:51:11 2015
(r286963)
@@ -233,28 +233,6 @@ amd64_fbsd32_syscall_entry(struct trussi
fprintf(trussinfo-outfile, \n);
 #endif
 
-   if (fsc-name != NULL  (strcmp(fsc-name, freebsd32_execve) == 0 ||
-   strcmp(fsc-name, exit) == 0)) {
-   /*
-* XXX
-* This could be done in a more general
-* manner but it still wouldn't be very pretty.
-*/
-   if (strcmp(fsc-name, freebsd32_execve) == 0) {
-   if ((trussinfo-flags  EXECVEARGS) == 0) {
-   if (fsc-s_args[1]) {
-   free(fsc-s_args[1]);
-   fsc-s_args[1] = NULL;
-   }
-   }
-   if ((trussinfo-flags  EXECVEENVS) == 0) {
-   if (fsc-s_args[2]) {
-   free(fsc-s_args[2]);
-   fsc-s_args[2] = NULL;
-   }
-   }
-   }
-   }
trussinfo-curthread-fsc = fsc;
 }
 

Modified: head/usr.bin/truss/amd64-linux32.c
==
--- head/usr.bin/truss/amd64-linux32.c  Thu Aug 20 14:33:30 2015
(r286962)
+++ head/usr.bin/truss/amd64-linux32.c  Thu Aug 20 14:51:11 2015
(r286963)
@@ -206,28 +206,6 @@ amd64_linux32_syscall_entry(struct truss
fprintf(trussinfo-outfile, \n);
 #endif
 
-   if (fsc-name != NULL  (strcmp(fsc-name, linux_execve) == 0 ||
-   strcmp(fsc-name, exit) == 0)) {
-   /*
-* XXX
-* This could be done in a more general
-* manner but it still wouldn't be very pretty.
-*/
-   if (strcmp(fsc-name, linux_execve) == 0) {
-   if ((trussinfo-flags  EXECVEARGS) == 0) {
-   if (fsc-s_args[1]) {
-   free(fsc-s_args[1]);
-   fsc-s_args[1] = NULL;
-   }
-   }
-   if ((trussinfo-flags  EXECVEENVS) == 0) {

svn commit: r286958 - in head/sys: arm64/arm64 vm

2015-08-20 Thread Andrew Turner
Author: andrew
Date: Thu Aug 20 12:49:56 2015
New Revision: 286958
URL: https://svnweb.freebsd.org/changeset/base/286958

Log:
  Add the kernel support for minidumps on arm64.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D3318

Modified:
  head/sys/arm64/arm64/minidump_machdep.c
  head/sys/arm64/arm64/uma_machdep.c
  head/sys/vm/vm_page.c

Modified: head/sys/arm64/arm64/minidump_machdep.c
==
--- head/sys/arm64/arm64/minidump_machdep.c Thu Aug 20 12:07:44 2015
(r286957)
+++ head/sys/arm64/arm64/minidump_machdep.c Thu Aug 20 12:49:56 2015
(r286958)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2006 Peter Wemm
  * Copyright (c) 2015 The FreeBSD Foundation
  * All rights reserved.
  *
@@ -8,6 +9,7 @@
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
+ *
  * 1. Redistributions of source code must retain the above copyright
  *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
@@ -32,19 +34,434 @@ __FBSDID($FreeBSD$);
 
 #include opt_watchdog.h
 
+#include opt_watchdog.h
+
 #include sys/param.h
 #include sys/systm.h
 #include sys/conf.h
+#include sys/cons.h
 #include sys/kernel.h
 #include sys/kerneldump.h
+#include sys/msgbuf.h
+#include sys/watchdog.h
+
+#include vm/vm.h
+#include vm/vm_param.h
+#include vm/vm_page.h
+#include vm/vm_phys.h
+#include vm/pmap.h
 
 #include machine/md_var.h
+#include machine/pmap.h
+#include machine/pte.h
+#include machine/vmparam.h
+#include machine/minidump.h
+
+CTASSERT(sizeof(struct kerneldumpheader) == 512);
+
+/*
+ * Don't touch the first SIZEOF_METADATA bytes on the dump device. This
+ * is to protect us from metadata and to protect metadata from us.
+ */
+#defineSIZEOF_METADATA (64*1024)
+
+uint64_t *vm_page_dump;
+int vm_page_dump_size;
+
+static struct kerneldumpheader kdh;
+static off_t dumplo;
+
+/* Handle chunked writes. */
+static size_t fragsz;
+static void *dump_va;
+static size_t counter, progress, dumpsize;
+
+static uint64_t tmpbuffer[PAGE_SIZE / sizeof(uint64_t)];
+
+CTASSERT(sizeof(*vm_page_dump) == 8);
+
+static int
+is_dumpable(vm_paddr_t pa)
+{
+   vm_page_t m;
+   int i;
+
+   if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
+   return ((m-flags  PG_NODUMP) == 0);
+   for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
+   if (pa = dump_avail[i]  pa  dump_avail[i + 1])
+   return (1);
+   }
+   return (0);
+}
+
+static int
+blk_flush(struct dumperinfo *di)
+{
+   int error;
+
+   if (fragsz == 0)
+   return (0);
+
+   error = dump_write(di, dump_va, 0, dumplo, fragsz);
+   dumplo += fragsz;
+   fragsz = 0;
+   return (error);
+}
+
+static struct {
+   int min_per;
+   int max_per;
+   int visited;
+} progress_track[10] = {
+   {  0,  10, 0},
+   { 10,  20, 0},
+   { 20,  30, 0},
+   { 30,  40, 0},
+   { 40,  50, 0},
+   { 50,  60, 0},
+   { 60,  70, 0},
+   { 70,  80, 0},
+   { 80,  90, 0},
+   { 90, 100, 0}
+};
+
+static void
+report_progress(size_t progress, size_t dumpsize)
+{
+   int sofar, i;
+
+   sofar = 100 - ((progress * 100) / dumpsize);
+   for (i = 0; i  nitems(progress_track); i++) {
+   if (sofar  progress_track[i].min_per ||
+   sofar  progress_track[i].max_per)
+   continue;
+   if (progress_track[i].visited)
+   return;
+   progress_track[i].visited = 1;
+   printf(..%d%%, sofar);
+   return;
+   }
+}
+
+static int
+blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
+{
+   size_t len;
+   int error, c;
+   u_int maxdumpsz;
+
+   maxdumpsz = min(di-maxiosize, MAXDUMPPGS * PAGE_SIZE);
+   if (maxdumpsz == 0) /* seatbelt */
+   maxdumpsz = PAGE_SIZE;
+   error = 0;
+   if ((sz % PAGE_SIZE) != 0) {
+   printf(size not page aligned\n);
+   return (EINVAL);
+   }
+   if (ptr != NULL  pa != 0) {
+   printf(cant have both va and pa!\n);
+   return (EINVAL);
+   }
+   if uintptr_t)pa) % PAGE_SIZE) != 0) {
+   printf(address not page aligned %p\n, ptr);
+   return (EINVAL);
+   }
+   if (ptr != NULL) {
+   /*
+* If we're doing a virtual dump, flush any
+* pre-existing pa pages.
+*/
+   error = blk_flush(di);
+   if (error)
+   return (error);
+   }
+   while (sz) {
+   len = 

svn commit: r286959 - in head/lib/libc/aarch64: . gen

2015-08-20 Thread Andrew Turner
Author: andrew
Date: Thu Aug 20 13:11:52 2015
New Revision: 286959
URL: https://svnweb.freebsd.org/changeset/base/286959

Log:
  Add the definitions of __infinity and __nan.

Added:
  head/lib/libc/aarch64/gen/infinity.c
 - copied, changed from r286954, head/lib/libc/amd64/gen/infinity.c
Modified:
  head/lib/libc/aarch64/Symbol.map
  head/lib/libc/aarch64/gen/Makefile.inc

Modified: head/lib/libc/aarch64/Symbol.map
==
--- head/lib/libc/aarch64/Symbol.mapThu Aug 20 12:49:56 2015
(r286958)
+++ head/lib/libc/aarch64/Symbol.mapThu Aug 20 13:11:52 2015
(r286959)
@@ -17,6 +17,8 @@ FBSD_1.0 {
__flt_rounds;
fpgetmask;
fpsetmask;
+   __infinity;
+   __nan;
setjmp;
longjmp;
sigsetjmp;

Modified: head/lib/libc/aarch64/gen/Makefile.inc
==
--- head/lib/libc/aarch64/gen/Makefile.inc  Thu Aug 20 12:49:56 2015
(r286958)
+++ head/lib/libc/aarch64/gen/Makefile.inc  Thu Aug 20 13:11:52 2015
(r286959)
@@ -5,6 +5,7 @@ SRCS+=  _ctx_start.S \
flt_rounds.c \
fpgetmask.c \
fpsetmask.c \
+   infinity.c \
ldexp.c \
makecontext.c \
_setjmp.S \

Copied and modified: head/lib/libc/aarch64/gen/infinity.c (from r286954, 
head/lib/libc/amd64/gen/infinity.c)
==
--- head/lib/libc/amd64/gen/infinity.c  Thu Aug 20 11:26:26 2015
(r286954, copy source)
+++ head/lib/libc/aarch64/gen/infinity.cThu Aug 20 13:11:52 2015
(r286959)
@@ -7,7 +7,7 @@ __FBSDID($FreeBSD$);
 
 #include math.h
 
-/* bytes for +Infinity on a 387 */
+/* bytes for +Infinity on aarch64 */
 const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
 
 /* bytes for NaN */
___
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: r286955 - in head/sys: net netinet netinet6

2015-08-20 Thread George Neville-Neil
Why was this work not in Phabricator?  This is a large change that has 
not been reviewed,
as far as I can tell, by anyone else on the project.  I am tempted to 
ask that this be backed out

and reviewed BEFORE it goes into the tree.

Best,
George


On 20 Aug 2015, at 13:05, Alexander V. Chernikov wrote:


Author: melifaro
Date: Thu Aug 20 12:05:17 2015
New Revision: 286955
URL: https://svnweb.freebsd.org/changeset/base/286955

Log:
* Split allocation and table linking for lle's.
 Before that, the logic besides lle_create() was the following:
 return existing if found, create if not. This behaviour was 
error-prone

 since we had to deal with 'sudden' staticdynamic lle changes.
 This commit fixes bunch of different issues like:
 - refcount leak when lle is converted to static.
   Simple check case:
   console 1:
   while true;
 do for i in `arp -an|awk '$4~/incomp/{print$2}'|tr -d '()'`;
   do arp -s $i 00:22:44:66:88:00 ; arp -d $i;
 done;
   done
  console 2:
   ping -f any-dead-host-in-L2
  console 3:
   # watch for memory consumption:
   vmstat -m | awk '$1~/lltable/{print$2}'
 - possible problems in arptimer() / nd6_timer() when 
dropping/reacquiring

  lock.
 New logic explicitly handles use-or-create cases in every lla_create
 user. Basically, most of the changes are purely mechanical. However,
 we explicitly avoid using existing lle's for interface/static LLE 
records.

* While here, call lle_event handlers on all real table lle change.
* Create lltable_free_entry() calling existing per-lltable
 lle_free_t callback for entry deletion

Modified:
head/sys/net/if_llatbl.c
head/sys/net/if_llatbl.h
head/sys/netinet/if_ether.c
head/sys/netinet/in.c
head/sys/netinet/toecore.c
head/sys/netinet6/in6.c
head/sys/netinet6/nd6.c
head/sys/netinet6/nd6.h

Modified: head/sys/net/if_llatbl.c
==
--- head/sys/net/if_llatbl.cThu Aug 20 11:26:26 2015(r286954)
+++ head/sys/net/if_llatbl.cThu Aug 20 12:05:17 2015(r286955)
@@ -228,7 +228,7 @@ htable_prefix_free(struct lltable *llt,
IF_AFDATA_WUNLOCK(llt-llt_ifp);

LIST_FOREACH_SAFE(lle, pmd.dchain, lle_chain, next)
-   llt-llt_free_entry(llt, lle);
+   lltable_free_entry(llt, lle);
}

static void
@@ -278,10 +278,13 @@ lltable_drop_entry_queue(struct llentry
}

/*
- * Deletes an address from the address table.
- * This function is called by the timer functions
- * such as arptimer() and nd6_llinfo_timer(), and
- * the caller does the locking.
+ *
+ * Performes generic cleanup routines and frees lle.
+ *
+ * Called for non-linked entries, with callouts and
+ * other AF-specific cleanups performed.
+ *
+ * @lle must be passed WLOCK'ed
*
* Returns the number of held packets, if any, that were dropped.
*/
@@ -316,21 +319,35 @@ struct llentry *
llentry_alloc(struct ifnet *ifp, struct lltable *lt,
  struct sockaddr_storage *dst)
{
-   struct llentry *la;
+   struct llentry *la, *la_tmp;

IF_AFDATA_RLOCK(ifp);
la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst);
IF_AFDATA_RUNLOCK(ifp);
-   if ((la == NULL) 
-   (ifp-if_flags  (IFF_NOARP | IFF_STATICARP)) == 0) {
-   IF_AFDATA_WLOCK(ifp);
-   la = lla_create(lt, 0, (struct sockaddr *)dst);
-   IF_AFDATA_WUNLOCK(ifp);
-   }

if (la != NULL) {
LLE_ADDREF(la);
LLE_WUNLOCK(la);
+   return (la);
+   }
+
+   if ((ifp-if_flags  (IFF_NOARP | IFF_STATICARP)) == 0) {
+   la = lltable_alloc_entry(lt, 0, (struct sockaddr *)dst);
+   if (la == NULL)
+   return (NULL);
+   IF_AFDATA_WLOCK(ifp);
+   LLE_WLOCK(la);
+   /* Prefer any existing LLE over newly-created one */
+   la_tmp = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst);
+   if (la_tmp == NULL)
+   lltable_link_entry(lt, la);
+   IF_AFDATA_WUNLOCK(ifp);
+   if (la_tmp != NULL) {
+   lltable_free_entry(lt, la);
+   la = la_tmp;
+   }
+   LLE_ADDREF(la);
+   LLE_WUNLOCK(la);
}

return (la);
@@ -483,6 +500,21 @@ lltable_foreach_lle(struct lltable *llt,
return (llt-llt_foreach_entry(llt, f, farg));
}

+struct llentry *
+lltable_alloc_entry(struct lltable *llt, u_int flags,
+const struct sockaddr *l3addr)
+{
+
+   return (llt-llt_alloc_entry(llt, flags, l3addr));
+}
+
+void
+lltable_free_entry(struct lltable *llt, struct llentry *lle)
+{
+
+   llt-llt_free_entry(llt, lle);
+}
+
void
lltable_link_entry(struct lltable *llt, struct llentry *lle)
{
@@ -531,7 +563,7 @@ lla_rt_output(struct rt_msghdr *rtm, str
struct sockaddr *dst = (struct sockaddr *)info-rti_info[RTAX_DST];
struct ifnet *ifp;
struct lltable 

Re: svn commit: r286955 - in head/sys: net netinet netinet6

2015-08-20 Thread Bjoern A. Zeeb

 On 20 Aug 2015, at 13:13 , George Neville-Neil g...@neville-neil.com wrote:
 
 Why was this work not in Phabricator?  This is a large change that has not 
 been reviewed,
 as far as I can tell, by anyone else on the project.  I am tempted to ask 
 that this be backed out
 and reviewed BEFORE it goes into the tree.

I probably wouldn’t go as far as backing out.

Given this seems part of a larger change that seem to be streamed into HEAD and 
I have probably missed a posting or heads up or something on net@ [if someone 
could point me at that it would be very helpful], I appreciate things being 
broken into smaller reviewable bits.  I have no clear idea of what the end goal 
is or will be or look like, which makes it hard to comment on design decisions.

I however, as I have stated in the past, would really really appreciate each 
change in PB, with the proposed commit message, and allow a few days of review 
or for people to comment on.  I have spend two years on fixing bugs on the 
previous rewrite of that code.   I am not exactly looking forward to see 
history repeat itself.

Thanks,
Bjoern


___
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: r286960 - head/sys/arm/include

2015-08-20 Thread Konstantin Belousov
Author: kib
Date: Thu Aug 20 13:37:08 2015
New Revision: 286960
URL: https://svnweb.freebsd.org/changeset/base/286960

Log:
  Typo.

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

Modified: head/sys/arm/include/proc.h
==
--- head/sys/arm/include/proc.h Thu Aug 20 13:11:52 2015(r286959)
+++ head/sys/arm/include/proc.h Thu Aug 20 13:37:08 2015(r286960)
@@ -69,7 +69,7 @@ struct mdproc {
  * As some syscall arguments may be 64-bit aligned we need to ensure the
  * args value is 64-bit aligned. The ABI will then ensure any 64-bit
  * arguments are already correctly aligned, even if they were passed in
- * via registers, we just need to make sure we copy them to an algned
+ * via registers, we just need to make sure we copy them to an aligned
  * buffer.
  */
 struct syscall_args {
___
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: r286967 - head/sys/boot/efi

2015-08-20 Thread Oliver Pinter
On 8/20/15, Craig Rodrigues rodr...@crodrigues.org wrote:
 On Thu, Aug 20, 2015 at 11:31 AM, Warner Losh i...@freebsd.org wrote:

   The flags -mno-aes -mno-avx only exist for clang, not gcc, so
   add them only to the clang CFLAGS.


 It would be more accurate to say that these flags do not exist for gcc 4.2.
 They do exist for gcc 4.7:
 https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/i386-and-x86_002d64-Options.html

The attached one patch still needs to hyperv's hv_kvp_daemon with gcc.
After applied this fix, I get a buildable world. The kernel still
fails on aesni module, but that's a known problem with gcc 4.2.1.


 --
 Craig
 ___
 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

From 9469d3327fe45fd7ae31b98feffac996ff08471f Mon Sep 17 00:00:00 2001
From: Oliver Pinter oliver.pin...@hardenedbsd.org
Date: Thu, 20 Aug 2015 22:49:49 +0200
Subject: [PATCH] FBSD: silence build error with gcc

--- hv_kvp_daemon.o ---
cc1: warnings being treated as errors
/usr/data/source/git/opBSD/opBSD.git/usr.sbin/hyperv/tools/../../../contrib/hyperv/tools/hv_kvp_daemon.c:
In function 'kvp_get_ip_info':
/usr/data/source/git/opBSD/opBSD.git/usr.sbin/hyperv/tools/../../../contrib/hyperv/tools/hv_kvp_daemon.c:814:
warning: 'ip_buffer' may be used uninitialized in this function

*** [hv_kvp_daemon.o] Error code 1

Signed-off-by: Oliver Pinter oliver.pin...@hardenedbsd.org

diff --git a/contrib/hyperv/tools/hv_kvp_daemon.c 
b/contrib/hyperv/tools/hv_kvp_daemon.c
index 1c31d3f..50ae3ed 100644
--- a/contrib/hyperv/tools/hv_kvp_daemon.c
+++ b/contrib/hyperv/tools/hv_kvp_daemon.c
@@ -811,7 +811,7 @@ kvp_get_ip_info(int family, char *if_name, int op,
int error = 0;
char *buffer;
size_t buffer_length;
-   struct hv_kvp_ipaddr_value *ip_buffer;
+   struct hv_kvp_ipaddr_value *ip_buffer = NULL;
char cidr_mask[5];
int weight;
int i;
___
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: r286964 - in head: etc/mtree usr.sbin/fstyp usr.sbin/fstyp/tests

2015-08-20 Thread Alan Somers
Author: asomers
Date: Thu Aug 20 15:37:47 2015
New Revision: 286964
URL: https://svnweb.freebsd.org/changeset/base/286964

Log:
  Add ATF functional tests for fstyp(8).  No ZFS or GELI tests yet.
  
  Reviewed by:  trasz, ngie
  MFC after:2 weeks
  Sponsored by: SpectraLogic
  Differential Revision:https://reviews.freebsd.org/D2801

Added:
  head/usr.sbin/fstyp/tests/
  head/usr.sbin/fstyp/tests/Makefile   (contents, props changed)
  head/usr.sbin/fstyp/tests/ext2.img.bz2   (contents, props changed)
  head/usr.sbin/fstyp/tests/ext3.img.bz2   (contents, props changed)
  head/usr.sbin/fstyp/tests/ext4.img.bz2   (contents, props changed)
  head/usr.sbin/fstyp/tests/ext4_with_label.img.bz2   (contents, props changed)
  head/usr.sbin/fstyp/tests/fstyp_test.sh   (contents, props changed)
  head/usr.sbin/fstyp/tests/ntfs.img.bz2   (contents, props changed)
  head/usr.sbin/fstyp/tests/ntfs_with_label.img.bz2   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.sbin/fstyp/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Aug 20 14:51:11 2015
(r286963)
+++ head/etc/mtree/BSD.tests.dist   Thu Aug 20 15:37:47 2015
(r286964)
@@ -574,6 +574,8 @@
 usr.sbin
 etcupdate
 ..
+fstyp
+..
 newsyslog
 ..
 nmtree

Modified: head/usr.sbin/fstyp/Makefile
==
--- head/usr.sbin/fstyp/MakefileThu Aug 20 14:51:11 2015
(r286963)
+++ head/usr.sbin/fstyp/MakefileThu Aug 20 15:37:47 2015
(r286964)
@@ -13,6 +13,12 @@ MAN= fstyp.8
 
 WARNS?=0
 
+.include src.opts.mk
+
+.if ${MK_TESTS} != no
+SUBDIR+=   tests
+.endif
+
 .if ${MK_ZFS} != no
 IGNORE_PRAGMA=  YES
 

Added: head/usr.sbin/fstyp/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/fstyp/tests/Makefile  Thu Aug 20 15:37:47 2015
(r286964)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+TESTSDIR=  ${TESTSBASE}/usr.sbin/fstyp
+
+ATF_TESTS_SH=  fstyp_test
+
+FILES= ext2.img.bz2
+FILES+=ext3.img.bz2
+FILES+=ext4.img.bz2
+FILES+=ext4_with_label.img.bz2
+FILES+=ntfs.img.bz2
+FILES+=ntfs_with_label.img.bz2
+FILESDIR=  ${TESTSDIR}
+
+.include bsd.test.mk

Added: head/usr.sbin/fstyp/tests/ext2.img.bz2
==
Binary file. No diff available.

Added: head/usr.sbin/fstyp/tests/ext3.img.bz2
==
Binary file. No diff available.

Added: head/usr.sbin/fstyp/tests/ext4.img.bz2
==
Binary file. No diff available.

Added: head/usr.sbin/fstyp/tests/ext4_with_label.img.bz2
==
Binary file. No diff available.

Added: head/usr.sbin/fstyp/tests/fstyp_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/fstyp/tests/fstyp_test.sh Thu Aug 20 15:37:47 2015
(r286964)
@@ -0,0 +1,234 @@
+# $FreeBSD$
+
+atf_test_case cd9660
+cd9660_head() {
+   atf_set descr fstyp(8) should detect cd9660 filesystems
+}
+cd9660_body() {
+   atf_check -s exit:0 mkdir -p dir/emptydir   # makefs requires a 
nonempty directory
+   atf_check -s exit:0 -o ignore makefs -t cd9660 -Z -s 64m cd9660.img dir
+   atf_check -s exit:0 -o inline:cd9660\n fstyp cd9660.img
+   atf_check -s exit:0 -o inline:cd9660\n fstyp -l cd9660.img
+}  
+
+atf_test_case cd9660_label
+cd9660_label_head() {
+   atf_set descr fstyp(8) can read the label on a cd9660 filesystem
+}
+cd9660_label_body() {
+   atf_check -s exit:0 mkdir -p dir/emptydir   # makefs requires a 
nonempty directory
+   atf_check -s exit:0 -o ignore makefs -t cd9660 -o label=Foo -Z -s 64m 
cd9660.img dir
+   atf_check -s exit:0 -o inline:cd9660\n fstyp cd9660.img
+   # Note: cd9660 labels are always upper case
+   atf_check -s exit:0 -o inline:cd9660 FOO\n fstyp -l cd9660.img
+}  
+
+atf_test_case dir
+dir_head() {
+   atf_set descr fstyp(8) should fail on a directory
+}
+dir_body() {
+   atf_check -s exit:0 mkdir dir
+   atf_check -s exit:1 -e match:not a disk fstyp dir
+}
+
+atf_test_case empty
+empty_head() {
+   atf_set descr fstyp(8) should fail on an empty file
+}
+empty_body() {
+   atf_check -s exit:0 touch empty
+   atf_check -s exit:1 -e match:filesystem not recognized fstyp empty
+}
+
+atf_test_case ext2
+ext2_head() {
+   atf_set descr fstyp(8) can detect 

svn commit: r286970 - head/sys/vm

2015-08-20 Thread Ryan Stone
Author: rstone
Date: Thu Aug 20 20:28:51 2015
New Revision: 286970
URL: https://svnweb.freebsd.org/changeset/base/286970

Log:
  Prevent ticks rollover from preventing vm_lowmem event
  
  Currently vm_pageout_scan() uses a ticks-based scheme to rate-limit
  the number of times that the vm_lowmem event will happen.  However
  if no events happen for long enough for ticks to roll over, this
  leaves us in a long window in which vm_lowmem events will not
  happen.
  
  Replace the use of ticks with time_t to prevent rollover from ever
  being an issue.
  
  Reviewed by:  ian
  MFC after:3 weeks
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D3439

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cThu Aug 20 19:39:15 2015(r286969)
+++ head/sys/vm/vm_pageout.cThu Aug 20 20:28:51 2015(r286970)
@@ -93,6 +93,7 @@ __FBSDID($FreeBSD$);
 #include sys/sdt.h
 #include sys/signalvar.h
 #include sys/smp.h
+#include sys/time.h
 #include sys/vnode.h
 #include sys/vmmeter.h
 #include sys/rwlock.h
@@ -171,7 +172,7 @@ static int vm_pageout_update_period;
 static int defer_swap_pageouts;
 static int disable_swap_pageouts;
 static int lowmem_period = 10;
-static int lowmem_ticks;
+static time_t lowmem_uptime;
 
 #if defined(NO_SWAPPING)
 static int vm_swap_enabled = 0;
@@ -1034,7 +1035,7 @@ vm_pageout_scan(struct vm_domain *vmd, i
 * some.  We rate limit to avoid thrashing.
 */
if (vmd == vm_dom[0]  pass  0 
-   (ticks - lowmem_ticks) / hz = lowmem_period) {
+   (time_uptime - lowmem_uptime) = lowmem_period) {
/*
 * Decrease registered cache sizes.
 */
@@ -1045,7 +1046,7 @@ vm_pageout_scan(struct vm_domain *vmd, i
 * drained above.
 */
uma_reclaim();
-   lowmem_ticks = ticks;
+   lowmem_uptime = time_uptime;
}
 
/*
___
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: r286968 - head/sys/arm/arm

2015-08-20 Thread Ian Lepore
Author: ian
Date: Thu Aug 20 19:14:16 2015
New Revision: 286968
URL: https://svnweb.freebsd.org/changeset/base/286968

Log:
  Minor comment and style fixes, no functional change.
  
  Submitted by: Svatopluk Kraus onw...@gmail.com

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cThu Aug 20 18:31:05 2015
(r286967)
+++ head/sys/arm/arm/busdma_machdep-v6.cThu Aug 20 19:14:16 2015
(r286968)
@@ -110,8 +110,8 @@ struct bounce_page {
 };
 
 struct sync_list {
-   vm_offset_t vaddr;  /* kva of bounce buffer */
-   bus_addr_t  busaddr;/* Physical address */
+   vm_offset_t vaddr;  /* kva of client data */
+   bus_addr_t  busaddr;/* client physical address */
bus_size_t  datacount;  /* client data count */
 };
 
@@ -625,7 +625,8 @@ out:
return (error);
 }
 
-static int allocate_bz_and_pages(bus_dma_tag_t dmat, bus_dmamap_t mapp)
+static int
+allocate_bz_and_pages(bus_dma_tag_t dmat, bus_dmamap_t mapp)
 {
struct bounce_zone *bz;
int maxpages;
___
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: r286969 - head/sys/arm/arm

2015-08-20 Thread Ian Lepore
Author: ian
Date: Thu Aug 20 19:39:15 2015
New Revision: 286969
URL: https://svnweb.freebsd.org/changeset/base/286969

Log:
  Remove code left over from the armv4 days.  On armv4, cache maintenance
  operations always had to be aligned and sized to cache lines.  On armv6
  and later, cache maintenance operates on a cache line if any part of
  the line is referenced in the operation, so we don't need extra code to
  align the edges of the sync range.

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cThu Aug 20 19:14:16 2015
(r286968)
+++ head/sys/arm/arm/busdma_machdep-v6.cThu Aug 20 19:39:15 2015
(r286969)
@@ -1381,22 +1381,11 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
 */
if (op  BUS_DMASYNC_POSTREAD) {
while (bpage != NULL) {
-   vm_offset_t startv;
-   vm_paddr_t startp;
-   int len;
-
-   startv = bpage-vaddr ~ arm_dcache_align_mask;
-   startp = bpage-busaddr ~ 
arm_dcache_align_mask;
-   len = bpage-datacount;
-
-   if (startv != bpage-vaddr)
-   len += bpage-vaddr  
arm_dcache_align_mask;
-   if (len  arm_dcache_align_mask)
-   len = (len -
-   (len  arm_dcache_align_mask)) +
-   arm_dcache_align;
-   l2cache_inv_range(startv, startp, len);
-   cpu_dcache_inv_range(startv, len);
+   l2cache_inv_range((vm_offset_t)bpage-vaddr,
+   (vm_offset_t)bpage-busaddr,
+   bpage-datacount);
+   cpu_dcache_inv_range((vm_offset_t)bpage-vaddr,
+   bpage-datacount);
if (bpage-datavaddr != 0)
bcopy((void *)bpage-vaddr,
(void *)bpage-datavaddr,
___
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: r286971 - head/bin/sh/tests/parser

2015-08-20 Thread Jilles Tjoelker
Author: jilles
Date: Thu Aug 20 21:31:36 2015
New Revision: 286971
URL: https://svnweb.freebsd.org/changeset/base/286971

Log:
  sh: Add test for $'\u' without any digits.
  
  It is likely that $'\u' and $'\U' will allow fewer digits in
  future. However, no digits at all should still be disallowed.

Added:
  head/bin/sh/tests/parser/dollar-quote12.0   (contents, props changed)
Modified:
  head/bin/sh/tests/parser/Makefile

Modified: head/bin/sh/tests/parser/Makefile
==
--- head/bin/sh/tests/parser/Makefile   Thu Aug 20 20:28:51 2015
(r286970)
+++ head/bin/sh/tests/parser/Makefile   Thu Aug 20 21:31:36 2015
(r286971)
@@ -36,6 +36,7 @@ FILES+=   dollar-quote8.0
 FILES+=dollar-quote9.0
 FILES+=dollar-quote10.0
 FILES+=dollar-quote11.0
+FILES+=dollar-quote12.0
 FILES+=empty-braces1.0
 FILES+=empty-cmd1.0
 FILES+=for1.0

Added: head/bin/sh/tests/parser/dollar-quote12.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/parser/dollar-quote12.0   Thu Aug 20 21:31:36 2015
(r286971)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+# \u without any digits at all remains invalid.
+# Our choice is a parse error.
+
+v=$( (eval : \$'\u') 21 /dev/null)
+[ $? -ne 0 ]  [ -n $v ]
___
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: r286972 - head/contrib/hyperv/tools

2015-08-20 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Aug 20 21:49:59 2015
New Revision: 286972
URL: https://svnweb.freebsd.org/changeset/base/286972

Log:
  Appease gcc-4.2
  
  It needs to die, but it resists mipsteriously.
  
  Submitted by: Oliver Pinter

Modified:
  head/contrib/hyperv/tools/hv_kvp_daemon.c

Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c
==
--- head/contrib/hyperv/tools/hv_kvp_daemon.c   Thu Aug 20 21:31:36 2015
(r286971)
+++ head/contrib/hyperv/tools/hv_kvp_daemon.c   Thu Aug 20 21:49:59 2015
(r286972)
@@ -811,7 +811,7 @@ kvp_get_ip_info(int family, char *if_nam
int error = 0;
char *buffer;
size_t buffer_length;
-   struct hv_kvp_ipaddr_value *ip_buffer;
+   struct hv_kvp_ipaddr_value *ip_buffer = NULL;
char cidr_mask[5];
int weight;
int i;
___
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: r286973 - in head/bin/sh: . tests/parser

2015-08-20 Thread Jilles Tjoelker
Author: jilles
Date: Thu Aug 20 22:05:55 2015
New Revision: 286973
URL: https://svnweb.freebsd.org/changeset/base/286973

Log:
  sh: Avoid negative character values from $'\U' etc.
  
  The negative value was not expected and generated the low 8 bits as a byte,
  which may be an invalid character encoding.
  
  The final shift in creating the negative value was undefined as well.
  
  Make the temporary variable unsigned to fix this.

Added:
  head/bin/sh/tests/parser/dollar-quote13.0   (contents, props changed)
Modified:
  head/bin/sh/parser.c
  head/bin/sh/tests/parser/Makefile

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cThu Aug 20 21:49:59 2015(r286972)
+++ head/bin/sh/parser.cThu Aug 20 22:05:55 2015(r286973)
@@ -1195,7 +1195,8 @@ parsebackq(char *out, struct nodelist **
 static char *
 readcstyleesc(char *out)
 {
-   int c, v, i, n;
+   int c, vc, i, n;
+   unsigned int v;
 
c = pgetc();
switch (c) {
@@ -1310,12 +1311,12 @@ readcstyleesc(char *out)
default:
  synerror(Bad escape sequence);
}
-   v = (char)v;
+   vc = (char)v;
/*
 * We can't handle NUL bytes.
 * POSIX says we should skip till the closing quote.
 */
-   if (v == '\0') {
+   if (vc == '\0') {
while ((c = pgetc()) != '\'') {
if (c == '\\')
c = pgetc();
@@ -1332,9 +1333,9 @@ readcstyleesc(char *out)
pungetc();
return out;
}
-   if (SQSYNTAX[v] == CCTL)
+   if (SQSYNTAX[vc] == CCTL)
USTPUTC(CTLESC, out);
-   USTPUTC(v, out);
+   USTPUTC(vc, out);
return out;
 }
 

Modified: head/bin/sh/tests/parser/Makefile
==
--- head/bin/sh/tests/parser/Makefile   Thu Aug 20 21:49:59 2015
(r286972)
+++ head/bin/sh/tests/parser/Makefile   Thu Aug 20 22:05:55 2015
(r286973)
@@ -37,6 +37,7 @@ FILES+=   dollar-quote9.0
 FILES+=dollar-quote10.0
 FILES+=dollar-quote11.0
 FILES+=dollar-quote12.0
+FILES+=dollar-quote13.0
 FILES+=empty-braces1.0
 FILES+=empty-cmd1.0
 FILES+=for1.0

Added: head/bin/sh/tests/parser/dollar-quote13.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/parser/dollar-quote13.0   Thu Aug 20 22:05:55 2015
(r286973)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+# This Unicode escape sequence that has never been in range should either
+# fail to expand or expand to a fallback.
+
+c=$(eval printf %s \$\'\\Uff41\' 2/dev/null)
+r=$(($? != 0))
+[ $r.$c = '1.' ] || [ $r.$c = '0.?' ] || [ $r.$c = $'0.\u' ]
___
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: r286974 - head/share/man/man9

2015-08-20 Thread Bryan Drewery
Author: bdrewery
Date: Thu Aug 20 22:14:43 2015
New Revision: 286974
URL: https://svnweb.freebsd.org/changeset/base/286974

Log:
  Remove reference to non-existent kern_openat(9).
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/man/man9/devfs_set_cdevpriv.9

Modified: head/share/man/man9/devfs_set_cdevpriv.9
==
--- head/share/man/man9/devfs_set_cdevpriv.9Thu Aug 20 22:05:55 2015
(r286973)
+++ head/share/man/man9/devfs_set_cdevpriv.9Thu Aug 20 22:14:43 2015
(r286974)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 15, 2012
+.Dd August 20, 2015
 .Dt DEVFS_CDEVPRIV 9
 .Os
 .Sh NAME
@@ -116,8 +116,7 @@ was called.
 .Sh SEE ALSO
 .Xr close 2 ,
 .Xr open 2 ,
-.Xr devfs 5 ,
-.Xr kern_openat 9
+.Xr devfs 5
 .Sh HISTORY
 The
 .Fn devfs_cdevpriv
___
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: r286965 - in head: sbin/camcontrol sys/cam/scsi

2015-08-20 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 20 16:07:51 2015
New Revision: 286965
URL: https://svnweb.freebsd.org/changeset/base/286965

Log:
  Revamp camcontrol(8) fwdownload support and add the opcodes subcommand.
  
  The significant changes and bugs fixed here are:
  
  1. Fixed a bug in the progress display code:
  
 When the user's filename is too big, or his terminal width is too
 small, the progress code could wind up using a negative number for
 the length of the stars that it uses to indicate progress.
  
 This negative value was assigned to an unsigned variable, resulting
 in a very large positive value.
  
 The result is that we wound up writing garbage from memory to the
 user's terminal.
  
 With an 80 column terminal, a file name length of more than 35
 characters would generate this problem.
  
 To address this, we now set a minimum progress bar length, and
 truncate the user's file name as needed.
  
 This has been tested with large filenames and small terminals, and
 at least produces reasonable results.  If the terminal is too
 narrow, the progress display takes up an additional line with each
 update, but this is more user friendly than writing garbage to the
 tty.
  
  2. SATA drives connected via a SATA controller didn't have SCSI Inquiry
 data populated in struct cam_device.  This meant that the code in
 fw_get_vendor() in fwdownload.c would try to match a zero-length
 vendor ID, and so return the first entry in the vendor table.  (Which
 used to be HITACHI.)  Fixed by grabbing identify data, passing the
 identify buffer into fw_get_vendor(), and matching against the model
 name.
  
  3. SATA drives connected via a SAS controller do have Inquiry data
 populated.  The table included a couple of entries -- ATA ST and
 ATA HDS, intended to handle Seagate and Hitachi SATA drives attached
 via a SAS controller.  SCSI to ATA translation layers use a vendor
 ID of ATA (which is standard), and then the model name from the ATA
 identify data as the SCSI product name when they are returning data on
 SATA disks.  The cam_strmatch code will match the first part of the
 string (because the length it is given is the length of the vendor,
 ATA), and return 0 (i.e. a match).  So all SATA drives attached to
 a SAS controller would be programmed using the Seagate method
 (WRITE BUFFER mode 7) of SCSI firmware downloading.
  
  4. Issue #2 above covered up a bug in fw_download_img() -- if the
 maximum packet size in the vendor table was 0, it tried to default
 to a packet size of 32K.  But then it didn't actually succeed in
 doing that, because it set the packet size to the value that was
 in the vendor table (0).  Now that we actually have ATA attached
 drives fall use the VENDOR_ATA case, we need a reasonable default
 packet size.  So this is fixed to properly set the default packet size.
  
  5. Add support for downloading firmware to IBM LTO drives, and add a
 firmware file validation method to make sure that the firmware
 file matches the drive type.  IBM tape drives include a Load ID and
 RU name in their vendor-specific VPD page 0x3.  Those should match
 the IDs in the header of the firmware file to insure that the
 proper firmware file is loaded.
  
  6. This also adds a new -q option to the camcontrol fwdownload
 subcommand to suppress informational output.  When -q is used in
 combination with -y, the firmware upgrade will happen without
 prompting and without output except if an error condition occurs.
  
  7. Re-add support for printing out SCSI inquiry information when
 asking the user to confirm that they want to download firmware, and
 add printing of ATA Identify data if it is a SATA disk.  This was
 removed in r237281 when support for flashing ATA disks was added.
  
  8. Add a new camcontrol(8) opcodes subcommand, and use the
 underlying code to get recommended timeout values for drive
 firmware downloads.
  
 Many SCSI devices support the REPORT SUPPORTED OPERATION CODES
 command, and some support the optional timeout descriptor that
 specifies nominal and recommended timeouts for the commands
 supported by the device.
  
 The new camcontrol opcodes subcommand allows displaying all
 opcodes supported by a drive, information about which fields
 in a SCSI CDB are actually used by a given SCSI device, and the
 nominal and recommended timeout values for each command.
  
 Since firmware downloads can take a long time in some devices, and
 the time varies greatly between different types of devices, take
 advantage of the infrastructure used by the camcontrol opcodes
 subcommand to determine the best timeout to use for the WRITE
 BUFFER command in SCSI device firmware downloads.
  
 If the device recommends a timeout, it is likely to be more
 

Re: svn commit: r286974 - head/share/man/man9

2015-08-20 Thread Konstantin Belousov
On Thu, Aug 20, 2015 at 10:14:43PM +, Bryan Drewery wrote:
 Author: bdrewery
 Date: Thu Aug 20 22:14:43 2015
 New Revision: 286974
 URL: https://svnweb.freebsd.org/changeset/base/286974
 
 Log:
   Remove reference to non-existent kern_openat(9).
The man page does not exist, but the function is there.  It is the right
kernel-mode entrance for the high-level open machinery.  As such, it is
useful reference for a set of functions which needs to be aware of the
open event.
___
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: r286974 - head/share/man/man9

2015-08-20 Thread Bryan Drewery
On 8/20/15 3:26 PM, Konstantin Belousov wrote:
 On Thu, Aug 20, 2015 at 10:14:43PM +, Bryan Drewery wrote:
 Author: bdrewery
 Date: Thu Aug 20 22:14:43 2015
 New Revision: 286974
 URL: https://svnweb.freebsd.org/changeset/base/286974

 Log:
   Remove reference to non-existent kern_openat(9).
 The man page does not exist, but the function is there.  It is the right
 kernel-mode entrance for the high-level open machinery.  As such, it is
 useful reference for a set of functions which needs to be aware of the
 open event.
 

I agree. However, I don't think this is the right place for it though as
this is typically a man page list. I also think it is similar to
commenting obvious code. The manual page already mentions the open(2)
hook. Finding that code is obviously in sys_open, which chains down into
kern_openat.

-- 
Regards,
Bryan Drewery
___
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: r286975 - in head: lib/libc/sys sys/kern

2015-08-20 Thread Konstantin Belousov
Author: kib
Date: Thu Aug 20 22:44:26 2015
New Revision: 286975
URL: https://svnweb.freebsd.org/changeset/base/286975

Log:
  If process becomes reaper (procctl(PROC_REAP_ACQUIRE)) while already
  having some children, the children' reaper is not reset to the parent.
  This allows for the situation where reaper has children but not
  descendands and the too strict asserts in the reap_status() fire.
  
  Remove the wrong asserts, add some clarification for the situation to
  the procctl(2) REAP_STATUS.
  
  Reported and tested by:   feld
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libc/sys/procctl.2
  head/sys/kern/kern_procctl.c

Modified: head/lib/libc/sys/procctl.2
==
--- head/lib/libc/sys/procctl.2 Thu Aug 20 22:14:43 2015(r286974)
+++ head/lib/libc/sys/procctl.2 Thu Aug 20 22:44:26 2015(r286975)
@@ -29,7 +29,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd December 29, 2014
+.Dd August 21, 2015
 .Dt PROCCTL 2
 .Os
 .Sh NAME
@@ -148,7 +148,11 @@ The specified process is the root of the
 .Pp
 The
 .Fa rs_children
-field returns the number of children of the reaper.
+field returns the number of children of the reaper among the descendands.
+It is possible to have a child which reaper is not the specified process,
+since the reaper for the existing children is not reset on the
+.Dv PROC_REAP_ACQUIRE
+operation.
 The
 .Fa rs_descendants
 field returns the total number of descendants of the reaper(s),

Modified: head/sys/kern/kern_procctl.c
==
--- head/sys/kern/kern_procctl.cThu Aug 20 22:14:43 2015
(r286974)
+++ head/sys/kern/kern_procctl.cThu Aug 20 22:44:26 2015
(r286975)
@@ -187,8 +187,6 @@ reap_status(struct thread *td, struct pr
}
} else {
rs-rs_pid = -1;
-   KASSERT(LIST_EMPTY(reap-p_reaplist), (reap children list));
-   KASSERT(LIST_EMPTY(reap-p_children), (children list));
}
return (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