Re: svn commit: r300000 - head/sys/mips/conf

2016-05-16 Thread Sepherosa Ziehau
On Tue, May 17, 2016 at 8:31 AM, Adrian Chadd  wrote:
> Author: adrian
> Date: Tue May 17 00:31:37 2016
> New Revision: 30
> URL: https://svnweb.freebsd.org/changeset/base/30

30!  Congrats! :P
___
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: r300005 - head/usr.bin/ncal

2016-05-16 Thread Don Lewis
Author: truckman
Date: Tue May 17 05:05:30 2016
New Revision: 35
URL: https://svnweb.freebsd.org/changeset/base/35

Log:
  swprintf() and apparently wcsftime() want the their output buffer size
  specified in terms of the the number of wide characters and not
  sizeof(buffer).
  
  Reported by:  Coverity
  CID:  1007605, 1007606
  MFC after:1 week

Modified:
  head/usr.bin/ncal/ncal.c

Modified: head/usr.bin/ncal/ncal.c
==
--- head/usr.bin/ncal/ncal.cTue May 17 04:53:21 2016(r34)
+++ head/usr.bin/ncal/ncal.cTue May 17 05:05:30 2016(r35)
@@ -642,8 +642,8 @@ monthrangeb(int y, int m, int jd_flag, i
wprintf(L"%-*ls  ",
mw, wcenter(ws, year[i].name, mw));
else {
-   swprintf(ws, sizeof(ws), L"%-ls %d",
-   year[i].name, M2Y(m + i));
+   swprintf(ws, sizeof(ws)/sizeof(ws[0]),
+   L"%-ls %d", year[i].name, M2Y(m + i));
wprintf(L"%-*ls  ", mw, wcenter(ws1, ws, mw));
}
printf("\n");
@@ -958,7 +958,7 @@ mkweekdays(struct weekdays *wds)
 
for (i = 0; i != 7; i++) {
tm.tm_wday = (i+1) % 7;
-   wcsftime(buf, sizeof(buf), L"%a", );
+   wcsftime(buf, sizeof(buf)/sizeof(buf[0]), L"%a", );
for (len = 2; len > 0; --len) {
if ((width = wcswidth(buf, len)) <= 2)
break;
___
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: r300003 - head/share/man/man4

2016-05-16 Thread Greg Lehey
Author: grog
Date: Tue May 17 04:40:00 2016
New Revision: 33
URL: https://svnweb.freebsd.org/changeset/base/33

Log:
  Correct use of incorrect grammar.

Modified:
  head/share/man/man4/gdb.4

Modified: head/share/man/man4/gdb.4
==
--- head/share/man/man4/gdb.4   Tue May 17 04:03:45 2016(r32)
+++ head/share/man/man4/gdb.4   Tue May 17 04:40:00 2016(r33)
@@ -595,7 +595,7 @@ run the link at more than 9600 bps.
 Firewire connections do not have this problem.
 .Pp
 The debugging macros
-.Dq "just grown" .
+.Dq "just growed" .
 In general, the person who wrote them did so while looking for a specific
 problem, so they may not be general enough, and they may behave badly when used
 in ways for which they were not intended, even if those ways make sense.
___
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: r300002 - head/usr.sbin/rarpd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Tue May 17 04:03:45 2016
New Revision: 32
URL: https://svnweb.freebsd.org/changeset/base/32

Log:
  When clearing rtmsg, pass  to bzero() instead of the address of
  just the header
  
  Reported by:  Coverity
  CID:  1007568, 1194256
  MFC after:1 week

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

Modified: head/usr.sbin/rarpd/rarpd.c
==
--- head/usr.sbin/rarpd/rarpd.c Tue May 17 00:32:36 2016(r31)
+++ head/usr.sbin/rarpd/rarpd.c Tue May 17 04:03:45 2016(r32)
@@ -739,7 +739,7 @@ update_arptab(u_char *ep, in_addr_t ipad
 
/* Get the type and interface index */
rt = 
-   bzero(rt, sizeof(rtmsg));
+   bzero(, sizeof(rtmsg));
rt->rtm_version = RTM_VERSION;
rt->rtm_addrs = RTA_DST;
rt->rtm_type = RTM_GET;
___
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: r299997 - head/sys/boot/i386/zfsboot

2016-05-16 Thread Ngie Cooper
On Mon, May 16, 2016 at 5:24 PM, Peter Wemm  wrote:
> Author: peter
> Date: Tue May 17 00:24:53 2016
> New Revision: 27
> URL: https://svnweb.freebsd.org/changeset/base/27
>
> Log:
>   Attempt to fix r299660:
>   slba is used only for the GPT case.
>   elba is used if either GPT or LOADER_GELI_SUPPORT is enabled.

Ugh -- sorry :(...

Pointyhat to: ngie
___
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: r299995 - head/usr.bin/kdump

2016-05-16 Thread Simon J. Gerraty
Ngie Cooper  wrote:
> Please use `!= 0` for explicitness.

Sure.

___
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: r300001 - head/sys/net

2016-05-16 Thread Bjoern A. Zeeb
Author: bz
Date: Tue May 17 00:32:36 2016
New Revision: 31
URL: https://svnweb.freebsd.org/changeset/base/31

Log:
  Mark the unused arguments of various SYSINIT functions __unused.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net/vnet.c

Modified: head/sys/net/vnet.c
==
--- head/sys/net/vnet.c Tue May 17 00:31:37 2016(r30)
+++ head/sys/net/vnet.c Tue May 17 00:32:36 2016(r31)
@@ -304,7 +304,7 @@ vnet_destroy(struct vnet *vnet)
  * Boot time initialization and allocation of virtual network stacks.
  */
 static void
-vnet_init_prelink(void *arg)
+vnet_init_prelink(void *arg __unused)
 {
 
rw_init(_rwlock, "vnet_rwlock");
@@ -316,7 +316,7 @@ SYSINIT(vnet_init_prelink, SI_SUB_VNET_P
 vnet_init_prelink, NULL);
 
 static void
-vnet0_init(void *arg)
+vnet0_init(void *arg __unused)
 {
 
/* Warn people before take off - in case we crash early. */
@@ -333,7 +333,7 @@ vnet0_init(void *arg)
 SYSINIT(vnet0_init, SI_SUB_VNET, SI_ORDER_FIRST, vnet0_init, NULL);
 
 static void
-vnet_init_done(void *unused)
+vnet_init_done(void *unused __unused)
 {
 
curvnet = 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: r300000 - head/sys/mips/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:31:37 2016
New Revision: 30
URL: https://svnweb.freebsd.org/changeset/base/30

Log:
  [mips] also add otus/urtwn USB modules.
  
  I'm using both AR933x (because the boards fit in small boxes) as well
  as AR934x for doing USB wifi testing on MIPS.
  
  So far so good, for both of them.

Modified:
  head/sys/mips/conf/AR933X_BASE

Modified: head/sys/mips/conf/AR933X_BASE
==
--- head/sys/mips/conf/AR933X_BASE  Tue May 17 00:30:34 2016
(r29)
+++ head/sys/mips/conf/AR933X_BASE  Tue May 17 00:31:37 2016
(r30)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR933X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr hwpmc ipfw"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr hwpmc ipfw urtwn urtwnfw otus otusfw"
 
 optionsDDB
 optionsKDB
___
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: r299999 - head/sys/mips/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:30:34 2016
New Revision: 29
URL: https://svnweb.freebsd.org/changeset/base/29

Log:
  [mips] add urtwn and otus NIC modules.
  
  I'm using this platform for testing USB wifi on MIPS.

Modified:
  head/sys/mips/conf/AR934X_BASE

Modified: head/sys/mips/conf/AR934X_BASE
==
--- head/sys/mips/conf/AR934X_BASE  Tue May 17 00:27:18 2016
(r28)
+++ head/sys/mips/conf/AR934X_BASE  Tue May 17 00:30:34 2016
(r29)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR934X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_vlan if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr ath ath_ahb hwpmc ipfw ipfw_nat libalias"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_vlan if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr ath ath_ahb hwpmc ipfw ipfw_nat libalias urtwn urtwnfw 
otus otusfw"
 # makeoptions  MODULES_OVERRIDE=""
 
 optionsDDB
___
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: r299556 - head/sys/dev/ixl

2016-05-16 Thread Adrian Chadd
Hi,

ixl doesn't build on -HEAD. The netmap ixl bits also aren't building
for me. What gives? :)


-a
___
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: r299998 - head/usr.bin/kdump

2016-05-16 Thread Simon J. Gerraty
Author: sjg
Date: Tue May 17 00:27:18 2016
New Revision: 28
URL: https://svnweb.freebsd.org/changeset/base/28

Log:
  Use != 0 to be clear

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Tue May 17 00:24:53 2016(r27)
+++ head/usr.bin/kdump/kdump.c  Tue May 17 00:27:18 2016(r28)
@@ -298,7 +298,7 @@ main(int argc, char *argv[])
m = malloc(size = 1025);
if (m == NULL)
errx(1, "%s", strerror(ENOMEM));
-   if (strcmp(tracefile, "-"))
+   if (strcmp(tracefile, "-") != 0)
if (!freopen(tracefile, "r", stdin))
err(1, "%s", tracefile);
 
___
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: r299997 - head/sys/boot/i386/zfsboot

2016-05-16 Thread Peter Wemm
Author: peter
Date: Tue May 17 00:24:53 2016
New Revision: 27
URL: https://svnweb.freebsd.org/changeset/base/27

Log:
  Attempt to fix r299660:
  slba is used only for the GPT case.
  elba is used if either GPT or LOADER_GELI_SUPPORT is enabled.

Modified:
  head/sys/boot/i386/zfsboot/zfsboot.c

Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==
--- head/sys/boot/i386/zfsboot/zfsboot.cTue May 17 00:23:46 2016
(r26)
+++ head/sys/boot/i386/zfsboot/zfsboot.cTue May 17 00:24:53 2016
(r27)
@@ -397,10 +397,12 @@ probe_drive(struct dsk *dsk)
 struct gpt_hdr hdr;
 struct gpt_ent *ent;
 unsigned part, entries_per_sec;
+daddr_t slba;
 #endif
-#ifdef LOADER_GELI_SUPPORT
-daddr_t slba, elba;
+#if defined(GPT) || defined(LOADER_GELI_SUPPORT)
+daddr_t elba;
 #endif
+
 struct dos_partition *dp;
 char *sec;
 unsigned i;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299996 - in head/sys/dev/bhnd: . bcma bhndb cores/chipc cores/pci nvram siba

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:23:46 2016
New Revision: 26
URL: https://svnweb.freebsd.org/changeset/base/26

Log:
  [bhnd] Centralize fetching of board information
  
  Centralizes fetching of board information (vendor, type, revision, etc),
  and adds support for matching quirks against board identification info.
  
  * Adds a BHND_BUS_READ_BOARD_INFO(), allowing bhnd bus/bus parent(s) to
handle implementation-specific fetching of board info.
  * Integrates board type constants from the latest Broadcom ISC-licensed
bcmdevs.h included in dd-wrt's Broadcom driver source drops.
  * Adds support for matching on chip/board quirks to bhnd_device_quirks()/
bhnd_chip_quirks().
  * Use the new board/chip quirk matching to match Apple devices that failed
to set BFL2_PCIEWAR_OVR in SROM.
  
  Submitted by: Landon Fuller 
  Differential Revision:https://reviews.freebsd.org/D6361

Modified:
  head/sys/dev/bhnd/bcma/bcma_bhndb.c
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhnd_ids.h
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb_if.m
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/cores/chipc/chipc.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci_hostbvar.h
  head/sys/dev/bhnd/nvram/nvram_map
  head/sys/dev/bhnd/siba/siba_bhndb.c

Modified: head/sys/dev/bhnd/bcma/bcma_bhndb.c
==
--- head/sys/dev/bhnd/bcma/bcma_bhndb.c Tue May 17 00:08:43 2016
(r25)
+++ head/sys/dev/bhnd/bcma/bcma_bhndb.c Tue May 17 00:23:46 2016
(r26)
@@ -166,6 +166,20 @@ bcma_bhndb_resume_child(device_t dev, de
return (0);
 }
 
+static int
+bcma_bhndb_read_board_info(device_t dev, device_t child,
+struct bhnd_board_info *info)
+{
+   int error;
+
+   /* Initialize with NVRAM-derived values */
+   if ((error = bhnd_bus_generic_read_board_info(dev, child, info)))
+   return (error);
+
+   /* Let the bridge fill in any additional data */
+   return (BHNDB_POPULATE_BOARD_INFO(device_get_parent(dev), dev, info));
+}
+
 static device_method_t bcma_bhndb_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, bcma_bhndb_probe),
@@ -175,6 +189,9 @@ static device_method_t bcma_bhndb_method
DEVMETHOD(bus_suspend_child,bcma_bhndb_suspend_child),
DEVMETHOD(bus_resume_child, bcma_bhndb_resume_child),
 
+   /* BHND interface */
+   DEVMETHOD(bhnd_bus_read_board_info, bcma_bhndb_read_board_info),
+
DEVMETHOD_END
 };
 

Modified: head/sys/dev/bhnd/bhnd.c
==
--- head/sys/dev/bhnd/bhnd.cTue May 17 00:08:43 2016(r25)
+++ head/sys/dev/bhnd/bhnd.cTue May 17 00:23:46 2016(r26)
@@ -58,11 +58,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "nvram/bhnd_nvram.h"
-
-#include "bhnd_chipc_if.h"
-#include "bhnd_nvram_if.h"
-
 #include "bhnd.h"
 #include "bhndvar.h"
 
@@ -85,8 +80,6 @@ static const struct bhnd_nomatch {
{ BHND_MFGID_INVALID,   BHND_COREID_INVALID,false   }
 };
 
-static device_tfind_nvram_child(device_t dev);
-
 static int compare_ascending_probe_order(const void *lhs,
const void *rhs);
 static int compare_descending_probe_order(const void *lhs,
@@ -314,7 +307,9 @@ bhnd_generic_get_probe_order(device_t de
 {
switch (bhnd_get_class(child)) {
case BHND_DEVCLASS_CC:
-   return (BHND_PROBE_BUS + BHND_PROBE_ORDER_FIRST);
+   /* Must be early enough to provide NVRAM access to the
+* host bridge */
+   return (BHND_PROBE_ROOT + BHND_PROBE_ORDER_FIRST);
 
case BHND_DEVCLASS_CC_B:
/* fall through */
@@ -381,68 +376,6 @@ bhnd_generic_is_region_valid(device_t de
 }
 
 /**
- * Find an NVRAM child device on @p dev, if any.
- * 
- * @retval device_t An NVRAM device.
- * @retval NULL If no NVRAM device is found.
- */
-static device_t
-find_nvram_child(device_t dev)
-{
-   device_tchipc, nvram;
-
-   /* Look for a directly-attached NVRAM child */
-   nvram = device_find_child(dev, "bhnd_nvram", 0);
-   if (nvram != NULL)
-   return (nvram);
-
-   /* Remaining checks are only applicable when searching a bhnd(4)
-* bus. */
-   if (device_get_devclass(dev) != bhnd_devclass)
-   return (NULL);
-
-   /* Look for a ChipCommon device */
-   if ((chipc = bhnd_find_child(dev, BHND_DEVCLASS_CC, -1)) != NULL) {
-   bhnd_nvram_src_t src;
-
-   /* Query the NVRAM source and determine whether it's
-* accessible via the 

Re: svn commit: r299995 - head/usr.bin/kdump

2016-05-16 Thread Ngie Cooper
On Mon, May 16, 2016 at 5:08 PM, Simon J. Gerraty  wrote:
> Author: sjg
> Date: Tue May 17 00:08:43 2016
> New Revision: 25
> URL: https://svnweb.freebsd.org/changeset/base/25
>
> Log:
>   Allow -f - to read from stdin.
>
> Modified:
>   head/usr.bin/kdump/kdump.c
>
> Modified: head/usr.bin/kdump/kdump.c
> ==
> --- head/usr.bin/kdump/kdump.c  Tue May 17 00:00:01 2016(r24)
> +++ head/usr.bin/kdump/kdump.c  Tue May 17 00:08:43 2016(r25)
> @@ -298,8 +298,9 @@ main(int argc, char *argv[])
> m = malloc(size = 1025);
> if (m == NULL)
> errx(1, "%s", strerror(ENOMEM));
> -   if (!freopen(tracefile, "r", stdin))
> -   err(1, "%s", tracefile);
> +   if (strcmp(tracefile, "-"))

Please use `!= 0` for explicitness.
Thanks,
-Ngie
___
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: r299995 - head/usr.bin/kdump

2016-05-16 Thread Simon J. Gerraty
Author: sjg
Date: Tue May 17 00:08:43 2016
New Revision: 25
URL: https://svnweb.freebsd.org/changeset/base/25

Log:
  Allow -f - to read from stdin.

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Tue May 17 00:00:01 2016(r24)
+++ head/usr.bin/kdump/kdump.c  Tue May 17 00:08:43 2016(r25)
@@ -298,8 +298,9 @@ main(int argc, char *argv[])
m = malloc(size = 1025);
if (m == NULL)
errx(1, "%s", strerror(ENOMEM));
-   if (!freopen(tracefile, "r", stdin))
-   err(1, "%s", tracefile);
+   if (strcmp(tracefile, "-"))
+   if (!freopen(tracefile, "r", stdin))
+   err(1, "%s", tracefile);
 
strerror_init();
localtime_init();
___
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: r299994 - in head/sys/mips: broadcom conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:00:01 2016
New Revision: 24
URL: https://svnweb.freebsd.org/changeset/base/24

Log:
  [mips/broadcom] Add initial support for Broadcom MIPS processor
  
  Relies on BHND(4) driver.
  
  There files contains machine-dependent code for Broadcom MIPS processor and
  provide UART driver.
  
  This is a work in progress; it and the current bhnd code is enough to boot
  on the ASUS RT-N16 and RT-N53 platforms.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6251

Added:
  head/sys/mips/broadcom/bcm_machdep.c   (contents, props changed)
  head/sys/mips/broadcom/bcm_socinfo.c   (contents, props changed)
  head/sys/mips/broadcom/bcm_socinfo.h   (contents, props changed)
  head/sys/mips/broadcom/files.broadcom   (contents, props changed)
  head/sys/mips/broadcom/std.broadcom   (contents, props changed)
  head/sys/mips/broadcom/uart_bus_chipc.c   (contents, props changed)
  head/sys/mips/broadcom/uart_cpu_chipc.c   (contents, props changed)
  head/sys/mips/conf/BCM   (contents, props changed)
  head/sys/mips/conf/BCM.hints   (contents, props changed)

Added: head/sys/mips/broadcom/bcm_machdep.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/broadcom/bcm_machdep.cTue May 17 00:00:01 2016
(r24)
@@ -0,0 +1,221 @@
+/*-
+ * Copyright (c) 2007 Bruce M. Simpson.
+ * Copyright (c) 2016 Michael Zhilin 
+ *
+ * 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 ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_ddb.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "bcm_socinfo.h"
+
+#ifdef CFE
+#include 
+#endif
+
+#if 0
+#define BROADCOM_TRACE 0
+#endif
+
+extern int *edata;
+extern int *end;
+
+void
+platform_cpu_init()
+{
+   /* Nothing special */
+}
+
+static void
+mips_init(void)
+{
+   int i, j;
+
+   printf("entry: mips_init()\n");
+
+#ifdef CFE
+   /*
+* Query DRAM memory map from CFE.
+*/
+   physmem = 0;
+   for (i = 0; i < 10; i += 2) {
+   int result;
+   uint64_t addr, len, type;
+
+   result = cfe_enummem(i / 2, 0, , , );
+   if (result < 0) {
+#ifdef BROADCOM_TRACE
+   printf("There is no phys memory for: %d\n", i);
+#endif
+   phys_avail[i] = phys_avail[i + 1] = 0;
+   break;
+   }
+   if (type != CFE_MI_AVAILABLE){
+#ifdef BROADCOM_TRACE
+   printf("phys memory is not available: %d\n", i);
+#endif
+   continue;
+   }
+
+   phys_avail[i] = addr;
+   if (i == 0 && addr == 0) {
+   /*
+* If this is the first physical memory segment probed
+* from CFE, omit the region at the start of physical
+* memory where the kernel has been loaded.
+*/
+   phys_avail[i] += MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
+   }
+#ifdef BROADCOM_TRACE
+   printf("phys memory is available for: %d\n", i);
+   printf(" => addr 

svn commit: r299993 - head/sys/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:56:31 2016
New Revision: 23
URL: https://svnweb.freebsd.org/changeset/base/23

Log:
  [mips] Improve MIPS trampoline code
  
  This patch fix trampoline build. inckern.S increases stack and calls _startC
  of elf_trampoline, so inckern.S should be called before elf_trampoline. 
gcc4.2 puts
  text (code) into image according to order of source files in this call, so 
order has changed.
  
  In addition make will install trampoline kernel. It allows to use kernel for 
firmware build.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6242

Modified:
  head/sys/conf/Makefile.mips

Modified: head/sys/conf/Makefile.mips
==
--- head/sys/conf/Makefile.mips Mon May 16 23:54:28 2016(r22)
+++ head/sys/conf/Makefile.mips Mon May 16 23:56:31 2016(r23)
@@ -62,6 +62,7 @@ ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE
 
 .if !defined(WITHOUT_KERNEL_TRAMPOLINE)
 KERNEL_EXTRA=trampoline
+KERNEL_EXTRA_INSTALL=${KERNEL_KO}.tramp.bin
 trampoline: ${KERNEL_KO}.tramp.bin
 ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \
$S/$M/$M/inckern.S 
@@ -72,7 +73,7 @@ ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/
${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} 
-Xlinker \
-T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \
-DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \
-   $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
+   $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c \
-o ${KERNEL_KO}.tramp.elf
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \
${KERNEL_KO}.tramp.bin
___
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: r299992 - head/sys/mips/broadcom

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:54:28 2016
New Revision: 22
URL: https://svnweb.freebsd.org/changeset/base/22

Log:
  [mips/broadcom] Add initial code for interrupts on the Broadcom MIPS processor
  
  Broadcom MIPS processor doesn't reset TI flag if additional manipulation
  is done.
  
  Thanks to @sobomax!

Added:
  head/sys/mips/broadcom/
  head/sys/mips/broadcom/bcm_mipscore.c   (contents, props changed)
  head/sys/mips/broadcom/bcm_mipscore.h   (contents, props changed)

Added: head/sys/mips/broadcom/bcm_mipscore.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/broadcom/bcm_mipscore.c   Mon May 16 23:54:28 2016
(r22)
@@ -0,0 +1,123 @@
+/*-
+ * Copyright (c) 2016 Michael Zhilin 
+ * 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,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "bcm_mipscore.h"
+
+static const struct resource_spec mipscore_rspec[MIPSCORE_MAX_RSPEC] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { -1, -1, 0 }
+};
+
+struct bhnd_device mipscore_match[] = {
+   BHND_MIPS_DEVICE(MIPS,  "BHND MIPS processor",  NULL),
+   BHND_MIPS_DEVICE(MIPS33,"BHND MIPS3302 processor",  NULL),
+   BHND_MIPS_DEVICE(MIPS74K,   "BHND MIPS74K processor",   NULL),
+   BHND_DEVICE_END
+};
+
+static int
+mipscore_probe(device_t dev)
+{
+   const struct bhnd_device *id;
+
+   id = bhnd_device_lookup(dev, mipscore_match, sizeof(mipscore_match[0]));
+   if (id == NULL)
+   return (ENXIO);
+
+   bhnd_set_default_core_desc(dev);
+   return (BUS_PROBE_DEFAULT);
+}
+
+static int
+mipscore_attach(device_t dev)
+{
+   struct mipscore_softc   *sc;
+   struct resource *res;
+   uint32_t intmask;
+   uint16_t devid;
+   int  error;
+
+   sc = device_get_softc(dev);
+   devid = bhnd_get_device(dev);
+
+   sc->devid = devid;
+   sc->dev = dev;
+
+   /* Allocate bus resources */
+   memcpy(sc->rspec, mipscore_rspec, sizeof(sc->rspec));
+   error = bhnd_alloc_resources(dev, sc->rspec, sc->res);
+   if (error)
+   return (error);
+
+   res = sc->res[0]->res;
+   if (res == NULL)
+   return (ENXIO);
+
+   if (devid == BHND_COREID_MIPS74K) {
+   intmask = (1 << 31);
+   /* Use intmask5 register to route the timer interrupt */
+   bus_write_4(res, offsetof(struct mipscore_regs, intmask[5]),
+   intmask);
+   }
+
+   return (0);
+}
+
+static device_method_t mipscore_methods[] = {
+   DEVMETHOD(device_probe, mipscore_probe),
+   DEVMETHOD(device_attach,mipscore_attach),
+   DEVMETHOD_END
+};
+
+devclass_t bhnd_mipscore_devclass;
+
+DEFINE_CLASS_0(bhnd_mipscore, mipscore_driver, mipscore_methods,
+   sizeof(struct mipscore_softc));
+DRIVER_MODULE(bhnd_mipscore, bhnd, mipscore_driver, bhnd_mipscore_devclass,
+   0, 0);
+MODULE_VERSION(bhnd_mipscore, 1);

Added: head/sys/mips/broadcom/bcm_mipscore.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 

svn commit: r299991 - head/usr.sbin/ppp

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 23:47:08 2016
New Revision: 21
URL: https://svnweb.freebsd.org/changeset/base/21

Log:
  Don't walk off the end of the array when proto isn't explicitly
  listed above.  Instead update the catch-all "Others" bucket.
  
  Reported by:  Coverity
  CID:  1007571, 1007572
  MFC after:1 week

Modified:
  head/usr.sbin/ppp/link.c

Modified: head/usr.sbin/ppp/link.c
==
--- head/usr.sbin/ppp/link.cMon May 16 23:40:32 2016(r20)
+++ head/usr.sbin/ppp/link.cMon May 16 23:47:08 2016(r21)
@@ -209,7 +209,7 @@ static struct protostatheader {
   { PROTO_LQR, "LQR" },
   { PROTO_CHAP, "CHAP" },
   { PROTO_MP, "MULTILINK" },
-  { 0, "Others" }
+  { 0, "Others" }  /* must be last */
 };
 
 void
@@ -218,13 +218,13 @@ link_ProtocolRecord(struct link *l, u_sh
   int i;
 
   for (i = 0; i < NPROTOSTAT; i++)
-if (ProtocolStat[i].number == proto)
+if (ProtocolStat[i].number == proto || ProtocolStat[i].number == 0) {
+  if (type == PROTO_IN)
+l->proto_in[i]++;
+  else
+l->proto_out[i]++;
   break;
-
-  if (type == PROTO_IN)
-l->proto_in[i]++;
-  else
-l->proto_out[i]++;
+}
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299990 - in head/sys: conf dev/bhnd

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:40:32 2016
New Revision: 20
URL: https://svnweb.freebsd.org/changeset/base/20

Log:
  [bhnd] Add logging macros to BHND.
  
  There are 5 logging levels:
  
  * ERROR
  * WARN
  * INFO
  * DEBUG
  * TRACE
  
  There are 2 logging context:
  
  * with
  * without device
  
  DEBUG and TRACE records are printed only if bootverbose.
  Logging records are printed with source code line information if acceptable
  logging level is DEBUG or TRACE.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6247

Added:
  head/sys/dev/bhnd/bhnd_debug.h   (contents, props changed)
Modified:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/dev/bhnd/bhnd.h

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Mon May 16 23:37:18 2016(r299989)
+++ head/sys/conf/NOTES Mon May 16 23:40:32 2016(r20)
@@ -3061,3 +3061,6 @@ options   EM_MULTIQUEUE # Activate multiq
 # zlib I/O stream support
 # This enables support for compressed core dumps.
 optionsGZIO
+
+# BHND(4) drivers
+optionsBHND_LOGLEVEL   # Logging threshold level
\ No newline at end of file

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon May 16 23:37:18 2016(r299989)
+++ head/sys/conf/options   Mon May 16 23:40:32 2016(r20)
@@ -979,3 +979,6 @@ RANDOM_ENABLE_UMA   opt_global.h
 
 # Intel em(4) driver
 EM_MULTIQUEUE  opt_em.h
+
+# BHND(4) driver
+BHND_LOGLEVEL  opt_global.h

Modified: head/sys/dev/bhnd/bhnd.h
==
--- head/sys/dev/bhnd/bhnd.hMon May 16 23:37:18 2016(r299989)
+++ head/sys/dev/bhnd/bhnd.hMon May 16 23:40:32 2016(r20)
@@ -39,6 +39,7 @@
 
 #include "bhnd_ids.h"
 #include "bhnd_types.h"
+#include "bhnd_debug.h"
 #include "bhnd_bus_if.h"
 
 extern devclass_t bhnd_devclass;

Added: head/sys/dev/bhnd/bhnd_debug.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bhnd/bhnd_debug.h  Mon May 16 23:40:32 2016
(r20)
@@ -0,0 +1,192 @@
+/*-
+ * Copyright (c) 2016 Michael Zhilin 
+ * 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,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+/* $FreeBSD$ */
+
+/*
+ * This file provides set of macros for logging:
+ *  - BHND_ and
+ *  - BHND__DEV
+ * where LEVEL = {ERROR,WARN,INFO,DEBUG}
+ *
+ * BHND_ macros is proxies to printf call and accept same parameters,
+ * for instance:
+ * BHND_INFO("register %d has value %d", reg, val);
+ *
+ * BHND__DEV macros is proxies to device_printf call and accept
+ * same parameters, for instance:
+ * BHND_INFO_DEV(dev, "register %d has value %d", reg, val);
+ *
+ * All macros contains newline char at the end of each call
+ *
+ * ERROR, WARN, INFO messages are printed only if:
+ * - log message level is lower than BHND_LOGGING (logging threshold)
+ *
+ * DEBUG, TRACE messages are printed only if:
+ * - bootverbose and
+ * - log message level is lower than BHND_LOGGING (logging threshold)
+ *
+ * In addition, for debugging purpose log message contains information about
+ * file name and line number if BHND_LOGGING is more than BHND_INFO_LEVEL
+ *
+ * NOTE: macros starting with underscore (_) are private and should be not used
+ *
+ * 

svn commit: r299989 - head/sys/dev/bhnd

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:37:18 2016
New Revision: 299989
URL: https://svnweb.freebsd.org/changeset/base/299989

Log:
  [bhnd] Add support for matching of MIPS & ARM cores
  
  Extend macros for MIPS & ARM cores. Now only BCM cores can be matched by 
matching mechanism.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6246

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

Modified: head/sys/dev/bhnd/bhnd.h
==
--- head/sys/dev/bhnd/bhnd.hMon May 16 23:29:04 2016(r299988)
+++ head/sys/dev/bhnd/bhnd.hMon May 16 23:37:18 2016(r299989)
@@ -316,12 +316,18 @@ struct bhnd_device {
uint32_t device_flags;  /**< required 
BHND_DF_* flags */
 };
 
-#define_BHND_DEVICE(_device, _desc, _quirks, _flags, ...)  \
-   { BHND_CORE_MATCH(BHND_MFGID_BCM, BHND_COREID_ ## _device, \
+#define_BHND_DEVICE(_vendor, _device, _desc, _quirks, _flags, ...) 
\
+   { BHND_CORE_MATCH(BHND_MFGID_ ## _vendor, BHND_COREID_ ## _device, \
BHND_HWREV_ANY), _desc, _quirks, _flags }
 
+#defineBHND_MIPS_DEVICE(_device, _desc, _quirks, ...)  \
+   _BHND_DEVICE(MIPS, _device, _desc, _quirks, ## __VA_ARGS__, 0)
+
+#defineBHND_ARM_DEVICE(_device, _desc, _quirks, ...)   \
+   _BHND_DEVICE(ARM, _device, _desc, _quirks, ## __VA_ARGS__, 0)
+
 #defineBHND_DEVICE(_device, _desc, _quirks, ...)   \
-   _BHND_DEVICE(_device, _desc, _quirks, ## __VA_ARGS__, 0)
+   _BHND_DEVICE(BCM, _device, _desc, _quirks, ## __VA_ARGS__, 0)
 
 #defineBHND_DEVICE_END { BHND_CORE_MATCH_ANY, NULL, 
NULL, 0 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299988 - head/usr.sbin/rpc.statd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 23:29:04 2016
New Revision: 299988
URL: https://svnweb.freebsd.org/changeset/base/299988

Log:
  Set ai2 to NULL in in find_host() before the loop and after calling
  freeaddrinfo() on it to indicate that it doesn't point to a valid
  addrinfo list.  This fixes this Coverity issues:
1006368 Uninitialized pointer read
1018506 Double free
1305590 Resource leak
  that can be triggered in the hp->hostname[0] != '\0' case.
  
  Don't treat a character as a boolean.
  
  Fix these Coverity issues:
1009293 Unchecked return value from library
1194246 Wrong size argument
  by tweaking the status file extend code.
  
  Reported by:  Coverity
  CID:  1006368, 1018506, 1305590, 1009293, 1194246
  Reviewed by:  rmacklem
  Feedback from:hrs
  MFC after:1 week
  Differential Revision:D6398

Modified:
  head/usr.sbin/rpc.statd/file.c

Modified: head/usr.sbin/rpc.statd/file.c
==
--- head/usr.sbin/rpc.statd/file.c  Mon May 16 23:20:19 2016
(r299987)
+++ head/usr.sbin/rpc.statd/file.c  Mon May 16 23:29:04 2016
(r299988)
@@ -82,6 +82,7 @@ HostInfo *find_host(char *hostname, int 
   struct addrinfo *ai1, *ai2;
   int i;
 
+  ai2 = NULL;
   if (getaddrinfo(hostname, NULL, NULL, ) != 0)
 ai1 = NULL;
   for (i = 0, hp = status_info->hosts; i < status_info->noOfHosts; i++, hp++)
@@ -91,7 +92,7 @@ HostInfo *find_host(char *hostname, int 
   result = hp;
   break;
 }
-if (hp->hostname[0] && 
+if (hp->hostname[0] != '\0' &&
getaddrinfo(hp->hostname, NULL, NULL, ) != 0)
   ai2 = NULL;
 if (ai1 && ai2)
@@ -113,8 +114,10 @@ HostInfo *find_host(char *hostname, int 
if (result)
 break;
 }
-if (ai2)
+if (ai2) {
   freeaddrinfo(ai2);
+  ai2 = NULL;
+}
 if (!spare_slot && !hp->monList && !hp->notifyReqd)
   spare_slot = hp;
   }
@@ -134,9 +137,8 @@ HostInfo *find_host(char *hostname, int 
 if (desired_size > status_file_len)
 {
   /* Extend file by writing 1 byte of junk at the desired end pos  */
-  lseek(status_fd, desired_size - 1, SEEK_SET);
-  i = write(status_fd, , 1);
-  if (i < 1)
+  if (lseek(status_fd, desired_size - 1, SEEK_SET) == -1 ||
+  write(status_fd, "\0", 1) < 0)
   {
syslog(LOG_ERR, "Unable to extend status file");
return (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: r299986 - head/usr.sbin/rpc.lockd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 23:00:48 2016
New Revision: 299986
URL: https://svnweb.freebsd.org/changeset/base/299986

Log:
  Actually use the loop interation limit so carefully computed on the
  previous line to prevent buffer overflow.  This turns out to not be
  important because the upstream xdr code already capped the object
  size at the proper value.  Using the correct limit here looks a lot
  less scary and should please Coverity.
  
  Reported by:  Coverity
  CID:  1199309, 1199310
  MFC after:1 week

Modified:
  head/usr.sbin/rpc.lockd/lock_proc.c

Modified: head/usr.sbin/rpc.lockd/lock_proc.c
==
--- head/usr.sbin/rpc.lockd/lock_proc.c Mon May 16 22:57:36 2016
(r299985)
+++ head/usr.sbin/rpc.lockd/lock_proc.c Mon May 16 23:00:48 2016
(r299986)
@@ -112,7 +112,7 @@ log_netobj(netobj *obj)
}
/* Prevent the security hazard from the buffer overflow */
maxlen = (obj->n_len < MAX_NETOBJ_SZ ? obj->n_len : MAX_NETOBJ_SZ);
-   for (i=0, tmp1 = objvalbuffer, tmp2 = objascbuffer; i < obj->n_len;
+   for (i=0, tmp1 = objvalbuffer, tmp2 = objascbuffer; i < maxlen;
i++, tmp1 +=2, tmp2 +=1) {
sprintf(tmp1,"%02X",*(obj->n_bytes+i));
sprintf(tmp2,"%c",*(obj->n_bytes+i));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299985 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 22:57:36 2016
New Revision: 299985
URL: https://svnweb.freebsd.org/changeset/base/299985

Log:
  [bwn] add opt_wlan.h / opt_bwn.h for build-time control
  
  This is a separate commit as I have local changes to bwn for now and
  this needs a manual merge/commit.
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Mon May 16 22:56:45 2016(r299984)
+++ head/sys/dev/bwn/if_bwn.c   Mon May 16 22:57:36 2016(r299985)
@@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299753 - head/sys/fs/fuse

2016-05-16 Thread Rick Macklem
Alexey Dokuchaev wrote:
> On Sat, May 14, 2016 at 08:03:22PM +, Rick Macklem wrote:
> > New Revision: 299753
> > URL: https://svnweb.freebsd.org/changeset/base/299753
> > 
> > Log:
> >   Fix fuse to use DIRECT_IO when required.
> >   
> >   When a file is opened write-only and a partial block was written,
> >   buffered I/O would try and read the whole block in. This would
> >   result in a hung thread, since there was no open (fuse filehandle)
> >   that allowed reading. This patch avoids the problem by forcing
> >   DIRECT_IO for this case.
> >   It also sets DIRECT_IO when the file system specifies the FN_DIRECTIO
> >   flag in its reply to the open.
> 
> Since you're at fuse now, perhaps you could also have a look at PR 195000?
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195000
> 
> ./danfe
> 
I was able to test the patch and it stops the crash.
I took out the MPASS() call because I didn't see why it should panic
for VFIFO instead of returning EINVAL like the rest.

If you'd like to commit it, email soon. Otherwise I will commit it.

Thanks for pointing this out, rick
___
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: r299984 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 22:56:45 2016
New Revision: 299984
URL: https://svnweb.freebsd.org/changeset/base/299984

Log:
  [bwn] add opt_wlan.h and opt_bwn.h so we can enable bwn debugging as 
appropriate.
  
  Tested:
  
  * BCM4322, STA mode (11a)
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/bwn/bwn_mac.c
  head/sys/dev/bwn/if_bwn_debug.h
  head/sys/dev/bwn/if_bwn_pci.c
  head/sys/dev/bwn/if_bwn_phy_common.c
  head/sys/dev/bwn/if_bwn_phy_g.c
  head/sys/dev/bwn/if_bwn_phy_lp.c
  head/sys/dev/bwn/if_bwn_util.c

Modified: head/sys/dev/bwn/bwn_mac.c
==
--- head/sys/dev/bwn/bwn_mac.c  Mon May 16 22:42:09 2016(r299983)
+++ head/sys/dev/bwn/bwn_mac.c  Mon May 16 22:56:45 2016(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/dev/bwn/if_bwn_debug.h
==
--- head/sys/dev/bwn/if_bwn_debug.h Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_debug.h Mon May 16 22:56:45 2016
(r299984)
@@ -32,8 +32,6 @@
 #ifndef__IF_BWN_DEBUG_H__
 #define__IF_BWN_DEBUG_H__
 
-#defineBWN_DEBUG
-
 enum {
BWN_DEBUG_XMIT  = 0x0001,   /* basic xmit operation */
BWN_DEBUG_RECV  = 0x0002,   /* basic recv operation */

Modified: head/sys/dev/bwn/if_bwn_pci.c
==
--- head/sys/dev/bwn/if_bwn_pci.c   Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_pci.c   Mon May 16 22:56:45 2016
(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/dev/bwn/if_bwn_phy_common.c
==
--- head/sys/dev/bwn/if_bwn_phy_common.cMon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_phy_common.cMon May 16 22:56:45 2016
(r299984)
@@ -31,6 +31,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 /*
  * The Broadcom Wireless LAN controller driver.
  */

Modified: head/sys/dev/bwn/if_bwn_phy_g.c
==
--- head/sys/dev/bwn/if_bwn_phy_g.c Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_phy_g.c Mon May 16 22:56:45 2016
(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 /*
  * The Broadcom Wireless LAN controller driver.
  */

Modified: head/sys/dev/bwn/if_bwn_phy_lp.c
==
--- head/sys/dev/bwn/if_bwn_phy_lp.cMon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_phy_lp.cMon May 16 22:56:45 2016
(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 /*
  * The Broadcom Wireless LAN controller driver.
  */

Modified: head/sys/dev/bwn/if_bwn_util.c
==
--- head/sys/dev/bwn/if_bwn_util.c  Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_util.c  Mon May 16 22:56:45 2016
(r299984)
@@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299982 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 22:39:17 2016
New Revision: 299982
URL: https://svnweb.freebsd.org/changeset/base/299982

Log:
  [bwn] switch to ieee80211_add_channel()
  
  This is an updated version of D6140.
  
  Tested:
  
  * BCM4321 11abgn, STA mode (11a)
  
  Submitted by: avos
  Differential Revision:https://reviews.freebsd.org/D6140

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Mon May 16 22:36:10 2016(r299981)
+++ head/sys/dev/bwn/if_bwn.c   Mon May 16 22:39:17 2016(r299982)
@@ -128,7 +128,7 @@ static int  bwn_setup_channels(struct bwn
 static voidbwn_shm_ctlword(struct bwn_mac *, uint16_t,
uint16_t);
 static voidbwn_addchannels(struct ieee80211_channel [], int, int *,
-   const struct bwn_channelinfo *, int);
+   const struct bwn_channelinfo *, const uint8_t []);
 static int bwn_raw_xmit(struct ieee80211_node *, struct mbuf *,
const struct ieee80211_bpf_params *);
 static voidbwn_updateslot(struct ieee80211com *);
@@ -1459,14 +1459,12 @@ error:
return (ENODEV);
 }
 
-#defineIEEE80211_CHAN_HTG  (IEEE80211_CHAN_HT | IEEE80211_CHAN_G)
-#defineIEEE80211_CHAN_HTA  (IEEE80211_CHAN_HT | IEEE80211_CHAN_A)
-
 static int
 bwn_setup_channels(struct bwn_mac *mac, int have_bg, int have_a)
 {
struct bwn_softc *sc = mac->mac_sc;
struct ieee80211com *ic = >sc_ic;
+   uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
 
memset(ic->ic_channels, 0, sizeof(ic->ic_channels));
ic->ic_nchans = 0;
@@ -1476,26 +1474,20 @@ bwn_setup_channels(struct bwn_mac *mac, 
have_bg,
have_a);
 
-   if (have_bg)
+   if (have_bg) {
+   memset(bands, 0, sizeof(bands));
+   setbit(bands, IEEE80211_MODE_11B);
+   setbit(bands, IEEE80211_MODE_11G);
bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   >ic_nchans, _chantable_bg, IEEE80211_CHAN_G);
-#if 0
-   if (mac->mac_phy.type == BWN_PHYTYPE_N) {
-   if (have_a)
-   bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   >ic_nchans, _chantable_n,
-   IEEE80211_CHAN_HTA);
-   } else {
-   if (have_a)
-   bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   >ic_nchans, _chantable_a,
-   IEEE80211_CHAN_A);
+   >ic_nchans, _chantable_bg, bands);
}
-#endif
-   if (have_a)
+
+   if (have_a) {
+   memset(bands, 0, sizeof(bands));
+   setbit(bands, IEEE80211_MODE_11A);
bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   >ic_nchans, _chantable_a,
-   IEEE80211_CHAN_A);
+   >ic_nchans, _chantable_a, bands);
+   }
 
mac->mac_phy.supports_2ghz = have_bg;
mac->mac_phy.supports_5ghz = have_a;
@@ -1609,63 +1601,16 @@ bwn_shm_write_2(struct bwn_mac *mac, uin
 }
 
 static void
-bwn_addchan(struct ieee80211_channel *c, int freq, int flags, int ieee,
-int txpow)
-{
-
-   c->ic_freq = freq;
-   c->ic_flags = flags;
-   c->ic_ieee = ieee;
-   c->ic_minpower = 0;
-   c->ic_maxpower = 2 * txpow;
-   c->ic_maxregpower = txpow;
-}
-
-static void
 bwn_addchannels(struct ieee80211_channel chans[], int maxchans, int *nchans,
-const struct bwn_channelinfo *ci, int flags)
+const struct bwn_channelinfo *ci, const uint8_t bands[])
 {
-   struct ieee80211_channel *c;
-   int i;
+   int i, error;
 
-   c = [*nchans];
+   for (i = 0, error = 0; i < ci->nchannels && error == 0; i++) {
+   const struct bwn_channel *hc = >channels[i];
 
-   for (i = 0; i < ci->nchannels; i++) {
-   const struct bwn_channel *hc;
-
-   hc = >channels[i];
-   if (*nchans >= maxchans)
-   break;
-   bwn_addchan(c, hc->freq, flags, hc->ieee, hc->maxTxPow);
-   c++, (*nchans)++;
-   if (flags == IEEE80211_CHAN_G || flags == IEEE80211_CHAN_HTG) {
-   /* g channel have a separate b-only entry */
-   if (*nchans >= maxchans)
-   break;
-   c[0] = c[-1];
-   c[-1].ic_flags = IEEE80211_CHAN_B;
-   c++, (*nchans)++;
-   }
-   if (flags == IEEE80211_CHAN_HTG) {
-   /* HT g channel have a separate g-only entry */
-   if (*nchans >= maxchans)
-   break;
-   c[-1].ic_flags = IEEE80211_CHAN_G;
-   c[0] = c[-1];
- 

svn commit: r299977 - head/sys/dev/acpica/Osd

2016-05-16 Thread John Baldwin
Author: jhb
Date: Mon May 16 21:33:31 2016
New Revision: 299977
URL: https://svnweb.freebsd.org/changeset/base/299977

Log:
  Use polling spin loops for timeouts during early boot.
  
  Some ACPI operations such as mutex acquires and event waits accept a
  timeout.  The ACPI OSD layer implements these timeouts by using regular
  sleep timeouts.  However, this doesn't work during early boot before
  event timers are setup.  Instead, use polling combined with DELAY()
  to spin.
  
  This fixes booting on upcoming Intel systems with Kaby Lake processors.
  
  Tested by:"Jeffrey E Pieper" 
  Reviewed by:  jimharris
  MFC after:1 week

Modified:
  head/sys/dev/acpica/Osd/OsdSynch.c

Modified: head/sys/dev/acpica/Osd/OsdSynch.c
==
--- head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 20:26:30 2016
(r299976)
+++ head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 21:33:31 2016
(r299977)
@@ -188,6 +188,23 @@ AcpiOsWaitSemaphore(ACPI_SEMAPHORE Handl
}
break;
default:
+   if (cold) {
+   /*
+* Just spin polling the semaphore once a
+* millisecond.
+*/
+   while (!ACPISEM_AVAIL(as, Units)) {
+   if (Timeout == 0) {
+   status = AE_TIME;
+   break;
+   }
+   Timeout--;
+   mtx_unlock(>as_lock);
+   DELAY(1000);
+   mtx_lock(>as_lock);
+   }
+   break;
+   }
tmo = timeout2hz(Timeout);
while (!ACPISEM_AVAIL(as, Units)) {
prevtick = ticks;
@@ -381,6 +398,23 @@ AcpiOsAcquireMutex(ACPI_MUTEX Handle, UI
}
break;
default:
+   if (cold) {
+   /*
+* Just spin polling the mutex once a
+* millisecond.
+*/
+   while (!ACPIMTX_AVAIL(am)) {
+   if (Timeout == 0) {
+   status = AE_TIME;
+   break;
+   }
+   Timeout--;
+   mtx_unlock(>am_lock);
+   DELAY(1000);
+   mtx_lock(>am_lock);
+   }
+   break;
+   }
tmo = timeout2hz(Timeout);
while (!ACPIMTX_AVAIL(am)) {
prevtick = ticks;
___
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: r299753 - head/sys/fs/fuse

2016-05-16 Thread Rick Macklem
Alexey Dokuchaev wrote:
> On Sat, May 14, 2016 at 08:03:22PM +, Rick Macklem wrote:
> > New Revision: 299753
> > URL: https://svnweb.freebsd.org/changeset/base/299753
> > 
> > Log:
> >   Fix fuse to use DIRECT_IO when required.
> >   
> >   When a file is opened write-only and a partial block was written,
> >   buffered I/O would try and read the whole block in. This would
> >   result in a hung thread, since there was no open (fuse filehandle)
> >   that allowed reading. This patch avoids the problem by forcing
> >   DIRECT_IO for this case.
> >   It also sets DIRECT_IO when the file system specifies the FN_DIRECTIO
> >   flag in its reply to the open.
> 
> Since you're at fuse now, perhaps you could also have a look at PR 195000?
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195000
> 
> ./danfe
> 
Yea, the patch in PR#195000 looks ok. I'll try to reproduce the crash and if
I can test the patch, I can commit it.
Or would you prefer to do so?

I think fuse can be made to handle special files by  creating separate tables
of vop methods (like the NFS client does), but that is a fair amount of work, so
I think committing this patch to stop the crash makes sense in the meantime.

rick
___
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: r299976 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 20:26:30 2016
New Revision: 299976
URL: https://svnweb.freebsd.org/changeset/base/299976

Log:
  [bwn] check DUALPHY; add BCM4322 to the don't-override list.
  
  * DUALPHY in TGSHIGH tells us there's a phy that is dualband, rather than
two separate PHYs/MACs (which we almost but don't quite yet support.)
Use it.
  
  * Add the BCM4322 PCI ID to the list of devices we don't override.
This means the 2g/5g flags are preserved, and thus we get 5GHz
operation (with N-PHY, of course.)
  
  Tested:
  
  * BCM4311, STA mode (11bg)
  * BCM4312, STA mode (11bg)
  * BCM4321, STA mode (11abg)
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Mon May 16 20:22:52 2016(r299975)
+++ head/sys/dev/bwn/if_bwn.c   Mon May 16 20:26:30 2016(r299976)
@@ -1147,15 +1147,32 @@ bwn_attach_core(struct bwn_mac *mac)
siba_powerup(sc->sc_dev, 0);
 
high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
+
+   /*
+* Guess at whether it has A-PHY or G-PHY.
+* This is just used for resetting the core to probe things;
+* we will re-guess once it's all up and working.
+*
+* XXX TODO: there's the TGSHIGH DUALPHY flag based on
+* the PHY revision.
+*/
bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ));
+
+   /*
+* Get the PHY version.
+*/
error = bwn_phy_getinfo(mac, high);
if (error)
goto fail;
 
-   /* XXX need bhnd */
+   /* XXX TODO need bhnd */
if (bwn_is_bus_siba(mac)) {
have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
+   if (high & BWN_TGSHIGH_DUALPHY) {
+   have_bg = 1;
+   have_a = 1;
+   }
} else {
device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__);
error = ENXIO;
@@ -1175,7 +1192,8 @@ bwn_attach_core(struct bwn_mac *mac)
 
if (siba_get_pci_device(sc->sc_dev) != 0x4312 &&
siba_get_pci_device(sc->sc_dev) != 0x4319 &&
-   siba_get_pci_device(sc->sc_dev) != 0x4324) {
+   siba_get_pci_device(sc->sc_dev) != 0x4324 &&
+   siba_get_pci_device(sc->sc_dev) != 0x4328) {
have_a = have_bg = 0;
if (mac->mac_phy.type == BWN_PHYTYPE_A)
have_a = 1;
@@ -1187,9 +1205,17 @@ bwn_attach_core(struct bwn_mac *mac)
KASSERT(0 == 1, ("%s: unknown phy type (%d)", __func__,
mac->mac_phy.type));
}
-   /* XXX turns off PHY A because it's not supported */
+
+   /*
+* XXX turns off PHY A because it's not supported.
+* Implement PHY-A support so we can use it for PHY-G
+* dual-band support.
+*/
if (mac->mac_phy.type != BWN_PHYTYPE_LP &&
mac->mac_phy.type != BWN_PHYTYPE_N) {
+   device_printf(sc->sc_dev,
+   "%s: forcing 2GHz only; missing PHY-A support\n",
+   __func__);
have_a = 0;
have_bg = 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: r299975 - head/sys/dev/siba

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 20:22:52 2016
New Revision: 299975
URL: https://svnweb.freebsd.org/changeset/base/299975

Log:
  [siba] fix up debugging.
  
  * unbreak non-debug builds - don't default to debugging SCAN; that was
left-over from my testing.
  * include opt_siba.h, now that it's generated as appropriate.
  * stick the debug enum outside the debug block, just so it's there for
any code that wants to set siba_debug for some reason (like say,
my debugging muckup.)
  * make DPRINTF() use __VA_ARGS__ for formatting too, so it correctly
handles printing w/ no args.
  * Make DPRINTF() use device_printf().
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/siba/siba_core.c

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Mon May 16 20:18:54 2016
(r299974)
+++ head/sys/dev/siba/siba_core.c   Mon May 16 20:22:52 2016
(r299975)
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
  * the Sonics Silicon Backplane driver.
  */
 
+#include "opt_siba.h"
+
 #include 
 #include 
 #include 
@@ -60,7 +62,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#ifdef SIBA_DEBUG
 enum {
SIBA_DEBUG_SCAN = 0x0001,   /* scan */
SIBA_DEBUG_PMU  = 0x0002,   /* PMU */
@@ -70,13 +71,16 @@ enum {
SIBA_DEBUG_CORE = 0x0020,   /* handling cores */
SIBA_DEBUG_ANY  = 0x
 };
-#define DPRINTF(siba, m, fmt, ...) do {\
-   if (siba->siba_debug & (m)) \
-   printf(fmt, __VA_ARGS__);   \
+
+#ifdef SIBA_DEBUG
+#define DPRINTF(siba, m, ...) do { \
+   if (siba->siba_debug & (m)) \
+   device_printf(siba->siba_dev, __VA_ARGS__); \
 } while (0)
 #else
-#define DPRINTF(siba, m, fmt, ...) do { (void) siba; } while (0)
+#define DPRINTF(siba, m, ...) do { (void) siba; } while (0)
 #endif
+
 #defineN(a)(sizeof(a) / sizeof(a[0]))
 
 static voidsiba_pci_gpio(struct siba_softc *, uint32_t, int);
@@ -184,8 +188,6 @@ siba_core_attach(struct siba_softc *siba
 
siba->siba_ops = _pci_ops;
 
-   siba->siba_debug = SIBA_DEBUG_SCAN;
-
siba_pci_gpio(siba, SIBA_GPIO_CRYSTAL | SIBA_GPIO_PLL, 1);
siba_scan(siba);
 
___
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: r299974 - head/sys/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 20:18:54 2016
New Revision: 299974
URL: https://svnweb.freebsd.org/changeset/base/299974

Log:
  [siba] add SIBA_DEBUG option.
  
  Sponsored by: Palm Springs

Modified:
  head/sys/conf/options

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon May 16 20:04:38 2016(r299973)
+++ head/sys/conf/options   Mon May 16 20:18:54 2016(r299974)
@@ -857,6 +857,9 @@ BWI_DEBUG_VERBOSE   opt_bwi.h
 # options for the Brodacom BCM43xx driver (bwn)
 BWN_DEBUG  opt_bwn.h
 
+# Options for the SIBA driver
+SIBA_DEBUG opt_siba.h
+
 # options for the Marvell 8335 wireless driver
 MALO_DEBUG opt_malo.h
 MALO_TXBUF opt_malo.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299930 - in head/sys/compat/linuxkpi/common: include/linux src

2016-05-16 Thread Conrad Meyer
On Mon, May 16, 2016 at 2:16 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Mon May 16 09:16:15 2016
> New Revision: 299930
> URL: https://svnweb.freebsd.org/changeset/base/299930
>
> Log:
>   Properly implement "cpu_has_clflush" macro.
> ...
> @@ -51,6 +51,10 @@ __FBSDID("$FreeBSD$");
>
>  #include 
>
> +#if defined(__i386__) || defined(__amd64__)
> +#include 
> +#endif
> +
>  #include 
>  #include 
>  #include 
> @@ -67,6 +71,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 

Hi Hans,

In Linux code, usually linux/kernel.h is included first.  In FreeBSD,
we mostly sort alphabetically.  Pick a system, but this is the wrong
place for this include :-).

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


svn commit: r299973 - head/sys/dev/ow

2016-05-16 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 16 20:04:38 2016
New Revision: 299973
URL: https://svnweb.freebsd.org/changeset/base/299973

Log:
  dev/ow: Tag an unreachable switch default.
  
  Coverity reports an uninitialized "dir" in case the switch defaults
  without hitting any case. Respect the original intent and quell the
  false positive with the relatively new __unreachable() builtin.
  
  CID:  1331566

Modified:
  head/sys/dev/ow/ow.c

Modified: head/sys/dev/ow/ow.c
==
--- head/sys/dev/ow/ow.cMon May 16 20:00:09 2016(r299972)
+++ head/sys/dev/ow/ow.cMon May 16 20:04:38 2016(r299973)
@@ -401,6 +401,8 @@ again:
if (++retries > 5)
return (EIO);
goto again;
+   default: /* NOTREACHED */
+   __unreachable();
}
if (dir) {
OWLL_WRITE_ONE(lldev, _regular);
___
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: r299972 - head/sys/boot/efi/libefi

2016-05-16 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 16 20:00:09 2016
New Revision: 299972
URL: https://svnweb.freebsd.org/changeset/base/299972

Log:
  libefi: Tag an unreachable switch default.
  
  Coverity reports an uninitialized "len" in case the switch defaults
  without hitting any case. Respect the original intent and quell the
  false positive with the relatively new __unreachable() builtin.
  
  CID:  1347796

Modified:
  head/sys/boot/efi/libefi/efi_console.c

Modified: head/sys/boot/efi/libefi/efi_console.c
==
--- head/sys/boot/efi/libefi/efi_console.c  Mon May 16 19:48:02 2016
(r299971)
+++ head/sys/boot/efi/libefi/efi_console.c  Mon May 16 20:00:09 2016
(r299972)
@@ -266,6 +266,8 @@ CL(int direction)
case 2: /* entire line */
len = x;
break;
+   default:/* NOTREACHED */
+   __unreachable();
}
 
if (cury == y - 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"


Re: svn commit: r299839 - head/etc/rc.d

2016-05-16 Thread Ngie Cooper
On Sun, May 15, 2016 at 9:45 AM, Ian Lepore  wrote:
> On Sun, 2016-05-15 at 04:38 +, Garrett Cooper wrote:
>> Author: ngie
>> Date: Sun May 15 04:38:50 2016
>> New Revision: 299839
>> URL: https://svnweb.freebsd.org/changeset/base/299839
>>
>> Log:
>>   Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol
>>
>>   Make zfs and zvol come before all of the items that depended on
>> them
>>   previously
>
> I'm trying to figure out why these changes are needed.  rcorder works
> just fine when a requirement has no providers (yes, it whines, but
> that's why /etc/rc invokes it with 2>/dev/null).  If FILESYSTEMS
> requires zfs and nothing provides zfs, then it's as if the requirement
> weren't in the list at all.
>
> The manpage for rcorder is wrong, the DIAGNOSTICS section implies that
> rcorder will abort on a missing requirement, but it doesn't.
>
> Changing requirements to BEFOREs seems like it has a lot of potential
> for messing with peoples' out-of-tree customizations.  (And for some
> reason I've always had the impression that BEFORE was to be avoided in
> the base rc files, but I can't remember why I think that.)

Hi Ian,
Answering both you and Ravi, I agree that the general boot case
will "just work" (tm), but it masks issues. In the vanilla case,
/etc/rc redirects stderr to /dev/null . This unfortunately hides both
missing rc.d dependencies called out as REQUIREs, as well as circular
dependencies (which you might notice if you ran rcorder on the
directory after r287197 on head -- see:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202726 ), which
means that if anyone is running rcorder without directing the stderr
to /dev/null, they'll be confused by circular dependencies or missing
PROVIDEs if rc.d script aren't installed; I do this sometimes by
cd'ing to the etc/rc.d directory and running rcorder `make -VFILES`.
Anytime there's a circular dependency, rcorder tosses the whole thing
out and screws up the boot order.
In the $work case, we use a different system internally at $work
for running parallel boot that calculates rc.d script dependencies in
a lot more pedantic way. If a dependency is missing, our boot will
fail, so we've created a bunch of dummy provides for missing rc.d
scripts that are REQUIREments that we don't install. This bloats the
rc.d graph more than necessary.
All in all, this entire thing is a mess; I'm just shuffling deck
chairs right now so I can replace boards and refinish parts of the
metaphorical deck enough that things will work "ok" for 11.0-RELEASE.
I'll talk with mmacy about launchd and come up with an official
proposal for how to move forward with boot in 12.0, because rc is a
dated system and needs to be replaced with something more performant
and more flexible/logical (run things based on events instead of a
one-time static boot order).
Thanks,
-Ngie
___
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: r299971 - head/usr.bin/chat

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 19:48:02 2016
New Revision: 299971
URL: https://svnweb.freebsd.org/changeset/base/299971

Log:
  Fix off by one error that overflowed the rep_len array when doing
  the final NUL termination.
  
  Reported by:  Coverity
  CID:  1007617
  MFC after:1 week

Modified:
  head/usr.bin/chat/chat.c

Modified: head/usr.bin/chat/chat.c
==
--- head/usr.bin/chat/chat.cMon May 16 19:42:38 2016(r299970)
+++ head/usr.bin/chat/chat.cMon May 16 19:48:02 2016(r299971)
@@ -521,7 +521,7 @@ void terminate(int status)
size_t rep_len;
 
rep_len = strlen(report_buffer);
-   while (rep_len + 1 <= sizeof(report_buffer)) {
+   while (rep_len + 1 < sizeof(report_buffer)) {
alarm(1);
c = get_char();
alarm(0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299970 - head/sys/ddb

2016-05-16 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 16 19:42:38 2016
New Revision: 299970
URL: https://svnweb.freebsd.org/changeset/base/299970

Log:
  Add a small set of logical operators to DDB command language.
  
  This are based on Mach3.
  Documentation is pending but has been promised.
  
  Submitted by: Dan Partelly
  Reviewed by:  adrian, jhb (older version)
  
  Differential Revision:https://reviews.freebsd.org/D4230
  RelNotes: yes

Modified:
  head/sys/ddb/db_examine.c
  head/sys/ddb/db_expr.c
  head/sys/ddb/db_lex.c
  head/sys/ddb/db_lex.h

Modified: head/sys/ddb/db_examine.c
==
--- head/sys/ddb/db_examine.c   Mon May 16 19:39:05 2016(r299969)
+++ head/sys/ddb/db_examine.c   Mon May 16 19:42:38 2016(r299970)
@@ -225,6 +225,10 @@ db_print_cmd(db_expr_t addr, bool have_a
else
db_printf("\\%03o", (int)value);
break;
+   default:
+   db_print_format = 'x';
+   db_error("Syntax error: unsupported print modifier\n");
+   /*NOTREACHED*/
}
db_printf("\n");
 }

Modified: head/sys/ddb/db_expr.c
==
--- head/sys/ddb/db_expr.c  Mon May 16 19:39:05 2016(r299969)
+++ head/sys/ddb/db_expr.c  Mon May 16 19:42:38 2016(r299970)
@@ -43,6 +43,9 @@ static bool   db_mult_expr(db_expr_t *valu
 static booldb_shift_expr(db_expr_t *valuep);
 static booldb_term(db_expr_t *valuep);
 static booldb_unary(db_expr_t *valuep);
+static booldb_logical_or_expr(db_expr_t *valuep);
+static booldb_logical_and_expr(db_expr_t *valuep);
+static booldb_logical_relation_expr(db_expr_t *valuep);
 
 static bool
 db_term(db_expr_t *valuep)
@@ -108,19 +111,40 @@ db_unary(db_expr_t *valuep)
t = db_read_token();
if (t == tMINUS) {
if (!db_unary(valuep)) {
-   db_error("Syntax error\n");
+   db_printf("Expression syntax error after '%c'\n", '-');
+   db_error(NULL);
/*NOTREACHED*/
}
*valuep = -*valuep;
return (true);
}
+   if (t == tEXCL) {
+   if(!db_unary(valuep)) {
+   db_printf("Expression syntax error after '%c'\n", '!');
+   db_error(NULL);
+   /* NOTREACHED  */
+   }
+   *valuep = (!(*valuep));
+   return (true);
+   }
+   if (t == tBIT_NOT) {
+   if(!db_unary(valuep)) {
+   db_printf("Expression syntax error after '%c'\n", '~');
+   db_error(NULL);
+   /* NOTREACHED */
+   }
+   *valuep = (~(*valuep));
+   return (true);
+   }
if (t == tSTAR) {
/* indirection */
if (!db_unary(valuep)) {
-   db_error("Syntax error\n");
+   db_printf("Expression syntax error after '%c'\n", '*');
+   db_error(NULL);
/*NOTREACHED*/
}
-   *valuep = db_get_value((db_addr_t)*valuep, sizeof(void *), false);
+   *valuep = db_get_value((db_addr_t)*valuep, sizeof(void *),
+   false);
return (true);
}
db_unread_token(t);
@@ -137,24 +161,31 @@ db_mult_expr(db_expr_t *valuep)
return (false);
 
t = db_read_token();
-   while (t == tSTAR || t == tSLASH || t == tPCT || t == tHASH) {
+   while (t == tSTAR || t == tSLASH || t == tPCT || t == tHASH ||
+   t == tBIT_AND ) {
if (!db_term()) {
-   db_error("Syntax error\n");
+   db_printf("Expression syntax error after '%c'\n", '!');
+   db_error(NULL);
/*NOTREACHED*/
}
-   if (t == tSTAR)
-   lhs *= rhs;
-   else {
-   if (rhs == 0) {
-   db_error("Divide by 0\n");
-   /*NOTREACHED*/
-   }
-   if (t == tSLASH)
-   lhs /= rhs;
-   else if (t == tPCT)
-   lhs %= rhs;
-   else
-   lhs = roundup(lhs, rhs);
+   switch(t)  {
+   case tSTAR:
+   lhs *= rhs;
+   break;
+   case tBIT_AND:
+   lhs &= rhs;
+   break;
+   default:
+   if (rhs == 0) {
+   db_error("Divide by 0\n");
+   /*NOTREACHED*/
+   }
+   if (t == tSLASH)
+   lhs /= rhs;
+   else if (t == tPCT)
+   lhs %= rhs;
+   else
+   lhs = roundup(lhs, rhs);
}
t = db_read_token();
}
@@ -168,20 +199,32 @@ db_add_expr(db_expr_t *valuep)
 {
db_expr_t  

svn commit: r299969 - head/sys/dev/siba

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 19:39:05 2016
New Revision: 299969
URL: https://svnweb.freebsd.org/changeset/base/299969

Log:
  [siba] make the debug code somewhat useful again.
  
  It's still not configurable by a kernel option; that'll come next.
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/siba/siba_core.c
  head/sys/dev/siba/sibavar.h

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Mon May 16 19:33:23 2016
(r299968)
+++ head/sys/dev/siba/siba_core.c   Mon May 16 19:39:05 2016
(r299969)
@@ -184,6 +184,8 @@ siba_core_attach(struct siba_softc *siba
 
siba->siba_ops = _pci_ops;
 
+   siba->siba_debug = SIBA_DEBUG_SCAN;
+
siba_pci_gpio(siba, SIBA_GPIO_CRYSTAL | SIBA_GPIO_PLL, 1);
siba_scan(siba);
 
@@ -332,7 +334,8 @@ siba_scan(struct siba_softc *siba)
DPRINTF(siba, SIBA_DEBUG_SCAN,
"core %d (%s) found (cc %#xrev %#x vendor %#x)\n",
i, siba_core_name(sd->sd_id.sd_device),
-   sd->sd_id.sd_device, sd->sd_id.sd_rev, sd->sd_id.vendor);
+   sd->sd_id.sd_device, sd->sd_id.sd_rev,
+   sd->sd_id.sd_vendor);
 
switch (sd->sd_id.sd_device) {
case SIBA_DEVID_CHIPCOMMON:

Modified: head/sys/dev/siba/sibavar.h
==
--- head/sys/dev/siba/sibavar.h Mon May 16 19:33:23 2016(r299968)
+++ head/sys/dev/siba/sibavar.h Mon May 16 19:39:05 2016(r299969)
@@ -604,6 +604,7 @@ struct siba_softc {
bus_addr_t  siba_maddr;
bus_size_t  siba_msize;
uint8_t siba_ncores;
+   uint32_tsiba_debug;
 
/*
 * the following variables are only used for siba_bwn bridge.
___
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: r299965 - head/sys/dev/urtwn

2016-05-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon May 16 19:10:59 2016
New Revision: 299965
URL: https://svnweb.freebsd.org/changeset/base/299965

Log:
  urtwn: add support for hardware multicast filter setup.
  
  Tested with RTL8188EU and RTL8188CUS.

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Mon May 16 19:10:35 2016
(r299964)
+++ head/sys/dev/urtwn/if_urtwn.c   Mon May 16 19:10:59 2016
(r299965)
@@ -356,6 +356,8 @@ static void urtwn_update_slot(struct ie
 static voidurtwn_update_slot_cb(struct urtwn_softc *,
union sec_param *);
 static voidurtwn_update_aifs(struct urtwn_softc *, uint8_t);
+static uint8_t urtwn_get_multi_pos(const uint8_t[]);
+static voidurtwn_set_multi(struct urtwn_softc *);
 static voidurtwn_set_promisc(struct urtwn_softc *);
 static voidurtwn_update_promisc(struct ieee80211com *);
 static voidurtwn_update_mcast(struct ieee80211com *);
@@ -4359,9 +4361,8 @@ urtwn_rxfilter_init(struct urtwn_softc *
 
URTWN_ASSERT_LOCKED(sc);
 
-   /* Accept all multicast frames. */
-   urtwn_write_4(sc, R92C_MAR + 0, 0x);
-   urtwn_write_4(sc, R92C_MAR + 4, 0x);
+   /* Setup multicast filter. */
+   urtwn_set_multi(sc);
 
/* Filter for management frames. */
filter = 0x7f3f;
@@ -4822,6 +4823,67 @@ urtwn_update_aifs(struct urtwn_softc *sc
 }
 }
 
+static uint8_t
+urtwn_get_multi_pos(const uint8_t maddr[])
+{
+   uint64_t mask = 0x4d101df481b4;
+   uint8_t pos = 0x27; /* initial value */
+   int i, j;
+
+   for (i = 0; i < IEEE80211_ADDR_LEN; i++)
+   for (j = (i == 0) ? 1 : 0; j < 8; j++)
+   if ((maddr[i] >> j) & 1)
+   pos ^= (mask >> (i * 8 + j - 1));
+
+   pos &= 0x3f;
+
+   return (pos);
+}
+
+static void
+urtwn_set_multi(struct urtwn_softc *sc)
+{
+   struct ieee80211com *ic = >sc_ic;
+   uint32_t mfilt[2];
+
+   URTWN_ASSERT_LOCKED(sc);
+
+   /* general structure was copied from ath(4). */
+   if (ic->ic_allmulti == 0) {
+   struct ieee80211vap *vap;
+   struct ifnet *ifp;
+   struct ifmultiaddr *ifma;
+
+   /*
+* Merge multicast addresses to form the hardware filter.
+*/
+   mfilt[0] = mfilt[1] = 0;
+   TAILQ_FOREACH(vap, >ic_vaps, iv_next) {
+   ifp = vap->iv_ifp;
+   if_maddr_rlock(ifp);
+   TAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link) {
+   caddr_t dl;
+   uint8_t pos;
+
+   dl = LLADDR((struct sockaddr_dl *)
+   ifma->ifma_addr);
+   pos = urtwn_get_multi_pos(dl);
+
+   mfilt[pos / 32] |= (1 << (pos % 32));
+   }
+   if_maddr_runlock(ifp);
+   }
+   } else
+   mfilt[0] = mfilt[1] = ~0;
+
+
+   urtwn_write_4(sc, R92C_MAR + 0, mfilt[0]);
+   urtwn_write_4(sc, R92C_MAR + 4, mfilt[1]);
+
+   URTWN_DPRINTF(sc, URTWN_DEBUG_STATE, "%s: MC filter %08x:%08x\n",
+__func__, mfilt[0], mfilt[1]);
+}
+
 static void
 urtwn_set_promisc(struct urtwn_softc *sc)
 {
@@ -4877,7 +4939,12 @@ urtwn_update_promisc(struct ieee80211com
 static void
 urtwn_update_mcast(struct ieee80211com *ic)
 {
-   /* XXX do nothing?  */
+   struct urtwn_softc *sc = ic->ic_softc;
+
+   URTWN_LOCK(sc);
+   if (sc->sc_flags & URTWN_RUNNING)
+   urtwn_set_multi(sc);
+   URTWN_UNLOCK(sc);
 }
 
 static struct ieee80211_node *
___
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: r299963 - head/sys/arm/conf

2016-05-16 Thread Bjoern A. Zeeb
Author: bz
Date: Mon May 16 19:07:58 2016
New Revision: 299963
URL: https://svnweb.freebsd.org/changeset/base/299963

Log:
  Add HWPMC_HOOKS to std.armv6 to make them available
  so the module could be loaded.
  
  Discussed with:   andrew
  Reviewed by:  andrew
  Sponsored by: DARPA/AFRL
  Differential Revision:https://reviews.freebsd.org/D6359

Modified:
  head/sys/arm/conf/TEGRA124
  head/sys/arm/conf/std.armv6

Modified: head/sys/arm/conf/TEGRA124
==
--- head/sys/arm/conf/TEGRA124  Mon May 16 18:47:53 2016(r299962)
+++ head/sys/arm/conf/TEGRA124  Mon May 16 19:07:58 2016(r299963)
@@ -154,4 +154,3 @@ device  fdt_pinctrl
 # SoC-specific devices
 
 #devicehwpmc
-#options   HWPMC_HOOKS

Modified: head/sys/arm/conf/std.armv6
==
--- head/sys/arm/conf/std.armv6 Mon May 16 18:47:53 2016(r299962)
+++ head/sys/arm/conf/std.armv6 Mon May 16 19:07:58 2016(r299963)
@@ -36,6 +36,7 @@ options   SYSVSEM # SYSV-style semaphor
 options_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time 
extensions
 optionsPRINTF_BUFR_SIZE=128# Prevent printf output being 
interspersed.
 optionsKBD_INSTALL_CDEV# install a CDEV entry in /dev
+optionsHWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
 optionsFREEBSD_BOOT_LOADER # Process metadata passed from loader(8)
 optionsVFP # Enable floating point hardware support
 
___
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: r299746 - in head/sys: cddl/dev/dtrace cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 cddl/dev/dtrace/powerpc conf dev/acpica dev/hwpmc dev/hyperv/vmbus dev/xen/control geom/eli kern net s

2016-05-16 Thread John Baldwin
On Monday, May 16, 2016 01:25:56 PM Julian Elischer wrote:
> On 15/05/2016 2:22 AM, John Baldwin wrote:
> > Author: jhb
> > Date: Sat May 14 18:22:52 2016
> > New Revision: 299746
> > URL: https://svnweb.freebsd.org/changeset/base/299746
> >
> > Log:
> >Add an EARLY_AP_STARTUP option to start APs earlier during boot.


 
> >As a transition aid, the new behavior is available under a new kernel
> >option (EARLY_AP_STARTUP).  This will allow the option to be turned off
> >if need be during initial testing.  I plan to enable this on x86 by
> >default in a followup commit in the next few days and to have all
> >platforms moved over before 11.0.  Once the transition is complete,
> >the option will be removed along with the !EARLY_AP_STARTUP code.



> John, This feels as though it should be settable with a tuneable 
> variable. Can you think
> of a good way to do this other than having two sysinit entries and making
> the tuneable "enable" the right one? There is no tuneable/sysinit 
> interaction otherwise.

The idea is for the !EARLY_AP_STARTUP code to be temporary, so I think
adding a tunable is probably a bit much to add in terms of overhead for
something that should be temporary.

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


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

2016-05-16 Thread Ngie Cooper
On Mon, May 16, 2016 at 10:41 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Mon May 16 17:41:25 2016
> New Revision: 299960
> URL: https://svnweb.freebsd.org/changeset/base/299960
>
> Log:
>   Only lock Giant when needed in the LinuxKPI.
>
>   Suggested by: ngie @
>   MFC after:1 week
>   Sponsored by: Mellanox Technologies

Thanks!
___
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: r299960 - head/sys/compat/linuxkpi/common/include/linux

2016-05-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 16 17:41:25 2016
New Revision: 299960
URL: https://svnweb.freebsd.org/changeset/base/299960

Log:
  Only lock Giant when needed in the LinuxKPI.
  
  Suggested by: ngie @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
17:32:28 2016(r299959)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
17:41:25 2016(r299960)
@@ -333,10 +333,11 @@ device_unregister(struct device *dev)
bsddev = dev->bsddev;
dev->bsddev = NULL;
 
-   mtx_lock();
-   if (bsddev != NULL)
+   if (bsddev != NULL) {
+   mtx_lock();
device_delete_child(device_get_parent(bsddev), bsddev);
-   mtx_unlock();
+   mtx_unlock();
+   }
put_device(dev);
 }
 
@@ -348,10 +349,11 @@ device_del(struct device *dev)
bsddev = dev->bsddev;
dev->bsddev = NULL;
 
-   mtx_lock();
-   if (bsddev != NULL)
+   if (bsddev != NULL) {
+   mtx_lock();
device_delete_child(device_get_parent(bsddev), bsddev);
-   mtx_unlock();
+   mtx_unlock();
+   }
 }
 
 struct device *device_create(struct class *class, struct device *parent,
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Hans Petter Selasky

On 05/16/16 18:51, Ngie Cooper (yaneurabeya) wrote:



On May 16, 2016, at 09:47, Hans Petter Selasky  wrote:

On 05/16/16 18:31, Ngie Cooper (yaneurabeya) wrote:

Dumb question — couldn’t we run the check without locking Giant, then delete 
the child, e.g.

if (bsddev != NULL) {
   mtx_lock();
   device_delete_child(device_get_parent(bsddev), bsddev);
   mtx_unlock();
}
put_device(dev);


I guess so. Does it make a difference for you?


First off, how often does the bsddev == NULL case occur?

If it doesn’t occur often, doing this increases contention on Giant 
unnecessarily…


In general this piece of code is called very rarely. I'll look into it.

--HPS

___
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: r299944 - in head/sys: arm64/arm64 conf

2016-05-16 Thread Ed Maste
On 16 May 2016 at 12:08, Zbigniew Bodek  wrote:
> Hello Andrew,
>
> I think committing this code should be preceded by at least brief review.

I agree, review makes sense especially in the case of GICv3 and other
files that originated in the ThunderX work or are closely tied to that
platform.
___
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: r299957 - head/sys/dev/isp

2016-05-16 Thread Alexander Motin
Author: mav
Date: Mon May 16 17:18:26 2016
New Revision: 299957
URL: https://svnweb.freebsd.org/changeset/base/299957

Log:
  Reduce verbosity of "now sending synthesized status" message.
  
  MFC after:1 week

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Mon May 16 17:06:44 2016
(r299956)
+++ head/sys/dev/isp/isp_freebsd.c  Mon May 16 17:18:26 2016
(r299957)
@@ -1363,7 +1363,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u
 * and status, don't do it again and do the status portion now.
 */
if (atp->sendst) {
-   isp_prt(isp, ISP_LOGTINFO, "[0x%x] now sending 
synthesized status orig_dl=%u xfered=%u bit=%u",
+   isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] now sending 
synthesized status orig_dl=%u xfered=%u bit=%u",
cso->tag_id, atp->orig_datalen, atp->bytes_xfered, 
atp->bytes_in_transit);
xfrlen = 0; /* we already did the data transfer */
atp->sendst = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Ngie Cooper (yaneurabeya)

> On May 16, 2016, at 09:47, Hans Petter Selasky  wrote:
> 
> On 05/16/16 18:31, Ngie Cooper (yaneurabeya) wrote:
>> Dumb question — couldn’t we run the check without locking Giant, then delete 
>> the child, e.g.
>> 
>> if (bsddev != NULL) {
>>mtx_lock();
>>device_delete_child(device_get_parent(bsddev), bsddev);
>>mtx_unlock();
>> }
>> put_device(dev);
> 
> I guess so. Does it make a difference for you?

First off, how often does the bsddev == NULL case occur?

If it doesn’t occur often, doing this increases contention on Giant 
unnecessarily…

Thanks,
-Ngie
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Hans Petter Selasky

On 05/16/16 18:31, Ngie Cooper (yaneurabeya) wrote:

Dumb question — couldn’t we run the check without locking Giant, then delete 
the child, e.g.

if (bsddev != NULL) {
mtx_lock();
device_delete_child(device_get_parent(bsddev), bsddev);
mtx_unlock();
}
put_device(dev);


I guess so. Does it make a difference for you?

--HPS
___
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: r299955 - head/sys/dev/isp

2016-05-16 Thread Alexander Motin
Author: mav
Date: Mon May 16 16:44:34 2016
New Revision: 299955
URL: https://svnweb.freebsd.org/changeset/base/299955

Log:
  No need to check login status for ZOMBIE ports.
  
  ZOMBIE ports are always logged out, and so initiator may try to relogin.
  
  MFC after:1 weeks

Modified:
  head/sys/dev/isp/isp.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Mon May 16 16:29:56 2016(r299954)
+++ head/sys/dev/isp/isp.c  Mon May 16 16:44:34 2016(r299955)
@@ -3808,6 +3808,9 @@ fail:
goto fail;
}
 
+   if (lp->state == FC_PORTDB_STATE_ZOMBIE)
+   goto relogin;
+
/*
 * See if we're still logged into it.
 *
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Ngie Cooper (yaneurabeya)

> On May 16, 2016, at 02:56, Hans Petter Selasky  wrote:
> 
> Author: hselasky
> Date: Mon May 16 09:56:48 2016
> New Revision: 299933
> URL: https://svnweb.freebsd.org/changeset/base/299933
> 
> Log:
>  Implement more Linux device related functions in the LinuxKPI. While
>  at it use NULL for some pointer checks.
> 
>  Bump the FreeBSD version to force recompilation of all kernel modules
>  due to a structure size change.
> 
>  Obtained from:   kmacy @
>  MFC after:   1 week
>  Sponsored by:Mellanox Technologies
> 
> Modified:
>  head/sys/compat/linuxkpi/common/include/linux/device.h
>  head/sys/sys/param.h
> 
> Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/device.hMon May 16 
> 09:31:44 2016(r299932)
> +++ head/sys/compat/linuxkpi/common/include/linux/device.hMon May 16 
> 09:56:48 2016(r299933)
> @@ -31,6 +31,7 @@
> #ifndef   _LINUX_DEVICE_H_
> #define   _LINUX_DEVICE_H_
> 
> +#include 
> #include 
> #include 
> #include 
> @@ -71,6 +72,7 @@ struct device {
>   unsigned intirq;
>   unsigned intmsix;
>   unsigned intmsix_max;
> + const struct attribute_group **groups;
> };
> 
> extern struct device linux_root_device;
> @@ -127,11 +129,12 @@ show_class_attr_string(struct class *cla
> #define   dev_err(dev, fmt, ...)  device_printf((dev)->bsddev, fmt, 
> ##__VA_ARGS__)
> #define   dev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
> ##__VA_ARGS__)
> #define   dev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
> ##__VA_ARGS__)
> +#define  dev_notice(dev, fmt, ...)   device_printf((dev)->bsddev, 
> fmt, ##__VA_ARGS__)
> #define   dev_printk(lvl, dev, fmt, ...)  
> \
>   device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
> 
> static inline void *
> -dev_get_drvdata(struct device *dev)
> +dev_get_drvdata(const struct device *dev)
> {
> 
>   return dev->driver_data;
> @@ -191,11 +194,106 @@ class_unregister(struct class *class)
>   kobject_put(>kobj);
> }
> 
> +static inline struct device *kobj_to_dev(struct kobject *kobj)
> +{
> + return container_of(kobj, struct device, kobj);
> +}
> +
> /*
> - * Devices are registered and created for exporting to sysfs.  create
> + * Devices are registered and created for exporting to sysfs. Create
>  * implies register and register assumes the device fields have been
>  * setup appropriately before being called.
>  */
> +static inline void
> +device_initialize(struct device *dev)
> +{
> + device_t bsddev;
> +
> + bsddev = NULL;
> + if (dev->devt) {
> + int unit = MINOR(dev->devt);
> + bsddev = devclass_get_device(dev->class->bsdclass, unit);
> + }
> + if (bsddev != NULL)
> + device_set_softc(bsddev, dev);
> +
> + dev->bsddev = bsddev;
> + kobject_init(>kobj, _dev_ktype);
> +}
> +
> +static inline int
> +device_add(struct device *dev)
> +{
> + if (dev->bsddev != NULL) {
> + if (dev->devt == 0)
> + dev->devt = makedev(0, device_get_unit(dev->bsddev));
> + }
> + kobject_add(>kobj, >class->kobj, dev_name(dev));
> + return (0);
> +}
> +
> +static inline void
> +device_create_release(struct device *dev)
> +{
> + kfree(dev);
> +}
> +
> +static inline struct device *
> +device_create_groups_vargs(struct class *class, struct device *parent,
> +dev_t devt, void *drvdata, const struct attribute_group **groups,
> +const char *fmt, va_list args)
> +{
> + struct device *dev = NULL;
> + int retval = -ENODEV;
> +
> + if (class == NULL || IS_ERR(class))
> + goto error;
> +
> + dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> + if (!dev) {
> + retval = -ENOMEM;
> + goto error;
> + }
> +
> + device_initialize(dev);
> + dev->devt = devt;
> + dev->class = class;
> + dev->parent = parent;
> + dev->groups = groups;
> + dev->release = device_create_release;
> + dev->bsddev = devclass_get_device(dev->class->bsdclass, MINOR(devt));
> + dev_set_drvdata(dev, drvdata);
> +
> + retval = kobject_set_name_vargs(>kobj, fmt, args);
> + if (retval)
> + goto error;
> +
> + retval = device_add(dev);
> + if (retval)
> + goto error;
> +
> + return dev;
> +
> +error:
> + put_device(dev);
> + return ERR_PTR(retval);
> +}
> +
> +static inline struct device *
> +device_create_with_groups(struct class *class,
> +struct device *parent, dev_t devt, void *drvdata,
> +const struct attribute_group **groups, const char *fmt, ...)
> +{
> + va_list vargs;
> + struct device *dev;
> +
> + va_start(vargs, fmt);
> + dev = device_create_groups_vargs(class, parent, devt, drvdata,
> + groups, fmt, vargs);
> 

Re: svn commit: r299953 - head/usr.sbin/makefs

2016-05-16 Thread Don Lewis
On 16 May, To: src-committ...@freebsd.org wrote:
> Author: truckman
> Date: Mon May 16 16:16:46 2016
> New Revision: 299953
> URL: https://svnweb.freebsd.org/changeset/base/299953
> 
> Log:
>   Fix an off by one error to avoid overflowing rp[].
>   
>   Reported by:Coverity
>   CID:1007579
> 
> Modified:
>   head/usr.sbin/makefs/mtree.c

MFC after:  1 week
___
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: r299953 - head/usr.sbin/makefs

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 16:16:46 2016
New Revision: 299953
URL: https://svnweb.freebsd.org/changeset/base/299953

Log:
  Fix an off by one error to avoid overflowing rp[].
  
  Reported by:  Coverity
  CID:  1007579

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

Modified: head/usr.sbin/makefs/mtree.c
==
--- head/usr.sbin/makefs/mtree.cMon May 16 16:01:46 2016
(r299952)
+++ head/usr.sbin/makefs/mtree.cMon May 16 16:16:46 2016
(r299953)
@@ -150,7 +150,7 @@ mtree_file_path(fsnode *node)
 
depth = 0;
rp[depth] = node->name;
-   for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH;
+   for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH - 1;
 pnode = pnode->parent) {
if (strcmp(pnode->name, ".") == 0)
break;
___
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: r299952 - head/usr.bin/ldd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 16:01:46 2016
New Revision: 299952
URL: https://svnweb.freebsd.org/changeset/base/299952

Log:
  Increase size of argv[] array to avoid running off the end.
  
  Reported by:  Coverity
  CID:  1193819
  MFC after:1 week

Modified:
  head/usr.bin/ldd/ldd.c

Modified: head/usr.bin/ldd/ldd.c
==
--- head/usr.bin/ldd/ldd.c  Mon May 16 15:48:56 2016(r299951)
+++ head/usr.bin/ldd/ldd.c  Mon May 16 16:01:46 2016(r299952)
@@ -88,7 +88,7 @@ static void   usage(void);
 static int
 execldd32(char *file, char *fmt1, char *fmt2, int aflag, int vflag)
 {
-   char *argv[8];
+   char *argv[9];
int i, rval, status;
 
LDD_UNSETENV("TRACE_LOADED_OBJECTS");
___
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: r299944 - in head/sys: arm64/arm64 conf

2016-05-16 Thread Zbigniew Bodek
Hello Andrew,

I think committing this code should be preceded by at least brief review.
Few remarks to the code found on the first glance below.

Kind regards
zbb

2016-05-16 16:07 GMT+02:00 Andrew Turner :

> Author: andrew
> Date: Mon May 16 14:07:43 2016
> New Revision: 299944
> URL: https://svnweb.freebsd.org/changeset/base/299944
>
> Log:
>   Add intrng support to the GICv3 driver. It lacks ITS support so won't
> handle
>   MSI or MSI-X interrupts, however this is enought to boot FreeBSD under
> the
>   ARM Foundation Model with a GICv3 interrupt controller.
>
>   Approved by:  ABT Systems Ltd
>   Relnotes: yes
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/arm64/arm64/gic_v3.c
>   head/sys/arm64/arm64/gic_v3_fdt.c
>   head/sys/arm64/arm64/gic_v3_var.h
>   head/sys/conf/files.arm64
>
> Modified: head/sys/arm64/arm64/gic_v3.c
>
> ==
> --- head/sys/arm64/arm64/gic_v3.c   Mon May 16 13:39:04 2016
> (r299943)
> +++ head/sys/arm64/arm64/gic_v3.c   Mon May 16 14:07:43 2016
> (r299944)
> @@ -1,7 +1,10 @@
>  /*-
> - * Copyright (c) 2015 The FreeBSD Foundation
> + * Copyright (c) 2015-2016 The FreeBSD Foundation
>   * All rights reserved.
>   *
> + * This software was developed by Andrew Turner under
> + * the sponsorship of the FreeBSD Foundation.
> + *
>   * This software was developed by Semihalf under
>   * the sponsorship of the FreeBSD Foundation.
>   *
> @@ -27,6 +30,8 @@
>   * SUCH DAMAGE.
>   */
>
> +#include "opt_platform.h"
> +
>  #include 
>  __FBSDID("$FreeBSD$");
>
> @@ -58,6 +63,28 @@ __FBSDID("$FreeBSD$");
>  #include "gic_v3_reg.h"
>  #include "gic_v3_var.h"
>
> +#ifdef INTRNG
> +static pic_disable_intr_t gic_v3_disable_intr;
> +static pic_enable_intr_t gic_v3_enable_intr;
> +static pic_map_intr_t gic_v3_map_intr;
> +static pic_setup_intr_t gic_v3_setup_intr;
> +static pic_teardown_intr_t gic_v3_teardown_intr;
> +static pic_post_filter_t gic_v3_post_filter;
> +static pic_post_ithread_t gic_v3_post_ithread;
> +static pic_pre_ithread_t gic_v3_pre_ithread;
> +static pic_bind_intr_t gic_v3_bind_intr;
> +#ifdef SMP
> +static pic_init_secondary_t gic_v3_init_secondary;
> +static pic_ipi_send_t gic_v3_ipi_send;
> +static pic_ipi_setup_t gic_v3_ipi_setup;
> +#endif
> +
> +static u_int gic_irq_cpu;
> +#ifdef SMP
> +static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
> +static u_int sgi_first_unused = GIC_FIRST_SGI;
> +#endif
> +#else
>  /* Device and PIC methods */
>  static int gic_v3_bind(device_t, u_int, u_int);
>  static void gic_v3_dispatch(device_t, struct trapframe *);
> @@ -68,11 +95,29 @@ static void gic_v3_unmask_irq(device_t,
>  static void gic_v3_init_secondary(device_t);
>  static void gic_v3_ipi_send(device_t, cpuset_t, u_int);
>  #endif
> +#endif
>
>  static device_method_t gic_v3_methods[] = {
> /* Device interface */
> DEVMETHOD(device_detach,gic_v3_detach),
>
> +#ifdef INTRNG
> +   /* Interrupt controller interface */
> +   DEVMETHOD(pic_disable_intr, gic_v3_disable_intr),
> +   DEVMETHOD(pic_enable_intr,  gic_v3_enable_intr),
> +   DEVMETHOD(pic_map_intr, gic_v3_map_intr),
> +   DEVMETHOD(pic_setup_intr,   gic_v3_setup_intr),
> +   DEVMETHOD(pic_teardown_intr,gic_v3_teardown_intr),
> +   DEVMETHOD(pic_post_filter,  gic_v3_post_filter),
> +   DEVMETHOD(pic_post_ithread, gic_v3_post_ithread),
> +   DEVMETHOD(pic_pre_ithread,  gic_v3_pre_ithread),
> +#ifdef SMP
> +   DEVMETHOD(pic_bind_intr,gic_v3_bind_intr),
> +   DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
> +   DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
> +   DEVMETHOD(pic_ipi_setup,gic_v3_ipi_setup),
> +#endif
> +#else
> /* PIC interface */
> DEVMETHOD(pic_bind, gic_v3_bind),
> DEVMETHOD(pic_dispatch, gic_v3_dispatch),
> @@ -83,6 +128,8 @@ static device_method_t gic_v3_methods[]
> DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
> DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
>  #endif
> +#endif
> +
> /* End */
> DEVMETHOD_END
>  };
> @@ -144,6 +191,10 @@ gic_v3_attach(device_t dev)
> int rid;
> int err;
> size_t i;
> +#ifdef INTRNG
> +   u_int irq;
> +   const char *name;
> +#endif
>
> sc = device_get_softc(dev);
> sc->gic_registered = FALSE;
> @@ -192,6 +243,36 @@ gic_v3_attach(device_t dev)
> if (sc->gic_nirqs > GIC_I_NUM_MAX)
> sc->gic_nirqs = GIC_I_NUM_MAX;
>
> +#ifdef INTRNG
> +   sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs,
> +   M_GIC_V3, M_WAITOK | M_ZERO);
> +   name = device_get_nameunit(dev);
> +   for (irq = 0; irq < sc->gic_nirqs; irq++) {
> +   struct intr_irqsrc *isrc;
> +
> +   sc->gic_irqs[irq].gi_irq = irq;
> +  

svn commit: r299951 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:48:56 2016
New Revision: 299951
URL: https://svnweb.freebsd.org/changeset/base/299951

Log:
  do not destroy 'snapdir' when it becomes  inactive
  
  That was just wrong.  In fact, we can safely keep this static entry when
  it's inactive.
  Now the destructive action is moved to the reclaim method and the
  function is renamed from zfsctl_snapdir_inactive(0 to
  zfsctl_snapdir_reclaim().
  
  Also, we can use gfs_vop_reclaim() instead of gfs_dir_inactive() +
  kmem_free().
  
  Lastly, we can just assert that the node does not any children when it
  is reclaimed, even on the force unmount.  That's because zfs_umount()
  does an extra vflush() pass which should destroy all snapshot-mountpoint
  vnodes that are the snapdir's children.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:42:59 2016(r299950)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:48:56 2016(r299951)
@@ -454,25 +454,6 @@ zfsctl_shares_fid(ap)
return (error);
 }
 
-static int
-zfsctl_common_reclaim(ap)
-   struct vop_reclaim_args /* {
-   struct vnode *a_vp;
-   struct thread *a_td;
-   } */ *ap;
-{
-   vnode_t *vp = ap->a_vp;
-
-   /*
-* Destroy the vm object and flush associated pages.
-*/
-   vnode_destroy_vobject(vp);
-   VI_LOCK(vp);
-   vp->v_data = NULL;
-   VI_UNLOCK(vp);
-   return (0);
-}
-
 /*
  * .zfs inode namespace
  *
@@ -1377,8 +1358,8 @@ zfsctl_snapdir_getattr(ap)
 
 /* ARGSUSED */
 static int
-zfsctl_snapdir_inactive(ap)
-   struct vop_inactive_args /* {
+zfsctl_snapdir_reclaim(ap)
+   struct vop_reclaim_args /* {
struct vnode *a_vp;
struct thread *a_td;
} */ *ap;
@@ -1387,21 +1368,10 @@ zfsctl_snapdir_inactive(ap)
zfsctl_snapdir_t *sdp = vp->v_data;
zfs_snapentry_t *sep;
 
-   /*
-* On forced unmount we have to free snapshots from here.
-*/
-   mutex_enter(>sd_lock);
-   while ((sep = avl_first(>sd_snaps)) != NULL) {
-   avl_remove(>sd_snaps, sep);
-   kmem_free(sep->se_name, strlen(sep->se_name) + 1);
-   kmem_free(sep, sizeof (zfs_snapentry_t));
-   }
-   mutex_exit(>sd_lock);
-   gfs_dir_inactive(vp);
ASSERT(avl_numnodes(>sd_snaps) == 0);
mutex_destroy(>sd_lock);
avl_destroy(>sd_snaps);
-   kmem_free(sdp, sizeof (zfsctl_snapdir_t));
+   gfs_vop_reclaim(ap);
 
return (0);
 }
@@ -1448,8 +1418,8 @@ static struct vop_vector zfsctl_ops_snap
.vop_mkdir =zfsctl_freebsd_snapdir_mkdir,
.vop_readdir =  gfs_vop_readdir,
.vop_lookup =   zfsctl_snapdir_lookup,
-   .vop_inactive = zfsctl_snapdir_inactive,
-   .vop_reclaim =  zfsctl_common_reclaim,
+   .vop_inactive = VOP_NULL,
+   .vop_reclaim =  zfsctl_snapdir_reclaim,
.vop_fid =  zfsctl_common_fid,
 };
 
___
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: r299949 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:37:41 2016
New Revision: 299949
URL: https://svnweb.freebsd.org/changeset/base/299949

Log:
  try to recycle "snap" vnodes as soon as possible
  
  Those vnodes should not linger.  "Stale" nodes may get out of
  synchronization with actual snapshots.  For example if we destroy a
  snapshot and create a new one with the same name.  Or when we rename a
  snapshot.
  
  While there fix the argument type for zfsctl_snapshot_reclaim().
  Also, its original argument can be passed to gfs_vop_reclaim() directly.
  
  Bug 209093 could be related although I have not specifically verified
  that.  Referencing just in case.
  
  PR:   209093
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:32:02 2016(r299948)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:37:41 2016(r299949)
@@ -1490,17 +1490,28 @@ zfsctl_snapshot_mknode(vnode_t *pvp, uin
return (vp);
 }
 
+static int
+zfsctl_snapshot_inactive(ap)
+   struct vop_inactive_args /* {
+   struct vnode *a_vp;
+   struct thread *a_td;
+   } */ *ap;
+{
+   vnode_t *vp = ap->a_vp;
+
+   vrecycle(vp);
+   return (0);
+}
 
 static int
 zfsctl_snapshot_reclaim(ap)
-   struct vop_inactive_args /* {
+   struct vop_reclaim_args /* {
struct vnode *a_vp;
struct thread *a_td;
} */ *ap;
 {
vnode_t *vp = ap->a_vp;
cred_t *cr = ap->a_td->td_ucred;
-   struct vop_reclaim_args iap;
zfsctl_snapdir_t *sdp;
zfs_snapentry_t *sep, *next;
int locked;
@@ -1543,8 +1554,7 @@ zfsctl_snapshot_reclaim(ap)
 * "active".  If we lookup the same name again we will end up
 * creating a new vnode.
 */
-   iap.a_vp = vp;
-   gfs_vop_reclaim();
+   gfs_vop_reclaim(ap);
return (0);
 
 }
@@ -1597,7 +1607,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc
  */
 static struct vop_vector zfsctl_ops_snapshot = {
.vop_default =  _vnodeops,
-   .vop_inactive = VOP_NULL,
+   .vop_inactive = zfsctl_snapshot_inactive,
.vop_reclaim =  zfsctl_snapshot_reclaim,
.vop_vptocnp =  zfsctl_snapshot_vptocnp,
 };
___
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: r299926 - head/lib/libpam/modules/pam_unix

2016-05-16 Thread Don Lewis
On 16 May, Ed Maste wrote:
> On 16 May 2016 at 04:34, Don Lewis  wrote:
>> Author: truckman
>> Date: Mon May 16 08:34:17 2016
>> New Revision: 299926
>> URL: https://svnweb.freebsd.org/changeset/base/299926
>>
>> Log:
>>   Hoist the getpwnam() call outside the first if/else block in
>>   pam_sm_chauthtok().  Set user = getlogin() inside the true
>>   branch so that it is initialized for the following PAM_LOG()
>>   call.  This is how it is done in pam_sm_authenticate().
> 
> Unfortunately this triggers a warning on powerpc/powerpc64:
> 
> /scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c: In
> function 'pam_sm_chauthtok':
> /scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c:278:
> warning: 'retval' may be used uninitialized in this function
> 
> I don't see why GCC warns now and did not before, though.

Strange ...

It turns out that Coverity did notice this, CID 1018711.  It should be
fixed by r299948.

___
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: r299948 - head/lib/libpam/modules/pam_unix

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 15:32:02 2016
New Revision: 299948
URL: https://svnweb.freebsd.org/changeset/base/299948

Log:
  Set retval in the empty password case to avoid a path through the
  code that fails to set retval before falling through to the final
  return().
  
  Reported by:  emaste
  Reported by:  Coverity
  CID:  1018711
  MFC after:1 week

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.c

Modified: head/lib/libpam/modules/pam_unix/pam_unix.c
==
--- head/lib/libpam/modules/pam_unix/pam_unix.c Mon May 16 15:28:39 2016
(r299947)
+++ head/lib/libpam/modules/pam_unix/pam_unix.c Mon May 16 15:32:02 2016
(r299948)
@@ -332,6 +332,7 @@ pam_sm_chauthtok(pam_handle_t *pamh, int
 * XXX check PAM_DISALLOW_NULL_AUTHTOK
 */
old_pass = "";
+   retval = PAM_SUCCESS;
} else {
retval = pam_get_authtok(pamh,
PAM_OLDAUTHTOK, _pass, 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: r299947 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:28:39 2016
New Revision: 299947
URL: https://svnweb.freebsd.org/changeset/base/299947

Log:
  fix locking in zfsctl_root_lookup
  
  Dropping the root vnode's lock after VFS_ROOT() didn't really help the
  fact that we acquired the lock while holding its child's, .zfs, lock
  while performing the operaiton.
  So, directly use zfs_zget() to get the root vnode.
  
  While there simplify the code in zfsctl_freebsd_root_lookup.
  We know that .zfs is always exclusively locked.
  We know that there is already a reference on *vpp, so no need for an
  extra one.
  Account for the fact that .. lookup may ask for a different lock type,
  not necessarily LK_EXCLUSIVE.  And handle a possible failure to acquire
  the lock given the lock flags.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:13:16 2016(r299946)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:28:39 2016(r299947)
@@ -537,9 +537,20 @@ zfsctl_root_lookup(vnode_t *dvp, char *n
ZFS_ENTER(zfsvfs);
 
if (strcmp(nm, "..") == 0) {
+#ifdef illumos
err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp);
+#else
+   /*
+* NB: can not use VFS_ROOT here as it would acquire
+* the vnode lock of the parent (root) vnode while
+* holding the child's (.zfs) lock.
+*/
+   znode_t *rootzp;
+
+   err = zfs_zget(zfsvfs, zfsvfs->z_root, );
if (err == 0)
-   VOP_UNLOCK(*vpp, 0);
+   *vpp = ZTOV(rootzp);
+#endif
} else {
err = gfs_vop_lookup(dvp, nm, vpp, pnp, flags, rdir,
cr, ct, direntflags, realpnp);
@@ -601,10 +612,10 @@ zfsctl_freebsd_root_lookup(ap)
vnode_t **vpp = ap->a_vpp;
cred_t *cr = ap->a_cnp->cn_cred;
int flags = ap->a_cnp->cn_flags;
+   int lkflags = ap->a_cnp->cn_lkflags;
int nameiop = ap->a_cnp->cn_nameiop;
char nm[NAME_MAX + 1];
int err;
-   int ltype;
 
if ((flags & ISLASTCN) && (nameiop == RENAME || nameiop == CREATE))
return (EOPNOTSUPP);
@@ -613,16 +624,15 @@ zfsctl_freebsd_root_lookup(ap)
strlcpy(nm, ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen + 1);
err = zfsctl_root_lookup(dvp, nm, vpp, NULL, 0, NULL, cr, NULL, NULL, 
NULL);
if (err == 0 && (nm[0] != '.' || nm[1] != '\0')) {
-   ltype = VOP_ISLOCKED(dvp);
-   if (flags & ISDOTDOT) {
-   VN_HOLD(*vpp);
+   if (flags & ISDOTDOT)
VOP_UNLOCK(dvp, 0);
+   err = vn_lock(*vpp, lkflags);
+   if (err != 0) {
+   vrele(*vpp);
+   *vpp = NULL;
}
-   vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-   if (flags & ISDOTDOT) {
-   VN_RELE(*vpp);
-   vn_lock(dvp, ltype| LK_RETRY);
-   }
+   if (flags & ISDOTDOT)
+   vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
}
 
return (err);
___
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: r299946 - in head/sys/cddl/contrib/opensolaris/uts/common/fs: . zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:13:16 2016
New Revision: 299946
URL: https://svnweb.freebsd.org/changeset/base/299946

Log:
  gfs_lookup_dot() does not have to acquire any locks
  
  In fact, that was dangerous.  For example, zfsctl_snapshot_reclaim()
  calls gfs_dir_lookup() on ".." path and that ends up calling
  gfs_lookup_dot() which violated locking order by acquiring the parent's
  directory vnode lock after the child's vnode lock.
  
  Also, the previous behavior was inconsistent as gfs_dir_lookup()
  returned a locked vnode for . and .. lookups, but not for any other.
  
  Now gfs_lookup_dot() just references a resulting vnode and the locking
  is done in its consumers, where necessary.
  Note that we do not enable shared locking support for any gfs / zfsctl
  vnodes.
  
  This commit partially reverts r273641.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Mon May 16 
15:03:52 2016(r299945)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Mon May 16 
15:13:16 2016(r299946)
@@ -442,19 +442,9 @@ gfs_lookup_dot(vnode_t **vpp, vnode_t *d
*vpp = dvp;
return (0);
} else if (strcmp(nm, "..") == 0) {
-   if (pvp == NULL) {
-   ASSERT(dvp->v_flag & VROOT);
-   VN_HOLD(dvp);
-   *vpp = dvp;
-   ASSERT_VOP_ELOCKED(dvp, "gfs_lookup_dot: non-locked 
dvp");
-   } else {
-   ltype = VOP_ISLOCKED(dvp);
-   VOP_UNLOCK(dvp, 0);
-   VN_HOLD(pvp);
-   *vpp = pvp;
-   vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-   vn_lock(dvp, ltype | LK_RETRY);
-   }
+   ASSERT(pvp != NULL);
+   VN_HOLD(pvp);
+   *vpp = pvp;
return (0);
}
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:03:52 2016(r299945)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:13:16 2016(r299946)
@@ -987,6 +987,11 @@ zfsctl_snapdir_lookup(ap)
 
ZFS_ENTER(zfsvfs);
if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {
+   if (nm[0] == '.' && nm[1] == '.' && nm[2] =='\0') {
+   VOP_UNLOCK(dvp, 0);
+   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
+   VERIFY0(vn_lock(dvp, LK_EXCLUSIVE));
+   }
ZFS_EXIT(zfsvfs);
return (0);
}
@@ -1151,6 +1156,11 @@ zfsctl_shares_lookup(ap)
strlcpy(nm, cnp->cn_nameptr, cnp->cn_namelen + 1);
 
if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {
+   if (nm[0] == '.' && nm[1] == '.' && nm[2] =='\0') {
+   VOP_UNLOCK(dvp, 0);
+   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
+   VERIFY0(vn_lock(dvp, LK_EXCLUSIVE));
+   }
ZFS_EXIT(zfsvfs);
return (0);
}
@@ -1488,7 +1498,6 @@ zfsctl_snapshot_reclaim(ap)
 
VERIFY(gfs_dir_lookup(vp, "..", , cr, 0, NULL, NULL) == 0);
sdp = dvp->v_data;
-   VOP_UNLOCK(dvp, 0);
/* this may already have been unmounted */
if (sdp == NULL) {
VN_RELE(dvp);
___
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: r299945 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:03:52 2016
New Revision: 299945
URL: https://svnweb.freebsd.org/changeset/base/299945

Log:
  avoid deadlock between zfsctl_snapdir_lookup and zfsctl_snapshot_reclaim
  
  The former acquired a snap vnode lock while holding sd_lock while the
  latter does the opposite.
  
  The solution is drop sd_lock before acquiring the vnode lock.  That
  should be okay as we are still holding a lock on the 'snapshot'
  directory in the exclusive mode.  That lock ensures that there are no
  concurrent lookups in the directory and thus no concurrent mount attempts.
  
  But now we have to account for the possibility that the snap vnode
  might get reclaim after we drop sd_lock and before we can get
  the node lock.  So, check for that case and retry.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 14:07:43 2016(r299944)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:03:52 2016(r299945)
@@ -1011,6 +1011,7 @@ zfsctl_snapdir_lookup(ap)
 #endif
}
 
+relookup:
mutex_enter(>sd_lock);
search.se_name = (char *)nm;
if ((sep = avl_find(>sd_snaps, , )) != NULL) {
@@ -1085,7 +1086,16 @@ domount:
(void) snprintf(mountpoint, mountpoint_len,
"%s/" ZFS_CTLDIR_NAME "/snapshot/%s",
dvp->v_vfsp->mnt_stat.f_mntonname, nm);
-   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
+   mutex_exit(>sd_lock);
+
+   /*
+* The vnode may get reclaimed between dropping sd_lock and
+* getting the vnode lock.
+* */
+   err = vn_lock(*vpp, LK_EXCLUSIVE);
+   if (err == ENOENT)
+   goto relookup;
+   VERIFY0(err);
err = mount_snapshot(curthread, vpp, "zfs", mountpoint, snapname, 0);
kmem_free(mountpoint, mountpoint_len);
if (err == 0) {
@@ -1100,7 +1110,6 @@ domount:
VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs;
(*vpp)->v_flag &= ~VROOT;
}
-   mutex_exit(>sd_lock);
ZFS_EXIT(zfsvfs);
 
 #ifdef illumos
___
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: r299944 - in head/sys: arm64/arm64 conf

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 14:07:43 2016
New Revision: 299944
URL: https://svnweb.freebsd.org/changeset/base/299944

Log:
  Add intrng support to the GICv3 driver. It lacks ITS support so won't handle
  MSI or MSI-X interrupts, however this is enought to boot FreeBSD under the
  ARM Foundation Model with a GICv3 interrupt controller.
  
  Approved by:  ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_fdt.c
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/conf/files.arm64

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Mon May 16 13:39:04 2016
(r299943)
+++ head/sys/arm64/arm64/gic_v3.c   Mon May 16 14:07:43 2016
(r299944)
@@ -1,7 +1,10 @@
 /*-
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
+ * This software was developed by Andrew Turner under
+ * the sponsorship of the FreeBSD Foundation.
+ *
  * This software was developed by Semihalf under
  * the sponsorship of the FreeBSD Foundation.
  *
@@ -27,6 +30,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -58,6 +63,28 @@ __FBSDID("$FreeBSD$");
 #include "gic_v3_reg.h"
 #include "gic_v3_var.h"
 
+#ifdef INTRNG
+static pic_disable_intr_t gic_v3_disable_intr;
+static pic_enable_intr_t gic_v3_enable_intr;
+static pic_map_intr_t gic_v3_map_intr;
+static pic_setup_intr_t gic_v3_setup_intr;
+static pic_teardown_intr_t gic_v3_teardown_intr;
+static pic_post_filter_t gic_v3_post_filter;
+static pic_post_ithread_t gic_v3_post_ithread;
+static pic_pre_ithread_t gic_v3_pre_ithread;
+static pic_bind_intr_t gic_v3_bind_intr;
+#ifdef SMP
+static pic_init_secondary_t gic_v3_init_secondary;
+static pic_ipi_send_t gic_v3_ipi_send;
+static pic_ipi_setup_t gic_v3_ipi_setup;
+#endif
+
+static u_int gic_irq_cpu;
+#ifdef SMP
+static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
+static u_int sgi_first_unused = GIC_FIRST_SGI;
+#endif
+#else
 /* Device and PIC methods */
 static int gic_v3_bind(device_t, u_int, u_int);
 static void gic_v3_dispatch(device_t, struct trapframe *);
@@ -68,11 +95,29 @@ static void gic_v3_unmask_irq(device_t, 
 static void gic_v3_init_secondary(device_t);
 static void gic_v3_ipi_send(device_t, cpuset_t, u_int);
 #endif
+#endif
 
 static device_method_t gic_v3_methods[] = {
/* Device interface */
DEVMETHOD(device_detach,gic_v3_detach),
 
+#ifdef INTRNG
+   /* Interrupt controller interface */
+   DEVMETHOD(pic_disable_intr, gic_v3_disable_intr),
+   DEVMETHOD(pic_enable_intr,  gic_v3_enable_intr),
+   DEVMETHOD(pic_map_intr, gic_v3_map_intr),
+   DEVMETHOD(pic_setup_intr,   gic_v3_setup_intr),
+   DEVMETHOD(pic_teardown_intr,gic_v3_teardown_intr),
+   DEVMETHOD(pic_post_filter,  gic_v3_post_filter),
+   DEVMETHOD(pic_post_ithread, gic_v3_post_ithread),
+   DEVMETHOD(pic_pre_ithread,  gic_v3_pre_ithread),
+#ifdef SMP
+   DEVMETHOD(pic_bind_intr,gic_v3_bind_intr),
+   DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
+   DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
+   DEVMETHOD(pic_ipi_setup,gic_v3_ipi_setup),
+#endif
+#else
/* PIC interface */
DEVMETHOD(pic_bind, gic_v3_bind),
DEVMETHOD(pic_dispatch, gic_v3_dispatch),
@@ -83,6 +128,8 @@ static device_method_t gic_v3_methods[] 
DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
 #endif
+#endif
+
/* End */
DEVMETHOD_END
 };
@@ -144,6 +191,10 @@ gic_v3_attach(device_t dev)
int rid;
int err;
size_t i;
+#ifdef INTRNG
+   u_int irq;
+   const char *name;
+#endif
 
sc = device_get_softc(dev);
sc->gic_registered = FALSE;
@@ -192,6 +243,36 @@ gic_v3_attach(device_t dev)
if (sc->gic_nirqs > GIC_I_NUM_MAX)
sc->gic_nirqs = GIC_I_NUM_MAX;
 
+#ifdef INTRNG
+   sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs,
+   M_GIC_V3, M_WAITOK | M_ZERO);
+   name = device_get_nameunit(dev);
+   for (irq = 0; irq < sc->gic_nirqs; irq++) {
+   struct intr_irqsrc *isrc;
+
+   sc->gic_irqs[irq].gi_irq = irq;
+   sc->gic_irqs[irq].gi_pol = INTR_POLARITY_CONFORM;
+   sc->gic_irqs[irq].gi_trig = INTR_TRIGGER_CONFORM;
+
+   isrc = >gic_irqs[irq].gi_isrc;
+   if (irq <= GIC_LAST_SGI) {
+   err = intr_isrc_register(isrc, sc->dev,
+   INTR_ISRCF_IPI, "%s,i%u", name, irq - 
GIC_FIRST_SGI);
+   } else if (irq <= GIC_LAST_PPI) {
+   err = intr_isrc_register(isrc, sc->dev,

Re: svn commit: r299926 - head/lib/libpam/modules/pam_unix

2016-05-16 Thread Ed Maste
On 16 May 2016 at 04:34, Don Lewis  wrote:
> Author: truckman
> Date: Mon May 16 08:34:17 2016
> New Revision: 299926
> URL: https://svnweb.freebsd.org/changeset/base/299926
>
> Log:
>   Hoist the getpwnam() call outside the first if/else block in
>   pam_sm_chauthtok().  Set user = getlogin() inside the true
>   branch so that it is initialized for the following PAM_LOG()
>   call.  This is how it is done in pam_sm_authenticate().

Unfortunately this triggers a warning on powerpc/powerpc64:

/scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c: In
function 'pam_sm_chauthtok':
/scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c:278:
warning: 'retval' may be used uninitialized in this function

I don't see why GCC warns now and did not before, though.
___
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: r299943 - head/lib/libthr

2016-05-16 Thread Jilles Tjoelker
Author: jilles
Date: Mon May 16 13:39:04 2016
New Revision: 299943
URL: https://svnweb.freebsd.org/changeset/base/299943

Log:
  libthr(3): Fix xref to _umtx_op(2) now that we have it.

Modified:
  head/lib/libthr/libthr.3

Modified: head/lib/libthr/libthr.3
==
--- head/lib/libthr/libthr.3Mon May 16 12:56:28 2016(r299942)
+++ head/lib/libthr/libthr.3Mon May 16 13:39:04 2016(r299943)
@@ -118,7 +118,7 @@ environment variable.
 If both the spin and yield loops
 failed to acquire the lock, the thread is taken off the CPU and
 put to sleep in the kernel with the
-.Xr umtx 2
+.Xr _umtx_op 2
 syscall.
 The kernel wakes up a thread and hands the ownership of the lock to
 the woken thread when the lock becomes available.
@@ -236,7 +236,7 @@ logs.
 .Xr ld-elf.so.1 1 ,
 .Xr getrlimit 2 ,
 .Xr errno 2 ,
-.Xr umtx 2 ,
+.Xr _umtx_op 2 ,
 .Xr dlclose 3 ,
 .Xr dlopen 3 ,
 .Xr getenv 3 ,
___
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: r298230 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/mips/beri/loader s

2016-05-16 Thread Konstantin Belousov
On Tue, Apr 19, 2016 at 09:26:41AM -0700, John Baldwin wrote:
> On Tuesday, April 19, 2016 07:05:00 PM Konstantin Belousov wrote:
> > On Tue, Apr 19, 2016 at 11:49:31AM -0400, Allan Jude wrote:
> > > On 2016-04-19 05:30, Konstantin Belousov wrote:
> > > > On Mon, Apr 18, 2016 at 07:43:04PM -0400, Allan Jude wrote:
> > > >> On 2016-04-18 19:36, Adrian Chadd wrote:
> > > >>> Someone pointed out how this bloats out memory requirement in loader.
> > > >>>
> > > >>> Did anyone check that?
> > > >>>
> > > >>> -adrian
> > > >>>
> > > >>
> > > >> I tested down to 128mb of ram in QEMU, booted from the installer ISO, 
> > > >> did the install, and booted the installed system without issue.
> > > > 
> > > > 64MB is^H^H was very much useful and workable i386 config. i386 kernel
> > > > does fit into the 32M but current automatic tuning prevents usermode
> > > > from operating. Little manual tuning make 32M on tolerable.
> > > > 
> > > > Making loader require 64M is a regression. At very least, it is
> > > > impossible to test low mem configs anymore.
> > > > 
> > > 
> > > Would a src.conf knob make sense, to use a smaller value when targeting
> > > small systems, while keeping the advantages when using more reasonable
> > > systems?
> > > 
> > > Or we could make these changes to the HEAP and bcache size specific to
> > > 64bit platforms?
> > I do not consider neither the current state, nor the two proposed
> > changes, acceptable. Loader is same on 32 and 64 bit x86 machines, so
> > how would you reconfigure it on 64bit machine ? Non-default knob is too
> > obscure and hard to communicate, people would try to use 32M and see
> > that it breaks, just abandoning the idea of trying.
> > 
> > Either default-built loader should size itself dynamically based on the
> > available memory, perhaps capping heap at 64MB starting from the 128MB
> > configs, or, assuming that we consider 32MB be the absolute minimal
> > workable config, loader could set HEAP to 8MB.
> > 
> > Dynamic heap size is theoretically best, but it might be hard to do
> > if memory map is retrieved after heap is configured (I do not know).
> 
> We retreive the memory map first and parse the SMAP to pick the best
> "spot" for the heap.  (We prefer to put it "away" from the location
> where we load the kernel + modules.)  Choosing a dynamic size for the
> heap should be quite doable.  Fixing libstand's malloc() to try to
> "grow" when necessary would be nice for the EFI case as well, but that
> is a larger change.

It was a month since this commit was made.  Is there any progress with
fixing the regression on small machines ?

BTW, as a data point, I happen to have to run stripped-down i386 current
kernel on 32MB machine, and saw around 11MB left to usermode after the
init and /bin/sh were started for singlemode.   Kernel was stripped, but
not too much stripped (unused drivers removed).
___
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: r299942 - in head/usr.bin/xinstall: . tests

2016-05-16 Thread Baptiste Daroussin
On Mon, May 16, 2016 at 12:56:28PM +, Jilles Tjoelker wrote:
> Author: jilles
> Date: Mon May 16 12:56:28 2016
> New Revision: 299942
> URL: https://svnweb.freebsd.org/changeset/base/299942
> 
> Log:
>   install: Revert utimensat usage (r299850).
>   
>   This should fix the build on older stable/10, since install is a bootstrap
>   tool.
>   
>   Pending a decision how to fix this properly, revert utimensat usage. Copies
>   with the -p option will again appear older than the original almost always,
>   but -p is not commonly used.

You could add a utimensat stub into libstand to workaround the issue?

Best regards,
Bapt


signature.asc
Description: PGP signature


svn commit: r299942 - in head/usr.bin/xinstall: . tests

2016-05-16 Thread Jilles Tjoelker
Author: jilles
Date: Mon May 16 12:56:28 2016
New Revision: 299942
URL: https://svnweb.freebsd.org/changeset/base/299942

Log:
  install: Revert utimensat usage (r299850).
  
  This should fix the build on older stable/10, since install is a bootstrap
  tool.
  
  Pending a decision how to fix this properly, revert utimensat usage. Copies
  with the -p option will again appear older than the original almost always,
  but -p is not commonly used.

Modified:
  head/usr.bin/xinstall/tests/install_test.sh
  head/usr.bin/xinstall/xinstall.c

Modified: head/usr.bin/xinstall/tests/install_test.sh
==
--- head/usr.bin/xinstall/tests/install_test.sh Mon May 16 12:18:30 2016
(r299941)
+++ head/usr.bin/xinstall/tests/install_test.sh Mon May 16 12:56:28 2016
(r299942)
@@ -64,12 +64,6 @@ copy_to_nonexistent_backup_safe_body() {
copy_to_nonexistent_with_opts -b -B.bak -S
 }
 
-atf_test_case copy_to_nonexistent_preserving
-copy_to_nonexistent_preserving_body() {
-   copy_to_nonexistent_with_opts -p
-   [ ! testf -ot copyf ] || atf_fail "bad timestamp 2"
-}
-
 copy_self_with_opts() {
printf 'test\n123\r456\r\n789\0z' >testf
printf 'test\n123\r456\r\n789\0z' >testf2
@@ -313,7 +307,6 @@ atf_init_test_cases() {
atf_add_test_case copy_to_nonexistent_safe_comparing
atf_add_test_case copy_to_nonexistent_backup
atf_add_test_case copy_to_nonexistent_backup_safe
-   atf_add_test_case copy_to_nonexistent_preserving
atf_add_test_case copy_self
atf_add_test_case copy_self_safe
atf_add_test_case copy_self_comparing

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cMon May 16 12:18:30 2016
(r299941)
+++ head/usr.bin/xinstall/xinstall.cMon May 16 12:56:28 2016
(r299942)
@@ -131,7 +131,7 @@ static void do_symlink(const char *, con
 static voidmakelink(const char *, const char *, const struct stat *);
 static voidinstall(const char *, const char *, u_long, u_int);
 static voidinstall_dir(char *);
-static voidmetadata_log(const char *, const char *, struct timespec *,
+static voidmetadata_log(const char *, const char *, struct timeval *,
const char *, const char *, off_t);
 static int parseid(const char *, id_t *);
 static voidstrip(const char *);
@@ -722,7 +722,7 @@ static void
 install(const char *from_name, const char *to_name, u_long fset, u_int flags)
 {
struct stat from_sb, temp_sb, to_sb;
-   struct timespec tsb[2];
+   struct timeval tvb[2];
int devnull, files_match, from_fd, serrno, target;
int tempcopy, temp_fd, to_fd;
char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
@@ -857,9 +857,11 @@ install(const char *from_name, const cha
 * Need to preserve target file times, though.
 */
if (to_sb.st_nlink != 1) {
-   tsb[0] = to_sb.st_atim;
-   tsb[1] = to_sb.st_mtim;
-   (void)utimensat(AT_FDCWD, tempfile, tsb, 0);
+   tvb[0].tv_sec = to_sb.st_atime;
+   tvb[0].tv_usec = 0;
+   tvb[1].tv_sec = to_sb.st_mtime;
+   tvb[1].tv_usec = 0;
+   (void)utimes(tempfile, tvb);
} else {
files_match = 1;
(void)unlink(tempfile);
@@ -914,9 +916,11 @@ install(const char *from_name, const cha
 * Preserve the timestamp of the source file if necessary.
 */
if (dopreserve && !files_match && !devnull) {
-   tsb[0] = from_sb.st_atim;
-   tsb[1] = from_sb.st_mtim;
-   (void)utimensat(AT_FDCWD, to_name, tsb, 0);
+   tvb[0].tv_sec = from_sb.st_atime;
+   tvb[0].tv_usec = 0;
+   tvb[1].tv_sec = from_sb.st_mtime;
+   tvb[1].tv_usec = 0;
+   (void)utimes(to_name, tvb);
}
 
if (fstat(to_fd, _sb) == -1) {
@@ -985,7 +989,7 @@ install(const char *from_name, const cha
if (!devnull)
(void)close(from_fd);
 
-   metadata_log(to_name, "file", tsb, NULL, digestresult, to_sb.st_size);
+   metadata_log(to_name, "file", tvb, NULL, digestresult, to_sb.st_size);
free(digestresult);
 }
 
@@ -1297,7 +1301,7 @@ again:
  * or to allow integrity checks to be performed.
  */
 static void
-metadata_log(const char *path, const char *type, struct timespec *ts,
+metadata_log(const char *path, const char *type, struct timeval *tv,
const char *slink, const char *digestresult, off_t size)
 {
static const char 

svn commit: r299941 - head/sys/dev/pci

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 12:18:30 2016
New Revision: 299941
URL: https://svnweb.freebsd.org/changeset/base/299941

Log:
  Call ofw_bus_msimap to find the parent MSI controller, it may not use the
  msi-parent property.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/pci/pci_host_generic.c
  head/sys/dev/pci/pci_host_generic.h

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Mon May 16 12:15:19 2016
(r299940)
+++ head/sys/dev/pci/pci_host_generic.c Mon May 16 12:18:30 2016
(r299941)
@@ -235,10 +235,6 @@ pci_host_generic_attach(device_t dev)
node = ofw_bus_get_node(dev);
ofw_bus_setup_iinfo(node, >pci_iinfo, sizeof(cell_t));
 
-   /* Find the MSI interrupt handler */
-   OF_searchencprop(node, "msi-parent", >msi_parent,
-   sizeof(sc->msi_parent));
-
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
 }
@@ -671,10 +667,11 @@ generic_pcie_alloc_msi(device_t pci, dev
 int *irqs)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_alloc_msi(pci, child, sc->msi_parent, count, maxcount,
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
irqs));
 #elif defined(__aarch64__)
return (arm_alloc_msi(pci, child, count, maxcount, irqs));
@@ -687,10 +684,11 @@ static int
 generic_pcie_release_msi(device_t pci, device_t child, int count, int *irqs)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_release_msi(pci, child, sc->msi_parent, count, irqs));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msi(pci, child, msi_parent, count, irqs));
 #elif defined(__aarch64__)
return (arm_release_msi(pci, child, count, irqs));
 #else
@@ -703,10 +701,11 @@ generic_pcie_map_msi(device_t pci, devic
 uint32_t *data)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_map_msi(pci, child, sc->msi_parent, irq, addr, data));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
 #elif defined(__aarch64__)
return (arm_map_msi(pci, child, irq, addr, data));
 #else
@@ -718,10 +717,11 @@ static int
 generic_pcie_alloc_msix(device_t pci, device_t child, int *irq)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_alloc_msix(pci, child, sc->msi_parent, irq));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
return (arm_alloc_msix(pci, child, irq));
 #else
@@ -733,10 +733,11 @@ static int
 generic_pcie_release_msix(device_t pci, device_t child, int irq)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_release_msix(pci, child, sc->msi_parent, irq));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
return (arm_release_msix(pci, child, irq));
 #else

Modified: head/sys/dev/pci/pci_host_generic.h
==
--- head/sys/dev/pci/pci_host_generic.h Mon May 16 12:15:19 2016
(r299940)
+++ head/sys/dev/pci/pci_host_generic.h Mon May 16 12:18:30 2016
(r299941)
@@ -60,7 +60,6 @@ struct generic_pcie_softc {
bus_space_handle_t  ioh;
 #ifdef FDT
struct ofw_bus_iinfopci_iinfo;
-   phandle_t   msi_parent;
 #endif
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 12:15:19 2016
New Revision: 299940
URL: https://svnweb.freebsd.org/changeset/base/299940

Log:
  fix a vnode reference leak caused by illumos compat traverse()
  
  This commit partially reverts r273641 which introduced the leak.
  It did so to accomodate for some consumers of traverse() that expected
  the starting vnode to stay as-is.  But that introduced the leak in the
  case when a mounted filesystem was found and its root vnode was
  returned.
  
  r299914 removed the troublesome consumers and now there is no reason to
  keep the starting vnode.  So, now the new rules are:
  - if there is no mounted filesystem, then nothing is changed
  - otherwise the starting vnode is always released
  - the root vnode of the mounted filesystem is returned locked and
referenced in the case of success
  
  MFC after:5 weeks
  X-MFC after:  r299914

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c  Mon May 16 
12:02:06 2016(r299939)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c  Mon May 16 
12:15:19 2016(r299940)
@@ -89,13 +89,14 @@ traverse(vnode_t **cvpp, int lktype)
if (vfsp == NULL)
break;
error = vfs_busy(vfsp, 0);
+
/*
 * tvp is NULL for *cvpp vnode, which we can't unlock.
-* At least some callers expect the reference to be
-* maintained to the original *cvpp
 */
if (tvp != NULL)
vput(cvp);
+   else
+   vrele(cvp);
if (error)
return (error);
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 12:02:06 2016(r299939)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 12:15:19 2016(r299940)
@@ -1018,7 +1018,6 @@ zfsctl_snapdir_lookup(ap)
VN_HOLD(*vpp);
err = traverse(vpp, LK_EXCLUSIVE | LK_RETRY);
if (err != 0) {
-   VN_RELE(*vpp);
*vpp = NULL;
} else if (*vpp == sep->se_root) {
/*
@@ -1613,16 +1612,15 @@ zfsctl_lookup_objset(vfs_t *vfsp, uint64
 */
error = traverse(, LK_SHARED | LK_RETRY);
if (error == 0) {
-   if (vp == sep->se_root)
+   if (vp == sep->se_root) {
+   VN_RELE(vp);/* release covered vp */
error = SET_ERROR(EINVAL);
-   else
+   } else {
*zfsvfsp = VTOZ(vp)->z_zfsvfs;
+   VN_URELE(vp);   /* put snapshot's root vp */
+   }
}
mutex_exit(>sd_lock);
-   if (error == 0)
-   VN_URELE(vp);
-   else
-   VN_RELE(vp);
} else {
error = SET_ERROR(EINVAL);
mutex_exit(>sd_lock);
___
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: r299939 - head/sys/arm64/arm64

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 12:02:06 2016
New Revision: 299939
URL: https://svnweb.freebsd.org/changeset/base/299939

Log:
  Move the call to intr_pic_init_secondary to the same place as in the
  non-intrng case.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon May 16 11:48:43 2016
(r299938)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon May 16 12:02:06 2016
(r299939)
@@ -275,7 +275,9 @@ init_secondary(uint64_t cpu)
 */
identify_cpu();
 
-#ifndef INTRNG
+#ifdef INTRNG
+   intr_pic_init_secondary();
+#else
/* Configure the interrupt controller */
arm_init_secondary();
 
@@ -306,10 +308,6 @@ init_secondary(uint64_t cpu)
 
mtx_unlock_spin(_boot_mtx);
 
-#ifdef INTRNG
-   intr_pic_init_secondary();
-#endif
-
/* Enter the scheduler */
sched_throw(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: r299938 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 11:48:43 2016
New Revision: 299938
URL: https://svnweb.freebsd.org/changeset/base/299938

Log:
  fix up r299902: mount_snapshot requires that the covered vnode is locked
  
  Previously that was not strictly enforced.
  
  MFC after:4 weeks
  X-MFC with:   r299902

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 10:51:35 2016(r299937)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 11:48:43 2016(r299938)
@@ -1086,6 +1086,7 @@ domount:
(void) snprintf(mountpoint, mountpoint_len,
"%s/" ZFS_CTLDIR_NAME "/snapshot/%s",
dvp->v_vfsp->mnt_stat.f_mntonname, nm);
+   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
err = mount_snapshot(curthread, vpp, "zfs", mountpoint, snapname, 0);
kmem_free(mountpoint, mountpoint_len);
if (err == 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299934 - head/sys/arm64/cavium

2016-05-16 Thread Zbigniew Bodek
Are these ThunderX related commits going to be reviewed or tested by anyone
that uses ThunderX?

Kind regards
zbb

2016-05-16 12:03 GMT+02:00 Andrew Turner :

> Author: andrew
> Date: Mon May 16 10:03:57 2016
> New Revision: 299934
> URL: https://svnweb.freebsd.org/changeset/base/299934
>
> Log:
>   Teach the ThunderX PCI PEM driver about intrng. This will be used later
>   when arm64 is supported by intrng.
>
>   Obtained from:ABT Systems Ltd
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
>
> Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
>
> ==
> --- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16
> 09:56:48 2016(r299933)
> +++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16
> 10:03:57 2016(r299934)
> @@ -109,6 +109,60 @@ thunder_pem_fdt_probe(device_t dev)
> return (ENXIO);
>  }
>
> +#ifdef INTRNG
> +static int
> +thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int
> maxcount,
> +int *irqs)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> _parent,
> +   NULL);
> +   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
> +   irqs));
> +}
> +
> +static int
> +thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int
> *irqs)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> _parent,
> +   NULL);
> +   return (intr_release_msi(pci, child, msi_parent, count, irqs));
> +}
> +
> +static int
> +thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> _parent,
> +   NULL);
> +   return (intr_alloc_msix(pci, child, msi_parent, irq));
> +}
> +
> +static int
> +thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> _parent,
> +   NULL);
> +   return (intr_release_msix(pci, child, msi_parent, irq));
> +}
> +
> +static int
> +thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t
> *addr,
> +uint32_t *data)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> _parent,
> +   NULL);
> +   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
> +}
> +#else
>  static int
>  thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int
> maxcount,
>  int *irqs)
> @@ -145,6 +199,7 @@ thunder_pem_fdt_map_msi(device_t pci, de
>
> return (arm_map_msi(pci, child, irq, addr, data));
>  }
> +#endif
>
>  static int
>  thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type
> type,
> ___
> svn-src-...@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-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: r299937 - head/sys/dev/rtwn

2016-05-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon May 16 10:51:35 2016
New Revision: 299937
URL: https://svnweb.freebsd.org/changeset/base/299937

Log:
  rtwn: fix double free in raw xmit path.
  
  Reported by:  mva

Modified:
  head/sys/dev/rtwn/if_rtwn.c

Modified: head/sys/dev/rtwn/if_rtwn.c
==
--- head/sys/dev/rtwn/if_rtwn.c Mon May 16 10:48:51 2016(r299936)
+++ head/sys/dev/rtwn/if_rtwn.c Mon May 16 10:51:35 2016(r299937)
@@ -1789,7 +1789,6 @@ rtwn_raw_xmit(struct ieee80211_node *ni,
}
 
if (rtwn_tx(sc, m, ni) != 0) {
-   m_freem(m);
RTWN_UNLOCK(sc);
return (EIO);
}
___
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: r299936 - in head/sys: arm64/arm64 arm64/include conf

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 10:48:51 2016
New Revision: 299936
URL: https://svnweb.freebsd.org/changeset/base/299936

Log:
  Add support for intrng to arm64. As the GICv3 drivers will need to be
  updated, and until further testing can be done, this is disabled for now.
  
  It is expected arm64 will switch to this interface, and the old interface
  will be removed before 11.0 is released.
  
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/autoconf.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/intr.h
  head/sys/conf/files.arm64
  head/sys/conf/options.arm64

Modified: head/sys/arm64/arm64/autoconf.c
==
--- head/sys/arm64/arm64/autoconf.c Mon May 16 10:34:55 2016
(r299935)
+++ head/sys/arm64/arm64/autoconf.c Mon May 16 10:48:51 2016
(r299936)
@@ -80,7 +80,13 @@ configure(void *dummy)
 static void
 configure_final(void *dummy)
 {
+
+#ifdef INTRNG
+   /* Enable interrupt reception on this CPU */
+   intr_enable();
+#else
arm_enable_intr();
+#endif
cninit_finish(); 
 
if (bootverbose)

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon May 16 10:34:55 2016
(r299935)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon May 16 10:48:51 2016
(r299936)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by Andrew Turner under
@@ -65,6 +65,29 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#ifdef INTRNG
+#include "pic_if.h"
+
+typedef void intr_ipi_send_t(void *, cpuset_t, u_int);
+typedef void intr_ipi_handler_t(void *);
+
+#define INTR_IPI_NAMELEN   (MAXCOMLEN + 1)
+struct intr_ipi {
+   intr_ipi_handler_t *ii_handler;
+   void *  ii_handler_arg;
+   intr_ipi_send_t *   ii_send;
+   void *  ii_send_arg;
+   charii_name[INTR_IPI_NAMELEN];
+   u_long *ii_count;
+};
+
+static struct intr_ipi ipi_sources[INTR_IPI_COUNT];
+
+static struct intr_ipi *intr_ipi_lookup(u_int);
+static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *,
+void *);
+#endif /* INTRNG */
+
 boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *);
 
 extern struct pcpu __pcpu[];
@@ -184,9 +207,18 @@ release_aps(void *dummy __unused)
 {
int cpu, i;
 
+#ifdef INTRNG
+   intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL);
+   intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL);
+   intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL);
+   intr_pic_ipi_setup(IPI_STOP, "stop", ipi_stop, NULL);
+   intr_pic_ipi_setup(IPI_STOP_HARD, "stop hard", ipi_stop, NULL);
+   intr_pic_ipi_setup(IPI_HARDCLOCK, "hardclock", ipi_hardclock, NULL);
+#else
/* Setup the IPI handler */
for (i = 0; i < INTR_IPI_COUNT; i++)
arm_setup_ipihandler(ipi_handler, i);
+#endif
 
atomic_store_rel_int(_ready, 1);
/* Wake up the other CPUs */
@@ -214,7 +246,9 @@ void
 init_secondary(uint64_t cpu)
 {
struct pcpu *pcpup;
+#ifndef INTRNG
int i;
+#endif
 
pcpup = &__pcpu[cpu];
/*
@@ -241,11 +275,13 @@ init_secondary(uint64_t cpu)
 */
identify_cpu();
 
+#ifndef INTRNG
/* Configure the interrupt controller */
arm_init_secondary();
 
for (i = 0; i < INTR_IPI_COUNT; i++)
arm_unmask_ipi(i);
+#endif
 
/* Start per-CPU event timers. */
cpu_initclocks_ap();
@@ -270,6 +306,10 @@ init_secondary(uint64_t cpu)
 
mtx_unlock_spin(_boot_mtx);
 
+#ifdef INTRNG
+   intr_pic_init_secondary();
+#endif
+
/* Enter the scheduler */
sched_throw(NULL);
 
@@ -277,6 +317,64 @@ init_secondary(uint64_t cpu)
/* NOTREACHED */
 }
 
+#ifdef INTRNG
+/*
+ *  Send IPI thru interrupt controller.
+ */
+static void
+pic_ipi_send(void *arg, cpuset_t cpus, u_int ipi)
+{
+
+   KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__));
+   PIC_IPI_SEND(intr_irq_root_dev, arg, cpus, ipi);
+}
+
+/*
+ *  Setup IPI handler on interrupt controller.
+ *
+ *  Not SMP coherent.
+ */
+static void
+intr_pic_ipi_setup(u_int ipi, const char *name, intr_ipi_handler_t *hand,
+void *arg)
+{
+   struct intr_irqsrc *isrc;
+   struct intr_ipi *ii;
+   int error;
+
+   KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__));
+   KASSERT(hand != NULL, ("%s: ipi %u no handler", __func__, ipi));
+
+   error = PIC_IPI_SETUP(intr_irq_root_dev, ipi, );
+   if (error != 0)
+   return;
+
+   

svn commit: r299934 - head/sys/arm64/cavium

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 10:03:57 2016
New Revision: 299934
URL: https://svnweb.freebsd.org/changeset/base/299934

Log:
  Teach the ThunderX PCI PEM driver about intrng. This will be used later
  when arm64 is supported by intrng.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem_fdt.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16 09:56:48 
2016(r299933)
+++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16 10:03:57 
2016(r299934)
@@ -109,6 +109,60 @@ thunder_pem_fdt_probe(device_t dev)
return (ENXIO);
 }
 
+#ifdef INTRNG
+static int
+thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
+int *irqs)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
+   irqs));
+}
+
+static int
+thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msi(pci, child, msi_parent, count, irqs));
+}
+
+static int
+thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_alloc_msix(pci, child, msi_parent, irq));
+}
+
+static int
+thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_release_msix(pci, child, msi_parent, irq));
+}
+
+static int
+thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
+uint32_t *data)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), _parent,
+   NULL);
+   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
+}
+#else
 static int
 thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
 int *irqs)
@@ -145,6 +199,7 @@ thunder_pem_fdt_map_msi(device_t pci, de
 
return (arm_map_msi(pci, child, irq, addr, data));
 }
+#endif
 
 static int
 thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type type,
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 16 09:56:48 2016
New Revision: 299933
URL: https://svnweb.freebsd.org/changeset/base/299933

Log:
  Implement more Linux device related functions in the LinuxKPI. While
  at it use NULL for some pointer checks.
  
  Bump the FreeBSD version to force recompilation of all kernel modules
  due to a structure size change.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
09:31:44 2016(r299932)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
09:56:48 2016(r299933)
@@ -31,6 +31,7 @@
 #ifndef_LINUX_DEVICE_H_
 #define_LINUX_DEVICE_H_
 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +72,7 @@ struct device {
unsigned intirq;
unsigned intmsix;
unsigned intmsix_max;
+   const struct attribute_group **groups;
 };
 
 extern struct device linux_root_device;
@@ -127,11 +129,12 @@ show_class_attr_string(struct class *cla
 #definedev_err(dev, fmt, ...)  device_printf((dev)->bsddev, fmt, 
##__VA_ARGS__)
 #definedev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
##__VA_ARGS__)
 #definedev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
##__VA_ARGS__)
+#definedev_notice(dev, fmt, ...)   device_printf((dev)->bsddev, 
fmt, ##__VA_ARGS__)
 #definedev_printk(lvl, dev, fmt, ...)  
\
device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
 
 static inline void *
-dev_get_drvdata(struct device *dev)
+dev_get_drvdata(const struct device *dev)
 {
 
return dev->driver_data;
@@ -191,11 +194,106 @@ class_unregister(struct class *class)
kobject_put(>kobj);
 }
 
+static inline struct device *kobj_to_dev(struct kobject *kobj)
+{
+   return container_of(kobj, struct device, kobj);
+}
+
 /*
- * Devices are registered and created for exporting to sysfs.  create
+ * Devices are registered and created for exporting to sysfs. Create
  * implies register and register assumes the device fields have been
  * setup appropriately before being called.
  */
+static inline void
+device_initialize(struct device *dev)
+{
+   device_t bsddev;
+
+   bsddev = NULL;
+   if (dev->devt) {
+   int unit = MINOR(dev->devt);
+   bsddev = devclass_get_device(dev->class->bsdclass, unit);
+   }
+   if (bsddev != NULL)
+   device_set_softc(bsddev, dev);
+
+   dev->bsddev = bsddev;
+   kobject_init(>kobj, _dev_ktype);
+}
+
+static inline int
+device_add(struct device *dev)
+{  
+   if (dev->bsddev != NULL) {
+   if (dev->devt == 0)
+   dev->devt = makedev(0, device_get_unit(dev->bsddev));
+   }
+   kobject_add(>kobj, >class->kobj, dev_name(dev));
+   return (0);
+}
+
+static inline void
+device_create_release(struct device *dev)
+{
+   kfree(dev);
+}
+
+static inline struct device *
+device_create_groups_vargs(struct class *class, struct device *parent,
+dev_t devt, void *drvdata, const struct attribute_group **groups,
+const char *fmt, va_list args)
+{
+   struct device *dev = NULL;
+   int retval = -ENODEV;
+
+   if (class == NULL || IS_ERR(class))
+   goto error;
+
+   dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+   if (!dev) {
+   retval = -ENOMEM;
+   goto error;
+   }
+
+   device_initialize(dev);
+   dev->devt = devt;
+   dev->class = class;
+   dev->parent = parent;
+   dev->groups = groups;
+   dev->release = device_create_release;
+   dev->bsddev = devclass_get_device(dev->class->bsdclass, MINOR(devt));
+   dev_set_drvdata(dev, drvdata);
+
+   retval = kobject_set_name_vargs(>kobj, fmt, args);
+   if (retval)
+   goto error;
+
+   retval = device_add(dev);
+   if (retval)
+   goto error;
+
+   return dev;
+
+error:
+   put_device(dev);
+   return ERR_PTR(retval);
+}
+
+static inline struct device *
+device_create_with_groups(struct class *class,
+struct device *parent, dev_t devt, void *drvdata,
+const struct attribute_group **groups, const char *fmt, ...)
+{
+   va_list vargs;
+   struct device *dev;
+
+   va_start(vargs, fmt);
+   dev = device_create_groups_vargs(class, parent, devt, drvdata,
+   groups, fmt, vargs);
+   va_end(vargs);
+   return dev;
+}
+
 static inline int
 device_register(struct device *dev)
 {
@@ -233,13 +331,29 @@ device_unregister(struct device *dev)
device_t bsddev;
 
bsddev = dev->bsddev;
+   dev->bsddev = NULL;

svn commit: r299932 - in head: share/man/man9 sys/arm64/arm64 sys/arm64/cavium sys/dev/ofw sys/dev/pci

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 09:31:44 2016
New Revision: 299932
URL: https://svnweb.freebsd.org/changeset/base/299932

Log:
  Add a pcib interface for use by interrupt controllers that need to
  translate the pci rid to a controller ID. The translation could be based
  on the 'msi-map' OFW property, a similar ACPI option, or hard-coded for
  hardware lacking the above options.
  
  Reviewed by:  wma
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man9/pci.9
  head/sys/arm64/arm64/gic_v3_its.c
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/arm64/cavium/thunder_pcie_fdt.c
  head/sys/arm64/cavium/thunder_pcie_pem.c
  head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h
  head/sys/dev/pci/pci_host_generic.c
  head/sys/dev/pci/pci_host_generic.h
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c

Modified: head/share/man/man9/pci.9
==
--- head/share/man/man9/pci.9   Mon May 16 09:25:56 2016(r299931)
+++ head/share/man/man9/pci.9   Mon May 16 09:31:44 2016(r299932)
@@ -369,6 +369,9 @@ The following flags are supported:
 .Bl -hang -width ".Dv PCI_ID_RID"
 .It Dv PCI_ID_RID
 Read the routing identifier for the device.
+.It Dv PCI_ID_MSI
+Read the MSI routing ID.
+This is needed by some interrupt controllers to route MSI and MSI-X interrupts.
 .El
 .Pp
 The

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Mon May 16 09:25:56 2016
(r299931)
+++ head/sys/arm64/arm64/gic_v3_its.c   Mon May 16 09:31:44 2016
(r299932)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #defineGIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET88
 
 #include "pic_if.h"
+#include "pcib_if.h"
 
 /* Device and PIC methods */
 static int gic_v3_its_attach(device_t);
@@ -150,7 +151,6 @@ const char *its_ptab_type[] = {
 
 /* Cavium ThunderX PCI devid acquire function */
 static uint32_t its_get_devbits_thunder(device_t);
-static uint32_t its_get_devid_thunder(device_t);
 
 static const struct its_quirks its_quirks[] = {
{
@@ -160,7 +160,6 @@ static const struct its_quirks its_quirk
 */
.cpuid =CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 
0, 0),
.cpuid_mask =   CPU_IMPL_MASK | CPU_PART_MASK,
-   .devid_func =   its_get_devid_thunder,
.devbits_func = its_get_devbits_thunder,
},
 };
@@ -1569,46 +1568,6 @@ its_device_asign_lpi_locked(struct gic_v
  * Add vendor specific PCI devid function here.
  */
 static uint32_t
-its_get_devid_thunder(device_t pci_dev)
-{
-   int bsf;
-   int pem;
-   uint32_t bus;
-
-   bus = pci_get_bus(pci_dev);
-   bsf = pci_get_rid(pci_dev);
-
-   /* Check if accessing internal PCIe (low bus numbers) */
-   if (bus < GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET) {
-   return ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) |
-   bsf);
-   /* PEM otherwise */
-   } else {
-   /* PEM (PCIe MAC/root complex) number is equal to domain */
-   pem = pci_get_domain(pci_dev);
-
-   /*
-* Set appropriate device ID (passed by the HW along with
-* the transaction to memory) for different root complex
-* numbers using hard-coded domain portion for each group.
-*/
-   if (pem < 3)
-   return ((0x1 << PCI_RID_DOMAIN_SHIFT) | bsf);
-
-   if (pem < 6)
-   return ((0x3 << PCI_RID_DOMAIN_SHIFT) | bsf);
-
-   if (pem < 9)
-   return ((0x9 << PCI_RID_DOMAIN_SHIFT) | bsf);
-
-   if (pem < 12)
-   return ((0xB << PCI_RID_DOMAIN_SHIFT) | bsf);
-   }
-
-   return (0);
-}
-
-static uint32_t
 its_get_devbits_thunder(device_t dev)
 {
uint32_t devid_bits;
@@ -1670,28 +1629,15 @@ its_get_devbits(device_t dev)
return (its_get_devbits_default(dev));
 }
 
-static __inline uint32_t
-its_get_devid_default(device_t pci_dev)
-{
-
-   return (PCI_DEVID_GENERIC(pci_dev));
-}
-
 static uint32_t
 its_get_devid(device_t pci_dev)
 {
-   const struct its_quirks *quirk;
-   size_t i;
+   uintptr_t id;
 
-   for (i = 0; i < nitems(its_quirks); i++) {
-   quirk = _quirks[i];
-   if (CPU_MATCH_RAW(quirk->cpuid_mask, quirk->cpuid)) {
-   if (quirk->devid_func != NULL)
-   return ((*quirk->devid_func)(pci_dev));
-   }
-   }
+   if (pci_get_id(pci_dev, PCI_ID_MSI, ) != 0)
+   panic("its_get_devid: Unable to get the MSI DeviceID");
 
-   return (its_get_devid_default(pci_dev));
+   return (id);

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

2016-05-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 16 09:25:56 2016
New Revision: 299931
URL: https://svnweb.freebsd.org/changeset/base/299931

Log:
  Don't dereference parent pointer when it is NULL.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
09:16:15 2016(r299930)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
09:25:56 2016(r299931)
@@ -211,11 +211,11 @@ device_register(struct device *dev)
} else if (dev->parent == NULL) {
bsddev = devclass_get_device(dev->class->bsdclass, 0);
}
-
-   if (bsddev == NULL)
+   if (bsddev == NULL && dev->parent != NULL) {
bsddev = device_add_child(dev->parent->bsddev,
dev->class->kobj.name, unit);
-   if (bsddev) {
+   }
+   if (bsddev != NULL) {
if (dev->devt == 0)
dev->devt = makedev(0, device_get_unit(bsddev));
device_set_softc(bsddev, dev);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299930 - in head/sys/compat/linuxkpi/common: include/linux src

2016-05-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 16 09:16:15 2016
New Revision: 299930
URL: https://svnweb.freebsd.org/changeset/base/299930

Log:
  Properly implement "cpu_has_clflush" macro.
  
  Suggested by: kib, jhb
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Mon May 16 
09:15:50 2016(r299929)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Mon May 16 
09:16:15 2016(r299930)
@@ -258,7 +258,11 @@
 #definesmp_processor_id()  PCPU_GET(cpuid)
 #definenum_possible_cpus() mp_ncpus
 #definenum_online_cpus()   mp_ncpus
-#definecpu_has_clflush (1)
+
+#if defined(__i386__) || defined(__amd64__)
+extern bool linux_cpu_has_clflush;
+#definecpu_has_clflush linux_cpu_has_clflush
+#endif
 
 typedef struct pm_message {
 int event;

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May 16 09:15:50 
2016(r299929)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May 16 09:16:15 
2016(r299930)
@@ -51,6 +51,10 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#if defined(__i386__) || defined(__amd64__)
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -67,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1362,12 +1367,19 @@ linux_irq_handler(void *ent)
irqe->handler(irqe->irq, irqe->arg);
 }
 
+#if defined(__i386__) || defined(__amd64__)
+bool linux_cpu_has_clflush;
+#endif
+
 static void
 linux_compat_init(void *arg)
 {
struct sysctl_oid *rootoid;
int i;
 
+#if defined(__i386__) || defined(__amd64__)
+   linux_cpu_has_clflush = (cpu_feature & CPUID_CLFSH);
+#endif
sx_init(_global_rcu_lock, "LinuxGlobalRCU");
 
rootoid = SYSCTL_ADD_ROOT_NODE(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: r299929 - in head: share/man/man9 sys/dev/pci

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 09:15:50 2016
New Revision: 299929
URL: https://svnweb.freebsd.org/changeset/base/299929

Log:
  Re-commit r299467 having fixed the build:
  
  Add a new get_id interface to pci and pcib. This will allow us to both
  detect failures, and get different PCI IDs.
  
  For the former the interface returns an int to signal an error. The ID is
  returned at a uintptr_t * argument.
  
  For the latter there is a type argument that allows selecting the ID type.
  This only specifies a single type, however a MSI type will be added
  to handle the need to find the ID the hardware passes to the ARM GICv3
  interrupt controller.
  
  A follow up commit will be made to remove pci_get_rid.
  
  Reviewed by:jhb, rstone (previous version)
  Obtained from:  ABT Systems Ltd
  Sponsored by:   The FreeBSD Foundation
  Differential Revision:  https://reviews.freebsd.org/D6239

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/pci.9
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_if.m
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcib_support.c
  head/sys/dev/pci/pcivar.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileMon May 16 09:11:40 2016
(r299928)
+++ head/share/man/man9/MakefileMon May 16 09:15:50 2016
(r299929)
@@ -1290,6 +1290,7 @@ MLINKS+=pci.9 pci_alloc_msi.9 \
pci.9 pci_find_extcap.9 \
pci.9 pci_find_htcap.9 \
pci.9 pci_find_pcie_root_port.9 \
+   pci.9 pci_get_id.9 \
pci.9 pci_get_max_read_req.9 \
pci.9 pci_get_powerstate.9 \
pci.9 pci_get_vpd_ident.9 \

Modified: head/share/man/man9/pci.9
==
--- head/share/man/man9/pci.9   Mon May 16 09:11:40 2016(r299928)
+++ head/share/man/man9/pci.9   Mon May 16 09:15:50 2016(r299929)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 23, 2015
+.Dd May 16, 2016
 .Dt PCI 9
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .Nm pci_find_extcap ,
 .Nm pci_find_htcap ,
 .Nm pci_find_pcie_root_port ,
+.Nm pci_get_id ,
 .Nm pci_get_max_read_req ,
 .Nm pci_get_powerstate ,
 .Nm pci_get_vpd_ident ,
@@ -97,6 +98,8 @@
 .Ft device_t
 .Fn pci_find_pcie_root_port "device_t dev"
 .Ft int
+.Fn pci_get_id "device_t dev" "enum pci_id_type type" "uintptr_t *id"
+.Ft int
 .Fn pci_get_max_read_req "device_t dev"
 .Ft int
 .Fn pci_get_powerstate "device_t dev"
@@ -357,6 +360,18 @@ returns
 .Dv NULL .
 .Pp
 The
+.Fn pci_get_id
+function is used to read an identifier from a device.
+The
+.Fa type
+flag is used to specify which identifier to read.
+The following flags are supported:
+.Bl -hang -width ".Dv PCI_ID_RID"
+.It Dv PCI_ID_RID
+Read the routing identifier for the device.
+.El
+.Pp
+The
 .Fn pci_get_vpd_ident
 function is used to fetch a device's Vital Product Data
 .Pq VPD

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Mon May 16 09:11:40 2016(r299928)
+++ head/sys/dev/pci/pci.c  Mon May 16 09:15:50 2016(r299929)
@@ -122,7 +122,8 @@ static void pci_resume_msix(device_t de
 static int pci_remap_intr_method(device_t bus, device_t dev,
u_int irq);
 
-static uint16_tpci_get_rid_method(device_t dev, device_t 
child);
+static int pci_get_id_method(device_t dev, device_t child,
+   enum pci_id_type type, uintptr_t *rid);
 
 static struct pci_devinfo * pci_fill_devinfo(device_t pcib, device_t bus, int 
d,
 int b, int s, int f, uint16_t vid, uint16_t did);
@@ -190,7 +191,7 @@ static device_method_t pci_methods[] = {
DEVMETHOD(pci_msix_count,   pci_msix_count_method),
DEVMETHOD(pci_msix_pba_bar, pci_msix_pba_bar_method),
DEVMETHOD(pci_msix_table_bar,   pci_msix_table_bar_method),
-   DEVMETHOD(pci_get_rid,  pci_get_rid_method),
+   DEVMETHOD(pci_get_id,   pci_get_id_method),
DEVMETHOD(pci_alloc_devinfo,pci_alloc_devinfo_method),
DEVMETHOD(pci_child_added,  pci_child_added_method),
 #ifdef PCI_IOV
@@ -5823,11 +5824,12 @@ pci_restore_state(device_t dev)
pci_cfg_restore(dev, dinfo);
 }
 
-static uint16_t
-pci_get_rid_method(device_t dev, device_t child)
+static int
+pci_get_id_method(device_t dev, device_t child, enum pci_id_type type,
+uintptr_t *id)
 {
 
-   return (PCIB_GET_RID(device_get_parent(dev), child));
+   return (PCIB_GET_ID(device_get_parent(dev), child, type, id));
 }
 
 /* Find the upstream port of a given PCI device in a root complex. */

Modified: head/sys/dev/pci/pci_if.m
==
--- head/sys/dev/pci/pci_if.m   Mon May 16 

svn commit: r299928 - in head/sys: arm/arm conf dev/pci kern mips/mediatek sys

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 09:11:40 2016
New Revision: 299928
URL: https://svnweb.freebsd.org/changeset/base/299928

Log:
  Introduce MSI and MSI-X support to intrng. This adds a new msi device
  interface with 5 methods to mirror the 5 MSI/MSI-X methods in the pcib
  interface. The pcib driver will need to perform a device specific lookup
  to find the MSI controller and pass this to intrng as the xref. Intrng
  will finally find the controller and have it handle the requested operation.
  
  Obtained from:ABT Systems Ltd
  MFH:  yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5985

Added:
  head/sys/kern/msi_if.m   (contents, props changed)
Modified:
  head/sys/arm/arm/gic.c
  head/sys/conf/files.arm
  head/sys/dev/pci/pci_host_generic.c
  head/sys/dev/pci/pci_host_generic.h
  head/sys/kern/subr_intr.c
  head/sys/mips/mediatek/files.mediatek
  head/sys/sys/intr.h

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Mon May 16 08:50:32 2016(r299927)
+++ head/sys/arm/arm/gic.c  Mon May 16 09:11:40 2016(r299928)
@@ -53,6 +53,10 @@ __FBSDID("$FreeBSD$");
 #ifdef INTRNG
 #include 
 #endif
+
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -64,6 +68,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef INTRNG
 #include "pic_if.h"
+#include "msi_if.h"
 #endif
 
 #define GIC_DEBUG_SPURIOUS
@@ -123,6 +128,10 @@ struct gic_irqsrc {
enum intr_polarity  gi_pol;
enum intr_trigger   gi_trig;
 #define GI_FLAG_EARLY_EOI  (1 << 0)
+#define GI_FLAG_MSI(1 << 1) /* This interrupt source should only */
+/* be used for MSI/MSI-X interrupts */
+#define GI_FLAG_MSI_USED   (1 << 2) /* This irq is already allocated */
+/* for a MSI/MSI-X interrupt */
u_int   gi_flags;
 };
 
@@ -562,6 +571,33 @@ arm_gic_add_children(device_t dev)
 
return (true);
 }
+
+static void
+arm_gic_reserve_msi_range(device_t dev, u_int start, u_int count)
+{
+   struct arm_gic_softc *sc;
+   int i;
+
+   sc = device_get_softc(dev);
+
+   KASSERT((start + count) < sc->nirqs,
+   ("%s: Trying to allocate too many MSI IRQs: %d + %d > %d", __func__,
+   start, count, sc->nirqs));
+   for (i = 0; i < count; i++) {
+   KASSERT(sc->gic_irqs[start + i].gi_isrc.isrc_handlers == 0,
+   ("%s: MSI interrupt %d already has a handler", __func__,
+   count + i));
+   KASSERT(sc->gic_irqs[start + i].gi_pol == INTR_POLARITY_CONFORM,
+   ("%s: MSI interrupt %d already has a polarity", __func__,
+   count + i));
+   KASSERT(sc->gic_irqs[start + i].gi_trig == INTR_TRIGGER_CONFORM,
+   ("%s: MSI interrupt %d already has a trigger", __func__,
+   count + i));
+   sc->gic_irqs[start + i].gi_pol = INTR_POLARITY_HIGH;
+   sc->gic_irqs[start + i].gi_trig = INTR_TRIGGER_EDGE;
+   sc->gic_irqs[start + i].gi_flags |= GI_FLAG_MSI;
+   }
+}
 #endif
 
 static int
@@ -1018,6 +1054,10 @@ gic_map_intr(device_t dev, struct intr_m
if (gic_map_fdt(dev, daf->ncells, daf->cells, , ,
) != 0)
return (EINVAL);
+   KASSERT(irq >= sc->nirqs ||
+   (sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) == 0,
+   ("%s: Attempting to map a MSI interrupt from FDT",
+   __func__));
break;
 #endif
default:
@@ -1067,15 +1107,23 @@ arm_gic_setup_intr(device_t dev, struct 
enum intr_trigger trig;
enum intr_polarity pol;
 
-   if (data == NULL)
-   return (ENOTSUP);
-
-   /* Get config for resource. */
-   if (gic_map_intr(dev, data, , , ))
-   return (EINVAL);
+   if ((gi->gi_flags & GI_FLAG_MSI) == GI_FLAG_MSI) {
+   irq = gi->gi_irq;
+   pol = gi->gi_pol;
+   trig = gi->gi_trig;
+   KASSERT(pol == INTR_POLARITY_HIGH,
+   ("%s: MSI interrupts must be active-high", __func__));
+   KASSERT(trig == INTR_TRIGGER_EDGE,
+   ("%s: MSI interrupts must be edge triggered", __func__));
+   } else if (data != NULL) {
+   /* Get config for resource. */
+   if (gic_map_intr(dev, data, , , ))
+   return (EINVAL);
 
-   if (gi->gi_irq != irq)
-   return (EINVAL);
+   if (gi->gi_irq != irq)
+   return (EINVAL);
+   } else
+   return (ENOTSUP);
 
/* Compare config if this is not first setup. */
if (isrc->isrc_handlers != 0) {
@@ -1086,16 +1134,20 @@ arm_gic_setup_intr(device_t dev, 

svn commit: r299927 - head/sys/dev/hyperv/vmbus

2016-05-16 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 16 08:50:32 2016
New Revision: 299927
URL: https://svnweb.freebsd.org/changeset/base/299927

Log:
  hyperv/vmbus: Use atomic_testandclear
  
  Prepare to use unsigned long for event channel bit array.
  
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6382

Modified:
  head/sys/dev/hyperv/vmbus/hv_connection.c

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Mon May 16 08:34:17 2016
(r299926)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Mon May 16 08:50:32 2016
(r299927)
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -313,7 +314,7 @@ hv_vmbus_on_events(int cpu)
/*
 * receive size is 1/2 page and divide that by 4 bytes
 */
-   if (synch_test_and_clear_bit(0, >flags32[0])) {
+   if (atomic_testandclear_int(>flags32[0], 0)) {
recv_interrupt_page =
hv_vmbus_g_connection.recv_interrupt_page;
} else {
@@ -337,8 +338,8 @@ hv_vmbus_on_events(int cpu)
continue;
 
for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) {
-   if (synch_test_and_clear_bit(bit,
-   (uint32_t *)_interrupt_page[dword])) {
+   if (atomic_testandclear_int(
+   _interrupt_page[dword], bit)) {
struct hv_vmbus_channel *channel;
 
rel_id = (dword << 5) + bit;
___
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: r299926 - head/lib/libpam/modules/pam_unix

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 08:34:17 2016
New Revision: 299926
URL: https://svnweb.freebsd.org/changeset/base/299926

Log:
  Hoist the getpwnam() call outside the first if/else block in
  pam_sm_chauthtok().  Set user = getlogin() inside the true
  branch so that it is initialized for the following PAM_LOG()
  call.  This is how it is done in pam_sm_authenticate().
  
  Reported by:  Coverity
  CID:  272498
  MFC after:1 week

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.c

Modified: head/lib/libpam/modules/pam_unix/pam_unix.c
==
--- head/lib/libpam/modules/pam_unix/pam_unix.c Mon May 16 08:32:21 2016
(r299925)
+++ head/lib/libpam/modules/pam_unix/pam_unix.c Mon May 16 08:34:17 2016
(r299926)
@@ -278,13 +278,13 @@ pam_sm_chauthtok(pam_handle_t *pamh, int
int pfd, tfd, retval;
 
if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF))
-   pwd = getpwnam(getlogin());
+   user = getlogin();
else {
retval = pam_get_user(pamh, , NULL);
if (retval != PAM_SUCCESS)
return (retval);
-   pwd = getpwnam(user);
}
+   pwd = getpwnam(user);
 
if (pwd == NULL)
return (PAM_AUTHTOK_RECOVERY_ERR);
___
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: r299925 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 08:32:21 2016
New Revision: 299925
URL: https://svnweb.freebsd.org/changeset/base/299925

Log:
  sfxge(4): cleanup: quieten more common code MCDI handlers
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c
  head/sys/dev/sfxge/common/ef10_filter.c
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/ef10_tx.c

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Mon May 16 08:28:27 2016
(r299924)
+++ head/sys/dev/sfxge/common/ef10_ev.c Mon May 16 08:32:21 2016
(r299925)
@@ -207,7 +207,7 @@ efx_mcdi_fini_evq(
 
MCDI_IN_SET_DWORD(req, FINI_EVQ_IN_INSTANCE, instance);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Mon May 16 08:28:27 2016
(r299924)
+++ head/sys/dev/sfxge/common/ef10_filter.c Mon May 16 08:32:21 2016
(r299925)
@@ -353,7 +353,7 @@ efx_mcdi_filter_op_delete(
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO, handle->efh_lo);
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI, handle->efh_hi);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cMon May 16 08:28:27 2016
(r299924)
+++ head/sys/dev/sfxge/common/ef10_nic.cMon May 16 08:32:21 2016
(r299925)
@@ -765,7 +765,7 @@ efx_mcdi_unlink_piobuf(
 
MCDI_IN_SET_DWORD(req, UNLINK_PIOBUF_IN_TXQ_INSTANCE, vi_index);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Mon May 16 08:28:27 2016
(r299924)
+++ head/sys/dev/sfxge/common/ef10_rx.c Mon May 16 08:32:21 2016
(r299925)
@@ -127,7 +127,7 @@ efx_mcdi_fini_rxq(
 
MCDI_IN_SET_DWORD(req, FINI_RXQ_IN_INSTANCE, instance);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if ((req.emr_rc != 0) && (req.emr_rc != MC_CMD_ERR_EALREADY)) {
rc = req.emr_rc;
@@ -249,7 +249,7 @@ efx_mcdi_rss_context_free(
 
MCDI_IN_SET_DWORD(req, RSS_CONTEXT_FREE_IN_RSS_CONTEXT_ID, rss_context);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;

Modified: head/sys/dev/sfxge/common/ef10_tx.c
==
--- head/sys/dev/sfxge/common/ef10_tx.c Mon May 16 08:28:27 2016
(r299924)
+++ head/sys/dev/sfxge/common/ef10_tx.c Mon May 16 08:32:21 2016
(r299925)
@@ -149,7 +149,7 @@ efx_mcdi_fini_txq(
 
MCDI_IN_SET_DWORD(req, FINI_TXQ_IN_INSTANCE, instance);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if ((req.emr_rc != 0) && (req.emr_rc != MC_CMD_ERR_EALREADY)) {
rc = req.emr_rc;
___
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: r299924 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 08:28:27 2016
New Revision: 299924
URL: https://svnweb.freebsd.org/changeset/base/299924

Log:
  sfxge(4): cleanup: remove misnamed function declaration
  
  Submitted by:   Richard Houldsworth 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/efx_impl.h

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hMon May 16 08:27:20 2016
(r299923)
+++ head/sys/dev/sfxge/common/efx_impl.hMon May 16 08:28:27 2016
(r299924)
@@ -461,14 +461,6 @@ typedef struct efx_nvram_ops_s {
 } efx_nvram_ops_t;
 #endif /* EFSYS_OPT_NVRAM */
 
-extern __checkReturn   efx_rc_t
-efx_nvram_tlv_validate(
-   __inefx_nic_t *enp,
-   __inuint32_t partn,
-   __in_bcount(partn_size) caddr_t partn_data,
-   __insize_t partn_size);
-
-
 #if EFSYS_OPT_VPD
 typedef struct efx_vpd_ops_s {
efx_rc_t(*evpdo_init)(efx_nic_t *);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299923 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 08:27:20 2016
New Revision: 299923
URL: https://svnweb.freebsd.org/changeset/base/299923

Log:
  sfxge(4): cleanup: make MCDI license queries quieter in common code
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/efx_lic.c

Modified: head/sys/dev/sfxge/common/efx_lic.c
==
--- head/sys/dev/sfxge/common/efx_lic.c Mon May 16 08:13:30 2016
(r299922)
+++ head/sys/dev/sfxge/common/efx_lic.c Mon May 16 08:27:20 2016
(r299923)
@@ -408,7 +408,7 @@ efx_mcdi_fc_license_get_key_stats(
MCDI_IN_SET_DWORD(req, FC_IN_LICENSE_OP,
MC_CMD_FC_IN_LICENSE_GET_KEY_STATS);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -935,7 +935,7 @@ efx_mcdi_licensing_v3_report_license(
MCDI_IN_SET_DWORD(req, LICENSING_V3_IN_OP,
MC_CMD_LICENSING_V3_IN_OP_REPORT_LICENSE);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -1062,7 +1062,7 @@ efx_mcdi_licensing_v3_get_id(
(void) memset(bufferp, 0, req.emr_out_length);
}
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;
___
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: r299922 - head/lib/libc/net

2016-05-16 Thread Don Lewis
On 16 May, To: src-committ...@freebsd.org wrote:
> Author: truckman
> Date: Mon May 16 08:13:30 2016
> New Revision: 299922
> URL: https://svnweb.freebsd.org/changeset/base/299922
> 
> Log:
>   Don't call free_addrselectpolicy() before policyhead has been
>   initialized.
>   
>   Reported by:Coverity
>   CID:1018727

MFC after:  1 week
___
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: r299922 - head/lib/libc/net

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 08:13:30 2016
New Revision: 299922
URL: https://svnweb.freebsd.org/changeset/base/299922

Log:
  Don't call free_addrselectpolicy() before policyhead has been
  initialized.
  
  Reported by:  Coverity
  CID:  1018727

Modified:
  head/lib/libc/net/name6.c

Modified: head/lib/libc/net/name6.c
==
--- head/lib/libc/net/name6.c   Mon May 16 08:07:32 2016(r299921)
+++ head/lib/libc/net/name6.c   Mon May 16 08:13:30 2016(r299922)
@@ -655,7 +655,6 @@ _hpreorder(struct hostent *hp)
 #endif
break;
default:
-   free_addrselectpolicy();
return hp;
}
 
___
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: r299921 - head/sbin/ifconfig

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 08:07:32 2016
New Revision: 299921
URL: https://svnweb.freebsd.org/changeset/base/299921

Log:
  Add an assertion to catch a potential underflow in an array index
  calculation, though this should not happen in the current code.
  
  Reported by:  Coverity
  CID:  1008486
  MFC after:3 weeks

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon May 16 08:04:40 2016
(r299920)
+++ head/sbin/ifconfig/ifieee80211.cMon May 16 08:07:32 2016
(r299921)
@@ -3753,6 +3753,7 @@ list_txpow(int s)
/* suppress duplicates as above */
if (isset(reported, c->ic_ieee) && !verbose) {
/* XXX we assume duplicates are adjacent */
+   assert(achans->ic_nchans > 0);
prev = >ic_chans[achans->ic_nchans-1];
/* display highest power on channel */
if (c->ic_maxpower > prev->ic_maxpower)
___
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: r299920 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 08:04:40 2016
New Revision: 299920
URL: https://svnweb.freebsd.org/changeset/base/299920

Log:
  sfxge(4): cleanup: simplify ef10_ev_qcreate
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Mon May 16 07:47:20 2016
(r299919)
+++ head/sys/dev/sfxge/common/ef10_ev.c Mon May 16 08:04:40 2016
(r299920)
@@ -92,8 +92,7 @@ efx_mcdi_init_evq(
__inunsigned int instance,
__inefsys_mem_t *esmp,
__insize_t nevs,
-   __inuint32_t irq,
-   __out_opt   uint32_t *irqp)
+   __inuint32_t irq)
 {
efx_mcdi_req_t req;
uint8_t payload[
@@ -175,8 +174,7 @@ efx_mcdi_init_evq(
goto fail3;
}
 
-   if (irqp != NULL)
-   *irqp = MCDI_OUT_DWORD(req, INIT_EVQ_OUT_IRQ);
+   /* NOTE: ignore the returned IRQ param as firmware does not set it. */
 
return (0);
 
@@ -275,12 +273,9 @@ ef10_ev_qcreate(
eep->ee_drv_gen = ef10_ev_drv_gen;
eep->ee_mcdi= ef10_ev_mcdi;
 
-   /*
-* Set up the event queue
-* NOTE: ignore the returned IRQ param as firmware does not set it.
-*/
+   /* Set up the event queue */
irq = index;/* INIT_EVQ expects function-relative vector number */
-   if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq, NULL)) != 0)
+   if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq)) != 0)
goto fail3;
 
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299919 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 07:47:20 2016
New Revision: 299919
URL: https://svnweb.freebsd.org/changeset/base/299919

Log:
  sfxge(4): translate MC_CMD_ERR_EEXIST to host errno value
  
  This is needed because the new MCDI command nvram_private_append can
  return MC_CMD_ERR_EEXIST
  
  Submitted by:   Tom Millington 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cMon May 16 07:45:43 2016
(r299918)
+++ head/sys/dev/sfxge/common/efx_mcdi.cMon May 16 07:47:20 2016
(r299919)
@@ -632,6 +632,8 @@ efx_mcdi_request_errcode(
return (EALREADY);
 
/* MCDI v2 */
+   case MC_CMD_ERR_EEXIST:
+   return (EEXIST);
 #ifdef MC_CMD_ERR_EAGAIN
case MC_CMD_ERR_EAGAIN:
return (EAGAIN);
___
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: r299918 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 07:45:43 2016
New Revision: 299918
URL: https://svnweb.freebsd.org/changeset/base/299918

Log:
  fxge(4): cleanup: run genfwdef to propogate prior changes to TLV headers
  
  Submitted by:   Andrew Lee 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/ef10_tlv_layout.h

Modified: head/sys/dev/sfxge/common/ef10_tlv_layout.h
==
--- head/sys/dev/sfxge/common/ef10_tlv_layout.h Mon May 16 07:33:56 2016
(r299917)
+++ head/sys/dev/sfxge/common/ef10_tlv_layout.h Mon May 16 07:45:43 2016
(r299918)
@@ -776,6 +776,39 @@ struct tlv_pcie_link_settings {
   uint16_t width; /* Number of lanes */
 };
 
+/* TX event merging config.
+ *
+ * Sets the global maximum number of events for the merging bins, and the
+ * global timeout configuration for the bins, and the global timeout for
+ * empty queues.
+ */
+#define TLV_TAG_TX_EVENT_MERGING_CONFIG(0x1021)
+struct tlv_tx_event_merging_config {
+  uint32_t  tag;
+  uint32_t  length;
+  uint32_t  max_events;
+#define TLV_TX_EVENT_MERGING_CONFIG_MAX_EVENTS_MAX ((1 << 4) - 1)
+  uint32_t  timeout_ns;
+  uint32_t  qempty_timeout_ns; /* Medford only */
+};
+#define TLV_TX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7
+#define TLV_TX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 1400
+#define TLV_TX_EVENT_MERGING_QEMPTY_TIMEOUT_NS_DEFAULT 700
+
+/* Tx vFIFO Low latency configuration 
+ * 
+ * To keep the desired booting behaviour for the switch, it just requires to
+ * know if the low latency mode is enabled.
+ */
+
+#define TLV_TAG_TX_VFIFO_ULL_MODE  (0x1022)
+struct tlv_tx_vfifo_ull_mode {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t  mode;
+#define TLV_TX_VFIFO_ULL_MODE_DEFAULT0
+};
+
 #define TLV_TAG_LICENSE (0x3080)
 
 typedef struct tlv_license {
@@ -784,4 +817,104 @@ typedef struct tlv_license {
   uint8_t   data[];
 } tlv_license_t;
 
+/* TSA NIC IP address configuration
+ *
+ * Sets the TSA NIC IP address statically via configuration tool or dynamically
+ * via DHCP via snooping based on the mode selection (0=Static, 1=DHCP, 
2=Snoop)
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and 
will
+ * be moved to a private partition during TSA development. It is not used in 
any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_TSAN_CONFIG (0x1022)
+
+#define TLV_TSAN_IP_MODE_STATIC (0)
+#define TLV_TSAN_IP_MODE_DHCP   (1)
+#define TLV_TSAN_IP_MODE_SNOOP  (2)
+typedef struct tlv_tsan_config {
+  uint32_t tag;
+  uint32_t length;
+  uint32_t mode;
+  uint32_t ip;
+  uint32_t netmask;
+  uint32_t gateway;
+  uint32_t port;
+  uint32_t bind_retry;
+  uint32_t bind_bkout;
+} tlv_tsan_config_t;
+
+/* TSA Controller IP address configuration
+ *
+ * Sets the TSA Controller IP address statically via configuration tool
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and 
will
+ * be moved to a private partition during TSA development. It is not used in 
any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_TSAC_CONFIG (0x1023)
+
+#define TLV_MAX_TSACS (4)
+typedef struct tlv_tsac_config {
+  uint32_t tag;
+  uint32_t length;
+  uint32_t num_tsacs;
+  uint32_t ip[TLV_MAX_TSACS];
+  uint32_t port[TLV_MAX_TSACS];
+} tlv_tsac_config_t;
+
+/* Binding ticket
+ *
+ * Sets the TSA NIC binding ticket used for binding process between the TSA NIC
+ * and the TSA Controller
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and 
will
+ * be moved to a private partition during TSA development. It is not used in 
any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_BINDING_TICKET  (0x1024)
+
+typedef struct tlv_binding_ticket {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t  bytes[];
+} tlv_binding_ticket_t;
+
+/* Solarflare private key
+ *
+ * Sets the Solareflare private key used for signing during the binding process
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and 
will
+ * be moved to a private partition during TSA development. It is not used in 
any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_PIK_SF  (0x1025)
+
+typedef struct tlv_pik_sf {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t  bytes[];
+} tlv_pik_sf_t;
+
+/* CA root certificate
+ *
+ * Sets the CA root certificate used for TSA Controller verfication during
+ * TLS connection setup between the TSA NIC and the TSA Controller
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and 
will
+ * be moved to a private partition during TSA development. It is not used in 
any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_CA_ROOT_CERT(0x1026)
+
+typedef struct tlv_ca_root_cert {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t  bytes[];
+} tlv_ca_root_cert_t;
+
 #endif /* CI_MGMT_TLV_LAYOUT_H */

svn commit: r299917 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 07:33:56 2016
New Revision: 299917
URL: https://svnweb.freebsd.org/changeset/base/299917

Log:
  sfxge(4): set TSOv2 feature flag on Medford
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/efx_nic.c

Modified: head/sys/dev/sfxge/common/efx_nic.c
==
--- head/sys/dev/sfxge/common/efx_nic.c Mon May 16 07:31:11 2016
(r299916)
+++ head/sys/dev/sfxge/common/efx_nic.c Mon May 16 07:33:56 2016
(r299917)
@@ -307,7 +307,8 @@ efx_nic_create(
EFX_FEATURE_MCDI |
EFX_FEATURE_MAC_HEADER_FILTERS |
EFX_FEATURE_MCDI_DMA |
-   EFX_FEATURE_PIO_BUFFERS;
+   EFX_FEATURE_PIO_BUFFERS |
+   EFX_FEATURE_FW_ASSISTED_TSO_V2;
break;
 #endif /* EFSYS_OPT_MEDFORD */
 
___
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: r299916 - head/sys/kern

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 07:31:11 2016
New Revision: 299916
URL: https://svnweb.freebsd.org/changeset/base/299916

Log:
  vfs_read_dirent: increment ncookies after adding a cookie
  
  It seems that at present vfs_read_dirent() is used only with filesystems
  that do not support cookies, so the bug never manifested itself.
  
  MFC after:1 week

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon May 16 07:29:50 2016(r299915)
+++ head/sys/kern/vfs_subr.cMon May 16 07:31:11 2016(r299916)
@@ -5053,6 +5053,7 @@ vfs_read_dirent(struct vop_readdir_args 
*ap->a_cookies = realloc(*ap->a_cookies,
(*ap->a_ncookies + 1) * sizeof(u_long), M_TEMP, M_WAITOK | M_ZERO);
(*ap->a_cookies)[*ap->a_ncookies] = off;
+   *ap->a_ncookies += 1;
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r299915 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 16 07:29:50 2016
New Revision: 299915
URL: https://svnweb.freebsd.org/changeset/base/299915

Log:
  sfxge(4): improve TX/RX queue error messages
  
  Report the full error descriptor in a form that can be passed to
  firmwaresrc/dpcpu/scripts/evdecode
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Mon May 16 07:24:30 2016
(r299914)
+++ head/sys/dev/sfxge/common/ef10_ev.c Mon May 16 07:29:50 2016
(r299915)
@@ -871,7 +871,9 @@ ef10_ev_mcdi(
 */
enp->en_reset_flags |= EFX_RESET_TXQ_ERR;
 
-   EFSYS_PROBE1(tx_descq_err, uint32_t, MCDI_EV_FIELD(eqp, DATA));
+   EFSYS_PROBE2(tx_descq_err,
+   uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_1),
+   uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_0));
 
/* Inform the driver that a reset is required. */
eecp->eec_exception(arg, EFX_EXCEPTION_TX_ERROR,
@@ -911,7 +913,9 @@ ef10_ev_mcdi(
 */
enp->en_reset_flags |= EFX_RESET_RXQ_ERR;
 
-   EFSYS_PROBE1(rx_descq_err, uint32_t, MCDI_EV_FIELD(eqp, DATA));
+   EFSYS_PROBE2(rx_descq_err,
+   uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_1),
+   uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_0));
 
/* Inform the driver that a reset is required. */
eecp->eec_exception(arg, EFX_EXCEPTION_RX_ERROR,
___
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: r299913 - head/sys/kern

2016-05-16 Thread Andriy Gapon
On 16/05/2016 10:23, Andriy Gapon wrote:
> Author: avg
> Date: Mon May 16 07:23:24 2016
> New Revision: 299913
> URL: https://svnweb.freebsd.org/changeset/base/299913
> 
> Log:
>   dounmount: do not call mountcheckdirs() for mounts with MNT_IGNORE
>   
>   This is a bit hackish, but the flag is currently set only for ZFS
>   snapshots mounted under .zfs.  mountcheckdirs() can change cdir/rdir
>   references to a covered vnode.  But for the said snapshots the covered
>   vnode is really ephemeral and it must never be accessed (except
>   for a few specific cases).
>   
>   To do:  consider removing mountcheckdirs() entirely
>   
>   MFC after:  5 days

This was supposed to be 5 weeks.


-- 
Andriy Gapon
___
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: r299914 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 07:24:30 2016
New Revision: 299914
URL: https://svnweb.freebsd.org/changeset/base/299914

Log:
  zfsctl_ops_snapshot: remove methods should never be called
  
  We pretend that snapshots mounted under .zfs are part of the original
  filesystem and we try very hard to hide vnodes on top of which the snapshots
  are mounted.  Given that I believe that the removed operations should
  never be called.  They might have been called previously because
  of issues fixed in r299906, r299908 and r299913.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 07:23:24 2016(r299913)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 07:24:30 2016(r299914)
@@ -1522,99 +1522,6 @@ zfsctl_snapshot_reclaim(ap)
 }
 
 static int
-zfsctl_traverse_begin(vnode_t **vpp, int lktype)
-{
-
-   VN_HOLD(*vpp);
-   /* Snapshot should be already mounted, but just in case. */
-   if (vn_mountedvfs(*vpp) == NULL)
-   return (ENOENT);
-   return (traverse(vpp, lktype));
-}
-
-static void
-zfsctl_traverse_end(vnode_t *vp, int err)
-{
-
-   if (err == 0)
-   vput(vp);
-   else
-   VN_RELE(vp);
-}
-
-static int
-zfsctl_snapshot_getattr(ap)
-   struct vop_getattr_args /* {
-   struct vnode *a_vp;
-   struct vattr *a_vap;
-   struct ucred *a_cred;
-   } */ *ap;
-{
-   vnode_t *vp = ap->a_vp;
-   int err;
-
-   err = zfsctl_traverse_begin(, LK_SHARED | LK_RETRY);
-   if (err == 0)
-   err = VOP_GETATTR(vp, ap->a_vap, ap->a_cred);
-   zfsctl_traverse_end(vp, err);
-   return (err);
-}
-
-static int
-zfsctl_snapshot_fid(ap)
-   struct vop_fid_args /* {
-   struct vnode *a_vp;
-   struct fid *a_fid;
-   } */ *ap;
-{
-   vnode_t *vp = ap->a_vp;
-   int err;
-
-   err = zfsctl_traverse_begin(, LK_SHARED | LK_RETRY);
-   if (err == 0)
-   err = VOP_VPTOFH(vp, (void *)ap->a_fid);
-   zfsctl_traverse_end(vp, err);
-   return (err);
-}
-
-static int
-zfsctl_snapshot_lookup(ap)
-   struct vop_lookup_args /* {
-   struct vnode *a_dvp;
-   struct vnode **a_vpp;
-   struct componentname *a_cnp;
-   } */ *ap;
-{
-   vnode_t *dvp = ap->a_dvp;
-   vnode_t **vpp = ap->a_vpp;
-   struct componentname *cnp = ap->a_cnp;
-   cred_t *cr = ap->a_cnp->cn_cred;
-   zfsvfs_t *zfsvfs = dvp->v_vfsp->vfs_data;
-   int error;
-
-   if (cnp->cn_namelen != 2 || cnp->cn_nameptr[0] != '.' ||
-   cnp->cn_nameptr[1] != '.') {
-   return (ENOENT);
-   }
-
-   ASSERT(dvp->v_type == VDIR);
-   ASSERT(zfsvfs->z_ctldir != NULL);
-
-   error = zfsctl_root_lookup(zfsvfs->z_ctldir, "snapshot", vpp,
-   NULL, 0, NULL, cr, NULL, NULL, NULL);
-   if (error == 0) {
-   int ltype = VOP_ISLOCKED(dvp);
-   VN_HOLD(*vpp);
-   VOP_UNLOCK(dvp, 0);
-   vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-   VN_RELE(*vpp);
-   vn_lock(dvp, ltype | LK_RETRY);
-   }
-
-   return (error);
-}
-
-static int
 zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
 {
zfsvfs_t *zfsvfs = ap->a_vp->v_vfsp->vfs_data;
@@ -1663,10 +1570,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc
 static struct vop_vector zfsctl_ops_snapshot = {
.vop_default =  _vnodeops,
.vop_inactive = VOP_NULL,
-   .vop_lookup =   zfsctl_snapshot_lookup,
.vop_reclaim =  zfsctl_snapshot_reclaim,
-   .vop_getattr =  zfsctl_snapshot_getattr,
-   .vop_fid =  zfsctl_snapshot_fid,
.vop_vptocnp =  zfsctl_snapshot_vptocnp,
 };
 
___
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: r299913 - head/sys/kern

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 07:23:24 2016
New Revision: 299913
URL: https://svnweb.freebsd.org/changeset/base/299913

Log:
  dounmount: do not call mountcheckdirs() for mounts with MNT_IGNORE
  
  This is a bit hackish, but the flag is currently set only for ZFS
  snapshots mounted under .zfs.  mountcheckdirs() can change cdir/rdir
  references to a covered vnode.  But for the said snapshots the covered
  vnode is really ephemeral and it must never be accessed (except
  for a few specific cases).
  
  To do:consider removing mountcheckdirs() entirely
  
  MFC after:5 days

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Mon May 16 07:19:33 2016(r299912)
+++ head/sys/kern/vfs_mount.c   Mon May 16 07:23:24 2016(r299913)
@@ -1298,7 +1298,8 @@ dounmount(struct mount *mp, int flags, s
 */
if ((flags & MNT_FORCE) &&
VFS_ROOT(mp, LK_EXCLUSIVE, ) == 0) {
-   if (mp->mnt_vnodecovered != NULL)
+   if (mp->mnt_vnodecovered != NULL &&
+   (mp->mnt_flag & MNT_IGNORE) == 0)
mountcheckdirs(fsrootvp, mp->mnt_vnodecovered);
if (fsrootvp == rootvnode) {
vrele(rootvnode);
@@ -1319,7 +1320,8 @@ dounmount(struct mount *mp, int flags, s
if (error && error != ENXIO) {
if ((flags & MNT_FORCE) &&
VFS_ROOT(mp, LK_EXCLUSIVE, ) == 0) {
-   if (mp->mnt_vnodecovered != NULL)
+   if (mp->mnt_vnodecovered != NULL &&
+   (mp->mnt_flag & MNT_IGNORE) == 0)
mountcheckdirs(mp->mnt_vnodecovered, fsrootvp);
if (rootvnode == NULL) {
rootvnode = fsrootvp;
___
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: r299912 - in head: share/man/man9 sys/amd64/include sys/i386/include

2016-05-16 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 16 07:19:33 2016
New Revision: 299912
URL: https://svnweb.freebsd.org/changeset/base/299912

Log:
  atomic: Add testandclear on i386/amd64
  
  Reviewed by:  kib
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6381

Modified:
  head/share/man/man9/atomic.9
  head/sys/amd64/include/atomic.h
  head/sys/i386/include/atomic.h

Modified: head/share/man/man9/atomic.9
==
--- head/share/man/man9/atomic.9Mon May 16 07:12:04 2016
(r299911)
+++ head/share/man/man9/atomic.9Mon May 16 07:19:33 2016
(r299912)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 14, 2015
+.Dd May 12, 2016
 .Dt ATOMIC 9
 .Os
 .Sh NAME
@@ -65,6 +65,8 @@
 .Ft 
 .Fn atomic_swap_ "volatile  *p" " v"
 .Ft int
+.Fn atomic_testandclear_ "volatile  *p" "u_int v"
+.Ft int
 .Fn atomic_testandset_ "volatile  *p" "u_int v"
 .Sh DESCRIPTION
 Each of the atomic operations is guaranteed to be atomic across multiple
@@ -309,6 +311,15 @@ and
 .Dq Li 16
 and do not have any variants with memory barriers at this time.
 .Bl -hang
+.It Fn atomic_testandclear p v
+.Bd -literal -compact
+bit = 1 << (v % (sizeof(*p) * NBBY));
+tmp = (*p & bit) != 0;
+*p &= ~bit;
+return (tmp);
+.Ed
+.El
+.Bl -hang
 .It Fn atomic_testandset p v
 .Bd -literal -compact
 bit = 1 << (v % (sizeof(*p) * NBBY));
@@ -320,6 +331,8 @@ return (tmp);
 .Pp
 The
 .Fn atomic_testandset
+and
+.Fn atomic_testandclear
 functions are only implemented for the types
 .Dq Li int ,
 .Dq Li long
@@ -348,6 +361,8 @@ and
 functions return the value at the specified address.
 The
 .Fn atomic_testandset
+and
+.Fn atomic_testandclear
 function returns the result of the test operation.
 .Sh EXAMPLES
 This example uses the
@@ -425,3 +440,6 @@ and
 .Fn atomic_testandset
 operations were added in
 .Fx 10.0 .
+.Fn atomic_testandclear
+operation was added in
+.Fx 11.0 .

Modified: head/sys/amd64/include/atomic.h
==
--- head/sys/amd64/include/atomic.h Mon May 16 07:12:04 2016
(r299911)
+++ head/sys/amd64/include/atomic.h Mon May 16 07:19:33 2016
(r299912)
@@ -103,6 +103,8 @@ u_int   atomic_fetchadd_int(volatile u_int
 u_long atomic_fetchadd_long(volatile u_long *p, u_long v);
 intatomic_testandset_int(volatile u_int *p, u_int v);
 intatomic_testandset_long(volatile u_long *p, u_int v);
+intatomic_testandclear_int(volatile u_int *p, u_int v);
+intatomic_testandclear_long(volatile u_long *p, u_int v);
 void   atomic_thread_fence_acq(void);
 void   atomic_thread_fence_acq_rel(void);
 void   atomic_thread_fence_rel(void);
@@ -264,6 +266,40 @@ atomic_testandset_long(volatile u_long *
return (res);
 }
 
+static __inline int
+atomic_testandclear_int(volatile u_int *p, u_int v)
+{
+   u_char res;
+
+   __asm __volatile(
+   "   " MPLOCKED ""
+   "   btrl%2,%1 ; "
+   "   setc%0 ;"
+   "# atomic_testandclear_int"
+   : "=q" (res),   /* 0 */
+ "+m" (*p) /* 1 */
+   : "Ir" (v & 0x1f)   /* 2 */
+   : "cc");
+   return (res);
+}
+
+static __inline int
+atomic_testandclear_long(volatile u_long *p, u_int v)
+{
+   u_char res;
+
+   __asm __volatile(
+   "   " MPLOCKED ""
+   "   btrq%2,%1 ; "
+   "   setc%0 ;"
+   "# atomic_testandclear_long"
+   : "=q" (res),   /* 0 */
+ "+m" (*p) /* 1 */
+   : "Jr" ((u_long)(v & 0x3f)) /* 2 */
+   : "cc");
+   return (res);
+}
+
 /*
  * We assume that a = b will do atomic loads and stores.  Due to the
  * IA32 memory model, a simple store guarantees release semantics.
@@ -537,6 +573,7 @@ u_long  atomic_swap_long(volatile u_long 
 #defineatomic_readandclear_32  atomic_readandclear_int
 #defineatomic_fetchadd_32  atomic_fetchadd_int
 #defineatomic_testandset_32atomic_testandset_int
+#defineatomic_testandclear_32  atomic_testandclear_int
 
 /* Operations on 64-bit quad words. */
 #defineatomic_set_64   atomic_set_long
@@ -560,6 +597,7 @@ u_long  atomic_swap_long(volatile u_long 
 #defineatomic_readandclear_64  atomic_readandclear_long
 #defineatomic_fetchadd_64  atomic_fetchadd_long
 #defineatomic_testandset_64atomic_testandset_long
+#defineatomic_testandclear_64  atomic_testandclear_long
 
 /* Operations on pointers. */
 #defineatomic_set_ptr  atomic_set_long

Modified: head/sys/i386/include/atomic.h
==
--- head/sys/i386/include/atomic.h  Mon May 16 07:12:04 2016
(r299911)
+++ 

  1   2   >