svn commit: r296929 - head/share/man/man9

2016-03-15 Thread Conrad E. Meyer
Author: cem
Date: Wed Mar 16 05:05:54 2016
New Revision: 296929
URL: https://svnweb.freebsd.org/changeset/base/296929

Log:
  fail.9: Bump Dd

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

Modified: head/share/man/man9/fail.9
==
--- head/share/man/man9/fail.9  Wed Mar 16 04:37:26 2016(r296928)
+++ head/share/man/man9/fail.9  Wed Mar 16 05:05:54 2016(r296929)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 02, 2016
+.Dd March 15, 2016
 .Dt FAIL 9
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-15 Thread Julian Elischer

On 16/03/2016 3:12 AM, Gleb Smirnoff wrote:

   Ravi,

On Mon, Mar 14, 2016 at 05:33:06PM -0700, Ravi Pokala wrote:
R> To make sure I'm reading this correctly:
R>
R> (1) The sysctl operates on an opaque array of (uint64_t)s. The elements of 
the array are not individually accessible.

On array of counter_u64_t. The elements are individually accessible of course,
but not by this sysctl API.

R> (2) Reading the sysctl populates each element of the userspace array by 
calling counter_u64_fetch() on the corresponding element of the kernelspace array.

Right.

R> (3) Writing the sysctl clears the kernelspace array by calling 
counter_u64_zero() on each element.

Right.

but it is not atomic.  since the user process decides the time delay 
between a read and write (zero) there could be  a lot of missed counts 
if you are resetting to zero after each read. better to just read in a 
loop and not zero..

here are somethings I've wanted at various times:
  read/zero atomic
  read timestamp as part of imported struct. (because you really 
can't do accurate timing from user space, but knowing when the data 
was read is a good replacement).
 read a "mib" (for want of a better term)  for each set, giving 
individual field names.




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


svn commit: r296927 - in head: share/man/man9 sys/kern sys/sys

2016-03-15 Thread Conrad E. Meyer
Author: cem
Date: Wed Mar 16 04:22:32 2016
New Revision: 296927
URL: https://svnweb.freebsd.org/changeset/base/296927

Log:
  fail(9): Upstreaming some fail point enhancements
  
  This is several year's worth of fail point upgrades done at EMC Isilon. They
  are interdependent enough that it makes sense to put a single diff up for 
them.
  Primarily, we added:
  
  - Changing all mainline execution paths to be lockless, which lets us use fail
points in more sleep-sensitive areas, and allows more parallel execution
  - A number of additional commands, including 'pause' that lets us do some
interesting deterministic repros of race conditions
  - The ability to dump the stacks of all threads sleeping on a fail point
  - A number of other API changes to allow marking up the fail point's context 
in
the code, and firing callbacks before and after execution
  - A man page update
  
  Submitted by: Matthew Bryan 
  Reviewed by:  cem (earlier version), jhb, kib, pho
  With feedback from:   bdrewery
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D5427

Modified:
  head/share/man/man9/fail.9
  head/sys/kern/kern_fail.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/sys/fail.h
  head/sys/sys/sleepqueue.h

Modified: head/share/man/man9/fail.9
==
--- head/share/man/man9/fail.9  Wed Mar 16 04:05:02 2016(r296926)
+++ head/share/man/man9/fail.9  Wed Mar 16 04:22:32 2016(r296927)
@@ -26,25 +26,31 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 10, 2009
+.Dd February 02, 2016
 .Dt FAIL 9
 .Os
 .Sh NAME
 .Nm KFAIL_POINT_CODE ,
+.Nm KFAIL_POINT_CODE_FLAGS ,
+.Nm KFAIL_POINT_CODE_COND ,
 .Nm KFAIL_POINT_RETURN ,
 .Nm KFAIL_POINT_RETURN_VOID ,
 .Nm KFAIL_POINT_ERROR ,
 .Nm KFAIL_POINT_GOTO ,
+.Nm KFAIL_POINT_SLEEP_CALLBACKS ,
 .Nm fail_point ,
 .Nm DEBUG_FP
 .Nd fail points
 .Sh SYNOPSIS
 .In sys/fail.h
 .Fn KFAIL_POINT_CODE "parent" "name" "code"
+.Fn KFAIL_POINT_CODE_FLAGS "parent" "name" "flags" "code"
+.Fn KFAIL_POINT_CODE_COND "parent" "name" "cond" "flags" "code"
 .Fn KFAIL_POINT_RETURN "parent" "name"
 .Fn KFAIL_POINT_RETURN_VOID "parent" "name"
 .Fn KFAIL_POINT_ERROR "parent" "name" "error_var"
 .Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
+.Fn KFAIL_POINT_SLEEP_CALLBACKS "parent" "name" "pre_func" "pre_arg" 
"post_func" "post_arg" "code"
 .Sh DESCRIPTION
 Fail points are used to add code points where errors may be injected
 in a user controlled fashion.
@@ -77,6 +83,42 @@ argument, the evaluation of
 is derived from the
 .Fn return
 value set in the sysctl MIB.
+.Pp
+Additionally,
+.Fn KFAIL_POINT_CODE_FLAGS
+provides a
+.Fa flags
+argument which controls the fail point's behaviour.
+This can be used to e.g., mark the fail point's context as non-sleepable,
+which causes the
+.Sy sleep
+action to be coerced to a busy wait.
+The supported flags are:
+.Bl -ohang -offset indent
+.It FAIL_POINT_USE_TIMEOUT_PATH
+Rather than sleeping on a
+.Fn sleep
+call, just fire the post-sleep function after a timeout fires.
+.It FAIL_POINT_NONSLEEPABLE
+Mark the fail point as being in a non-sleepable context, which coerces
+.Fn sleep
+calls to
+.Fn delay
+calls.
+.El
+.Pp
+Likewise,
+.Fn KFAIL_POINT_CODE_COND
+supplies a
+.Fa cond
+argument, which allows you to set the condition under which the fail point's
+code may fire.
+This is equivalent to:
+.Bd -literal
+   if (cond)
+   KFAIL_POINT_CODE_FLAGS(...);
+
+.Ed
 See
 .Sx SYSCTL VARIABLES
 below.
@@ -107,26 +149,12 @@ Many base kernel MIBs can be found in th
 tree (referenced in code by
 .Sy DEBUG_FP ) .
 .Pp
-The sysctl variable may be set using the following grammar:
+The sysctl variable may be set in a number of ways:
 .Bd -literal
-   ::
-   ( "->"  )*
-
-   ::
-  ( ( "%") | ( "*" ) )*
-  
-  [ "("  ")" ]
-  [ "[pid "  "]" ]
-
-   ::
-   [ "."  ] |
-  "." 
-
-   ::
-  "off" | "return" | "sleep" | "panic" | "break" | "print"
+  [%][*][(args...)][->]
 .Ed
 .Pp
-The  argument specifies which action to take:
+The  argument specifies which action to take; it can be one of:
 .Bl -tag -width ".Dv return"
 .It Sy off
 Take no action (does not trigger fail point code)
@@ -140,13 +168,23 @@ Panic
 Break into the debugger, or trap if there is no debugger support
 .It Sy print
 Print that the fail point executed
+.It Sy pause
+Threads sleep at the fail point until the fail point is set to
+.Sy off
+.It Sy yield
+Thread yields the cpu when the fail point is evaluated
+.It Sy delay
+Similar to sleep, but busy waits the cpu.
+(Useful in non-sleepable contexts.)
 .El
 .Pp
-The % and * modifiers prior to  control when
+The % and * modifiers prior to  control when
  is executed.
-The % form (e.g. "1.2%") can be used to specify a
+The % form (e.g. "1.2%") can be used to specify a
 probability that  will execute.
-The * form (e.g. "5*") can be used to specify the 

svn commit: r296926 - head/usr.sbin/kbdcontrol

2016-03-15 Thread Ed Maste
Author: emaste
Date: Wed Mar 16 04:05:02 2016
New Revision: 296926
URL: https://svnweb.freebsd.org/changeset/base/296926

Log:
  kbdcontrol: add -P path option to add keymap search paths
  
  PR:   193865
  Reviewed by:  cem
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5645

Modified:
  head/usr.sbin/kbdcontrol/kbdcontrol.1
  head/usr.sbin/kbdcontrol/kbdcontrol.c

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.1
==
--- head/usr.sbin/kbdcontrol/kbdcontrol.1   Wed Mar 16 02:07:04 2016
(r296925)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.1   Wed Mar 16 04:05:02 2016
(r296926)
@@ -13,7 +13,7 @@
 .\" @(#)kbdcontrol.1
 .\" $FreeBSD$
 .\"
-.Dd January 29, 2008
+.Dd March 16, 2016
 .Dt KBDCONTROL 1
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@
 .Op Fl f Ar # Ar string
 .Op Fl k Ar keyboard_device
 .Op Fl L Ar keymap_file
+.Op Fl P Ar path
 .Sh DESCRIPTION
 The
 .Nm
@@ -171,6 +172,12 @@ and write the
 compiled from it to stdout.
 This option is primarily intended for programmers and is probably
 of little use under normal circumstances.
+.It Fl P Ar path
+Search for the keymap file in
+.Ar path .
+The
+.Fl P
+option may be specified multiple times.
 .El
 .Sh ENVIRONMENT
 The environment variable

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c
==
--- head/usr.sbin/kbdcontrol/kbdcontrol.c   Wed Mar 16 02:07:04 2016
(r296925)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.c   Wed Mar 16 04:05:02 2016
(r296926)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "path.h"
 #include "lex.h"
@@ -112,11 +113,13 @@ static const int repeats[] = { 34,  38, 
 static const int ndelays = (sizeof(delays) / sizeof(int));
 static const int nrepeats = (sizeof(repeats) / sizeof(int));
 static int hex = 0;
+static int paths_configured = 0;
 static int token;
 
 intnumber;
 char   letter;
 
+static voidadd_keymap_path(const char *path);
 static voiddump_accent_definition(char *name, accentmap_t *accentmap);
 static voiddump_entry(int value);
 static voiddump_key_definition(char *name, keymap_t *keymap);
@@ -142,6 +145,12 @@ static voidset_keyrates(char *opt);
 static voidshow_kbd_info(void);
 static voidusage(void) __dead2;
 
+struct pathent {
+   STAILQ_ENTRY(pathent) next;
+   char *path;
+};
+static STAILQ_HEAD(, pathent) pathlist = STAILQ_HEAD_INITIALIZER(pathlist);
+
 /* Detect presence of vt(4). */
 static int
 is_vt4(void)
@@ -279,11 +288,11 @@ get_entry(void)
 }
 
 static int
-get_definition_line(FILE *fd, keymap_t *keymap, accentmap_t *accentmap)
+get_definition_line(FILE *file, keymap_t *keymap, accentmap_t *accentmap)
 {
int c;
 
-   yyin = fd;
+   yyin = file;
 
if (token < 0)
token = yylex();
@@ -791,32 +800,57 @@ dump_accent_definition(char *name, accen
 }
 
 static void
+add_keymap_path(const char *path)
+{
+   struct pathent* pe;
+   size_t len;
+
+   len = strlen(path);
+   if ((pe = malloc(sizeof(*pe))) == NULL ||
+   (pe->path = malloc(len + 2)) == NULL)
+   err(1, "malloc");
+   memcpy(pe->path, path, len);
+   if (len > 0 && path[len - 1] != '/')
+   pe->path[len++] = '/';
+   pe->path[len] = '\0';
+   STAILQ_INSERT_TAIL(, pe, next);
+}
+
+static void
 load_keymap(char *opt, int dumponly)
 {
keymap_t keymap;
accentmap_t accentmap;
-   FILE*fd;
-   int i, j;
+   struct pathent *pe;
+   FILE*file;
+   int j;
char*name, *cp;
charblank[] = "", keymap_path[] = KEYMAP_PATH;
charvt_keymap_path[] = VT_KEYMAP_PATH, dotkbd[] = ".kbd";
-   char*prefix[]  = {blank, blank, keymap_path, NULL};
char*postfix[] = {blank, dotkbd, NULL};
 
-   if (is_vt4())
-   prefix[2] = vt_keymap_path;
-   cp = getenv("KEYMAP_PATH");
-   if (cp != NULL)
-   asprintf(&(prefix[0]), "%s/", cp);
-
-   fd = NULL;
-   for (i=0; prefix[i] && fd == NULL; i++) {
-   for (j=0; postfix[j] && fd == NULL; j++) {
-   name = mkfullname(prefix[i], opt, postfix[j]);
-   fd = fopen(name, "r");
+   if (!paths_configured) {
+   cp = getenv("KEYMAP_PATH");
+   if (cp != NULL)
+   add_keymap_path(cp);
+   add_keymap_path("");
+   if (is_vt4())
+   add_keymap_path(vt_keymap_path);
+   else
+   add_keymap_path(keymap_path);
+   paths_configured = 1;
+   }
+
+   file = NULL;
+   STAILQ_FOREACH(pe, , next) {
+   for (j=0; postfix[j] && file == NULL; 

svn commit: r296925 - head/sys/net80211

2016-03-15 Thread Adrian Chadd
Author: adrian
Date: Wed Mar 16 02:07:04 2016
New Revision: 296925
URL: https://svnweb.freebsd.org/changeset/base/296925

Log:
  [net80211] Begin implementing rate control module stats.
  
  * Implement a new ratectl method, which defaults to returning nothing;
  * Add a top level sysctl (net.wlan.X.rate_stats) to extract it;
  * Add ratectl info for the 'amrr' module.
  
  Tested:
  
  * urtwn(4), STA mode
  
  Differential Revision:https://reviews.freebsd.org/D5630

Modified:
  head/sys/net80211/ieee80211_amrr.c
  head/sys/net80211/ieee80211_ratectl.c
  head/sys/net80211/ieee80211_ratectl.h

Modified: head/sys/net80211/ieee80211_amrr.c
==
--- head/sys/net80211/ieee80211_amrr.c  Wed Mar 16 02:01:17 2016
(r296924)
+++ head/sys/net80211/ieee80211_amrr.c  Wed Mar 16 02:07:04 2016
(r296925)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -75,6 +76,7 @@ static void   amrr_tx_update(const struct 
const struct ieee80211_node *, void *, void *, void *);
 static voidamrr_sysctlattach(struct ieee80211vap *,
struct sysctl_ctx_list *, struct sysctl_oid *);
+static voidamrr_node_stats(struct ieee80211_node *ni, struct sbuf *s);
 
 /* number of references from net80211 layer */
 static int nrefs = 0;
@@ -91,6 +93,7 @@ static const struct ieee80211_ratectl am
.ir_tx_complete = amrr_tx_complete,
.ir_tx_update   = amrr_tx_update,
.ir_setinterval = amrr_setinterval,
+   .ir_node_stats  = amrr_node_stats,
 };
 IEEE80211_RATECTL_MODULE(amrr, 1);
 IEEE80211_RATECTL_ALG(amrr, IEEE80211_RATECTL_AMRR, amrr);
@@ -410,3 +413,31 @@ amrr_sysctlattach(struct ieee80211vap *v
"amrr_min_sucess_threshold", CTLFLAG_RW,
>amrr_min_success_threshold, 0, "");
 }
+
+static void
+amrr_node_stats(struct ieee80211_node *ni, struct sbuf *s)
+{
+   int rate;
+   struct ieee80211_amrr_node *amn = ni->ni_rctls;
+   struct ieee80211_rateset *rs;
+
+   /* XXX TODO: check locking? */
+
+   /* XXX TODO: this should be a method */
+   if (amrr_node_is_11n(ni)) {
+   rs = (struct ieee80211_rateset *) >ni_htrates;
+   rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL;
+   sbuf_printf(s, "rate: MCS %d\n", rate);
+   } else {
+   rs = >ni_rates;
+   rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL;
+   sbuf_printf(s, "rate: %d Mbit\n", rate / 2);
+   }
+
+   sbuf_printf(s, "ticks: %d\n", amn->amn_ticks);
+   sbuf_printf(s, "txcnt: %u\n", amn->amn_txcnt);
+   sbuf_printf(s, "success: %u\n", amn->amn_success);
+   sbuf_printf(s, "success_threshold: %u\n", amn->amn_success_threshold);
+   sbuf_printf(s, "recovery: %u\n", amn->amn_recovery);
+   sbuf_printf(s, "retry_cnt: %u\n", amn->amn_retrycnt);
+}

Modified: head/sys/net80211/ieee80211_ratectl.c
==
--- head/sys/net80211/ieee80211_ratectl.c   Wed Mar 16 02:01:17 2016
(r296924)
+++ head/sys/net80211/ieee80211_ratectl.c   Wed Mar 16 02:07:04 2016
(r296925)
@@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -68,12 +69,52 @@ ieee80211_ratectl_unregister(int type)
ratectls[type] = NULL;
 }
 
+static void
+ieee80211_ratectl_sysctl_stats_node_iter(void *arg, struct ieee80211_node *ni)
+{
+
+   struct sbuf *sb = (struct sbuf *) arg;
+   sbuf_printf(sb, "MAC: %6D\n", ni->ni_macaddr, ":");
+   ieee80211_ratectl_node_stats(ni, sb);
+   sbuf_printf(sb, "\n");
+}
+
+static int
+ieee80211_ratectl_sysctl_stats(SYSCTL_HANDLER_ARGS)
+{
+   struct ieee80211vap *vap = arg1;
+   struct ieee80211com *ic = vap->iv_ic;
+   struct sbuf sb;
+   int error;
+
+   error = sysctl_wire_old_buffer(req, 0);
+   if (error)
+   return (error);
+   sbuf_new_for_sysctl(, NULL, 8, req);
+   sbuf_clear_flags(, SBUF_INCLUDENUL);
+
+   IEEE80211_LOCK(ic);
+   ieee80211_iterate_nodes(>ic_sta,
+   ieee80211_ratectl_sysctl_stats_node_iter,
+   );
+   IEEE80211_UNLOCK(ic);
+
+   error = sbuf_finish();
+   sbuf_delete();
+   return (error);
+}
+
 void
 ieee80211_ratectl_init(struct ieee80211vap *vap)
 {
if (vap->iv_rate == ratectls[IEEE80211_RATECTL_NONE])
ieee80211_ratectl_set(vap, IEEE80211_RATECTL_AMRR);
vap->iv_rate->ir_init(vap);
+
+   /* Attach generic stats sysctl */
+   SYSCTL_ADD_PROC(vap->iv_sysctl, SYSCTL_CHILDREN(vap->iv_oid), OID_AUTO,
+   "rate_stats", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, vap,
+   0, ieee80211_ratectl_sysctl_stats, "A", "ratectl node stats");
 }
 
 void

Modified: 

svn commit: r296922 - head/sys/dev/ixgbe

2016-03-15 Thread Steven Hartland
Author: smh
Date: Wed Mar 16 01:41:55 2016
New Revision: 296922
URL: https://svnweb.freebsd.org/changeset/base/296922

Log:
  Prevent invalid ixgbe advertise setting warning
  
  Prevent ixgbe outputting "Invalid advertised speed" warning on boot with
  no customisations by moving test from sysctl handler to set handler.
  
  PR:   208022
  MFC after:3 days
  Sponsored by: Multiplay

Modified:
  head/sys/dev/ixgbe/if_ix.c

Modified: head/sys/dev/ixgbe/if_ix.c
==
--- head/sys/dev/ixgbe/if_ix.c  Tue Mar 15 22:27:29 2016(r296921)
+++ head/sys/dev/ixgbe/if_ix.c  Wed Mar 16 01:41:55 2016(r296922)
@@ -4749,10 +4749,6 @@ ixgbe_sysctl_advertise(SYSCTL_HANDLER_AR
if ((error) || (req->newptr == NULL))
return (error);
 
-   /* Checks to validate new value */
-   if (adapter->advertise == advertise) /* no change */
-   return (0);
-
return ixgbe_set_advertise(adapter, advertise);
 }
 
@@ -4763,6 +4759,10 @@ ixgbe_set_advertise(struct adapter *adap
struct ixgbe_hw *hw;
ixgbe_link_speedspeed;
 
+   /* Checks to validate new value */
+   if (adapter->advertise == advertise) /* no change */
+   return (0);
+
hw = >hw;
dev = adapter->dev;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296921 - head/share/mk

2016-03-15 Thread Bryan Drewery
Author: bdrewery
Date: Tue Mar 15 22:27:29 2016
New Revision: 296921
URL: https://svnweb.freebsd.org/changeset/base/296921

Log:
  Partially revert r266227 and stop stripping paths in ldscripts.
  
  Specifically this fixes /usr/lib/libc.so stripping the paths to the
  libraries.  The reason for this in r266227 was both likely because ld(1) did
  not fully respect --sysroot until r291226 and because of the lib32
  build.  The lib32 build does not use --sysroot into the /usr/lib32 path,
  rather it only uses -L and -B into the /usr/lib32 path and --sysroot
  into the normal (64bit) /usr/lib.  The _LDSCRIPTROOT was added with
  the ldscript support in bsd.lib.mk so that it builds a 32-bit-sysrooted pathed
  ldscript in the object directory and then installs a normal unprefixed
  version in installworld.  This commit also fixes the rebuild during
  install which was broken in r266227.  This commit would break DIRDEPS_BUILD
  build of lib32 but it does not currently have a way to build it anyhow.
  
  For example, before this change we had in /usr/lib/libc.so:
GROUP ( libc.so.7 libc_nonshared.a libssp_nonshared.a )
  Now it is restored to pre-r266227:
GROUP ( /lib/libc.so.7 /usr/lib/libc_nonshared.a 
/usr/lib/libssp_nonshared.a )
  
  The motivation for this is in testing of lld.
  From emaste:
lld does not have built-in search paths (e.g. /lib, /usr/lib) and relies on
-L arguments passed by the caller.  As the linker is nearly always invoked
from the clang driver this is fine other than the fact that /usr/lib/libc.so
is an ldscript that refers to libc.so.7 which is in /lib, not /usr/lib.
  
  PR:   207980
  Reported by:  emaste
  Submitted by: emaste (based on)
  Differential Revision:https://reviews.freebsd.org/D5637

Modified:
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkTue Mar 15 21:32:46 2016(r296920)
+++ head/share/mk/bsd.lib.mkTue Mar 15 22:27:29 2016(r296921)
@@ -235,7 +235,6 @@ ${SHLIB_NAME_FULL}: beforelinking
 ${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT}
sed -e 's,@@SHLIB@@,${_LDSCRIPTROOT}${_SHLIBDIR}/${SHLIB_NAME},g' \
-e 's,@@LIBDIR@@,${_LDSCRIPTROOT}${_LIBDIR},g' \
-   -e 's,/[^ ]*/,,g' \
${.ALLSRC} > ${.TARGET}
 
 ${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld
@@ -339,6 +338,9 @@ _SHLINSTALLFLAGS:=  ${_SHLINSTALLFLAGS${i
 .if !defined(INTERNALLIB)
 realinstall: _libinstall
 .ORDER: beforeinstall _libinstall
+.if target(${SHLIB_LINK:R}.ld)
+_libinstall: ${SHLIB_LINK:R}.ld
+.endif
 _libinstall:
 .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
@@ -365,6 +367,7 @@ _libinstall:
${INSTALL} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
+   rm -f ${SHLIB_LINK:R}.ld
 .for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS}
${INSTALL_SYMLINK} ${SHLIB_LINK} 
${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK}
 .endfor

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkTue Mar 15 21:32:46 2016(r296920)
+++ head/share/mk/bsd.sys.mkTue Mar 15 22:27:29 2016(r296921)
@@ -231,7 +231,7 @@ stage_files.shlib: ${_LIBS:M*.so.*}
 .endif
 
 .if defined(SHLIB_LINK) && commands(${SHLIB_LINK:R}.ld)
-_LDSCRIPTROOT?= ${STAGE_OBJTOP}
+#_LDSCRIPTROOT?= ${STAGE_OBJTOP}
 STAGE_AS_SETS+= ldscript
 STAGE_AS.ldscript+= ${SHLIB_LINK:R}.ld
 stage_as.ldscript: ${SHLIB_LINK:R}.ld
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-15 Thread Don Lewis
On 15 Mar, Gleb Smirnoff wrote:
>   Hans,
> 
> On Tue, Mar 15, 2016 at 08:50:11AM +0100, Hans Petter Selasky wrote:
> H> > Modified: head/sys/sys/sysctl.h
> H> > 
> ==
> H> > --- head/sys/sys/sysctl.hMon Mar 14 23:49:16 2016
> (r296879)
> H> > +++ head/sys/sys/sysctl.hTue Mar 15 00:05:00 2016
> (r296880)
> H> > @@ -204,6 +204,7 @@ int sysctl_handle_long(SYSCTL_HANDLER_AR
> H> >   int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
> H> >   int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
> H> >   int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS);
> H> > +int sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS);
> H> >
> H> >   int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS);
> H> >   int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS);
> H> > @@ -648,6 +649,26 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
> H> >  __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); 
> \
> H> >   })
> H> >
> H> > +/* Oid for an array of counter(9)s.  The pointer and length must be non 
> zero. */
> H> > +#define SYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, 
> descr) \
> H> > +SYSCTL_OID(parent, nbr, name,   
> \
> H> > +CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), 
> \
> H> > +(ptr), (len), sysctl_handle_counter_u64_array, "S", descr); 
> \
> H> > +CTASSERT(((access) & CTLTYPE) == 0 ||   
> \
> H> > +((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
> H> > +
> H> 
> H> Gleb: I suggest you follow the example of the other static SYSCTLs, and 
> H> extend the CTASSERT to also cover the size of the array:
> 
> I agree.
> 
> H> CTASSERT(((access) & CTLTYPE) == 0 ||  \
> H>  (((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE &&  \
> H>   (sizeof(*(ptr)) == 8 * (len
> 
> Hardcoding 8 is definitely wrong here. If you come up with correct assert,
> feel free to commit it. I failed to imagine one quickly.
> 
> H> > +#define SYSCTL_ADD_COUNTER_U64_ARRAY(ctx, parent, nbr, name, access,
> \
> H> > +ptr, len, descr)
> \
> H> > +({  
> \
> H> > +counter_u64_t *__ptr = (ptr);   
> \
> H> > +CTASSERT(((access) & CTLTYPE) == 0 ||   
> \
> H> > +((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE);  
> \
> H> 
> H> Same here possibly. Maybe extend the CTASSERT() to also cover the size 
> H> of the array? Would limit the "len" to a constant argument though.
> 
> Of course limiting len to constant for a dynamic oid is something we
> don't want.


How can you do a CTASSERT() on something that isn't known at compile
time?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296919 - head/sys/cddl/compat/opensolaris/kern

2016-03-15 Thread Alexander Motin
Author: mav
Date: Tue Mar 15 21:21:28 2016
New Revision: 296919
URL: https://svnweb.freebsd.org/changeset/base/296919

Log:
  Fix small memory leak on attempt to access deleted snapshot.
  
  MFC after:3 days

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Tue Mar 15 
20:42:36 2016(r296918)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Tue Mar 15 
21:21:28 2016(r296919)
@@ -196,6 +196,7 @@ mount_snapshot(kthread_t *td, vnode_t **
VI_UNLOCK(vp);
vrele(vp);
vfs_unbusy(mp);
+   vfs_freeopts(mp->mnt_optnew);
vfs_mount_destroy(mp);
*vpp = NULL;
return (error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296920 - head/usr.bin/vtfontcvt

2016-03-15 Thread Ed Maste
Author: emaste
Date: Tue Mar 15 21:32:46 2016
New Revision: 296920
URL: https://svnweb.freebsd.org/changeset/base/296920

Log:
  vtfontcvt: support .hex fonts with characters beyond the Unicode BMP
  
  This is already supported by the vt(4) vfnt format mapping from code
  points to glyphs. Update the .hex font parser to accept up to six hex
  digits.

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

Modified: head/usr.bin/vtfontcvt/vtfontcvt.c
==
--- head/usr.bin/vtfontcvt/vtfontcvt.c  Tue Mar 15 21:21:28 2016
(r296919)
+++ head/usr.bin/vtfontcvt/vtfontcvt.c  Tue Mar 15 21:32:46 2016
(r296920)
@@ -315,12 +315,13 @@ parse_hex(FILE *fp, unsigned int map_idx
if (bytes != NULL)
errx(1, "malformed input: Width tag after font 
data");
set_width(atoi(ln + 9));
-   } else if (sscanf(ln, "%4x:", )) {
+   } else if (sscanf(ln, "%6x:", )) {
if (bytes == NULL) {
bytes = xmalloc(wbytes * height);
bytes_r = xmalloc(wbytes * height);
}
-   p = ln + 5;
+   /* ln is guaranteed to have a colon here. */
+   p = strchr(ln, ':') + 1;
chars_per_row = strlen(p) / height;
dwidth = width;
if (chars_per_row / 2 > (width + 7) / 8)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296918 - head/sys/fs/autofs

2016-03-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Mar 15 20:42:36 2016
New Revision: 296918
URL: https://svnweb.freebsd.org/changeset/base/296918

Log:
  Pacify Coverity.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/fs/autofs/autofs_vnops.c

Modified: head/sys/fs/autofs/autofs_vnops.c
==
--- head/sys/fs/autofs/autofs_vnops.c   Tue Mar 15 19:45:24 2016
(r296917)
+++ head/sys/fs/autofs/autofs_vnops.c   Tue Mar 15 20:42:36 2016
(r296918)
@@ -370,8 +370,10 @@ static size_t
 autofs_dirent_reclen(const char *name)
 {
size_t reclen;
+   int error;
 
-   autofs_readdir_one(NULL, name, -1, );
+   error = autofs_readdir_one(NULL, name, -1, );
+   KASSERT(error == 0, ("autofs_readdir_one() failed"));
 
return (reclen);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296918 - head/sys/fs/autofs

2016-03-15 Thread Conrad Meyer
Instead you will get, "warning: unused but set variable 'error'" on
-NODEBUG builds.  Maybe add:

(void)error;

Best,
Conrad

On Tue, Mar 15, 2016 at 1:42 PM, Edward Tomasz Napierala
 wrote:
> Author: trasz
> Date: Tue Mar 15 20:42:36 2016
> New Revision: 296918
> URL: https://svnweb.freebsd.org/changeset/base/296918
>
> Log:
>   Pacify Coverity.
>
>   MFC after:1 month
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/fs/autofs/autofs_vnops.c
>
> Modified: head/sys/fs/autofs/autofs_vnops.c
> ==
> --- head/sys/fs/autofs/autofs_vnops.c   Tue Mar 15 19:45:24 2016
> (r296917)
> +++ head/sys/fs/autofs/autofs_vnops.c   Tue Mar 15 20:42:36 2016
> (r296918)
> @@ -370,8 +370,10 @@ static size_t
>  autofs_dirent_reclen(const char *name)
>  {
> size_t reclen;
> +   int error;
>
> -   autofs_readdir_one(NULL, name, -1, );
> +   error = autofs_readdir_one(NULL, name, -1, );
> +   KASSERT(error == 0, ("autofs_readdir_one() failed"));
>
> return (reclen);
>  }
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-15 Thread Ravi Pokala
Hi Gleb,

-Original Message-


From: Gleb Smirnoff 
Date: 2016-03-15, Tuesday at 12:12
To: Ravi Pokala 
Cc: , , 

Subject: Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

>  Ravi,
>
>On Mon, Mar 14, 2016 at 05:33:06PM -0700, Ravi Pokala wrote:
>R> To make sure I'm reading this correctly:
>R> 
>R> (1) The sysctl operates on an opaque array of (uint64_t)s. The elements of 
>the array are not individually accessible.
>
>On array of counter_u64_t. The elements are individually accessible of course,
>but not by this sysctl API.

Got it.


>R> For example, if you have a bunch of device statistics, this interface will 
>let you get or clear them all in one shot, but they won't have distinct names. 
>You would have to define an enum to set up names for the array indices.
>
>Something what you want is already provided by VNET_PCPUSTAT* macros.
>The idea is that you declare a struct, whose members all are uint64_t.
>This struct becomes an API between userland and kernel.
>
>The VNET_PCPUSTAT* macros then are used to allocate nameless arrays of
>counter(9)s, with number of elements equal to number of members in the API
>struct. Each counter array element accumulates statistics for its corresponding
>struct member.
>
>The only problem, is that VIMAGE is mixed into this set of macros.

Yeah. I think I looked at that stuff before, and got confused. Between this new 
change, and other uses of counter(9) which have been introduced since I last 
looked, I understand this quite a bit better now.


>What needs
>to be done is separate logic of making correspondence of array of counters to
>struct members and VIMAGE, yielding in a more generic and network unaware KPI.
>This KPI should be moved from vnet.h into counter.h, and in vnet.h there should
>remain macros that summon VIMAGE awareness upon the new macros in counter.h.
>
>See struct tcpstat as example usage of VNET_PCPUSTAT* macros. 

The one that clarified it the most for me was SFSTAT_ADD() - the use of 
offsetof() to map between the name of the stat field in (struct sfstat) and the 
array index.

Thanks!

-Ravi (rpokala@)


>-- 
>Totus tuus, Glebius.

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


svn commit: r296915 - in head/lib/libc: db/mpool gen iconv posix1e secure

2016-03-15 Thread Ed Maste
Author: emaste
Date: Tue Mar 15 19:26:32 2016
New Revision: 296915
URL: https://svnweb.freebsd.org/changeset/base/296915

Log:
  libc: don't build compat functions if building WITHOUT_SYMVER
  
  WITHOUT_SYMVER necessarily implies building a system without symver
  backwards compatability.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libc/db/mpool/Makefile.inc
  head/lib/libc/gen/Makefile.inc
  head/lib/libc/iconv/Makefile.inc
  head/lib/libc/posix1e/Makefile.inc
  head/lib/libc/secure/Makefile.inc

Modified: head/lib/libc/db/mpool/Makefile.inc
==
--- head/lib/libc/db/mpool/Makefile.inc Tue Mar 15 17:32:29 2016
(r296914)
+++ head/lib/libc/db/mpool/Makefile.inc Tue Mar 15 19:26:32 2016
(r296915)
@@ -3,4 +3,7 @@
 
 .PATH: ${LIBC_SRCTOP}/db/mpool
 
-SRCS+= mpool.c mpool-compat.c
+SRCS+= mpool.c
+.if ${MK_SYMVER} == yes
+SRCS+= mpool-compat.c
+.endif

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Tue Mar 15 17:32:29 2016
(r296914)
+++ head/lib/libc/gen/Makefile.inc  Tue Mar 15 19:26:32 2016
(r296915)
@@ -49,7 +49,6 @@ SRCS+=__getosreldate.c \
fstab.c \
ftok.c \
fts.c \
-   fts-compat.c \
ftw.c \
getbootfile.c \
getbsize.c \
@@ -137,7 +136,6 @@ SRCS+=  __getosreldate.c \
ualarm.c \
ulimit.c \
uname.c \
-   unvis-compat.c \
usleep.c \
utime.c \
utxdb.c \
@@ -147,6 +145,10 @@ SRCS+= __getosreldate.c \
waitpid.c \
waitid.c \
wordexp.c
+.if ${MK_SYMVER} == yes
+SRCS+= fts-compat.c \
+   unvis-compat.c
+.endif
 
 .PATH: ${LIBC_SRCTOP}/../../contrib/libc-pwcache
 SRCS+= pwcache.c pwcache.h

Modified: head/lib/libc/iconv/Makefile.inc
==
--- head/lib/libc/iconv/Makefile.incTue Mar 15 17:32:29 2016
(r296914)
+++ head/lib/libc/iconv/Makefile.incTue Mar 15 19:26:32 2016
(r296915)
@@ -14,7 +14,11 @@ SRCS+=   citrus_bcs.c citrus_bcs_strtol.c 
citrus_esdb.c citrus_hash.c citrus_iconv.c citrus_lookup.c \
citrus_lookup_factory.c citrus_mapper.c citrus_memstream.c \
citrus_mmap.c citrus_module.c citrus_none.c citrus_pivot_factory.c \
-   citrus_prop.c citrus_stdenc.c bsd_iconv.c iconv_compat.c
+   citrus_prop.c citrus_stdenc.c bsd_iconv.c
+.if ${MK_SYMVER} == yes
+SRCS+= iconv_compat.c
+.endif
+
 SYM_MAPS+= ${LIBC_SRCTOP}/iconv/Symbol.map
 
 .if ${MK_ICONV} == yes

Modified: head/lib/libc/posix1e/Makefile.inc
==
--- head/lib/libc/posix1e/Makefile.inc  Tue Mar 15 17:32:29 2016
(r296914)
+++ head/lib/libc/posix1e/Makefile.inc  Tue Mar 15 19:26:32 2016
(r296915)
@@ -11,7 +11,6 @@ subr_acl_nfs4.c: ${LIBC_SRCTOP}/../../sy
 SRCS+= acl_branding.c  \
acl_calc_mask.c \
acl_copy.c  \
-   acl_compat.c\
acl_delete.c\
acl_delete_entry.c  \
acl_entry.c \
@@ -36,6 +35,9 @@ SRCS+=acl_branding.c  \
mac_get.c   \
mac_set.c   \
subr_acl_nfs4.c
+.if ${MK_SYMVER} == yes
+SRCS+= acl_compat.c
+.endif
 
 SYM_MAPS+=${LIBC_SRCTOP}/posix1e/Symbol.map
 

Modified: head/lib/libc/secure/Makefile.inc
==
--- head/lib/libc/secure/Makefile.inc   Tue Mar 15 17:32:29 2016
(r296914)
+++ head/lib/libc/secure/Makefile.inc   Tue Mar 15 19:26:32 2016
(r296915)
@@ -5,8 +5,9 @@
 .PATH: ${LIBC_SRCTOP}/secure
 
 # Sources common to both syscall interfaces:
-SRCS+= \
-   stack_protector.c \
-   stack_protector_compat.c
+SRCS+= stack_protector.c
+.if ${MK_SYMVER} == yes
+SRCS+= stack_protector_compat.c
+.endif
 
 SYM_MAPS+=${LIBC_SRCTOP}/secure/Symbol.map
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-15 Thread Gleb Smirnoff
  Ravi,

On Mon, Mar 14, 2016 at 05:33:06PM -0700, Ravi Pokala wrote:
R> To make sure I'm reading this correctly:
R> 
R> (1) The sysctl operates on an opaque array of (uint64_t)s. The elements of 
the array are not individually accessible.

On array of counter_u64_t. The elements are individually accessible of course,
but not by this sysctl API.

R> (2) Reading the sysctl populates each element of the userspace array by 
calling counter_u64_fetch() on the corresponding element of the kernelspace 
array.

Right.

R> (3) Writing the sysctl clears the kernelspace array by calling 
counter_u64_zero() on each element.

Right.

R> For example, if you have a bunch of device statistics, this interface will 
let you get or clear them all in one shot, but they won't have distinct names. 
You would have to define an enum to set up names for the array indices.

Something what you want is already provided by VNET_PCPUSTAT* macros.
The idea is that you declare a struct, whose members all are uint64_t.
This struct becomes an API between userland and kernel.

The VNET_PCPUSTAT* macros then are used to allocate nameless arrays of
counter(9)s, with number of elements equal to number of members in the API
struct. Each counter array element accumulates statistics for its corresponding
struct member.

The only problem, is that VIMAGE is mixed into this set of macros. What needs
to be done is separate logic of making correspondence of array of counters to
struct members and VIMAGE, yielding in a more generic and network unaware KPI.
This KPI should be moved from vnet.h into counter.h, and in vnet.h there should
remain macros that summon VIMAGE awareness upon the new macros in counter.h.

See struct tcpstat as example usage of VNET_PCPUSTAT* macros. 

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


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-15 Thread Gleb Smirnoff
  Hans,

On Tue, Mar 15, 2016 at 08:50:11AM +0100, Hans Petter Selasky wrote:
H> > Modified: head/sys/sys/sysctl.h
H> > 
==
H> > --- head/sys/sys/sysctl.h  Mon Mar 14 23:49:16 2016(r296879)
H> > +++ head/sys/sys/sysctl.h  Tue Mar 15 00:05:00 2016(r296880)
H> > @@ -204,6 +204,7 @@ int sysctl_handle_long(SYSCTL_HANDLER_AR
H> >   int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
H> >   int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
H> >   int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS);
H> > +int sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS);
H> >
H> >   int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS);
H> >   int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS);
H> > @@ -648,6 +649,26 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
H> >__ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \
H> >   })
H> >
H> > +/* Oid for an array of counter(9)s.  The pointer and length must be non 
zero. */
H> > +#define   SYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, 
descr) \
H> > +  SYSCTL_OID(parent, nbr, name,   \
H> > +  CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
H> > +  (ptr), (len), sysctl_handle_counter_u64_array, "S", descr); \
H> > +  CTASSERT(((access) & CTLTYPE) == 0 ||   \
H> > +  ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
H> > +
H> 
H> Gleb: I suggest you follow the example of the other static SYSCTLs, and 
H> extend the CTASSERT to also cover the size of the array:

I agree.

H> CTASSERT(((access) & CTLTYPE) == 0 ||\
H>  (((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE &&\
H>   (sizeof(*(ptr)) == 8 * (len

Hardcoding 8 is definitely wrong here. If you come up with correct assert,
feel free to commit it. I failed to imagine one quickly.

H> > +#define   SYSCTL_ADD_COUNTER_U64_ARRAY(ctx, parent, nbr, name, access,
\
H> > +ptr, len, descr)  
\
H> > +({
\
H> > +  counter_u64_t *__ptr = (ptr);   \
H> > +  CTASSERT(((access) & CTLTYPE) == 0 ||   \
H> > +  ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE);  \
H> 
H> Same here possibly. Maybe extend the CTASSERT() to also cover the size 
H> of the array? Would limit the "len" to a constant argument though.

Of course limiting len to constant for a dynamic oid is something we
don't want.

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


Re: svn commit: r296909 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-03-15 Thread Hans Petter Selasky

On 03/15/16 18:43, John Baldwin wrote:

On Tuesday, March 15, 2016 03:47:26 PM Hans Petter Selasky wrote:

Author: hselasky
Date: Tue Mar 15 15:47:26 2016
New Revision: 296909
URL: https://svnweb.freebsd.org/changeset/base/296909

Log:
   Fix witness panic in the ipoib_ioctl() function when unloading the
   ipoib module.

   The bpfdetach() function is trying to turn off promiscious mode on the
   network interface it is attached to while holding a mutex. The fix
   consists of ignoring any further calls to the ipoib_ioctl() function
   when the network interface is going to be detached. The ipoib_ioctl()
   function might sleep.

   Sponsored by:Mellanox Technologies
   MFC after:   1 week


In all of the other NIC drivers I have worked on the fix has been to call
if_detach (or ether_ifdetach) as the first step in your detach method before
you try to stop the interface.  The idea is to remove external connections
from your driver first, and the only after those have drained do you actually
shut down the hardware.  Given you are calling if_detach() just before
if_free() below, ipoib just seems to be broken here.

For example, detach in a typical NIC driver does this:

struct foo_softc *sc;

sc = device_get_softc(dev);
ether_ifdetach(sc->sc_ifp);
FOO_LOCK(sc);
foo_stop(sc);
FOO_UNLOCK(sc);
callout_drain(>timer);
bus_teardown_intr(...);
bus_release_resource(...);
if_free(sc->sc_ifp);

Similarly, devices with a character device in /dev should be calling
destroy_dev() first before shutting down hardware, etc.



I'll have a look at it. Thank you for your input.

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


Re: svn commit: r296910 - head/sys/ofed/drivers/net/mlx4

2016-03-15 Thread Hans Petter Selasky

On 03/15/16 17:48, Adrian Chadd wrote:

hiya,

make sure you set M_HASHTYPE_ appropriately?



I think the hashtype is not available with this chipset. I'll check it out.

--HPS

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


Re: svn commit: r296889 - in head: etc/mtree share/man/man7 tools/build/mk usr.sbin usr.sbin/uathload

2016-03-15 Thread John Baldwin
On Tuesday, March 15, 2016 04:42:37 AM Warner Losh wrote:
> Author: imp
> Date: Tue Mar 15 04:42:37 2016
> New Revision: 296889
> URL: https://svnweb.freebsd.org/changeset/base/296889
> 
> Log:
>   Just install ar5523.bin into /usr/share/firmware and stop compiling it
>   in.
>   
>   Differential Review: https://reviews.freebsd.org/D5639

Maybe add a _PATH_FIRMWARE to /usr/include/paths.h?

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


Re: svn commit: r296909 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-03-15 Thread John Baldwin
On Tuesday, March 15, 2016 03:47:26 PM Hans Petter Selasky wrote:
> Author: hselasky
> Date: Tue Mar 15 15:47:26 2016
> New Revision: 296909
> URL: https://svnweb.freebsd.org/changeset/base/296909
> 
> Log:
>   Fix witness panic in the ipoib_ioctl() function when unloading the
>   ipoib module.
>   
>   The bpfdetach() function is trying to turn off promiscious mode on the
>   network interface it is attached to while holding a mutex. The fix
>   consists of ignoring any further calls to the ipoib_ioctl() function
>   when the network interface is going to be detached. The ipoib_ioctl()
>   function might sleep.
>   
>   Sponsored by:   Mellanox Technologies
>   MFC after:  1 week

In all of the other NIC drivers I have worked on the fix has been to call
if_detach (or ether_ifdetach) as the first step in your detach method before
you try to stop the interface.  The idea is to remove external connections
from your driver first, and the only after those have drained do you actually
shut down the hardware.  Given you are calling if_detach() just before
if_free() below, ipoib just seems to be broken here.

For example, detach in a typical NIC driver does this:

struct foo_softc *sc;

sc = device_get_softc(dev);
ether_ifdetach(sc->sc_ifp);
FOO_LOCK(sc);
foo_stop(sc);
FOO_UNLOCK(sc);
callout_drain(>timer);
bus_teardown_intr(...);
bus_release_resource(...);
if_free(sc->sc_ifp);

Similarly, devices with a character device in /dev should be calling
destroy_dev() first before shutting down hardware, etc.

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


svn commit: r296914 - head/sys/conf

2016-03-15 Thread Ed Maste
Author: emaste
Date: Tue Mar 15 17:32:29 2016
New Revision: 296914
URL: https://svnweb.freebsd.org/changeset/base/296914

Log:
  Fix copy-n-pasteo in r296899 ukbdmap.h header generation for pc98
  
  The ukbd default is specified by UKBD_DFLT_KEYMAP not ATKBD_DFLT_KEYMAP.
  
  PR:   193865
  Submitted by: Harald Schmalzbauer

Modified:
  head/sys/conf/files.pc98

Modified: head/sys/conf/files.pc98
==
--- head/sys/conf/files.pc98Tue Mar 15 17:09:27 2016(r296913)
+++ head/sys/conf/files.pc98Tue Mar 15 17:32:29 2016(r296914)
@@ -46,7 +46,7 @@ svr4_assym.h  optionalcompat_svr4 
\
clean   "svr4_assym.h"
 #
 ukbdmap.h  optionalukbd_dflt_keymap\
-   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${ATKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h; else echo 
Error:   ukbd_dflt_keymap not found; exit 1; fi" \
+   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${UKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h; else echo 
Error:ukbd_dflt_keymap not found; exit 1; fi" \
no-obj no-implicit-rule before-depend   \
clean   "ukbdmap.h"
 #
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296910 - head/sys/ofed/drivers/net/mlx4

2016-03-15 Thread Adrian Chadd
hiya,

make sure you set M_HASHTYPE_ appropriately?


-adrian


On 15 March 2016 at 08:53, Hans Petter Selasky  wrote:
> Author: hselasky
> Date: Tue Mar 15 15:53:37 2016
> New Revision: 296910
> URL: https://svnweb.freebsd.org/changeset/base/296910
>
> Log:
>   Use hardware computed Toeplitz hash for incoming flowids
>
>   Use the Toeplitz hash value as source for the flowid. This makes the
>   hash value more suitable for so-called hash bucket algorithms which
>   are used in the FreeBSD's TCP/IP stack when RSS is enabled.
>
>   Sponsored by: Mellanox Technologies
>   MFC after:1 week
>
> Modified:
>   head/sys/ofed/drivers/net/mlx4/en_rx.c
>   head/sys/ofed/drivers/net/mlx4/en_tx.c
>
> Modified: head/sys/ofed/drivers/net/mlx4/en_rx.c
> ==
> --- head/sys/ofed/drivers/net/mlx4/en_rx.c  Tue Mar 15 15:47:26 2016  
>   (r296909)
> +++ head/sys/ofed/drivers/net/mlx4/en_rx.c  Tue Mar 15 15:53:37 2016  
>   (r296910)
> @@ -616,7 +616,8 @@ int mlx4_en_process_rx_cq(struct net_dev
> goto next;
> }
>
> -   mb->m_pkthdr.flowid = cq->ring;
> +   /* forward Toeplitz compatible hash value */
> +   mb->m_pkthdr.flowid = be32_to_cpu(cqe->immed_rss_invalid);
> M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE);
> mb->m_pkthdr.rcvif = dev;
> if (be32_to_cpu(cqe->vlan_my_qpn) &
>
> Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c
> ==
> --- head/sys/ofed/drivers/net/mlx4/en_tx.c  Tue Mar 15 15:47:26 2016  
>   (r296909)
> +++ head/sys/ofed/drivers/net/mlx4/en_tx.c  Tue Mar 15 15:53:37 2016  
>   (r296910)
> @@ -1060,7 +1060,7 @@ mlx4_en_transmit(struct ifnet *dev, stru
>
> /* Compute which queue to use */
> if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
> -   i = m->m_pkthdr.flowid % priv->tx_ring_num;
> +   i = (m->m_pkthdr.flowid % 128) % priv->tx_ring_num;
> }
> else {
> i = mlx4_en_select_queue(dev, m);
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296909 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-03-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 15 15:47:26 2016
New Revision: 296909
URL: https://svnweb.freebsd.org/changeset/base/296909

Log:
  Fix witness panic in the ipoib_ioctl() function when unloading the
  ipoib module.
  
  The bpfdetach() function is trying to turn off promiscious mode on the
  network interface it is attached to while holding a mutex. The fix
  consists of ignoring any further calls to the ipoib_ioctl() function
  when the network interface is going to be detached. The ipoib_ioctl()
  function might sleep.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h  Tue Mar 15 15:42:53 
2016(r296908)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h  Tue Mar 15 15:47:26 
2016(r296909)
@@ -322,6 +322,8 @@ struct ipoib_dev_priv {
 
unsigned long flags;
 
+   int gone;
+
struct mutex vlan_mutex;
 
struct rb_root  path_tree;

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Mar 15 
15:42:53 2016(r296908)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Mar 15 
15:47:26 2016(r296909)
@@ -258,6 +258,10 @@ ipoib_ioctl(struct ifnet *ifp, u_long co
struct ifreq *ifr = (struct ifreq *) data;
int error = 0;
 
+   /* check if detaching */
+   if (priv == NULL || priv->gone != 0)
+   return (ENXIO);
+
switch (command) {
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
@@ -794,6 +798,7 @@ ipoib_detach(struct ipoib_dev_priv *priv
 
dev = priv->dev;
if (!test_bit(IPOIB_FLAG_SUBINTERFACE, >flags)) {
+   priv->gone = 1;
bpfdetach(dev);
if_detach(dev);
if_free(dev);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296906 - in head/sys: conf dev/extres/regulator

2016-03-15 Thread Michal Meloun
Author: mmel
Date: Tue Mar 15 15:30:17 2016
New Revision: 296906
URL: https://svnweb.freebsd.org/changeset/base/296906

Log:
  Add regulator framework, a next part of new 'extended resources' family of
  support frameworks(i.e. clk/reset/phy/tsensors/fuses...).
  
  The framework is still far from perfect and probably doesn't have stable
  interface yet, but we want to start testing it on more real boards and
  different architectures.

Added:
  head/sys/dev/extres/regulator/
  head/sys/dev/extres/regulator/regdev_if.m   (contents, props changed)
  head/sys/dev/extres/regulator/regnode_if.m   (contents, props changed)
  head/sys/dev/extres/regulator/regulator.c   (contents, props changed)
  head/sys/dev/extres/regulator/regulator.h   (contents, props changed)
  head/sys/dev/extres/regulator/regulator_bus.c   (contents, props changed)
  head/sys/dev/extres/regulator/regulator_fixed.c   (contents, props changed)
  head/sys/dev/extres/regulator/regulator_fixed.h   (contents, props changed)
Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Mar 15 15:28:24 2016(r296905)
+++ head/sys/conf/files Tue Mar 15 15:30:17 2016(r296906)
@@ -1420,6 +1420,11 @@ dev/extres/clk/clk_gate.coptional ext_r
 dev/extres/clk/clk_mux.c   optional ext_resources clk
 dev/extres/hwreset/hwreset.c   optional ext_resources hwreset
 dev/extres/hwreset/hwreset_if.moptional ext_resources hwreset
+dev/extres/regulator/regdev_if.m   optional ext_resources regulator
+dev/extres/regulator/regnode_if.m  optional ext_resources regulator
+dev/extres/regulator/regulator.c   optional ext_resources regulator
+dev/extres/regulator/regulator_bus.c   optional ext_resources regulator fdt
+dev/extres/regulator/regulator_fixed.c optional ext_resources regulator
 dev/fatm/if_fatm.c optional fatm pci
 dev/fb/fbd.c   optional fbd | vt
 dev/fb/fb_if.m standard
@@ -1561,10 +1566,10 @@ ipw_monitor.fw  optional ipwmonitorfw |
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "ipw_monitor.fw"
-dev/iscsi/icl.coptional iscsi | ctl 
-dev/iscsi/icl_conn_if.moptional iscsi | ctl 
+dev/iscsi/icl.coptional iscsi | ctl
+dev/iscsi/icl_conn_if.moptional iscsi | ctl
 dev/iscsi/icl_proxy.c  optional iscsi | ctl
-dev/iscsi/icl_soft.c   optional iscsi | ctl 
+dev/iscsi/icl_soft.c   optional iscsi | ctl
 dev/iscsi/iscsi.c  optional iscsi scbus
 dev/iscsi_initiator/iscsi.coptional iscsi_initiator scbus
 dev/iscsi_initiator/iscsi_subr.c   optional iscsi_initiator scbus

Added: head/sys/dev/extres/regulator/regdev_if.m
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/extres/regulator/regdev_if.m   Tue Mar 15 15:30:17 2016
(r296906)
@@ -0,0 +1,56 @@
+#-
+# Copyright 2016 Michal Meloun 
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+#ifdef FDT
+#include 
+#include 
+#endif
+
+#include 
+
+INTERFACE regdev;
+
+#ifdef FDT
+
+HEADER {
+int regdev_default_ofw_map(device_t , phandle_t, int, pcell_t *, intptr_t *);
+}
+
+#
+# map fdt property cells to regulator number
+# Returns 0 on success or a standard errno value.
+#
+METHOD int map {
+   device_tprovider_dev;
+   phandle_t   xref;
+   int

svn commit: r296905 - head/sys/dev/extres/clk

2016-03-15 Thread Michal Meloun
Author: mmel
Date: Tue Mar 15 15:28:24 2016
New Revision: 296905
URL: https://svnweb.freebsd.org/changeset/base/296905

Log:
  CLK: Add and use explicit locking for access to clock device registers.
  Implicit locking (for read/write/modify) is not sufficient for complex
  cases.

Modified:
  head/sys/dev/extres/clk/clk_div.c
  head/sys/dev/extres/clk/clk_gate.c
  head/sys/dev/extres/clk/clk_mux.c
  head/sys/dev/extres/clk/clkdev_if.m

Modified: head/sys/dev/extres/clk/clk_div.c
==
--- head/sys/dev/extres/clk/clk_div.c   Tue Mar 15 15:27:15 2016
(r296904)
+++ head/sys/dev/extres/clk/clk_div.c   Tue Mar 15 15:28:24 2016
(r296905)
@@ -46,6 +46,10 @@ __FBSDID("$FreeBSD$");
CLKDEV_READ_4(clknode_get_device(_clk), off, val)
 #defineMD4(_clk, off, clr, set )   
\
CLKDEV_MODIFY_4(clknode_get_device(_clk), off, clr, set)
+#defineDEVICE_LOCK(_clk)   
\
+   CLKDEV_DEVICE_LOCK(clknode_get_device(_clk))
+#defineDEVICE_UNLOCK(_clk) 
\
+   CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk))
 
 static int clknode_div_init(struct clknode *clk, device_t dev);
 static int clknode_div_recalc(struct clknode *clk, uint64_t *req);
@@ -86,7 +90,9 @@ clknode_div_init(struct clknode *clk, de
 
sc = clknode_get_softc(clk);
 
+   DEVICE_LOCK(clk);
rv = RD4(clk, sc->offset, );
+   DEVICE_UNLOCK(clk);
if (rv != 0)
return (rv);
 
@@ -171,12 +177,17 @@ clknode_div_set_freq(struct clknode *clk
(*fout != (_fin / divider)))
return (ERANGE);
 
+   DEVICE_LOCK(clk);
rv = MD4(clk, sc->offset,
(sc->i_mask << sc->i_shift) | (sc->f_mask << sc->f_shift),
(i_div << sc->i_shift) | (f_div << sc->f_shift));
-   if (rv != 0)
+   if (rv != 0) {
+   DEVICE_UNLOCK(clk);
return (rv);
+   }
RD4(clk, sc->offset, );
+   DEVICE_UNLOCK(clk);
+
sc->divider = divider;
}
 

Modified: head/sys/dev/extres/clk/clk_gate.c
==
--- head/sys/dev/extres/clk/clk_gate.c  Tue Mar 15 15:27:15 2016
(r296904)
+++ head/sys/dev/extres/clk/clk_gate.c  Tue Mar 15 15:28:24 2016
(r296905)
@@ -46,7 +46,10 @@ __FBSDID("$FreeBSD$");
CLKDEV_READ_4(clknode_get_device(_clk), off, val)
 #defineMD4(_clk, off, clr, set )   
\
CLKDEV_MODIFY_4(clknode_get_device(_clk), off, clr, set)
-
+#defineDEVICE_LOCK(_clk)   
\
+   CLKDEV_DEVICE_LOCK(clknode_get_device(_clk))
+#defineDEVICE_UNLOCK(_clk) 
\
+   CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk))
 
 static int clknode_gate_init(struct clknode *clk, device_t dev);
 static int clknode_gate_set_gate(struct clknode *clk, bool enable);
@@ -77,7 +80,9 @@ clknode_gate_init(struct clknode *clk, d
int rv;
 
sc = clknode_get_softc(clk);
+   DEVICE_LOCK(clk);
rv = RD4(clk, sc->offset, );
+   DEVICE_UNLOCK(clk);
if (rv != 0)
return (rv);
reg = (reg >> sc->shift) & sc->mask;
@@ -95,11 +100,15 @@ clknode_gate_set_gate(struct clknode *cl
 
sc = clknode_get_softc(clk);
sc->ungated = enable;
+   DEVICE_LOCK(clk);
rv = MD4(clk, sc->offset, sc->mask << sc->shift,
(sc->ungated ? sc->on_value : sc->off_value) << sc->shift);
-   if (rv != 0)
+   if (rv != 0) {
+   DEVICE_UNLOCK(clk);
return (rv);
+   }
RD4(clk, sc->offset, );
+   DEVICE_UNLOCK(clk);
return(0);
 }
 

Modified: head/sys/dev/extres/clk/clk_mux.c
==
--- head/sys/dev/extres/clk/clk_mux.c   Tue Mar 15 15:27:15 2016
(r296904)
+++ head/sys/dev/extres/clk/clk_mux.c   Tue Mar 15 15:28:24 2016
(r296905)
@@ -46,6 +46,10 @@ __FBSDID("$FreeBSD$");
CLKDEV_READ_4(clknode_get_device(_clk), off, val)
 #defineMD4(_clk, off, clr, set )   
\
CLKDEV_MODIFY_4(clknode_get_device(_clk), off, clr, set)
+#defineDEVICE_LOCK(_clk)   
\
+   CLKDEV_DEVICE_LOCK(clknode_get_device(_clk))
+#defineDEVICE_UNLOCK(_clk) 
\
+   CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk))
 
 static int clknode_mux_init(struct clknode *clk, device_t dev);
 static int clknode_mux_set_mux(struct clknode *clk, int 

svn commit: r296908 - in head/sys: amd64/amd64 i386/i386

2016-03-15 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 15 15:42:53 2016
New Revision: 296908
URL: https://svnweb.freebsd.org/changeset/base/296908

Log:
  The PKRU state size is 4 bytes, its support makes the XSAVE area size
  non-multiple of 64 bytes.  Thereafter, the user state save area is
  misaligned, which triggers assertion in the debugging kernels, or
  segmentation violation on accesses for non-debugging configs.
  
  Force the desired alignment of the user save area as the fix
  (workaround is to disable bit 9 in the hw.xsave_mask loader tunable).
  This correction is required for booting on the upcoming Intel' Purley
  platform.
  
  Reported and tested by:   "Pieper, Jeffrey E" 
,
jimharris
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/i386/i386/vm_machdep.c

Modified: head/sys/amd64/amd64/vm_machdep.c
==
--- head/sys/amd64/amd64/vm_machdep.c   Tue Mar 15 15:31:17 2016
(r296907)
+++ head/sys/amd64/amd64/vm_machdep.c   Tue Mar 15 15:42:53 2016
(r296908)
@@ -102,8 +102,8 @@ get_pcb_user_save_td(struct thread *td)
vm_offset_t p;
 
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-   cpu_max_ext_state_size;
-   KASSERT((p % 64) == 0, ("Unaligned pcb_user_save area"));
+   roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
+   KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
return ((struct savefpu *)p);
 }
 
@@ -122,7 +122,8 @@ get_pcb_td(struct thread *td)
vm_offset_t p;
 
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-   cpu_max_ext_state_size - sizeof(struct pcb);
+   roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
+   sizeof(struct pcb);
return ((struct pcb *)p);
 }
 

Modified: head/sys/i386/i386/vm_machdep.c
==
--- head/sys/i386/i386/vm_machdep.c Tue Mar 15 15:31:17 2016
(r296907)
+++ head/sys/i386/i386/vm_machdep.c Tue Mar 15 15:42:53 2016
(r296908)
@@ -127,8 +127,8 @@ get_pcb_user_save_td(struct thread *td)
vm_offset_t p;
 
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-   cpu_max_ext_state_size;
-   KASSERT((p % 64) == 0, ("Unaligned pcb_user_save area"));
+   roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
+   KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
return ((union savefpu *)p);
 }
 
@@ -147,7 +147,8 @@ get_pcb_td(struct thread *td)
vm_offset_t p;
 
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-   cpu_max_ext_state_size - sizeof(struct pcb);
+   roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
+   sizeof(struct pcb);
return ((struct pcb *)p);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296903 - head/sys/dev/extres/clk

2016-03-15 Thread Michal Meloun
Author: mmel
Date: Tue Mar 15 15:25:26 2016
New Revision: 296903
URL: https://svnweb.freebsd.org/changeset/base/296903

Log:
  CLK: Remove forgotten mutex from clk_fixed class.

Modified:
  head/sys/dev/extres/clk/clk_fixed.c
  head/sys/dev/extres/clk/clk_fixed.h

Modified: head/sys/dev/extres/clk/clk_fixed.c
==
--- head/sys/dev/extres/clk/clk_fixed.c Tue Mar 15 15:24:55 2016
(r296902)
+++ head/sys/dev/extres/clk/clk_fixed.c Tue Mar 15 15:25:26 2016
(r296903)
@@ -42,13 +42,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#defineDEVICE_LOCK(_sc)  mtx_lock((_sc)->mtx)
-#defineDEVICE_UNLOCK(_sc)mtx_unlock((_sc)->mtx)
-
 static int clknode_fixed_init(struct clknode *clk, device_t dev);
 static int clknode_fixed_recalc(struct clknode *clk, uint64_t *freq);
 struct clknode_fixed_sc {
-   struct mtx  *mtx;
int fixed_flags;
uint64_tfreq;
uint32_tmult;
@@ -74,6 +70,7 @@ clknode_fixed_init(struct clknode *clk, 
clknode_init_parent_idx(clk, 0);
return(0);
 }
+
 static int
 clknode_fixed_recalc(struct clknode *clk, uint64_t *freq)
 {
@@ -90,8 +87,7 @@ clknode_fixed_recalc(struct clknode *clk
 }
 
 int
-clknode_fixed_register(struct clkdom *clkdom, struct clk_fixed_def *clkdef,
-struct mtx *dev_mtx)
+clknode_fixed_register(struct clkdom *clkdom, struct clk_fixed_def *clkdef)
 {
struct clknode *clk;
struct clknode_fixed_sc *sc;
@@ -103,7 +99,6 @@ clknode_fixed_register(struct clkdom *cl
return (1);
 
sc = clknode_get_softc(clk);
-   sc->mtx = dev_mtx;
sc->fixed_flags = clkdef->fixed_flags;
sc->freq = clkdef->freq;
sc->mult = clkdef->mult;

Modified: head/sys/dev/extres/clk/clk_fixed.h
==
--- head/sys/dev/extres/clk/clk_fixed.h Tue Mar 15 15:24:55 2016
(r296902)
+++ head/sys/dev/extres/clk/clk_fixed.h Tue Mar 15 15:25:26 2016
(r296903)
@@ -47,7 +47,6 @@ struct clk_fixed_def {
int fixed_flags;
 };
 
-int clknode_fixed_register(struct clkdom *clkdom, struct clk_fixed_def *clkdef,
-struct mtx *dev_mtx);
+int clknode_fixed_register(struct clkdom *clkdom, struct clk_fixed_def 
*clkdef);
 
 #endif /*_DEV_EXTRES_CLK_FIXED_H_*/
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296899 - head/sys/conf

2016-03-15 Thread Ed Maste
Author: emaste
Date: Tue Mar 15 13:38:15 2016
New Revision: 296899
URL: https://svnweb.freebsd.org/changeset/base/296899

Log:
  Fix atkbdmap.h generation for sc/vt consoles
  
  Keymap header files have historically been generated using the build
  host's /usr/sbin/kbdcontrol and using the host's keymap files.
  
  However, that introduces an issue when building a kernel to use vt(4)
  on a system using sc(4), or vice versa: kbdcontrol searches for keymap
  files in the /usr/share subdirectory appropriate for the host, not the
  target.
  
  With this change the build searches both the and sc keymap directories
  from the source tree.
  
  PR:   193865
  Submitted by: Harald Schmalzbauer

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/conf/files.sparc64

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Mar 15 11:10:08 2016(r296898)
+++ head/sys/conf/files.amd64   Tue Mar 15 13:38:15 2016(r296899)
@@ -50,12 +50,12 @@ font.h  optional
sc_dflt_font\
clean   "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 
${SC_DFLT_FONT}-8x8"
 #
 atkbdmap.h optionalatkbd_dflt_keymap   \
-   compile-with"/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 
's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h"   
 \
+   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${ATKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h; else echo 
Error: atkbd_dflt_keymap not found; exit 1; fi"\
no-obj no-implicit-rule before-depend   \
clean   "atkbdmap.h"
 #
 ukbdmap.h  optionalukbd_dflt_keymap\
-   compile-with"/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 
's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h"
  \
+   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${UKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h; else echo 
Error:ukbd_dflt_keymap not found; exit 1; fi" \
no-obj no-implicit-rule before-depend   \
clean   "ukbdmap.h"
 #

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Mar 15 11:10:08 2016(r296898)
+++ head/sys/conf/files.i386Tue Mar 15 13:38:15 2016(r296899)
@@ -49,12 +49,12 @@ font.h  optional
sc_dflt_font\
clean   "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 
${SC_DFLT_FONT}-8x8"
 #
 atkbdmap.h optionalatkbd_dflt_keymap   \
-   compile-with"/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 
's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h"   
 \
+   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${ATKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h; else echo 
Error: atkbd_dflt_keymap not found; exit 1; fi"\
no-obj no-implicit-rule before-depend   \
clean   "atkbdmap.h"
 #
 ukbdmap.h  optionalukbd_dflt_keymap\
-   compile-with"/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 
's/^static keymap_t.* = /static keymap_t key_map 

svn commit: r296910 - head/sys/ofed/drivers/net/mlx4

2016-03-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 15 15:53:37 2016
New Revision: 296910
URL: https://svnweb.freebsd.org/changeset/base/296910

Log:
  Use hardware computed Toeplitz hash for incoming flowids
  
  Use the Toeplitz hash value as source for the flowid. This makes the
  hash value more suitable for so-called hash bucket algorithms which
  are used in the FreeBSD's TCP/IP stack when RSS is enabled.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/net/mlx4/en_rx.c
  head/sys/ofed/drivers/net/mlx4/en_tx.c

Modified: head/sys/ofed/drivers/net/mlx4/en_rx.c
==
--- head/sys/ofed/drivers/net/mlx4/en_rx.c  Tue Mar 15 15:47:26 2016
(r296909)
+++ head/sys/ofed/drivers/net/mlx4/en_rx.c  Tue Mar 15 15:53:37 2016
(r296910)
@@ -616,7 +616,8 @@ int mlx4_en_process_rx_cq(struct net_dev
goto next;
}
 
-   mb->m_pkthdr.flowid = cq->ring;
+   /* forward Toeplitz compatible hash value */
+   mb->m_pkthdr.flowid = be32_to_cpu(cqe->immed_rss_invalid);
M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE);
mb->m_pkthdr.rcvif = dev;
if (be32_to_cpu(cqe->vlan_my_qpn) &

Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c
==
--- head/sys/ofed/drivers/net/mlx4/en_tx.c  Tue Mar 15 15:47:26 2016
(r296909)
+++ head/sys/ofed/drivers/net/mlx4/en_tx.c  Tue Mar 15 15:53:37 2016
(r296910)
@@ -1060,7 +1060,7 @@ mlx4_en_transmit(struct ifnet *dev, stru
 
/* Compute which queue to use */
if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
-   i = m->m_pkthdr.flowid % priv->tx_ring_num;
+   i = (m->m_pkthdr.flowid % 128) % priv->tx_ring_num;
}
else {
i = mlx4_en_select_queue(dev, m);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296907 - in head/sys: conf dev/extres/phy

2016-03-15 Thread Michal Meloun
Author: mmel
Date: Tue Mar 15 15:31:17 2016
New Revision: 296907
URL: https://svnweb.freebsd.org/changeset/base/296907

Log:
  Add phy framework, a next part of new 'extended resources' family of
  support frameworks (i.e. clk/regulators/tsensors/fuses...).
  
  It provides simple unified consumers interface for manipulations with
  phy (USB/SATA/PCIe) resources.

Added:
  head/sys/dev/extres/phy/
  head/sys/dev/extres/phy/phy.c   (contents, props changed)
  head/sys/dev/extres/phy/phy.h   (contents, props changed)
  head/sys/dev/extres/phy/phy_if.m   (contents, props changed)
Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Mar 15 15:30:17 2016(r296906)
+++ head/sys/conf/files Tue Mar 15 15:31:17 2016(r296907)
@@ -1418,6 +1418,8 @@ dev/extres/clk/clk_div.c  optional ext_re
 dev/extres/clk/clk_fixed.c optional ext_resources clk
 dev/extres/clk/clk_gate.c  optional ext_resources clk
 dev/extres/clk/clk_mux.c   optional ext_resources clk
+dev/extres/phy/phy.c   optional ext_resources phy
+dev/extres/phy/phy_if.moptional ext_resources phy
 dev/extres/hwreset/hwreset.c   optional ext_resources hwreset
 dev/extres/hwreset/hwreset_if.moptional ext_resources hwreset
 dev/extres/regulator/regdev_if.m   optional ext_resources regulator

Added: head/sys/dev/extres/phy/phy.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/extres/phy/phy.c   Tue Mar 15 15:31:17 2016
(r296907)
@@ -0,0 +1,235 @@
+/*-
+ * Copyright 2016 Michal Meloun 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+#include "opt_platform.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef FDT
+#include 
+#include 
+#endif
+
+#include  
+
+#include "phy_if.h"
+
+struct phy {
+   device_tconsumer_dev;   /* consumer device*/
+   device_tprovider_dev;   /* provider device*/
+   uintptr_t   phy_id; /* phy id */
+};
+
+MALLOC_DEFINE(M_PHY, "phy", "Phy framework");
+
+int
+phy_init(device_t consumer, phy_t phy)
+{
+
+   return (PHY_INIT(phy->provider_dev, phy->phy_id, true));
+}
+
+int
+phy_deinit(device_t consumer, phy_t phy)
+{
+
+   return (PHY_INIT(phy->provider_dev, phy->phy_id, false));
+}
+
+
+int
+phy_enable(device_t consumer, phy_t phy)
+{
+
+   return (PHY_ENABLE(phy->provider_dev, phy->phy_id, true));
+}
+
+int
+phy_disable(device_t consumer, phy_t phy)
+{
+
+   return (PHY_ENABLE(phy->provider_dev, phy->phy_id, false));
+}
+
+int
+phy_status(device_t consumer, phy_t phy, int *value)
+{
+
+   return (PHY_STATUS(phy->provider_dev, phy->phy_id, value));
+}
+
+int
+phy_get_by_id(device_t consumer_dev, device_t provider_dev, intptr_t id,
+phy_t *phy_out)
+{
+   phy_t phy;
+
+   /* Create handle */
+   phy = malloc(sizeof(struct phy), M_PHY,
+   M_WAITOK | M_ZERO);
+   phy->consumer_dev = consumer_dev;
+   phy->provider_dev = provider_dev;
+   phy->phy_id = id;
+   *phy_out = phy;
+   return (0);
+}
+
+void
+phy_release(phy_t phy)
+{
+   free(phy, M_PHY);
+}
+
+
+#ifdef FDT
+int phy_default_map(device_t provider, phandle_t xref, int ncells,
+pcell_t *cells, intptr_t *id)
+{
+
+   if (ncells == 0)
+   *id = 1;
+   else if (ncells == 1)
+   *id = cells[0];
+   else
+   return  (ERANGE);
+
+   return (0);
+}
+
+int
+phy_get_by_ofw_idx(device_t consumer_dev, int idx, phy_t 

svn commit: r296904 - in head/sys: conf dev/extres/clk

2016-03-15 Thread Michal Meloun
Author: mmel
Date: Tue Mar 15 15:27:15 2016
New Revision: 296904
URL: https://svnweb.freebsd.org/changeset/base/296904

Log:
  CLK: Add enumerator for 'clocks' OFW node. Add bus device bindings
  for clk_fixed class.

Added:
  head/sys/dev/extres/clk/clk_bus.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/extres/clk/clk.c
  head/sys/dev/extres/clk/clk.h
  head/sys/dev/extres/clk/clk_fixed.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Mar 15 15:25:26 2016(r296903)
+++ head/sys/conf/files Tue Mar 15 15:27:15 2016(r296904)
@@ -1413,6 +1413,7 @@ dev/exca/exca.c   optional cbb
 dev/extres/clk/clk.c   optional ext_resources clk
 dev/extres/clk/clkdev_if.m optional ext_resources clk
 dev/extres/clk/clknode_if.moptional ext_resources clk
+dev/extres/clk/clk_bus.c   optional ext_resources clk fdt
 dev/extres/clk/clk_div.c   optional ext_resources clk
 dev/extres/clk/clk_fixed.c optional ext_resources clk
 dev/extres/clk/clk_gate.c  optional ext_resources clk

Modified: head/sys/dev/extres/clk/clk.c
==
--- head/sys/dev/extres/clk/clk.c   Tue Mar 15 15:25:26 2016
(r296903)
+++ head/sys/dev/extres/clk/clk.c   Tue Mar 15 15:27:15 2016
(r296904)
@@ -1258,4 +1258,75 @@ clk_get_by_ofw_name(device_t dev, const 
return (rv);
return (clk_get_by_ofw_index(dev, idx, clk));
 }
+
+/* --
+ *
+ * Support functions for parsing various clock related OFW things.
+ */
+
+/*
+ * Get "clock-output-names" and  (optional) "clock-indices" lists.
+ * Both lists are alocated using M_OFWPROP specifier.
+ *
+ * Returns number of items or 0.
+ */
+int
+clk_parse_ofw_out_names(device_t dev, phandle_t node, const char ***out_names,
+   uint32_t *indices)
+{
+   int name_items, rv;
+
+   *out_names = NULL;
+   indices = NULL;
+   if (!OF_hasprop(node, "clock-output-names"))
+   return (0);
+   rv = ofw_bus_string_list_to_array(node, "clock-output-names",
+   out_names);
+   if (rv <= 0)
+   return (0);
+   name_items = rv;
+
+   if (!OF_hasprop(node, "clock-indices"))
+   return (name_items);
+   rv = OF_getencprop_alloc(node, "clock-indices", sizeof (uint32_t),
+   (void **)indices);
+   if (rv != name_items) {
+   device_printf(dev, " Size of 'clock-output-names' and "
+   "'clock-indices' differs\n");
+   free(*out_names, M_OFWPROP);
+   free(indices, M_OFWPROP);
+   return (0);
+   }
+   return (name_items);
+}
+
+/*
+ * Get output clock name for single output clock node.
+ */
+int
+clk_parse_ofw_clk_name(device_t dev, phandle_t node, const char **name)
+{
+   const char **out_names;
+   const char  *tmp_name;
+   int rv;
+
+   *name = NULL;
+   if (!OF_hasprop(node, "clock-output-names")) {
+   tmp_name  = ofw_bus_get_name(dev);
+   if (tmp_name == NULL)
+   return (ENXIO);
+   *name = strdup(tmp_name, M_OFWPROP);
+   return (0);
+   }
+   rv = ofw_bus_string_list_to_array(node, "clock-output-names",
+   _names);
+   if (rv != 1) {
+   free(out_names, M_OFWPROP);
+   device_printf(dev, "Malformed 'clock-output-names' property\n");
+   return (ENXIO);
+   }
+   *name = strdup(out_names[0], M_OFWPROP);
+   free(out_names, M_OFWPROP);
+   return (0);
+}
 #endif

Modified: head/sys/dev/extres/clk/clk.h
==
--- head/sys/dev/extres/clk/clk.h   Tue Mar 15 15:25:26 2016
(r296903)
+++ head/sys/dev/extres/clk/clk.h   Tue Mar 15 15:27:15 2016
(r296904)
@@ -131,6 +131,9 @@ const char *clk_get_name(clk_t clk);
 #ifdef FDT
 int clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk);
 int clk_get_by_ofw_name(device_t dev, const char *name, clk_t *clk);
+int clk_parse_ofw_out_names(device_t dev, phandle_t node,
+const char ***out_names, uint32_t *indices);
+int clk_parse_ofw_clk_name(device_t dev, phandle_t node, const char **name);
 #endif
 
 #endif /* _DEV_EXTRES_CLK_H_ */

Added: head/sys/dev/extres/clk/clk_bus.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/extres/clk/clk_bus.c   Tue Mar 15 15:27:15 2016
(r296904)
@@ -0,0 +1,93 @@
+/*-
+ * Copyright 2016 Michal Meloun 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that 

svn commit: r296902 - head/sbin/ifconfig

2016-03-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 15 15:24:55 2016
New Revision: 296902
URL: https://svnweb.freebsd.org/changeset/base/296902

Log:
  Improve detection of extended QSFP diagnostics.
  
  The standards in the QSFP diagnostics area are not clear when the
  additional measurements are present or not. Use a valid temperature
  reading as an indicator for the presence of voltage and TX/RX power
  measurements.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Tested by:Netflix
  Differential Revision:https://reviews.freebsd.org/D5391
  Reviewed by:  gallatin

Modified:
  head/sbin/ifconfig/sfp.c

Modified: head/sbin/ifconfig/sfp.c
==
--- head/sbin/ifconfig/sfp.cTue Mar 15 15:24:18 2016(r296901)
+++ head/sbin/ifconfig/sfp.cTue Mar 15 15:24:55 2016(r296902)
@@ -625,14 +625,17 @@ get_sfp_voltage(struct i2c_info *ii, cha
convert_sff_voltage(buf, size, xbuf);
 }
 
-static void
+static int
 get_qsfp_temp(struct i2c_info *ii, char *buf, size_t size)
 {
uint8_t xbuf[2];
 
memset(xbuf, 0, sizeof(xbuf));
read_i2c(ii, SFF_8436_BASE, SFF_8436_TEMP, 2, xbuf);
+   if ((xbuf[0] == 0xFF && xbuf[1] == 0xFF) || (xbuf[0] == 0 && xbuf[1] == 
0))
+   return (-1);
convert_sff_temp(buf, size, xbuf);
+   return (0);
 }
 
 static void
@@ -779,22 +782,9 @@ static void
 print_qsfp_status(struct i2c_info *ii, int verbose)
 {
char buf[80], buf2[40], buf3[40];
-   uint8_t diag_type;
uint32_t bitrate;
int i;
 
-   /* Read diagnostic monitoring type */
-   read_i2c(ii, SFF_8436_BASE, SFF_8436_DIAG_TYPE, 1, (caddr_t)_type);
-   if (ii->error != 0)
-   return;
-
-   /*
-* Read monitoring data it is supplied.
-* XXX: It is not exactly clear from standard
-* how one can specify lack of measurements (passive cables case).
-*/
-   if (diag_type != 0)
-   ii->do_diag = 1;
ii->qsfp = 1;
 
/* Transceiver type */
@@ -817,9 +807,13 @@ print_qsfp_status(struct i2c_info *ii, i
printf("\tnominal bitrate: %u Mbps\n", bitrate);
}
 
-   /* Request current measurements if they are provided: */
-   if (ii->do_diag != 0) {
-   get_qsfp_temp(ii, buf, sizeof(buf));
+   /*
+* The standards in this area are not clear when the
+* additional measurements are present or not. Use a valid
+* temperature reading as an indicator for the presence of
+* voltage and TX/RX power measurements.
+*/
+   if (get_qsfp_temp(ii, buf, sizeof(buf)) == 0) {
get_qsfp_voltage(ii, buf2, sizeof(buf2));
printf("\tmodule temperature: %s voltage: %s\n", buf, buf2);
for (i = 1; i <= 4; i++) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296901 - in head/sys/dev: gpio ofw

2016-03-15 Thread Michal Meloun
Author: mmel
Date: Tue Mar 15 15:24:18 2016
New Revision: 296901
URL: https://svnweb.freebsd.org/changeset/base/296901

Log:
  Use EARLY_DRIVER_MODULE() with BUS_PASS_BUS priority for ofw_gpiobus
  and ofw_iicbus. This causes enumeration of gpiobus/iicbus at the base driver
  attach time. Due to this, childern drivers can be also attached early.

Modified:
  head/sys/dev/gpio/ofw_gpiobus.c
  head/sys/dev/ofw/ofw_iicbus.c

Modified: head/sys/dev/gpio/ofw_gpiobus.c
==
--- head/sys/dev/gpio/ofw_gpiobus.c Tue Mar 15 15:24:14 2016
(r296900)
+++ head/sys/dev/gpio/ofw_gpiobus.c Tue Mar 15 15:24:18 2016
(r296901)
@@ -575,6 +575,7 @@ static devclass_t ofwgpiobus_devclass;
 
 DEFINE_CLASS_1(gpiobus, ofw_gpiobus_driver, ofw_gpiobus_methods,
 sizeof(struct gpiobus_softc), gpiobus_driver);
-DRIVER_MODULE(ofw_gpiobus, gpio, ofw_gpiobus_driver, ofwgpiobus_devclass, 0, 
0);
+EARLY_DRIVER_MODULE(ofw_gpiobus, gpio, ofw_gpiobus_driver, ofwgpiobus_devclass,
+0, 0, BUS_PASS_BUS);
 MODULE_VERSION(ofw_gpiobus, 1);
 MODULE_DEPEND(ofw_gpiobus, gpiobus, 1, 1, 1);

Modified: head/sys/dev/ofw/ofw_iicbus.c
==
--- head/sys/dev/ofw/ofw_iicbus.c   Tue Mar 15 15:24:14 2016
(r296900)
+++ head/sys/dev/ofw/ofw_iicbus.c   Tue Mar 15 15:24:18 2016
(r296901)
@@ -80,8 +80,10 @@ static devclass_t ofwiicbus_devclass;
 
 DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods,
 sizeof(struct iicbus_softc), iicbus_driver);
-DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass, 0, 0);
-DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass,
+0, 0, BUS_PASS_BUS);
+EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass,
+0, 0, BUS_PASS_BUS);
 MODULE_VERSION(ofw_iicbus, 1);
 MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296898 - head/usr.sbin/iscsid

2016-03-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Mar 15 11:10:08 2016
New Revision: 296898
URL: https://svnweb.freebsd.org/changeset/base/296898

Log:
  Make fail() preserve the errno.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/usr.sbin/iscsid/iscsid.c
==
--- head/usr.sbin/iscsid/iscsid.c   Tue Mar 15 11:03:45 2016
(r296897)
+++ head/usr.sbin/iscsid/iscsid.c   Tue Mar 15 11:10:08 2016
(r296898)
@@ -290,7 +290,9 @@ void
 fail(const struct connection *conn, const char *reason)
 {
struct iscsi_daemon_fail idf;
-   int error;
+   int error, saved_errno;
+
+   saved_errno = errno;
 
memset(, 0, sizeof(idf));
idf.idf_session_id = conn->conn_session_id;
@@ -299,6 +301,8 @@ fail(const struct connection *conn, cons
error = ioctl(conn->conn_iscsi_fd, ISCSIDFAIL, );
if (error != 0)
log_err(1, "ISCSIDFAIL");
+
+   errno = saved_errno;
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296897 - in head/usr.sbin: autofs ctld iscsid

2016-03-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Mar 15 11:03:45 2016
New Revision: 296897
URL: https://svnweb.freebsd.org/changeset/base/296897

Log:
  Use the log_errno value passed to the function instead of the errno global
  variable.
  
  Suggested by: Daniel Braniss
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/autofs/log.c
  head/usr.sbin/ctld/log.c
  head/usr.sbin/iscsid/log.c

Modified: head/usr.sbin/autofs/log.c
==
--- head/usr.sbin/autofs/log.c  Tue Mar 15 10:45:55 2016(r296896)
+++ head/usr.sbin/autofs/log.c  Tue Mar 15 11:03:45 2016(r296897)
@@ -88,6 +88,7 @@ log_common(int priority, int log_errno, 
 {
static char msgbuf[MSGBUF_LEN];
static char msgbuf_strvised[MSGBUF_LEN * 4 + 1];
+   char *errstr;
int ret;
 
ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
@@ -121,21 +122,23 @@ log_common(int priority, int log_errno, 
}
 
} else {
+   errstr = strerror(log_errno);
+
if (peer_name != NULL) {
fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(),
-   peer_addr, peer_name, msgbuf_strvised, 
strerror(errno));
+   peer_addr, peer_name, msgbuf_strvised, errstr);
syslog(priority, "%s (%s): %s: %s",
-   peer_addr, peer_name, msgbuf_strvised, 
strerror(errno));
+   peer_addr, peer_name, msgbuf_strvised, errstr);
} else if (peer_addr != NULL) {
fprintf(stderr, "%s: %s: %s: %s\n", getprogname(),
-   peer_addr, msgbuf_strvised, strerror(errno));
+   peer_addr, msgbuf_strvised, errstr);
syslog(priority, "%s: %s: %s",
-   peer_addr, msgbuf_strvised, strerror(errno));
+   peer_addr, msgbuf_strvised, errstr);
} else {
fprintf(stderr, "%s: %s: %s\n", getprogname(),
-   msgbuf_strvised, strerror(errno));
+   msgbuf_strvised, errstr);
syslog(priority, "%s: %s",
-   msgbuf_strvised, strerror(errno));
+   msgbuf_strvised, errstr);
}
}
 }

Modified: head/usr.sbin/ctld/log.c
==
--- head/usr.sbin/ctld/log.cTue Mar 15 10:45:55 2016(r296896)
+++ head/usr.sbin/ctld/log.cTue Mar 15 11:03:45 2016(r296897)
@@ -88,6 +88,7 @@ log_common(int priority, int log_errno, 
 {
static char msgbuf[MSGBUF_LEN];
static char msgbuf_strvised[MSGBUF_LEN * 4 + 1];
+   char *errstr;
int ret;
 
ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
@@ -121,21 +122,23 @@ log_common(int priority, int log_errno, 
}
 
} else {
+   errstr = strerror(log_errno);
+
if (peer_name != NULL) {
fprintf(stderr, "%s: %s (%s): %s: %s\n", getprogname(),
-   peer_addr, peer_name, msgbuf_strvised, 
strerror(errno));
+   peer_addr, peer_name, msgbuf_strvised, errstr);
syslog(priority, "%s (%s): %s: %s",
-   peer_addr, peer_name, msgbuf_strvised, 
strerror(errno));
+   peer_addr, peer_name, msgbuf_strvised, errstr);
} else if (peer_addr != NULL) {
fprintf(stderr, "%s: %s: %s: %s\n", getprogname(),
-   peer_addr, msgbuf_strvised, strerror(errno));
+   peer_addr, msgbuf_strvised, errstr);
syslog(priority, "%s: %s: %s",
-   peer_addr, msgbuf_strvised, strerror(errno));
+   peer_addr, msgbuf_strvised, errstr);
} else {
fprintf(stderr, "%s: %s: %s\n", getprogname(),
-   msgbuf_strvised, strerror(errno));
+   msgbuf_strvised, errstr);
syslog(priority, "%s: %s",
-   msgbuf_strvised, strerror(errno));
+   msgbuf_strvised, errstr);
}
}
 }

Modified: head/usr.sbin/iscsid/log.c
==
--- head/usr.sbin/iscsid/log.c  Tue Mar 15 10:45:55 2016(r296896)
+++ head/usr.sbin/iscsid/log.c  Tue Mar 15 11:03:45 2016(r296897)
@@ -88,6 +88,7 @@ log_common(int priority, int log_errno, 
 {
static char msgbuf[MSGBUF_LEN];
static char msgbuf_strvised[MSGBUF_LEN * 4 + 1];
+   char *errstr;
int ret;
 
ret = vsnprintf(msgbuf, 

Re: svn commit: r296868 - head/sys/sys

2016-03-15 Thread Bruce Evans

On Tue, 15 Mar 2016, Hans Petter Selasky wrote:


On 03/14/16 21:33, Gleb Smirnoff wrote:

On Mon, Mar 14, 2016 at 02:31:37PM -0400, Ryan Stone wrote:
R> On Mon, Mar 14, 2016 at 2:07 PM, Gleb Smirnoff  
wrote:

R>
R> >   Remove useless cast in SYSCTL_ADD_COUNTER_U64 macro.


There was no cast here.

R> Is it useless?  I believe that the point is to give a compiler error if 
an

R> incompatible pointer type was passed as the ptr parameter.

Thanks for explanation! I will back out.


I added the casts to get more checks with regard to the type safety in the 
sysctls, because sysctl_add_oid() uses "void *". They are not useless.


Casts would reduce type safety.  You actually added assignments.
Assignments to void * would be little different from conversions to the
void * parameter, but the assignments are to uint64_t * so they detect
most type differences except an initial type of void * which might be
correct (the caller should have started with uint64_t *, and it is too
late to detect the error if the caller started with something like
const volatile int32_t * and subverted this to void *.  But if the
sysctl is read-only, subverting its pointer from const int64_t * to
int64_t * might be needed since lower levels don't support const).


Maybe this should be explained in a comment somewhere?


A comment is not a place to explain what a cast is.

The assignment doesn't work for what should the usual case of a static
initializer.  I don't see a good way to fix this.  A not so good way is
to add a union holding int *, long *, etc. to the sysctl data.  Then for
SYSCTL_INT() assign the pointer to the the int * union member, etc.

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


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-15 Thread Hans Petter Selasky

On 03/15/16 01:05, Gleb Smirnoff wrote:

Author: glebius
Date: Tue Mar 15 00:05:00 2016
New Revision: 296880
URL: https://svnweb.freebsd.org/changeset/base/296880

Log:
   Provide sysctl(9) macro to deal with array of counter(9).

Modified:
   head/share/man/man9/counter.9
   head/sys/kern/subr_counter.c
   head/sys/sys/sysctl.h




Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Mon Mar 14 23:49:16 2016(r296879)
+++ head/sys/sys/sysctl.h   Tue Mar 15 00:05:00 2016(r296880)
@@ -204,6 +204,7 @@ int sysctl_handle_long(SYSCTL_HANDLER_AR
  int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
  int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
  int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS);
+int sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS);

  int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS);
  int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS);
@@ -648,6 +649,26 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
__ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr));   \
  })

+/* Oid for an array of counter(9)s.  The pointer and length must be non zero. 
*/
+#defineSYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, 
descr) \
+   SYSCTL_OID(parent, nbr, name,   \
+   CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
+   (ptr), (len), sysctl_handle_counter_u64_array, "S", descr);   \
+   CTASSERT(((access) & CTLTYPE) == 0 ||   \
+   ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
+


Gleb: I suggest you follow the example of the other static SYSCTLs, and 
extend the CTASSERT to also cover the size of the array:


CTASSERT(((access) & CTLTYPE) == 0 ||   \
(((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE &&\
 (sizeof(*(ptr)) == 8 * (len


+#defineSYSCTL_ADD_COUNTER_U64_ARRAY(ctx, parent, nbr, name, access,
\
+ptr, len, descr)   \
+({ \
+   counter_u64_t *__ptr = (ptr);   \
+   CTASSERT(((access) & CTLTYPE) == 0 ||   \
+   ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE);  \


Same here possibly. Maybe extend the CTASSERT() to also cover the size 
of the array? Would limit the "len" to a constant argument though.



+   sysctl_add_oid(ctx, parent, nbr, name,  \
+   CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
+   __ptr, len, sysctl_handle_counter_u64_array, "S", \
+   __DESCR(descr));\
+})
+
  /* Oid for an opaque object.  Specified by a pointer and a length. */
  #define   SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr)  
\
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access),  \


--HPS

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


Re: svn commit: r296868 - head/sys/sys

2016-03-15 Thread Hans Petter Selasky

On 03/14/16 21:33, Gleb Smirnoff wrote:

On Mon, Mar 14, 2016 at 02:31:37PM -0400, Ryan Stone wrote:
R> On Mon, Mar 14, 2016 at 2:07 PM, Gleb Smirnoff  wrote:
R>
R> >   Remove useless cast in SYSCTL_ADD_COUNTER_U64 macro.
R> >
R>
R> Is it useless?  I believe that the point is to give a compiler error if an
R> incompatible pointer type was passed as the ptr parameter.

Thanks for explanation! I will back out.



Hi,

I added the casts to get more checks with regard to the type safety in 
the sysctls, because sysctl_add_oid() uses "void *". They are not useless.


Maybe this should be explained in a comment somewhere?

Similarly you'll find a set of sizeof() compile time assert checks for 
the static sysctls.


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


Re: svn commit: r296769 - in head/sys/boot/efi: boot1 loader

2016-03-15 Thread Baptiste Daroussin
On Sat, Mar 12, 2016 at 09:44:33PM +, Ed Maste wrote:
> Author: emaste
> Date: Sat Mar 12 21:44:33 2016
> New Revision: 296769
> URL: https://svnweb.freebsd.org/changeset/base/296769
> 
> Log:
>   boot/efi: Prefer nm to objdump
>   
>   Both objdump and nm are equally capable of reporting undefined symbols.
>   
>   This gets us a step closer to building without binutils as we have an nm
>   implementation from ELF Tool Chain.
>   
>   Reviewed by:bdrewery
>   MFC after:  1 month
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D5613
> 
> Modified:
>   head/sys/boot/efi/boot1/Makefile
>   head/sys/boot/efi/loader/Makefile
> 
> Modified: head/sys/boot/efi/boot1/Makefile
> ==
> --- head/sys/boot/efi/boot1/Makefile  Sat Mar 12 20:05:23 2016
> (r296768)
> +++ head/sys/boot/efi/boot1/Makefile  Sat Mar 12 21:44:33 2016
> (r296769)
> @@ -73,8 +73,8 @@ LDADD+= -lstand
>  
>  DPADD+=  ${LDSCRIPT}
>  
> +NM?= nm
>  OBJCOPY?=objcopy
> -OBJDUMP?=objdump
>  
>  .if ${MACHINE_CPUARCH} == "amd64"
>  EFI_TARGET=  efi-app-x86_64
> @@ -85,8 +85,8 @@ EFI_TARGET= binary
>  .endif
>  
>  boot1.efi: ${PROG}
> - if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \
> - ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \
> + if ${NM} ${.ALLSRC} | grep ' U '; then \

grep -q maybe to avoid extra noise?

Bapt


signature.asc
Description: PGP signature


Re: svn commit: r296825 - in head/sys: arm/conf arm/mv arm/mv/armada38x boot/fdt/dts/arm

2016-03-15 Thread Wojciech Macek
Fixed in https://svnweb.freebsd.org/changeset/base/296893


2016-03-15 2:37 GMT+01:00 Andrew Turner :

> On Mon, 14 Mar 2016 07:05:41 + (UTC)
> Wojciech Macek  wrote:
>
> > Author: wma
> > Date: Mon Mar 14 07:05:41 2016
> > New Revision: 296825
> > URL: https://svnweb.freebsd.org/changeset/base/296825
> >
> > Log:
> >   Make MPIC compatible with ARM_INTRNG
> >
> >   After ARM_INTRNG introduction, MPIC code needed several
> > modifications:
> >   - IRQ resource and its handler added
> >   -  several DEVMETHODs of INTRNG interface implemented
> >   -  defines enhanced to ensure code compiles as well for AXP as for
> > A38X
> >   - added dummy MSI_IRQ, ERR_IRQ defines for Armada38x
> >   - MPIC driver was added to files.armada38x, ARM_INTRNG option
> > enabled in kernconf file and regs of MPIC corrected in dts file.
> >
> >   Instead of modifying Armada38X DTS, offsets to CPU registers
> > defined in driver were changed. That required restoring 'reg'
> > property of mpic node in ArmadaXP to state compliant with Linux DTS.
> >
> >   Additionally, required ARM_INTRNG definitions were added to
> > mv_common.c.
> >   Submitted by:  Bartosz Szczepanek 
> >   Obtained from: Semihalf
> >   Sponsored by:  Stormshield
> >   Reviewed by:   adrian, andrew, ian, skra
> >   Approved by:   cognet (mentor)
> >   Differential Revision: https://reviews.freebsd.org/D5030
> >
> > Modified:
> >   head/sys/arm/conf/ARMADA38X
> >   head/sys/arm/mv/armada38x/files.armada38x
> >   head/sys/arm/mv/mpic.c
> >   head/sys/arm/mv/mvreg.h
> >   head/sys/boot/fdt/dts/arm/db78460.dts
> >
> > Modified: head/sys/arm/conf/ARMADA38X
> >
> ==
> > --- head/sys/arm/conf/ARMADA38X   Mon Mar 14 06:30:37
> > 2016  (r296824) +++ head/sys/arm/conf/ARMADA38X   Mon Mar
> > 14 07:05:41 2016  (r296825) @@ -23,6 +23,7 @@ options
> > SCHED_ULE # ULE scheduler #options
> > SCHED_4BSD# 4BSD scheduler
> >  options  SMP
> > +options  ARM_INTRNG
>
> This file already had ARM_INTRNG set. It now has it twice.
>
> Andrew
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296893 - in head/sys/arm: conf mv

2016-03-15 Thread Wojciech Macek
Author: wma
Date: Tue Mar 15 06:06:09 2016
New Revision: 296893
URL: https://svnweb.freebsd.org/changeset/base/296893

Log:
  Remove redefinitions in ARMADA code
  
  * Rename IRQ_MASK to MPIC_IRQ_MASK not to overlap with
register name from mvreg.h
  * Remove ARM_INTRNG from ARMADA38X, apparently was already
included.

Modified:
  head/sys/arm/conf/ARMADA38X
  head/sys/arm/mv/mpic.c

Modified: head/sys/arm/conf/ARMADA38X
==
--- head/sys/arm/conf/ARMADA38X Tue Mar 15 05:17:31 2016(r296892)
+++ head/sys/arm/conf/ARMADA38X Tue Mar 15 06:06:09 2016(r296893)
@@ -23,7 +23,6 @@ options   SCHED_ULE   # ULE scheduler
 #options   SCHED_4BSD  # 4BSD scheduler
 
 optionsSMP
-optionsARM_INTRNG
 
 # Debugging
 #options   DEBUG

Modified: head/sys/arm/mv/mpic.c
==
--- head/sys/arm/mv/mpic.c  Tue Mar 15 05:17:31 2016(r296892)
+++ head/sys/arm/mv/mpic.c  Tue Mar 15 06:06:09 2016(r296893)
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
 #defineMPIC_INT_ERR4
 #defineMPIC_INT_MSI96
 
-#defineIRQ_MASK0x3ff
+#defineMPIC_IRQ_MASK   0x3ff
 
 #defineMPIC_CTRL   0x0
 #defineMPIC_SOFT_INT   0x4
@@ -409,10 +409,10 @@ arm_get_next_irq(int last)
 {
u_int irq, next = -1;
 
-   irq = mv_mpic_get_cause() & IRQ_MASK;
+   irq = mv_mpic_get_cause() & MPIC_IRQ_MASK;
CTR2(KTR_INTR, "%s: irq:%#x", __func__, irq);
 
-   if (irq != IRQ_MASK) {
+   if (irq != MPIC_IRQ_MASK) {
if (irq == MPIC_INT_ERR)
irq = mv_mpic_get_cause_err();
if (irq == MPIC_INT_MSI)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"