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

2016-12-13 Thread Navdeep Parhar
Author: np
Date: Wed Dec 14 07:36:36 2016
New Revision: 310049
URL: https://svnweb.freebsd.org/changeset/base/310049

Log:
  cxgbe(4): Fix the tid range shown for T6 cards in misc.tids.
  
  MFC after:3 days

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

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cWed Dec 14 03:20:57 2016
(r310048)
+++ head/sys/dev/cxgbe/t4_main.cWed Dec 14 07:36:36 2016
(r310049)
@@ -7219,25 +7219,23 @@ sysctl_tids(SYSCTL_HANDLER_ARGS)
}
 
if (t->ntids) {
+   sbuf_printf(sb, "TID range: ");
if (t4_read_reg(sc, A_LE_DB_CONFIG) & F_HASHEN) {
-   uint32_t b;
+   uint32_t b, hb;
 
-   if (chip_id(sc) <= CHELSIO_T5)
+   if (chip_id(sc) <= CHELSIO_T5) {
b = t4_read_reg(sc, A_LE_DB_SERVER_INDEX) / 4;
-   else
-   b = t4_read_reg(sc, A_LE_DB_SRVR_START_INDEX);
-
-   if (b) {
-   sbuf_printf(sb, "TID range: 0-%u, %u-%u", b - 1,
-   t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4,
-   t->ntids - 1);
+   hb = t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4;
} else {
-   sbuf_printf(sb, "TID range: %u-%u",
-   t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4,
-   t->ntids - 1);
+   b = t4_read_reg(sc, A_LE_DB_SRVR_START_INDEX);
+   hb = t4_read_reg(sc, A_T6_LE_DB_HASH_TID_BASE);
}
+
+   if (b)
+   sbuf_printf(sb, "0-%u, ", b - 1);
+   sbuf_printf(sb, "%u-%u", hb, t->ntids - 1);
} else
-   sbuf_printf(sb, "TID range: 0-%u", t->ntids - 1);
+   sbuf_printf(sb, "0-%u", t->ntids - 1);
sbuf_printf(sb, ", in use: %u\n",
atomic_load_acq_int(>tids_in_use));
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310048 - in head/sys/dev/hyperv: include vmbus vmbus/amd64

2016-12-13 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 14 03:20:57 2016
New Revision: 310048
URL: https://svnweb.freebsd.org/changeset/base/310048

Log:
  hyperv: Implement "enlightened" time counter, which is rdtsc based.
  
  Reviewed by:  kib
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8763

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c
  head/sys/dev/hyperv/vmbus/hyperv_reg.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Dec 14 03:01:15 2016
(r310047)
+++ head/sys/dev/hyperv/include/hyperv.hWed Dec 14 03:20:57 2016
(r310048)
@@ -45,6 +45,7 @@
 #define CPUID_HV_MSR_HYPERCALL 0x0020  /* MSR_HV_GUEST_OS_ID
 * MSR_HV_HYPERCALL */
 #define CPUID_HV_MSR_VP_INDEX  0x0040  /* MSR_HV_VP_INDEX */
+#define CPUID_HV_MSR_REFERENCE_TSC 0x0200  /* MSR_HV_REFERENCE_TSC */
 #define CPUID_HV_MSR_GUEST_IDLE0x0400  /* MSR_HV_GUEST_IDLE */
 
 #ifndef NANOSEC

Modified: head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c
==
--- head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cWed Dec 14 03:01:15 
2016(r310047)
+++ head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cWed Dec 14 03:20:57 
2016(r310048)
@@ -28,7 +28,37 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
 #include 
+#include 
+#include 
+
+struct hyperv_reftsc_ctx {
+   struct hyperv_reftsc*tsc_ref;
+   struct hyperv_dma   tsc_ref_dma;
+};
+
+static struct timecounter  hyperv_tsc_timecounter = {
+   .tc_get_timecount   = NULL, /* based on CPU vendor. */
+   .tc_poll_pps= NULL,
+   .tc_counter_mask= 0x,
+   .tc_frequency   = HYPERV_TIMER_FREQ,
+   .tc_name= "Hyper-V-TSC",
+   .tc_quality = 3000,
+   .tc_flags   = 0,
+   .tc_priv= NULL
+};
+
+static struct hyperv_reftsc_ctxhyperv_ref_tsc;
 
 uint64_t
 hypercall_md(volatile void *hc_addr, uint64_t in_val,
@@ -41,3 +71,85 @@ hypercall_md(volatile void *hc_addr, uin
"c" (in_val), "d" (in_paddr), "m" (hc_addr));
return (status);
 }
+
+#define HYPERV_TSC_TIMECOUNT(fence)\
+static u_int   \
+hyperv_tsc_timecount_##fence(struct timecounter *tc)   \
+{  \
+   struct hyperv_reftsc *tsc_ref = hyperv_ref_tsc.tsc_ref; \
+   uint32_t seq;   \
+   \
+   while ((seq = atomic_load_acq_int(_ref->tsc_seq)) != 0) {   \
+   uint64_t disc, ret, tsc;\
+   uint64_t scale = tsc_ref->tsc_scale;\
+   int64_t ofs = tsc_ref->tsc_ofs; \
+   \
+   fence();\
+   tsc = rdtsc();  \
+   \
+   /* ret = ((tsc * scale) >> 64) + ofs */ \
+   __asm__ __volatile__ ("mulq %3" :   \
+   "=d" (ret), "=a" (disc) :   \
+   "a" (tsc), "r" (scale));\
+   ret += ofs; \
+   \
+   atomic_thread_fence_acq();  \
+   if (tsc_ref->tsc_seq == seq)\
+   return (ret);   \
+   \
+   /* Sequence changed; re-sync. */\
+   }   \
+   /* Fallback to the generic timecounter, i.e. rdmsr. */  \
+   return (rdmsr(MSR_HV_TIME_REF_COUNT));  \
+}  \
+struct __hack
+
+HYPERV_TSC_TIMECOUNT(lfence);
+HYPERV_TSC_TIMECOUNT(mfence);
+
+static void
+hyperv_tsc_tcinit(void *dummy __unused)
+{
+   uint64_t val, orig;
+
+   if ((hyperv_features &
+(CPUID_HV_MSR_TIME_REFCNT | 

svn commit: r310047 - head/release/tools

2016-12-13 Thread Glen Barber
Author: gjb
Date: Wed Dec 14 03:01:15 2016
New Revision: 310047
URL: https://svnweb.freebsd.org/changeset/base/310047

Log:
  - Resize FreeBSD to the size of the OpenStack flavor (growfs).
  - Speeds up the boot process by disabling sendmail.
  - Allows an user to ssh as root with a public key.
  - Make ssh(1) respond faster by disabling DNS lookups.
  - Enable DHCP on the vtnet(4) interface.
  
  Note: The CLOUDWARE list has not yet been changed to include the
  OpenStack target by default yet.
  
  Submitted by: Diego Casati
  PR:   215258
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/tools/openstack.conf

Modified: head/release/tools/openstack.conf
==
--- head/release/tools/openstack.conf   Wed Dec 14 00:21:06 2016
(r310046)
+++ head/release/tools/openstack.conf   Wed Dec 14 03:01:15 2016
(r310047)
@@ -11,8 +11,25 @@ export VM_EXTRA_PACKAGES="net/cloud-init
 # Set to a list of third-party software to enable in rc.conf(5).
 export VM_RC_LIST="cloudinit"
 
+export NOSWAP=YES
+
 vm_extra_pre_umount() {
+   #Enable sshd by default
echo 'sshd_enable="YES"' >> ${DESTDIR}/etc/rc.conf
+
+   # Disable DNS lookups by default to make SSH connect quickly
+   echo 'UseDNS no' >> ${DESTDIR}/etc/ssh/sshd_config
+
+   # Allow root to ssh using keys
+   echo 'PermitRootLogin without-password' >> 
${DESTDIR}/etc/ssh/sshd_config
+
+   # Disable sendmail
+   echo 'sendmail_enable="NO"' >> ${DESTDIR}/etc/rc.conf
+   echo 'sendmail_submit_enable="NO"' >> ${DESTDIR}/etc/rc.conf
+   echo 'sendmail_outbound_enable="NO"' >> ${DESTDIR}/etc/rc.conf
+   echo 'sendmail_msp_queue_enable="NO"' >> ${DESTDIR}/etc/rc.conf
+
+   # Enable DHCP for the OpenStack instance
echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf
 
# Openstack wants sudo(8) usable by default without a password.
@@ -21,5 +38,15 @@ vm_extra_pre_umount() {
 
rm -f ${DESTDIR}/etc/resolv.conf
 
+   # The console is not interactive, so we might as well boot quickly.
+   echo 'autoboot_delay="-1"' >> ${DESTDIR}/boot/loader.conf
+   echo 'beastie_disable="YES"' >> ${DESTDIR}/boot/loader.conf
+
+   # Reboot quickly, Don't wait at the panic screen
+   echo 'debug.trace_on_panic=1' >> ${DESTDIR}/etc/sysctl.conf
+   echo 'debug.debugger_on_panic=0' >> ${DESTDIR}/etc/sysctl.conf
+   echo 'kern.panic_reboot_wait_time=0' >> ${DESTDIR}/etc/sysctl.conf
+
+   touch ${DESTDIR}/firstboot
return 0
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310045 - head/sys/ddb

2016-12-13 Thread John Baldwin
On Wednesday, December 14, 2016 12:18:12 AM John Baldwin wrote:
> Author: jhb
> Date: Wed Dec 14 00:18:12 2016
> New Revision: 310045
> URL: https://svnweb.freebsd.org/changeset/base/310045
> 
> Log:
>   Use casts to force an unsigned comparison in db_search_symbol().
>   
>   On all of our platforms, db_expr_t is a signed integer while
>   db_addr_t is an unsigned integer value.  db_search_symbol used variables
>   of type db_expr_t to hold the current offset of the requested address from
>   the "best" symbol found so far.  This value was initialized to '~0'.
>   When a new symbol is found from a symbol table, the associated diff for the
>   new symbol is compared against the existing value as 'if (newdiff < diff)'
>   to determine if the new symbol had a smaller diff and was thus a closer
>   match.
>   
>   On 64-bit MIPS, the '~0' was treated as a negative value (-1).  A lookup
>   that found a perfect match of an address against a symbol returned a diff
>   of 0.  However, in signed comparisons, 0 is not less than -1.  As a result,
>   DDB on 64-bit MIPS never resolved any addresses to symbols.  Workaround
>   this by using casts to force an unsigned comparison.

I am somewhat unsure of why this worked on other architectures.  amd64
treated ~0 as 0x which when assigned to a 64-bit register was
zero-extended.  i386 also used 0x, but it used an unsigned comparison
(jae instead of jge).  The kernel linker API returns an unsigned long for
the diff, so I do think using db_addr_t for this type is probably the right
solution in the long term.

>   Probably the diff returned from db_search_symbol() and X_db_search_symbol()
>   should be changed to a db_addr_t instead of a db_expr_t as it is an
>   unsigned value (and is an offset of an address, so should fit in the same
>   size as an address).

Also, in case it wasn't clear, this fixes resolution of addresses to names
in MIPS64 stack traces in DDB as well as when using 'x', etc.

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


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

2016-12-13 Thread John Baldwin
Author: jhb
Date: Wed Dec 14 00:21:06 2016
New Revision: 310046
URL: https://svnweb.freebsd.org/changeset/base/310046

Log:
  Add 'const' to fn_name's return type to remove a cast.

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

Modified: head/sys/mips/mips/db_trace.c
==
--- head/sys/mips/mips/db_trace.c   Wed Dec 14 00:18:12 2016
(r310045)
+++ head/sys/mips/mips/db_trace.c   Wed Dec 14 00:21:06 2016
(r310046)
@@ -105,7 +105,7 @@ static struct {
 /*
  * Map a function address to a string name, if known; or a hex string.
  */
-static char *
+static const char *
 fn_name(uintptr_t addr)
 {
static char buf[17];
@@ -113,12 +113,12 @@ fn_name(uintptr_t addr)
 
db_expr_t diff;
c_db_sym_t sym;
-   char *symname;
+   const char *symname;
 
diff = 0;
symname = NULL;
sym = db_search_symbol((db_addr_t)addr, DB_STGY_ANY, );
-   db_symbol_values(sym, (const char **), (db_expr_t *)0);
+   db_symbol_values(sym, , NULL);
if (symname && diff == 0)
return (symname);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310045 - head/sys/ddb

2016-12-13 Thread John Baldwin
Author: jhb
Date: Wed Dec 14 00:18:12 2016
New Revision: 310045
URL: https://svnweb.freebsd.org/changeset/base/310045

Log:
  Use casts to force an unsigned comparison in db_search_symbol().
  
  On all of our platforms, db_expr_t is a signed integer while
  db_addr_t is an unsigned integer value.  db_search_symbol used variables
  of type db_expr_t to hold the current offset of the requested address from
  the "best" symbol found so far.  This value was initialized to '~0'.
  When a new symbol is found from a symbol table, the associated diff for the
  new symbol is compared against the existing value as 'if (newdiff < diff)'
  to determine if the new symbol had a smaller diff and was thus a closer
  match.
  
  On 64-bit MIPS, the '~0' was treated as a negative value (-1).  A lookup
  that found a perfect match of an address against a symbol returned a diff
  of 0.  However, in signed comparisons, 0 is not less than -1.  As a result,
  DDB on 64-bit MIPS never resolved any addresses to symbols.  Workaround
  this by using casts to force an unsigned comparison.
  
  Probably the diff returned from db_search_symbol() and X_db_search_symbol()
  should be changed to a db_addr_t instead of a db_expr_t as it is an
  unsigned value (and is an offset of an address, so should fit in the same
  size as an address).
  
  Sponsored by: DARPA / AFRL

Modified:
  head/sys/ddb/db_sym.c

Modified: head/sys/ddb/db_sym.c
==
--- head/sys/ddb/db_sym.c   Tue Dec 13 23:34:07 2016(r310044)
+++ head/sys/ddb/db_sym.c   Wed Dec 14 00:18:12 2016(r310045)
@@ -373,10 +373,10 @@ db_search_symbol(db_addr_t val, db_strat
register inti;
c_db_sym_t  ret = C_DB_SYM_NULL, sym;
 
-   newdiff = diff = ~0;
+   newdiff = diff = val;
for (i = 0; i < db_nsymtab; i++) {
sym = X_db_search_symbol(_symtabs[i], val, strategy, );
-   if (newdiff < diff) {
+   if ((uintmax_t)newdiff < (uintmax_t)diff) {
db_last_symtab = _symtabs[i];
diff = newdiff;
ret = sym;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310044 - in stable/11: lib/libc/sys share/man/man3 sys/kern

2016-12-13 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec 13 23:34:07 2016
New Revision: 310044
URL: https://svnweb.freebsd.org/changeset/base/310044

Log:
  MFC r309460
  
  thr_set_name(): silently truncate the given name as needed
  
  Instead of failing with ENAMETOOLONG, which is swallowed by
  pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1
  bytes.  This is more likely what the user wants, and saves the
  caller from truncating it before the call (which was the only
  recourse).
  
  Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2)
  so the user might find the documentation for this behavior.
  
  Sponsored by: Dell EMC

Modified:
  stable/11/lib/libc/sys/thr_set_name.2
  stable/11/share/man/man3/pthread_set_name_np.3
  stable/11/sys/kern/kern_thr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/thr_set_name.2
==
--- stable/11/lib/libc/sys/thr_set_name.2   Tue Dec 13 23:13:03 2016
(r310043)
+++ stable/11/lib/libc/sys/thr_set_name.2   Tue Dec 13 23:34:07 2016
(r310044)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2016
+.Dd December 2, 2016
 .Dt THR_SET_NAME 2
 .Os
 .Sh NAME
@@ -43,37 +43,34 @@
 .Sh DESCRIPTION
 The
 .Fn thr_set_name
-sets the user-visible name for the kernel thread with the identifier
+system call sets the user-visible name for the thread with the identifier
 .Va id
-in the current process, to the NUL-terminated string
+in the current process to the NUL-terminated string
 .Va name .
+The name will be silently truncated to fit into a buffer of
+.Dv MAXCOMLEN + 1
+bytes.
 The thread name can be seen in the output of the
 .Xr ps 1
 and
 .Xr top 1
 commands, in the kernel debuggers and kernel tracing facility outputs,
-also in userland debuggers and program core files, as notes.
+and in userland debuggers and program core files, as notes.
 .Sh RETURN VALUES
 If successful,
 .Fn thr_set_name
-will return zero, otherwise \-1 is returned, and
+returns zero; otherwise, \-1 is returned, and
 .Va errno
 is set to indicate the error.
 .Sh ERRORS
 The
 .Fn thr_set_name
-operation may return the following errors:
+system call may return the following errors:
 .Bl -tag -width Er
 .It Bq Er EFAULT
 The memory pointed to by the
 .Fa name
 argument is not valid.
-.It Bq Er ENAMETOOLONG
-The string pointed to by the
-.Fa name
-argument exceeds
-.Dv MAXCOMLEN + 1
-bytes in length.
 .It Bq Er ESRCH
 The thread with the identifier
 .Fa id
@@ -92,6 +89,6 @@ does not exist in the current process.
 .Xr ktr 9
 .Sh STANDARDS
 The
-.Fn thr_new
-system call is non-standard and is used by
+.Fn thr_set_name
+system call is non-standard and is used by the
 .Lb libthr .

Modified: stable/11/share/man/man3/pthread_set_name_np.3
==
--- stable/11/share/man/man3/pthread_set_name_np.3  Tue Dec 13 23:13:03 
2016(r310043)
+++ stable/11/share/man/man3/pthread_set_name_np.3  Tue Dec 13 23:34:07 
2016(r310044)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 13, 2003
+.Dd December 2, 2016
 .Dt PTHREAD_SET_NAME_NP 3
 .Os
 .Sh NAME
@@ -35,18 +35,19 @@
 .Sh SYNOPSIS
 .In pthread_np.h
 .Ft void
-.Fn pthread_set_name_np "pthread_t tid" "const char *name"
+.Fn pthread_set_name_np "pthread_t thread" "const char *name"
 .Sh DESCRIPTION
 The
 .Fn pthread_set_name_np
-function sets internal name for thread specified by
-.Fa tid
-argument to string value specified by
+function applies a copy of the given
 .Fa name
-argument.
+to the given
+.Fa thread .
 .Sh ERRORS
 Because of the debugging nature of this function, all errors that may
 appear inside are silently ignored.
+.Sh SEE ALSO
+.Xr thr_set_name 2
 .Sh AUTHORS
 This manual page was written by
 .An Alexey Zelkin Aq Mt phan...@freebsd.org .

Modified: stable/11/sys/kern/kern_thr.c
==
--- stable/11/sys/kern/kern_thr.c   Tue Dec 13 23:13:03 2016
(r310043)
+++ stable/11/sys/kern/kern_thr.c   Tue Dec 13 23:34:07 2016
(r310044)
@@ -579,8 +579,11 @@ sys_thr_set_name(struct thread *td, stru
error = 0;
name[0] = '\0';
if (uap->name != NULL) {
-   error = copyinstr(uap->name, name, sizeof(name),
-   NULL);
+   error = copyinstr(uap->name, name, sizeof(name), NULL);
+   if (error == ENAMETOOLONG) {
+   error = copyin(uap->name, name, sizeof(name) - 1);
+   name[sizeof(name) - 1] = '\0';
+   }
if (error)
return (error);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310043 - stable/10/sbin/rcorder

2016-12-13 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec 13 23:13:03 2016
New Revision: 310043
URL: https://svnweb.freebsd.org/changeset/base/310043

Log:
  MFC r309625
  
  This is imported from NetBSD.  The author--Joerg Sonnenberger--agreed
  to apply a two-clause BSD license, just so the license was clear.
  
  This source tree location matches NetBSD, and is the first place someone
  might look for such a tool.
  
  Obtained from:Joerg Sonnenberger via NetBSD
  Sponsored by: Dell EMC

Added:
  stable/10/sbin/rcorder/rcorder-visualize.sh
 - copied unchanged from r309625, head/sbin/rcorder/rcorder-visualize.sh
Modified:
Directory Properties:
  stable/10/   (props changed)

Copied: stable/10/sbin/rcorder/rcorder-visualize.sh (from r309625, 
head/sbin/rcorder/rcorder-visualize.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/sbin/rcorder/rcorder-visualize.sh Tue Dec 13 23:13:03 2016
(r310043, copy of r309625, head/sbin/rcorder/rcorder-visualize.sh)
@@ -0,0 +1,52 @@
+#!/bin/sh
+# $NetBSD: rcorder-visualize.sh,v 1.5 2009/08/09 17:08:53 apb Exp $
+#
+# Copyright (c) 2009 by Joerg Sonnenberger
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+# Simple script to show the dependency graph for rc scripts.
+# Output is in the dot(1) language and can be rendered using
+#  sh rcorder-visualize | dot -T svg -o rcorder.svg
+# dot(1) can be found in graphics/graphviz in pkgsrc.
+
+rc_files=${*:-/etc/rc.d/*}
+
+{
+echo ' digraph {'
+for f in $rc_files; do
+< $f awk '
+/# PROVIDE: /  { provide = $3 }
+/# REQUIRE: /  { for (i = 3; i <= NF; i++) requires[$i] = $i }
+/# BEFORE: /   { for (i = 3; i <= NF; i++) befores[$i] = $i }
+
+END {
+   print "\"" provide "\";"
+   for (x in requires) print "\"" provide "\"->\"" x "\";"
+   for (x in befores) print "\"" x "\"->\"" provide "\";"
+}
+'
+done
+echo '}'
+}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310042 - stable/11/sbin/rcorder

2016-12-13 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec 13 23:12:59 2016
New Revision: 310042
URL: https://svnweb.freebsd.org/changeset/base/310042

Log:
  MFC r309625
  
  This is imported from NetBSD.  The author--Joerg Sonnenberger--agreed
  to apply a two-clause BSD license, just so the license was clear.
  
  This source tree location matches NetBSD, and is the first place someone
  might look for such a tool.
  
  Obtained from:Joerg Sonnenberger via NetBSD
  Sponsored by: Dell EMC

Added:
  stable/11/sbin/rcorder/rcorder-visualize.sh
 - copied unchanged from r309625, head/sbin/rcorder/rcorder-visualize.sh
Modified:
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/sbin/rcorder/rcorder-visualize.sh (from r309625, 
head/sbin/rcorder/rcorder-visualize.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/sbin/rcorder/rcorder-visualize.sh Tue Dec 13 23:12:59 2016
(r310042, copy of r309625, head/sbin/rcorder/rcorder-visualize.sh)
@@ -0,0 +1,52 @@
+#!/bin/sh
+# $NetBSD: rcorder-visualize.sh,v 1.5 2009/08/09 17:08:53 apb Exp $
+#
+# Copyright (c) 2009 by Joerg Sonnenberger
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+# Simple script to show the dependency graph for rc scripts.
+# Output is in the dot(1) language and can be rendered using
+#  sh rcorder-visualize | dot -T svg -o rcorder.svg
+# dot(1) can be found in graphics/graphviz in pkgsrc.
+
+rc_files=${*:-/etc/rc.d/*}
+
+{
+echo ' digraph {'
+for f in $rc_files; do
+< $f awk '
+/# PROVIDE: /  { provide = $3 }
+/# REQUIRE: /  { for (i = 3; i <= NF; i++) requires[$i] = $i }
+/# BEFORE: /   { for (i = 3; i <= NF; i++) befores[$i] = $i }
+
+END {
+   print "\"" provide "\";"
+   for (x in requires) print "\"" provide "\"->\"" x "\";"
+   for (x in befores) print "\"" x "\"->\"" provide "\";"
+}
+'
+done
+echo '}'
+}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310041 - stable/10/usr.bin/locale

2016-12-13 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec 13 23:10:35 2016
New Revision: 310041
URL: https://svnweb.freebsd.org/changeset/base/310041

Log:
  MFC r309364 r309367 r309624
  
  locale: fix buffer management
  
  Also, handle signed and unsigned chars, and more gracefully handle
  invalid input.
  
  locale: enable more warnings; fix them
  
  Do not set WARNS, so it gets the current default of 6.
  Fix the warnings by sprinkling static, const, or strdup.
  Make some constant data tables const.  Fix whitespace.
  
  Sponsored by: Dell EMC

Modified:
  stable/10/usr.bin/locale/Makefile
  stable/10/usr.bin/locale/locale.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/locale/Makefile
==
--- stable/10/usr.bin/locale/Makefile   Tue Dec 13 23:09:22 2016
(r310040)
+++ stable/10/usr.bin/locale/Makefile   Tue Dec 13 23:10:35 2016
(r310041)
@@ -1,7 +1,6 @@
 # $FreeBSD$
 
 PROG=  locale
-WARNS?=3
 CFLAGS+= -I${.CURDIR}/../../lib/libc/locale
 
 .include 

Modified: stable/10/usr.bin/locale/locale.c
==
--- stable/10/usr.bin/locale/locale.c   Tue Dec 13 23:09:22 2016
(r310040)
+++ stable/10/usr.bin/locale/locale.c   Tue Dec 13 23:10:35 2016
(r310041)
@@ -55,8 +55,8 @@ void  list_charmaps(void);
 void   list_locales(void);
 const char *lookup_localecat(int);
 char   *kwval_lconv(int);
-intkwval_lookup(char *, char **, int *, int *);
-void   showdetails(char *);
+intkwval_lookup(const char *, char **, int *, int *);
+void   showdetails(const char *);
 void   showkeywordslist(char *substring);
 void   showlocale(void);
 void   usage(void);
@@ -64,13 +64,12 @@ voidusage(void);
 /* Global variables */
 static StringList *locales = NULL;
 
-intall_locales = 0;
-intall_charmaps = 0;
-intprt_categories = 0;
-intprt_keywords = 0;
-intmore_params = 0;
+static int all_locales = 0;
+static int all_charmaps = 0;
+static int prt_categories = 0;
+static int prt_keywords = 0;
 
-struct _lcinfo {
+static const struct _lcinfo {
const char  *name;
int id;
 } lcinfo [] = {
@@ -108,7 +107,7 @@ struct _lcinfo {
 #defineKW_INT_P_SIGN_POSN  (KW_ZERO+21)
 #defineKW_INT_N_SIGN_POSN  (KW_ZERO+22)
 
-struct _kwinfo {
+static const struct _kwinfo {
const char  *name;
int isstr;  /* true - string, false - number */
int catid;  /* LC_* */
@@ -222,7 +221,7 @@ struct _kwinfo {
 };
 #defineNKWINFO (sizeof(kwinfo)/sizeof(kwinfo[0]))
 
-const char *boguslocales[] = { "UTF-8" };
+static const char *boguslocales[] = { "UTF-8" };
 #defineNBOGUS  (sizeof(boguslocales)/sizeof(boguslocales[0]))
 
 int
@@ -294,7 +293,7 @@ main(int argc, char *argv[])
} else {
uint i;
for (i = 0; i < sizeof (kwinfo) / sizeof (struct 
_kwinfo); i++)
-   showdetails ((char *)kwinfo [i].name);
+   showdetails(kwinfo[i].name);
}
exit(0);
}
@@ -339,7 +338,7 @@ list_locales(void)
 static int
 scmp(const void *s1, const void *s2)
 {
-   return strcmp(*(const char **)s1, *(const char **)s2);
+   return strcmp(*(const char * const *)s1, *(const char * const *)s2);
 }
 
 /*
@@ -376,7 +375,7 @@ list_charmaps(void)
 
/* add US-ASCII, if not yet added */
if (sl_find(charmaps, "US-ASCII") == NULL)
-   sl_add(charmaps, "US-ASCII");
+   sl_add(charmaps, strdup("US-ASCII"));
 
/* sort the list */
qsort(charmaps->sl_str, charmaps->sl_cur, sizeof(char *), scmp);
@@ -435,10 +434,10 @@ init_locales_list(void)
 * we also list 'C' for constistency
 */
if (sl_find(locales, "POSIX") == NULL)
-   sl_add(locales, "POSIX");
+   sl_add(locales, strdup("POSIX"));
 
if (sl_find(locales, "C") == NULL)
-   sl_add(locales, "C");
+   sl_add(locales, strdup("C"));
 
/* make output nicer, sort the list */
qsort(locales->sl_str, locales->sl_cur, sizeof(char *), scmp);
@@ -493,29 +492,31 @@ format_grouping(const char *binary)
 {
static char rval[64];
const char *cp;
-   size_t len;
+   size_t roff;
+   int len;
 
rval[0] = '\0';
+   roff = 0;
for (cp = binary; *cp != '\0'; ++cp) {
-   char group[sizeof("127;")];
-   snprintf(group, sizeof(group), "%hhd;", *cp);
-   len = strlcat(rval, group, sizeof(rval));
-   if (len >= sizeof(rval)) {
-   len = sizeof(rval) - 1;
-   break;
-   }
-   if (*cp == CHAR_MAX) {
-   break;
-  

svn commit: r310040 - stable/11/usr.bin/locale

2016-12-13 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec 13 23:09:22 2016
New Revision: 310040
URL: https://svnweb.freebsd.org/changeset/base/310040

Log:
  MFC r309364 r309367 r309624
  
  locale: fix buffer management
  
  Also, handle signed and unsigned chars, and more gracefully handle
  invalid input.
  
  locale: enable more warnings; fix them
  
  Do not set WARNS, so it gets the current default of 6.
  Fix the warnings by sprinkling static, const, or strdup.
  Make some constant data tables const.  Fix whitespace.
  
  Sponsored by: Dell EMC

Modified:
  stable/11/usr.bin/locale/Makefile
  stable/11/usr.bin/locale/locale.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/locale/Makefile
==
--- stable/11/usr.bin/locale/Makefile   Tue Dec 13 22:40:09 2016
(r310039)
+++ stable/11/usr.bin/locale/Makefile   Tue Dec 13 23:09:22 2016
(r310040)
@@ -1,7 +1,6 @@
 # $FreeBSD$
 
 PROG=  locale
-WARNS?=3
 CFLAGS+= -I${.CURDIR}/../../lib/libc/locale
 
 .include 

Modified: stable/11/usr.bin/locale/locale.c
==
--- stable/11/usr.bin/locale/locale.c   Tue Dec 13 22:40:09 2016
(r310039)
+++ stable/11/usr.bin/locale/locale.c   Tue Dec 13 23:09:22 2016
(r310040)
@@ -57,8 +57,8 @@ void  list_charmaps(void);
 void   list_locales(void);
 const char *lookup_localecat(int);
 char   *kwval_lconv(int);
-intkwval_lookup(char *, char **, int *, int *);
-void   showdetails(char *);
+intkwval_lookup(const char *, char **, int *, int *);
+void   showdetails(const char *);
 void   showkeywordslist(char *substring);
 void   showlocale(void);
 void   usage(void);
@@ -66,13 +66,12 @@ voidusage(void);
 /* Global variables */
 static StringList *locales = NULL;
 
-intall_locales = 0;
-intall_charmaps = 0;
-intprt_categories = 0;
-intprt_keywords = 0;
-intmore_params = 0;
+static int all_locales = 0;
+static int all_charmaps = 0;
+static int prt_categories = 0;
+static int prt_keywords = 0;
 
-struct _lcinfo {
+static const struct _lcinfo {
const char  *name;
int id;
 } lcinfo [] = {
@@ -110,7 +109,7 @@ struct _lcinfo {
 #defineKW_INT_P_SIGN_POSN  (KW_ZERO+21)
 #defineKW_INT_N_SIGN_POSN  (KW_ZERO+22)
 
-struct _kwinfo {
+static const struct _kwinfo {
const char  *name;
int isstr;  /* true - string, false - number */
int catid;  /* LC_* */
@@ -224,7 +223,7 @@ struct _kwinfo {
 };
 #defineNKWINFO (nitems(kwinfo))
 
-const char *boguslocales[] = { "UTF-8" };
+static const char *boguslocales[] = { "UTF-8" };
 #defineNBOGUS  (nitems(boguslocales))
 
 int
@@ -296,7 +295,7 @@ main(int argc, char *argv[])
} else {
uint i;
for (i = 0; i < nitems(kwinfo); i++)
-   showdetails ((char *)kwinfo [i].name);
+   showdetails(kwinfo[i].name);
}
exit(0);
}
@@ -341,7 +340,7 @@ list_locales(void)
 static int
 scmp(const void *s1, const void *s2)
 {
-   return strcmp(*(const char **)s1, *(const char **)s2);
+   return strcmp(*(const char * const *)s1, *(const char * const *)s2);
 }
 
 /*
@@ -378,7 +377,7 @@ list_charmaps(void)
 
/* add US-ASCII, if not yet added */
if (sl_find(charmaps, "US-ASCII") == NULL)
-   sl_add(charmaps, "US-ASCII");
+   sl_add(charmaps, strdup("US-ASCII"));
 
/* sort the list */
qsort(charmaps->sl_str, charmaps->sl_cur, sizeof(char *), scmp);
@@ -437,10 +436,10 @@ init_locales_list(void)
 * we also list 'C' for constistency
 */
if (sl_find(locales, "POSIX") == NULL)
-   sl_add(locales, "POSIX");
+   sl_add(locales, strdup("POSIX"));
 
if (sl_find(locales, "C") == NULL)
-   sl_add(locales, "C");
+   sl_add(locales, strdup("C"));
 
/* make output nicer, sort the list */
qsort(locales->sl_str, locales->sl_cur, sizeof(char *), scmp);
@@ -495,29 +494,31 @@ format_grouping(const char *binary)
 {
static char rval[64];
const char *cp;
-   size_t len;
+   size_t roff;
+   int len;
 
rval[0] = '\0';
+   roff = 0;
for (cp = binary; *cp != '\0'; ++cp) {
-   char group[sizeof("127;")];
-   snprintf(group, sizeof(group), "%hhd;", *cp);
-   len = strlcat(rval, group, sizeof(rval));
-   if (len >= sizeof(rval)) {
-   len = sizeof(rval) - 1;
-   break;
-   }
-   if (*cp == CHAR_MAX) {
-   break;
-   }
-   }
-
-   /* Remove the trailing ';'. */
-   

svn commit: r310038 - head/usr.sbin/bsdinstall/scripts

2016-12-13 Thread Devin Teske
Author: dteske
Date: Tue Dec 13 22:31:49 2016
New Revision: 310038
URL: https://svnweb.freebsd.org/changeset/base/310038

Log:
  Revert r309918 -- modern POSIX has deprecated -<#>/+<#> syntax
  
  Special thanks to:jilles

Modified:
  head/usr.sbin/bsdinstall/scripts/wlanconfig

Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig
==
--- head/usr.sbin/bsdinstall/scripts/wlanconfig Tue Dec 13 22:30:48 2016
(r310037)
+++ head/usr.sbin/bsdinstall/scripts/wlanconfig Tue Dec 13 22:31:49 2016
(r310038)
@@ -185,8 +185,8 @@ fi
 #
 if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
# Get current country/regdomain for selected interface
-   WLAN_IFACE=$( wpa_cli ifname | tail -1 )
-   INPUT=$( ifconfig "$WLAN_IFACE" list regdomain | head -1 )
+   WLAN_IFACE=$( wpa_cli ifname | tail -n 1 )
+   INPUT=$( ifconfig "$WLAN_IFACE" list regdomain | head -n 1 )
DEF_REGDOMAIN=$( echo "$INPUT" | cut -w -f 2 )
DEF_COUNTRY=$( echo "$INPUT" | cut -w -f 4 )
[ "$DEF_REGDOMAIN" = 0 ] && DEF_REGDOMAIN=""
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-12-13 Thread John Baldwin
Author: jhb
Date: Tue Dec 13 22:30:48 2016
New Revision: 310037
URL: https://svnweb.freebsd.org/changeset/base/310037

Log:
  Fix stack traces in DDB for the debugger thread.
  
  When the kernel debugger is entered, makectx() is called to store
  appropriate state from the trapframe for the debugger into a global
  kdb_pcb used as the thread context of the thread entering the
  debugger.  Stack unwinders for DDB called via db_trace_thread() are
  supposed to then use this saved context so that the stack trace for
  the current thread starts at the location of the event that triggered
  debugger entry.
  
  MIPS was instead starting the stack trace of the current thread from
  the context of db_trace_thread itself and unwinding back out through
  the debugger to the original frame.  Fix a couple of things to bring
  MIPS inline with other platforms:
  - Fix makectx() to store the PC, SP, and RA in the right portion of
the PCB used by db_trace_thread().
  - Fix db_trace_thread() to always use kdb_thr_ctx() (and thus kdb_pcb
for the debugger thread).
  - Move the logic for tracing curthread from within the current
function into db_trace_self() to match other architectures.
  
  Sponsored by: DARPA / AFRL

Modified:
  head/sys/mips/mips/db_trace.c
  head/sys/mips/mips/pm_machdep.c

Modified: head/sys/mips/mips/db_trace.c
==
--- head/sys/mips/mips/db_trace.c   Tue Dec 13 22:16:02 2016
(r310036)
+++ head/sys/mips/mips/db_trace.c   Tue Dec 13 22:30:48 2016
(r310037)
@@ -432,7 +432,20 @@ db_md_list_watchpoints()
 void
 db_trace_self(void)
 {
-   db_trace_thread (curthread, -1);
+   register_t pc, ra, sp;
+
+   sp = (register_t)(intptr_t)__builtin_frame_address(0);
+   ra = (register_t)(intptr_t)__builtin_return_address(0);
+
+   __asm __volatile(
+   "jal 99f\n"
+   "nop\n"
+   "99:\n"
+"move %0, $31\n" /* get ra */
+"move $31, %1\n" /* restore ra */
+: "=r" (pc)
+: "r" (ra));
+   stacktrace_subr(pc, sp, ra, db_printf);
return;
 }
 
@@ -442,28 +455,11 @@ db_trace_thread(struct thread *thr, int 
register_t pc, ra, sp;
struct pcb *ctx;
 
-   if (thr == curthread) {
-   sp = (register_t)(intptr_t)__builtin_frame_address(0);
-   ra = (register_t)(intptr_t)__builtin_return_address(0);
-
-   __asm __volatile(
-   "jal 99f\n"
-   "nop\n"
-   "99:\n"
- "move %0, $31\n" /* get ra */
- "move $31, %1\n" /* restore ra */
- : "=r" (pc)
-: "r" (ra));
-
-   } else {
-   ctx = kdb_thr_ctx(thr);
-   sp = (register_t)ctx->pcb_context[PCB_REG_SP];
-   pc = (register_t)ctx->pcb_context[PCB_REG_PC];
-   ra = (register_t)ctx->pcb_context[PCB_REG_RA];
-   }
-
-   stacktrace_subr(pc, sp, ra,
-   (int (*) (const char *, ...))db_printf);
+   ctx = kdb_thr_ctx(thr);
+   sp = (register_t)ctx->pcb_context[PCB_REG_SP];
+   pc = (register_t)ctx->pcb_context[PCB_REG_PC];
+   ra = (register_t)ctx->pcb_context[PCB_REG_RA];
+   stacktrace_subr(pc, sp, ra, db_printf);
 
return (0);
 }

Modified: head/sys/mips/mips/pm_machdep.c
==
--- head/sys/mips/mips/pm_machdep.c Tue Dec 13 22:16:02 2016
(r310036)
+++ head/sys/mips/mips/pm_machdep.c Tue Dec 13 22:30:48 2016
(r310037)
@@ -292,9 +292,9 @@ void
 makectx(struct trapframe *tf, struct pcb *pcb)
 {
 
-   pcb->pcb_regs.ra = tf->ra;
-   pcb->pcb_regs.pc = tf->pc;
-   pcb->pcb_regs.sp = tf->sp;
+   pcb->pcb_context[PCB_REG_RA] = tf->ra;
+   pcb->pcb_context[PCB_REG_PC] = tf->pc;
+   pcb->pcb_context[PCB_REG_SP] = tf->sp;
 }
 
 int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r309918 - head/usr.sbin/bsdinstall/scripts

2016-12-13 Thread Devin Teske

> On Dec 13, 2016, at 1:24 PM, Jilles Tjoelker  wrote:
> 
> On Mon, Dec 12, 2016 at 06:48:00PM +, Devin Teske wrote:
>> Author: dteske
>> Date: Mon Dec 12 18:48:00 2016
>> New Revision: 309918
>> URL: https://svnweb.freebsd.org/changeset/base/309918 
>> 
> 
>> Log:
>>  Remove unnecessary `-n' parameter to head/tail
> 
> These -n options are not completely unnecessary since POSIX removed the
> obsolete forms without -n years ago, and some minimalistic
> implementations (Busybox) followed suit. Therefore, although I use the
> obsolete forms frequently interactively, I think head/tail -n should be
> the preferred form in scripts.
> 
> The obsolete form tail +N (where N is a number) should definitely be
> avoided since it conflicts with a file named like that; head -N and tail
> -N are valid extensions to the standard.
> 

Thanks for keeping me abreast of the POSIX changes.

I'll make the applicable change right now and should I see any other instances, 
tackle those in the future as well.
-- 
Cheers,
Devin



>> Modified:
>>  head/usr.sbin/bsdinstall/scripts/wlanconfig
>> 
>> Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig
>> ==
>> --- head/usr.sbin/bsdinstall/scripts/wlanconfig  Mon Dec 12 18:45:52 
>> 2016(r309917)
>> +++ head/usr.sbin/bsdinstall/scripts/wlanconfig  Mon Dec 12 18:48:00 
>> 2016(r309918)
>> @@ -175,8 +175,8 @@ fi
>> #
>> if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
>>  # Get current country/regdomain for selected interface
>> -WLAN_IFACE=$( wpa_cli ifname | tail -n 1 )
>> -INPUT=$( ifconfig $WLAN_IFACE list regdomain | head -n 1 )
>> +WLAN_IFACE=$( wpa_cli ifname | tail -1 )
>> +INPUT=$( ifconfig $WLAN_IFACE list regdomain | head -1 )
>>  DEF_REGDOMAIN=$( echo $INPUT | cut -w -f 2 )
>>  DEF_COUNTRY=$( echo $INPUT | cut -w -f 4 )
>>  [ "$DEF_REGDOMAIN" = 0 ] && DEF_REGDOMAIN=""
> 
> -- 
> Jilles Tjoelker

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


svn commit: r310036 - in head/contrib/byacc: . package package/debian package/pkgsrc test/btyacc

2016-12-13 Thread Jung-uk Kim
Author: jkim
Date: Tue Dec 13 22:16:02 2016
New Revision: 310036
URL: https://svnweb.freebsd.org/changeset/base/310036

Log:
  MFV:  r309561
  
  Merge byacc 20161202.

Modified:
  head/contrib/byacc/CHANGES
  head/contrib/byacc/MANIFEST
  head/contrib/byacc/VERSION
  head/contrib/byacc/aclocal.m4
  head/contrib/byacc/btyaccpar.c
  head/contrib/byacc/btyaccpar.skel
  head/contrib/byacc/config.guess
  head/contrib/byacc/config.sub
  head/contrib/byacc/configure
  head/contrib/byacc/defs.h
  head/contrib/byacc/error.c
  head/contrib/byacc/main.c
  head/contrib/byacc/mstring.c
  head/contrib/byacc/output.c
  head/contrib/byacc/package/byacc.spec
  head/contrib/byacc/package/debian/changelog
  head/contrib/byacc/package/mingw-byacc.spec
  head/contrib/byacc/package/pkgsrc/Makefile
  head/contrib/byacc/reader.c
  head/contrib/byacc/test/btyacc/btyacc_calc1.tab.c
  head/contrib/byacc/test/btyacc/btyacc_demo.tab.c
  head/contrib/byacc/test/btyacc/btyacc_demo.tab.h
  head/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c
  head/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c
  head/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c
  head/contrib/byacc/test/btyacc/calc.tab.c
  head/contrib/byacc/test/btyacc/calc1.tab.c
  head/contrib/byacc/test/btyacc/calc2.tab.c
  head/contrib/byacc/test/btyacc/calc3.tab.c
  head/contrib/byacc/test/btyacc/code_calc.code.c
  head/contrib/byacc/test/btyacc/code_calc.tab.c
  head/contrib/byacc/test/btyacc/code_error.code.c
  head/contrib/byacc/test/btyacc/code_error.tab.c
  head/contrib/byacc/test/btyacc/empty.tab.c
  head/contrib/byacc/test/btyacc/err_inherit3.tab.c
  head/contrib/byacc/test/btyacc/err_inherit4.tab.c
  head/contrib/byacc/test/btyacc/err_inherit4.tab.h
  head/contrib/byacc/test/btyacc/err_syntax10.tab.c
  head/contrib/byacc/test/btyacc/err_syntax11.tab.c
  head/contrib/byacc/test/btyacc/err_syntax12.tab.c
  head/contrib/byacc/test/btyacc/err_syntax18.tab.c
  head/contrib/byacc/test/btyacc/err_syntax20.tab.c
  head/contrib/byacc/test/btyacc/error.tab.c
  head/contrib/byacc/test/btyacc/grammar.tab.c
  head/contrib/byacc/test/btyacc/inherit0.tab.c
  head/contrib/byacc/test/btyacc/inherit1.tab.c
  head/contrib/byacc/test/btyacc/inherit2.tab.c
  head/contrib/byacc/test/btyacc/ok_syntax1.tab.c
  head/contrib/byacc/test/btyacc/pure_calc.tab.c
  head/contrib/byacc/test/btyacc/pure_error.tab.c
  head/contrib/byacc/test/btyacc/quote_calc-s.tab.c
  head/contrib/byacc/test/btyacc/quote_calc.tab.c
  head/contrib/byacc/test/btyacc/quote_calc2-s.tab.c
  head/contrib/byacc/test/btyacc/quote_calc2.tab.c
  head/contrib/byacc/test/btyacc/quote_calc3-s.tab.c
  head/contrib/byacc/test/btyacc/quote_calc3.tab.c
  head/contrib/byacc/test/btyacc/quote_calc4-s.tab.c
  head/contrib/byacc/test/btyacc/quote_calc4.tab.c
  head/contrib/byacc/test/btyacc/rename_debug.c
  head/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c
  head/contrib/byacc/yaccpar.c
  head/contrib/byacc/yaccpar.skel
Directory Properties:
  head/contrib/byacc/   (props changed)

Modified: head/contrib/byacc/CHANGES
==
--- head/contrib/byacc/CHANGES  Tue Dec 13 20:55:46 2016(r310035)
+++ head/contrib/byacc/CHANGES  Tue Dec 13 22:16:02 2016(r310036)
@@ -1,4 +1,123 @@
-2016-06-06  Thomas E. Dickey  
+2016-12-02  Thomas E. Dickey  
+
+   * test/btyacc/quote_calc4-s.tab.c, test/btyacc/varsyntax_calc1.tab.c, 
test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, 
test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, 
test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, 
test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, 
test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, 
test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, 
test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4.tab.c, 
test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, 
test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, 
test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, 
test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, 
test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, 
test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, 
test/btyacc/err_syntax20.tab.c, test/btyacc/rename_debug.c, 
test/btyacc/btyacc_calc1.tab.c, test/btyacc
 /btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, 
test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, 
btyaccpar.c:
+   regen
+
+   * btyaccpar.skel: changes from NetBSD
+   + use YYINT rather than short in btyaccpar.skel
+ (some of this had already been done by Tom Shields)
+   + remove some casts of malloc/realloc
+
+   * yaccpar.c, yaccpar.skel, output.c: changes from NetBSD
+   - Add some more bison stuff to make the mesa/gallium parser work:
+   %initial-action (add missing source struct 

Re: svn commit: r309918 - head/usr.sbin/bsdinstall/scripts

2016-12-13 Thread Jilles Tjoelker
On Mon, Dec 12, 2016 at 06:48:00PM +, Devin Teske wrote:
> Author: dteske
> Date: Mon Dec 12 18:48:00 2016
> New Revision: 309918
> URL: https://svnweb.freebsd.org/changeset/base/309918

> Log:
>   Remove unnecessary `-n' parameter to head/tail

These -n options are not completely unnecessary since POSIX removed the
obsolete forms without -n years ago, and some minimalistic
implementations (Busybox) followed suit. Therefore, although I use the
obsolete forms frequently interactively, I think head/tail -n should be
the preferred form in scripts.

The obsolete form tail +N (where N is a number) should definitely be
avoided since it conflicts with a file named like that; head -N and tail
-N are valid extensions to the standard.

> Modified:
>   head/usr.sbin/bsdinstall/scripts/wlanconfig
> 
> Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig
> ==
> --- head/usr.sbin/bsdinstall/scripts/wlanconfig   Mon Dec 12 18:45:52 
> 2016(r309917)
> +++ head/usr.sbin/bsdinstall/scripts/wlanconfig   Mon Dec 12 18:48:00 
> 2016(r309918)
> @@ -175,8 +175,8 @@ fi
>  #
>  if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
>   # Get current country/regdomain for selected interface
> - WLAN_IFACE=$( wpa_cli ifname | tail -n 1 )
> - INPUT=$( ifconfig $WLAN_IFACE list regdomain | head -n 1 )
> + WLAN_IFACE=$( wpa_cli ifname | tail -1 )
> + INPUT=$( ifconfig $WLAN_IFACE list regdomain | head -1 )
>   DEF_REGDOMAIN=$( echo $INPUT | cut -w -f 2 )
>   DEF_COUNTRY=$( echo $INPUT | cut -w -f 4 )
>   [ "$DEF_REGDOMAIN" = 0 ] && DEF_REGDOMAIN=""

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


Re: svn commit: r310029 - head/sys/mips/mips

2016-12-13 Thread John Baldwin
On Tuesday, December 13, 2016 07:27:32 PM John Baldwin wrote:
> Author: jhb
> Date: Tue Dec 13 19:27:31 2016
> New Revision: 310029
> URL: https://svnweb.freebsd.org/changeset/base/310029
> 
> Log:
>   Fix remove_userlocal_code() for n32.
>   
>   n32 kernels use a 64-bit store to the TLS register rather than a 32-bit
>   store.
>   
>   Sponsored by:   DARPA / AFRL

This permits booting an n32 kernel under qemu-system-mips64.  However,
/sbin/init gets stuck in some sort of recursive loop (I think) which
causes it to overflow its stack, so userland doesn't quite work yet.

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


Re: svn commit: r310025 - head/libexec/rtld-elf

2016-12-13 Thread Conrad Meyer
On Tue, Dec 13, 2016 at 12:51 PM, Andriy Gapon  wrote:
> On 13/12/2016 20:05, Bryan Drewery wrote:
>> Author: bdrewery
>> Date: Tue Dec 13 18:05:14 2016
>> New Revision: 310025
>> URL: https://svnweb.freebsd.org/changeset/base/310025
>>
>> Log:
>>   Take write lock for rtld_bind before modifying obj_list in 
>> dl_iterate_phdr().
>
> What are typical callers of dl_iterate_phdr() ?

libunwind::UnwindCursor::setInfoBasedOnIPRegister(bool) via
_pthread_exit.

> In what scenarios this bug would typically be hit?
> Thank you!

We mostly hit this during multi-threaded program teardown.  Exiting
threads would be in _pthread_exit -> libunwind -> dl_iterate_phdr at
the same time as the main thread was performing __cxa_finalize ->
_rtld_addr_phdr -> obj_from_addr.

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


Re: svn commit: r310035 - head/usr.sbin/syslogd

2016-12-13 Thread Conrad Meyer
On Tue, Dec 13, 2016 at 12:55 PM, Hiroki Sato  wrote:
> Author: hrs
> Date: Tue Dec 13 20:55:46 2016
> New Revision: 310035
> URL: https://svnweb.freebsd.org/changeset/base/310035
>
> Log:
>   Remove an extra "break" which could incorrectly terminate an
>   STAILQ_FOREACH() loop when an AF_INET6 rule matched.
>
>   Spotted by:   cem

Coverity CID: 1366941

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


Re: svn commit: r309933 - head/usr.sbin/syslogd

2016-12-13 Thread Hiroki Sato
Conrad Meyer  wrote
  in 

svn commit: r310035 - head/usr.sbin/syslogd

2016-12-13 Thread Hiroki Sato
Author: hrs
Date: Tue Dec 13 20:55:46 2016
New Revision: 310035
URL: https://svnweb.freebsd.org/changeset/base/310035

Log:
  Remove an extra "break" which could incorrectly terminate an
  STAILQ_FOREACH() loop when an AF_INET6 rule matched.
  
  Spotted by:   cem

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Tue Dec 13 20:54:38 2016
(r310034)
+++ head/usr.sbin/syslogd/syslogd.c Tue Dec 13 20:55:46 2016
(r310035)
@@ -2465,7 +2465,6 @@ validate(struct sockaddr *sa, const char
struct allowedpeer *ap;
struct sockaddr_in *sin4, *a4p = NULL, *m4p = NULL;
 #ifdef INET6
-   int reject;
struct sockaddr_in6 *sin6, *a6p = NULL, *m6p = NULL;
 #endif
struct addrinfo hints, *res;
@@ -2533,13 +2532,8 @@ validate(struct sockaddr *sa, const char
dprintf("rejected in rule %d due to 
scope mismatch.\n", i);
continue;
}
-   reject = 0;
if (IN6_ARE_MASKED_ADDR_EQUAL(>sin6_addr,
>sin6_addr, >sin6_addr) != 0) {
-   ++reject;
-   break;
-   }
-   if (reject) {
dprintf("rejected in rule %d due to IP 
mismatch.\n", i);
continue;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310025 - head/libexec/rtld-elf

2016-12-13 Thread Andriy Gapon
On 13/12/2016 20:05, Bryan Drewery wrote:
> Author: bdrewery
> Date: Tue Dec 13 18:05:14 2016
> New Revision: 310025
> URL: https://svnweb.freebsd.org/changeset/base/310025
> 
> Log:
>   Take write lock for rtld_bind before modifying obj_list in 
> dl_iterate_phdr().

What are typical callers of dl_iterate_phdr() ?
In what scenarios this bug would typically be hit?
Thank you!

>   This avoids a race with readers such as dladdr(3)/dlinfo(3)/dlsym(3) and
>   the atexit(3) handler.  This race was introduced in r294373.
>   
>   Reviewed by:markj, kib, kan
>   MFC after:  2 weeks
>   Sponsored by:   Dell EMC Isilon
> 
> Modified:
>   head/libexec/rtld-elf/rtld.c
> 
> Modified: head/libexec/rtld-elf/rtld.c
> ==
> --- head/libexec/rtld-elf/rtld.c  Tue Dec 13 16:53:58 2016
> (r310024)
> +++ head/libexec/rtld-elf/rtld.c  Tue Dec 13 18:05:14 2016
> (r310025)
> @@ -3549,7 +3549,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac
>   error = 0;
>  
>   wlock_acquire(rtld_phdr_lock, _lockstate);
> - rlock_acquire(rtld_bind_lock, _lockstate);
> + wlock_acquire(rtld_bind_lock, _lockstate);
>   for (obj = globallist_curr(TAILQ_FIRST(_list)); obj != NULL;) {
>   TAILQ_INSERT_AFTER(_list, obj, , next);
>   rtld_fill_dl_phdr_info(obj, _info);
> @@ -3557,7 +3557,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac
>  
>   error = callback(_info, sizeof phdr_info, param);
>  
> - rlock_acquire(rtld_bind_lock, _lockstate);
> + wlock_acquire(rtld_bind_lock, _lockstate);
>   obj = globallist_next();
>   TAILQ_REMOVE(_list, , next);
>   if (error != 0) {
> 


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


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

2016-12-13 Thread Navdeep Parhar
Author: np
Date: Tue Dec 13 20:35:57 2016
New Revision: 310033
URL: https://svnweb.freebsd.org/changeset/base/310033

Log:
  cxgbe(4): Retire t4_bus_space_read_8 and t4_bus_space_write_8.
  
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hTue Dec 13 20:11:45 2016
(r310032)
+++ head/sys/dev/cxgbe/adapter.hTue Dec 13 20:35:57 2016
(r310033)
@@ -84,45 +84,6 @@ prefetch(void *x)
 #define SBUF_DRAIN 1
 #endif
 
-#ifdef __amd64__
-/* XXX: need systemwide bus_space_read_8/bus_space_write_8 */
-static __inline uint64_t
-t4_bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t handle,
-bus_size_t offset)
-{
-   KASSERT(tag == X86_BUS_SPACE_MEM,
-   ("%s: can only handle mem space", __func__));
-
-   return (*(volatile uint64_t *)(handle + offset));
-}
-
-static __inline void
-t4_bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t bsh,
-bus_size_t offset, uint64_t value)
-{
-   KASSERT(tag == X86_BUS_SPACE_MEM,
-   ("%s: can only handle mem space", __func__));
-
-   *(volatile uint64_t *)(bsh + offset) = value;
-}
-#else
-static __inline uint64_t
-t4_bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t handle,
-bus_size_t offset)
-{
-   return (uint64_t)bus_space_read_4(tag, handle, offset) +
-   ((uint64_t)bus_space_read_4(tag, handle, offset + 4) << 32);
-}
-
-static __inline void
-t4_bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t bsh,
-bus_size_t offset, uint64_t value)
-{
-   bus_space_write_4(tag, bsh, offset, value);
-   bus_space_write_4(tag, bsh, offset + 4, value >> 32);
-}
-#endif
-
 struct adapter;
 typedef struct adapter adapter_t;
 
@@ -977,14 +938,25 @@ static inline uint64_t
 t4_read_reg64(struct adapter *sc, uint32_t reg)
 {
 
-   return t4_bus_space_read_8(sc->bt, sc->bh, reg);
+#ifdef __LP64__
+   return bus_space_read_8(sc->bt, sc->bh, reg);
+#else
+   return (uint64_t)bus_space_read_4(sc->bt, sc->bh, reg) +
+   ((uint64_t)bus_space_read_4(sc->bt, sc->bh, reg + 4) << 32);
+
+#endif
 }
 
 static inline void
 t4_write_reg64(struct adapter *sc, uint32_t reg, uint64_t val)
 {
 
-   t4_bus_space_write_8(sc->bt, sc->bh, reg, val);
+#ifdef __LP64__
+   bus_space_write_8(sc->bt, sc->bh, reg, val);
+#else
+   bus_space_write_4(sc->bt, sc->bh, reg, val);
+   bus_space_write_4(sc->bt, sc->bh, reg + 4, val>> 32);
+#endif
 }
 
 static inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310013 - head/sys/dev/xen/blkfront

2016-12-13 Thread Dimitry Andric
On 13 Dec 2016, at 07:54, Colin Percival  wrote:
> 
> Author: cperciva
> Date: Tue Dec 13 06:54:13 2016
> New Revision: 310013
> URL: https://svnweb.freebsd.org/changeset/base/310013
> 
> Log:
>  Check that blkfront devices have a non-zero number of sectors and a
>  non-zero sector size.  Such a device would be a virtual disk of zero
>  bytes; clearly not useful, and not something we should try to attach.
> 
>  As a fortuitous side effect, checking that these values are non-zero
>  here results in them not *becoming* zero later on the function.  This
>  odd behaviour began with r309124 (clang 3.9.0) but is challenging to
>  debug; making any changes to this function whatsoever seems to affect
>  the llvm optimizer behaviour enough to make the unexpected zeroing of
>  the sector_size variable cease.

I've been having some fun debugging a kernel under Xen, and what I found
is that sector_size changes from 512 to 0 because of an xs_gather() call
in xbd_connect().  The function starts as follows:

  1222  static void
  1223  xbd_connect(struct xbd_softc *sc)
  1224  {
  1225  device_t dev = sc->xbd_dev;
  1226  unsigned long sectors, sector_size, phys_sector_size;
  1227  unsigned int binfo;
  1228  int err, feature_barrier, feature_flush;
...
  1237  err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
  1238  "sectors", "%lu", ,
  1239  "info", "%u", ,
  1240  "sector-size", "%lu", _size,
  1241  NULL);

After this first call to xs_gather(), sectors is 44040322 (in my case of
a ~21G disk), binfo is zero, and sector_size is 512.  During execution
of the following few lines, sector_size stays 512, until just after the
fourth call to xs_gather():

  1259  err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
  1260   "feature-flush-cache", "%lu", _flush,
  1261   NULL);

and then it becomes zero!  This is because the %lu format scans a 64 bit
unsigned integer, while the feature_flush variable is a 32 bit signed
integer, thus overwriting an adjacent location on the stack, which
happens to contain sector_size: in the assembly output, sector_size is
at -88(%rbp), while feature_flush is at -92(%rbp).

There is another instance of such an incorrect format, a few lines
before this, but it doesn't seem to scribble over important data (or we
didn't panic because of it, yet):

  1253  err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
  1254   "feature-barrier", "%lu", _barrier,
  1255   NULL);

Here, feature_barrier is a 32 bit signed integer, while %lu again scans
a 64 bit unsigned integer.

In short, I think the following change would also fix the problem:

Index: sys/dev/xen/blkfront/blkfront.c
===
--- sys/dev/xen/blkfront/blkfront.c (revision 309817)
+++ sys/dev/xen/blkfront/blkfront.c (working copy)
@@ -1251,13 +1251,13 @@ xbd_connect(struct xbd_softc *sc)
if (err || phys_sector_size <= sector_size)
phys_sector_size = 0;
err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
-"feature-barrier", "%lu", _barrier,
+"feature-barrier", "%d", _barrier,
 NULL);
if (err == 0 && feature_barrier != 0)
sc->xbd_flags |= XBDF_BARRIER;

err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
-"feature-flush-cache", "%lu", _flush,
+"feature-flush-cache", "%d", _flush,
 NULL);
if (err == 0 && feature_flush != 0)
sc->xbd_flags |= XBDF_FLUSH;

However, I have some difficulty getting a custom-built kernel booting on
my very rudimentary Xen setup.  I am using a snapshot raw image, with no
idea how to insert a kernel into it.

E.g, can you please try this out, instead of the zero-check fix?  I am
very curious whether that fixes the panics. :)

-Dimitry

P.S.: We really need AddressSanitizer support in the kernel...



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r310032 - head/sys/kern

2016-12-13 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec 13 20:11:45 2016
New Revision: 310032
URL: https://svnweb.freebsd.org/changeset/base/310032

Log:
  Zero return value when counter_rate() switches over to next second and
  value is positive, but below the limit.

Modified:
  head/sys/kern/subr_counter.c

Modified: head/sys/kern/subr_counter.c
==
--- head/sys/kern/subr_counter.cTue Dec 13 19:58:21 2016
(r310031)
+++ head/sys/kern/subr_counter.cTue Dec 13 20:11:45 2016
(r310032)
@@ -154,6 +154,8 @@ counter_ratecheck(struct counter_rate *c
counter_u64_zero(cr->cr_rate);
cr->cr_over = 0;
cr->cr_ticks = now;
+   if (val <= limit)
+   val = 0;
}
atomic_store_rel_int(>cr_lock, 0);
} else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310031 - head/sys/compat/linuxkpi/common/include/linux

2016-12-13 Thread Conrad E. Meyer
Author: cem
Date: Tue Dec 13 19:58:21 2016
New Revision: 310031
URL: https://svnweb.freebsd.org/changeset/base/310031

Log:
  linuxkpi: Fix not-found case of linux_pci_find_irq_dev
  
  Linux list_for_each_entry() does not neccessarily end with the iterator
  NULL (it may be an offset from NULL if the list member is not the first
  element of the member struct).
  
  Reported by:  Coverity
  CID:  1366940
  Reviewed by:  hselasky@
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D8780

Modified:
  head/sys/compat/linuxkpi/common/include/linux/pci.h

Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h
==
--- head/sys/compat/linuxkpi/common/include/linux/pci.h Tue Dec 13 19:36:05 
2016(r310030)
+++ head/sys/compat/linuxkpi/common/include/linux/pci.h Tue Dec 13 19:58:21 
2016(r310031)
@@ -220,18 +220,19 @@ static inline struct device *
 linux_pci_find_irq_dev(unsigned int irq)
 {
struct pci_dev *pdev;
+   struct device *found;
 
+   found = NULL;
spin_lock(_lock);
list_for_each_entry(pdev, _devices, links) {
-   if (irq == pdev->dev.irq)
-   break;
-   if (irq >= pdev->dev.msix && irq < pdev->dev.msix_max)
+   if (irq == pdev->dev.irq ||
+   (irq >= pdev->dev.msix && irq < pdev->dev.msix_max)) {
+   found = >dev;
break;
+   }
}
spin_unlock(_lock);
-   if (pdev)
-   return >dev;
-   return (NULL);
+   return (found);
 }
 
 static inline unsigned long
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-12-13 Thread John Baldwin
Author: jhb
Date: Tue Dec 13 19:36:05 2016
New Revision: 310030
URL: https://svnweb.freebsd.org/changeset/base/310030

Log:
  Use register_t instead of uintptr_t for register values in backtraces.
  
  This fixes backtraces from DDB in n32 kernels as uintptr_t is only a
  uint32_t.  In particular, the upper 32-bits of each register value were
  treated as the register's value breaking both the output of register
  values, but also the values of 'ra' and 'sp' required to walk up to the
  previous frame.
  
  Sponsored by: DARPA / AFRL

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

Modified: head/sys/mips/mips/db_trace.c
==
--- head/sys/mips/mips/db_trace.c   Tue Dec 13 19:27:31 2016
(r310029)
+++ head/sys/mips/mips/db_trace.c   Tue Dec 13 19:36:05 2016
(r310030)
@@ -139,8 +139,8 @@ stacktrace_subr(register_t pc, register_
 * of these registers is valid, e.g. obtained from the stack
 */
int valid_args[4];
-   uintptr_t args[4];
-   uintptr_t va, subr;
+   register_t args[4];
+   register_t va, subr;
unsigned instr, mask;
unsigned int frames = 0;
int more, stksize, j;
@@ -379,7 +379,7 @@ done:
if (j > 0)
(*printfn)(",");
if (valid_args[j])
-   (*printfn)("%x", args[j]);
+   (*printfn)("%jx", (uintmax_t)(u_register_t)args[j]);
else
(*printfn)("?");
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-12-13 Thread John Baldwin
Author: jhb
Date: Tue Dec 13 19:27:31 2016
New Revision: 310029
URL: https://svnweb.freebsd.org/changeset/base/310029

Log:
  Fix remove_userlocal_code() for n32.
  
  n32 kernels use a 64-bit store to the TLS register rather than a 32-bit
  store.
  
  Sponsored by: DARPA / AFRL

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

Modified: head/sys/mips/mips/cpu.c
==
--- head/sys/mips/mips/cpu.cTue Dec 13 19:22:43 2016(r310028)
+++ head/sys/mips/mips/cpu.cTue Dec 13 19:27:31 2016(r310029)
@@ -78,9 +78,6 @@ struct mips_cpuinfo cpuinfo;
 #   define _ADDU_V0_T0_T1 \
 _ENCODE_INSN(0, T0, T1, V0, OP_DADDU)
 
-#   define _MTC0_V0_USERLOCAL \
-_ENCODE_INSN(OP_COP0, OP_DMT, V0, 4, 2)
-
 #else /* mips 32 */
 
 #   define _LOAD_T0_MDTLS_A1 \
@@ -93,10 +90,19 @@ struct mips_cpuinfo cpuinfo;
 #   define _ADDU_V0_T0_T1 \
 _ENCODE_INSN(0, T0, T1, V0, OP_ADDU)
 
+#endif /* ! __mips_n64 */
+
+#if defined(__mips_n64) || defined(__mips_n32)
+
+#   define _MTC0_V0_USERLOCAL \
+_ENCODE_INSN(OP_COP0, OP_DMT, V0, 4, 2)
+
+#else /* mips o32 */
+
 #   define _MTC0_V0_USERLOCAL \
 _ENCODE_INSN(OP_COP0, OP_MT, V0, 4, 2)
 
-#endif /* ! __mips_n64 */
+#endif /* ! (__mips_n64 || __mipsn32) */
 
 #define_JR_RA  _ENCODE_INSN(OP_SPECIAL, RA, 0, 0, OP_JR)
 #define_NOP0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310028 - head/sys/vm

2016-12-13 Thread John Baldwin
Author: jhb
Date: Tue Dec 13 19:22:43 2016
New Revision: 310028
URL: https://svnweb.freebsd.org/changeset/base/310028

Log:
  Use db_lookup_proc() in the DDB 'show procvm' command.
  
  This allows processes to be identified by PID as well as a pointer address.
  
  MFC after:2 weeks
  Sponsored by: DARPA / AFRL

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cTue Dec 13 19:04:05 2016(r310027)
+++ head/sys/vm/vm_map.cTue Dec 13 19:22:43 2016(r310028)
@@ -4309,7 +4309,7 @@ DB_SHOW_COMMAND(procvm, procvm)
struct proc *p;
 
if (have_addr) {
-   p = (struct proc *) addr;
+   p = db_lookup_proc(addr);
} else {
p = curproc;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310027 - head/sys/dev/drm2/i915

2016-12-13 Thread Konstantin Belousov
Author: kib
Date: Tue Dec 13 19:04:05 2016
New Revision: 310027
URL: https://svnweb.freebsd.org/changeset/base/310027

Log:
  Fix bug in r309712, do not leak gem object pin count in case of error
  or retry.
  
  Reported and tested by:   Michael Butler 
  Sponsored by: The FreeBSD Foundation
  MFC after:16 days

Modified:
  head/sys/dev/drm2/i915/i915_gem.c

Modified: head/sys/dev/drm2/i915/i915_gem.c
==
--- head/sys/dev/drm2/i915/i915_gem.c   Tue Dec 13 18:15:11 2016
(r310026)
+++ head/sys/dev/drm2/i915/i915_gem.c   Tue Dec 13 19:04:05 2016
(r310027)
@@ -1521,7 +1521,7 @@ retry:
/* Now bind it into the GTT if needed */
ret = i915_gem_object_pin(obj, 0, true, false);
if (ret)
-   goto unpin;
+   goto unlock;
pinned = 1;
 
ret = i915_gem_object_set_to_gtt_domain(obj, write);
@@ -1580,6 +1580,8 @@ have_page:
return (VM_PAGER_OK);
 
 unpin:
+   i915_gem_object_unpin(obj);
+unlock:
DRM_UNLOCK(dev);
 out:
KASSERT(ret != 0, ("i915_gem_pager_fault: wrong return"));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r309933 - head/usr.sbin/syslogd

2016-12-13 Thread Conrad Meyer
On Mon, Dec 12, 2016 at 11:33 AM, Hiroki Sato  wrote:
> Author: hrs
> Date: Mon Dec 12 19:33:40 2016
> New Revision: 309933
> URL: https://svnweb.freebsd.org/changeset/base/309933
>
> Log:
>   - Refactor listening socket list.  All of the listening sockets are
> now maintained in a single linked-list in a transport-independent manner.
>   - Use queue.h for linked-list structure.
>   - Use linked-list for AllowedPeers.
>   - Use getaddrinfo(8) even for Unix Domain sockets.
>   - Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
>   - Define fu_* macro for union f_un to shorten the member names.
>   - Remove an extra #include .
>   - Add "static" to non-exported symbols.
>   - !INET support is still incomplete but will be fixed later.
>
>   There is no functional change except for some minor debug messages.

Hello Hiroki,

This refactor introduced a bug in the IPv6 address comparison/rejection logic.

> Modified: head/usr.sbin/syslogd/syslogd.c
> ==
> --- head/usr.sbin/syslogd/syslogd.c Mon Dec 12 19:26:55 2016
> (r309932)
> +++ head/usr.sbin/syslogd/syslogd.c Mon Dec 12 19:33:40 2016
> (r309933)
> ...
>  reject = 0;
> - for (j = 0; j < 16; j += 4) {
> - if ((*(u_int32_t *)>sin6_addr.s6_addr[j] & *(u_int32_t 
> *)>sin6_addr.s6_addr[j])
> -!= *(u_int32_t *)>sin6_addr.s6_addr[j]) {
> - ++reject;
> - break;
> - }
> + if (IN6_ARE_MASKED_ADDR_EQUAL(>sin6_addr,
> +>sin6_addr, >sin6_addr) != 0) {
> + ++reject;
> + break;
>  }
>  if (reject) {
>   dprintf("rejected in rule %d due to IP mismatch.\n", i);

The new check isn't a loop, so the 'break' breaks out of the outer
loop, which is unintentional.  I think we should just remove 'break'.

This was found by Coverity CID 1366941.

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


svn commit: r310026 - head/sbin/decryptcore

2016-12-13 Thread Christian Brueffer
Author: brueffer
Date: Tue Dec 13 18:15:11 2016
New Revision: 310026
URL: https://svnweb.freebsd.org/changeset/base/310026

Log:
  Language and mdoc cleanup.

Modified:
  head/sbin/decryptcore/decryptcore.8

Modified: head/sbin/decryptcore/decryptcore.8
==
--- head/sbin/decryptcore/decryptcore.8 Tue Dec 13 18:05:14 2016
(r310025)
+++ head/sbin/decryptcore/decryptcore.8 Tue Dec 13 18:15:11 2016
(r310026)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 10, 2016
+.Dd December 13, 2016
 .Dt DECRYPTCORE 8
 .Os
 .Sh NAME
@@ -45,7 +45,7 @@
 .Sh DESCRIPTION
 The
 .Nm
-first decrypts
+utility first decrypts
 .Ar keyfile
 using
 .Ar privatekeyfile
@@ -53,7 +53,7 @@ and then uses the resulting key to decry
 .Ar encryptedcore
 saved by
 .Xr savecore 8 .
-Result is saved in
+The result is saved in
 .Ar core .
 .Pp
 Alternatively a user can decrypt a core dump numbered
@@ -91,24 +91,22 @@ Specify location of an encrypted core.
 .It Fl c Ar core
 Specify location of a resulting decrypted core dump.
 .It Fl d Ar crashdir
-Specify an alternative crash dump directory. The default crash dump directory 
is
+Specify an alternative crash dump directory.
+The default crash dump directory is
 .Pa /var/crash .
 .It Fl n Ar dumpnr
 Specify a number of a crash dump to be decrypted.
 .El
 .Sh EXIT STATUS
-The
-.Nm
-utility exits 0 on success, and >0 if an error occurs.
+.Ex -std
 .Sh SEE ALSO
+.Xr kgdb 1 ,
 .Xr capsicum 4 ,
 .Xr dumpon 8 ,
-.Xr kgdb 1 ,
 .Xr savecore 8 ,
 .Xr syslogd 8
 .Sh AUTHORS
 The
 .Nm
-was implemented by
-.An -nosplit
+utility was implemented by
 .An Konrad Witaszczyk Aq Mt d...@freebsd.org .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-12-13 Thread Bryan Drewery
Author: bdrewery
Date: Tue Dec 13 18:05:14 2016
New Revision: 310025
URL: https://svnweb.freebsd.org/changeset/base/310025

Log:
  Take write lock for rtld_bind before modifying obj_list in dl_iterate_phdr().
  
  This avoids a race with readers such as dladdr(3)/dlinfo(3)/dlsym(3) and
  the atexit(3) handler.  This race was introduced in r294373.
  
  Reviewed by:  markj, kib, kan
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

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

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cTue Dec 13 16:53:58 2016
(r310024)
+++ head/libexec/rtld-elf/rtld.cTue Dec 13 18:05:14 2016
(r310025)
@@ -3549,7 +3549,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac
error = 0;
 
wlock_acquire(rtld_phdr_lock, _lockstate);
-   rlock_acquire(rtld_bind_lock, _lockstate);
+   wlock_acquire(rtld_bind_lock, _lockstate);
for (obj = globallist_curr(TAILQ_FIRST(_list)); obj != NULL;) {
TAILQ_INSERT_AFTER(_list, obj, , next);
rtld_fill_dl_phdr_info(obj, _info);
@@ -3557,7 +3557,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac
 
error = callback(_info, sizeof phdr_info, param);
 
-   rlock_acquire(rtld_bind_lock, _lockstate);
+   wlock_acquire(rtld_bind_lock, _lockstate);
obj = globallist_next();
TAILQ_REMOVE(_list, , next);
if (error != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310024 - head/share/misc

2016-12-13 Thread Nikolai Lifanov
Author: lifanov (ports committer)
Date: Tue Dec 13 16:53:58 2016
New Revision: 310024
URL: https://svnweb.freebsd.org/changeset/base/310024

Log:
  add myself as a ports committer and update mentor/mentee relationship
  
  Reviewed by:  matthew
  Approved by:  matthew (mentor)
  Differential Revision:https://reviews.freebsd.org/D8774

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotTue Dec 13 16:20:10 2016
(r310023)
+++ head/share/misc/committers-ports.dotTue Dec 13 16:53:58 2016
(r310024)
@@ -145,6 +145,7 @@ lawrance [label="Sam Lawrance\nlawrance@
 lbr [label="Lars Balker Rasmussen\n...@freebsd.org\n2006/04/30"]
 leeym [label="Yen-Ming Lee\nle...@freebsd.org\n2002/08/14"]
 lev [label="Lev Serebryakov\n...@freebsd.org\n2003/06/17"]
+lifanov [label="Nikolai Lifanov\nlifa...@freebsd.org\n2016/12/11"]
 linimon [label="Mark Linimon\nlini...@freebsd.org\n2003/10/23"]
 lioux [label="Mario Sergio Fujikawa Ferriera\nli...@freebsd.org\n2000/10/14"]
 lippe [label="Felippe de Meirelles Motta\nli...@freebsd.org\n2008/03/08"]
@@ -475,6 +476,8 @@ mat -> tcberner
 mat -> thierry
 mat -> woodsb02
 
+matthew -> lifanov
+
 mezz -> tmclaugh
 
 miwi -> amdmi3
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310023 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs

2016-12-13 Thread Alexander Motin
Author: mav
Date: Tue Dec 13 16:20:10 2016
New Revision: 310023
URL: https://svnweb.freebsd.org/changeset/base/310023

Log:
  Reduce diff from Illumos by better variables mapping.

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

Modified: head/sys/cddl/compat/opensolaris/sys/kmem.h
==
--- head/sys/cddl/compat/opensolaris/sys/kmem.h Tue Dec 13 13:46:09 2016
(r310022)
+++ head/sys/cddl/compat/opensolaris/sys/kmem.h Tue Dec 13 16:20:10 2016
(r310023)
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 MALLOC_DECLARE(M_SOLARIS);
 
@@ -77,8 +78,10 @@ void kmem_reap(void);
 int kmem_debugging(void);
 void *calloc(size_t n, size_t s);
 
-#definefreemem vm_cnt.v_free_count
-#defineminfree vm_cnt.v_free_min
+#definefreemem (long)vm_cnt.v_free_count
+#definedesfree (long)vm_cnt.v_free_target
+#defineminfree (long)vm_cnt.v_free_min
+#defineneedfree(long)vm_pageout_deficit
 #defineheap_arena  kmem_arena
 #definekmem_alloc(size, kmflags)   zfs_kmem_alloc((size), 
(kmflags))
 #definekmem_zalloc(size, kmflags)  zfs_kmem_alloc((size), 
(kmflags) | M_ZERO)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Dec 13 
13:46:09 2016(r310022)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Dec 13 
16:20:10 2016(r310023)
@@ -357,6 +357,7 @@ int zfs_arc_shrink_shift = 0;
 int zfs_arc_p_min_shift = 0;
 uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */
 u_int zfs_arc_free_target = 0;
+#definelotsfreezfs_arc_free_target
 
 /* Absolute min for arc min / max is 16MB. */
 static uint64_t arc_abs_min = 16 << 20;
@@ -3827,8 +3828,6 @@ arc_shrink(int64_t to_free)
}
 }
 
-static long needfree = 0;
-
 typedef enum free_memory_reason_t {
FMR_UNKNOWN,
FMR_NEEDFREE,
@@ -3875,17 +3874,6 @@ arc_available_memory(void)
}
 
/*
-* Cooperate with pagedaemon when it's time for it to scan
-* and reclaim some pages.
-*/
-   n = PAGESIZE * ((int64_t)freemem - zfs_arc_free_target);
-   if (n < lowest) {
-   lowest = n;
-   r = FMR_LOTSFREE;
-   }
-
-#ifdef illumos
-   /*
 * check that we're out of range of the pageout scanner.  It starts to
 * schedule paging if freemem is less than lotsfree and needfree.
 * lotsfree is the high-water mark for pageout, and needfree is the
@@ -3898,6 +3886,7 @@ arc_available_memory(void)
r = FMR_LOTSFREE;
}
 
+#ifdef illumos
/*
 * check to make sure that swapfs has enough space so that anon
 * reservations can still succeed. anon_resvmem() checks that the
@@ -4154,9 +4143,6 @@ arc_reclaim_thread(void *dummy __unused)
 * infinite loop.
 */
if (arc_size <= arc_c || evicted == 0) {
-#ifdef _KERNEL
-   needfree = 0;
-#endif
/*
 * We're either no longer overflowing, or we
 * can't evict anything more, so we should wake
@@ -5883,8 +5869,6 @@ arc_lowmem(void *arg __unused, int howto
 {
 
mutex_enter(_reclaim_lock);
-   /* XXX: Memory deficit should be passed as argument. */
-   needfree = btoc(arc_c >> arc_shrink_shift);
DTRACE_PROBE(arc__needfree);
cv_signal(_reclaim_thread_cv);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310022 - in head/sys/arm: allwinner broadcom/bcm2835 freescale/imx nvidia/tegra124 ti

2016-12-13 Thread Andrew Turner
Author: andrew
Date: Tue Dec 13 13:46:09 2016
New Revision: 310022
URL: https://svnweb.freebsd.org/changeset/base/310022

Log:
  Use the platform_*_t typedefs to help check the platform function types are
  correct.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/aw_machdep.c
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/freescale/imx/imx51_machdep.c
  head/sys/arm/freescale/imx/imx53_machdep.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/ti/ti_machdep.c

Modified: head/sys/arm/allwinner/aw_machdep.c
==
--- head/sys/arm/allwinner/aw_machdep.c Tue Dec 13 13:43:22 2016
(r310021)
+++ head/sys/arm/allwinner/aw_machdep.c Tue Dec 13 13:46:09 2016
(r310022)
@@ -54,6 +54,17 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
+static platform_attach_t a10_attach;
+static platform_attach_t a13_attach;
+static platform_attach_t a20_attach;
+static platform_attach_t a31_attach;
+static platform_attach_t a31s_attach;
+static platform_attach_t a83t_attach;
+static platform_attach_t h3_attach;
+static platform_lastaddr_t allwinner_lastaddr;
+static platform_devmap_init_t allwinner_devmap_init;
+static platform_cpu_reset_t allwinner_cpu_reset;
+
 static u_int soc_type;
 static u_int soc_family;
 

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Tue Dec 13 13:43:22 
2016(r310021)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Tue Dec 13 13:46:09 
2016(r310022)
@@ -62,6 +62,16 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
+#ifdef SOC_BCM2835
+static platform_devmap_init_t bcm2835_devmap_init;
+#endif
+#ifdef SOC_BCM2836
+static platform_devmap_init_t bcm2836_devmap_init;
+#endif
+static platform_lastaddr_t bcm2835_lastaddr;
+static platform_late_init_t bcm2835_late_init;
+static platform_cpu_reset_t bcm2835_cpu_reset;
+
 static vm_offset_t
 bcm2835_lastaddr(platform_t plat)
 {

Modified: head/sys/arm/freescale/imx/imx51_machdep.c
==
--- head/sys/arm/freescale/imx/imx51_machdep.c  Tue Dec 13 13:43:22 2016
(r310021)
+++ head/sys/arm/freescale/imx/imx51_machdep.c  Tue Dec 13 13:46:09 2016
(r310022)
@@ -45,6 +45,11 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
+static platform_attach_t imx51_attach;
+static platform_devmap_init_t imx51_devmap_init;
+static platform_lastaddr_t imx51_lastaddr;
+static platform_cpu_reset_t imx51_cpu_reset;
+
 static vm_offset_t
 imx51_lastaddr(platform_t plat)
 {
@@ -88,7 +93,8 @@ imx51_cpu_reset(platform_t plat)
imx_wdog_cpu_reset(0x73F98000);
 }
 
-u_int imx_soc_type()
+u_int
+imx_soc_type(void)
 {
return (IMXSOC_51);
 }

Modified: head/sys/arm/freescale/imx/imx53_machdep.c
==
--- head/sys/arm/freescale/imx/imx53_machdep.c  Tue Dec 13 13:43:22 2016
(r310021)
+++ head/sys/arm/freescale/imx/imx53_machdep.c  Tue Dec 13 13:46:09 2016
(r310022)
@@ -45,6 +45,11 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
+static platform_attach_t imx53_attach;
+static platform_devmap_init_t imx53_devmap_init;
+static platform_lastaddr_t imx53_lastaddr;
+static platform_cpu_reset_t imx53_cpu_reset;
+
 static vm_offset_t
 imx53_lastaddr(platform_t plat)
 {
@@ -88,7 +93,8 @@ imx53_cpu_reset(platform_t plat)
imx_wdog_cpu_reset(0x53F98000);
 }
 
-u_int imx_soc_type()
+u_int
+imx_soc_type(void)
 {
return (IMXSOC_53);
 }

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==
--- head/sys/arm/freescale/imx/imx6_machdep.c   Tue Dec 13 13:43:22 2016
(r310021)
+++ head/sys/arm/freescale/imx/imx6_machdep.c   Tue Dec 13 13:46:09 2016
(r310022)
@@ -54,6 +54,12 @@ __FBSDID("$FreeBSD$");
 
 static uint32_t gpio1_node;
 
+static platform_attach_t imx6_attach;
+static platform_devmap_init_t imx6_devmap_init;
+static platform_lastaddr_t imx6_lastaddr;
+static platform_late_init_t imx6_late_init;
+static platform_cpu_reset_t imx6_cpu_reset;
+
 #ifndef INTRNG
 /*
  * Work around the linux workaround for imx6 erratum 006687, in which some
@@ -259,7 +265,8 @@ imx6_cpu_reset(platform_t plat)
  *  hwsoc  = 0x0063
  *  scu config = 0x5503
  */
-u_int imx_soc_type()
+u_int
+imx_soc_type(void)
 {
uint32_t digprog, hwsoc;
uint32_t *pcr;

Modified: head/sys/arm/nvidia/tegra124/tegra124_machdep.c
==
--- head/sys/arm/nvidia/tegra124/tegra124_machdep.c Tue Dec 13 13:43:22 
2016(r310021)
+++ 

svn commit: r310021 - in head/sys/arm: allwinner amlogic/aml8726 arm broadcom/bcm2835 freescale/imx lpc nvidia rockchip ti/am335x versatile xilinx xscale/pxa

2016-12-13 Thread Andrew Turner
Author: andrew
Date: Tue Dec 13 13:43:22 2016
New Revision: 310021
URL: https://svnweb.freebsd.org/changeset/base/310021

Log:
  Add the missing void to function signatures in much of the arm code.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/aw_wdog.c
  head/sys/arm/amlogic/aml8726/aml8726_identsoc.c
  head/sys/arm/amlogic/aml8726/aml8726_machdep.c
  head/sys/arm/amlogic/aml8726/aml8726_wdt.c
  head/sys/arm/arm/cpufunc.c
  head/sys/arm/arm/db_trace.c
  head/sys/arm/arm/physmem.c
  head/sys/arm/arm/undefined.c
  head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
  head/sys/arm/freescale/imx/imx6_anatop.c
  head/sys/arm/freescale/imx/imx6_src.c
  head/sys/arm/lpc/lpc_gpio.c
  head/sys/arm/nvidia/tegra_efuse.c
  head/sys/arm/rockchip/rk30xx_wdog.c
  head/sys/arm/ti/am335x/am335x_dmtpps.c
  head/sys/arm/versatile/versatile_machdep.c
  head/sys/arm/xilinx/zy7_machdep.c
  head/sys/arm/xilinx/zy7_slcr.c
  head/sys/arm/xscale/pxa/pxa_gpio.c
  head/sys/arm/xscale/pxa/pxa_icu.c
  head/sys/arm/xscale/pxa/pxa_space.c
  head/sys/arm/xscale/pxa/pxa_timer.c

Modified: head/sys/arm/allwinner/aw_wdog.c
==
--- head/sys/arm/allwinner/aw_wdog.cTue Dec 13 13:07:17 2016
(r310020)
+++ head/sys/arm/allwinner/aw_wdog.cTue Dec 13 13:43:22 2016
(r310021)
@@ -237,7 +237,7 @@ aw_wdog_shutdown_fn(void *private, int h
 }
 
 void
-aw_wdog_watchdog_reset()
+aw_wdog_watchdog_reset(void)
 {
 
if (aw_wdog_sc == NULL) {

Modified: head/sys/arm/amlogic/aml8726/aml8726_identsoc.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_identsoc.c Tue Dec 13 13:07:17 
2016(r310020)
+++ head/sys/arm/amlogic/aml8726/aml8726_identsoc.c Tue Dec 13 13:43:22 
2016(r310021)
@@ -87,7 +87,7 @@ static const struct {
 };
 
 void
-aml8726_identify_soc()
+aml8726_identify_soc(void)
 {
int err;
struct resource res;

Modified: head/sys/arm/amlogic/aml8726/aml8726_machdep.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Tue Dec 13 13:07:17 
2016(r310020)
+++ head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Tue Dec 13 13:43:22 
2016(r310021)
@@ -56,7 +56,7 @@ vm_offset_t aml8726_aobus_kva_base;
 #endif
 
 static void
-aml8726_fixup_busfreq()
+aml8726_fixup_busfreq(void)
 {
phandle_t node;
pcell_t freq, prop;

Modified: head/sys/arm/amlogic/aml8726/aml8726_wdt.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_wdt.c  Tue Dec 13 13:07:17 2016
(r310020)
+++ head/sys/arm/amlogic/aml8726/aml8726_wdt.c  Tue Dec 13 13:43:22 2016
(r310021)
@@ -289,7 +289,7 @@ EARLY_DRIVER_MODULE(wdt, simplebus, aml8
 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
 
 void
-cpu_reset()
+cpu_reset(void)
 {
 
/* Watchdog has not yet been initialized */

Modified: head/sys/arm/arm/cpufunc.c
==
--- head/sys/arm/arm/cpufunc.c  Tue Dec 13 13:07:17 2016(r310020)
+++ head/sys/arm/arm/cpufunc.c  Tue Dec 13 13:43:22 2016(r310021)
@@ -485,7 +485,7 @@ static int  arm_dcache_l2_assoc;
 static int arm_dcache_l2_linesize;
 
 static void
-get_cachetype_cp15()
+get_cachetype_cp15(void)
 {
u_int ctype, isize, dsize, cpuid;
u_int clevel, csize, i, sel;
@@ -600,7 +600,7 @@ get_cachetype_cp15()
  */
 
 int
-set_cpufuncs()
+set_cpufuncs(void)
 {
cputype = cpu_ident();
cputype &= CPU_ID_CPU_MASK;

Modified: head/sys/arm/arm/db_trace.c
==
--- head/sys/arm/arm/db_trace.c Tue Dec 13 13:07:17 2016(r310020)
+++ head/sys/arm/arm/db_trace.c Tue Dec 13 13:43:22 2016(r310021)
@@ -130,7 +130,7 @@ db_stack_trace_cmd(struct unwind_state *
 }
 
 void
-db_md_list_watchpoints()
+db_md_list_watchpoints(void)
 {
 
dbg_show_watchpoint();

Modified: head/sys/arm/arm/physmem.c
==
--- head/sys/arm/arm/physmem.c  Tue Dec 13 13:07:17 2016(r310020)
+++ head/sys/arm/arm/physmem.c  Tue Dec 13 13:43:22 2016(r310021)
@@ -145,7 +145,7 @@ physmem_dump_tables(int (*prfunc)(const 
  * Print the contents of the static mapping table.  Used for bootverbose.
  */
 void
-arm_physmem_print_tables()
+arm_physmem_print_tables(void)
 {
 
physmem_dump_tables(printf);

Modified: head/sys/arm/arm/undefined.c
==
--- head/sys/arm/arm/undefined.cTue Dec 13 13:07:17 2016
(r310020)
+++ head/sys/arm/arm/undefined.cTue Dec 13 13:43:22 2016
(r310021)
@@ -165,7 +165,7 @@ 

svn commit: r310020 - head/sys/arm/rockchip

2016-12-13 Thread Andrew Turner
Author: andrew
Date: Tue Dec 13 13:07:17 2016
New Revision: 310020
URL: https://svnweb.freebsd.org/changeset/base/310020

Log:
  Use platform_*_t to check the platform function signatures are correct in
  the Rockchip platform code and correct the one place they differ.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/rockchip/rk30xx_machdep.c

Modified: head/sys/arm/rockchip/rk30xx_machdep.c
==
--- head/sys/arm/rockchip/rk30xx_machdep.c  Tue Dec 13 11:43:46 2016
(r310019)
+++ head/sys/arm/rockchip/rk30xx_machdep.c  Tue Dec 13 13:07:17 2016
(r310020)
@@ -52,6 +52,11 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
+static platform_lastaddr_t rk30xx_lastaddr;
+static platform_devmap_init_t rk30xx_devmap_init;
+static platform_late_init_t rk30xx_late_init;
+static platform_cpu_reset_t rk30xx_cpu_reset;
+
 static vm_offset_t
 rk30xx_lastaddr(platform_t plat)
 {
@@ -82,7 +87,7 @@ rk30xx_devmap_init(platform_t plat)
 }
 
 static void
-rk30xx_cpu_reset()
+rk30xx_cpu_reset(platform_t plat)
 {
 
rk30_wd_watchdog_reset();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r309891 - head/sys/kern

2016-12-13 Thread Konstantin Belousov
On Tue, Dec 13, 2016 at 10:20:30AM +1100, Bruce Evans wrote:
> Hrmph.  kib didn't like my patch to kill the spam from reentering ddb.
> The spam messes up even cases where the ddb command handles errors.
> Howver, in most cases the error handling is incomplete.  There is always
> the outer setjmp/longjmp back to the command loop.  This gives null and
> bad error handling for unexpected null pointer accesses like the one here.
> Other cases set up inner setjump/longjmps which longjmp back to an inner
> context which prints an error message (spammed by the reentry messages)
> and should clean up.  However, cleanup is rarely done.  One case is
> writing to inaccessible memory on at least x86.  Then the page tables
> are left in modified state.
You have a variant of the patch which makes the behaviour adjustable.
I already agreed with that modification, and with making the defaults
to not print the backtrace.

> 
> Null pointer panics are also interesting.  They seem to have been broken
> on i386 by the double mapping of low memory (PTD[0] = PTD[KERNBASE >> 12] =
> shared page table for low physical memory).  So the null pointer is mapped
> and points to physical memory 0 .  There are other bugs from the shared
> page table.  When I fix the other bugs by changing PTD[0] to 0, this also
> fixes null pointers.  It breaks ACPI resume but not much else.  See
> locore.s for some details about the mapping -- it is documented as being
> mainly for ACPI.  But ACPI somehow works on amd64 with PTD[0] = 0.
That page table is only active for the kernel processes, so most often,
when userspace part is present, page at zero is not mapped.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310019 - in head/sys: arm/conf arm/rockchip conf

2016-12-13 Thread Ganbold Tsagaankhuu
Author: ganbold
Date: Tue Dec 13 11:43:46 2016
New Revision: 310019
URL: https://svnweb.freebsd.org/changeset/base/310019

Log:
  Switch Rockchip RK3188 SoC to use the platform code.
  
  Reviewed by:  andrew, manu
  Differential Revision:https://reviews.freebsd.org/D8769

Added:
  head/sys/arm/rockchip/rk30xx_mp.h   (contents, props changed)
Modified:
  head/sys/arm/conf/RK3188
  head/sys/arm/rockchip/rk30xx_machdep.c
  head/sys/arm/rockchip/rk30xx_mp.c
  head/sys/conf/options.arm

Modified: head/sys/arm/conf/RK3188
==
--- head/sys/arm/conf/RK3188Tue Dec 13 10:03:29 2016(r310018)
+++ head/sys/arm/conf/RK3188Tue Dec 13 11:43:46 2016(r310019)
@@ -23,8 +23,13 @@ identRK3188
 include"std.armv6"
 include"../rockchip/std.rk30xx"
 
+optionsSOC_ROCKCHIP_RK3188
+
 optionsSCHED_ULE   # ULE scheduler
 optionsSMP # Enable multiple cores
+optionsPLATFORM
+optionsPLATFORM_SMP
+optionsMULTIDELAY
 
 # Root mount from MMC/SD card
 optionsROOTDEVNAME=\"ufs:/dev/mmcsd0\"

Modified: head/sys/arm/rockchip/rk30xx_machdep.c
==
--- head/sys/arm/rockchip/rk30xx_machdep.c  Tue Dec 13 10:03:29 2016
(r310018)
+++ head/sys/arm/rockchip/rk30xx_machdep.c  Tue Dec 13 11:43:46 2016
(r310019)
@@ -42,33 +42,25 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
-#include  
+#include 
+#include 
 
 #include 
+#include 
 
-vm_offset_t
-platform_lastaddr(void)
-{
+#include "platform_if.h"
 
-   return (devmap_lastaddr());
-}
-
-void
-platform_probe_and_attach(void)
+static vm_offset_t
+rk30xx_lastaddr(platform_t plat)
 {
 
+   return (devmap_lastaddr());
 }
 
-void
-platform_gpio_init(void)
-{
-}
-
-void
-platform_late_init(void)
+static void
+rk30xx_late_init(platform_t plat)
 {
 
/* Enable cache */
@@ -79,8 +71,8 @@ platform_late_init(void)
 /*
  * Set up static device mappings.
  */
-int
-platform_devmap_init(void)
+static int
+rk30xx_devmap_init(platform_t plat)
 {
 
devmap_add_entry(0x1000, 0x0020);
@@ -89,11 +81,27 @@ platform_devmap_init(void)
return (0);
 }
 
-void
-cpu_reset()
+static void
+rk30xx_cpu_reset()
 {
 
rk30_wd_watchdog_reset();
printf("Reset failed!\n");
while (1);
 }
+
+#if defined(SOC_ROCKCHIP_RK3188)
+static platform_method_t rk30xx_methods[] = {
+   PLATFORMMETHOD(platform_lastaddr,   rk30xx_lastaddr),
+   PLATFORMMETHOD(platform_devmap_init,rk30xx_devmap_init),
+   PLATFORMMETHOD(platform_late_init,  rk30xx_late_init),
+   PLATFORMMETHOD(platform_cpu_reset,  rk30xx_cpu_reset),
+
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,rk30xx_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,rk30xx_mp_setmaxid),
+#endif
+   PLATFORMMETHOD_END,
+};
+FDT_PLATFORM_DEF(rk30xx, "RK3188", 0, "rockchip,rk3188", 200);
+#endif

Modified: head/sys/arm/rockchip/rk30xx_mp.c
==
--- head/sys/arm/rockchip/rk30xx_mp.c   Tue Dec 13 10:03:29 2016
(r310018)
+++ head/sys/arm/rockchip/rk30xx_mp.c   Tue Dec 13 11:43:46 2016
(r310019)
@@ -37,9 +37,13 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+
+#include 
 
 #defineSCU_PHYSBASE0x1013c000
 #defineSCU_SIZE0x100
@@ -80,7 +84,7 @@ rk30xx_boot2(void)
 }
 
 void
-platform_mp_setmaxid(void)
+rk30xx_mp_setmaxid(platform_t plat)
 {
bus_space_handle_t scu;
int ncpu;
@@ -101,7 +105,7 @@ platform_mp_setmaxid(void)
 }
 
 void
-platform_mp_start_ap(void)
+rk30xx_mp_start_ap(platform_t plat)
 {
bus_space_handle_t scu;
bus_space_handle_t imem;

Added: head/sys/arm/rockchip/rk30xx_mp.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/rockchip/rk30xx_mp.h   Tue Dec 13 11:43:46 2016
(r310019)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (C) 2016 Ganbold Tsagaankhuu 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS 

svn commit: r310018 - head/sys/dev/gpio

2016-12-13 Thread Michael Zhilin
Author: mizhka
Date: Tue Dec 13 10:03:29 2016
New Revision: 310018
URL: https://svnweb.freebsd.org/changeset/base/310018

Log:
  [gpiospi] add clock delay to avoid smashing of bits
  
  Submitted by: Hiroki Mori 
  Reviewed by:  loos, ray, mizhka
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D8749

Modified:
  head/sys/dev/gpio/gpiospi.c

Modified: head/sys/dev/gpio/gpiospi.c
==
--- head/sys/dev/gpio/gpiospi.c Tue Dec 13 09:53:43 2016(r310017)
+++ head/sys/dev/gpio/gpiospi.c Tue Dec 13 10:03:29 2016(r310018)
@@ -293,6 +293,7 @@ gpio_spi_txrx(struct gpio_spi_softc *sc,
gpio_delay(sc);
GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev,
sc->sc_sclk, 1);
+   gpio_delay(sc);
} else {
/* If mode 0 or 3 */
 
@@ -312,6 +313,7 @@ gpio_spi_txrx(struct gpio_spi_softc *sc,
gpio_delay(sc);
GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev,
sc->sc_sclk, 0);
+   gpio_delay(sc);
}
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310017 - in head/sys: dev/spibus mips/atheros/ar531x

2016-12-13 Thread Michael Zhilin
Author: mizhka
Date: Tue Dec 13 09:53:43 2016
New Revision: 310017
URL: https://svnweb.freebsd.org/changeset/base/310017

Log:
  [spi] reformat message and ar5315_spi minor fix
  
  This commit corrects print of nomatch (newline was too early) and fix
  unit number for new child in ar5315_spi (was 0, now is -1 to calculate it
  according to actual system state)
  
  Submitted by: Hiroki Mori 
  Reviewed by:  ray, loos, mizhka
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D8749

Modified:
  head/sys/dev/spibus/spibus.c
  head/sys/mips/atheros/ar531x/ar5315_spi.c

Modified: head/sys/dev/spibus/spibus.c
==
--- head/sys/dev/spibus/spibus.cTue Dec 13 09:43:49 2016
(r310016)
+++ head/sys/dev/spibus/spibus.cTue Dec 13 09:53:43 2016
(r310017)
@@ -117,8 +117,8 @@ spibus_probe_nomatch(device_t bus, devic
struct spibus_ivar *devi = SPIBUS_IVAR(child);
 
device_printf(bus, "");
-   printf(" at cs %d\n", devi->cs);
-   printf(" mode %d", devi->mode);
+   printf(" at cs %d", devi->cs);
+   printf(" mode %d\n", devi->mode);
return;
 }
 

Modified: head/sys/mips/atheros/ar531x/ar5315_spi.c
==
--- head/sys/mips/atheros/ar531x/ar5315_spi.c   Tue Dec 13 09:43:49 2016
(r310016)
+++ head/sys/mips/atheros/ar531x/ar5315_spi.c   Tue Dec 13 09:53:43 2016
(r310017)
@@ -122,7 +122,7 @@ ar5315_spi_attach(device_t dev)
return (ENXIO);
}
 
-   device_add_child(dev, "spibus", 0);
+   device_add_child(dev, "spibus", -1);
ar5315_spi_attach_sysctl(dev);
 
return (bus_generic_attach(dev));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310016 - stable/11/lib/libthr/thread

2016-12-13 Thread Konstantin Belousov
Author: kib
Date: Tue Dec 13 09:43:49 2016
New Revision: 310016
URL: https://svnweb.freebsd.org/changeset/base/310016

Log:
  MFC r309630:
  Do not leak curthread->inact_mtx when cancelling in pthread_cond_wait(3).

Modified:
  stable/11/lib/libthr/thread/thr_cond.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libthr/thread/thr_cond.c
==
--- stable/11/lib/libthr/thread/thr_cond.c  Tue Dec 13 09:17:30 2016
(r310015)
+++ stable/11/lib/libthr/thread/thr_cond.c  Tue Dec 13 09:43:49 2016
(r310016)
@@ -224,16 +224,26 @@ cond_wait_kernel(struct pthread_cond *cv
 * state and unlock the mutex without making the state
 * consistent and the state will be unrecoverable.
 */
-   if (error2 == 0 && cancel)
+   if (error2 == 0 && cancel) {
+   if (robust) {
+   _mutex_leave_robust(curthread, mp);
+   robust = false;
+   }
_thr_testcancel(curthread);
+   }
 
if (error == EINTR)
error = 0;
} else {
/* We know that it didn't unlock the mutex. */
_mutex_cv_attach(mp, recurse);
-   if (cancel)
+   if (cancel) {
+   if (robust) {
+   _mutex_leave_robust(curthread, mp);
+   robust = false;
+   }
_thr_testcancel(curthread);
+   }
error2 = 0;
}
if (robust)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310015 - stable/11/sys/netpfil/ipfw

2016-12-13 Thread Andrey V. Elsukov
Author: ae
Date: Tue Dec 13 09:17:30 2016
New Revision: 310015
URL: https://svnweb.freebsd.org/changeset/base/310015

Log:
  MFC r309660:
Convert result of hash_packet6() into host byte order.
  
For IPv4 similar function uses addresses and ports in host byte order,
but for IPv6 it used network byte order. This led to very bad hash
distribution for IPv6 flows. Now the result looks similar to IPv4.

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c  Tue Dec 13 07:58:30 2016
(r310014)
+++ stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c  Tue Dec 13 09:17:30 2016
(r310015)
@@ -256,9 +256,8 @@ hash_packet6(struct ipfw_flow_id *id)
i = (id->dst_ip6.__u6_addr.__u6_addr32[2]) ^
(id->dst_ip6.__u6_addr.__u6_addr32[3]) ^
(id->src_ip6.__u6_addr.__u6_addr32[2]) ^
-   (id->src_ip6.__u6_addr.__u6_addr32[3]) ^
-   (id->dst_port) ^ (id->src_port);
-   return i;
+   (id->src_ip6.__u6_addr.__u6_addr32[3]);
+   return ntohl(i);
 }
 #endif
 
@@ -277,9 +276,9 @@ hash_packet(struct ipfw_flow_id *id, int
i = hash_packet6(id);
else
 #endif /* INET6 */
-   i = (id->dst_ip) ^ (id->src_ip) ^ (id->dst_port) ^ (id->src_port);
-   i &= (buckets - 1);
-   return i;
+   i = (id->dst_ip) ^ (id->src_ip);
+   i ^= (id->dst_port) ^ (id->src_port);
+   return (i & (buckets - 1));
 }
 
 /**
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"