svn commit: r317604 - head/sys/dev/fdt

2017-04-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sun Apr 30 07:31:48 2017
New Revision: 317604
URL: https://svnweb.freebsd.org/changeset/base/317604

Log:
  Set the correct default for #address-cells variable when the property does
  not exist.
  
  This has never caused any issue because #address-cells is mandatory.
  
  Sponsored by: Rubicon Communications, LLC (Netgate)
  MFC after:2 weeks

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Sun Apr 30 06:15:56 2017
(r317603)
+++ head/sys/dev/fdt/fdt_common.c   Sun Apr 30 07:31:48 2017
(r317604)
@@ -422,7 +422,7 @@ fdt_addrsize_cells(phandle_t node, int *
 */
cell_size = sizeof(cell);
if (OF_getencprop(node, "#address-cells", &cell, cell_size) < cell_size)
-   *addr_cells = 2;
+   cell = 2;
*addr_cells = (int)cell;
 
if (OF_getencprop(node, "#size-cells", &cell, cell_size) < cell_size)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317605 - head/sys/dev/etherswitch/e6000sw

2017-04-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sun Apr 30 07:51:31 2017
New Revision: 317605
URL: https://svnweb.freebsd.org/changeset/base/317605

Log:
  When the switch is set to operate in the Multi Chip Addressing Mode we
  cannot access the GLOBAL2 register directly.
  
  Despite the comment in code (which was misleading), the indirect access is
  only used to read the switch CONFIG data from the scrap register and not
  for the GLOBAL2 access.
  
  Use the dsa data to define when the switch is in the Multi Chip Addressing
  Mode (a even address different than zero).
  
  While here fix a typo.
  
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  head/sys/dev/etherswitch/e6000sw/e6000sw.c

Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c
==
--- head/sys/dev/etherswitch/e6000sw/e6000sw.c  Sun Apr 30 07:31:48 2017
(r317604)
+++ head/sys/dev/etherswitch/e6000sw/e6000sw.c  Sun Apr 30 07:51:31 2017
(r317605)
@@ -214,7 +214,6 @@ e6000sw_probe(device_t dev)
e6000sw_softc_t *sc;
const char *description;
unsigned int id;
-   uint16_t dev_addr;
phandle_t dsa_node, switch_node;
 
dsa_node = fdt_find_compatible(OF_finddevice("/"),
@@ -229,21 +228,11 @@ e6000sw_probe(device_t dev)
sc->dev = dev;
sc->node = switch_node;
 
-   /* Read ADDR[4:1]n using indirect access */
-   MDIO_WRITE(dev, REG_GLOBAL2, SCR_AND_MISC_REG,
-   SCR_AND_MISC_PTR_CFG);
-   dev_addr = MDIO_READ(dev, REG_GLOBAL2, SCR_AND_MISC_REG) &
-   SCR_AND_MISC_DATA_CFG_MASK;
-   if (dev_addr != 0) {
-   sc->multi_chip = true;
-   device_printf(dev, "multi-chip addresing mode\n");
-   } else {
-   device_printf(dev, "single-chip addressing mode\n");
-   }
-
if (OF_getencprop(sc->node, "reg", &sc->sw_addr,
sizeof(sc->sw_addr)) < 0)
return (ENXIO);
+   if (sc->sw_addr != 0 && (sc->sw_addr % 2) == 0)
+   sc->multi_chip = true;
 
/* Lock is necessary due to assertions. */
sx_init(&sc->sx, "e6000sw");
@@ -368,6 +357,11 @@ e6000sw_attach(device_t dev)
err = 0;
sc = device_get_softc(dev);
 
+   if (sc->multi_chip)
+   device_printf(dev, "multi-chip addressing mode\n");
+   else
+   device_printf(dev, "single-chip addressing mode\n");
+
E6000SW_LOCK(sc);
e6000sw_setup(dev, sc);
bzero(member_ports, sizeof(member_ports));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317606 - head/lib/libc/gen

2017-04-30 Thread Konstantin Belousov
Author: kib
Date: Sun Apr 30 10:47:59 2017
New Revision: 317606
URL: https://svnweb.freebsd.org/changeset/base/317606

Log:
  Style.
  - Use ANSI C function definitions.
  - Remove redundand cast.
  - Minor style compliance tweaks.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/lib/libc/gen/sem_new.c
==
--- head/lib/libc/gen/sem_new.c Sun Apr 30 07:51:31 2017(r317605)
+++ head/lib/libc/gen/sem_new.c Sun Apr 30 10:47:59 2017(r317606)
@@ -77,24 +77,26 @@ struct sem_nameinfo {
 
 static pthread_once_t once = PTHREAD_ONCE_INIT;
 static pthread_mutex_t sem_llock;
-static LIST_HEAD(,sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
+static LIST_HEAD(, sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
 
 static void
-sem_prefork()
+sem_prefork(void)
 {

_pthread_mutex_lock(&sem_llock);
 }
 
 static void
-sem_postfork()
+sem_postfork(void)
 {
+
_pthread_mutex_unlock(&sem_llock);
 }
 
 static void
-sem_child_postfork()
+sem_child_postfork(void)
 {
+
_pthread_mutex_unlock(&sem_llock);
 }
 
@@ -116,10 +118,8 @@ sem_check_validity(sem_t *sem)
 
if (sem->_magic == SEM_MAGIC)
return (0);
-   else {
-   errno = EINVAL;
-   return (-1);
-   }
+   errno = EINVAL;
+   return (-1);
 }
 
 int
@@ -142,13 +142,16 @@ sem_t *
 _sem_open(const char *name, int flags, ...)
 {
char path[PATH_MAX];
-
struct stat sb;
va_list ap;
-   struct sem_nameinfo *ni = NULL;
-   sem_t *sem = NULL;
-   int fd = -1, mode, len, errsave;
-   int value = 0;
+   struct sem_nameinfo *ni;
+   sem_t *sem, tmp;
+   int errsave, fd, len, mode, value;
+
+   ni = NULL;
+   sem = NULL;
+   fd = -1;
+   value = 0;
 
if (name[0] != '/') {
errno = EINVAL;
@@ -213,8 +216,6 @@ _sem_open(const char *name, int flags, .
goto error;
}
if (sb.st_size < sizeof(sem_t)) {
-   sem_t tmp;
-
tmp._magic = SEM_MAGIC;
tmp._kern._count = value;
tmp._kern._flags = USYNC_PROCESS_SHARED | SEM_NAMED;
@@ -222,8 +223,8 @@ _sem_open(const char *name, int flags, .
goto error;
}
flock(fd, LOCK_UN);
-   sem = (sem_t *)mmap(NULL, sizeof(sem_t), PROT_READ|PROT_WRITE,
-   MAP_SHARED|MAP_NOSYNC, fd, 0);
+   sem = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE,
+   MAP_SHARED | MAP_NOSYNC, fd, 0);
if (sem == MAP_FAILED) {
sem = NULL;
if (errno == ENOMEM)
@@ -277,12 +278,11 @@ _sem_close(sem_t *sem)
_pthread_mutex_unlock(&sem_llock);
return (0);
}
-   else
-   break;
+   break;
}
}
 
-   if (ni) {
+   if (ni != NULL) {
LIST_REMOVE(ni, next);
_pthread_mutex_unlock(&sem_llock);
munmap(sem, sizeof(*sem));
@@ -342,7 +342,8 @@ _sem_getvalue(sem_t * __restrict sem, in
 static __inline int
 usem_wake(struct _usem2 *sem)
 {
-   return _umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL);
+
+   return (_umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL));
 }
 
 static __inline int
@@ -436,6 +437,7 @@ int
 _sem_timedwait(sem_t * __restrict sem,
const struct timespec * __restrict abstime)
 {
+
return (_sem_clockwait_np(sem, CLOCK_REALTIME, TIMER_ABSTIME, abstime,
NULL));
 };
@@ -443,7 +445,8 @@ _sem_timedwait(sem_t * __restrict sem,
 int
 _sem_wait(sem_t *sem)
 {
-   return _sem_timedwait(sem, NULL);
+
+   return (_sem_timedwait(sem, NULL));
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm

2017-04-30 Thread Matteo Riondato

> On Apr 29, 2017, at 10:08 PM, Anish Gupta  wrote:
> 
> Author: anish
> Date: Sun Apr 30 02:08:46 2017
> New Revision: 317600
> URL: https://svnweb.freebsd.org/changeset/base/317600
> 
> Log:
>  Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to 
> VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1.

This knob should likely be documented somewhere, and maybe also "Relnotes: yes" 
?

Thank you,

Matteo

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


svn commit: r317608 - head/share/mk

2017-04-30 Thread Ed Maste
Author: emaste
Date: Sun Apr 30 16:12:23 2017
New Revision: 317608
URL: https://svnweb.freebsd.org/changeset/base/317608

Log:
  revert r313473 (Disable LLD_IS_LD option combinations that fail)
  
  r316647 corrected the build of tblgen and libllvm as dependencies for
  LLD so undo the temporary seat-belt.
  
  We still want to extend the build infrastructure to automatically detect
  the case where the host LLD can be used instead of building a bootstrap
  LLD, and likely extend libllvmminimal to meet LLD's needs for cases
  where the build includes LLD but not Clang.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Sun Apr 30 13:25:10 2017(r317607)
+++ head/share/mk/src.opts.mk   Sun Apr 30 16:12:23 2017(r317608)
@@ -339,16 +339,6 @@ MK_LDNS_UTILS:=no
 MK_UNBOUND:= no
 .endif
 
-.if ${MK_LLD} == "no"
-MK_LLD_IS_LD:= no
-.endif
-
-# LLD requires LLVM libraries, and we do not yet compare in-tree and host LLD
-# versions to avoid building it if they are identical.
-.if ${MK_LLD_IS_LD} != "no"
-MK_SYSTEM_COMPILER:=   no
-.endif
-
 .if ${MK_SOURCELESS} == "no"
 MK_SOURCELESS_HOST:=   no
 MK_SOURCELESS_UCODE:= no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317610 - head/lib/libc/gen

2017-04-30 Thread Konstantin Belousov
Author: kib
Date: Sun Apr 30 19:32:51 2017
New Revision: 317610
URL: https://svnweb.freebsd.org/changeset/base/317610

Log:
  Restructure normal (non-error) control flow in sem_close().
  
  Do not retest for the found semaphore after the loop to look it up.
  Instead, handle both cases of last and non-last close simultaneously,
  which allows to consolidate the list unlock and successful return.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/lib/libc/gen/sem_new.c
==
--- head/lib/libc/gen/sem_new.c Sun Apr 30 18:39:31 2017(r317609)
+++ head/lib/libc/gen/sem_new.c Sun Apr 30 19:32:51 2017(r317610)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -260,6 +261,7 @@ int
 _sem_close(sem_t *sem)
 {
struct sem_nameinfo *ni;
+   bool last;
 
if (sem_check_validity(sem) != 0)
return (-1);
@@ -274,21 +276,17 @@ _sem_close(sem_t *sem)
_pthread_mutex_lock(&sem_llock);
LIST_FOREACH(ni, &sem_list, next) {
if (sem == ni->sem) {
-   if (--ni->open_count > 0) {
-   _pthread_mutex_unlock(&sem_llock);
-   return (0);
+   last = --ni->open_count == 0;
+   if (last)
+   LIST_REMOVE(ni, next);
+   _pthread_mutex_unlock(&sem_llock);
+   if (last) {
+   munmap(sem, sizeof(*sem));
+   free(ni);
}
-   break;
+   return (0);
}
}
-
-   if (ni != NULL) {
-   LIST_REMOVE(ni, next);
-   _pthread_mutex_unlock(&sem_llock);
-   munmap(sem, sizeof(*sem));
-   free(ni);
-   return (0);
-   }
_pthread_mutex_unlock(&sem_llock);
errno = EINVAL;
return (-1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317611 - head/lib/libc/gen

2017-04-30 Thread Konstantin Belousov
Author: kib
Date: Sun Apr 30 19:37:45 2017
New Revision: 317611
URL: https://svnweb.freebsd.org/changeset/base/317611

Log:
  Make semaphore names list mutex non-recursive.
  
  The mutex is used in sem_open() and sem_close(), which cannot
  recurse. The atfork handlers cannot collide with the open and close
  code.
  
  Reviewed by:  vangyzen
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D10545

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

Modified: head/lib/libc/gen/sem_new.c
==
--- head/lib/libc/gen/sem_new.c Sun Apr 30 19:32:51 2017(r317610)
+++ head/lib/libc/gen/sem_new.c Sun Apr 30 19:37:45 2017(r317611)
@@ -104,12 +104,8 @@ sem_child_postfork(void)
 static void
 sem_module_init(void)
 {
-   pthread_mutexattr_t ma;
 
-   _pthread_mutexattr_init(&ma);
-   _pthread_mutexattr_settype(&ma,  PTHREAD_MUTEX_RECURSIVE);
-   _pthread_mutex_init(&sem_llock, &ma);
-   _pthread_mutexattr_destroy(&ma);
+   _pthread_mutex_init(&sem_llock, NULL);
_pthread_atfork(sem_prefork, sem_postfork, sem_child_postfork);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r315526 - in head: contrib/netbsd-tests/lib/libc/sys include lib/libc/include lib/libc/sys lib/libc/tests/sys lib/libthr/thread share/man/man3 sys/compat/freebsd32 sys/kern sys/sys

2017-04-30 Thread Eric van Gyzen
On 04/29/2017 04:39, Chagin Dmitry wrote:
> On Sun, Mar 19, 2017 at 12:51:13AM +, Eric van Gyzen wrote:
>> Author: vangyzen
>> Date: Sun Mar 19 00:51:12 2017
>> New Revision: 315526
>> URL: https://svnweb.freebsd.org/changeset/base/315526
>>
>> Log:
>>   Add clock_nanosleep()
> 
> hi, why it is not merged still?

There is no technical reason, just time and other priorities.  I'm starting the
merge now.

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


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-04-30 Thread Konstantin Belousov
On Wed, Apr 19, 2017 at 02:09:58PM +1000, Bruce Evans wrote:
> On Tue, 18 Apr 2017, Alan Somers wrote:
> 
> > On Mon, Apr 17, 2017 at 11:34 AM, Gleb Smirnoff  wrote:
> 
> >>   head/usr.bin/top/machine.c
> >>   head/usr.bin/vmstat/vmstat.c
> 
> The previous 2 lines turn out to be relevant.  I missed the update to
> vmstat and checked a wrong version in my bug report described below
> I checked an updated top, but the change seemed too small to help.
> systat was not updated.
> 
> > This change broke backwards compatibility with old top binaries.  When
> > I use a kernel at version 317094 but a top from 14-April, I get the
> > error "top: sysctl(vm.stats.vm.v_swappgsin...) failed: Cannot allocate
> > memory".  I get the same error when running top from an 11.0-RELEASE
> > jail.  Can you please add backward compatibility shims?
> 
> I sent a much longer (30 times longer) bug report to the author of the
> bug.
> 
> Most or all statistics utilities that use vmmeter are broken.  vmstat
> is too broken to even notice the bug -- it silently ignores the error,
> an has type errors which prevent other errors which it doesn't ignore.
> The result is silently truncating to 32 bits, like a quick fix would
> do intentionally.  systat -v detects the errors but prints warning
> messages to the status line where they overwrite each other so make
> the problem look smaller than it is.  The result is unsilently
> truncating to 32 bits.
> 
> I've never seen any backwards compatibility shims added for sysctls.
> None should be needed, but there are few or no utilities other than
> sysctl(8) which use sysctl(3) in a portable way.
See vfs.bufspace handled by vfs_bio.c:sysctl_bufspace().

In fact, not only top and vmstat are broken. Quite unexpected and
worrying, reboot(8) is broken as well. This is due to get_pageins()
failing and system stopping userspace much earlier than it is desirable.

I now believe that compat shims to handle int-sized vmstat queries are
required.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317614 - head/usr.sbin/makefs

2017-04-30 Thread Ed Maste
Author: emaste
Date: Mon May  1 00:53:07 2017
New Revision: 317614
URL: https://svnweb.freebsd.org/changeset/base/317614

Log:
  makefs: remove unused cd9660_defaults_set global
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/makefs/cd9660.c

Modified: head/usr.sbin/makefs/cd9660.c
==
--- head/usr.sbin/makefs/cd9660.c   Mon May  1 00:42:31 2017
(r317613)
+++ head/usr.sbin/makefs/cd9660.c   Mon May  1 00:53:07 2017
(r317614)
@@ -186,8 +186,6 @@ cd9660_allocate_cd9660node(void)
return temp;
 }
 
-int cd9660_defaults_set = 0;
-
 /**
 * Set default values for cd9660 extension to makefs
 */
@@ -234,8 +232,6 @@ cd9660_set_defaults(iso9660_disk *diskSt
 
strcpy(diskStructure->primaryDescriptor.system_id, "FreeBSD");
 
-   cd9660_defaults_set = 1;
-
/* Boot support: Initially disabled */
diskStructure->has_generic_bootimage = 0;
diskStructure->generic_bootimage = NULL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317620 - head/sbin/ifconfig

2017-04-30 Thread Alan Somers
Author: asomers
Date: Mon May  1 01:42:26 2017
New Revision: 317620
URL: https://svnweb.freebsd.org/changeset/base/317620

Log:
  Fix a comment that's been wrong ever since this file was imported in 1997

Modified:
  head/sbin/ifconfig/ifmedia.c

Modified: head/sbin/ifconfig/ifmedia.c
==
--- head/sbin/ifconfig/ifmedia.cMon May  1 01:40:24 2017
(r317619)
+++ head/sbin/ifconfig/ifmedia.cMon May  1 01:42:26 2017
(r317620)
@@ -371,7 +371,7 @@ setmediamode(const char *val, int d, int
 }
 
 /**
- * A good chunk of this is duplicated from sys/net/ifmedia.c
+ * A good chunk of this is duplicated from sys/net/if_media.c
  **/
 
 static struct ifmedia_description ifm_type_descriptions[] =
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317626 - head/contrib/elftoolchain/cxxfilt

2017-04-30 Thread Ed Maste
Author: emaste
Date: Mon May  1 01:56:11 2017
New Revision: 317626
URL: https://svnweb.freebsd.org/changeset/base/317626

Log:
  revert r308465: c++filt: flush output after newline
  
  The ELF Tool Chain update to r3520 uses setvbuf to set line buffering.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/cxxfilt/cxxfilt.c

Modified: head/contrib/elftoolchain/cxxfilt/cxxfilt.c
==
--- head/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon May  1 01:54:03 2017
(r317625)
+++ head/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon May  1 01:56:11 2017
(r317626)
@@ -189,8 +189,6 @@ main(int argc, char **argv)
if (c == EOF)
break;
putchar(c);
-   if (c == '\n')
-   fflush(stdout);
} else {
if ((size_t) p >= sizeof(buf) - 1)
warnx("buffer overflowed");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm

2017-04-30 Thread Ngie Cooper (yaneurabeya)

> On Apr 30, 2017, at 07:35, Matteo Riondato  wrote:
> 
> 
>> On Apr 29, 2017, at 10:08 PM, Anish Gupta  wrote:
>> 
>> Author: anish
>> Date: Sun Apr 30 02:08:46 2017
>> New Revision: 317600
>> URL: https://svnweb.freebsd.org/changeset/base/317600
>> 
>> Log:
>> Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to 
>> VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1.
> 
> This knob should likely be documented somewhere, and maybe also "Relnotes: 
> yes" ?

Good catch.

The knob should be documented in the driver manpage.

Thanks!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail