svn commit: r334314 - head/sys/net

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 07:14:57 2018
New Revision: 334314
URL: https://svnweb.freebsd.org/changeset/base/334314

Log:
  rt_getifa_fib: don't use ifa but info->rti_ifa
  
  Reported by:  kp

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue May 29 04:23:21 2018(r334313)
+++ head/sys/net/route.cTue May 29 07:14:57 2018(r334314)
@@ -1308,7 +1308,7 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum)
}
if (needref && info->rti_ifa != NULL) {
if (info->rti_ifp == NULL)
-   info->rti_ifp = ifa->ifa_ifp;
+   info->rti_ifp = info->rti_ifa->ifa_ifp;
ifa_ref(info->rti_ifa);
} else
error = ENETUNREACH;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334314 - head/sys/net

2018-05-29 Thread Hans Petter Selasky

On 05/29/18 09:14, Matt Macy wrote:

Author: mmacy
Date: Tue May 29 07:14:57 2018
New Revision: 334314
URL: https://svnweb.freebsd.org/changeset/base/334314

Log:
   rt_getifa_fib: don't use ifa but info->rti_ifa
   
   Reported by:	kp


Modified:
   head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue May 29 04:23:21 2018(r334313)
+++ head/sys/net/route.cTue May 29 07:14:57 2018(r334314)
@@ -1308,7 +1308,7 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum)
}
if (needref && info->rti_ifa != NULL) {
if (info->rti_ifp == NULL)
-   info->rti_ifp = ifa->ifa_ifp;
+   info->rti_ifp = info->rti_ifa->ifa_ifp;
ifa_ref(info->rti_ifa);
} else
error = ENETUNREACH;




Hi,

This and the previous commit solves the panics I see.

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


svn commit: r334315 - stable/11/sys/dev/xen/blkback

2018-05-29 Thread Roger Pau Monné
Author: royger
Date: Tue May 29 07:51:24 2018
New Revision: 334315
URL: https://svnweb.freebsd.org/changeset/base/334315

Log:
  MFC r334027: xen-blkback: do not use state 3
  
  Linux will not connect to a backend that's in state 3
  (XenbusStateInitialised), it needs to be in state 2
  (XenbusStateInitWait) for Linux to attempt to connect to the
  backend.
  
  Approved by:  re (kib)

Modified:
  stable/11/sys/dev/xen/blkback/blkback.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/xen/blkback/blkback.c
==
--- stable/11/sys/dev/xen/blkback/blkback.c Tue May 29 07:14:57 2018
(r334314)
+++ stable/11/sys/dev/xen/blkback/blkback.c Tue May 29 07:51:24 2018
(r334315)
@@ -804,6 +804,9 @@ struct xbb_softc {
 
/** Watch to wait for hotplug script execution */
struct xs_watch   hotplug_watch;
+
+   /** Got the needed data from hotplug scripts? */
+   bool  hotplug_done;
 };
 
 /* Request Processing 
*/
@@ -3308,12 +3311,11 @@ xbb_connect(struct xbb_softc *xbb)
 {
int error;
 
-   if (xenbus_get_state(xbb->dev) != XenbusStateInitialised)
+   if (!xbb->hotplug_done ||
+   (xenbus_get_state(xbb->dev) != XenbusStateInitWait) ||
+   (xbb_collect_frontend_info(xbb) != 0))
return;
 
-   if (xbb_collect_frontend_info(xbb) != 0)
-   return;
-
xbb->flags &= ~XBBF_SHUTDOWN;
 
/*
@@ -3410,6 +3412,7 @@ xbb_shutdown(struct xbb_softc *xbb)
free(xbb->hotplug_watch.node, M_XENBLOCKBACK);
xbb->hotplug_watch.node = NULL;
}
+   xbb->hotplug_done = false;
 
if (xenbus_get_state(xbb->dev) < XenbusStateClosing)
xenbus_set_state(xbb->dev, XenbusStateClosing);
@@ -3690,8 +3693,11 @@ xbb_attach_disk(struct xs_watch *watch, const char **v
return;
}
 
-   /* Tell the front end that we are ready to connect. */
-   xenbus_set_state(dev, XenbusStateInitialised);
+   xbb->hotplug_done = true;
+
+   /* The front end might be waiting for the backend, attach if so. */
+   if (xenbus_get_otherend_state(xbb->dev) == XenbusStateInitialised)
+   xbb_connect(xbb);
 }
 
 /**
@@ -3755,6 +3761,7 @@ xbb_attach(device_t dev)
 * We need to wait for hotplug script execution before
 * moving forward.
 */
+   KASSERT(!xbb->hotplug_done, ("Hotplug scripts already executed"));
watch_path = xs_join(xenbus_get_node(xbb->dev), "physical-device-path");
xbb->hotplug_watch.callback_data = (uintptr_t)dev;
xbb->hotplug_watch.callback = xbb_attach_disk;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334316 - head/sys/teken

2018-05-29 Thread Jean-Sébastien Pédron
Author: dumbbell
Date: Tue May 29 08:41:44 2018
New Revision: 334316
URL: https://svnweb.freebsd.org/changeset/base/334316

Log:
  teken: Fix `sequences` header which was crossing the 80-col boundary
  
  Also, the commented line's columns for `DECID` were not re-aligned in
  r334302.
  
  Reported by:  bde

Modified:
  head/sys/teken/sequences

Modified: head/sys/teken/sequences
==
--- head/sys/teken/sequencesTue May 29 07:51:24 2018(r334315)
+++ head/sys/teken/sequencesTue May 29 08:41:44 2018(r334316)
@@ -29,12 +29,12 @@
 #  AbbrAbbreviation of sequence name
 #  NameSequence name (will be converted to C function name)
 #  SequenceBytes that form the sequence
-#  Arguments   Standard value of arguments passed to this sequence
+#  ArgsStandard value of arguments passed to this sequence
 #  - `n' non-zero number (0 gets converted to 1)
 #  - `r' regular numeric argument
 #  - `v' means a variable number of arguments
 
-# Abbr NameSequence
Arguments
+# Abbr NameSequenceArgs
 CBTCursor Backward Tabulation  ^[ [ Z  n
 CHTCursor Forward Tabulation   ^[ [ I  n
 CNLCursor Next Line^[ [ E  n
@@ -113,4 +113,4 @@ C25SGR  Cons25 set graphic rendition
^[ [ x  r r
 C25VTSWCons25 switch virtual terminal  ^[ [ z  
r
 
 # VT52 compatibility
-#DECID VT52 DECID  ^[ Z
+#DECID VT52 DECID  ^[ Z
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334317 - head/lib/libfetch

2018-05-29 Thread Dag-Erling Smørgrav
Author: des
Date: Tue May 29 10:28:20 2018
New Revision: 334317
URL: https://svnweb.freebsd.org/changeset/base/334317

Log:
  Use __VA_ARGS__ to simplify the DEBUG macro.
  
  MFC after:3 weeks

Modified:
  head/lib/libfetch/common.c
  head/lib/libfetch/common.h
  head/lib/libfetch/fetch.c
  head/lib/libfetch/ftp.c
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/common.c
==
--- head/lib/libfetch/common.c  Tue May 29 08:41:44 2018(r334316)
+++ head/lib/libfetch/common.c  Tue May 29 10:28:20 2018(r334317)
@@ -347,7 +347,7 @@ fetch_connect(const char *host, int port, int af, int 
conn_t *conn = NULL;
int err = 0, sd = -1;
 
-   DEBUG(fprintf(stderr, "---> %s:%d\n", host, port));
+   DEBUGF("---> %s:%d\n", host, port);
 
/* resolve server address */
if (verbose)
@@ -1158,7 +1158,7 @@ fetch_getln(conn_t *conn)
} while (c != '\n');
 
conn->buf[conn->buflen] = '\0';
-   DEBUG(fprintf(stderr, "<<< %s", conn->buf));
+   DEBUGF("<<< %s", conn->buf);
return (0);
 }
 
@@ -1263,7 +1263,7 @@ fetch_putln(conn_t *conn, const char *str, size_t len)
struct iovec iov[2];
int ret;
 
-   DEBUG(fprintf(stderr, ">>> %s\n", str));
+   DEBUGF(">>> %s\n", str);
iov[0].iov_base = __DECONST(char *, str);
iov[0].iov_len = len;
iov[1].iov_base = __DECONST(char *, ENDL);
@@ -1403,13 +1403,13 @@ fetch_netrc_auth(struct url *url)
rewind(f);
while ((word = fetch_read_word(f)) != NULL) {
if (strcmp(word, "default") == 0) {
-   DEBUG(fetch_info("Using default .netrc settings"));
+   DEBUGF("Using default .netrc settings");
break;
}
if (strcmp(word, "machine") == 0 &&
(word = fetch_read_word(f)) != NULL &&
strcasecmp(word, url->host) == 0) {
-   DEBUG(fetch_info("Using .netrc settings for %s", word));
+   DEBUGF("Using .netrc settings for %s", word);
break;
}
}

Modified: head/lib/libfetch/common.h
==
--- head/lib/libfetch/common.h  Tue May 29 08:41:44 2018(r334316)
+++ head/lib/libfetch/common.h  Tue May 29 10:28:20 2018(r334317)
@@ -104,9 +104,16 @@ int fetch_no_proxy_match(const char *);
 #define url_seterr(n)   fetch_seterr(url_errlist, n)
 
 #ifndef NDEBUG
-#define DEBUG(x) do { if (fetchDebug) { x; } } while (0)
+#define DEBUGF(...)\
+   do {\
+   if (fetchDebug) \
+   fprintf(stderr, __VA_ARGS__);   \
+   } while (0)
 #else
-#define DEBUG(x) do { } while (0)
+#define DEBUGF(...)\
+   do {\
+   /* nothing */   \
+   } while (0)
 #endif
 
 /*

Modified: head/lib/libfetch/fetch.c
==
--- head/lib/libfetch/fetch.c   Tue May 29 08:41:44 2018(r334316)
+++ head/lib/libfetch/fetch.c   Tue May 29 10:28:20 2018(r334317)
@@ -444,15 +444,14 @@ nohost:
goto ouch;
}
 
-   DEBUG(fprintf(stderr,
- "scheme:   \"%s\"\n"
- "user: \"%s\"\n"
- "password: \"%s\"\n"
- "host: \"%s\"\n"
- "port: \"%d\"\n"
- "document: \"%s\"\n",
- u->scheme, u->user, u->pwd,
- u->host, u->port, u->doc));
+   DEBUGF("scheme:   \"%s\"\n"
+   "user: \"%s\"\n"
+   "password: \"%s\"\n"
+   "host: \"%s\"\n"
+   "port: \"%d\"\n"
+   "document: \"%s\"\n",
+   u->scheme, u->user, u->pwd,
+   u->host, u->port, u->doc);
 
return (u);
 

Modified: head/lib/libfetch/ftp.c
==
--- head/lib/libfetch/ftp.c Tue May 29 08:41:44 2018(r334316)
+++ head/lib/libfetch/ftp.c Tue May 29 10:28:20 2018(r334317)
@@ -259,7 +259,7 @@ ftp_pwd(conn_t *conn, char *pwd, size_t pwdlen)
return (FTP_PROTOCOL_ERROR);
*dst = '\0';
 #if 0
-   DEBUG(fprintf(stderr, "pwd: [%s]\n", pwd));
+   DEBUGF("pwd: [%s]\n", pwd);
 #endif
return (FTP_OK);
 }
@@ -291,8 +291,8 @@ ftp_cwd(conn_t *conn, const char *file)
if (pwd[i] != file[i])
break;
 #if 0
-  

svn commit: r334319 - head/lib/libfetch

2018-05-29 Thread Dag-Erling Smørgrav
Author: des
Date: Tue May 29 10:29:43 2018
New Revision: 334319
URL: https://svnweb.freebsd.org/changeset/base/334319

Log:
  Fix a few (but far from all) style issues.
  
  MFC after:3 weeks

Modified:
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cTue May 29 10:29:04 2018(r334318)
+++ head/lib/libfetch/http.cTue May 29 10:29:43 2018(r334319)
@@ -780,9 +780,9 @@ http_parse_authenticate(const char *cp, http_auth_chal
goto out;
}
init_http_auth_challenge(cs->challenges[cs->count]);
-   if (!strcasecmp(key, "basic")) {
+   if (strcasecmp(key, "basic") == 0) {
cs->challenges[cs->count]->scheme = HTTPAS_BASIC;
-   } else if (!strcasecmp(key, "digest")) {
+   } else if (strcasecmp(key, "digest") == 0) {
cs->challenges[cs->count]->scheme = HTTPAS_DIGEST;
} else {
cs->challenges[cs->count]->scheme = HTTPAS_UNKNOWN;
@@ -811,25 +811,27 @@ http_parse_authenticate(const char *cp, http_auth_chal
if (lex != HTTPHL_WORD && lex != HTTPHL_STRING)
goto out;
 
-   if (!strcasecmp(key, "realm"))
+   if (strcasecmp(key, "realm") == 0) {
cs->challenges[cs->count]->realm =
-   strdup(value);
-   else if (!strcasecmp(key, "qop"))
+   strdup(value);
+   } else if (strcasecmp(key, "qop") == 0) {
cs->challenges[cs->count]->qop =
-   strdup(value);
-   else if (!strcasecmp(key, "nonce"))
+   strdup(value);
+   } else if (strcasecmp(key, "nonce") == 0) {
cs->challenges[cs->count]->nonce =
-   strdup(value);
-   else if (!strcasecmp(key, "opaque"))
+   strdup(value);
+   } else if (strcasecmp(key, "opaque") == 0) {
cs->challenges[cs->count]->opaque =
-   strdup(value);
-   else if (!strcasecmp(key, "algorithm"))
+   strdup(value);
+   } else if (strcasecmp(key, "algorithm") == 0) {
cs->challenges[cs->count]->algo =
-   strdup(value);
-   else if (!strcasecmp(key, "stale"))
+   strdup(value);
+   } else if (strcasecmp(key, "stale") == 0) {
cs->challenges[cs->count]->stale =
-   strcasecmp(value, "no");
-   /* Else ignore unknown attributes */
+   strcasecmp(value, "no");
+   } else {
+   /* ignore unknown attributes */
+   }
 
/* Comma or Next challenge or End */
lex = http_header_lex(&cp, key);
@@ -1262,8 +1264,8 @@ http_digest_auth(conn_t *conn, const char *hdr, http_a
c->algo = strdup("");
 
if (asprintf(&options, "%s%s%s%s",
-*c->algo? ",algorithm=" : "", c->algo,
-c->opaque? ",opaque=" : "", c->opaque?c->opaque:"")== -1)
+   *c->algo? ",algorithm=" : "", c->algo,
+   c->opaque? ",opaque=" : "", c->opaque?c->opaque:"") < 0)
return (-1);
 
if (!c->qop) {
@@ -1349,8 +1351,8 @@ http_authorize(conn_t *conn, const char *hdr, http_aut
}
 
/* Error if "Digest" was specified and there is no Digest challenge */
-   if (!digest && (parms->scheme &&
-   !strcasecmp(parms->scheme, "digest"))) {
+   if (!digest &&
+   (parms->scheme && strcasecmp(parms->scheme, "digest") == 0)) {
DEBUGF("Digest auth in env, not supported by peer\n");
return (-1);
}
@@ -1359,7 +1361,8 @@ http_authorize(conn_t *conn, const char *hdr, http_aut
 * challenge, do the basic thing. Don't need a challenge for this,
 * so no need to check basic!=NULL
 */
-   if (!digest || (parms->scheme && !strcasecmp(parms->scheme,"basic")))
+   if (!digest ||
+   (parms->scheme && strcasecmp(parms->scheme, "basic") == 0))
return (http_basic_auth(conn,hdr,parms->user,parms->password));
 
/* Else, prefer digest. We just checked that it's not NULL */
@@ -1851,11 +1854,12 @@ http_reque

svn commit: r334318 - head/contrib/tcpdump

2018-05-29 Thread Slava Shwartsman
Author: slavash
Date: Tue May 29 10:29:04 2018
New Revision: 334318
URL: https://svnweb.freebsd.org/changeset/base/334318

Log:
  MFV r333668:
  
  Vendor import two upstream commits:
  c1bb8784abd3ca978e376b0d10e324db0491237b
  9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72
  
  When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP,
  tcpdump will print an error message saying rfmon is not supported.
  
  Give a concise explanation as to how one might solve this problem by
  creating a monitor mode VAP.
  
  MFC after:  1 month
  Approved by:hselasky (mentor), kib (mentor)
  Sponsored by:   Mellanox Technologies

Modified:
  head/contrib/tcpdump/tcpdump.c
Directory Properties:
  head/contrib/tcpdump/   (props changed)

Modified: head/contrib/tcpdump/tcpdump.c
==
--- head/contrib/tcpdump/tcpdump.c  Tue May 29 10:28:20 2018
(r334317)
+++ head/contrib/tcpdump/tcpdump.c  Tue May 29 10:29:04 2018
(r334318)
@@ -77,7 +77,6 @@ The Regents of the University of California.  All righ
  */
 #ifdef HAVE_CAPSICUM
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -114,6 +113,10 @@ The Regents of the University of California.  All righ
 #endif /* HAVE_CAP_NG_H */
 #endif /* HAVE_LIBCAP_NG */
 
+#ifdef __FreeBSD__
+#include 
+#endif /* __FreeBSD__ */
+
 #include "netdissect.h"
 #include "interface.h"
 #include "addrtoname.h"
@@ -1095,6 +1098,10 @@ open_interface(const char *device, netdissect_options 
sysctlbyname(sysctl, parent, &s, NULL, 0);
strlcpy(newdev, device, sizeof(newdev));
/* Suggest a new wlan device. */
+   /* FIXME: incrementing the index this way is not going 
to work well
+* when the index is 9 or greater but the only 
consequence in this
+* specific case would be an error message that looks a 
bit odd.
+*/
newdev[strlen(newdev)-1]++;
error("%s is not a monitor mode VAP\n"
"To create a new monitor mode VAP use:\n"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May 29 11:59:02 2018
New Revision: 334320
URL: https://svnweb.freebsd.org/changeset/base/334320

Log:
  Implement atomic_add_64() and atomic_subtract_64() for the i386 target.
  
  While at it add missing _acq_ and _rel_ variants for 64-bit atomic
  operations under i386.
  
  Reviewed by:  kib @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
  head/sys/cddl/compat/opensolaris/sys/atomic.h
  head/sys/i386/include/atomic.h

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c  Tue May 29 
10:29:43 2018(r334319)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c  Tue May 29 
11:59:02 2018(r334320)
@@ -52,7 +52,8 @@ atomic_init(void)
 }
 #endif
 
-#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64)
+#if !defined(__LP64__) && !defined(__mips_n32) && \
+!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
 void
 atomic_add_64(volatile uint64_t *target, int64_t delta)
 {

Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h
==
--- head/sys/cddl/compat/opensolaris/sys/atomic.h   Tue May 29 10:29:43 
2018(r334319)
+++ head/sys/cddl/compat/opensolaris/sys/atomic.h   Tue May 29 11:59:02 
2018(r334320)
@@ -36,7 +36,8 @@
atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), 
(uintptr_t) (_c))
 #define cas32  atomic_cmpset_32
 
-#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64)
+#if !defined(__LP64__) && !defined(__mips_n32) && \
+!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
 extern void atomic_add_64(volatile uint64_t *target, int64_t delta);
 extern void atomic_dec_64(volatile uint64_t *target);
 #endif
@@ -85,7 +86,8 @@ atomic_dec_32_nv(volatile uint32_t *target)
return (atomic_fetchadd_32(target, -1) - 1);
 }
 
-#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64)
+#if defined(__LP64__) || defined(__mips_n32) || \
+defined(ARM_HAVE_ATOMIC64) || defined(__i386__)
 static __inline void
 atomic_dec_64(volatile uint64_t *target)
 {

Modified: head/sys/i386/include/atomic.h
==
--- head/sys/i386/include/atomic.h  Tue May 29 10:29:43 2018
(r334319)
+++ head/sys/i386/include/atomic.h  Tue May 29 11:59:02 2018
(r334320)
@@ -134,6 +134,8 @@ uint64_tatomic_load_acq_64(volatile uint64_t *);
 void   atomic_store_rel_64(volatile uint64_t *, uint64_t);
 uint64_t   atomic_swap_64(volatile uint64_t *, uint64_t);
 uint64_t   atomic_fetchadd_64(volatile uint64_t *, uint64_t);
+void   atomic_add_64(volatile uint64_t *, uint64_t);
+void   atomic_subtract_64(volatile uint64_t *, uint64_t);
 
 #else /* !KLD_MODULE && __GNUCLIKE_ASM */
 
@@ -581,6 +583,30 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t v)
}
 }
 
+static __inline void
+atomic_add_64(volatile uint64_t *p, uint64_t v)
+{
+   uint64_t t;
+
+   for (;;) {
+   t = *p;
+   if (atomic_cmpset_64(p, t, t + v))
+   break;
+   }
+}
+
+static __inline void
+atomic_subtract_64(volatile uint64_t *p, uint64_t v)
+{
+   uint64_t t;
+
+   for (;;) {
+   t = *p;
+   if (atomic_cmpset_64(p, t, t - v))
+   break;
+   }
+}
+
 #endif /* _KERNEL */
 
 #endif /* KLD_MODULE || !__GNUCLIKE_ASM */
@@ -804,6 +830,16 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
 #defineatomic_fetchadd_32  atomic_fetchadd_int
 #defineatomic_testandset_32atomic_testandset_int
 #defineatomic_testandclear_32  atomic_testandclear_int
+
+/* Operations on 64-bit quad words. */
+#defineatomic_cmpset_acq_64 atomic_cmpset_64
+#defineatomic_cmpset_rel_64 atomic_cmpset_64
+#defineatomic_fetchadd_acq_64  atomic_fetchadd_64
+#defineatomic_fetchadd_rel_64  atomic_fetchadd_64
+#defineatomic_add_acq_64 atomic_add_64
+#defineatomic_add_rel_64 atomic_add_64
+#defineatomic_subtract_acq_64 atomic_subtract_64
+#defineatomic_subtract_rel_64 atomic_subtract_64
 
 /* Operations on pointers. */
 #defineatomic_set_ptr(p, v) \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334324 - in head/sys: netinet netinet6

2018-05-29 Thread Andrey V. Elsukov
Author: ae
Date: Tue May 29 12:32:08 2018
New Revision: 334324
URL: https://svnweb.freebsd.org/changeset/base/334324

Log:
  Remove empty encap_init() function.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/in_proto.c
  head/sys/netinet/ip_encap.c
  head/sys/netinet/ip_encap.h
  head/sys/netinet6/in6_proto.c

Modified: head/sys/netinet/in_proto.c
==
--- head/sys/netinet/in_proto.c Tue May 29 12:30:41 2018(r334323)
+++ head/sys/netinet/in_proto.c Tue May 29 12:32:08 2018(r334324)
@@ -227,7 +227,6 @@ struct protosw inetsw[] = {
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap4_input,
.pr_ctloutput = rip_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip_usrreqs
 },
 {
@@ -237,7 +236,6 @@ struct protosw inetsw[] = {
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap4_input,
.pr_ctloutput = rip_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip_usrreqs
 },
 {
@@ -247,7 +245,6 @@ struct protosw inetsw[] = {
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap4_input,
.pr_ctloutput = rip_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip_usrreqs
 },
 {
@@ -257,7 +254,6 @@ struct protosw inetsw[] = {
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap4_input,
.pr_ctloutput = rip_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip_usrreqs
 },
 # ifdef INET6
@@ -268,7 +264,6 @@ struct protosw inetsw[] = {
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap4_input,
.pr_ctloutput = rip_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip_usrreqs
 },
 #endif

Modified: head/sys/netinet/ip_encap.c
==
--- head/sys/netinet/ip_encap.c Tue May 29 12:30:41 2018(r334323)
+++ head/sys/netinet/ip_encap.c Tue May 29 12:32:08 2018(r334324)
@@ -108,15 +108,6 @@ static struct mtx encapmtx;
 MTX_SYSINIT(encapmtx, &encapmtx, "encapmtx", MTX_DEF);
 static LIST_HEAD(, encaptab) encaptab = LIST_HEAD_INITIALIZER(encaptab);
 
-/*
- * We currently keey encap_init() for source code compatibility reasons --
- * it's referenced by KAME pieces in netinet6.
- */
-void
-encap_init(void)
-{
-}
-
 #ifdef INET
 int
 encap4_input(struct mbuf **mp, int *offp, int proto)

Modified: head/sys/netinet/ip_encap.h
==
--- head/sys/netinet/ip_encap.h Tue May 29 12:30:41 2018(r334323)
+++ head/sys/netinet/ip_encap.h Tue May 29 12:32:08 2018(r334324)
@@ -50,7 +50,6 @@ struct encaptab {
void *arg;  /* passed via m->m_pkthdr.aux */
 };
 
-void   encap_init(void);
 intencap4_input(struct mbuf **, int *, int);
 intencap6_input(struct mbuf **, int *, int);
 const struct encaptab *encap_attach(int, int, const struct sockaddr *,

Modified: head/sys/netinet6/in6_proto.c
==
--- head/sys/netinet6/in6_proto.c   Tue May 29 12:30:41 2018
(r334323)
+++ head/sys/netinet6/in6_proto.c   Tue May 29 12:32:08 2018
(r334324)
@@ -282,7 +282,6 @@ struct protosw inet6sw[] = {
.pr_input = encap6_input,
.pr_output =rip6_output,
.pr_ctloutput = rip6_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip6_usrreqs
 },
 #endif /* INET */
@@ -294,7 +293,6 @@ struct protosw inet6sw[] = {
.pr_input = encap6_input,
.pr_output =rip6_output,
.pr_ctloutput = rip6_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip6_usrreqs
 },
 {
@@ -305,7 +303,6 @@ struct protosw inet6sw[] = {
.pr_input = encap6_input,
.pr_output =rip6_output,
.pr_ctloutput = rip6_ctloutput,
-   .pr_init =  encap_init,
.pr_usrreqs =   &rip6_usrreqs
 },
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Cy Schubert
In message <201805291159.w4tbx3e5085...@repo.freebsd.org>, Hans Petter 
Selasky
writes:
> Author: hselasky
> Date: Tue May 29 11:59:02 2018
> New Revision: 334320
> URL: https://svnweb.freebsd.org/changeset/base/334320
>
> Log:
>   Implement atomic_add_64() and atomic_subtract_64() for the i386 target.
>   
>   While at it add missing _acq_ and _rel_ variants for 64-bit atomic
>   operations under i386.
>   
>   Reviewed by:kib @
>   MFC after:  1 week
>   Sponsored by:   Mellanox Technologies
>
> Modified:
>   head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
>   head/sys/cddl/compat/opensolaris/sys/atomic.h
>   head/sys/i386/include/atomic.h
>
> Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
> =
> =
> --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.cTue May
>  29 10:29:43 2018 (r334319)
> +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.cTue May
>  29 11:59:02 2018 (r334320)
> @@ -52,7 +52,8 @@ atomic_init(void)
>  }
>  #endif
>  
> -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64
> )
> +#if !defined(__LP64__) && !defined(__mips_n32) && \
> +!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
>  void
>  atomic_add_64(volatile uint64_t *target, int64_t delta)
>  {
>
> Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h
> =
> =
> --- head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 10:29:43 201
> 8 (r334319)
> +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 11:59:02 201
> 8 (r334320)
> @@ -36,7 +36,8 @@
>   atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr
> _t) (_c))
>  #define cas32atomic_cmpset_32
>  
> -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64
> )
> +#if !defined(__LP64__) && !defined(__mips_n32) && \
> +!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
>  extern void atomic_add_64(volatile uint64_t *target, int64_t delta);
>  extern void atomic_dec_64(volatile uint64_t *target);
>  #endif
> @@ -85,7 +86,8 @@ atomic_dec_32_nv(volatile uint32_t *target)
>   return (atomic_fetchadd_32(target, -1) - 1);
>  }
>  
> -#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64)
> +#if defined(__LP64__) || defined(__mips_n32) || \
> +defined(ARM_HAVE_ATOMIC64) || defined(__i386__)
>  static __inline void
>  atomic_dec_64(volatile uint64_t *target)
>  {
>
> Modified: head/sys/i386/include/atomic.h
> =
> =
> --- head/sys/i386/include/atomic.hTue May 29 10:29:43 2018(r33431
> 9)
> +++ head/sys/i386/include/atomic.hTue May 29 11:59:02 2018(r33432
> 0)
> @@ -134,6 +134,8 @@ uint64_t  atomic_load_acq_64(volatile uint64_t *);
>  void atomic_store_rel_64(volatile uint64_t *, uint64_t);
>  uint64_t atomic_swap_64(volatile uint64_t *, uint64_t);
>  uint64_t atomic_fetchadd_64(volatile uint64_t *, uint64_t);
> +void atomic_add_64(volatile uint64_t *, uint64_t);
> +void atomic_subtract_64(volatile uint64_t *, uint64_t);
>  
>  #else /* !KLD_MODULE && __GNUCLIKE_ASM */
>  
> @@ -581,6 +583,30 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t v)
>   }
>  }
>  
> +static __inline void
> +atomic_add_64(volatile uint64_t *p, uint64_t v)
> +{
> + uint64_t t;
> +
> + for (;;) {
> + t = *p;
> + if (atomic_cmpset_64(p, t, t + v))
> + break;
> + }
> +}
> +
> +static __inline void
> +atomic_subtract_64(volatile uint64_t *p, uint64_t v)
> +{
> + uint64_t t;
> +
> + for (;;) {
> + t = *p;
> + if (atomic_cmpset_64(p, t, t - v))
> + break;
> + }
> +}
> +
>  #endif /* _KERNEL */
>  
>  #endif /* KLD_MODULE || !__GNUCLIKE_ASM */
> @@ -804,6 +830,16 @@ u_long   atomic_swap_long(volatile u_long *p, u_long v);
>  #define  atomic_fetchadd_32  atomic_fetchadd_int
>  #define  atomic_testandset_32atomic_testandset_int
>  #define  atomic_testandclear_32  atomic_testandclear_int
> +
> +/* Operations on 64-bit quad words. */
> +#define  atomic_cmpset_acq_64 atomic_cmpset_64
> +#define  atomic_cmpset_rel_64 atomic_cmpset_64
> +#define  atomic_fetchadd_acq_64  atomic_fetchadd_64
> +#define  atomic_fetchadd_rel_64  atomic_fetchadd_64
> +#define  atomic_add_acq_64 atomic_add_64
> +#define  atomic_add_rel_64 atomic_add_64
> +#define  atomic_subtract_acq_64 atomic_subtract_64
> +#define  atomic_subtract_rel_64 atomic_subtract_64
>  
>  /* Operations on pointers. */
>  #define  atomic_set_ptr(p, v) \
>

Hi Hans,

This broke in lib32 on an amd64 system.

--- cddl/lib/libnvpair__L ---
In file included from /opt/src/svn-current/sys/cddl/contrib/opensol

svn commit: r334326 - head/lib/libfetch

2018-05-29 Thread Dag-Erling Smørgrav
Author: des
Date: Tue May 29 13:07:36 2018
New Revision: 334326
URL: https://svnweb.freebsd.org/changeset/base/334326

Log:
  Fix an inverted conditional in the netrc code, which would ignore the
  value of $HOME and always use the home directory from the passwd
  database, unless $HOME was unset, in which case it would use (null).
  
  While there, clean up handling of netrcfd and add debugging aids.
  
  MFC after:3 weeks

Modified:
  head/lib/libfetch/common.c
  head/lib/libfetch/fetch.c
  head/lib/libfetch/ftp.c

Modified: head/lib/libfetch/common.c
==
--- head/lib/libfetch/common.c  Tue May 29 12:43:03 2018(r334325)
+++ head/lib/libfetch/common.c  Tue May 29 13:07:36 2018(r334326)
@@ -1361,19 +1361,20 @@ fetch_read_word(FILE *f)
 static int
 fetch_netrc_open(void)
 {
-   const char *p;
+   struct passwd *pwd;
char fn[PATH_MAX];
+   const char *p;
+   int fd, serrno;
 
if ((p = getenv("NETRC")) != NULL) {
+   DEBUGF("NETRC=%s\n", p);
if (snprintf(fn, sizeof(fn), "%s", p) >= (int)sizeof(fn)) {
fetch_info("$NETRC specifies a file name "
"longer than PATH_MAX");
return (-1);
}
} else {
-   if ((p = getenv("HOME")) != NULL) {
-   struct passwd *pwd;
-
+   if ((p = getenv("HOME")) == NULL) {
if ((pwd = getpwuid(getuid())) == NULL ||
(p = pwd->pw_dir) == NULL)
return (-1);
@@ -1382,7 +1383,12 @@ fetch_netrc_open(void)
return (-1);
}
 
-   return (open(fn, O_RDONLY));
+   if ((fd = open(fn, O_RDONLY)) < 0) {
+   serrno = errno;
+   DEBUGF("%s: %s\n", fn, strerror(serrno));
+   errno = serrno;
+   }
+   return (fd);
 }
 
 /*
@@ -1392,24 +1398,32 @@ int
 fetch_netrc_auth(struct url *url)
 {
const char *word;
+   int serrno;
FILE *f;
 
-   if (url->netrcfd == -2)
+   if (url->netrcfd < 0)
url->netrcfd = fetch_netrc_open();
if (url->netrcfd < 0)
return (-1);
-   if ((f = fdopen(url->netrcfd, "r")) == NULL)
+   if ((f = fdopen(url->netrcfd, "r")) == NULL) {
+   serrno = errno;
+   DEBUGF("fdopen(netrcfd): %s", strerror(errno));
+   close(url->netrcfd);
+   url->netrcfd = -1;
+   errno = serrno;
return (-1);
+   }
rewind(f);
+   DEBUGF("searching netrc for %s\n", url->host);
while ((word = fetch_read_word(f)) != NULL) {
if (strcmp(word, "default") == 0) {
-   DEBUGF("Using default .netrc settings");
+   DEBUGF("using default netrc settings\n");
break;
}
if (strcmp(word, "machine") == 0 &&
(word = fetch_read_word(f)) != NULL &&
strcasecmp(word, url->host) == 0) {
-   DEBUGF("Using .netrc settings for %s", word);
+   DEBUGF("using netrc settings for %s\n", word);
break;
}
}
@@ -1441,9 +1455,13 @@ fetch_netrc_auth(struct url *url)
}
}
fclose(f);
+   url->netrcfd = -1;
return (0);
- ferr:
+ferr:
+   serrno = errno;
fclose(f);
+   url->netrcfd = -1;
+   errno = serrno;
return (-1);
 }
 

Modified: head/lib/libfetch/fetch.c
==
--- head/lib/libfetch/fetch.c   Tue May 29 12:43:03 2018(r334325)
+++ head/lib/libfetch/fetch.c   Tue May 29 13:07:36 2018(r334326)
@@ -272,6 +272,7 @@ fetchMakeURL(const char *scheme, const char *host, int
fetch_syserr();
return (NULL);
}
+   u->netrcfd = -1;
 
if ((u->doc = strdup(doc ? doc : "/")) == NULL) {
fetch_syserr();
@@ -286,7 +287,6 @@ fetchMakeURL(const char *scheme, const char *host, int
seturl(pwd);
 #undef seturl
u->port = port;
-   u->netrcfd = -2;
 
return (u);
 }
@@ -352,7 +352,7 @@ fetchParseURL(const char *URL)
fetch_syserr();
return (NULL);
}
-   u->netrcfd = -2;
+   u->netrcfd = -1;
 
/* scheme name */
if ((p = strstr(URL, ":/"))) {

Modified: head/lib/libfetch/ftp.c
==
--- head/lib/libfetch/ftp.c Tue May 29 12:43:03 2018(r334325)
+++ head/lib/libfetch/ftp.c Tue May 29 13:07:36 2018(r334326)
@@ -914,7 +914,8 @@ ftp_authenticate(conn_t *conn, struct url *url, struct
fetch_netrc_a

Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Hans Petter Selasky

On 05/29/18 15:02, Cy Schubert wrote:

In message <201805291159.w4tbx3e5085...@repo.freebsd.org>, Hans Petter
Selasky
writes:

Author: hselasky
Date: Tue May 29 11:59:02 2018
New Revision: 334320
URL: https://svnweb.freebsd.org/changeset/base/334320

Log:
   Implement atomic_add_64() and atomic_subtract_64() for the i386 target.
   
   While at it add missing _acq_ and _rel_ variants for 64-bit atomic

   operations under i386.
   
   Reviewed by:	kib @

   MFC after:   1 week
   Sponsored by:Mellanox Technologies

Modified:
   head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
   head/sys/cddl/compat/opensolaris/sys/atomic.h
   head/sys/i386/include/atomic.h

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
=
=
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c  Tue May
  29 10:29:43 2018  (r334319)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c  Tue May
  29 11:59:02 2018  (r334320)
@@ -52,7 +52,8 @@ atomic_init(void)
  }
  #endif
  
-#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64

)
+#if !defined(__LP64__) && !defined(__mips_n32) && \
+!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
  void
  atomic_add_64(volatile uint64_t *target, int64_t delta)
  {

Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h
=
=
--- head/sys/cddl/compat/opensolaris/sys/atomic.h   Tue May 29 10:29:43 201
8   (r334319)
+++ head/sys/cddl/compat/opensolaris/sys/atomic.h   Tue May 29 11:59:02 201
8   (r334320)
@@ -36,7 +36,8 @@
atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr
_t) (_c))
  #define cas32 atomic_cmpset_32
  
-#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64

)
+#if !defined(__LP64__) && !defined(__mips_n32) && \
+!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
  extern void atomic_add_64(volatile uint64_t *target, int64_t delta);
  extern void atomic_dec_64(volatile uint64_t *target);
  #endif
@@ -85,7 +86,8 @@ atomic_dec_32_nv(volatile uint32_t *target)
return (atomic_fetchadd_32(target, -1) - 1);
  }
  
-#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64)

+#if defined(__LP64__) || defined(__mips_n32) || \
+defined(ARM_HAVE_ATOMIC64) || defined(__i386__)
  static __inline void
  atomic_dec_64(volatile uint64_t *target)
  {

Modified: head/sys/i386/include/atomic.h
=
=
--- head/sys/i386/include/atomic.h  Tue May 29 10:29:43 2018(r33431
9)
+++ head/sys/i386/include/atomic.h  Tue May 29 11:59:02 2018(r33432
0)
@@ -134,6 +134,8 @@ uint64_tatomic_load_acq_64(volatile uint64_t *);
  void  atomic_store_rel_64(volatile uint64_t *, uint64_t);
  uint64_t  atomic_swap_64(volatile uint64_t *, uint64_t);
  uint64_t  atomic_fetchadd_64(volatile uint64_t *, uint64_t);
+void   atomic_add_64(volatile uint64_t *, uint64_t);
+void   atomic_subtract_64(volatile uint64_t *, uint64_t);
  
  #else /* !KLD_MODULE && __GNUCLIKE_ASM */
  
@@ -581,6 +583,30 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t v)

}
  }
  
+static __inline void

+atomic_add_64(volatile uint64_t *p, uint64_t v)
+{
+   uint64_t t;
+
+   for (;;) {
+   t = *p;
+   if (atomic_cmpset_64(p, t, t + v))
+   break;
+   }
+}
+
+static __inline void
+atomic_subtract_64(volatile uint64_t *p, uint64_t v)
+{
+   uint64_t t;
+
+   for (;;) {
+   t = *p;
+   if (atomic_cmpset_64(p, t, t - v))
+   break;
+   }
+}
+
  #endif /* _KERNEL */
  
  #endif /* KLD_MODULE || !__GNUCLIKE_ASM */

@@ -804,6 +830,16 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
  #define   atomic_fetchadd_32  atomic_fetchadd_int
  #define   atomic_testandset_32atomic_testandset_int
  #define   atomic_testandclear_32  atomic_testandclear_int
+
+/* Operations on 64-bit quad words. */
+#defineatomic_cmpset_acq_64 atomic_cmpset_64
+#defineatomic_cmpset_rel_64 atomic_cmpset_64
+#defineatomic_fetchadd_acq_64  atomic_fetchadd_64
+#defineatomic_fetchadd_rel_64  atomic_fetchadd_64
+#defineatomic_add_acq_64 atomic_add_64
+#defineatomic_add_rel_64 atomic_add_64
+#defineatomic_subtract_acq_64 atomic_subtract_64
+#defineatomic_subtract_rel_64 atomic_subtract_64
  
  /* Operations on pointers. */

  #define   atomic_set_ptr(p, v) \



Hi Hans,

This broke in lib32 on an amd64 system.

--- cddl/lib/libnvpair__L ---
In file included from /opt/src/svn-current/sys/cddl/contrib/opensolaris/
common/nvpair/opensolaris_fnvpair.c:29:
In file included from /opt/src/svn-current/cddl/contrib/opensolaris/l

svn commit: r334327 - stable/11/sys/amd64/include

2018-05-29 Thread Konstantin Belousov
Author: kib
Date: Tue May 29 13:24:42 2018
New Revision: 334327
URL: https://svnweb.freebsd.org/changeset/base/334327

Log:
  MFC r334038:
  Enable IBRS when entering an interrupt handler from usermode.
  
  Approved by:  re (marius)

Modified:
  stable/11/sys/amd64/include/asmacros.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/include/asmacros.h
==
--- stable/11/sys/amd64/include/asmacros.h  Tue May 29 13:07:36 2018
(r334326)
+++ stable/11/sys/amd64/include/asmacros.h  Tue May 29 13:24:42 2018
(r334327)
@@ -255,6 +255,7 @@ X\vec_name:
jz  1f  /* yes, leave PCB_FULL_IRET alone */
movqPCPU(CURPCB),%r8
andl$~PCB_FULL_IRET,PCB_FLAGS(%r8)
+   callhandle_ibrs_entry
 1:
.endm
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334328 - in head/sys/cddl/compat/opensolaris: kern sys

2018-05-29 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May 29 13:43:16 2018
New Revision: 334328
URL: https://svnweb.freebsd.org/changeset/base/334328

Log:
  Fix 32-bit buildworld for i386 after r334320.
  
  The 64-bit atomics defined for i386 are currently only available in
  the kernel space.
  
  Found by: cy@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
  head/sys/cddl/compat/opensolaris/sys/atomic.h

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c  Tue May 29 
13:24:42 2018(r334327)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c  Tue May 29 
13:43:16 2018(r334328)
@@ -53,7 +53,7 @@ atomic_init(void)
 #endif
 
 #if !defined(__LP64__) && !defined(__mips_n32) && \
-!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
+!defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64)
 void
 atomic_add_64(volatile uint64_t *target, int64_t delta)
 {

Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h
==
--- head/sys/cddl/compat/opensolaris/sys/atomic.h   Tue May 29 13:24:42 
2018(r334327)
+++ head/sys/cddl/compat/opensolaris/sys/atomic.h   Tue May 29 13:43:16 
2018(r334328)
@@ -36,8 +36,12 @@
atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), 
(uintptr_t) (_c))
 #define cas32  atomic_cmpset_32
 
+#if defined(__i386__) && (defined(_KERNEL) || defined(KLD_MODULE))
+#defineI386_HAVE_ATOMIC64
+#endif
+
 #if !defined(__LP64__) && !defined(__mips_n32) && \
-!defined(ARM_HAVE_ATOMIC64) && !defined(__i386__)
+!defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64)
 extern void atomic_add_64(volatile uint64_t *target, int64_t delta);
 extern void atomic_dec_64(volatile uint64_t *target);
 #endif
@@ -87,7 +91,7 @@ atomic_dec_32_nv(volatile uint32_t *target)
 }
 
 #if defined(__LP64__) || defined(__mips_n32) || \
-defined(ARM_HAVE_ATOMIC64) || defined(__i386__)
+defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64)
 static __inline void
 atomic_dec_64(volatile uint64_t *target)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Hans Petter Selasky

On 05/29/18 15:10, Hans Petter Selasky wrote:

Hi Hans,

This broke in lib32 on an amd64 system.

--- cddl/lib/libnvpair__L ---
In file included from /opt/src/svn-current/sys/cddl/contrib/opensolaris/
common/nvpair/opensolaris_fnvpair.c:29:
In file included from /opt/src/svn-current/cddl/contrib/opensolaris/lib/
libzpool/common/sys/zfs_context.h:74:
/opt/src/svn-current/sys/cddl/compat/opensolaris/sys/atomic.h:94:2:
error: implicit declaration of function 'atomic_subtract_64' is invalid
in C99 [-Werror,-Wimplicit-function-declaration]
 atomic_subtract_64(target, 1);
 ^


I only tested buildkernel i386 LINT + GENERIC with this change. I will 
have a look ASAP.


--HPS


See r334328 .

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


svn commit: r334329 - head/sys/arm64/arm64

2018-05-29 Thread Andrew Turner
Author: andrew
Date: Tue May 29 13:52:25 2018
New Revision: 334329
URL: https://svnweb.freebsd.org/changeset/base/334329

Log:
  On ThunderX2 we need to be careful to only map the memory the firmware
  lists in the EFI memory map. As such we need to reduce the mappings to
  restrict them to not be the full 1G block. For now reduce this to a 2M
  block, however this may be further restricted to be 4k page aligned as
  other SoCs may require.
  
  This allows ThunderX2 to boot reliably to userspace without performing
  any speculative memory accesses to invalid physical memory.
  
  This is a recommit of r334035 now that we can access the EFI Runtime data
  through the DMAP region.
  
  Tested by:tuexen
  Sponsored by: DARPA, AFRL

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

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Tue May 29 13:43:16 2018(r334328)
+++ head/sys/arm64/arm64/pmap.c Tue May 29 13:52:25 2018(r334329)
@@ -590,33 +590,100 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va)
return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET));
 }
 
-static void
-pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, vm_paddr_t max_pa)
+static vm_offset_t
+pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa,
+vm_offset_t freemempos)
 {
+   pt_entry_t *l2;
vm_offset_t va;
-   vm_paddr_t pa;
-   u_int l1_slot;
+   vm_paddr_t l2_pa, pa;
+   u_int l1_slot, l2_slot, prev_l1_slot;
int i;
 
dmap_phys_base = min_pa & ~L1_OFFSET;
dmap_phys_max = 0;
dmap_max_addr = 0;
+   l2 = NULL;
+   prev_l1_slot = -1;
 
+#defineDMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> 
L0_SHIFT)
+   memset(pagetable_dmap, 0, PAGE_SIZE * DMAP_TABLES);
+
for (i = 0; i < (physmap_idx * 2); i += 2) {
-   pa = physmap[i] & ~L1_OFFSET;
+   pa = physmap[i] & ~L2_OFFSET;
va = pa - dmap_phys_base + DMAP_MIN_ADDRESS;
 
-   for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1];
+   /* Create L2 mappings at the start of the region */
+   if ((pa & L1_OFFSET) != 0) {
+   l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT);
+   if (l1_slot != prev_l1_slot) {
+   prev_l1_slot = l1_slot;
+   l2 = (pt_entry_t *)freemempos;
+   l2_pa = pmap_early_vtophys(kern_l1,
+   (vm_offset_t)l2);
+   freemempos += PAGE_SIZE;
+
+   pmap_load_store(&pagetable_dmap[l1_slot],
+   (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE);
+
+   memset(l2, 0, PAGE_SIZE);
+   }
+   KASSERT(l2 != NULL,
+   ("pmap_bootstrap_dmap: NULL l2 map"));
+   for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1];
+   pa += L2_SIZE, va += L2_SIZE) {
+   /*
+* We are on a boundary, stop to
+* create a level 1 block
+*/
+   if ((pa & L1_OFFSET) == 0)
+   break;
+
+   l2_slot = pmap_l2_index(va);
+   KASSERT(l2_slot != 0, ("..."));
+   pmap_load_store(&l2[l2_slot],
+   (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN |
+   ATTR_IDX(CACHED_MEMORY) | L2_BLOCK);
+   }
+   KASSERT(va == (pa - dmap_phys_base + DMAP_MIN_ADDRESS),
+   ("..."));
+   }
+
+   for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1] &&
+   (physmap[i + 1] - pa) >= L1_SIZE;
pa += L1_SIZE, va += L1_SIZE) {
l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT);
-   /* We already have an entry */
-   if (pagetable_dmap[l1_slot] != 0)
-   continue;
pmap_load_store(&pagetable_dmap[l1_slot],
(pa & ~L1_OFFSET) | ATTR_DEFAULT | ATTR_XN |
ATTR_IDX(CACHED_MEMORY) | L1_BLOCK);
}
 
+   /* Create L2 mappings at the end of the region */
+   if (pa < physmap[i + 1]) {
+   l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT);
+   if (l1_slot != prev_l1_slot) {
+   prev_l1_slot = l1_slot;
+   l2 = (pt_entry_t *)freemempos;
+   

svn commit: r334330 - stable/11/sys/amd64/include

2018-05-29 Thread John Baldwin
Author: jhb
Date: Tue May 29 13:54:34 2018
New Revision: 334330
URL: https://svnweb.freebsd.org/changeset/base/334330

Log:
  MFC 333606: Make the common interrupt entry point labels local labels.
  
  Kernel debuggers depend on symbol names to find stack frames with a
  trapframe rather than a normal stack frame.  The labels used for the
  shared interrupt entry point for the PTI and non-PTI cases did not
  match the existing patterns confusing debuggers.  Add the '.L' prefix
  to mark these symbols as local so they are not visible in the symbol
  table.
  
  Approved by:  re (kib)

Modified:
  stable/11/sys/amd64/include/asmacros.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/include/asmacros.h
==
--- stable/11/sys/amd64/include/asmacros.h  Tue May 29 13:52:25 2018
(r334329)
+++ stable/11/sys/amd64/include/asmacros.h  Tue May 29 13:54:34 2018
(r334330)
@@ -218,9 +218,9 @@ X\name\()_pti:
.type   X\vec_name\()_pti,@function
 X\vec_name\()_pti:
testb   $SEL_RPL_MASK,PTI_CS-3*8(%rsp) /* err, %rax, %rdx not pushed */
-   jz  \vec_name\()_u
+   jz  .L\vec_name\()_u
PTI_UENTRY has_err=0
-   jmp \vec_name\()_u
+   jmp .L\vec_name\()_u
.endm
 
.macro  INTR_PUSH_FRAME vec_name
@@ -229,9 +229,9 @@ X\vec_name\()_pti:
.type   X\vec_name,@function
 X\vec_name:
testb   $SEL_RPL_MASK,PTI_CS-3*8(%rsp) /* come from kernel? */
-   jz  \vec_name\()_u  /* Yes, dont swapgs again */
+   jz  .L\vec_name\()_u/* Yes, dont swapgs again */
swapgs
-\vec_name\()_u:
+.L\vec_name\()_u:
subq$TF_RIP,%rsp/* skip dummy tf_err and tf_trapno */
movq%rdi,TF_RDI(%rsp)
movq%rsi,TF_RSI(%rsp)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Cy Schubert
In message , Hans 
Petter Sela
sky writes:
> On 05/29/18 15:10, Hans Petter Selasky wrote:
> >> Hi Hans,
> >>
> >> This broke in lib32 on an amd64 system.
> >>
> >> --- cddl/lib/libnvpair__L ---
> >> In file included from /opt/src/svn-current/sys/cddl/contrib/opensolaris/
> >> common/nvpair/opensolaris_fnvpair.c:29:
> >> In file included from /opt/src/svn-current/cddl/contrib/opensolaris/lib/
> >> libzpool/common/sys/zfs_context.h:74:
> >> /opt/src/svn-current/sys/cddl/compat/opensolaris/sys/atomic.h:94:2:
> >> error: implicit declaration of function 'atomic_subtract_64' is invalid
> >> in C99 [-Werror,-Wimplicit-function-declaration]
> >>          atomic_subtract_64(target, 1);
> >>          ^
> > 
> > I only tested buildkernel i386 LINT + GENERIC with this change. I will 
> > have a look ASAP.
> > 
> > --HPS
>
> See r334328 .

Thanks. I'll let it build while I'm at $JOB and check it at noon.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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


Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Ed Maste
On 29 May 2018 at 09:10, Hans Petter Selasky  wrote:
>
> I only tested buildkernel i386 LINT + GENERIC with this change. I will have
> a look ASAP.

On IRC the suggestion was made to run buildworld for any header
change, and I think this seems like a reasonable standard.

Our full buildworld times are admittedly quite long, so if you have a
suitably up-to-date toolchain on the build host you can skip building
toolchain components with something like:

make -DWITHOUT_TOOLCHAIN -DWITHOUT_CLANG_BOOTSTRAP
-DWITHOUT_LLD_BOOTSTRAP buildworld

That should give much of the build coverage benefit without taking so
long. On my little NUC desktop (with -j8) this took about 30 minutes.

In addition many folks have put a lot of effort into making non-clean
builds work - both meta-mode and conventional. I've generally been
building with -DNO_CLEAN for a few years now. The same build with
-DNO_CLEAN added and after `touch atomic.h` (again on the NUC) took
about 3 minutes.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334331 - head/sys/dev/usb

2018-05-29 Thread Eitan Adler
Author: eadler
Date: Tue May 29 14:04:50 2018
New Revision: 334331
URL: https://svnweb.freebsd.org/changeset/base/334331

Log:
  [usbdevs] Add USB product ID for Philips SPC N900 CCD Webcam
  
  PR:   228488
  Submitted by: "Harald Schmalzbauer" 

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue May 29 13:54:34 2018(r334330)
+++ head/sys/dev/usb/usbdevsTue May 29 14:04:50 2018(r334331)
@@ -3592,6 +3592,7 @@ product PHILIPS DSS   0x0104  DSS XXX Digital 
Speaker Sy
 product PHILIPS HUB0x0201  hub
 product PHILIPS PCA646VC   0x0303  PCA646VC PC Camera
 product PHILIPS PCVC680K   0x0308  PCVC680K Vesta Pro PC Camera
+product PHILIPS SPC900NC   0x0329  SPC 900NC CCD PC Camera
 product PHILIPS DSS150 0x0471  DSS 150 Digital Speaker System
 product PHILIPS ACE10010x066a  AKTAKOM ACE-1001 cable
 product PHILIPS SPE3030CC  0x083a  USB 2.0 External Disk
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334332 - in head: share/man/man4 sys/conf sys/dev/mlx5 sys/dev/mlx5/mlx5_core sys/dev/mlx5/mlx5_en sys/modules/mlx5 sys/modules/mlx5en sys/modules/mlx5ib

2018-05-29 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May 29 14:04:57 2018
New Revision: 334332
URL: https://svnweb.freebsd.org/changeset/base/334332

Log:
  Add support for hardware rate limiting to mlx5en(4).
  
  The hardware rate limiting feature is enabled by the RATELIMIT kernel
  option. Please refer to ifconfig(8) and the txrtlmt option and the
  SO_MAX_PACING_RATE set socket option for more information. This
  feature is compatible with hardware transmit send offload, TSO.
  
  A set of sysctl(8) knobs under dev.mce..rate_limit are provided to
  setup the ratelimit table and also to fine tune various rate limit
  related parameters.
  
  Sponsored by: Mellanox Technologies

Added:
  head/sys/dev/mlx5/mlx5_core/mlx5_rl.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/en_rl.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c   (contents, props changed)
Modified:
  head/share/man/man4/mlx5en.4
  head/sys/conf/files
  head/sys/conf/options
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  head/sys/modules/mlx5/Makefile
  head/sys/modules/mlx5en/Makefile
  head/sys/modules/mlx5ib/Makefile

Modified: head/share/man/man4/mlx5en.4
==
--- head/share/man/man4/mlx5en.4Tue May 29 14:04:50 2018
(r334331)
+++ head/share/man/man4/mlx5en.4Tue May 29 14:04:57 2018
(r334332)
@@ -24,18 +24,19 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 3, 2015
+.Dd May 29, 2018
 .Dt MLX5EN 4
 .Os
 .Sh NAME
 .Nm mlx5en
-.Nd "Mellanox ConnectX-4 and ConnectX-4 LX based 100Gb, 50Gb, 40Gb, 25Gb and 
10Gb Ethernet adapter driver"
+.Nd "Mellanox ConnectX-4, ConnectX-4 LX and ConnectX-5 based 100Gb, 50Gb, 
40Gb, 25Gb and 10Gb Ethernet adapter driver"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "options COMPAT_LINUXKPI"
+.Cd "options RATELIMIT"
 .Cd "device mlx5"
 .Cd "device mlx5en"
 .Ed
@@ -56,11 +57,12 @@ mlx5en_load="YES"
 The
 .Nm
 driver provides support for PCI Express Ethernet adapters based on
-ConnectX-4 and ConnectX-4 LX.
+ConnectX-4, ConnectX-4 LX and ConnectX-5.
 The driver supports Jumbo Frames, Transmit/Receive checksum offload,
 TCP segmentation offload (TSO), Large Receive Offload (LRO),
 HW Large Receive Offload (HW LRO), VLAN tag insertion/extraction,
-VLAN checksum offload, VLAN TSO, and Receive Side Steering (RSS).
+VLAN checksum offload, VLAN TSO, hardware rate limiting (TXRTLMT)
+and Receive Side Steering (RSS).
 .br
 The network interface is named mce.
 .br
@@ -74,6 +76,7 @@ For more information on configuring this device, see
 The
 .Nm
 driver supports 100Gb, 50Gb, 40Gb, 25Gb and 10Gb Ethernet adapters.
+ConnectX-5 supports:10/20/25/40/50/56/100Gb/s speeds.
 ConnectX-4 supports:10/20/25/40/50/56/100Gb/s speeds.
 ConnectX-4 LX supports:10/25/40/50Gb/s speeds (and reduced power consumption) :
 .Pp

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue May 29 14:04:50 2018(r334331)
+++ head/sys/conf/files Tue May 29 14:04:57 2018(r334332)
@@ -4775,6 +4775,8 @@ dev/mlx5/mlx5_core/mlx5_port.c
optional mlx5 pci   \
compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_qp.c   optional mlx5 pci   \
compile-with "${OFED_C}"
+dev/mlx5/mlx5_core/mlx5_rl.c   optional mlx5 pci   \
+   compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_srq.c  optional mlx5 pci   \
compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_transobj.c optional mlx5 pci   \
@@ -4797,6 +4799,8 @@ dev/mlx5/mlx5_en/mlx5_en_tx.c 
optional mlx5en pci in
 dev/mlx5/mlx5_en/mlx5_en_flow_table.c  optional mlx5en pci inet inet6  
\
compile-with "${OFED_C}"
 dev/mlx5/mlx5_en/mlx5_en_rx.c  optional mlx5en pci inet inet6  
\
+   compile-with "${OFED_C}"
+dev/mlx5/mlx5_en/mlx5_en_rl.c  optional mlx5en pci inet inet6  
\
compile-with "${OFED_C}"
 dev/mlx5/mlx5_en/mlx5_en_txrx.coptional mlx5en pci 
inet inet6  \
compile-with "${OFED_C}"

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue May 29 14:04:50 2018(r334331)
+++ head/sys/conf/options   Tue May 29 14:04:57 2018(r334332)
@@ -420,6 +420,7 @@ BOOTP_WIRED_TO  opt_bootp.h
 DEVICE_POLLING
 DUMMYNET   opt_ipdn.h
 RATELIMIT  opt_ratelimit.h
+RATELIMIT_DEBUGopt_ratelimit.h
 INET   opt_inet.h
 INET6  opt_inet6.h
 IPDIVERT

Modified: head/sys/dev/mlx5/driv

svn commit: r334333 - head/sys/dev/usb

2018-05-29 Thread Eitan Adler
Author: eadler
Date: Tue May 29 14:04:58 2018
New Revision: 334333
URL: https://svnweb.freebsd.org/changeset/base/334333

Log:
  [usbdevs] add several intel product identifiers

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue May 29 14:04:57 2018(r334332)
+++ head/sys/dev/usb/usbdevsTue May 29 14:04:58 2018(r334333)
@@ -2521,6 +2521,10 @@ product INTEL2 IRMH  0x0020  Integrated Rate 
Mat
 product INTEL2 IRMH2   0x0024  Integrated Rate Matching Hub
 product INTEL2 IRMH3   0x8000  Integrated Rate Matching Hub
 product INTEL2 IRMH4   0x8008  Integrated Rate Matching Hub
+product INTEL2 SFP 0x0aa7  Sandy Peak (3168) Bluetooth Module
+product INTEL2 JFP 0x0aaa  Jefferson Peak (9460/9560) Bluetooth 
Module
+product INTEL2 THP 0x0025  Thunder Peak (9160/9260) Bluetooth 
Module
+product INTEL2 HSP 0x0026  Harrison Peak (22560) Bluetooth Modu
 
 /* Interbiometric products */
 product INTERBIOMETRICS IOBOARD0x1002  FTDI compatible adapter
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334334 - head/sys/dev/usb

2018-05-29 Thread Eitan Adler
Author: eadler
Date: Tue May 29 14:08:06 2018
New Revision: 334334
URL: https://svnweb.freebsd.org/changeset/base/334334

Log:
  [usbdevs] add misig letters

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue May 29 14:04:58 2018(r334333)
+++ head/sys/dev/usb/usbdevsTue May 29 14:08:06 2018(r334334)
@@ -2524,7 +2524,7 @@ product INTEL2 IRMH4  0x8008  Integrated Rate 
Ma
 product INTEL2 SFP 0x0aa7  Sandy Peak (3168) Bluetooth Module
 product INTEL2 JFP 0x0aaa  Jefferson Peak (9460/9560) Bluetooth 
Module
 product INTEL2 THP 0x0025  Thunder Peak (9160/9260) Bluetooth 
Module
-product INTEL2 HSP 0x0026  Harrison Peak (22560) Bluetooth Modu
+product INTEL2 HSP 0x0026  Harrison Peak (22560) Bluetooth Module
 
 /* Interbiometric products */
 product INTERBIOMETRICS IOBOARD0x1002  FTDI compatible adapter
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Hans Petter Selasky

On 05/29/18 16:00, Ed Maste wrote:

On IRC the suggestion was made to run buildworld for any header
change, and I think this seems like a reasonable standard.

Our full buildworld times are admittedly quite long, so if you have a
suitably up-to-date toolchain on the build host you can skip building
toolchain components with something like:

make -DWITHOUT_TOOLCHAIN -DWITHOUT_CLANG_BOOTSTRAP
-DWITHOUT_LLD_BOOTSTRAP buildworld


Hi,

Thanks for the tip w.r.t. getting clang out of the buildworld.

Maybe this can be written down on some Wikipage . freebsd . org ?

The title could be "Who are my dependencies when changing code?", and it 
should answer the following questions like some kind of flow graph:


- Shortcuts for kernel builds.
- Shortcuts for user-space builds.
- Shortcuts for ports interactions.

- When do I only need to build a kernel module.
- When do I only need to build a single utility.
- When do I do a full kernel build.
- When do I do a full user-space build.
- When do I do a universe build.
- When do I ask ports guys for help.

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


svn commit: r334335 - head/sys/dev/usb

2018-05-29 Thread Eitan Adler
Author: eadler
Date: Tue May 29 14:37:48 2018
New Revision: 334335
URL: https://svnweb.freebsd.org/changeset/base/334335

Log:
  [usbdevs] add AMD vendor ids
  
  - also more fully spell the name of ATI for ATI2

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue May 29 14:08:06 2018(r334334)
+++ head/sys/dev/usb/usbdevsTue May 29 14:37:48 2018(r334335)
@@ -507,7 +507,7 @@ vendor HAL  0x0b41  HAL Corporation
 vendor EMS 0x0b43  EMS Production
 vendor NEC20x0b62  NEC
 vendor ADLINK  0x0b63  ADLINK Technoligy, Inc.
-vendor ATI20x0b6f  ATI
+vendor ATI20x0b6f  ATI Technologies
 vendor ZEEVO   0x0b7a  Zeevo, Inc.
 vendor KURUSUGAWA  0x0b7e  Kurusugawa Electronics, Inc.
 vendor SMART   0x0b8c  Smart Technologies
@@ -579,6 +579,7 @@ vendor MOTOROLA40x100d  Motorola
 vendor HP3 0x103c  Hewlett Packard
 vendor AIRPLUS 0x1011  Airplus
 vendor DESKNOTE0x1019  Desknote
+vendor AMD20x1022  Advanced Micro Devices
 vendor NEC30x1033  NEC
 vendor TTI 0x103e  Thurlby Thandar Instruments
 vendor GIGABYTE0x1044  GIGABYTE
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334336 - head/sys/dev/usb

2018-05-29 Thread Eitan Adler
Author: eadler
Date: Tue May 29 14:40:50 2018
New Revision: 334336
URL: https://svnweb.freebsd.org/changeset/base/334336

Log:
  [usbdevs] add several GENESYS product ids
  
  Add USB product ID for two GENESYS LOGIC ICs, found in DELOCK
  In-Desk-Hub 61991
  
  PR:   228489
  Submitted by: "Harald Schmalzbauer" 
  MFC After:3 weeks

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue May 29 14:37:48 2018(r334335)
+++ head/sys/dev/usb/usbdevsTue May 29 14:40:50 2018(r334336)
@@ -2201,9 +2201,12 @@ product GENESYS GL620USB 0x0501  GL620USB Host-Host int
 product GENESYS GL650  0x0604  GL650 HUB
 product GENESYS GL606  0x0606  GL606 USB 2.0 HUB
 product GENESYS GL850G 0x0608  GL850G USB 2.0 HUB
+product GENESYS GL3520_2   0x0610  GL3520 4-Port USB 2.0 DataPath
+product GENESYS GL3520_SS  0x0616  GL3520 4-Port USB 3.0 DataPath
 product GENESYS GL641USB   0x0700  GL641USB CompactFlash Card Reader
 product GENESYS GL641USB2IDE_2 0x0701  GL641USB USB-IDE Bridge No 2
 product GENESYS GL641USB2IDE   0x0702  GL641USB USB-IDE Bridge
+product GENESYS GL3233 0x0743  GL3233 USB 3.0 AiO Card Reader
 product GENESYS GL641USB_2 0x0760  GL641USB 6-in-1 Card Reader
 
 /* GIGABYTE products */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334337 - head/release/amd64

2018-05-29 Thread Ed Maste
Author: emaste
Date: Tue May 29 15:06:13 2018
New Revision: 334337
URL: https://svnweb.freebsd.org/changeset/base/334337

Log:
  switch amd64 memstick installer images to MBR
  
  A good number of BIOSes have trouble booting from GPT in non-UEFI mode.
  This is commonly reported with Lenovo desktops and laptops (including
  X220, X230, T430, and E31) and Dell systems.  Although UEFI is the
  preferred amd64 boot method on recent hardware, older hardware does not
  support UEFI, a user may wish to boot via BIOS/CSM, and some systems
  that support UEFI fail to boot FreeBSD via UEFI (such as an old
  AMD FX-6100 that I have).
  
  With this change amd64 memsticks remain dual-mode (booting from either
  UEFI or CSM); the partitioning type is just switched from GPT to MBR.
  
  The "vestigial swap partition" in the GPT scheme was added in r265017 to
  work around some issue with loader's GPT support, so we should not need
  it when using MBR.
  
  There is some concern that future UEFI systems may not boot from MBR,
  but I am not aware of any today.  In any case the likely path forward
  for our installers is to migrate to CD/USB combo images, and if it
  becomes necessary introduce a separate memstick specifically for the
  MBR BIOS/CSM case.
  
  PR:   227954
  Reviewed by:  gjb, imp, tsoome
  MFC after:3 days
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D15599

Modified:
  head/release/amd64/make-memstick.sh

Modified: head/release/amd64/make-memstick.sh
==
--- head/release/amd64/make-memstick.sh Tue May 29 14:40:50 2018
(r334336)
+++ head/release/amd64/make-memstick.sh Tue May 29 15:06:13 2018
(r334337)
@@ -36,12 +36,11 @@ makefs -B little -o label=FreeBSD_Install -o version=2
 rm ${1}/etc/fstab
 rm ${1}/etc/rc.conf.local
 
-mkimg -s gpt \
--b ${1}/boot/pmbr \
+mkimg -s mbr \
+-b ${1}/boot/mbr \
 -p efi:=${1}/boot/boot1.efifat \
--p freebsd-boot:=${1}/boot/gptboot \
--p freebsd-ufs:=${2}.part \
--p freebsd-swap::1M \
+-p freebsd:-"mkimg -s bsd -b ${1}/boot/boot -p freebsd-ufs:=${2}.part" \
+-a 2 \
 -o ${2}
 rm ${2}.part
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include

2018-05-29 Thread Warner Losh
On Tue, May 29, 2018 at 8:16 AM, Hans Petter Selasky 
wrote:

> On 05/29/18 16:00, Ed Maste wrote:
>
>> On IRC the suggestion was made to run buildworld for any header
>> change, and I think this seems like a reasonable standard.
>>
>> Our full buildworld times are admittedly quite long, so if you have a
>> suitably up-to-date toolchain on the build host you can skip building
>> toolchain components with something like:
>>
>> make -DWITHOUT_TOOLCHAIN -DWITHOUT_CLANG_BOOTSTRAP
>> -DWITHOUT_LLD_BOOTSTRAP buildworld
>>
>
> Hi,
>
> Thanks for the tip w.r.t. getting clang out of the buildworld.
>
> Maybe this can be written down on some Wikipage . freebsd . org ?
>
> The title could be "Who are my dependencies when changing code?", and it
> should answer the following questions like some kind of flow graph:
>
> - Shortcuts for kernel builds.
>

-DNO_CLEAN is the safest. KERNFAST=config will skip some steps when doing
iterative development (like config and depend), so it's more dangerous, but
often suffices.


> - Shortcuts for user-space builds.
>

For non-major stuff, I do a -DNO_CLEAN build as a sanity check. I hesitate
to enshrine too many shortcuts here because we want the buildworld path
well tested because that's the path users take. Anything beyond -DNO_CLEAN
likely is too risky.


> - Shortcuts for ports interactions.
>

There are no shortcuts here. Only driving fast and taking chances.


> - When do I only need to build a kernel module.
>

When you only changed .c or .s files that are used by the module. Even
then, there are some build failure that can happen in the kernel and not
the module and vice-versa.


> - When do I only need to build a single utility.
>

Only changed .c files and those .c files aren't used elsewhere in the tree.


> - When do I do a full kernel build.
>

Changing config and/or any .h file.


> - When do I do a full user-space build.
>

Changing any .h file, or altering anything in a library.


> - When do I do a universe build.
>

Any change to any printf :). Any time you change the MI/MD interface in the
kernel. Any time you have code that might be architecturally different
(this is hard to know)


> - When do I ask ports guys for help.


Anytime you change the userland API :).

The advice in the developer's handbook has grown stale. We should update
that. But machines are fast these days, and too many short-cuts has
historically caused problems. There's rarely a need to rush things in so
fast you can't build the system. I amortize the build times over several
changes at once using git svn to curate / manage the changes until they are
good. Also, you really should be running the changes you make. Ideally,
you'd test boot the whole system, but that's overkill if you fixed a
smelling error in ls.

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


Re: svn commit: r334337 - head/release/amd64

2018-05-29 Thread Kirill Ponomarev
On 05/29, Ed Maste wrote:
> Author: emaste
> Date: Tue May 29 15:06:13 2018
> New Revision: 334337
> URL: https://svnweb.freebsd.org/changeset/base/334337
> 
> Log:
>   switch amd64 memstick installer images to MBR
>   
>   A good number of BIOSes have trouble booting from GPT in non-UEFI mode.
>   This is commonly reported with Lenovo desktops and laptops (including
>   X220, X230, T430, and E31) and Dell systems.

Including X1 Carbon 6th Gen. as well.


signature.asc
Description: PGP signature


svn commit: r334338 - head/sys/x86/x86

2018-05-29 Thread Andriy Gapon
Author: avg
Date: Tue May 29 16:03:53 2018
New Revision: 334338
URL: https://svnweb.freebsd.org/changeset/base/334338

Log:
  fix x86 UP build broken by r334204, TSC resynchronization
  
  Reported by:  bde
  MFC after:1 week
  X-MFC with:   r334204

Modified:
  head/sys/x86/x86/tsc.c

Modified: head/sys/x86/x86/tsc.c
==
--- head/sys/x86/x86/tsc.c  Tue May 29 15:06:13 2018(r334337)
+++ head/sys/x86/x86/tsc.c  Tue May 29 16:03:53 2018(r334338)
@@ -505,19 +505,6 @@ retry:
 
 #undef N
 
-#else
-
-/*
- * The function is not called, it is provided to avoid linking failure
- * on uniprocessor kernel.
- */
-static int
-test_tsc(int adj_max_count __unused)
-{
-
-   return (0);
-}
-
 #endif /* SMP */
 
 static void
@@ -578,9 +565,12 @@ init_TSC_tc(void)
 * non-zero value.  The TSC seems unreliable in virtualized SMP
 * environments, so it is set to a negative quality in those cases.
 */
+#ifdef SMP
if (mp_ncpus > 1)
tsc_timecounter.tc_quality = test_tsc(smp_tsc_adjust);
-   else if (tsc_is_invariant)
+   else
+#endif /* SMP */
+   if (tsc_is_invariant)
tsc_timecounter.tc_quality = 1000;
max_freq >>= tsc_shift;
 
@@ -618,6 +608,7 @@ SYSINIT(tsc_tc, SI_SUB_SMP, SI_ORDER_ANY, init_TSC_tc,
 void
 resume_TSC(void)
 {
+#ifdef SMP
int quality;
 
/* If TSC was not good on boot, it is unlikely to become good now. */
@@ -637,6 +628,7 @@ resume_TSC(void)
tsc_timecounter.tc_quality, quality);
tsc_timecounter.tc_quality = quality;
}
+#endif /* SMP */
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334339 - head/sbin/savecore

2018-05-29 Thread Mark Johnston
Author: markj
Date: Tue May 29 16:04:53 2018
New Revision: 334339
URL: https://svnweb.freebsd.org/changeset/base/334339

Log:
  The extension for zstd-compressed files is ".zst".
  
  Reported by:  manu

Modified:
  head/sbin/savecore/savecore.c

Modified: head/sbin/savecore/savecore.c
==
--- head/sbin/savecore/savecore.c   Tue May 29 16:03:53 2018
(r334338)
+++ head/sbin/savecore/savecore.c   Tue May 29 16:04:53 2018
(r334339)
@@ -305,7 +305,7 @@ symlinks_remove(void)
(void)unlink("key.last");
(void)unlink("vmcore.last");
(void)unlink("vmcore.last.gz");
-   (void)unlink("vmcore.last.zstd");
+   (void)unlink("vmcore.last.zst");
(void)unlink("vmcore_encrypted.last");
(void)unlink("vmcore_encrypted.last.gz");
(void)unlink("textdump.tar.last");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334340 - in head/sys: dev/uart kern sys x86/acpica

2018-05-29 Thread Andriy Gapon
Author: avg
Date: Tue May 29 16:16:24 2018
New Revision: 334340
URL: https://svnweb.freebsd.org/changeset/base/334340

Log:
  add support for console resuming, implement it for uart, use on x86
  
  This change adds a new optional console method cn_resume and a kernel
  console interface cnresume.  Consoles that may need to re-initialize
  their hardware after suspend (e.g., because firmware does not care to do
  it) will implement cn_resume.  Note that it is called in rather early
  environment not unlike early boot, so the same restrictions apply.
  Platform specific code, for platforms that support hardware suspend,
  should call cnresume early after resume, before any console output is
  expected.
  
  This change fixes a problem with a system of mine failing to resume when
  a serial console is used.  I found that the serial port was in a strange
  configuration and an attempt to write to it likely resulted in an
  infinite loop.
  
  To avoid adding cn_resume method to every console driver, CONSOLE_DRIVER
  macro has been extended to support optional methods.
  
  Reviewed by:  imp, mav
  MFC after:3 weeks
  Differential Revision: https://reviews.freebsd.org/D15552

Modified:
  head/sys/dev/uart/uart_tty.c
  head/sys/kern/kern_cons.c
  head/sys/sys/cons.h
  head/sys/x86/acpica/acpi_wakeup.c

Modified: head/sys/dev/uart/uart_tty.c
==
--- head/sys/dev/uart/uart_tty.cTue May 29 16:04:53 2018
(r334339)
+++ head/sys/dev/uart/uart_tty.cTue May 29 16:16:24 2018
(r334340)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 
 static cn_probe_t uart_cnprobe;
 static cn_init_t uart_cninit;
+static cn_init_t uart_cnresume;
 static cn_term_t uart_cnterm;
 static cn_getc_t uart_cngetc;
 static cn_putc_t uart_cnputc;
@@ -69,7 +70,10 @@ static tsw_modem_t uart_tty_modem;
 static tsw_free_t uart_tty_free;
 static tsw_busy_t uart_tty_busy;
 
-CONSOLE_DRIVER(uart);
+CONSOLE_DRIVER(
+   uart,
+   .cn_resume = uart_cnresume,
+);
 
 static struct uart_devinfo uart_console;
 
@@ -112,6 +116,13 @@ uart_cninit(struct consdev *cp)
di->type = UART_DEV_CONSOLE;
uart_add_sysdev(di);
uart_init(di);
+}
+
+static void
+uart_cnresume(struct consdev *cp)
+{
+
+   uart_init(cp->cn_arg);
 }
 
 static void

Modified: head/sys/kern/kern_cons.c
==
--- head/sys/kern/kern_cons.c   Tue May 29 16:04:53 2018(r334339)
+++ head/sys/kern/kern_cons.c   Tue May 29 16:16:24 2018(r334340)
@@ -384,6 +384,19 @@ cnungrab()
}
 }
 
+void
+cnresume()
+{
+   struct cn_device *cnd;
+   struct consdev *cn;
+
+   STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
+   cn = cnd->cnd_cn;
+   if (cn->cn_ops->cn_resume != NULL)
+   cn->cn_ops->cn_resume(cn);
+   }
+}
+
 /*
  * Low level console routines.
  */

Modified: head/sys/sys/cons.h
==
--- head/sys/sys/cons.h Tue May 29 16:04:53 2018(r334339)
+++ head/sys/sys/cons.h Tue May 29 16:16:24 2018(r334340)
@@ -66,6 +66,8 @@ struct consdev_ops {
/* grab console for exclusive kernel use */
cn_ungrab_t *cn_ungrab;
/* ungrab console */
+   cn_init_t   *cn_resume;
+   /* set up console after sleep, optional */
 };
 
 struct consdev {
@@ -105,8 +107,9 @@ extern  struct tty *constty;/* Temporary virtual 
conso
};  \
DATA_SET(cons_set, name)
 
-#defineCONSOLE_DRIVER(name)
\
+#defineCONSOLE_DRIVER(name, ...)   
\
static const struct consdev_ops name##_consdev_ops = {  \
+   /* Mandatory methods. */\
.cn_probe = name##_cnprobe, \
.cn_init = name##_cninit,   \
.cn_term = name##_cnterm,   \
@@ -114,6 +117,8 @@ extern  struct tty *constty;/* Temporary virtual 
conso
.cn_putc = name##_cnputc,   \
.cn_grab = name##_cngrab,   \
.cn_ungrab = name##_cnungrab,   \
+   /* Optional fields. */  \
+   __VA_ARGS__ \
};  \
CONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL)
 
@@ -126,6 +131,7 @@ voidcnremove(struct consdev *);
 void   cnselect(struct consdev *);
 void  

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

2018-05-29 Thread Andrew Turner
Author: andrew
Date: Tue May 29 17:44:40 2018
New Revision: 334341
URL: https://svnweb.freebsd.org/changeset/base/334341

Log:
  Increase the number of fdt memory regions we support to 16. Some SoCs have
  many excluded regions causing a buffer overflow in the early boot code if
  this value is too small.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: Turing Robotic Industries

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

Modified: head/sys/dev/fdt/fdt_common.h
==
--- head/sys/dev/fdt/fdt_common.h   Tue May 29 16:16:24 2018
(r334340)
+++ head/sys/dev/fdt/fdt_common.h   Tue May 29 17:44:40 2018
(r334341)
@@ -39,7 +39,7 @@
 #include 
 #include 
 
-#define FDT_MEM_REGIONS8
+#define FDT_MEM_REGIONS16
 
 #define DI_MAX_INTR_NUM32
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334342 - head/sys/kern

2018-05-29 Thread Brooks Davis
Author: brooks
Date: Tue May 29 17:49:03 2018
New Revision: 334342
URL: https://svnweb.freebsd.org/changeset/base/334342

Log:
  Correct pointer subtraction in KASSERT().
  
  The assertion would never fire without truly spectacular future
  programming errors.
  
  Reported by:  Coverity
  CID:  1391367, 1391368
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Tue May 29 17:44:40 2018(r334341)
+++ head/sys/kern/imgact_elf.c  Tue May 29 17:49:03 2018(r334342)
@@ -1145,8 +1145,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct 
 
free(imgp->auxargs, M_TEMP);
imgp->auxargs = NULL;
-   KASSERT((pos - argarray) / sizeof(*pos) <= AT_COUNT,
-   ("Too many auxargs"));
+   KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs"));
 
error = copyout(argarray, auxbase, sizeof(*argarray) * AT_COUNT);
free(argarray, M_TEMP);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334343 - head/sys/net

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 18:03:43 2018
New Revision: 334343
URL: https://svnweb.freebsd.org/changeset/base/334343

Log:
  iflib: hold context lock across detach for drivers that need it

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cTue May 29 17:49:03 2018(r334342)
+++ head/sys/net/iflib.cTue May 29 18:03:43 2018(r334343)
@@ -4815,8 +4815,6 @@ iflib_device_deregister(if_ctx_t ctx)
 
iflib_netmap_detach(ifp);
ether_ifdetach(ifp);
-   /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/
-   CTX_LOCK_DESTROY(ctx);
if (ctx->ifc_led_dev != NULL)
led_destroy(ctx->ifc_led_dev);
/* XXX drain any dependent tasks */
@@ -4839,8 +4837,12 @@ iflib_device_deregister(if_ctx_t ctx)
taskqgroup_detach(tqg, &ctx->ifc_admin_task);
if (ctx->ifc_vflr_task.gt_uniq != NULL)
taskqgroup_detach(tqg, &ctx->ifc_vflr_task);
-
+   CTX_LOCK(ctx);
IFDI_DETACH(ctx);
+   CTX_UNLOCK(ctx);
+
+   /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/
+   CTX_LOCK_DESTROY(ctx);
device_set_softc(ctx->ifc_dev, NULL);
if (ctx->ifc_softc_ctx.isc_intr != IFLIB_INTR_LEGACY) {
pci_release_msi(dev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334344 - in head/sys: dev/hwpmc kern sys

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 18:03:48 2018
New Revision: 334344
URL: https://svnweb.freebsd.org/changeset/base/334344

Log:
  hwpmc: don't enter epoch section across mmap hook

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/pmckern.h

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==
--- head/sys/dev/hwpmc/hwpmc_mod.c  Tue May 29 18:03:43 2018
(r334343)
+++ head/sys/dev/hwpmc/hwpmc_mod.c  Tue May 29 18:03:48 2018
(r334344)
@@ -1717,7 +1717,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map
const struct pmc_process *pp;
 
freepath = fullpath = NULL;
-   epoch_exit_preempt(global_epoch_preempt);
+   MPASS(!in_epoch());
pmc_getfilename((struct vnode *) pkm->pm_file, &fullpath, &freepath);
 
pid = td->td_proc->p_pid;
@@ -1743,6 +1743,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map
   done:
if (freepath)
free(freepath, M_TEMP);
+   epoch_exit_preempt(global_epoch_preempt);
 }
 
 

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Tue May 29 18:03:43 2018(r334343)
+++ head/sys/kern/vfs_vnops.c   Tue May 29 18:03:48 2018(r334344)
@@ -2494,7 +2494,7 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *ad
if ((prot & VM_PROT_EXECUTE) != 0 && error == 0) {
pkm.pm_file = vp;
pkm.pm_address = (uintptr_t) *addr;
-   PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm);
+   PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_MMAP, (void *) &pkm);
}
}
 #endif

Modified: head/sys/sys/pmckern.h
==
--- head/sys/sys/pmckern.h  Tue May 29 18:03:43 2018(r334343)
+++ head/sys/sys/pmckern.h  Tue May 29 18:03:48 2018(r334344)
@@ -217,7 +217,8 @@ do {\
  */
 #definePMC_CALL_HOOK_UNLOCKED(t, cmd, arg) \
 do {   \
-   if (pmc_hook != NULL)   \
+   MPASS(!in_epoch()); \
+   if (pmc_hook != NULL)   \
(pmc_hook)((t), (cmd), (arg));  \
 } while (0)
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334345 - head/lib/libpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 18:26:12 2018
New Revision: 334345
URL: https://svnweb.freebsd.org/changeset/base/334345

Log:
  libpmc: free allocated string on return from pmc_allocate
  
  Reported by:  Coverity
  CID: 1391359

Modified:
  head/lib/libpmc/libpmc.c

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cTue May 29 18:03:48 2018(r334344)
+++ head/lib/libpmc/libpmc.cTue May 29 18:26:12 2018(r334345)
@@ -2797,6 +2797,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode,
if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) {
if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0)
return (errno);
+   free(spec_copy);
*pmcid = pmc_config.pm_pmcid;
return (0);
} else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334346 - head/lib/libpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 18:30:37 2018
New Revision: 334346
URL: https://svnweb.freebsd.org/changeset/base/334346

Log:
  libpmc: remove fixed counter diagnostic

Modified:
  head/lib/libpmc/libpmc_pmu_util.c   (contents, props changed)

Modified: head/lib/libpmc/libpmc_pmu_util.c
==
--- head/lib/libpmc/libpmc_pmu_util.c   Tue May 29 18:26:12 2018
(r334345)
+++ head/lib/libpmc/libpmc_pmu_util.c   Tue May 29 18:30:37 2018
(r334346)
@@ -315,10 +315,8 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc
return (ENOENT);
 
for (idx = 0; fixed_mode_cntrs[idx] != NULL; idx++)
-   if (strcmp(fixed_mode_cntrs[idx], event_name) == 0) {
+   if (strcmp(fixed_mode_cntrs[idx], event_name) == 0)
isfixed = 1;
-   printf("%s is fixed\n", event_name);
-   }
 
if (isfixed) {
if (strcasestr(pe->desc, "retired") != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334345 - head/lib/libpmc

2018-05-29 Thread Eric van Gyzen
On 05/29/2018 13:26, Matt Macy wrote:
>   if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) {
>   if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0)
>   return (errno);

^^
spec_copy is still leaked here.

> + free(spec_copy);
>   *pmcid = pmc_config.pm_pmcid;
>   return (0);
>   } else {
> 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334347 - head/lib/libpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 19:07:00 2018
New Revision: 334347
URL: https://svnweb.freebsd.org/changeset/base/334347

Log:
  libpmc: don't leak string in error case either
  
  Reported by:  vangyzen@

Modified:
  head/lib/libpmc/libpmc.c

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cTue May 29 18:30:37 2018(r334346)
+++ head/lib/libpmc/libpmc.cTue May 29 19:07:00 2018(r334347)
@@ -2795,11 +2795,12 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode,
r = spec_copy = strdup(ctrspec);
ctrname = strsep(&r, ",");
if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) {
-   if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0)
-   return (errno);
-   free(spec_copy);
+   if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) {
+   retval = errno;
+   goto out;
+   }
*pmcid = pmc_config.pm_pmcid;
-   return (0);
+   goto out;
} else {
free(spec_copy);
spec_copy = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334347 - head/lib/libpmc

2018-05-29 Thread Eric van Gyzen
On 05/29/2018 14:07, Matt Macy wrote:
>   if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) {
> - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0)
> - return (errno);
> - free(spec_copy);
> + if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) {
> + retval = errno;
> + goto out;
> + }
>   *pmcid = pmc_config.pm_pmcid;
> - return (0);
> + goto out;

This now returns -1 on the successful path.

Feel free to start throwing things at me now.  ;)

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


svn commit: r334348 - in head/sys: amd64/linux amd64/linux32 i386/linux

2018-05-29 Thread Brooks Davis
Author: brooks
Date: Tue May 29 20:03:24 2018
New Revision: 334348
URL: https://svnweb.freebsd.org/changeset/base/334348

Log:
  Correct pointer subtraction in KASSERT().
  
  The assertion would never fire without truly spectacular future
  programming errors.
  
  Reported by:  Coverity
  CID:  1391370
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Tue May 29 19:07:00 2018
(r334347)
+++ head/sys/amd64/linux/linux_sysvec.c Tue May 29 20:03:24 2018
(r334348)
@@ -283,8 +283,7 @@ linux_fixup_elf(register_t **stack_base, struct image_
AUXARGS_ENTRY(pos, AT_NULL, 0);
free(imgp->auxargs, M_TEMP);
imgp->auxargs = NULL;
-   KASSERT((pos - argarray) / sizeof(*pos) <= LINUX_AT_COUNT,
-   ("Too many auxargs"));
+   KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs"));
 
error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT);
free(argarray, M_TEMP);

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Tue May 29 19:07:00 2018
(r334347)
+++ head/sys/amd64/linux32/linux32_sysvec.c Tue May 29 20:03:24 2018
(r334348)
@@ -249,8 +249,7 @@ linux_fixup_elf(register_t **stack_base, struct image_
 
free(imgp->auxargs, M_TEMP);
imgp->auxargs = NULL;
-   KASSERT((pos - argarray) / sizeof(*pos) <= AT_COUNT,
-   ("Too many auxargs"));
+   KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs"));
 
error = copyout(&argarray[0], auxbase, sizeof(*argarray) * AT_COUNT);
free(argarray, M_TEMP);

Modified: head/sys/i386/linux/linux_sysvec.c
==
--- head/sys/i386/linux/linux_sysvec.c  Tue May 29 19:07:00 2018
(r334347)
+++ head/sys/i386/linux/linux_sysvec.c  Tue May 29 20:03:24 2018
(r334348)
@@ -261,8 +261,7 @@ linux_fixup_elf(register_t **stack_base, struct image_
 
free(imgp->auxargs, M_TEMP);
imgp->auxargs = NULL;
-   KASSERT((pos - argarray) / sizeof(*pos) <= LINUX_AT_COUNT,
-   ("Too many auxargs"));
+   KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs"));
 
error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT);
free(argarray, M_TEMP);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334349 - head/lib/libpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 20:09:35 2018
New Revision: 334349
URL: https://svnweb.freebsd.org/changeset/base/334349

Log:
  libpmc: don't return -1 on success in pmc_allocate

Modified:
  head/lib/libpmc/libpmc.c

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cTue May 29 20:03:24 2018(r334348)
+++ head/lib/libpmc/libpmc.cTue May 29 20:09:35 2018(r334349)
@@ -2796,9 +2796,9 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode,
ctrname = strsep(&r, ",");
if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) {
if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) {
-   retval = errno;
goto out;
}
+   retval = 0;
*pmcid = pmc_config.pm_pmcid;
goto out;
} else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334350 - in head/usr.sbin: . pmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 20:28:34 2018
New Revision: 334350
URL: https://svnweb.freebsd.org/changeset/base/334350

Log:
  pmc: Add new sub-command structured "pmc" utility
  
  This will manage pmc functionality with a more
  manageable structure of subcommands rather than the
  gradually accreted spaghetti logic of overlapping flags
  that exists in pmcstat.
  
  This is intended to ultimately have all the same functionality
  as pmcannotate+pmccontrol+pmcstat. Currently it just has
  "stat" and "system-stat" - counters for the process itself and counters
  for the system as a whole respectively (i.e. system-stat includes kernel
  threads). Note that the rusage results (page faults/context switches/
  user/sys) for stat-system will not account for the system as a whole -
  only for the child process specified on the command line.
  
  Implementing stat was suggested by mjg@ and the output is based on that
  from Linux's "perf stat".
  
  % pmc stat -- make -j32 buildkernel -DNO_MODULES  -ss > /dev/null
   9598393  page faults   #   0.674 M/sec
387085  voluntary csw #   0.027 M/sec
106989  involuntary csw   #   0.008 M/sec
 2763965982317  cycles
 2542953049760  instructions  #   0.920 inst/cycle
  511562750157  branches
   12917006881  branch-misses #   2.525%
   17944429878  cache-references  #   0.007 refs/inst
2205119560  cache-misses  #   12.289%
 43.74  real  #   2019.72% cpu
795.09  user  #   1817.72% cpu
 88.35  sys   #   202.00% cpu
  
  % make -j32 buildkernel -DNO_MODULES  -ss > /dev/null &
  % sudo pmc stat-system cat
  ^C 103  page faults #   0.811 M/sec
 4  voluntary csw #   0.031 M/sec
 0  involuntary csw   #   0.000 M/sec
 2843639070514  cycles
 2606171217438  instructions  #   0.916 inst/cycle
  522450422783  branches
   13092862839  branch-misses #   2.506%
   18592101113  cache-references  #   0.007 refs/inst
2562878667  cache-misses  #   13.785%
 44.85  real  #   0.00% cpu
  0.00  user  #   0.00% cpu
  0.00  sys   #   0.00% cpu

Added:
  head/usr.sbin/pmc/
  head/usr.sbin/pmc/Makefile   (contents, props changed)
  head/usr.sbin/pmc/cmd_pmc.h   (contents, props changed)
  head/usr.sbin/pmc/cmd_pmc_stat.c   (contents, props changed)
  head/usr.sbin/pmc/pmc.c   (contents, props changed)
  head/usr.sbin/pmc/pmc_util.c   (contents, props changed)
Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue May 29 20:09:35 2018(r334349)
+++ head/usr.sbin/Makefile  Tue May 29 20:28:34 2018(r334350)
@@ -179,6 +179,7 @@ SUBDIR.${MK_OPENSSL}+=  keyserv
 SUBDIR.${MK_PC_SYSINSTALL}+=   pc-sysinstall
 SUBDIR.${MK_PF}+=  ftp-proxy
 SUBDIR.${MK_PKGBOOTSTRAP}+=pkg
+SUBDIR.${MK_PMC}+= pmc
 SUBDIR.${MK_PMC}+= pmcannotate
 SUBDIR.${MK_PMC}+= pmccontrol
 SUBDIR.${MK_PMC}+= pmcstat

Added: head/usr.sbin/pmc/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pmc/Makefile  Tue May 29 20:28:34 2018(r334350)
@@ -0,0 +1,12 @@
+#
+# $FreeBSD$
+#
+
+PROG=  pmc
+MAN=   
+
+LIBADD=kvm pmc m ncursesw pmcstat elf
+
+SRCS=  pmc.c pmc_util.c cmd_pmc_stat.c
+
+.include 

Added: head/usr.sbin/pmc/cmd_pmc.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pmc/cmd_pmc.h Tue May 29 20:28:34 2018(r334350)
@@ -0,0 +1,52 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018, Matthew Macy
+ *
+ * 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 LIA

svn commit: r334351 - head/lib/libpmc

2018-05-29 Thread Eric van Gyzen
Author: vangyzen
Date: Tue May 29 20:30:46 2018
New Revision: 334351
URL: https://svnweb.freebsd.org/changeset/base/334351

Log:
  pmc_annotate: adhere to the API
  
  If the 'mode' parameter was invalid, pmc_annotate() would
  return EINVAL instead of setting errno and returning -1.
  
  Sponsored by: Dell EMC

Modified:
  head/lib/libpmc/libpmc.c

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cTue May 29 20:28:34 2018(r334350)
+++ head/lib/libpmc/libpmc.cTue May 29 20:30:46 2018(r334351)
@@ -2781,7 +2781,8 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode,
 
if (mode != PMC_MODE_SS && mode != PMC_MODE_TS &&
mode != PMC_MODE_SC && mode != PMC_MODE_TC) {
-   return (EINVAL);
+   errno = EINVAL;
+   goto out;
}
bzero(&pmc_config, sizeof(pmc_config));
pmc_config.pm_cpu   = cpu;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334353 - head/usr.sbin/pmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 21:02:08 2018
New Revision: 334353
URL: https://svnweb.freebsd.org/changeset/base/334353

Log:
  pmc: silence scan-build warnings

Modified:
  head/usr.sbin/pmc/cmd_pmc_stat.c   (contents, props changed)

Modified: head/usr.sbin/pmc/cmd_pmc_stat.c
==
--- head/usr.sbin/pmc/cmd_pmc_stat.cTue May 29 20:39:54 2018
(r334352)
+++ head/usr.sbin/pmc/cmd_pmc_stat.cTue May 29 21:02:08 2018
(r334353)
@@ -306,21 +306,21 @@ static struct option longopts[] = {
 static int
 pmc_stat_internal(int argc, char **argv, int system_mode)
 {
-   const char *event;
+   char *event, *r;
struct sigaction sa;
struct kevent kev;
struct rusage ru;
struct winsize ws;
struct pmcstat_ev *ev;
-   int c, option, runstate, do_print, do_read;
+   int c, option, runstate;
int waitstatus, ru_valid;
 
-   ru_valid = do_print = do_read = 0;
-   event = NULL;
+   ru_valid = 0;
+   r = event = NULL;
while ((option = getopt_long(argc, argv, "j:", longopts, NULL)) != -1) {
switch (option) {
case 'j':
-   event = strdup(optarg);
+   r = event = strdup(optarg);
break;
case '?':
default:
@@ -333,7 +333,8 @@ pmc_stat_internal(int argc, char **argv, int system_mo
usage();
pmc_args.pa_flags |= FLAG_HAS_COMMANDLINE;
pmc_stat_setup_stat(system_mode, event);
-
+   free(r);
+   bzero(&ru, sizeof(ru));
EV_SET(&kev, SIGINT, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL);
if (kevent(pmc_kq, &kev, 1, NULL, 0, NULL) < 0)
err(EX_OSERR, "ERROR: Cannot register kevent for SIGINT");
@@ -394,7 +395,6 @@ pmc_stat_internal(int argc, char **argv, int system_mo
  * are killed by a SIGINT or we reached the time duration.
  */
runstate = PMCSTAT_RUNNING;
-   do_print = do_read = 0;
do {
if ((c = kevent(pmc_kq, NULL, 0, &kev, 1, NULL)) <= 0) {
if (errno != EINTR)
@@ -411,11 +411,9 @@ pmc_stat_internal(int argc, char **argv, int system_mo
getrusage(RUSAGE_CHILDREN, &ru);
ru_valid = 1;
}
-   do_print = 1;
break;
 
case EVFILT_READ:   /* log file data is present */
-   do_read = 0;
break;
 
case EVFILT_SIGNAL:
@@ -439,7 +437,6 @@ pmc_stat_internal(int argc, char **argv, int system_mo
ru_valid = 1;
}
runstate = pmcstat_close_log(&pmc_args);
-   do_print = 1;   /* print PMCs at exit */
} else if (kev.ident == SIGINT) {
/* Kill the child process if we started it */
if (pmc_args.pa_flags & FLAG_HAS_COMMANDLINE)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334354 - head/lib/libpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Tue May 29 21:02:13 2018
New Revision: 334354
URL: https://svnweb.freebsd.org/changeset/base/334354

Log:
  libpmc: silence scan-build warnings

Modified:
  head/lib/libpmc/libpmc_pmu_util.c   (contents, props changed)
  head/lib/libpmc/pmclog.c

Modified: head/lib/libpmc/libpmc_pmu_util.c
==
--- head/lib/libpmc/libpmc_pmu_util.c   Tue May 29 21:02:08 2018
(r334353)
+++ head/lib/libpmc/libpmc_pmu_util.c   Tue May 29 21:02:13 2018
(r334354)
@@ -156,11 +156,12 @@ static int
 pmu_parse_event(struct pmu_event_desc *ped, const char *eventin)
 {
char *event;
-   char *kvp, *key, *value;
+   char *kvp, *key, *value, *r;
char *debug;
 
if ((event = strdup(eventin)) == NULL)
return (ENOMEM);
+   r = event;
bzero(ped, sizeof(*ped));
while ((kvp = strsep(&event, ",")) != NULL) {
key = strsep(&kvp, "=");
@@ -199,7 +200,7 @@ pmu_parse_event(struct pmu_event_desc *ped, const char
printf("unrecognized kvpair: %s:%s\n", key, 
value);
}
}
-   free(event);
+   free(r);
return (0);
 }
 

Modified: head/lib/libpmc/pmclog.c
==
--- head/lib/libpmc/pmclog.cTue May 29 21:02:08 2018(r334353)
+++ head/lib/libpmc/pmclog.cTue May 29 21:02:13 2018(r334354)
@@ -136,7 +136,7 @@ pmclog_get_record(struct pmclog_parse_state *ps, char 
return (ps->ps_state = PL_STATE_ERROR);
 
src = *data;
-   h = used = 0;
+   used = 0;
 
if (ps->ps_state == PL_STATE_NEW_RECORD)
ps->ps_svcount = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334356 - head/sys/kern

2018-05-29 Thread Gleb Smirnoff
Author: glebius
Date: Tue May 29 21:45:15 2018
New Revision: 334356
URL: https://svnweb.freebsd.org/changeset/base/334356

Log:
  Revert second chunk of r333860. The warning from gcc is false positive. The
  npages won't be ever used in no space case.

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Tue May 29 21:37:02 2018
(r334355)
+++ head/sys/kern/kern_sendfile.c   Tue May 29 21:45:15 2018
(r334356)
@@ -688,7 +688,6 @@ retry_space:
if (space == 0) {
sfio = NULL;
nios = 0;
-   npages = 0;
goto prepend_header;
}
hdr_uio = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334357 - head/sbin/dumpon

2018-05-29 Thread Sean Bruno
Author: sbruno
Date: Tue May 29 21:52:13 2018
New Revision: 334357
URL: https://svnweb.freebsd.org/changeset/base/334357

Log:
  dumpon(8)
  - fix the WITHOUT_CRYPTO buildworld case.  Its rare, but some of us do
build this way.
  
  Sponsored by: Limelight Networks

Modified:
  head/sbin/dumpon/dumpon.c

Modified: head/sbin/dumpon/dumpon.c
==
--- head/sbin/dumpon/dumpon.c   Tue May 29 21:45:15 2018(r334356)
+++ head/sbin/dumpon/dumpon.c   Tue May 29 21:52:13 2018(r334357)
@@ -393,7 +393,8 @@ main(int argc, char *argv[])
 
 #ifndef HAVE_CRYPTO
if (pubkeyfile != NULL)
-   errx("Unable to use the public key. Recompile dumpon with 
OpenSSL support.");
+   errx(EX_UNAVAILABLE,"Unable to use the public key."
+   " Recompile dumpon with OpenSSL support.");
 #endif
 
if (server != NULL && client != NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334358 - in head/sys: kern net sys

2018-05-29 Thread Stephen Hurd
Author: shurd
Date: Tue May 29 21:56:39 2018
New Revision: 334358
URL: https://svnweb.freebsd.org/changeset/base/334358

Log:
  iflib: mark irq allocation name parameter as constant
  
  The *name parameter passed to iflib_irq_alloc_generic and
  iflib_softirq_alloc_generic is never modified. Many places in code pass
  string literals and thus should not be modified.
  
  Mark the *name parameter as a const char * instead, so that we enforce
  that the name is not modified before passing to bus_describe_intr()
  
  Submitted by: Jacob Keller 
  Reviewed by:  kmacy
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D15343

Modified:
  head/sys/kern/subr_gtaskqueue.c
  head/sys/net/iflib.c
  head/sys/net/iflib.h
  head/sys/sys/gtaskqueue.h

Modified: head/sys/kern/subr_gtaskqueue.c
==
--- head/sys/kern/subr_gtaskqueue.c Tue May 29 21:52:13 2018
(r334357)
+++ head/sys/kern/subr_gtaskqueue.c Tue May 29 21:56:39 2018
(r334358)
@@ -561,7 +561,7 @@ struct taskqgroup_cpu {
 struct taskqgroup {
struct taskqgroup_cpu tqg_queue[MAXCPU];
struct mtx  tqg_lock;
-   char *  tqg_name;
+   const char *tqg_name;
int tqg_adjusting;
int tqg_stride;
int tqg_cnt;
@@ -720,7 +720,7 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup, 
 
 int
 taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask,
-   void *uniq, int cpu, int irq, char *name)
+   void *uniq, int cpu, int irq, const char *name)
 {
cpuset_t mask;
int i, qid, error;
@@ -961,7 +961,7 @@ taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, 
 }
 
 struct taskqgroup *
-taskqgroup_create(char *name)
+taskqgroup_create(const char *name)
 {
struct taskqgroup *qgroup;
 

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cTue May 29 21:52:13 2018(r334357)
+++ head/sys/net/iflib.cTue May 29 21:56:39 2018(r334358)
@@ -733,7 +733,7 @@ static int iflib_tx_credits_update(if_ctx_t ctx, iflib
 static int iflib_rxd_avail(if_ctx_t ctx, iflib_rxq_t rxq, qidx_t cidx, qidx_t 
budget);
 static int iflib_qset_structures_setup(if_ctx_t ctx);
 static int iflib_msix_init(if_ctx_t ctx);
-static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void 
*filterarg, int *rid, char *str);
+static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void 
*filterarg, int *rid, const char *str);
 static void iflib_txq_check_drain(iflib_txq_t txq, int budget);
 static uint32_t iflib_txq_can_drain(struct ifmp_ring *);
 static int iflib_register(if_ctx_t);
@@ -1523,8 +1523,8 @@ iflib_fast_intr_ctx(void *arg)
 
 static int
 _iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid,
-   driver_filter_t filter, driver_intr_t handler, void *arg,
-char *name)
+driver_filter_t filter, driver_intr_t handler, void *arg,
+const char *name)
 {
int rc, flags;
struct resource *res;
@@ -5395,7 +5395,7 @@ iflib_qset_structures_setup(if_ctx_t ctx)
 
 int
 iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid,
-   driver_filter_t filter, void *filter_arg, 
driver_intr_t handler, void *arg, char *name)
+   driver_filter_t filter, void *filter_arg, driver_intr_t 
handler, void *arg, const char *name)
 {
 
return (_iflib_irq_alloc(ctx, irq, rid, filter, handler, arg, name));
@@ -5526,7 +5526,7 @@ get_core_offset(if_ctx_t ctx, iflib_intr_type_t type, 
 /* Just to avoid copy/paste */
 static inline int
 iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_intr_type_t type, int qid,
-struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, char *name)
+struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, const char 
*name)
 {
int cpuid;
int err, tid;
@@ -5549,8 +5549,8 @@ iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_in
 
 int
 iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid,
-   iflib_intr_type_t type, 
driver_filter_t *filter,
-   void *filter_arg, int qid, char 
*name)
+   iflib_intr_type_t type, driver_filter_t *filter,
+   void *filter_arg, int qid, const char *name)
 {
struct grouptask *gtask;
struct taskqgroup *tqg;
@@ -5631,7 +5631,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in
 }
 
 void
-iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t 
type,  void *arg, int qid, char *name)
+iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t 
type,  void *arg, int qid, const char *name)
 {
struct grouptask *gtask;
s

svn commit: r334359 - head/cddl/usr.sbin/dwatch

2018-05-29 Thread Devin Teske
Author: dteske
Date: Tue May 29 22:36:37 2018
New Revision: 334359
URL: https://svnweb.freebsd.org/changeset/base/334359

Log:
  dwatch(1): Fix "-t test" for post-processing profiles
  
  Profiles that perform post-processing of the DTrace output were
  dropping the "-t test" option on the floor. Fix handling of this
  option for said profiles.
  
  X-MFC-to: stable/11
  X-MFC-with:   r334261-334262
  Sponsored by: Smule, Inc.

Modified:
  head/cddl/usr.sbin/dwatch/dwatch

Modified: head/cddl/usr.sbin/dwatch/dwatch
==
--- head/cddl/usr.sbin/dwatch/dwatchTue May 29 21:56:39 2018
(r334358)
+++ head/cddl/usr.sbin/dwatch/dwatchTue May 29 22:36:37 2018
(r334359)
@@ -47,7 +47,7 @@ DTRACE_PRAGMA="
 
  GLOBALS
 
-VERSION='$Version: 1.3 $' # -V
+VERSION='$Version: 1.4 $' # -V
 
 pgm="${0##*/}" # Program basename
 
@@ -576,8 +576,8 @@ load_profile()
ARGV="$ARGV -z '$( shell_escape "$EXECREGEX" )'"
[ "$CUSTOM_DETAILS" ] &&
ARGV="$ARGV -E '$( shell_escape "$EVENT_DETAILS" )'"
-   [ "$EVENT_TEST" ] &&
-   ARGV="$ARGV -t '$( shell_escape "$EVENT_TEST" )'"
+   [ "$CUSTOM_TEST" ] &&
+   ARGV="$ARGV -t '$( shell_escape "$CUSTOM_TEST" )'"
[ "$OUTPUT" ] &&
ARGV="$ARGV -o '$( shell_escape "$OUTPUT" )'"
[ "$OUTPUT_CMD" ] &&
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334360 - in head: etc/mtree tests/sys tests/sys/audit

2018-05-29 Thread Alan Somers
Author: asomers
Date: Tue May 29 23:08:33 2018
New Revision: 334360
URL: https://svnweb.freebsd.org/changeset/base/334360

Log:
  Add initial set of tests for audit(4)
  
  This change includes the framework for testing the auditability of various
  syscalls, and includes changes for the first 12.  The tests will start
  auditd(8) if needed, though they'll be much faster if it's already running.
  The syscalls tested in this commit include mkdir(2), mkdirat(2), mknod(2),
  mknodat(2), mkfifo(2), mkfifoat(2), link(2), linkat(2), symlink(2),
  symlinkat(2), rename(2), and renameat(2).
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15286

Added:
  head/tests/sys/audit/
  head/tests/sys/audit/Makefile   (contents, props changed)
  head/tests/sys/audit/file-create.c   (contents, props changed)
  head/tests/sys/audit/utils.c   (contents, props changed)
  head/tests/sys/audit/utils.h   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/tests/sys/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue May 29 22:36:37 2018
(r334359)
+++ head/etc/mtree/BSD.tests.dist   Tue May 29 23:08:33 2018
(r334360)
@@ -430,6 +430,8 @@
 ..
 aio
 ..
+audit
+..
 capsicum
 ..
 cddl

Modified: head/tests/sys/Makefile
==
--- head/tests/sys/Makefile Tue May 29 22:36:37 2018(r334359)
+++ head/tests/sys/Makefile Tue May 29 23:08:33 2018(r334360)
@@ -6,6 +6,7 @@ TESTSDIR=   ${TESTSBASE}/sys
 
 TESTS_SUBDIRS+=acl
 TESTS_SUBDIRS+=aio
+TESTS_SUBDIRS+=audit
 TESTS_SUBDIRS+=capsicum
 TESTS_SUBDIRS+=${_cddl}
 TESTS_SUBDIRS+=fifo

Added: head/tests/sys/audit/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/audit/Makefile   Tue May 29 23:08:33 2018
(r334360)
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR=  ${TESTSBASE}/sys/audit
+
+ATF_TESTS_C=   file-create
+
+SRCS.file-create+= file-create.c
+SRCS.file-create+= utils.c
+
+TEST_METADATA+= timeout="30"
+TEST_METADATA+= required_user="root"
+
+WARNS?=6
+
+LDFLAGS+=  -lbsm
+
+.include 

Added: head/tests/sys/audit/file-create.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/audit/file-create.c  Tue May 29 23:08:33 2018
(r334360)
@@ -0,0 +1,585 @@
+/*-
+ * Copyright 2018 Aniket Pandey
+ * 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
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * 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
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "utils.h"
+
+static struct pollfd fds[1];
+static mode_t mode = 0777;
+static dev_t dev =  0;
+static const char *auclass = "fc";
+static const char *path = "fileforaudit";
+static const char *successreg = "fileforaudit.*return,success";
+static const char *failurereg = "fileforaudit.*return,failure";
+
+
+ATF_TC_WITH_CLEANUP(mkdir_success);
+ATF_TC_HEAD(mkdir_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "mkdir(2) call");
+}
+
+ATF_TC_BODY(mkdir_success, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   ATF_

svn commit: r334361 - head/usr.sbin/pmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Wed May 30 00:06:17 2018
New Revision: 334361
URL: https://svnweb.freebsd.org/changeset/base/334361

Log:
  pmc: don't break build with format issues

Modified:
  head/usr.sbin/pmc/Makefile

Modified: head/usr.sbin/pmc/Makefile
==
--- head/usr.sbin/pmc/Makefile  Tue May 29 23:08:33 2018(r334360)
+++ head/usr.sbin/pmc/Makefile  Wed May 30 00:06:17 2018(r334361)
@@ -9,4 +9,5 @@ LIBADD= kvm pmc m ncursesw pmcstat elf
 
 SRCS=  pmc.c pmc_util.c cmd_pmc_stat.c
 
+CWARNFLAGS.cmd_pmc_stat.c= -Wno-format
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334360 - in head: etc/mtree tests/sys tests/sys/audit

2018-05-29 Thread Ed Maste
On 29 May 2018 at 19:08, Alan Somers  wrote:
> Author: asomers
> Date: Tue May 29 23:08:33 2018
> New Revision: 334360
> URL: https://svnweb.freebsd.org/changeset/base/334360
>
> Log:
>   Add initial set of tests for audit(4)

This has broken the build on many architectures, e.g. mips:
https://ci.freebsd.org/job/FreeBSD-head-mips-build/2467/console

23:15:17 In file included from /usr/src/tests/sys/audit/utils.c:38:
23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/libbsm.h:880:
warning: redundant redeclaration of 'au_bsm_to_domain'
23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/audit_record.h:301:
warning: previous declaration of 'au_bsm_to_domain' was here
...
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334362 - head/tests/sys

2018-05-29 Thread Ed Maste
Author: emaste
Date: Wed May 30 00:36:58 2018
New Revision: 334362
URL: https://svnweb.freebsd.org/changeset/base/334362

Log:
  Temporarily disconnect audit tests
  
  Audit tests added in r334360 broke the build on a number of archs.
  Remove the subdir from the top level tests/sys/Makefile until they're
  fixed.

Modified:
  head/tests/sys/Makefile

Modified: head/tests/sys/Makefile
==
--- head/tests/sys/Makefile Wed May 30 00:06:17 2018(r334361)
+++ head/tests/sys/Makefile Wed May 30 00:36:58 2018(r334362)
@@ -6,7 +6,6 @@ TESTSDIR=   ${TESTSBASE}/sys
 
 TESTS_SUBDIRS+=acl
 TESTS_SUBDIRS+=aio
-TESTS_SUBDIRS+=audit
 TESTS_SUBDIRS+=capsicum
 TESTS_SUBDIRS+=${_cddl}
 TESTS_SUBDIRS+=fifo
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334362 - head/tests/sys

2018-05-29 Thread Alan Somers
Thanks Ed.  I'll try to figure out the root cause for this.

On Tue, May 29, 2018 at 6:36 PM, Ed Maste  wrote:

> Author: emaste
> Date: Wed May 30 00:36:58 2018
> New Revision: 334362
> URL: https://svnweb.freebsd.org/changeset/base/334362
>
> Log:
>   Temporarily disconnect audit tests
>
>   Audit tests added in r334360 broke the build on a number of archs.
>   Remove the subdir from the top level tests/sys/Makefile until they're
>   fixed.
>
> Modified:
>   head/tests/sys/Makefile
>
> Modified: head/tests/sys/Makefile
> 
> ==
> --- head/tests/sys/Makefile Wed May 30 00:06:17 2018(r334361)
> +++ head/tests/sys/Makefile Wed May 30 00:36:58 2018(r334362)
> @@ -6,7 +6,6 @@ TESTSDIR=   ${TESTSBASE}/sys
>
>  TESTS_SUBDIRS+=acl
>  TESTS_SUBDIRS+=aio
> -TESTS_SUBDIRS+=audit
>  TESTS_SUBDIRS+=capsicum
>  TESTS_SUBDIRS+=${_cddl}
>  TESTS_SUBDIRS+=fifo
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334363 - head/usr.bin/elfdump

2018-05-29 Thread Ed Maste
Author: emaste
Date: Wed May 30 01:16:50 2018
New Revision: 334363
URL: https://svnweb.freebsd.org/changeset/base/334363

Log:
  elfdump: chase ABI tag note name change from r232832
  
  r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag.
  Follow suit in elfdump.
  
  Elfdump's note parsing is very basic and should be significantly
  reworked, but for now just restore the broken functionality.
  
  PR:   228290
  Submitted by: martin at lispworks.com
  MFC after:1 week

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

Modified: head/usr.bin/elfdump/elfdump.c
==
--- head/usr.bin/elfdump/elfdump.c  Wed May 30 00:36:58 2018
(r334362)
+++ head/usr.bin/elfdump/elfdump.c  Wed May 30 01:16:50 2018
(r334363)
@@ -659,7 +659,7 @@ main(int ac, char **av)
case SHT_NOTE:
name = elf_get_word(e, v, SH_NAME);
if (flags & ED_NOTE &&
-   strcmp(shstrtab + name, ".note.ABI-tag") == 0)
+   strcmp(shstrtab + name, ".note.tag") == 0)
elf_print_note(e, v);
break;
case SHT_DYNSYM:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334364 - head/sys/conf

2018-05-29 Thread Ravi Pokala
Author: rpokala
Date: Wed May 30 02:26:36 2018
New Revision: 334364
URL: https://svnweb.freebsd.org/changeset/base/334364

Log:
  Remove the mlx5 driver from LINT kernel config for 32-bit PPC
  
  The mlx5 driver requires 64-bit atomics, which are not supported on 32-bit
  PPC. Exclude that driver from the LINT kernel config.
  
  Submitted by: hps (but I re-worded the comment)
  Reported by:  rpokala
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D15611

Modified:
  head/sys/conf/makeLINT.mk

Modified: head/sys/conf/makeLINT.mk
==
--- head/sys/conf/makeLINT.mk   Wed May 30 01:16:50 2018(r334363)
+++ head/sys/conf/makeLINT.mk   Wed May 30 02:26:36 2018(r334364)
@@ -55,4 +55,8 @@ LINT: ${NOTES} ${MAKELINT_SED}
cat ${.TARGET} > ${.TARGET}64
echo "machine   ${TARGET} powerpc" >> ${.TARGET}
echo "machine   ${TARGET} powerpc64" >> ${.TARGET}64
+# mlx5 needs 64-bit atomics, so exclude from 32-bit PPC
+   echo "nodevice mlx5" >> ${.TARGET}
+   echo "nodevice mlx5en" >> ${.TARGET}
+   echo "nodevice mlx5ib" >> ${.TARGET}
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-05-29 Thread Justin Hibbits
Author: jhibbits
Date: Wed May 30 02:41:47 2018
New Revision: 334365
URL: https://svnweb.freebsd.org/changeset/base/334365

Log:
  Restrict PCIe maxslots to 0, instead of PCI_SLOTMAX
  
  Summary:
  PCIe only permits 1 device on an endpoint, so some devices ignore the device
  part of B:D:F probing.  Although ARI likely fixes this, not all platforms
  support ARI completely or correctly, so some devices end up showing up 32
  times on the bus.
  
  This was found during bringup of POWER9/Talos, and has been tested on POWER9
  and POWER8 hardware.
  
  Reviewed by:  leitao
  Differential Revision: https://reviews.freebsd.org/D15461

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Wed May 30 02:26:36 2018(r334364)
+++ head/sys/dev/pci/pci_pci.c  Wed May 30 02:41:47 2018(r334365)
@@ -2545,6 +2545,20 @@ pcib_enable_ari(struct pcib_softc *sc, uint32_t pcie_p
 int
 pcib_maxslots(device_t dev)
 {
+   uint32_t pcie_pos;
+   uint16_t val;
+
+   /*
+* If this is a PCIe rootport or downstream switch port, there's only
+* one slot permitted.
+*/
+   if (pci_find_cap(dev, PCIY_EXPRESS, &pcie_pos) == 0) {
+   val = pci_read_config(dev, pcie_pos + PCIER_FLAGS, 2);
+   val &= PCIEM_FLAGS_TYPE;
+   if (val == PCIEM_TYPE_ROOT_PORT ||
+   val == PCIEM_TYPE_DOWNSTREAM_PORT)
+   return (0);
+   }
return (PCI_SLOTMAX);
 }
 
@@ -2558,7 +2572,7 @@ pcib_ari_maxslots(device_t dev)
if (sc->flags & PCIB_ENABLE_ARI)
return (PCIE_ARI_SLOTMAX);
else
-   return (PCI_SLOTMAX);
+   return (pcib_maxslots(dev));
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334366 - head/sys/powerpc/powernv

2018-05-29 Thread Justin Hibbits
Author: jhibbits
Date: Wed May 30 02:47:23 2018
New Revision: 334366
URL: https://svnweb.freebsd.org/changeset/base/334366

Log:
  Cache the phandle of the PCI node in opal_pci_attach
  
  Simple cleanup, no functional change.  This is related to the fixups needed
  for POWER9 support.

Modified:
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:41:47 2018
(r334365)
+++ head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:47:23 2018
(r334366)
@@ -200,25 +200,27 @@ opalpci_attach(device_t dev)
 {
struct opalpci_softc *sc;
cell_t id[2], m64window[6], npe;
+   phandle_t node;
int i, err;
uint64_t maxmem;
uint64_t entries;
int rid;
 
sc = device_get_softc(dev);
+   node = ofw_bus_get_node(dev);
 
-   switch (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid")) {
+   switch (OF_getproplen(node, "ibm,opal-phbid")) {
case 8:
-   OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 8);
+   OF_getencprop(node, "ibm,opal-phbid", id, 8);
sc->phb_id = ((uint64_t)id[0] << 32) | id[1];
break;
case 4:
-   OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 4);
+   OF_getencprop(node, "ibm,opal-phbid", id, 4);
sc->phb_id = id[0];
break;
default:
device_printf(dev, "PHB ID property had wrong length (%zd)\n",
-   OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid"));
+   OF_getproplen(node, "ibm,opal-phbid"));
return (ENXIO);
}
 
@@ -264,8 +266,7 @@ opalpci_attach(device_t dev)
/*
 * Turn on MMIO, mapped to PE 1
 */
-   if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-num-pes", &npe, 4)
-   != 4)
+   if (OF_getencprop(node, "ibm,opal-num-pes", &npe, 4) != 4)
npe = 1;
for (i = 0; i < npe; i++) {
err = opal_call(OPAL_PCI_MAP_PE_MMIO_WINDOW, sc->phb_id,
@@ -275,7 +276,7 @@ opalpci_attach(device_t dev)
}
 
/* XXX: multiple M64 windows? */
-   if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window",
+   if (OF_getencprop(node, "ibm,opal-m64-window",
m64window, sizeof(m64window)) == sizeof(m64window)) {
opal_call(OPAL_PCI_PHB_MMIO_ENABLE, sc->phb_id,
OPAL_M64_WINDOW_TYPE, 0, 0);
@@ -342,9 +343,9 @@ opalpci_attach(device_t dev)
 * Get MSI properties
 */
sc->msi_vmem = NULL;
-   if (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-msi-ranges") > 0) {
+   if (OF_getproplen(node, "ibm,opal-msi-ranges") > 0) {
cell_t msi_ranges[2];
-   OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-msi-ranges",
+   OF_getencprop(node, "ibm,opal-msi-ranges",
msi_ranges, sizeof(msi_ranges));
sc->msi_base = msi_ranges[0];
 
@@ -352,7 +353,7 @@ opalpci_attach(device_t dev)
msi_ranges[1], 1, 16, M_BESTFIT | M_WAITOK);
 
sc->base_msi_irq = powerpc_register_pic(dev,
-   OF_xref_from_node(ofw_bus_get_node(dev)),
+   OF_xref_from_node(node),
msi_ranges[0] + msi_ranges[1], 0, FALSE);
 
if (bootverbose)
@@ -377,7 +378,7 @@ opalpci_attach(device_t dev)
/*
 * OPAL stores 64-bit BARs in a special property rather than "ranges"
 */
-   if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window",
+   if (OF_getencprop(node, "ibm,opal-m64-window",
m64window, sizeof(m64window)) == sizeof(m64window)) {
struct ofw_pci_range *rp;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334367 - head/sys/powerpc/powernv

2018-05-29 Thread Justin Hibbits
Author: jhibbits
Date: Wed May 30 03:00:57 2018
New Revision: 334367
URL: https://svnweb.freebsd.org/changeset/base/334367

Log:
  Make opal_pci driver work with POWER9
  
  Summary:
  Coupled with r334365, this makes PCI work on POWER9.  There is still more to
  do to fully exploit the hardware capabilities, but this is sufficient to
  enable USB and ethernet controllers on a POWER9 Talos II system.
  
  Reviewed by:  nwhitehorn, leitao
  Differential Revision: https://reviews.freebsd.org/D15566

Modified:
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:47:23 2018
(r334366)
+++ head/sys/powerpc/powernv/opal_pci.c Wed May 30 03:00:57 2018
(r334367)
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
 #include "opal.h"
 
 #defineOPAL_PCI_TCE_MAX_ENTRIES(1024*1024UL)
-#defineOPAL_PCI_TCE_SEG_SIZE   (16*1024*1024UL)
+#defineOPAL_PCI_TCE_DEFAULT_SEG_SIZE   (16*1024*1024UL)
 #defineOPAL_PCI_TCE_R  (1UL << 0)
 #defineOPAL_PCI_TCE_W  (1UL << 1)
 #definePHB3_TCE_KILL_INVAL_ALL (1UL << 63)
@@ -195,15 +195,52 @@ pci_phb3_tce_invalidate_entire(struct opalpci_softc *s
mb();
 }
 
+/* Simple function to round to a power of 2 */
+static uint64_t
+round_pow2(uint64_t val)
+{
+
+   return (1 << (flsl(val + (val - 1)) - 1));
+}
+
+/*
+ * Starting with skiboot 5.10 PCIe nodes have a new property,
+ * "ibm,supported-tce-sizes", to denote the TCE sizes available.  This allows 
us
+ * to avoid hard-coding the maximum TCE size allowed, and instead provide a 
sane
+ * default (however, the "sane" default, which works for all targets, is 64k,
+ * limiting us to 64GB if we have 1M entries.
+ */
+static uint64_t
+max_tce_size(device_t dev)
+{
+   phandle_t node;
+   cell_t sizes[64]; /* Property is a list of bit-widths, up to 64-bits */
+   int count;
+
+   node = ofw_bus_get_node(dev);
+
+   count = OF_getencprop(node, "ibm,supported-tce-sizes",
+   sizes, sizeof(sizes));
+   if (count < sizeof(cell_t))
+   return OPAL_PCI_TCE_DEFAULT_SEG_SIZE;
+
+   count /= sizeof(cell_t);
+
+   return (1ULL << sizes[count - 1]);
+}
+
 static int
 opalpci_attach(device_t dev)
 {
struct opalpci_softc *sc;
-   cell_t id[2], m64window[6], npe;
+   cell_t id[2], m64ranges[2], m64window[6], npe;
phandle_t node;
int i, err;
uint64_t maxmem;
uint64_t entries;
+   uint64_t tce_size;
+   uint64_t tce_tbl_size;
+   int m64bar;
int rid;
 
sc = device_get_softc(dev);
@@ -236,6 +273,7 @@ opalpci_attach(device_t dev)
return (ENXIO);
}
 
+#if 0
/*
 * Reset PCI IODA table
 */
@@ -245,11 +283,32 @@ opalpci_attach(device_t dev)
device_printf(dev, "IODA table reset failed: %d\n", err);
return (ENXIO);
}
-   while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0)
-   DELAY(1000*(err + 1)); /* Returns expected delay in ms */
+   err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PHB_COMPLETE,
+   1);
if (err < 0) {
+   device_printf(dev, "PHB reset failed: %d\n", err);
+   return (ENXIO);
+   }
+   if (err > 0) {
+   while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) {
+   DELAY(1000*(err + 1)); /* Returns expected delay in ms 
*/
+   }
+   }
+   if (err < 0) {
device_printf(dev, "WARNING: PHB IODA reset poll failed: %d\n", 
err);
}
+   err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PHB_COMPLETE,
+   0);
+   if (err < 0) {
+   device_printf(dev, "PHB reset failed: %d\n", err);
+   return (ENXIO);
+   }
+   if (err > 0) {
+   while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) {
+   DELAY(1000*(err + 1)); /* Returns expected delay in ms 
*/
+   }
+   }
+#endif
 
/*
 * Map all devices on the bus to partitionable endpoint one until
@@ -275,49 +334,58 @@ opalpci_attach(device_t dev)
device_printf(dev, "MMIO %d map failed: %d\n", i, err);
}
 
+   if (OF_getencprop(node, "ibm,opal-available-m64-ranges",
+   m64ranges, sizeof(m64ranges)) == sizeof(m64ranges))
+   m64bar = m64ranges[0];
+   else
+   m64bar = 0;
+
/* XXX: multiple M64 windows? */
if (OF_getencprop(node, "ibm,opal-m64-window",
m64window, sizeof(m64window)) == sizeof(m64window)) {
opal_call(OPAL_PCI_PHB_MMIO_ENABLE, sc->phb_id,
-   OPAL_M64_WINDOW_TYPE, 0, 0);
+   OPAL_M64_WINDOW_TYPE, m64bar, 0);

svn commit: r334368 - in head/sys: kern sys

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Wed May 30 03:39:57 2018
New Revision: 334368
URL: https://svnweb.freebsd.org/changeset/base/334368

Log:
  epoch(9): make epoch closer to style(9)

Modified:
  head/sys/kern/subr_epoch.c
  head/sys/sys/epoch.h

Modified: head/sys/kern/subr_epoch.c
==
--- head/sys/kern/subr_epoch.c  Wed May 30 03:00:57 2018(r334367)
+++ head/sys/kern/subr_epoch.c  Wed May 30 03:39:57 2018(r334368)
@@ -72,49 +72,54 @@ SYSCTL_NODE(_kern_epoch, OID_AUTO, stats, CTLFLAG_RW, 
 
 /* Stats. */
 static counter_u64_t block_count;
+
 SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, nblocked, CTLFLAG_RW,
-  &block_count, "# of times a thread was in an 
epoch when epoch_wait was called");
+&block_count, "# of times a thread was in an epoch when epoch_wait was 
called");
 static counter_u64_t migrate_count;
+
 SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, migrations, CTLFLAG_RW,
-  &migrate_count, "# of times thread was 
migrated to another CPU in epoch_wait");
+&migrate_count, "# of times thread was migrated to another CPU in 
epoch_wait");
 static counter_u64_t turnstile_count;
+
 SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, ncontended, CTLFLAG_RW,
-  &turnstile_count, "# of times a thread was 
blocked on a lock in an epoch during an epoch_wait");
+&turnstile_count, "# of times a thread was blocked on a lock in an epoch 
during an epoch_wait");
 static counter_u64_t switch_count;
+
 SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, switches, CTLFLAG_RW,
-  &switch_count, "# of times a thread 
voluntarily context switched in epoch_wait");
+&switch_count, "# of times a thread voluntarily context switched in 
epoch_wait");
 static counter_u64_t epoch_call_count;
+
 SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, epoch_calls, CTLFLAG_RW,
-  &epoch_call_count, "# of times a callback 
was deferred");
+&epoch_call_count, "# of times a callback was deferred");
 static counter_u64_t epoch_call_task_count;
+
 SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, epoch_call_tasks, CTLFLAG_RW,
-  &epoch_call_task_count, "# of times a 
callback task was run");
+&epoch_call_task_count, "# of times a callback task was run");
 
-TAILQ_HEAD(threadlist, thread);
+TAILQ_HEAD (threadlist, thread);
 
 CK_STACK_CONTAINER(struct ck_epoch_entry, stack_entry,
 ck_epoch_entry_container)
-
 typedef struct epoch_record {
ck_epoch_record_t er_record;
volatile struct threadlist er_tdlist;
volatile uint32_t er_gen;
uint32_t er_cpuid;
-} *epoch_record_t;
+}  *epoch_record_t;
 
 struct epoch_pcpu_state {
struct epoch_record eps_record;
-} __aligned(EPOCH_ALIGN);
+}  __aligned(EPOCH_ALIGN);
 
 struct epoch {
struct ck_epoch e_epoch __aligned(EPOCH_ALIGN);
struct epoch_pcpu_state *e_pcpu_dom[MAXMEMDOM] __aligned(EPOCH_ALIGN);
-   int e_idx;
-   int e_flags;
+   int e_idx;
+   int e_flags;
struct epoch_pcpu_state *e_pcpu[0];
 };
 
-epoch_t allepochs[MAX_EPOCHS];
+epoch_tallepochs[MAX_EPOCHS];
 
 DPCPU_DEFINE(struct grouptask, epoch_cb_task);
 DPCPU_DEFINE(int, epoch_cb_count);
@@ -154,7 +159,7 @@ epoch_init(void *arg __unused)
printf("domcount[%d] %d\n", domain, domcount[domain]);
}
for (domain = 1; domain < vm_ndomains; domain++)
-   domoffsets[domain] = domoffsets[domain-1] + domcount[domain-1];
+   domoffsets[domain] = domoffsets[domain - 1] + domcount[domain - 
1];
 
for (domain = 0; domain < vm_ndomains; domain++) {
if (domcount[domain] == 0) {
@@ -162,7 +167,7 @@ epoch_init(void *arg __unused)
break;
}
}
- done:
+done:
CPU_FOREACH(cpu) {
GROUPTASK_INIT(DPCPU_ID_PTR(cpu, epoch_cb_task), 0, 
epoch_call_task, NULL);
taskqgroup_attach_cpu(qgroup_softirq, DPCPU_ID_PTR(cpu, 
epoch_cb_task), NULL, cpu, -1, "epoch call task");
@@ -171,6 +176,7 @@ epoch_init(void *arg __unused)
global_epoch = epoch_alloc(0);
global_epoch_preempt = epoch_alloc(EPOCH_PREEMPT);
 }
+
 SYSINIT(epoch, SI_SUB_TASKQ + 1, SI_ORDER_FIRST, epoch_init, NULL);
 
 static void
@@ -181,8 +187,8 @@ epoch_init_numa(epoch_t epoch)
epoch_record_t er;
 
for (domain = 0; domain < vm_ndomains; domain++) {
-   eps = malloc_domain(sizeof(*eps)*domcount[domain], M_EPOCH,
-   domain, 
M_ZERO|M_WAITOK);
+   eps = malloc_domain(sizeof(*eps) * domcount[domain], M_EPOCH,
+   domain, M_ZERO | M_WAITOK);
epoch->e_pcpu_dom[domain] = eps;
cpu_offset = domoffsets[domain];
  

svn commit: r334369 - head/lib/libpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Wed May 30 03:40:02 2018
New Revision: 334369
URL: https://svnweb.freebsd.org/changeset/base/334369

Log:
  libpmc: bring pmu_util closer in line with style(9)

Modified:
  head/lib/libpmc/libpmc_pmu_util.c   (contents, props changed)

Modified: head/lib/libpmc/libpmc_pmu_util.c
==
--- head/lib/libpmc/libpmc_pmu_util.c   Wed May 30 03:39:57 2018
(r334368)
+++ head/lib/libpmc/libpmc_pmu_util.c   Wed May 30 03:40:02 2018
(r334369)
@@ -46,21 +46,21 @@ struct pmu_alias {
const char *pa_name;
 };
 static struct pmu_alias pmu_alias_table[] = {
-{ "UNHALTED_CORE_CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"},
-{ "UNHALTED-CORE-CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"},
-   { "LLC_MISSES", "LONGEST_LAT_CACHE.MISS"},
-   { "LLC-MISSES", "LONGEST_LAT_CACHE.MISS"},
-   { "LLC_REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"},
-   { "LLC-REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"},
-   { "LLC_MISS_RHITM", "mem_load_l3_miss_retired.remote_hitm"},
-   { "LLC-MISS-RHITM", "mem_load_l3_miss_retired.remote_hitm"},
-   { "RESOURCE_STALL", "RESOURCE_STALLS.ANY"},
-   { "RESOURCE_STALLS_ANY", "RESOURCE_STALLS.ANY"},
-   { "BRANCH_INSTRUCTION_RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"},
-   { "BRANCH-INSTRUCTION-RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"},
-   { "BRANCH_MISSES_RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"},
-   { "BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"},
-   { NULL, NULL },
+   {"UNHALTED_CORE_CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"},
+   {"UNHALTED-CORE-CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"},
+   {"LLC_MISSES", "LONGEST_LAT_CACHE.MISS"},
+   {"LLC-MISSES", "LONGEST_LAT_CACHE.MISS"},
+   {"LLC_REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"},
+   {"LLC-REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"},
+   {"LLC_MISS_RHITM", "mem_load_l3_miss_retired.remote_hitm"},
+   {"LLC-MISS-RHITM", "mem_load_l3_miss_retired.remote_hitm"},
+   {"RESOURCE_STALL", "RESOURCE_STALLS.ANY"},
+   {"RESOURCE_STALLS_ANY", "RESOURCE_STALLS.ANY"},
+   {"BRANCH_INSTRUCTION_RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"},
+   {"BRANCH-INSTRUCTION-RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"},
+   {"BRANCH_MISSES_RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"},
+   {"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"},
+   {NULL, NULL},
 };
 
 static const char *fixed_mode_cntrs[] = {
@@ -89,13 +89,13 @@ struct pmu_event_desc {
uint32_t ped_frontend;
uint32_t ped_ldlat;
uint32_t ped_config1;
-   uint8_t ped_umask;
-   uint8_t ped_cmask;
-   uint8_t ped_any;
-   uint8_t ped_inv;
-   uint8_t ped_edge;
-   uint8_t ped_fc_mask;
-   uint8_t ped_ch_mask;
+   uint8_t ped_umask;
+   uint8_t ped_cmask;
+   uint8_t ped_any;
+   uint8_t ped_inv;
+   uint8_t ped_edge;
+   uint8_t ped_fc_mask;
+   uint8_t ped_ch_mask;
 };
 
 static const struct pmu_events_map *
@@ -106,10 +106,10 @@ pmu_events_map_get(void)
const struct pmu_events_map *pme;
 
if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, &s,
-(void *)NULL, 0) == -1)
+   (void *)NULL, 0) == -1)
return (NULL);
if (sysctlbyname("kern.hwpmc.cpuid", buf, &s,
-(void *)NULL, 0) == -1)
+   (void *)NULL, 0) == -1)
return (NULL);
for (pme = pmu_events_map; pme->cpuid != NULL; pme++)
if (strcmp(buf, pme->cpuid) == 0)
@@ -147,8 +147,7 @@ pmc_pmu_event_get_by_idx(int idx)
 
if ((pme = pmu_events_map_get()) == NULL)
return (NULL);
-   for (i = 0, pe = pme->table; (pe->name || pe->desc || pe->event) && i < 
idx; pe++, i++)
-   ;
+   for (i = 0, pe = pme->table; (pe->name || pe->desc || pe->event) && i < 
idx; pe++, i++);
return (pe->name);
 }
 
@@ -237,7 +236,7 @@ pmc_pmu_print_counters(void)
struct pmu_event_desc ped;
char *debug;
int do_debug;
-   
+
debug = getenv("PMUDEBUG");
do_debug = 0;
 
@@ -266,8 +265,8 @@ pmc_pmu_print_counter_desc(const char *ev)
if (pe->name == NULL)
continue;
if (strcasestr(pe->name, ev) != NULL &&
-   pe->desc != NULL)
-   printf("%s:\t%s\n", pe->name, pe->desc);
+   pe->desc != NULL)
+   printf("%s:\t%s\n", pe->name, pe->desc);
}
 }
 
@@ -318,12 +317,11 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc
for (idx = 0; fixed_mode_cntrs[idx] != NULL; idx++)
if (strcmp(fixed_mode_cntrs[idx], event_name) == 0)
isfixed = 1;
-
if (isfixed) {
if (strcasestr(pe->desc, "retired") != NULL)
 

svn commit: r334370 - head/sys/cddl/dev/dtrace/powerpc

2018-05-29 Thread Justin Hibbits
Author: jhibbits
Date: Wed May 30 03:48:27 2018
New Revision: 334370
URL: https://svnweb.freebsd.org/changeset/base/334370

Log:
  Protect dtrace_getpcstack() from a NULL stack pointer in a trap frame
  
  Found when trying to use lockstat on a POWER9, the stack pointer (r1) could
  be NULL, and result in a NULL pointer dereference, crashing the kernel.

Modified:
  head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c

Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
==
--- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c   Wed May 30 03:40:02 
2018(r334369)
+++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c   Wed May 30 03:48:27 
2018(r334370)
@@ -98,6 +98,7 @@ static __inline uintptr_t
 dtrace_next_sp(uintptr_t sp)
 {
vm_offset_t callpc;
+   uintptr_t *r1;
struct trapframe *frame;
 
 #ifdef __powerpc64__
@@ -114,7 +115,10 @@ dtrace_next_sp(uintptr_t sp)
callpc + OFFSET == (vm_offset_t) &asttrapexit)) {
/* Access the trap frame */
frame = (struct trapframe *)(sp + FRAME_OFFSET);
-   return (*(uintptr_t *)(frame->fixreg[1]));
+   r1 = (uintptr_t *)frame->fixreg[1];
+   if (r1 == NULL)
+   return (0);
+   return (*r1);
}
 
return (*(uintptr_t*)sp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334367 - head/sys/powerpc/powernv

2018-05-29 Thread Justin Hibbits
On Tue, May 29, 2018 at 10:00 PM, Justin Hibbits  wrote:
> Author: jhibbits
> Date: Wed May 30 03:00:57 2018
> New Revision: 334367
> URL: https://svnweb.freebsd.org/changeset/base/334367
>
> Log:
>   Make opal_pci driver work with POWER9
>
>   Summary:
>   Coupled with r334365, this makes PCI work on POWER9.  There is still more to
>   do to fully exploit the hardware capabilities, but this is sufficient to
>   enable USB and ethernet controllers on a POWER9 Talos II system.

As mmacy pointed out, it's PCIe.  POWER9 has no PCI controller, only PCIe.

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


svn commit: r334371 - head/lib/libpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Wed May 30 04:12:51 2018
New Revision: 334371
URL: https://svnweb.freebsd.org/changeset/base/334371

Log:
  libpmc: squelch valgrind warnings

Modified:
  head/lib/libpmc/libpmc.c

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cWed May 30 03:48:27 2018(r334370)
+++ head/lib/libpmc/libpmc.cWed May 30 04:12:51 2018(r334371)
@@ -3277,6 +3277,7 @@ pmc_init(void)
return (pmc_syscall = -1);
}
 
+   bzero(&op_cpu_info, sizeof(op_cpu_info));
if (PMC_CALL(GETCPUINFO, &op_cpu_info) < 0)
return (pmc_syscall = -1);
 
@@ -3284,7 +3285,7 @@ pmc_init(void)
cpu_info.pm_ncpu= op_cpu_info.pm_ncpu;
cpu_info.pm_npmc= op_cpu_info.pm_npmc;
cpu_info.pm_nclass  = op_cpu_info.pm_nclass;
-   for (n = 0; n < cpu_info.pm_nclass; n++)
+   for (n = 0; n < op_cpu_info.pm_nclass; n++)
memcpy(&cpu_info.pm_classes[n], &op_cpu_info.pm_classes[n],
sizeof(cpu_info.pm_classes[n]));
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334372 - head/sys/dev/vt/hw/ofwfb

2018-05-29 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed May 30 04:15:33 2018
New Revision: 334372
URL: https://svnweb.freebsd.org/changeset/base/334372

Log:
  If linebytes property is missing from the graphics device, assume no
  overscan and synthesize it from the display depth and screen width.
  This may not be right, but it sometimes right and is better than
  returning CN_DEAD.

Modified:
  head/sys/dev/vt/hw/ofwfb/ofwfb.c

Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c
==
--- head/sys/dev/vt/hw/ofwfb/ofwfb.cWed May 30 04:12:51 2018
(r334371)
+++ head/sys/dev/vt/hw/ofwfb/ofwfb.cWed May 30 04:15:33 2018
(r334372)
@@ -394,8 +394,7 @@ ofwfb_init(struct vt_device *vd)
/* Make sure we have needed properties */
if (OF_getproplen(node, "height") != sizeof(height) ||
OF_getproplen(node, "width") != sizeof(width) ||
-   OF_getproplen(node, "depth") != sizeof(depth) ||
-   OF_getproplen(node, "linebytes") != sizeof(sc->fb.fb_stride))
+   OF_getproplen(node, "depth") != sizeof(depth))
return (CN_DEAD);
 
/* Only support 8 and 32-bit framebuffers */
@@ -406,7 +405,9 @@ ofwfb_init(struct vt_device *vd)
 
OF_getprop(node, "height", &height, sizeof(height));
OF_getprop(node, "width", &width, sizeof(width));
-   OF_getprop(node, "linebytes", &stride, sizeof(stride));
+   if (OF_getprop(node, "linebytes", &stride, sizeof(stride)) !=
+   sizeof(stride))
+   stride = width*depth/8;
 
sc->fb.fb_height = height;
sc->fb.fb_width = width;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334373 - head

2018-05-29 Thread Warner Losh
Author: imp
Date: Wed May 30 05:00:30 2018
New Revision: 334373
URL: https://svnweb.freebsd.org/changeset/base/334373

Log:
  We've removed the special case code for upgrading from FreeBSD 9 so
  remove the special warning. It's in svn if we need it.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed May 30 04:15:33 2018(r334372)
+++ head/UPDATING   Wed May 30 05:00:30 2018(r334373)
@@ -32,25 +32,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
 
-** SPECIAL WARNING: **
-
-   Due to a bug in some versions of clang that's very hard to workaround in
-   the upgrade process, to upgrade to -current you must first upgrade
-   either stable/9 after r286035 or stable/10 after r286033 (including
-   10.3-RELEASE) or current after r286007 (including stable/11 and
-   11.0-RELEASE). These revisions post-date the 10.2 and 9.3 releases, so
-   you'll need to take the unusual step of upgrading to the tip of the
-   stable branch before moving to 11 or -current via a source upgrade.
-   stable/11 and 11.0-RELEASE have working newer compiler. This differs
-   from the historical situation where one could upgrade from anywhere on
-   the last couple of stable branches, so be careful.
-
-   If you're running a hybrid system on 9.x or 10.x with an updated clang
-   compiler or are using an supported external toolchain, the build system
-   will allow the upgrade. Otherwise it will print a reminder.
-
-** SPECIAL WARNING: **
-
 20180523:
The on-disk format for hwpmc callchain records has changed to include
threadid corresponding to a given record. This changes the field offsets
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-29 Thread Antoine Brodin
On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Mon May 28 08:12:18 2018
> New Revision: 334277
> URL: https://svnweb.freebsd.org/changeset/base/334277
>
> Log:
>   MFV r333789: libpcap 1.9.0 (pre-release)
>
>   MFC after:1 month
>   Sponsored by: Mellanox Technologies

Hi,

Some things seem to be missing.
For instance,  pcap_setsampling and pcap_open are now declared in
pcap.h but they are not compiled in libpcap.so.
net/p5-Net-Pcap is confused by this:
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log

Cheers,

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


svn commit: r334374 - head/sys/dev/hwpmc

2018-05-29 Thread Matt Macy
Author: mmacy
Date: Wed May 30 06:29:22 2018
New Revision: 334374
URL: https://svnweb.freebsd.org/changeset/base/334374

Log:
  hwpmc: remove stale assert
  
  Reported by:  eadler

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==
--- head/sys/dev/hwpmc/hwpmc_mod.c  Wed May 30 05:00:30 2018
(r334373)
+++ head/sys/dev/hwpmc/hwpmc_mod.c  Wed May 30 06:29:22 2018
(r334374)
@@ -2197,7 +2197,6 @@ pmc_hook_handler(struct thread *td, int function, void
break;
 
case PMC_FN_MMAP:
-   MPASS(in_epoch() || sx_xlocked(&pmc_sx));
pmc_process_mmap(td, (struct pmckern_map_in *) arg);
break;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"