Re: svn commit: r333744 - in head/sys: kern sys

2018-06-06 Thread Matthew Macy
gt;>>   x before4
>>>   + after4.2
>>>   N   Min   MaxMedian   Avg
>>> Stddev
>>>   x  10   3986994   3991728 3990137.5 3989985.2 
>>> 1300.0164
>>>   +  10   470   4806664 4806116.5   4805194 
>>> 1990.6625
>>>   Difference at 95.0% confidence
>>>   815209 +/- 1579.64
>>>   20.4314% +/- 0.0421713%
>>>   (Student's t, pooled s = 1681.19)
>>>
>>>   Tested by: pho
>>>   Reported by:mjg
>>>   Approved by:sbruno
>>>   Sponsored by:   Limelight Networks
>>>   Differential Revision:  https://reviews.freebsd.org/D15430
>>>
>>> Modified:
>>>   head/sys/kern/uipc_usrreq.c
>>>   head/sys/sys/unpcb.h
>>>
>>> Modified: head/sys/kern/uipc_usrreq.c
>>> ==
>>> --- head/sys/kern/uipc_usrreq.c   Thu May 17 17:57:41 2018
>>> (r333743)
>>
>> This commit seems to cause this:
>>
>> 20180606 20:44:37 all (1/1): datagram.sh
>> panic: _mtx_lock_sleep: recursed on non-recursive mutex unp_mtx @ 
>> ../../../kern/uipc_usrreq.c:354
>>
>> cpuid = 91
>> time = 1528310678
>> KDB: stack backtrace:
>> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
>> 0xfe00f3a2bcd0
>> vpanic() at vpanic+0x1a3/frame 0xfe00f3a2bd30
>> doadump() at doadump/frame 0xfe00f3a2bdb0
>> __mtx_lock_sleep() at __mtx_lock_sleep+0x49d/frame 0xfe00f3a2be30
>> __mtx_lock_flags() at __mtx_lock_flags+0xf9/frame 0xfe00f3a2be80
>> unp_connectat() at unp_connectat+0x2ec/frame 0xfe00f3a2c110
>> soconnectat() at soconnectat+0xe8/frame 0xfe00f3a2c160
>> kern_connectat() at kern_connectat+0x10f/frame 0xfe00f3a2c1c0
>> sys_connect() at sys_connect+0x77/frame 0xfe00f3a2c200
>> amd64_syscall() at amd64_syscall+0x2a7/frame 0xfe00f3a2c330
>> fast_syscall_common() at fast_syscall_common+0x101/frame 0xfe00f3a2c330
>> --- syscall (98, FreeBSD ELF64, sys_connect), rip = 0x80040081a, rsp = 
>> 0x7fffe2e8, rbp = 0x7fffe770 ---
>> KDB: enter: panic
>> [ thread pid 1276 tid 100966 ]
>> Stopped at  kdb_enter+0x3b: movq$0,kdb_why
>> db> x/s version
>> version:FreeBSD 12.0-CURRENT #0 r333744: Wed Jun  6 20:35:18 CEST 
>> 2018\012
>> p...@flix1a.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO\012
>> db>
>
>
> I fixed this in 334175 and 334185.
>
>>
>> The stack trace is different on HEAD:
>>
>> panic: mutex unp not owned at ../../../kern/uipc_usrreq.c:879
>> cpuid = 47
>> time = 1528311629
>> KDB: stack backtrace:
>> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
>> 0xfe00ee593ca0
>> vpanic() at vpanic+0x1a3/frame 0xfe00ee593d00
>> panic() at panic+0x43/frame 0xfe00ee593d60
>> __mtx_assert() at __mtx_assert+0xb4/frame 0xfe00ee593d70
>> uipc_disconnect() at uipc_disconnect+0x93/frame 0xfe00ee593dc0
>> soclose() at soclose+0xa5/frame 0xfe00ee593e30
>> closef() at closef+0x1f5/frame 0xfe00ee593ec0
>> fdescfree_fds() at fdescfree_fds+0x90/frame 0xfe00ee593f10
>> fdescfree() at fdescfree+0x480/frame 0xfe00ee593fd0
>> exit1() at exit1+0x500/frame 0xfe00ee594040
>> sigexit() at sigexit+0xae8/frame 0xfe00ee594220
>> postsig() at postsig+0x1cf/frame 0xfe00ee5942f0
>> ast() at ast+0x4b8/frame 0xfe00ee594330
>> doreti_ast() at doreti_ast+0x1f/frame 0x7fffe760
>> KDB: enter: panic
>> [ thread pid 1013 tid 100834 ]
>> Stopped at  kdb_enter+0x3b: movq$0,kdb_why
>> db> x/s version
>> version:FreeBSD 12.0-CURRENT #0 r334723: Wed Jun  6 20:53:32 CEST 
>> 2018\012
>> p...@flix1a.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO\012
>> db>
>
> I'll take a look.
> -M
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334754 - head/sbin/nvmecontrol

2018-06-06 Thread Justin Hibbits
Author: jhibbits
Date: Thu Jun  7 04:02:09 2018
New Revision: 334754
URL: https://svnweb.freebsd.org/changeset/base/334754

Log:
  Print Maximum Data Transfer Size as a long rather than int
  
  PowerPC has PAGE_SIZE as a long, not an int.  This causes the compiler to 
throw
  a format mismatch warning on this print.  To work around the difference, print
  it as a long instead of an int, and force the argument to a long.
  
  Reviewed By: imp
  Differential Revision: https://reviews.freebsd.org/D15653

Modified:
  head/sbin/nvmecontrol/identify.c

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cThu Jun  7 03:19:21 2018
(r334753)
+++ head/sbin/nvmecontrol/identify.cThu Jun  7 04:02:09 2018
(r334754)
@@ -119,7 +119,7 @@ print_controller(struct nvme_controller_data *cdata)
if (cdata->mdts == 0)
printf("Unlimited\n");
else
-   printf("%d\n", PAGE_SIZE * (1 << cdata->mdts));
+   printf("%ld\n", PAGE_SIZE * (1L << cdata->mdts));
printf("Controller ID:   0x%02x\n", cdata->ctrlr_id);
printf("Version: %d.%d.%d\n",
(cdata->ver >> 16) & 0x, (cdata->ver >> 8) & 0xff,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334755 - head/sbin

2018-06-06 Thread Justin Hibbits
Author: jhibbits
Date: Thu Jun  7 04:03:19 2018
New Revision: 334755
URL: https://svnweb.freebsd.org/changeset/base/334755

Log:
  Build nvmecontrol on powerpc64
  
  The nvme driver is compiled for powerpc64 already, and the one fix required
  to build nvmecontrol on powerpc64 was fixed in r334754.

Modified:
  head/sbin/Makefile.powerpc64

Modified: head/sbin/Makefile.powerpc64
==
--- head/sbin/Makefile.powerpc64Thu Jun  7 04:02:09 2018
(r334754)
+++ head/sbin/Makefile.powerpc64Thu Jun  7 04:03:19 2018
(r334755)
@@ -2,3 +2,4 @@
 
 SUBDIR += bsdlabel
 SUBDIR += fdisk
+SUBDIR += nvmecontrol
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Ravi Pokala
> I believe the theory is that the compiler (remember, this is 
> __builtin_memset) can optimize away portions of the zeroing, or can optimize 
> zeroing for small sizes.

Ahhh! I didn't consider that the compiler would be doing analysis of the larger 
context, and potentially skipping zeroing parts that are set immediately after 
the call.

Thanks!

-Ravi (rpokala@)

-Original Message-
From: "Jonathan T. Looney" 
Date: 2018-06-06, Wednesday at 22:58
To: Ravi Pokala 
Cc: Mateusz Guzik , Mateusz Guzik , 
src-committers , , 

Subject: Re: svn commit: r334702 - head/sys/sys

> On Wed, Jun 6, 2018 at 10:14 PM, Ravi Pokala  wrote:
>>
>> -Original Message-
>> From:  on behalf of Mateusz Guzik 
>> 
>> Date: 2018-06-06, Wednesday at 09:01
>> To: Ravi Pokala 
>> Cc: Mateusz Guzik , src-committers 
>> , , 
>> 
>> Subject: Re: svn commit: r334702 - head/sys/sys
>>
>>> On Wed, Jun 6, 2018 at 1:35 PM, Ravi Pokala  wrote:
>>>
> + * Passing the flag down requires malloc to blindly zero the entire 
> object.
> + * In practice a lot of the zeroing can be avoided if most of the object
> + * gets explicitly initialized after the allocation. Letting the compiler
> + * zero in place gives it the opportunity to take advantage of this 
> state.

 This part, I still don't understand. :-(
>>>
>>> The call to bzero() is still for the full length passed in, so how does 
>>> this help?
>>>
>>> bzero is:
>>> #define bzero(buf, len) __builtin_memset((buf), 0, (len))
>> 
>> I'm afraid that doesn't answer my question; you're passing the full length 
>> to __builtin_memset() too.
> 
> I believe the theory is that the compiler (remember, this is 
> __builtin_memset) can optimize away portions of the zeroing, or can optimize 
> zeroing for small sizes.
> 
> For example, imagine you do this:
> 
> struct foo {
> uint32_t a;
> uint32_t b;
> };
> 
> struct foo *
> alloc_foo(void)
> {
> struct foo *rv;
> 
> rv = malloc(sizeof(*rv), M_TMP, M_WAITOK|M_ZERO);
> rv->a = 1;
> rv->b = 2;
> return (rv);
> }
> 
> In theory, the compiler can be smart enough to know that the entire structure 
> is initialized, so it is not necessary to zero it.
> 
> (I personally have not tested how well this works in practice. However, this 
> change theoretically lets the compiler be smarter and optimize away unneeded 
> work.)
> 
> At minimum, it should let the compiler replace calls to memset() (and the 
> loops there) with optimal instructions to zero the exact amount of memory 
> that needs to be initialized. (Again, I haven't personally tested how smart 
> the compilers we use are about producing optimal code in this situation.)
> 
> Jonathan


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


svn commit: r334753 - head/lib/libpmc

2018-06-06 Thread Matt Macy
Author: mmacy
Date: Thu Jun  7 03:19:21 2018
New Revision: 334753
URL: https://svnweb.freebsd.org/changeset/base/334753

Log:
  libpmc: add missed (uintmax_t) casts

Modified:
  head/lib/libpmc/libpmc_json.cc   (contents, props changed)

Modified: head/lib/libpmc/libpmc_json.cc
==
--- head/lib/libpmc/libpmc_json.cc  Thu Jun  7 02:54:11 2018
(r334752)
+++ head/lib/libpmc/libpmc_json.cc  Thu Jun  7 03:19:21 2018
(r334753)
@@ -75,7 +75,7 @@ startentry(struct pmclog_ev *ev)
char eventbuf[128];
 
snprintf(eventbuf, sizeof(eventbuf), "%s, \"tsc\": \"%jd\"",
-   typenames[ev->pl_type], (intmax_t)ev->pl_ts.tv_sec);
+   typenames[ev->pl_type], (uintmax_t)ev->pl_ts.tv_sec);
return (string(eventbuf));
 }
 
@@ -163,7 +163,7 @@ procexec_to_json(struct pmclog_ev *ev)
"%s, \"pmcid\": \"0x%08x\", \"pid\": \"%d\", "
"\"start\": \"0x%016jx\", \"pathname\": \"%s\"}\n",
startent.c_str(), ev->pl_u.pl_x.pl_pmcid, ev->pl_u.pl_x.pl_pid,
-   ev->pl_u.pl_x.pl_entryaddr, ev->pl_u.pl_x.pl_pathname);
+   (uintmax_t)ev->pl_u.pl_x.pl_entryaddr, 
ev->pl_u.pl_x.pl_pathname);
return string(eventbuf);
 }
 
@@ -264,10 +264,10 @@ callchain_to_json(struct pmclog_ev *ev)
ev->pl_u.pl_cc.pl_tid, ev->pl_u.pl_cc.pl_cpuflags, 
ev->pl_u.pl_cc.pl_cpuflags2);
result = string(eventbuf);
for (i = 0; i < ev->pl_u.pl_cc.pl_npc - 1; i++) {
-   snprintf(eventbuf, sizeof(eventbuf), "\"0x%016jx\", ", 
ev->pl_u.pl_cc.pl_pc[i]);
+   snprintf(eventbuf, sizeof(eventbuf), "\"0x%016jx\", ", 
(uintmax_t)ev->pl_u.pl_cc.pl_pc[i]);
result += string(eventbuf);
}
-   snprintf(eventbuf, sizeof(eventbuf), "\"0x%016jx\"]}\n", 
ev->pl_u.pl_cc.pl_pc[i]);
+   snprintf(eventbuf, sizeof(eventbuf), "\"0x%016jx\"]}\n", 
(uintmax_t)ev->pl_u.pl_cc.pl_pc[i]);
result += string(eventbuf);
return (result);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334752 - head/sys/kern

2018-06-06 Thread Alan Cox
Author: alc
Date: Thu Jun  7 02:54:11 2018
New Revision: 334752
URL: https://svnweb.freebsd.org/changeset/base/334752

Log:
  pidctrl_daemon() implements a variation on the classical, discrete PID
  controller that tries to handle early invocations of the controller,
  in other words, invocations before the expected end of the interval.
  However, there were some calculation errors in this early invocation
  case.  Notably, if an early invocation occurred while the error was
  negative, the derivative term was off by a large amount.  One visible
  effect of this error was that processes were being killed by the
  virtual memory system's OOM killer when in fact there was plentiful
  free memory.
  
  Correct a couple minor errors in the sysctl descriptions, and apply
  some style fixes.
  
  Reviewed by:  jeff, markj

Modified:
  head/sys/kern/subr_pidctrl.c

Modified: head/sys/kern/subr_pidctrl.c
==
--- head/sys/kern/subr_pidctrl.cThu Jun  7 02:30:48 2018
(r334751)
+++ head/sys/kern/subr_pidctrl.cThu Jun  7 02:54:11 2018
(r334752)
@@ -59,14 +59,14 @@ pidctrl_init_sysctl(struct pidctrl *pc, struct sysctl_
>pc_olderror, 0, "Error value from last interval");
SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "integral", CTLFLAG_RD,
>pc_integral, 0, "Accumulated error integral (I)");
-   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "derivative",
-   CTLFLAG_RD, >pc_derivative, 0, "Error derivative (I)");
+   SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "derivative", CTLFLAG_RD,
+   >pc_derivative, 0, "Error derivative (D)");
SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "input", CTLFLAG_RD,
>pc_input, 0, "Last controller process variable input");
SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "output", CTLFLAG_RD,
>pc_output, 0, "Last controller output");
SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "ticks", CTLFLAG_RD,
-   >pc_ticks, 0, "Last controler runtime");
+   >pc_ticks, 0, "Last controller runtime");
SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "setpoint", CTLFLAG_RW,
>pc_setpoint, 0, "Desired level for process variable");
SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "interval", CTLFLAG_RD,
@@ -96,21 +96,20 @@ pidctrl_classic(struct pidctrl *pc, int input)
Kid = MAX(pc->pc_Kid, 1);
Kdd = MAX(pc->pc_Kdd, 1);
 
-   /* Compute P (proportional error), I (integral), D (derivative) */
+   /* Compute P (proportional error), I (integral), D (derivative). */
pc->pc_error = error;
pc->pc_integral =
MAX(MIN(pc->pc_integral + error, pc->pc_bound), -pc->pc_bound);
pc->pc_derivative = error - pc->pc_olderror;
 
/* Divide by inverse gain values to produce output. */
-   output = ((pc->pc_error / Kpd) +
-   (pc->pc_integral / Kid)) +
+   output = (pc->pc_error / Kpd) + (pc->pc_integral / Kid) +
(pc->pc_derivative / Kdd);
/* Save for sysctl. */
pc->pc_output = output;
pc->pc_input = input;
 
-   return output;
+   return (output);
 }
 
 int
@@ -121,17 +120,18 @@ pidctrl_daemon(struct pidctrl *pc, int input)
 
error = pc->pc_setpoint - input;
/*
-* When ticks expired we reset our variables and start a new
+* When ticks expires we reset our variables and start a new
 * interval.  If we're called multiple times during one interval
 * we attempt to report a target as if the entire error came at
 * the interval boundary.
 */
-   if ((u_int)(ticks - pc->pc_ticks) >= pc->pc_interval) {
+   if ((u_int)ticks - pc->pc_ticks >= pc->pc_interval) {
pc->pc_ticks = ticks;
pc->pc_olderror = pc->pc_error;
pc->pc_output = pc->pc_error = 0;
} else {
-   error = MAX(error + pc->pc_error, 0);
+   /* Calculate the error relative to the last call. */
+   error -= pc->pc_error - pc->pc_output;
}
 
/* Fetch gains and prevent divide by zero. */
@@ -139,19 +139,19 @@ pidctrl_daemon(struct pidctrl *pc, int input)
Kid = MAX(pc->pc_Kid, 1);
Kdd = MAX(pc->pc_Kdd, 1);
 
-   /* Compute P (proportional error), I (integral), D (derivative) */
-   pc->pc_error = error;
+   /* Compute P (proportional error), I (integral), D (derivative). */
+   pc->pc_error += error;
pc->pc_integral =
MAX(MIN(pc->pc_integral + error, pc->pc_bound), 0);
-   pc->pc_derivative = error - pc->pc_olderror;
+   pc->pc_derivative = pc->pc_error - pc->pc_olderror;
 
/* Divide by inverse gain values to produce output. */
-   output = ((error / Kpd) +
-   (pc->pc_integral / Kid)) +
+   output = (error / Kpd) + (pc->pc_integral / Kid) +
(pc->pc_derivative / Kdd);
output = MAX(output 

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

2018-06-06 Thread Jonathan T. Looney
On Wed, Jun 6, 2018 at 10:14 PM, Ravi Pokala  wrote:
>
> -Original Message-
> From:  on behalf of Mateusz Guzik <
mjgu...@gmail.com>
> Date: 2018-06-06, Wednesday at 09:01
> To: Ravi Pokala 
> Cc: Mateusz Guzik , src-committers <
src-committ...@freebsd.org>, , <
svn-src-h...@freebsd.org>
> Subject: Re: svn commit: r334702 - head/sys/sys
>
> > On Wed, Jun 6, 2018 at 1:35 PM, Ravi Pokala  wrote:
> >
> >>> + * Passing the flag down requires malloc to blindly zero the entire
object.
> >>> + * In practice a lot of the zeroing can be avoided if most of the
object
> >>> + * gets explicitly initialized after the allocation. Letting the
compiler
> >>> + * zero in place gives it the opportunity to take advantage of this
state.
> >>
> >> This part, I still don't understand. :-(
> >
> > The call to bzero() is still for the full length passed in, so how does
this help?
> >
> > bzero is:
> > #define bzero(buf, len) __builtin_memset((buf), 0, (len))
>
> I'm afraid that doesn't answer my question; you're passing the full
length to __builtin_memset() too.


I believe the theory is that the compiler (remember, this is
__builtin_memset) can optimize away portions of the zeroing, or can
optimize zeroing for small sizes.

For example, imagine you do this:

struct foo {
uint32_t a;
uint32_t b;
};

struct foo *
alloc_foo(void)
{
struct foo *rv;

rv = malloc(sizeof(*rv), M_TMP, M_WAITOK|M_ZERO);
rv->a = 1;
rv->b = 2;
return (rv);
}

In theory, the compiler can be smart enough to know that the entire
structure is initialized, so it is not necessary to zero it.

(I personally have not tested how well this works in practice. However,
this change theoretically lets the compiler be smarter and optimize away
unneeded work.)

At minimum, it should let the compiler replace calls to memset() (and the
loops there) with optimal instructions to zero the exact amount of memory
that needs to be initialized. (Again, I haven't personally tested how smart
the compilers we use are about producing optimal code in this situation.)

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


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

2018-06-06 Thread Matt Macy
Author: mmacy
Date: Thu Jun  7 02:20:27 2018
New Revision: 334750
URL: https://svnweb.freebsd.org/changeset/base/334750

Log:
  hwpmc: don't do EMIT64 on constant

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

Modified: head/sys/dev/hwpmc/hwpmc_logging.c
==
--- head/sys/dev/hwpmc/hwpmc_logging.c  Thu Jun  7 02:03:22 2018
(r334749)
+++ head/sys/dev/hwpmc/hwpmc_logging.c  Thu Jun  7 02:20:27 2018
(r334750)
@@ -739,7 +739,8 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_o
PMCLOG_EMIT64(tsc_freq);
 #else
/* other architectures will need to fill this in */
-   PMCLOG_EMIT64(0);
+   PMCLOG_EMIT32(0);
+   PMCLOG_EMIT32(0);
 #endif
memcpy(_le, , sizeof(ts));
_le += sizeof(ts)/4;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Ravi Pokala
-Original Message-
From:  on behalf of Mateusz Guzik 

Date: 2018-06-06, Wednesday at 09:01
To: Ravi Pokala 
Cc: Mateusz Guzik , src-committers 
, , 

Subject: Re: svn commit: r334702 - head/sys/sys

> On Wed, Jun 6, 2018 at 1:35 PM, Ravi Pokala  wrote:
> 
>>> + * Passing the flag down requires malloc to blindly zero the entire object.
>>> + * In practice a lot of the zeroing can be avoided if most of the object
>>> + * gets explicitly initialized after the allocation. Letting the compiler
>>> + * zero in place gives it the opportunity to take advantage of this state.
>>
>> This part, I still don't understand. :-(
> 
> The call to bzero() is still for the full length passed in, so how does this 
> help?
> 
> bzero is:
> #define bzero(buf, len) __builtin_memset((buf), 0, (len))

I'm afraid that doesn't answer my question; you're passing the full length to 
__builtin_memset() too.

>>> ...
>>> + *   _malloc_item = malloc(_size, type, (flags) &~ M_ZERO);
>>> + *   if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL)
>>> + *   bzero(_malloc_item, _size);
>>> + *
>>> + * If the flag is set, the compiler knows the left side is always true,
>>> + * therefore the entire statement is true and the callsite is:
>> 
>> I think you mean "... the *right* side is always true ...", since the left 
>> side is the check for the flag being set. "If the flag is set, compiler 
>> knows (the check for the flag being set) is always true" is tautological.
> 
> It explains how __builtin_constant_p(flags) being true allows the compiler
> to optimize out the flags-based check.

The __builtin_constant_p()s are in the conditional *before* the one I'm asking 
about. The test for M_WAITOK on the left being true, will cause the NULL-check 
on the right to be skipped because of the short-circuit semantics of binary ||. 
But because M_WAITOK is set, the NULL-check will pass anyway... Ah, and that's 
what you meant by "therefore the entire statement is true".

I think the wording was throwing me; it might be clearer English to say 
something like "If the flag is set -- and we only get here if that can be 
determined at compile-time, because of __builtin_constant_p() -- then the 
entire statement is true. This skips the NULL-check, but it will always pass if 
the flag is set anyway."

> I don't understand why this particular use runs into so much confusion.
> Just above it there is a M_ZERO check relying on the same property and
> receiving no attention.

In that context, it's clearer what's the condition is:
- "size" must be constant at compile-time
- "flags" must be constant at compile-time
- "flags" must have M_ZERO set

>>> ...
>>> + * If the flag is not set, the compiler knows the left size is always false
>>> + * and the NULL check is needed, therefore the callsite is:
>> 
>> Same issue here.

And same answer here too.

>>> ...
>>>  #ifdef _KERNEL
>>>  #define  malloc(size, type, flags) ({  
>>>   \
>> 
>> Now that I'm taking another look at this, I'm confused as to why the entire 
>> macro expansion is inside parentheses? (The braces make sense, since this is 
>> a block with local variables which need to be contained.)
> 
> It is to return the value (the last expression).

Yeah, Ben / Bruce / Conrad clarified that.

>>>   void *_malloc_item; \
>>> @@ -193,7 +228,8 @@ void  *malloc(size_t size, struct malloc_type 
>>> *type, in
>>>   if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\
>>>   ((flags) & M_ZERO) != 0) {  \
>>>   _malloc_item = malloc(_size, type, (flags) &~ M_ZERO);  \
>>> - if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL)  \
>>> + if (((flags) & M_WAITOK) != 0 ||\
>>> + __predict_true(_malloc_item != NULL))   \
>>>   bzero(_malloc_item, _size); \
>>>   } else {\
>>>   _malloc_item = malloc(_size, type, flags);  \
>> 
>> This confuses me too. If the constant-size/constant-flags/M_ZERO-is-set test 
>> fails, then it falls down to calling malloc(). Which we are in the middle of 
>> defining. So what does that expand to?
> 
> Expansion is not recursive, so this is an actual call to malloc. 

Ah, right. I swear I knew that at some point. :-)

> -- 
> Mateusz Guzik http://gmail.com>>

Thanks Mateusz,

-Ravi (rpokala@)


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


Re: svn commit: r333744 - in head/sys: kern sys

2018-06-06 Thread Matthew Macy
On Wed, Jun 6, 2018 at 12:03 PM, Peter Holm  wrote:
> On Thu, May 17, 2018 at 05:59:35PM +, Matt Macy wrote:
>> Author: mmacy
>> Date: Thu May 17 17:59:35 2018
>> New Revision: 333744
>> URL: https://svnweb.freebsd.org/changeset/base/333744
>>
>> Log:
>>   AF_UNIX: make unix socket locking finer grained
>>
>>   This change moves to using a reference count across lock drop / reacquire
>>   to guarantee liveness.
>>
>>   Currently sends on unix sockets contend heavily on read locking the list 
>> lock.
>>   unix1_processes in will-it-scale peaks at 6 processes and then declines.
>>
>>   With this change I get a substantial improvement in number of operations 
>> per second
>>   with 96 processes:
>>
>>   x before
>>   + after
>>   N   Min   MaxMedian   AvgStddev
>>   x  11   1688420   1696389   1693578 1692766.3 2971.1702
>>   +  10  63417955  71030114  70662504  69576423 2374684.6
>>   Difference at 95.0% confidence
>>   6.78837e+07 +/- 1.49463e+06
>>   4010.22% +/- 88.4246%
>>   (Student's t, pooled s = 1.63437e+06)
>>
>>   And even for 2 processes shows a ~18% improvement.
>>   "Small" iron changes (1, 2, and 4 processes):
>>
>>   x before1
>>   + after1.2
>>   ++
>>   |  + |
>>   |   x  + |
>>   |   x  + |
>>   |   x  + |
>>   |   x ++ |
>>   |  xx ++ |
>>   |x   x xx ++ |
>>   |  |__A_M_AM||
>>   ++
>>   N   Min   MaxMedian   AvgStddev
>>   x  10   1131648   1197750 1197138.5 1190369.3 20651.839
>>   +  10   1203840   1205056   1204919 1204827.9 353.27404
>>   Difference at 95.0% confidence
>>   14458.6 +/- 13723
>>   1.21463% +/- 1.16683%
>>   (Student's t, pooled s = 14605.2)
>>
>>   x before2
>>   + after2.2
>>   ++
>>   |   +|
>>   |   +|
>>   |   +|
>>   |   +|
>>   |   +|
>>   |   +|
>>   |   x   +|
>>   |   x   +|
>>   | x xx  +|
>>   |x  +|
>>   |  |___AM_| A|
>>   ++
>>   N   Min   MaxMedian   AvgStddev
>>   x  10   1972843   2045866 2038186.5 2030443.8 21367.694
>>   +  10   2400853   2402196 2401043.5 2401172.7 385.40024
>>   Difference at 95.0% confidence
>>   370729 +/- 14198.9
>>   18.2585% +/- 0.826943%
>>   (Student's t, pooled s = 15111.7)
>>
>>   x before4
>>   + after4.2
>>   N   Min   MaxMedian   AvgStddev
>>   x  10   3986994   3991728 3990137.5 3989985.2 1300.0164
>>   +  10   470   4806664 4806116.5   4805194 1990.6625
>>   Difference at 95.0% confidence
>>   815209 +/- 1579.64
>>   20.4314% +/- 0.0421713%
>>   (Student's t, pooled s = 1681.19)
>>
>>   Tested by: pho
>>   Reported by:mjg
>>   Approved by:   

svn commit: r334749 - in head: lib lib/libpmc sys/dev/hwpmc sys/sys usr.sbin usr.sbin/pmc usr.sbin/pmccontrol usr.sbin/pmcstat

2018-06-06 Thread Matt Macy
Author: mmacy
Date: Thu Jun  7 02:03:22 2018
New Revision: 334749
URL: https://svnweb.freebsd.org/changeset/base/334749

Log:
  pmc: convert native to jsonl and track TSC value of samples
  
  - add '-j' options to filter to enable converting native pmc
log format to json lines format to enable the use of scripts
and external tooling
  
  % pmc filter -j pmc.log pmc.jsonl
  
  - Record the tsc value in sampling interrupts as opposed to
recording nanotime when the sample is copied to a global log
in hardclock - potentially many milliseconds later.
  
  - At initialize record the tsc_freq and the time of day to give
us an offset for translating the tsc values in callchain records

Added:
  head/lib/libpmc/libpmc_json.cc   (contents, props changed)
  head/lib/libpmc/pmcformat.h   (contents, props changed)
Modified:
  head/lib/Makefile
  head/lib/libpmc/Makefile
  head/lib/libpmc/pmclog.c
  head/lib/libpmc/pmclog.h
  head/sys/dev/hwpmc/hwpmc_logging.c
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/sys/pmc.h
  head/sys/sys/pmclog.h
  head/usr.sbin/Makefile
  head/usr.sbin/pmc/Makefile   (contents, props changed)
  head/usr.sbin/pmc/cmd_pmc_filter.cc
  head/usr.sbin/pmccontrol/Makefile
  head/usr.sbin/pmcstat/Makefile

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Thu Jun  7 00:55:17 2018(r334748)
+++ head/lib/Makefile   Thu Jun  7 02:03:22 2018(r334749)
@@ -202,7 +202,9 @@ _libdl= libdl
 .endif
 
 SUBDIR.${MK_OPENSSL}+= libmp
+.if (${COMPILER_TYPE} == "clang" || (${COMPILER_TYPE} == "gcc" && 
${COMPILER_VERSION} >= 60100))
 SUBDIR.${MK_PMC}+= libpmc libpmcstat
+.endif
 SUBDIR.${MK_RADIUS_SUPPORT}+=  libradius
 SUBDIR.${MK_SENDMAIL}+=libmilter libsm libsmdb libsmutil
 SUBDIR.${MK_TELNET}+=  libtelnet

Modified: head/lib/libpmc/Makefile
==
--- head/lib/libpmc/MakefileThu Jun  7 00:55:17 2018(r334748)
+++ head/lib/libpmc/MakefileThu Jun  7 02:03:22 2018(r334749)
@@ -3,8 +3,8 @@
 PACKAGE=lib${LIB}
 LIB=   pmc
 
-SRCS=  libpmc.c pmclog.c libpmc_pmu_util.c
-INCS=  pmc.h pmclog.h
+SRCS=  libpmc.c pmclog.c libpmc_pmu_util.c libpmc_json.cc
+INCS=  pmc.h pmclog.h pmcformat.h
 
 CFLAGS+= -I${.CURDIR}
 

Added: head/lib/libpmc/libpmc_json.cc
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libpmc/libpmc_json.cc  Thu Jun  7 02:03:22 2018
(r334749)
@@ -0,0 +1,393 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018, Matthew Macy
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+using std::string;
+
+static const char *typenames[] = {
+   "",
+   "{\"type\": \"closelog\"}\n",
+   "{\"type\": \"dropnotify\"}\n",
+   "{\"type\": \"initialize\"",
+   "",
+   "{\"type\": \"pmcallocate\"",
+   "{\"type\": \"pmcattach\"",
+   "{\"type\": \"pmcdetach\"",
+   "{\"type\": \"proccsw\"",
+   "{\"type\": \"procexec\"",
+   "{\"type\": \"procexit\"",
+   "{\"type\": \"procfork\"",
+   "{\"type\": \"sysexit\"",
+   "{\"type\": \"userdata\"",
+   "{\"type\": \"map_in\"",
+   "{\"type\": \"map_out\"",
+   "{\"type\": \"callchain\"",
+   "{\"type\": \"pmcallocatedyn\"",
+   "{\"type\": \"thr_create\"",
+   "{\"type\": \"thr_exit\"",
+   "{\"type\": 

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

2018-06-06 Thread Matt Macy
Author: mmacy
Date: Thu Jun  7 00:54:43 2018
New Revision: 334747
URL: https://svnweb.freebsd.org/changeset/base/334747

Log:
  hwpmc: don't log pid->name more than once

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

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==
--- head/sys/dev/hwpmc/hwpmc_mod.c  Thu Jun  7 00:54:11 2018
(r334746)
+++ head/sys/dev/hwpmc/hwpmc_mod.c  Thu Jun  7 00:54:43 2018
(r334747)
@@ -1821,7 +1821,8 @@ pmc_log_kernel_mappings(struct pmc *pm)
 
if (po->po_flags & PMC_PO_INITIAL_MAPPINGS_DONE)
return;
-
+   if (PMC_TO_MODE(pm) == PMC_MODE_SS)
+   pmc_process_allproc(pm);
/*
 * Log the current set of kernel modules.
 */
@@ -4041,8 +4042,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a
pmc = NULL;
break;
}
-   if (mode == PMC_MODE_SS)
-   pmc_process_allproc(pmc);
+
 
/*
 * Return the allocated index.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334748 - head/lib/libpmc

2018-06-06 Thread Matt Macy
Author: mmacy
Date: Thu Jun  7 00:55:17 2018
New Revision: 334748
URL: https://svnweb.freebsd.org/changeset/base/334748

Log:
  libpmc: simplify lookup by idx

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

Modified: head/lib/libpmc/libpmc_pmu_util.c
==
--- head/lib/libpmc/libpmc_pmu_util.c   Thu Jun  7 00:54:43 2018
(r334747)
+++ head/lib/libpmc/libpmc_pmu_util.c   Thu Jun  7 00:55:17 2018
(r334748)
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "pmu-events/pmu-events.h"
 
@@ -165,13 +166,11 @@ const char *
 pmc_pmu_event_get_by_idx(const char *cpuid, int idx)
 {
const struct pmu_events_map *pme;
-   const struct pmu_event *pe;
-   int i;
 
if ((pme = pmu_events_map_get(cpuid)) == NULL)
return (NULL);
-   for (i = 0, pe = pme->table; (pe->name || pe->desc || pe->event) && i < 
idx; pe++, i++);
-   return (pe->name);
+   assert(pme->table[idx].name);
+   return (pme->table[idx].name);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334746 - in head/sys: amd64/include i386/include

2018-06-06 Thread Matt Macy
Author: mmacy
Date: Thu Jun  7 00:54:11 2018
New Revision: 334746
URL: https://svnweb.freebsd.org/changeset/base/334746

Log:
  cpufunc: add rdtscp for x86

Modified:
  head/sys/amd64/include/cpufunc.h
  head/sys/i386/include/cpufunc.h

Modified: head/sys/amd64/include/cpufunc.h
==
--- head/sys/amd64/include/cpufunc.hThu Jun  7 00:24:10 2018
(r334745)
+++ head/sys/amd64/include/cpufunc.hThu Jun  7 00:54:11 2018
(r334746)
@@ -386,6 +386,15 @@ rdtsc(void)
return (low | ((uint64_t)high << 32));
 }
 
+static __inline uint64_t
+rdtscp(void)
+{
+   uint32_t low, high;
+
+   __asm __volatile("rdtscp" : "=a" (low), "=d" (high));
+   return (low | ((uint64_t)high << 32));
+}
+
 static __inline uint32_t
 rdtsc32(void)
 {

Modified: head/sys/i386/include/cpufunc.h
==
--- head/sys/i386/include/cpufunc.h Thu Jun  7 00:24:10 2018
(r334745)
+++ head/sys/i386/include/cpufunc.h Thu Jun  7 00:54:11 2018
(r334746)
@@ -368,6 +368,15 @@ rdtsc(void)
return (rv);
 }
 
+static __inline uint64_t
+rdtscp(void)
+{
+   uint64_t rv;
+
+   __asm __volatile("rdtscp" : "=A" (rv));
+   return (rv);
+}
+
 static __inline uint32_t
 rdtsc32(void)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Eugene Grosbein
07.06.2018 7:27, Ian Lepore wrote:

>>> I don't understand the drama over this.  rc.d startup scripts are
>>> *binaries*.
>> This is plain wrong. Example: before introduction of rcNG we had
>> /etc/rc.serial
>> supposed to be user-modified to contain local settings for serial
>> ports (uncluding USB serial).
>> Now it is moved to /etc/rc.d/serial largely unchanged and is still
>> supposed to be user-modified.
>>
> 
> You're holding up mostly-obsolete badly-written script as the example
> of why nothing can ever change?

I have not said nothing can ever change :-) Just that scripts are not binaries 
at all.
And discussed move will break things without working alternative proposal.

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


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Ian Lepore
On Thu, 2018-06-07 at 07:20 +0700, Eugene Grosbein wrote:
> 07.06.2018 3:06, Ian Lepore wrote:
> 
> > 
> > I don't understand the drama over this.  rc.d startup scripts are
> > *binaries*.
> This is plain wrong. Example: before introduction of rcNG we had
> /etc/rc.serial
> supposed to be user-modified to contain local settings for serial
> ports (uncluding USB serial).
> Now it is moved to /etc/rc.d/serial largely unchanged and is still
> supposed to be user-modified.
> 

You're holding up mostly-obsolete badly-written script as the example
of why nothing can ever change?

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


svn commit: r334745 - head/usr.sbin/bsdinstall/partedit

2018-06-06 Thread Justin Hibbits
Author: jhibbits
Date: Thu Jun  7 00:24:10 2018
New Revision: 334745
URL: https://svnweb.freebsd.org/changeset/base/334745

Log:
  Add partition scheme for mpc85xx devices
  
  Some mpc85xx devices with u-boot need MBR partitioning with a FAT boot
  partition.  Since the infrastructure is already in place to have a dedicated
  boot partition, this adds the necessary bits to use that infrastructure with
  mpc85xx boards.
  
  Reviewed By: nwhitehorn
  Differential Revision: https://reviews.freebsd.org/D15664

Modified:
  head/usr.sbin/bsdinstall/partedit/partedit_powerpc.c

Modified: head/usr.sbin/bsdinstall/partedit/partedit_powerpc.c
==
--- head/usr.sbin/bsdinstall/partedit/partedit_powerpc.cWed Jun  6 
23:12:35 2018(r334744)
+++ head/usr.sbin/bsdinstall/partedit/partedit_powerpc.cThu Jun  7 
00:24:10 2018(r334745)
@@ -44,7 +44,8 @@ default_scheme(void) {
 
if (strcmp(platform, "powermac") == 0)
return ("APM");
-   if (strcmp(platform, "chrp") == 0 || strcmp(platform, "ps3") == 0)
+   if (strcmp(platform, "chrp") == 0 || strcmp(platform, "ps3") == 0 ||
+   strcmp(platform, "mpc85xx") == 0)
return ("MBR");
 
/* Pick GPT as a generic default */
@@ -65,6 +66,8 @@ is_scheme_bootable(const char *part_type) {
(strcmp(part_type, "MBR") == 0 || strcmp(part_type, "BSD") == 0 ||
 strcmp(part_type, "GPT") == 0))
return (1);
+   if (strcmp(platform, "mpc85xx") == 0 && strcmp(part_type, "MBR") == 0)
+   return (1);
 
return (0);
 }
@@ -91,7 +94,8 @@ bootpart_size(const char *part_type)
return (0);
if (strcmp(platform, "chrp") == 0)
return (800*1024);
-   if (strcmp(platform, "ps3") == 0 || strcmp(platform, "powernv") == 0)
+   if (strcmp(platform, "ps3") == 0 || strcmp(platform, "powernv") == 0 ||
+   strcmp(platform, "mpc85xx") == 0)
return (512*1024*1024);
return (0);
 }
@@ -107,7 +111,8 @@ bootpart_type(const char *scheme, const char **mountpo
return ("prep-boot");
if (strcmp(platform, "powermac") == 0)
return ("apple-boot");
-   if (strcmp(platform, "powernv") == 0 || strcmp(platform, "ps3") == 0) {
+   if (strcmp(platform, "powernv") == 0 || strcmp(platform, "ps3") == 0 ||
+   strcmp(platform, "mpc85xx") == 0) {
*mountpoint = "/boot";
if (strcmp(scheme, "GPT") == 0)
return ("ms-basic-data");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Eugene Grosbein
07.06.2018 3:06, Ian Lepore wrote:

> I don't understand the drama over this.  rc.d startup scripts are
> *binaries*.

This is plain wrong. Example: before introduction of rcNG we had /etc/rc.serial
supposed to be user-modified to contain local settings for serial ports 
(uncluding USB serial).
Now it is moved to /etc/rc.d/serial largely unchanged and is still supposed to 
be user-modified.

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


svn commit: r334744 - in head: . tools/build/mk usr.bin/grep usr.bin/grep/nls

2018-06-06 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jun  6 23:12:35 2018
New Revision: 334744
URL: https://svnweb.freebsd.org/changeset/base/334744

Log:
  Remove NLS support from BSD grep
  
  GNU grep as in actually in base does not have any translations support
  compiled in, so no functionnality loss.
  
  We do support 193 locales in base, we will never catch up on that number of
  translation with bsd grep.
  
  Removing NLS support make bsd grep consistent with the other binaries in base
  which are not translated, and also reduce a little bit the code.
  
  Reviewed by:  kevans
  Approved by:  kevans
  Discussed with:   kevans @BSDCan
  Differential Revision:https://reviews.freebsd.org/D15682

Deleted:
  head/usr.bin/grep/nls/
Modified:
  head/ObsoleteFiles.inc
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.bin/grep/Makefile
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/grep.h
  head/usr.bin/grep/util.c

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jun  6 22:34:20 2018(r334743)
+++ head/ObsoleteFiles.inc  Wed Jun  6 23:12:35 2018(r334744)
@@ -38,6 +38,17 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20180607: remove nls support from grep
+OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/grep.cat
+OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/grep.cat
+OLD_FILES+=usr/share/nls/ja_JP.SJIS/grep.cat
+OLD_FILES+=usr/share/nls/ja_JP.eucJP/grep.cat
+OLD_FILES+=usr/share/nls/gl_ES.ISO8859-1/grep.cat
+OLD_FILES+=usr/share/nls/zh_CN.UTF-8/grep.cat
+OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/grep.cat
+OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/grep.cat
+OLD_FILES+=usr/share/nls/uk_UA.UTF-8/grep.cat
+OLD_FILES+=usr/share/nls/ja_JP.UTF-8/grep.cat
 # 20180517: retire vxge
 OLD_FILES+=usr/share/man/man4/if_vxge.4.gz
 OLD_FILES+=usr/share/man/man4/vxge.4.gz

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jun  6 22:34:20 
2018(r334743)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jun  6 23:12:35 
2018(r334744)
@@ -6277,7 +6277,6 @@ OLD_FILES+=usr/share/nls/el_GR.ISO8859-7/tcsh.cat
 OLD_FILES+=usr/share/nls/el_GR.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/en_US.ISO8859-1/ee.cat
 OLD_FILES+=usr/share/nls/en_US.ISO8859-15/ee.cat
-OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/grep.cat
 OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/libc.cat
 OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/es_ES.ISO8859-15/tcsh.cat
@@ -6309,10 +6308,8 @@ OLD_FILES+=usr/share/nls/fr_FR.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_FR.ISO8859-15/ee.cat
 OLD_FILES+=usr/share/nls/fr_FR.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_FR.UTF-8/tcsh.cat
-OLD_FILES+=usr/share/nls/gl_ES.ISO8859-1/grep.cat
 OLD_FILES+=usr/share/nls/gl_ES.ISO8859-1/libc.cat
 OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/ee.cat
-OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/grep.cat
 OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/libc.cat
 OLD_FILES+=usr/share/nls/hu_HU.ISO8859-2/sort.cat
 OLD_FILES+=usr/share/nls/it_CH.ISO8859-1/tcsh.cat
@@ -6322,12 +6319,9 @@ OLD_FILES+=usr/share/nls/it_IT.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/it_IT.ISO8859-15/libc.cat
 OLD_FILES+=usr/share/nls/it_IT.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/it_IT.UTF-8/tcsh.cat
-OLD_FILES+=usr/share/nls/ja_JP.SJIS/grep.cat
 OLD_FILES+=usr/share/nls/ja_JP.SJIS/tcsh.cat
-OLD_FILES+=usr/share/nls/ja_JP.UTF-8/grep.cat
 OLD_FILES+=usr/share/nls/ja_JP.UTF-8/libc.cat
 OLD_FILES+=usr/share/nls/ja_JP.UTF-8/tcsh.cat
-OLD_FILES+=usr/share/nls/ja_JP.eucJP/grep.cat
 OLD_FILES+=usr/share/nls/ja_JP.eucJP/libc.cat
 OLD_FILES+=usr/share/nls/ja_JP.eucJP/tcsh.cat
 OLD_FILES+=usr/share/nls/ko_KR.UTF-8/libc.cat
@@ -6338,14 +6332,12 @@ OLD_FILES+=usr/share/nls/no_NO.ISO8859-1/libc.cat
 OLD_FILES+=usr/share/nls/pl_PL.ISO8859-2/ee.cat
 OLD_FILES+=usr/share/nls/pl_PL.ISO8859-2/libc.cat
 OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/ee.cat
-OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/grep.cat
 OLD_FILES+=usr/share/nls/pt_BR.ISO8859-1/libc.cat
 OLD_FILES+=usr/share/nls/pt_PT.ISO8859-1/ee.cat
 OLD_FILES+=usr/share/nls/ru_RU.CP1251/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.CP866/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.ISO8859-5/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/ee.cat
-OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/grep.cat
 OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/libc.cat
 OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.UTF-8/tcsh.cat
@@ -6354,12 +6346,10 @@ OLD_FILES+=usr/share/nls/sv_SE.ISO8859-1/libc.cat
 OLD_FILES+=usr/share/nls/uk_UA.ISO8859-5/tcsh.cat
 OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat
 OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/tcsh.cat
-OLD_FILES+=usr/share/nls/uk_UA.UTF-8/grep.cat
 OLD_FILES+=usr/share/nls/uk_UA.UTF-8/libc.cat
 OLD_FILES+=usr/share/nls/uk_UA.UTF-8/tcsh.cat
 

svn commit: r334743 - releng/11.2/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 22:34:20 2018
New Revision: 334743
URL: https://svnweb.freebsd.org/changeset/base/334743

Log:
  MFstable/11 334732:
  
  Don't overflow a buffer if we receive an INIT or INIT-ACK chunk
  without a RANDOM parameter but with a CHUNKS or HMAC-ALGO parameter.
  Please note that sending this combination violates the specification.
  
  Thanks to Ronald E. Crane for reporting the issue for the userland
  stack.
  
  Approved by:  re (gjb@)

Modified:
  releng/11.2/sys/netinet/sctp_auth.c
  releng/11.2/sys/netinet/sctp_pcb.c
Directory Properties:
  releng/11.2/   (props changed)

Modified: releng/11.2/sys/netinet/sctp_auth.c
==
--- releng/11.2/sys/netinet/sctp_auth.c Wed Jun  6 22:29:21 2018
(r334742)
+++ releng/11.2/sys/netinet/sctp_auth.c Wed Jun  6 22:34:20 2018
(r334743)
@@ -1502,6 +1502,8 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str
if (p_random != NULL) {
keylen = sizeof(*p_random) + random_len;
memcpy(new_key->key, p_random, keylen);
+   } else {
+   keylen = 0;
}
/* append in the AUTH chunks */
if (chunks != NULL) {

Modified: releng/11.2/sys/netinet/sctp_pcb.c
==
--- releng/11.2/sys/netinet/sctp_pcb.c  Wed Jun  6 22:29:21 2018
(r334742)
+++ releng/11.2/sys/netinet/sctp_pcb.c  Wed Jun  6 22:34:20 2018
(r334743)
@@ -6702,6 +6702,8 @@ next_param:
if (p_random != NULL) {
keylen = sizeof(*p_random) + random_len;
memcpy(new_key->key, p_random, keylen);
+   } else {
+   keylen = 0;
}
/* append in the AUTH chunks */
if (chunks != NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334742 - stable/11/sys/fs/msdosfs

2018-06-06 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jun  6 22:29:21 2018
New Revision: 334742
URL: https://svnweb.freebsd.org/changeset/base/334742

Log:
  MFC r11:
  msdosfs: use vfs_timestamp() to generate timestamps instead of getnanotime().
  
  Most filesystems, with the notable exceptions of msdosfs and autofs use
  only vfs_timestamp() to read the current time. This has the benefit of
  configurable granularity (using the vfs.timestamp_precision sysctl).
  
  For convenience, use it on msdosfs too.
  
  Submitted by: Damjan Jovanovic

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_denode.c
  stable/11/sys/fs/msdosfs/msdosfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_denode.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_denode.c   Wed Jun  6 22:18:24 2018
(r334741)
+++ stable/11/sys/fs/msdosfs/msdosfs_denode.c   Wed Jun  6 22:29:21 2018
(r334742)
@@ -295,7 +295,7 @@ deupdat(struct denode *dep, int waitfor)
DE_MODIFIED);
return (0);
}
-   getnanotime();
+   vfs_timestamp();
DETIMES(dep, , , );
if ((dep->de_flag & DE_MODIFIED) == 0 && waitfor == 0)
return (0);

Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_vnops.cWed Jun  6 22:18:24 2018
(r334741)
+++ stable/11/sys/fs/msdosfs/msdosfs_vnops.cWed Jun  6 22:29:21 2018
(r334742)
@@ -176,7 +176,7 @@ msdosfs_create(struct vop_create_args *ap)
ndirent.de_FileSize = 0;
ndirent.de_pmp = pdep->de_pmp;
ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
-   getnanotime();
+   vfs_timestamp();
DETIMES(, , , );
error = createde(, pdep, , cnp);
if (error)
@@ -214,7 +214,7 @@ msdosfs_close(struct vop_close_args *ap)
 
VI_LOCK(vp);
if (vp->v_usecount > 1) {
-   getnanotime();
+   vfs_timestamp();
DETIMES(dep, , , );
}
VI_UNLOCK(vp);
@@ -264,7 +264,7 @@ msdosfs_getattr(struct vop_getattr_args *ap)
u_long dirsperblk = pmp->pm_BytesPerSec / sizeof(struct direntry);
uint64_t fileid;
 
-   getnanotime();
+   vfs_timestamp();
DETIMES(dep, , , );
vap->va_fsid = dev2udev(pmp->pm_dev);
/*
@@ -1327,7 +1327,7 @@ msdosfs_mkdir(struct vop_mkdir_args *ap)
bzero(, sizeof(ndirent));
ndirent.de_pmp = pmp;
ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
-   getnanotime();
+   vfs_timestamp();
DETIMES(, , , );
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334741 - stable/10/sys/fs/nfsserver

2018-06-06 Thread Rick Macklem
Author: rmacklem
Date: Wed Jun  6 22:18:24 2018
New Revision: 334741
URL: https://svnweb.freebsd.org/changeset/base/334741

Log:
  MFC: r333580
  Fix a slow leak of session structures in the NFSv4.1 server.
  
  For a fairly rare case of a client doing an ExchangeID after a hard reboot,
  the old confirmed clientid still exists, but some clients use a new
  co_verifier. For this case, the server was not freeing up the sessions on
  the old confirmed clientid.
  This patch fixes this case. It also adds two LIST_INIT() macros, which are
  actually no-ops, since the structure is malloc()d with M_ZERO so the pointer
  is already set to NULL.
  It should have minimal impact, since the only way I could exercise this
  code path was by doing a hard power cycle (pulling the plus) on a machine
  running Linux with a NFSv4.1 mount on the server.
  Originally spotted during testing of the ESXi 6.5 client.
  
  PR:   228497

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c  Wed Jun  6 22:02:44 2018
(r334740)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c  Wed Jun  6 22:18:24 2018
(r334741)
@@ -183,9 +183,10 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
 nfsquad_t *clientidp, nfsquad_t *confirmp, NFSPROC_T *p)
 {
struct nfsclient *clp = NULL, *new_clp = *new_clpp;
-   int i, error = 0;
+   int i, error = 0, ret;
struct nfsstate *stp, *tstp;
struct sockaddr_in *sad, *rad;
+   struct nfsdsession *sep, *nsep;
int zapit = 0, gotit, hasstate = 0, igotlock;
static u_int64_t confirm_index = 0;
 
@@ -355,6 +356,15 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
 * can be thrown away once the SETCLIENTID_CONFIRM occurs.
 */
LIST_REMOVE(clp, lc_hash);
+
+   /* Get rid of all sessions on this clientid. */
+   LIST_FOREACH_SAFE(sep, >lc_session, sess_list, nsep) {
+   ret = nfsrv_freesession(sep, NULL);
+   if (ret != 0)
+   printf("nfsrv_setclient: verifier changed free"
+   " session failed=%d\n", ret);
+   }
+
new_clp->lc_flags |= LCL_NEEDSCONFIRM;
if ((nd->nd_flag & ND_NFSV41) != 0)
new_clp->lc_confirm.lval[0] = confirmp->lval[0] =
@@ -390,6 +400,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
LIST_FOREACH(tstp, _clp->lc_stateid[i], ls_hash)
tstp->ls_clp = new_clp;
}
+   LIST_INIT(_clp->lc_session);
LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
lc_hash);
newnfsstats.srvclients++;
@@ -454,6 +465,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
LIST_FOREACH(tstp, _clp->lc_stateid[i], ls_hash)
tstp->ls_clp = new_clp;
}
+   LIST_INIT(_clp->lc_session);
LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
lc_hash);
newnfsstats.srvclients++;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334739 - stable/11/sys/fs/nfsserver

2018-06-06 Thread Rick Macklem
Author: rmacklem
Date: Wed Jun  6 22:02:20 2018
New Revision: 334739
URL: https://svnweb.freebsd.org/changeset/base/334739

Log:
  MFC: r333580
  Fix a slow leak of session structures in the NFSv4.1 server.
  
  For a fairly rare case of a client doing an ExchangeID after a hard reboot,
  the old confirmed clientid still exists, but some clients use a new
  co_verifier. For this case, the server was not freeing up the sessions on
  the old confirmed clientid.
  This patch fixes this case. It also adds two LIST_INIT() macros, which are
  actually no-ops, since the structure is malloc()d with M_ZERO so the pointer
  is already set to NULL.
  It should have minimal impact, since the only way I could exercise this
  code path was by doing a hard power cycle (pulling the plus) on a machine
  running Linux with a NFSv4.1 mount on the server.
  Originally spotted during testing of the ESXi 6.5 client.
  
  PR:   228497

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdstate.c  Wed Jun  6 21:32:49 2018
(r334738)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdstate.c  Wed Jun  6 22:02:20 2018
(r334739)
@@ -178,9 +178,10 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
 nfsquad_t *clientidp, nfsquad_t *confirmp, NFSPROC_T *p)
 {
struct nfsclient *clp = NULL, *new_clp = *new_clpp;
-   int i, error = 0;
+   int i, error = 0, ret;
struct nfsstate *stp, *tstp;
struct sockaddr_in *sad, *rad;
+   struct nfsdsession *sep, *nsep;
int zapit = 0, gotit, hasstate = 0, igotlock;
static u_int64_t confirm_index = 0;
 
@@ -350,6 +351,15 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
 * can be thrown away once the SETCLIENTID_CONFIRM occurs.
 */
LIST_REMOVE(clp, lc_hash);
+
+   /* Get rid of all sessions on this clientid. */
+   LIST_FOREACH_SAFE(sep, >lc_session, sess_list, nsep) {
+   ret = nfsrv_freesession(sep, NULL);
+   if (ret != 0)
+   printf("nfsrv_setclient: verifier changed free"
+   " session failed=%d\n", ret);
+   }
+
new_clp->lc_flags |= LCL_NEEDSCONFIRM;
if ((nd->nd_flag & ND_NFSV41) != 0)
new_clp->lc_confirm.lval[0] = confirmp->lval[0] =
@@ -385,6 +395,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
LIST_FOREACH(tstp, _clp->lc_stateid[i], ls_hash)
tstp->ls_clp = new_clp;
}
+   LIST_INIT(_clp->lc_session);
LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
lc_hash);
nfsstatsv1.srvclients++;
@@ -449,6 +460,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsc
LIST_FOREACH(tstp, _clp->lc_stateid[i], ls_hash)
tstp->ls_clp = new_clp;
}
+   LIST_INIT(_clp->lc_session);
LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
lc_hash);
nfsstatsv1.srvclients++;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334740 - releng/11.2/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 22:02:44 2018
New Revision: 334740
URL: https://svnweb.freebsd.org/changeset/base/334740

Log:
  MFstable/11 334731
  
  Limit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX.
  
  Use the same logic to handle the SYN-ACK retransmission when sent from
  the syn cache code as when sent from the main code.
  
  Approved by:  re (gjb@)
  Sponsored by: Netflix, Inc.

Modified:
  releng/11.2/sys/netinet/tcp_syncache.c
Directory Properties:
  releng/11.2/   (props changed)

Modified: releng/11.2/sys/netinet/tcp_syncache.c
==
--- releng/11.2/sys/netinet/tcp_syncache.c  Wed Jun  6 22:02:20 2018
(r334739)
+++ releng/11.2/sys/netinet/tcp_syncache.c  Wed Jun  6 22:02:44 2018
(r334740)
@@ -407,8 +407,14 @@ syncache_drop(struct syncache *sc, struct syncache_hea
 static void
 syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout)
 {
-   sc->sc_rxttime = ticks +
-   TCPTV_RTOBASE * (tcp_syn_backoff[sc->sc_rxmits]);
+   int rexmt;
+
+   if (sc->sc_rxmits == 0)
+   rexmt = TCPTV_RTOBASE;
+   else
+   TCPT_RANGESET(rexmt, TCPTV_RTOBASE * 
tcp_syn_backoff[sc->sc_rxmits],
+   tcp_rexmit_min, TCPTV_REXMTMAX);
+   sc->sc_rxttime = ticks + rexmt;
sc->sc_rxmits++;
if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) {
sch->sch_nextc = sc->sc_rxttime;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334738 - head/lib/libc/string

2018-06-06 Thread Conrad Meyer
Author: cem
Date: Wed Jun  6 21:32:49 2018
New Revision: 334738
URL: https://svnweb.freebsd.org/changeset/base/334738

Log:
  strdup.3: Document standardization in POSIX
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/string/strdup.3

Modified: head/lib/libc/string/strdup.3
==
--- head/lib/libc/string/strdup.3   Wed Jun  6 21:23:42 2018
(r334737)
+++ head/lib/libc/string/strdup.3   Wed Jun  6 21:32:49 2018
(r334738)
@@ -28,7 +28,7 @@
 .\" @(#)strdup.3   8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd December 5, 2008
+.Dd June 6, 2018
 .Dt STRDUP 3
 .Os
 .Sh NAME
@@ -73,6 +73,15 @@ terminating the copied string.
 .Xr free 3 ,
 .Xr malloc 3 ,
 .Xr wcsdup 3
+.Sh STANDARDS
+The
+.Fn strdup
+function is specified by
+.St -p1003.1-2001 .
+The
+.Fn strndup
+function is specified by
+.St -p1003.1-2008 .
 .Sh HISTORY
 The
 .Fn strdup
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334737 - releng/11.2/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 21:23:42 2018
New Revision: 334737
URL: https://svnweb.freebsd.org/changeset/base/334737

Log:
  MFstable/11 r334730
  
  Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.
  
  If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1,
  the array tcp_syn_backoff[] is accessed out of bounds.
  
  Discussed with:   jtl@
  Approved by:  re (gjb)
  Sponsored by: Netflix, Inc.

Modified:
  releng/11.2/sys/netinet/tcp_syncache.c
Directory Properties:
  releng/11.2/   (props changed)

Modified: releng/11.2/sys/netinet/tcp_syncache.c
==
--- releng/11.2/sys/netinet/tcp_syncache.c  Wed Jun  6 20:32:39 2018
(r334736)
+++ releng/11.2/sys/netinet/tcp_syncache.c  Wed Jun  6 21:23:42 2018
(r334737)
@@ -175,8 +175,27 @@ SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, hashsize
 _NAME(tcp_syncache.hashsize), 0,
 "Size of TCP syncache hashtable");
 
-SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit, CTLFLAG_VNET | 
CTLFLAG_RW,
+static int
+sysctl_net_inet_tcp_syncache_rexmtlimit_check(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+   u_int new;
+
+   new = V_tcp_syncache.rexmt_limit;
+   error = sysctl_handle_int(oidp, , 0, req);
+   if ((error == 0) && (req->newptr != NULL)) {
+   if (new > TCP_MAXRXTSHIFT)
+   error = EINVAL;
+   else
+   V_tcp_syncache.rexmt_limit = new;
+   }
+   return (error);
+}
+
+SYSCTL_PROC(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit,
+CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW,
 _NAME(tcp_syncache.rexmt_limit), 0,
+sysctl_net_inet_tcp_syncache_rexmtlimit_check, "UI",
 "Limit on SYN/ACK retransmissions");
 
 VNET_DEFINE(int, tcp_sc_rst_sock_fail) = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Rodney W. Grimes


> On Wed, Jun 6, 2018, at 12:33 PM, Rodney W. Grimes wrote:
> > > 
> > > On Tue, Jun 5, 2018, at 1:28 PM, Konstantin Belousov wrote:
> > > > On Wed, Jun 06, 2018 at 01:39:00AM +0700, Eugene Grosbein wrote:
> > > > > 06.06.2018 1:26, Konstantin Belousov wrote:
> > > > >
> > > > > >>> I find it often very useful to do
> > > > > >>>  (cd src/etc/rc.d && make install)
> > > > > >>> Same for defaults and several other directories which in fact
> > > > > >>> contains> > >>> non-editable content.  Is this planned to keep 
> > > > > >>> working ?
> > > > > >>
> > > > > >> The short answer is, no.  All rc.d scripts get moved to the src
> > > > > >> of the program they start.> > >>
> > > > > >> That said, if there is a big need for this, we can see about
> > > > > >> options to keep them working.> > >>
> > > > > >> What are you trying to accomplish when you do this?  Just verify
> > > > > >> the rc.d scripts match your src tree?> > >
> > > > > > I avoid mergemaster/etcupdate and whatever else. rc.d and /etc/rc,> 
> > > > > > > > /etc/rc.subr /etc/rc.network are not suitable to etc, they are
> > > > > > binaries> > > provided by the project not for the user editing.
> > > > > >
> > > > > > When upgrading the host, esp. on HEAD, i usually refresh scripts
> > > > > > by this> > > procedure and avoid any editing and implied conflict 
> > > > > > resolution
> > > > > > for real> > > configs.
> > > > > >
> > > > > > Not being able to easily install clean copies of these scripts
> > > > > > would> > > be very inconvenient and time consuming.
> > > > >
> > > > > I found that "mergemaster -iFUP" deals with unchanged files
> > > > > including mentioned rc* scripts just fine.> > That is, it 
> > > > > automatically refreshes unchanged files without any
> > > > > silly questions just for change of $FreeBSD$.>
> > > > No, you missed the point.  Whatever nice is the handling of
> > > > unchanged files,> use of mergemaster forces me to handle changed files, 
> > > > which is exactly> what I do not want/need to do.  Yes, I update 
> > > > crashboxes very
> > > > often, and> I want to get all new code, including the startup scripts, 
> > > > when
> > > > I update.
> > > The startup scripts will be installed as part of installworld.
> > 
> > So each installworld would wipe over the top of any localmod /etc/rc.d/ 
> > and other stuff
> > that mght exist?
> > One of the reasons that etc/Makefile is detached from Installword is so 
> > that
> > /etc does not get perturbuted unless specifically requested.
> 
> Yes, this is by design.

This is going to have a great amount of push back, and this is by your NEW 
design,
the existing design does not cause this pain.

> 
> If people need custom tweaks for that stuff they should be upstreamed or 
> moved into /usr/local/etc/rc.d as a custom startup script.

I doubt very much this is a practical solution.  I have changes that I doubt
belong in FreeBSD, and are not restricted to etc/rc.d.   And from reading
this thread thus far so do others.


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


svn commit: r334736 - releng/11.2/release/doc/en_US.ISO8859-1/relnotes

2018-06-06 Thread Glen Barber
Author: gjb
Date: Wed Jun  6 20:32:39 2018
New Revision: 334736
URL: https://svnweb.freebsd.org/changeset/base/334736

Log:
  Remove the r333006 entry following r334735.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/11.2/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: releng/11.2/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- releng/11.2/release/doc/en_US.ISO8859-1/relnotes/article.xmlWed Jun 
 6 20:31:15 2018(r334735)
+++ releng/11.2/release/doc/en_US.ISO8859-1/relnotes/article.xmlWed Jun 
 6 20:32:39 2018(r334736)
@@ -805,14 +805,6 @@
addresses a boot issue from a GPT partition
scheme in non-UEFI mode.
 
-  The
-installation ISO medium creation tools
-   have been updated to generate hybrid images for ,
-   supporting both BIOS and
-   EFI.  The ISO image can
-   now be written to a memory stick as well as being used as
-   a CD image.
-
   The
 memory stick image installers have been changed
to use the MBR partitioning scheme, which
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334735 - releng/11.2/release/amd64

2018-06-06 Thread Glen Barber
Author: gjb
Date: Wed Jun  6 20:31:15 2018
New Revision: 334735
URL: https://svnweb.freebsd.org/changeset/base/334735

Log:
  Revert r333006:
  
   This revision implemented hybrid ISOs for the amd64
   architecture, however it was discovered to have caused
   a regression in booting legacy-mode (BIOS/CSM).
  
   This restores the way ISOs were previously created, as
   the cause (and differences between head and stable/11
   and releng/11.2) have not been entirely identified.
  
  Approved by:  re (marius)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/11.2/release/amd64/mkisoimages.sh

Modified: releng/11.2/release/amd64/mkisoimages.sh
==
--- releng/11.2/release/amd64/mkisoimages.shWed Jun  6 20:28:17 2018
(r334734)
+++ releng/11.2/release/amd64/mkisoimages.shWed Jun  6 20:31:15 2018
(r334735)
@@ -23,18 +23,6 @@
 # extra-bits-dir, if provided, contains additional files to be merged
 # into base-bits-dir as part of making the image.
 
-if [ -z $ETDUMP ]; then
-   ETDUMP=etdump
-fi
-
-if [ -z $MAKEFS ]; then
-   MAKEFS=makefs
-fi
-
-if [ -z $MKIMG ]; then
-   MKIMG=mkimg
-fi
-
 if [ "x$1" = "x-b" ]; then
# This is highly x86-centric and will be used directly below.
bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
@@ -50,7 +38,7 @@ if [ "x$1" = "x-b" ]; then
umount efi
rmdir efi
mdconfig -d -u $device
-   bootable="$bootable -o bootimage=i386;efiboot.img -o no-emul-boot -o 
platformid=efi"
+   bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable"

shift
 else
@@ -67,32 +55,6 @@ NAME="$1"; shift
 
 publisher="The FreeBSD Project.  http://www.FreeBSD.org/;
 echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
-$MAKEFS -t cd9660 $bootable -o rockridge -o label="$LABEL" -o 
publisher="$publisher" "$NAME" "$@"
+makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o 
publisher="$publisher" "$NAME" "$@"
 rm -f "$1/etc/fstab"
 rm -f efiboot.img
-
-if [ "$bootable" != "" ]; then
-   # Look for the EFI System Partition image we dropped in the ISO image.
-   for entry in `$ETDUMP --format shell $NAME`; do
-   eval $entry
-   if [ "$et_platform" = "efi" ]; then
-   espstart=`expr $et_lba \* 2048`
-   espsize=`expr $et_sectors \* 512`
-   espparam="-p efi::$espsize:$espstart"
-   break
-   fi
-   done
-
-   # Create a GPT image containing the partitions we need for hybrid boot.
-   imgsize=`stat -f %z $NAME`
-   $MKIMG -s gpt \
-   --capacity $imgsize \
-   -b $4/boot/pmbr \
-   $espparam \
-   -p freebsd-boot:=$4/boot/isoboot \
-   -o hybrid.img
-
-   # Drop the PMBR, GPT, and boot code into the System Area of the ISO.
-   dd if=hybrid.img of=$NAME bs=32k count=1 conv=notrunc
-   rm -f hybrid.img
-fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334734 - releng/11.2/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 20:28:17 2018
New Revision: 334734
URL: https://svnweb.freebsd.org/changeset/base/334734

Log:
  MFstable/11 r334728:
  
  Ensure we are not dereferencing a NULL pointer.
  
  CID:  1385266
  Approved by: re (marius@)

Modified:
  releng/11.2/sys/netinet/sctp_indata.c
Directory Properties:
  releng/11.2/   (props changed)

Modified: releng/11.2/sys/netinet/sctp_indata.c
==
--- releng/11.2/sys/netinet/sctp_indata.c   Wed Jun  6 20:09:21 2018
(r334733)
+++ releng/11.2/sys/netinet/sctp_indata.c   Wed Jun  6 20:28:17 2018
(r334734)
@@ -3619,7 +3619,9 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
SCTP_SO_NOT_LOCKED);
}
/* Make sure to flag we had a FR */
-   tp1->whoTo->net_ack++;
+   if (tp1->whoTo != NULL) {
+   tp1->whoTo->net_ack++;
+   }
continue;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Konstantin Belousov
On Wed, Jun 06, 2018 at 02:06:48PM -0600, Ian Lepore wrote:
> On Wed, 2018-06-06 at 11:33 -0700, Rodney W. Grimes wrote:
> > > 
> > > 
> > > On Tue, Jun 5, 2018, at 1:28 PM, Konstantin Belousov wrote:
> > > > 
> > > > On Wed, Jun 06, 2018 at 01:39:00AM +0700, Eugene Grosbein wrote:
> > > > > 
> > > > > 06.06.2018 1:26, Konstantin Belousov wrote:
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > > 
> > > > > > > > I find it often very useful to do
> > > > > > > >  (cd src/etc/rc.d && make install)
> > > > > > > > Same for defaults and several other directories which in
> > > > > > > > fact
> > > > > > > > contains> > >>> non-editable content.  Is this planned to
> > > > > > > > keep working ?
> > > > > > > The short answer is, no.  All rc.d scripts get moved to the
> > > > > > > src
> > > > > > > of the program they start.> > >>
> > > > > > > That said, if there is a big need for this, we can see
> > > > > > > about
> > > > > > > options to keep them working.> > >>
> > > > > > > What are you trying to accomplish when you do this?  Just
> > > > > > > verify
> > > > > > > the rc.d scripts match your src tree?> > >
> > > > > > I avoid mergemaster/etcupdate and whatever else. rc.d and
> > > > > > /etc/rc,> > > /etc/rc.subr /etc/rc.network are not suitable
> > > > > > to etc, they are
> > > > > > binaries> > > provided by the project not for the user
> > > > > > editing.
> > > > > > 
> > > > > > When upgrading the host, esp. on HEAD, i usually refresh
> > > > > > scripts
> > > > > > by this> > > procedure and avoid any editing and implied
> > > > > > conflict resolution
> > > > > > for real> > > configs.
> > > > > > 
> > > > > > Not being able to easily install clean copies of these
> > > > > > scripts
> > > > > > would> > > be very inconvenient and time consuming.
> > > > > I found that "mergemaster -iFUP" deals with unchanged files
> > > > > including mentioned rc* scripts just fine.> > That is, it
> > > > > automatically refreshes unchanged files without any
> > > > > silly questions just for change of $FreeBSD$.>
> > > > No, you missed the point.  Whatever nice is the handling of
> > > > unchanged files,> use of mergemaster forces me to handle changed
> > > > files, which is exactly> what I do not want/need to do.  Yes, I
> > > > update crashboxes very
> > > > often, and> I want to get all new code, including the startup
> > > > scripts, when
> > > > I update.
> > > The startup scripts will be installed as part of installworld.
> > So each installworld would wipe over the top of any localmod
> > /etc/rc.d/ and other stuff
> > that mght exist?
> > One of the reasons that etc/Makefile is detached from Installword is
> > so that
> > /etc does not get perturbuted unless specifically requested.
> > 
> 
> I don't understand the drama over this.  rc.d startup scripts are
> *binaries*. Users are not expected to modify the system installed
> binaries, and if they do, it is expected that the next installworld
> will replace them with the system binaries again.

I agree with this, but the scripts are installed into /etc.

I proposed to move them somewhere, e.g. to /sbin/rc* or to /libexec/rc*.
If moved first, then the proposed change would be much more logical and
probably easier to fit into the workflows of FreeBSD consumers.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334733 - head/lib/libc/string

2018-06-06 Thread Conrad Meyer
Author: cem
Date: Wed Jun  6 20:09:21 2018
New Revision: 334733
URL: https://svnweb.freebsd.org/changeset/base/334733

Log:
  strcpy.3: Improve legibility and clarity
  
  In the DESCRIPTION, put the more commonly used functions first in the
  corresponding sentence, to help catch the eye.
  
  Pull out the note about overlapping buffers to its own paragraph, as it
  applies to all routines documented by this page.
  
  Emphasize the potentially surprising strncpy(3) behavior of zero-filling the
  remainder of a buffer larger than the source string.
  
  Encourage strlcpy use; remove portability note about strlcpy(3).  Adapting a
  strlcpy-using code base to a platform that does not provide strlcpy in libc
  is so trivial as to not be worth mentioning.  (Just copy strlcpy.c out of
  any BSD libc, or include and link the pre-packaged libbsd library on non-BSD
  platforms.)
  
  Likewise, expand the page's warning about ease of potential misuse to cover
  all functions documented herein, and explicitly suggest using strlcpy most
  of the time.  The text was mostly cribbed from a similar suggestion in
  gets(3).
  
  Finally, document the remaining valid use of strncpy -- the rare
  fixed-length record with no expectation of nul-termination.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/string/strcpy.3

Modified: head/lib/libc/string/strcpy.3
==
--- head/lib/libc/string/strcpy.3   Wed Jun  6 20:03:35 2018
(r334732)
+++ head/lib/libc/string/strcpy.3   Wed Jun  6 20:09:21 2018
(r334733)
@@ -32,7 +32,7 @@
 .\" @(#)strcpy.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2009
+.Dd June 6, 2018
 .Dt STRCPY 3
 .Os
 .Sh NAME
@@ -55,9 +55,9 @@
 .Fn strncpy "char * restrict dst" "const char * restrict src" "size_t len"
 .Sh DESCRIPTION
 The
-.Fn stpcpy
-and
 .Fn strcpy
+and
+.Fn stpcpy
 functions
 copy the string
 .Fa src
@@ -66,22 +66,18 @@ to
 (including the terminating
 .Ql \e0
 character.)
-If
-.Fa src
-and
-.Fa dst
-overlap, the results are undefined.
 .Pp
 The
-.Fn stpncpy
-and
 .Fn strncpy
+and
+.Fn stpncpy
 functions copy at most
 .Fa len
 characters from
 .Fa src
 into
 .Fa dst .
+.Bf Sy
 If
 .Fa src
 is less than
@@ -92,16 +88,25 @@ the remainder of
 is filled with
 .Ql \e0
 characters.
+.Ef
 Otherwise,
 .Fa dst
 is
 .Em not
 terminated.
-If
+.Pp
+For all of
+.Fn strcpy ,
+.Fn strncpy ,
+.Fn stpcpy ,
+and
+.Fn stpncpy ,
+the result is undefined
+if
 .Fa src
 and
 .Fa dst
-overlap, the results are undefined.
+overlap.
 .Sh RETURN VALUES
 The
 .Fn strcpy
@@ -182,11 +187,6 @@ This could be better achieved using
 as shown in the following example:
 .Pp
 .Dl "(void)strlcpy(buf, input, sizeof(buf));"
-.Pp
-Note that because
-.Xr strlcpy 3
-is not defined in any standards, it should
-only be used when portability is not a concern.
 .Sh SEE ALSO
 .Xr bcopy 3 ,
 .Xr memccpy 3 ,
@@ -218,8 +218,16 @@ and
 was added in
 .Fx 8.0 .
 .Sh SECURITY CONSIDERATIONS
-The
-.Fn strcpy
-function is easily misused in a manner which enables malicious users
-to arbitrarily change a running program's functionality through a
-buffer overflow attack.
+All of the functions documented in this manual page are easily misused in a
+manner which enables malicious users to arbitrarily change a running program's
+functionality through a buffer overflow attack.
+.Pp
+It is strongly suggested that the
+.Fn strlcpy
+function be used in almost all cases.
+.Pp
+For some, but not all, fixed-length records, non-terminated strings may be both
+valid and desirable.
+In that specific case, the
+.Fn strncpy
+function may be most sensible.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Ian Lepore
On Wed, 2018-06-06 at 11:33 -0700, Rodney W. Grimes wrote:
> > 
> > 
> > On Tue, Jun 5, 2018, at 1:28 PM, Konstantin Belousov wrote:
> > > 
> > > On Wed, Jun 06, 2018 at 01:39:00AM +0700, Eugene Grosbein wrote:
> > > > 
> > > > 06.06.2018 1:26, Konstantin Belousov wrote:
> > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > I find it often very useful to do
> > > > > > >  (cd src/etc/rc.d && make install)
> > > > > > > Same for defaults and several other directories which in
> > > > > > > fact
> > > > > > > contains> > >>> non-editable content.  Is this planned to
> > > > > > > keep working ?
> > > > > > The short answer is, no.  All rc.d scripts get moved to the
> > > > > > src
> > > > > > of the program they start.> > >>
> > > > > > That said, if there is a big need for this, we can see
> > > > > > about
> > > > > > options to keep them working.> > >>
> > > > > > What are you trying to accomplish when you do this?  Just
> > > > > > verify
> > > > > > the rc.d scripts match your src tree?> > >
> > > > > I avoid mergemaster/etcupdate and whatever else. rc.d and
> > > > > /etc/rc,> > > /etc/rc.subr /etc/rc.network are not suitable
> > > > > to etc, they are
> > > > > binaries> > > provided by the project not for the user
> > > > > editing.
> > > > > 
> > > > > When upgrading the host, esp. on HEAD, i usually refresh
> > > > > scripts
> > > > > by this> > > procedure and avoid any editing and implied
> > > > > conflict resolution
> > > > > for real> > > configs.
> > > > > 
> > > > > Not being able to easily install clean copies of these
> > > > > scripts
> > > > > would> > > be very inconvenient and time consuming.
> > > > I found that "mergemaster -iFUP" deals with unchanged files
> > > > including mentioned rc* scripts just fine.> > That is, it
> > > > automatically refreshes unchanged files without any
> > > > silly questions just for change of $FreeBSD$.>
> > > No, you missed the point.  Whatever nice is the handling of
> > > unchanged files,> use of mergemaster forces me to handle changed
> > > files, which is exactly> what I do not want/need to do.  Yes, I
> > > update crashboxes very
> > > often, and> I want to get all new code, including the startup
> > > scripts, when
> > > I update.
> > The startup scripts will be installed as part of installworld.
> So each installworld would wipe over the top of any localmod
> /etc/rc.d/ and other stuff
> that mght exist?
> One of the reasons that etc/Makefile is detached from Installword is
> so that
> /etc does not get perturbuted unless specifically requested.
> 

I don't understand the drama over this.  rc.d startup scripts are
*binaries*. Users are not expected to modify the system installed
binaries, and if they do, it is expected that the next installworld
will replace them with the system binaries again.

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


svn commit: r334732 - stable/11/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 20:03:35 2018
New Revision: 334732
URL: https://svnweb.freebsd.org/changeset/base/334732

Log:
  MFC r334532:
  
  Don't overflow a buffer if we receive an INIT or INIT-ACK chunk
  without a RANDOM parameter but with a CHUNKS or HMAC-ALGO parameter.
  Please note that sending this combination violates the specification.
  
  Thanks to Ronald E. Crane for reporting the issue for the userland
  stack.

Modified:
  stable/11/sys/netinet/sctp_auth.c
  stable/11/sys/netinet/sctp_pcb.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/sctp_auth.c
==
--- stable/11/sys/netinet/sctp_auth.c   Wed Jun  6 20:02:05 2018
(r334731)
+++ stable/11/sys/netinet/sctp_auth.c   Wed Jun  6 20:03:35 2018
(r334732)
@@ -1502,6 +1502,8 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str
if (p_random != NULL) {
keylen = sizeof(*p_random) + random_len;
memcpy(new_key->key, p_random, keylen);
+   } else {
+   keylen = 0;
}
/* append in the AUTH chunks */
if (chunks != NULL) {

Modified: stable/11/sys/netinet/sctp_pcb.c
==
--- stable/11/sys/netinet/sctp_pcb.cWed Jun  6 20:02:05 2018
(r334731)
+++ stable/11/sys/netinet/sctp_pcb.cWed Jun  6 20:03:35 2018
(r334732)
@@ -6702,6 +6702,8 @@ next_param:
if (p_random != NULL) {
keylen = sizeof(*p_random) + random_len;
memcpy(new_key->key, p_random, keylen);
+   } else {
+   keylen = 0;
}
/* append in the AUTH chunks */
if (chunks != NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334731 - stable/11/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 20:02:05 2018
New Revision: 334731
URL: https://svnweb.freebsd.org/changeset/base/334731

Log:
  MFC r334497:
  
  Limit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX.
  
  Use the same logic to handle the SYN-ACK retransmission when sent from
  the syn cache code as when sent from the main code.
  
  Sponsored by: Netflix, Inc.

Modified:
  stable/11/sys/netinet/tcp_syncache.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_syncache.c
==
--- stable/11/sys/netinet/tcp_syncache.cWed Jun  6 20:00:21 2018
(r334730)
+++ stable/11/sys/netinet/tcp_syncache.cWed Jun  6 20:02:05 2018
(r334731)
@@ -407,8 +407,14 @@ syncache_drop(struct syncache *sc, struct syncache_hea
 static void
 syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout)
 {
-   sc->sc_rxttime = ticks +
-   TCPTV_RTOBASE * (tcp_syn_backoff[sc->sc_rxmits]);
+   int rexmt;
+
+   if (sc->sc_rxmits == 0)
+   rexmt = TCPTV_RTOBASE;
+   else
+   TCPT_RANGESET(rexmt, TCPTV_RTOBASE * 
tcp_syn_backoff[sc->sc_rxmits],
+   tcp_rexmit_min, TCPTV_REXMTMAX);
+   sc->sc_rxttime = ticks + rexmt;
sc->sc_rxmits++;
if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) {
sch->sch_nextc = sc->sc_rxttime;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334730 - stable/11/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 20:00:21 2018
New Revision: 334730
URL: https://svnweb.freebsd.org/changeset/base/334730

Log:
  MFC r334494:
  
  Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.
  
  If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1,
  the array tcp_syn_backoff[] is accessed out of bounds.
  
  Discussed with:   jtl@
  Sponsored by: Netflix, Inc.

Modified:
  stable/11/sys/netinet/tcp_syncache.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_syncache.c
==
--- stable/11/sys/netinet/tcp_syncache.cWed Jun  6 19:56:19 2018
(r334729)
+++ stable/11/sys/netinet/tcp_syncache.cWed Jun  6 20:00:21 2018
(r334730)
@@ -175,8 +175,27 @@ SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, hashsize
 _NAME(tcp_syncache.hashsize), 0,
 "Size of TCP syncache hashtable");
 
-SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit, CTLFLAG_VNET | 
CTLFLAG_RW,
+static int
+sysctl_net_inet_tcp_syncache_rexmtlimit_check(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+   u_int new;
+
+   new = V_tcp_syncache.rexmt_limit;
+   error = sysctl_handle_int(oidp, , 0, req);
+   if ((error == 0) && (req->newptr != NULL)) {
+   if (new > TCP_MAXRXTSHIFT)
+   error = EINVAL;
+   else
+   V_tcp_syncache.rexmt_limit = new;
+   }
+   return (error);
+}
+
+SYSCTL_PROC(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit,
+CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW,
 _NAME(tcp_syncache.rexmt_limit), 0,
+sysctl_net_inet_tcp_syncache_rexmtlimit_check, "UI",
 "Limit on SYN/ACK retransmissions");
 
 VNET_DEFINE(int, tcp_sc_rst_sock_fail) = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334729 - stable/11/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 19:56:19 2018
New Revision: 334729
URL: https://svnweb.freebsd.org/changeset/base/334729

Log:
  MFC r333603:
  
  Ensure that the MTU's used are multiple of 4.
  
  The length of SCTP packets is always a multiple of 4. Therefore,
  ensure that the MTUs used are also a multiple of 4.
  
  Thanks to Irene Ruengeler for providing an earlier version of this
  patch.
  
  MFC r334286:
  
  Use correct mask.
  Introduced in https://svnweb.freebsd.org/changeset/base/333603.
  Thanks to Irene Ruengler for testing and reporting the issue.

Modified:
  stable/11/sys/netinet/sctputil.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/sctputil.c
==
--- stable/11/sys/netinet/sctputil.cWed Jun  6 19:51:55 2018
(r334728)
+++ stable/11/sys/netinet/sctputil.cWed Jun  6 19:56:19 2018
(r334729)
@@ -756,8 +756,8 @@ sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb)
 }
 
 /*
- * a list of sizes based on typical mtu's, used only if next hop size not
- * returned.
+ * A list of sizes based on typical mtu's, used only if next hop size not
+ * returned. These values MUST be multiples of 4 and MUST be ordered.
  */
 static uint32_t sctp_mtu_sizes[] = {
68,
@@ -766,29 +766,32 @@ static uint32_t sctp_mtu_sizes[] = {
512,
544,
576,
-   1006,
+   1004,
1492,
1500,
1536,
-   2002,
+   2000,
2048,
4352,
4464,
8166,
-   17914,
+   17912,
32000,
-   65535
+   65532
 };
 
 /*
- * Return the largest MTU smaller than val. If there is no
- * entry, just return val.
+ * Return the largest MTU in sctp_mtu_sizes smaller than val.
+ * If val is smaller than the minimum, just return the largest
+ * multiple of 4 smaller or equal to val.
+ * Ensure that the result is a multiple of 4.
  */
 uint32_t
 sctp_get_prev_mtu(uint32_t val)
 {
uint32_t i;
 
+   val &= 0xfffc;
if (val <= sctp_mtu_sizes[0]) {
return (val);
}
@@ -797,12 +800,16 @@ sctp_get_prev_mtu(uint32_t val)
break;
}
}
+   KASSERT((sctp_mtu_sizes[i - 1] & 0x0003) == 0,
+   ("sctp_mtu_sizes[%u] not a multiple of 4", i - 1));
return (sctp_mtu_sizes[i - 1]);
 }
 
 /*
- * Return the smallest MTU larger than val. If there is no
- * entry, just return val.
+ * Return the smallest MTU in sctp_mtu_sizes larger than val.
+ * If val is larger than the maximum, just return the largest multiple of 4 
smaller
+ * or equal to val.
+ * Ensure that the result is a multiple of 4.
  */
 uint32_t
 sctp_get_next_mtu(uint32_t val)
@@ -810,8 +817,11 @@ sctp_get_next_mtu(uint32_t val)
/* select another MTU that is just bigger than this one */
uint32_t i;
 
+   val &= 0xfffc;
for (i = 0; i < (sizeof(sctp_mtu_sizes) / sizeof(uint32_t)); i++) {
if (val < sctp_mtu_sizes[i]) {
+   KASSERT((sctp_mtu_sizes[i] & 0x0003) == 0,
+   ("sctp_mtu_sizes[%u] not a multiple of 4", i));
return (sctp_mtu_sizes[i]);
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334728 - stable/11/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 19:51:55 2018
New Revision: 334728
URL: https://svnweb.freebsd.org/changeset/base/334728

Log:
  MFC r04:
  
  Ensure we are not dereferencing a NULL pointer.
  
  CID:  1385266

Modified:
  stable/11/sys/netinet/sctp_indata.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/sctp_indata.c
==
--- stable/11/sys/netinet/sctp_indata.c Wed Jun  6 19:48:39 2018
(r334727)
+++ stable/11/sys/netinet/sctp_indata.c Wed Jun  6 19:51:55 2018
(r334728)
@@ -3619,7 +3619,9 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
SCTP_SO_NOT_LOCKED);
}
/* Make sure to flag we had a FR */
-   tp1->whoTo->net_ack++;
+   if (tp1->whoTo != NULL) {
+   tp1->whoTo->net_ack++;
+   }
continue;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334727 - stable/11/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 19:48:39 2018
New Revision: 334727
URL: https://svnweb.freebsd.org/changeset/base/334727

Log:
  MFC r333178:
  
  Simplify the call to tcp_drop(), since the handling of soft error
  is also done in tcp_drop(). No functional change.
  
  Sponsored by: Netflix, Inc.

Modified:
  stable/11/sys/netinet/tcp_timer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_timer.c
==
--- stable/11/sys/netinet/tcp_timer.c   Wed Jun  6 19:36:37 2018
(r334726)
+++ stable/11/sys/netinet/tcp_timer.c   Wed Jun  6 19:48:39 2018
(r334727)
@@ -619,8 +619,7 @@ tcp_timer_rexmt(void * xtp)
tp->t_rxtshift = TCP_MAXRXTSHIFT;
TCPSTAT_INC(tcps_timeoutdrop);
 
-   tp = tcp_drop(tp, tp->t_softerror ?
- tp->t_softerror : ETIMEDOUT);
+   tp = tcp_drop(tp, ETIMEDOUT);
headlocked = 1;
goto out;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334726 - in head: etc/rc.d sbin/pfctl

2018-06-06 Thread Kristof Provost
Author: kp
Date: Wed Jun  6 19:36:37 2018
New Revision: 334726
URL: https://svnweb.freebsd.org/changeset/base/334726

Log:
  pf: Return non-zero from 'status' if pf is not enabled
  
  In the pf rc.d script the output of `/etc/rc.d/pf status` or `/etc/rc.d/pf
  onestatus` always provided an exit status of zero. This made it fiddly to
  programmatically determine if pf was running or not.
  
  Return a non-zero status if the pf module is not loaded, extend pfctl to have
  an option to return an error status if pf is not enabled.
  
  PR:   228632
  Submitted by: James Park-Watt 
  MFC after:1 week

Modified:
  head/etc/rc.d/pf
  head/sbin/pfctl/pfctl.8
  head/sbin/pfctl/pfctl.c
  head/sbin/pfctl/pfctl_parser.c
  head/sbin/pfctl/pfctl_parser.h

Modified: head/etc/rc.d/pf
==
--- head/etc/rc.d/pfWed Jun  6 19:27:06 2018(r334725)
+++ head/etc/rc.d/pfWed Jun  6 19:36:37 2018(r334726)
@@ -66,8 +66,10 @@ pf_status()
 {
if ! [ -c /dev/pf ] ; then
echo "pf.ko is not loaded"
+   return 1
else
$pf_program -s info
+   $pf_program -s Running >/dev/null
fi
 }
 

Modified: head/sbin/pfctl/pfctl.8
==
--- head/sbin/pfctl/pfctl.8 Wed Jun  6 19:27:06 2018(r334725)
+++ head/sbin/pfctl/pfctl.8 Wed Jun  6 19:36:37 2018(r334726)
@@ -412,6 +412,8 @@ Show filter information (statistics and counters).
 When used together with
 .Fl v ,
 source tracking statistics are also shown.
+.It Fl s Cm Running
+Show the running status and provide a non-zero exit status when disabled.
 .It Fl s Cm labels
 Show per-rule statistics (label, evaluations, packets total, bytes total,
 packets in, bytes in, packets out, bytes out, state creations) of

Modified: head/sbin/pfctl/pfctl.c
==
--- head/sbin/pfctl/pfctl.c Wed Jun  6 19:27:06 2018(r334725)
+++ head/sbin/pfctl/pfctl.c Wed Jun  6 19:36:37 2018(r334726)
@@ -96,6 +96,7 @@ intpfctl_show_nat(int, int, char *);
 int pfctl_show_src_nodes(int, int);
 int pfctl_show_states(int, const char *, int);
 int pfctl_show_status(int, int);
+int pfctl_show_running(int);
 int pfctl_show_timeouts(int, int);
 int pfctl_show_limits(int, int);
 voidpfctl_debug(int, u_int32_t, int);
@@ -217,7 +218,7 @@ static const char * const clearopt_list[] = {
 static const char * const showopt_list[] = {
"nat", "queue", "rules", "Anchors", "Sources", "states", "info",
"Interfaces", "labels", "timeouts", "memory", "Tables", "osfp",
-   "all", NULL
+   "Running", "all", NULL
 };
 
 static const char * const tblcmdopt_list[] = {
@@ -1155,6 +1156,20 @@ pfctl_show_status(int dev, int opts)
 }
 
 int
+pfctl_show_running(int dev)
+{
+   struct pf_status status;
+
+   if (ioctl(dev, DIOCGETSTATUS, )) {
+   warn("DIOCGETSTATUS");
+   return (-1);
+   }
+
+   print_running();
+   return (!status.running);
+}
+
+int
 pfctl_show_timeouts(int dev, int opts)
 {
struct pfioc_tm pt;
@@ -2273,6 +2288,9 @@ main(int argc, char *argv[])
break;
case 'i':
pfctl_show_status(dev, opts);
+   break;
+   case 'R':
+   error = pfctl_show_running(dev);
break;
case 't':
pfctl_show_timeouts(dev, opts);

Modified: head/sbin/pfctl/pfctl_parser.c
==
--- head/sbin/pfctl/pfctl_parser.c  Wed Jun  6 19:27:06 2018
(r334725)
+++ head/sbin/pfctl/pfctl_parser.c  Wed Jun  6 19:36:37 2018
(r334726)
@@ -615,6 +615,12 @@ print_status(struct pf_status *s, int opts)
 }
 
 void
+print_running(struct pf_status *status)
+{
+   printf("%s\n", status->running ? "Enabled" : "Disabled");
+}
+
+void
 print_src_node(struct pf_src_node *sn, int opts)
 {
struct pf_addr_wrap aw;

Modified: head/sbin/pfctl/pfctl_parser.h
==
--- head/sbin/pfctl/pfctl_parser.h  Wed Jun  6 19:27:06 2018
(r334725)
+++ head/sbin/pfctl/pfctl_parser.h  Wed Jun  6 19:36:37 2018
(r334726)
@@ -257,6 +257,7 @@ voidprint_src_node(struct pf_src_node *, int);
 void   print_rule(struct pf_rule *, const char *, int, int);
 void   print_tabledef(const char *, int, int, struct node_tinithead *);
 void   print_status(struct pf_status *, int);
+void   print_running(struct pf_status *);
 
 inteval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *,
struct node_queue_opt *);

svn commit: r334725 - head/sys/netinet

2018-06-06 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  6 19:27:06 2018
New Revision: 334725
URL: https://svnweb.freebsd.org/changeset/base/334725

Log:
  Improve compliance with RFC 4895 and RFC 6458.
  
  Silently dicard SCTP chunks which have been requested to be
  authenticated but are received unauthenticated no matter if support
  for SCTP authentication has been negotiated. This improves compliance
  with RFC 4895.
  
  When the application uses the SCTP_AUTH_CHUNK socket option to
  request a chunk to be received in an authenticated way, enable
  the SCTP authentication extension for the end-point. This improves
  compliance with RFC 6458.
  
  Discussed with:   Peter Lei
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Wed Jun  6 18:52:33 2018
(r334724)
+++ head/sys/netinet/sctp_input.c   Wed Jun  6 19:27:06 2018
(r334725)
@@ -4809,7 +4809,6 @@ process_control_chunks:
 
/* check to see if this chunk required auth, but isn't */
if ((stcb != NULL) &&
-   (stcb->asoc.auth_supported == 1) &&
sctp_auth_is_required_chunk(ch->chunk_type, 
stcb->asoc.local_auth_chunks) &&
!stcb->asoc.authenticated) {
/* "silently" ignore */
@@ -5698,7 +5697,6 @@ sctp_common_input_processing(struct mbuf **mm, int iph
 * chunks
 */
if ((stcb != NULL) &&
-   (stcb->asoc.auth_supported == 1) &&
sctp_auth_is_required_chunk(SCTP_DATA, 
stcb->asoc.local_auth_chunks)) {
/* "silently" ignore */
SCTP_STAT_INCR(sctps_recvauthmissing);
@@ -5740,7 +5738,6 @@ sctp_common_input_processing(struct mbuf **mm, int iph
 */
if ((length > offset) &&
(stcb != NULL) &&
-   (stcb->asoc.auth_supported == 1) &&
sctp_auth_is_required_chunk(SCTP_DATA, 
stcb->asoc.local_auth_chunks) &&
!stcb->asoc.authenticated) {
/* "silently" ignore */

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Wed Jun  6 18:52:33 2018
(r334724)
+++ head/sys/netinet/sctp_usrreq.c  Wed Jun  6 19:27:06 2018
(r334725)
@@ -4250,6 +4250,8 @@ sctp_setopt(struct socket *so, int optname, void *optv
if (sctp_auth_add_chunk(sauth->sauth_chunk, 
inp->sctp_ep.local_auth_chunks)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;
+   } else {
+   inp->auth_supported = 1;
}
SCTP_INP_WUNLOCK(inp);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Cy Schubert
In message <1528231489.2440725.1397620864.5987B9ED@webmail.messagingengi
ne.com>
, Brad Davis writes:
> This is a multi-part message in MIME format.
>
> --_--=_152823148924407253
> Content-Transfer-Encoding: 7bit
> Content-Type: text/plain; charset="utf-8"
>
>
> On Tue, Jun 5, 2018, at 1:28 PM, Konstantin Belousov wrote:
> > On Wed, Jun 06, 2018 at 01:39:00AM +0700, Eugene Grosbein wrote:
> > > 06.06.2018 1:26, Konstantin Belousov wrote:
> > >
> > > >>> I find it often very useful to do
> > > >>>  (cd src/etc/rc.d && make install)
> > > >>> Same for defaults and several other directories which in fact
> > > >>> contains> > >>> non-editable content.  Is this planned to keep workin
> g ?
> > > >>
> > > >> The short answer is, no.  All rc.d scripts get moved to the src
> > > >> of the program they start.> > >>
> > > >> That said, if there is a big need for this, we can see about
> > > >> options to keep them working.> > >>
> > > >> What are you trying to accomplish when you do this?  Just verify
> > > >> the rc.d scripts match your src tree?> > >
> > > > I avoid mergemaster/etcupdate and whatever else. rc.d and /etc/rc,> > >
>  /etc/rc.subr /etc/rc.network are not suitable to etc, they are
> > > > binaries> > > provided by the project not for the user editing.
> > > >
> > > > When upgrading the host, esp. on HEAD, i usually refresh scripts
> > > > by this> > > procedure and avoid any editing and implied conflict resol
> ution
> > > > for real> > > configs.
> > > >
> > > > Not being able to easily install clean copies of these scripts
> > > > would> > > be very inconvenient and time consuming.
> > >
> > > I found that "mergemaster -iFUP" deals with unchanged files
> > > including mentioned rc* scripts just fine.> > That is, it automatically r
> efreshes unchanged files without any
> > > silly questions just for change of $FreeBSD$.>
> > No, you missed the point.  Whatever nice is the handling of
> > unchanged files,> use of mergemaster forces me to handle changed files, whi
> ch is exactly> what I do not want/need to do.  Yes, I update crashboxes very
> > often, and> I want to get all new code, including the startup scripts, when
> > I update.
> The startup scripts will be installed as part of installworld.

Shouldn't this be worked out in a phab review first?


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

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


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


Re: svn commit: r333744 - in head/sys: kern sys

2018-06-06 Thread Peter Holm
On Thu, May 17, 2018 at 05:59:35PM +, Matt Macy wrote:
> Author: mmacy
> Date: Thu May 17 17:59:35 2018
> New Revision: 333744
> URL: https://svnweb.freebsd.org/changeset/base/333744
> 
> Log:
>   AF_UNIX: make unix socket locking finer grained
>   
>   This change moves to using a reference count across lock drop / reacquire
>   to guarantee liveness.
>   
>   Currently sends on unix sockets contend heavily on read locking the list 
> lock.
>   unix1_processes in will-it-scale peaks at 6 processes and then declines.
>   
>   With this change I get a substantial improvement in number of operations 
> per second
>   with 96 processes:
>   
>   x before
>   + after
>   N   Min   MaxMedian   AvgStddev
>   x  11   1688420   1696389   1693578 1692766.3 2971.1702
>   +  10  63417955  71030114  70662504  69576423 2374684.6
>   Difference at 95.0% confidence
>   6.78837e+07 +/- 1.49463e+06
>   4010.22% +/- 88.4246%
>   (Student's t, pooled s = 1.63437e+06)
>   
>   And even for 2 processes shows a ~18% improvement.
>   "Small" iron changes (1, 2, and 4 processes):
>   
>   x before1
>   + after1.2
>   ++
>   |  + |
>   |   x  + |
>   |   x  + |
>   |   x  + |
>   |   x ++ |
>   |  xx ++ |
>   |x   x xx ++ |
>   |  |__A_M_AM||
>   ++
>   N   Min   MaxMedian   AvgStddev
>   x  10   1131648   1197750 1197138.5 1190369.3 20651.839
>   +  10   1203840   1205056   1204919 1204827.9 353.27404
>   Difference at 95.0% confidence
>   14458.6 +/- 13723
>   1.21463% +/- 1.16683%
>   (Student's t, pooled s = 14605.2)
>   
>   x before2
>   + after2.2
>   ++
>   |   +|
>   |   +|
>   |   +|
>   |   +|
>   |   +|
>   |   +|
>   |   x   +|
>   |   x   +|
>   | x xx  +|
>   |x  +|
>   |  |___AM_| A|
>   ++
>   N   Min   MaxMedian   AvgStddev
>   x  10   1972843   2045866 2038186.5 2030443.8 21367.694
>   +  10   2400853   2402196 2401043.5 2401172.7 385.40024
>   Difference at 95.0% confidence
>   370729 +/- 14198.9
>   18.2585% +/- 0.826943%
>   (Student's t, pooled s = 15111.7)
>   
>   x before4
>   + after4.2
>   N   Min   MaxMedian   AvgStddev
>   x  10   3986994   3991728 3990137.5 3989985.2 1300.0164
>   +  10   470   4806664 4806116.5   4805194 1990.6625
>   Difference at 95.0% confidence
>   815209 +/- 1579.64
>   20.4314% +/- 0.0421713%
>   (Student's t, pooled s = 1681.19)
>   
>   Tested by: pho
>   Reported by:mjg
>   Approved by:sbruno
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D15430
> 
> Modified:
>   head/sys/kern/uipc_usrreq.c
>   head/sys/sys/unpcb.h
> 
> Modified: head/sys/kern/uipc_usrreq.c
> ==
> --- head/sys/kern/uipc_usrr

Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Brad Davis
On Wed, Jun 6, 2018, at 12:33 PM, Rodney W. Grimes wrote:
> > 
> > On Tue, Jun 5, 2018, at 1:28 PM, Konstantin Belousov wrote:
> > > On Wed, Jun 06, 2018 at 01:39:00AM +0700, Eugene Grosbein wrote:
> > > > 06.06.2018 1:26, Konstantin Belousov wrote:
> > > >
> > > > >>> I find it often very useful to do
> > > > >>>  (cd src/etc/rc.d && make install)
> > > > >>> Same for defaults and several other directories which in fact
> > > > >>> contains> > >>> non-editable content.  Is this planned to keep 
> > > > >>> working ?
> > > > >>
> > > > >> The short answer is, no.  All rc.d scripts get moved to the src
> > > > >> of the program they start.> > >>
> > > > >> That said, if there is a big need for this, we can see about
> > > > >> options to keep them working.> > >>
> > > > >> What are you trying to accomplish when you do this?  Just verify
> > > > >> the rc.d scripts match your src tree?> > >
> > > > > I avoid mergemaster/etcupdate and whatever else. rc.d and /etc/rc,> > 
> > > > > > /etc/rc.subr /etc/rc.network are not suitable to etc, they are
> > > > > binaries> > > provided by the project not for the user editing.
> > > > >
> > > > > When upgrading the host, esp. on HEAD, i usually refresh scripts
> > > > > by this> > > procedure and avoid any editing and implied conflict 
> > > > > resolution
> > > > > for real> > > configs.
> > > > >
> > > > > Not being able to easily install clean copies of these scripts
> > > > > would> > > be very inconvenient and time consuming.
> > > >
> > > > I found that "mergemaster -iFUP" deals with unchanged files
> > > > including mentioned rc* scripts just fine.> > That is, it automatically 
> > > > refreshes unchanged files without any
> > > > silly questions just for change of $FreeBSD$.>
> > > No, you missed the point.  Whatever nice is the handling of
> > > unchanged files,> use of mergemaster forces me to handle changed files, 
> > > which is exactly> what I do not want/need to do.  Yes, I update 
> > > crashboxes very
> > > often, and> I want to get all new code, including the startup scripts, 
> > > when
> > > I update.
> > The startup scripts will be installed as part of installworld.
> 
> So each installworld would wipe over the top of any localmod /etc/rc.d/ 
> and other stuff
> that mght exist?
> One of the reasons that etc/Makefile is detached from Installword is so 
> that
> /etc does not get perturbuted unless specifically requested.

Yes, this is by design.

If people need custom tweaks for that stuff they should be upstreamed or moved 
into /usr/local/etc/rc.d as a custom startup script.


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


svn commit: r334724 - head/usr.sbin/gpioctl

2018-06-06 Thread Romain Tartière
Author: romain (ports committer)
Date: Wed Jun  6 18:52:33 2018
New Revision: 334724
URL: https://svnweb.freebsd.org/changeset/base/334724

Log:
  gpioctl.8: Fix man page section
  
  Reviewed by:  manu
  Approved by:  manu

Modified:
  head/usr.sbin/gpioctl/gpioctl.8

Modified: head/usr.sbin/gpioctl/gpioctl.8
==
--- head/usr.sbin/gpioctl/gpioctl.8 Wed Jun  6 18:28:17 2018
(r334723)
+++ head/usr.sbin/gpioctl/gpioctl.8 Wed Jun  6 18:52:33 2018
(r334724)
@@ -27,8 +27,8 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 11, 2016
-.Dt GPIOCTL 1
+.Dd June 6, 2018
+.Dt GPIOCTL 8
 .Os
 .Sh NAME
 .Nm gpioctl
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Rodney W. Grimes
> 
> On Tue, Jun 5, 2018, at 1:28 PM, Konstantin Belousov wrote:
> > On Wed, Jun 06, 2018 at 01:39:00AM +0700, Eugene Grosbein wrote:
> > > 06.06.2018 1:26, Konstantin Belousov wrote:
> > >
> > > >>> I find it often very useful to do
> > > >>>  (cd src/etc/rc.d && make install)
> > > >>> Same for defaults and several other directories which in fact
> > > >>> contains> > >>> non-editable content.  Is this planned to keep 
> > > >>> working ?
> > > >>
> > > >> The short answer is, no.  All rc.d scripts get moved to the src
> > > >> of the program they start.> > >>
> > > >> That said, if there is a big need for this, we can see about
> > > >> options to keep them working.> > >>
> > > >> What are you trying to accomplish when you do this?  Just verify
> > > >> the rc.d scripts match your src tree?> > >
> > > > I avoid mergemaster/etcupdate and whatever else. rc.d and /etc/rc,> > > 
> > > > /etc/rc.subr /etc/rc.network are not suitable to etc, they are
> > > > binaries> > > provided by the project not for the user editing.
> > > >
> > > > When upgrading the host, esp. on HEAD, i usually refresh scripts
> > > > by this> > > procedure and avoid any editing and implied conflict 
> > > > resolution
> > > > for real> > > configs.
> > > >
> > > > Not being able to easily install clean copies of these scripts
> > > > would> > > be very inconvenient and time consuming.
> > >
> > > I found that "mergemaster -iFUP" deals with unchanged files
> > > including mentioned rc* scripts just fine.> > That is, it automatically 
> > > refreshes unchanged files without any
> > > silly questions just for change of $FreeBSD$.>
> > No, you missed the point.  Whatever nice is the handling of
> > unchanged files,> use of mergemaster forces me to handle changed files, 
> > which is exactly> what I do not want/need to do.  Yes, I update crashboxes 
> > very
> > often, and> I want to get all new code, including the startup scripts, when
> > I update.
> The startup scripts will be installed as part of installworld.

So each installworld would wipe over the top of any localmod /etc/rc.d/ and 
other stuff
that mght exist?
One of the reasons that etc/Makefile is detached from Installword is so that
/etc does not get perturbuted unless specifically requested.


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


svn commit: r334723 - head/stand/lua

2018-06-06 Thread Kyle Evans
Author: kevans
Date: Wed Jun  6 18:28:17 2018
New Revision: 334723
URL: https://svnweb.freebsd.org/changeset/base/334723

Log:
  lualoader: Add a loaded hook for others to execute upon config load
  
  This will not be executed on reload, though later work could allow for that.
  It's intended/expected that later work won't generally need to happen on
  every config load, just once (for, e.g., menu initialization) or just when
  config is reloaded but not upon the initial load.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Wed Jun  6 16:47:33 2018(r334722)
+++ head/stand/lua/config.lua   Wed Jun  6 18:28:17 2018(r334723)
@@ -458,7 +458,7 @@ function config.selectKernel(kernel)
config.kernel_selected = kernel
 end
 
-function config.load(file)
+function config.load(file, reloading)
if not file then
file = "/boot/defaults/loader.conf"
end
@@ -485,13 +485,16 @@ function config.load(file)
config.module_path = loader.getenv("module_path")
local verbose = loader.getenv("verbose_loading") or "no"
config.verbose = verbose:lower() == "yes"
+   if not reloading then
+   hook.runAll("config.loaded")
+   end
 end
 
 -- Reload configuration
 function config.reload(file)
modules = {}
restoreEnv()
-   config.load(file)
+   config.load(file, true)
hook.runAll("config.reloaded")
 end
 
@@ -512,5 +515,6 @@ function config.loadelf()
end
 end
 
+hook.registerType("config.loaded")
 hook.registerType("config.reloaded")
 return config
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334226 - head/lib/libpmcstat/pmu-events

2018-06-06 Thread Matthew Macy
pmu events hasn't been in libpmcstat for a while

On Wed, Jun 6, 2018 at 08:36 Bryan Drewery  wrote:

> On 6/5/18 12:32 AM, Kyle Evans wrote:
> > On Mon, Jun 4, 2018 at 10:11 PM, Kyle Evans  wrote:
> >> On Fri, May 25, 2018 at 4:46 PM, Bryan Drewery 
> wrote:
> >>> Author: bdrewery
> >>> Date: Fri May 25 21:46:07 2018
> >>> New Revision: 334226
> >>> URL: https://svnweb.freebsd.org/changeset/base/334226
> >>>
> >>> Log:
> >>>   Cleanup style
> >>>
> >>> Modified:
> >>>   head/lib/libpmcstat/pmu-events/Makefile
> >>>
> >>> Modified: head/lib/libpmcstat/pmu-events/Makefile
> >>>
> ==
> >>> --- head/lib/libpmcstat/pmu-events/Makefile Fri May 25 20:42:28
> 2018(r334225)
> >>> +++ head/lib/libpmcstat/pmu-events/Makefile Fri May 25 21:46:07
> 2018(r334226)
> >>> @@ -1,9 +1,10 @@
> >>>  # $FreeBSD$
> >>>
> >>> -PROG=jevents
> >>> -SRCS=jevents.c jsmn.c json.c
> >>> +PROG=  jevents
> >>> +SRCS=  jevents.c jsmn.c json.c
> >>>  CFLAGS+= -Wno-cast-qual
> >>> -.PATH: ${.CURDIR}
> >>> -build-tools: jevents
> >>>  MAN=
> >>> +
> >>> +build-tools: jevents
> >>> +
> >>>  .include 
> >>>
> >>
> >> Hi Bryan,
> >>
> >> Something about this appears to be subtly wrong, but I can't quite pin
> >> down what. I'm getting a failure in the lib32 build of libpmc:
> >>
> >> sh: ./pmu-events/jevents: not found
>
> I believe this was fixed by r334455.
>
> >>
> >> My observations are that ${OBJDIR}/lib/libpmc/pmu-events/jevents
> >> exists, as does ${SRCTOP}/lib/libpmc/pmu-events/jevents.
> >> ${OBJDIR}/obj-lib32/lib/libpmc, OTOH, only contains _INCSINS.meta and
> >> libpmc_events.c.meta. I'm guessing this is the problem- that
> >> obj-lib32/... doesn't have the built jevents, but it's not obvious to
> >> me why this is the case.
> >
> > Some additional context:
> >
> > SRCCONF is defined to a file that looks like this:
> >
> > WITH_BSD_GREP="YES"
> > WITHOUT_BSD_GREP_FASTMATCH="YES"
> > WITH_LOADER_LUA="YES"
> > WITHOUT_FORTH="YES"
> >
> > _SRC_ENV_CONF and __MAKE_CONF are set to /dev/null; all three set in
> > arguments to make(1). OBJDIR has been completely wiped before-hand.
> >
>
>
> --
> Regards,
> Bryan Drewery
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Conrad Meyer
Hi Ben, Ravi,

GCC/Clang are fine with the just curly braces, or just do/while(0).

The core benefit of the ({ }) syntax is to allow multiple-statement
macros to have expression syntax externally (i.e., yield a value) —
which is not possible in standard C due to concession to simplistic
parsers.  Ben's link is a good one and does cover this in more detail.
The URL ("Statement-Exprs") is a hint ;-).

Best,
Conrad

On Wed, Jun 6, 2018 at 4:40 AM, Benjamin Kaduk  wrote:
> On Wed, Jun 6, 2018 at 6:35 AM, Ravi Pokala  wrote:
>>
>> Hi Mateusz,
>>
>> -Original Message-
>> From:  on behalf of Mateusz Guzik
>> 
>> Date: 2018-06-06, Wednesday at 01:08
>> To: , ,
>> 
>> Subject: svn commit: r334702 - head/sys/sys
>>
>> > ...
>> >  #ifdef _KERNEL
>> >  #define  malloc(size, type, flags) ({
>> > \
>>
>> Now that I'm taking another look at this, I'm confused as to why the
>> entire macro expansion is inside parentheses? (The braces make sense, since
>> this is a block with local variables which need to be contained.)
>
>
> This is a gcc (and clang) extension to allow the macro body to be a code
> block -- standard C gets unhappy with just the curly braces.
> https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html is a maybe-relevant
> page that google found me.
>
> -Ben
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334722 - head/sys/dev/puc

2018-06-06 Thread Conrad Meyer
Author: cem
Date: Wed Jun  6 16:47:33 2018
New Revision: 334722
URL: https://svnweb.freebsd.org/changeset/base/334722

Log:
  puc(4): Add provisional support for Exar XR17V352
  
  Reportedly, this is sufficient for 4800bps use, but maybe not any better.
  
  PR:   228781
  Submitted by: peo AT nethead.se

Modified:
  head/sys/dev/puc/pucdata.c

Modified: head/sys/dev/puc/pucdata.c
==
--- head/sys/dev/puc/pucdata.c  Wed Jun  6 16:25:00 2018(r334721)
+++ head/sys/dev/puc/pucdata.c  Wed Jun  6 16:47:33 2018(r334722)
@@ -689,6 +689,13 @@ const struct puc_cfg puc_pci_devices[] = {
.config_function = puc_config_exar
},
 
+   {   0x13a8, 0x0352, 0x, 0,
+   "Exar XR17V352",
+   12500,
+   PUC_PORT_2S, 0x10, 0, -1,
+   .config_function = puc_config_exar_pcie
+   },
+
/* The XR17V358 uses the 125MHz PCIe clock as its reference clock. */
{   0x13a8, 0x0358, 0x, 0,
"Exar XR17V358",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334721 - head/lib/msun/man

2018-06-06 Thread Conrad Meyer
Author: cem
Date: Wed Jun  6 16:25:00 2018
New Revision: 334721
URL: https://svnweb.freebsd.org/changeset/base/334721

Log:
  clog.3, complex.3: Fix typos and igor style issues
  
  PR:   228783
  Reported by:  Karsten 

Modified:
  head/lib/msun/man/clog.3
  head/lib/msun/man/complex.3

Modified: head/lib/msun/man/clog.3
==
--- head/lib/msun/man/clog.3Wed Jun  6 15:49:01 2018(r334720)
+++ head/lib/msun/man/clog.3Wed Jun  6 16:25:00 2018(r334721)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 13, 2017
+.Dd June 6, 2018
 .Dt CLOG 3
 .Os
 .Sh NAME
@@ -32,7 +32,7 @@
 .Nm clogf ,
 and
 .Nm clogl
-.Nd complex natural logrithm functions
+.Nd complex natural logarithm functions
 .Sh LIBRARY
 .Lb libm
 .Sh SYNOPSIS
@@ -47,9 +47,9 @@ and
 The
 .Fn clog ,
 .Fn clogf ,
-and 
+and
 .Fn clogl
-functions compute the complex natural logrithm of
+functions compute the complex natural logarithm of
 .Fa z .
 with a branch cut along the negative real axis .
 .Sh RETURN VALUES
@@ -58,14 +58,13 @@ The
 function returns the complex natural logarithm value, in the
 range of a strip mathematically unbounded along the real axis and in
 the interval [-I* \*(Pi , +I* \*(Pi ] along the imaginary axis.
-The function satisfies the relationship: 
+The function satisfies the relationship:
 .Fo clog
 .Fn conj "z" Fc
 =
 .Fo conj
 .Fn clog "z" Fc .
 .Pp
-
 .\" Table is formatted for an 80-column xterm.
 .Bl -column ".Sy +\*(If + I*\*(Na" ".Sy Return value" ".Sy Divide-by-zero 
exception"
 .It Sy Argument  Ta Sy Return value Ta Sy Comment
@@ -86,9 +85,8 @@ The function satisfies the relationship: 
 .It  TaTa floating-point exception
 .It  TaTa for finite y
 .It \*(Na + I*\*(If  Ta +\*(If + I*\*(Na
-.It \*(Na + I*\*(Na  Ta \*(Na + I*\*(Na 
+.It \*(Na + I*\*(Na  Ta \*(Na + I*\*(Na
 .El
-
 .Sh SEE ALSO
 .Xr complex 3 ,
 .Xr log 3 ,

Modified: head/lib/msun/man/complex.3
==
--- head/lib/msun/man/complex.3 Wed Jun  6 15:49:01 2018(r334720)
+++ head/lib/msun/man/complex.3 Wed Jun  6 16:25:00 2018(r334721)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 13, 2018
+.Dd June 6, 2018
 .Dt COMPLEX 3
 .Os
 .Sh NAME
@@ -63,28 +63,28 @@ and
 .Fn cabsl "long double complex z" ,
 respectively.
 .de Cl
-.Bl -column "csqrt" "complex absolute value (i.e. norm, modulus, magnitude)"
+.Bl -column "csqrt" "complex absolute value (i.e., norm, modulus, magnitude)"
 .Em "Name  Description"
 ..
 .\" Section 7.3.5 - 7.3.7 of ISO C99 standard unimplemented, see BUGS
 .\" Section 7.3.8 of ISO C99 standard
 .Ss Absolute-value Functions
 .Cl
-cabs   complex absolute value (i.e. norm, modulus, magnitude)
+cabs   complex absolute value (i.e., norm, modulus, magnitude)
 csqrt  complex square root
 .El
 .Ss Exponential Function
 .Cl
 cexp   exponential base e
 .El
-.Ss Natural logrithm Function
+.Ss Natural logarithm Function
 .Cl
-clog   natural logrithm
+clog   natural logarithm
 .El
 .\" Section 7.3.9 of ISO C99 standard
 .Ss Manipulation Functions
 .Cl
-carg   compute the argument (i.e. phase angle)
+carg   compute the argument (i.e., phase angle)
 cimag  compute the imaginary part
 conj   compute the complex conjugate
 cproj  compute projection onto Riemann sphere
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334712 - head/sys/compat/linuxkpi/common/include/asm

2018-06-06 Thread Hans Petter Selasky

On 06/06/18 17:06, Mateusz Guzik wrote:

On Wed, Jun 6, 2018 at 3:59 PM, Hans Petter Selasky 
wrote:




cmpset loops are crap since they require an explicit re-read of the target
value

see fcmpset and refcount_acquire_if_not_zero for an example use



See r334718.

Thank you!

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


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

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 15:49:01 2018
New Revision: 334720
URL: https://svnweb.freebsd.org/changeset/base/334720

Log:
  Make some list functions RCU safe in the LinuxKPI.
  While at it rename hlist_add_after() into hlist_add_behind().
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

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

Modified: head/sys/compat/linuxkpi/common/include/linux/list.h
==
--- head/sys/compat/linuxkpi/common/include/linux/list.hWed Jun  6 
15:45:57 2018(r334719)
+++ head/sys/compat/linuxkpi/common/include/linux/list.hWed Jun  6 
15:49:01 2018(r334720)
@@ -337,16 +337,16 @@ static inline int
 hlist_empty(const struct hlist_head *h)
 {
 
-   return !h->first;
+   return !READ_ONCE(h->first);
 }
 
 static inline void
 hlist_del(struct hlist_node *n)
 {
 
-   if (n->next)
+   WRITE_ONCE(*(n->pprev), n->next);
+   if (n->next != NULL)
n->next->pprev = n->pprev;
-   *n->pprev = n->next;
 }
 
 static inline void
@@ -364,9 +364,9 @@ hlist_add_head(struct hlist_node *n, struct hlist_head
 {
 
n->next = h->first;
-   if (h->first)
+   if (h->first != NULL)
h->first->pprev = >next;
-   h->first = n;
+   WRITE_ONCE(h->first, n);
n->pprev = >first;
 }
 
@@ -377,18 +377,19 @@ hlist_add_before(struct hlist_node *n, struct hlist_no
n->pprev = next->pprev;
n->next = next;
next->pprev = >next;
-   *(n->pprev) = n;
+   WRITE_ONCE(*(n->pprev), n);
 }
 
 static inline void
-hlist_add_after(struct hlist_node *n, struct hlist_node *next)
+hlist_add_behind(struct hlist_node *n, struct hlist_node *prev)
 {
 
-   next->next = n->next;
-   n->next = next;
-   next->pprev = >next;
-   if (next->next)
-   next->next->pprev = >next;
+   n->next = prev->next;
+   WRITE_ONCE(prev->next, n);
+   n->pprev = >next;
+
+   if (n->next != NULL)
+   n->next->pprev = >next;
 }
 
 static inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334719 - in head: cddl/lib/libdtrace lib/libc/sys sys/kern sys/netinet sys/netinet6 sys/sys

2018-06-06 Thread Sean Bruno
Author: sbruno
Date: Wed Jun  6 15:45:57 2018
New Revision: 334719
URL: https://svnweb.freebsd.org/changeset/base/334719

Log:
  Load balance sockets with new SO_REUSEPORT_LB option.
  
  This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
  programs or threads to bind to the same port and incoming connections will be
  load balanced using a hash function.
  
  Most of the code was copied from a similar patch for DragonflyBSD.
  
  However, in DragonflyBSD, load balancing is a global on/off setting and can 
not
  be set per socket. This patch allows for simultaneous use of both the current
  SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.
  
  Required changes to structures:
  Globally change so_options from 16 to 32 bit value to allow for more options.
  Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.
  
  Limitations:
  As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or
  threads sharing the same socket).
  
  This is a substantially different contribution as compared to its original
  incarnation at svn r332894 and reverted at svn r332967.  Thanks to rwatson@
  for the substantive feedback that is included in this commit.
  
  Submitted by: Johannes Lundberg 
  Obtained from:DragonflyBSD
  Relnotes: Yes
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D11003

Modified:
  head/cddl/lib/libdtrace/tcp.d
  head/lib/libc/sys/getsockopt.2
  head/sys/kern/uipc_debug.c
  head/sys/kern/uipc_socket.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_output.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/udp6_usrreq.c
  head/sys/sys/socket.h
  head/sys/sys/socketvar.h

Modified: head/cddl/lib/libdtrace/tcp.d
==
--- head/cddl/lib/libdtrace/tcp.d   Wed Jun  6 15:31:47 2018
(r334718)
+++ head/cddl/lib/libdtrace/tcp.d   Wed Jun  6 15:45:57 2018
(r334719)
@@ -192,12 +192,12 @@ translator tcpsinfo_t < struct tcpcb *p > {
tcps_rport =p == NULL ? 0 : 
ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport);
tcps_laddr =p == NULL ? 0 :
p->t_inpcb->inp_vflag == INP_IPV4 ?
-   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr)
 :
-   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie6_local);
+   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr)
 :
+   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr);
tcps_raddr =p == NULL ? 0 :
p->t_inpcb->inp_vflag == INP_IPV4 ?
-   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr)
 :
-   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign);
+   
inet_ntoa(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr)
 :
+   inet_ntoa6(>t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr);
tcps_state =p == NULL ? -1 : p->t_state;
tcps_iss =  p == NULL ? 0  : p->iss;
tcps_irs =  p == NULL ? 0  : p->irs;

Modified: head/lib/libc/sys/getsockopt.2
==
--- head/lib/libc/sys/getsockopt.2  Wed Jun  6 15:31:47 2018
(r334718)
+++ head/lib/libc/sys/getsockopt.2  Wed Jun  6 15:45:57 2018
(r334719)
@@ -152,6 +152,7 @@ and set with
 .It Dv SO_DEBUG Ta "enables recording of debugging information"
 .It Dv SO_REUSEADDR Ta "enables local address reuse"
 .It Dv SO_REUSEPORT Ta "enables duplicate address and port bindings"
+.It Dv SO_REUSEPORT_LB Ta "enables duplicate address and port bindings with 
load balancing"
 .It Dv SO_KEEPALIVE Ta "enables keep connections alive"
 .It Dv SO_DONTROUTE Ta "enables routing bypass for outgoing messages"
 .It Dv SO_LINGER  Ta "linger on close if data present"
@@ -207,6 +208,15 @@ if they all set
 before binding the port.
 This option permits multiple instances of a program to each
 receive UDP/IP multicast or broadcast datagrams destined for the bound port.
+.Pp
+.Dv SO_REUSEPORT_LB
+allows completely duplicate bindings by multiple processes
+if they all set
+.Dv SO_REUSEPORT_LB
+before binding the port.
+Incoming TCP and UDP connections are distributed among the sharing
+processes based on a hash function of local port number, foreign IP
+address and port number. A maximum of 256 processes can share one socket.
 .Pp
 .Dv SO_KEEPALIVE
 enables the

Modified: head/sys/kern/uipc_debug.c
==
--- head/sys/kern/uipc_debug.c  Wed Jun  6 15:31:47 2018(r334718)
+++ head/sys/kern/uipc_debug.c  Wed Jun  6 15:45:57 2018

Re: svn commit: r334226 - head/lib/libpmcstat/pmu-events

2018-06-06 Thread Bryan Drewery
On 6/5/18 12:32 AM, Kyle Evans wrote:
> On Mon, Jun 4, 2018 at 10:11 PM, Kyle Evans  wrote:
>> On Fri, May 25, 2018 at 4:46 PM, Bryan Drewery  wrote:
>>> Author: bdrewery
>>> Date: Fri May 25 21:46:07 2018
>>> New Revision: 334226
>>> URL: https://svnweb.freebsd.org/changeset/base/334226
>>>
>>> Log:
>>>   Cleanup style
>>>
>>> Modified:
>>>   head/lib/libpmcstat/pmu-events/Makefile
>>>
>>> Modified: head/lib/libpmcstat/pmu-events/Makefile
>>> ==
>>> --- head/lib/libpmcstat/pmu-events/Makefile Fri May 25 20:42:28 2018
>>> (r334225)
>>> +++ head/lib/libpmcstat/pmu-events/Makefile Fri May 25 21:46:07 2018
>>> (r334226)
>>> @@ -1,9 +1,10 @@
>>>  # $FreeBSD$
>>>
>>> -PROG=jevents
>>> -SRCS=jevents.c jsmn.c json.c
>>> +PROG=  jevents
>>> +SRCS=  jevents.c jsmn.c json.c
>>>  CFLAGS+= -Wno-cast-qual
>>> -.PATH: ${.CURDIR}
>>> -build-tools: jevents
>>>  MAN=
>>> +
>>> +build-tools: jevents
>>> +
>>>  .include 
>>>
>>
>> Hi Bryan,
>>
>> Something about this appears to be subtly wrong, but I can't quite pin
>> down what. I'm getting a failure in the lib32 build of libpmc:
>>
>> sh: ./pmu-events/jevents: not found

I believe this was fixed by r334455.

>>
>> My observations are that ${OBJDIR}/lib/libpmc/pmu-events/jevents
>> exists, as does ${SRCTOP}/lib/libpmc/pmu-events/jevents.
>> ${OBJDIR}/obj-lib32/lib/libpmc, OTOH, only contains _INCSINS.meta and
>> libpmc_events.c.meta. I'm guessing this is the problem- that
>> obj-lib32/... doesn't have the built jevents, but it's not obvious to
>> me why this is the case.
> 
> Some additional context:
> 
> SRCCONF is defined to a file that looks like this:
> 
> WITH_BSD_GREP="YES"
> WITHOUT_BSD_GREP_FASTMATCH="YES"
> WITH_LOADER_LUA="YES"
> WITHOUT_FORTH="YES"
> 
> _SRC_ENV_CONF and __MAKE_CONF are set to /dev/null; all three set in
> arguments to make(1). OBJDIR has been completely wiped before-hand.
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r334718 - head/sys/compat/linuxkpi/common/include/asm

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 15:31:47 2018
New Revision: 334718
URL: https://svnweb.freebsd.org/changeset/base/334718

Log:
  Rewrite code using atomic_fcmpset_int() in the LinuxKPI.
  
  Suggested by: mjg@
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic.hWed Jun  6 
15:19:30 2018(r334717)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic.hWed Jun  6 
15:31:47 2018(r334718)
@@ -239,15 +239,16 @@ static inline int
 atomic_dec_if_positive(atomic_t *v)
 {
int retval;
-   int curr;
+   int old;
 
-   do {
-   curr = atomic_read(v);
-   retval = curr - 1;
+   old = atomic_read(v);
+   for (;;) {
+   retval = old - 1;
if (unlikely(retval < 0))
break;
-   } while (!likely(atomic_cmpset_int(>counter, curr, retval)));
-
+   if (likely(atomic_fcmpset_int(>counter, , retval)))
+   break;
+   }
return (retval);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 15:19:30 2018
New Revision: 334717
URL: https://svnweb.freebsd.org/changeset/base/334717

Log:
  Implement the __add_wait_queue_entry_tail() function in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

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

Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
15:12:19 2018(r334716)
+++ head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
15:19:30 2018(r334717)
@@ -54,7 +54,10 @@
 struct wait_queue;
 struct wait_queue_head;
 
+#definewait_queue_entry wait_queue
+
 typedef struct wait_queue wait_queue_t;
+typedef struct wait_queue_entry wait_queue_entry_t;
 typedef struct wait_queue_head wait_queue_head_t;
 
 typedef int wait_queue_func_t(wait_queue_t *, unsigned int, int, void *);
@@ -246,6 +249,12 @@ static inline void
 __add_wait_queue_tail(wait_queue_head_t *wqh, wait_queue_t *wq)
 {
list_add_tail(>task_list, >task_list);
+}
+
+static inline void
+__add_wait_queue_entry_tail(wait_queue_head_t *wqh, wait_queue_entry_t *wq)
+{
+list_add_tail(>entry, >head);
 }
 
 static inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334716 - head/sys/kern

2018-06-06 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jun  6 15:12:19 2018
New Revision: 334716
URL: https://svnweb.freebsd.org/changeset/base/334716

Log:
  Revert r334708
  
  This is the wrong place to put the barrier.
  Requested by: kib,mjg

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Jun  6 15:10:11 2018(r334715)
+++ head/sys/kern/vfs_subr.cWed Jun  6 15:12:19 2018(r334716)
@@ -2807,9 +2807,6 @@ _vhold(struct vnode *vp, bool locked)
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
if (!locked) {
if (refcount_acquire_if_not_zero(>v_holdcnt)) {
-#if !defined(__amd64__) && !defined(__i386__)
-   mb();
-#endif
VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
("_vhold: vnode with holdcnt is free"));
return;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 15:10:11 2018
New Revision: 334715
URL: https://svnweb.freebsd.org/changeset/base/334715

Log:
  Implement the might_sleep_if() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

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

Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
15:06:21 2018(r334714)
+++ head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
15:10:11 2018(r334715)
@@ -47,6 +47,10 @@
 #definemight_sleep()   
\
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "might_sleep()")
 
+#definemight_sleep_if(cond) do { \
+   if (cond) { might_sleep(); } \
+} while (0)
+
 struct wait_queue;
 struct wait_queue_head;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334712 - head/sys/compat/linuxkpi/common/include/asm

2018-06-06 Thread Mateusz Guzik
On Wed, Jun 6, 2018 at 3:59 PM, Hans Petter Selasky 
wrote:

> Author: hselasky
> Date: Wed Jun  6 13:59:51 2018
> New Revision: 334712
> URL: https://svnweb.freebsd.org/changeset/base/334712
>
> Log:
>   Implement the atomic_dec_if_positive() function in the LinuxKPI.
>
>   Submitted by: Johannes Lundberg 
>   MFC after:1 week
>   Sponsored by: Mellanox Technologies
>   Sponsored by: Limelight Networks
>
> Modified:
>   head/sys/compat/linuxkpi/common/include/asm/atomic.h
>
> Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h
> 
> ==
> --- head/sys/compat/linuxkpi/common/include/asm/atomic.hWed Jun
> 6 13:37:31 2018(r334711)
> +++ head/sys/compat/linuxkpi/common/include/asm/atomic.hWed Jun
> 6 13:59:51 2018(r334712)
> @@ -235,6 +235,22 @@ atomic_cmpxchg(atomic_t *v, int old, int new)
> __ret.val;  \
>  })
>
> +static inline int
> +atomic_dec_if_positive(atomic_t *v)
> +{
> +   int retval;
> +   int curr;
> +
> +   do {
> +   curr = atomic_read(v);
> +   retval = curr - 1;
> +   if (unlikely(retval < 0))
> +   break;
> +   } while (!likely(atomic_cmpset_int(>counter, curr, retval)));
> +
> +   return (retval);
> +}
> +
>

cmpset loops are crap since they require an explicit re-read of the target
value

see fcmpset and refcount_acquire_if_not_zero for an example use

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


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

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 15:06:21 2018
New Revision: 334714
URL: https://svnweb.freebsd.org/changeset/base/334714

Log:
  Rename two structure field members while keeping backwards compatibility in
  the LinuxKPI. Add a comment saying in which Linux version this change was 
made.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

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

Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
14:59:23 2018(r334713)
+++ head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
15:06:21 2018(r334714)
@@ -63,12 +63,18 @@ struct wait_queue {
unsigned int flags; /* always 0 */
void *private;
wait_queue_func_t *func;
-   struct list_head task_list;
+   union {
+   struct list_head task_list; /* < v4.13 */
+   struct list_head entry; /* >= v4.13 */
+   };
 };
 
 struct wait_queue_head {
spinlock_t lock;
-   struct list_head task_list;
+   union {
+   struct list_head task_list; /* < v4.13 */
+   struct list_head head; /* >= v4.13 */
+   };
 };
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 14:59:23 2018
New Revision: 334713
URL: https://svnweb.freebsd.org/changeset/base/334713

Log:
  Implement the init_wait_entry() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/wait.h
  head/sys/compat/linuxkpi/common/src/linux_schedule.c

Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
13:59:51 2018(r334712)
+++ head/sys/compat/linuxkpi/common/include/linux/wait.hWed Jun  6 
14:59:23 2018(r334713)
@@ -106,8 +106,11 @@ extern wait_queue_func_t default_wake_function;
INIT_LIST_HEAD(&(wqh)->task_list);  \
 } while (0)
 
+void linux_init_wait_entry(wait_queue_t *, int);
 void linux_wake_up(wait_queue_head_t *, unsigned int, int, bool);
 
+#defineinit_wait_entry(wq, flags)  
\
+linux_init_wait_entry(wq, flags)
 #definewake_up(wqh)
\
linux_wake_up(wqh, TASK_NORMAL, 1, false)
 #definewake_up_all(wqh)
\

Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c
==
--- head/sys/compat/linuxkpi/common/src/linux_schedule.cWed Jun  6 
13:59:51 2018(r334712)
+++ head/sys/compat/linuxkpi/common/src/linux_schedule.cWed Jun  6 
14:59:23 2018(r334713)
@@ -188,6 +188,17 @@ default_wake_function(wait_queue_t *wq, unsigned int s
 }
 
 void
+linux_init_wait_entry(wait_queue_t *wq, int flags)
+{
+
+   memset(wq, 0, sizeof(*wq));
+   wq->flags = flags;
+   wq->private = current;
+   wq->func = autoremove_wake_function;
+   INIT_LIST_HEAD(>task_list);
+}
+
+void
 linux_wake_up(wait_queue_head_t *wqh, unsigned int state, int nr, bool locked)
 {
wait_queue_t *pos, *next;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334226 - head/lib/libpmcstat/pmu-events

2018-06-06 Thread Bryan Drewery
Will look today or tomorrow. Pretty sure just a small thing is missing from 
Makefile.libcompat.

Regards,
Bryan Drewery

> On Jun 5, 2018, at 00:32, Kyle Evans  wrote:
> 
>> On Mon, Jun 4, 2018 at 10:11 PM, Kyle Evans  wrote:
>>> On Fri, May 25, 2018 at 4:46 PM, Bryan Drewery  wrote:
>>> Author: bdrewery
>>> Date: Fri May 25 21:46:07 2018
>>> New Revision: 334226
>>> URL: https://svnweb.freebsd.org/changeset/base/334226
>>> 
>>> Log:
>>>  Cleanup style
>>> 
>>> Modified:
>>>  head/lib/libpmcstat/pmu-events/Makefile
>>> 
>>> Modified: head/lib/libpmcstat/pmu-events/Makefile
>>> ==
>>> --- head/lib/libpmcstat/pmu-events/Makefile Fri May 25 20:42:28 2018
>>> (r334225)
>>> +++ head/lib/libpmcstat/pmu-events/Makefile Fri May 25 21:46:07 2018
>>> (r334226)
>>> @@ -1,9 +1,10 @@
>>> # $FreeBSD$
>>> 
>>> -PROG=jevents
>>> -SRCS=jevents.c jsmn.c json.c
>>> +PROG=  jevents
>>> +SRCS=  jevents.c jsmn.c json.c
>>> CFLAGS+= -Wno-cast-qual
>>> -.PATH: ${.CURDIR}
>>> -build-tools: jevents
>>> MAN=
>>> +
>>> +build-tools: jevents
>>> +
>>> .include 
>>> 
>> 
>> Hi Bryan,
>> 
>> Something about this appears to be subtly wrong, but I can't quite pin
>> down what. I'm getting a failure in the lib32 build of libpmc:
>> 
>> sh: ./pmu-events/jevents: not found
>> 
>> My observations are that ${OBJDIR}/lib/libpmc/pmu-events/jevents
>> exists, as does ${SRCTOP}/lib/libpmc/pmu-events/jevents.
>> ${OBJDIR}/obj-lib32/lib/libpmc, OTOH, only contains _INCSINS.meta and
>> libpmc_events.c.meta. I'm guessing this is the problem- that
>> obj-lib32/... doesn't have the built jevents, but it's not obvious to
>> me why this is the case.
> 
> Some additional context:
> 
> SRCCONF is defined to a file that looks like this:
> 
> WITH_BSD_GREP="YES"
> WITHOUT_BSD_GREP_FASTMATCH="YES"
> WITH_LOADER_LUA="YES"
> WITHOUT_FORTH="YES"
> 
> _SRC_ENV_CONF and __MAKE_CONF are set to /dev/null; all three set in
> arguments to make(1). OBJDIR has been completely wiped before-hand.

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


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

2018-06-06 Thread Konstantin Belousov
On Wed, Jun 06, 2018 at 12:57:12PM +, Justin Hibbits wrote:
> Author: jhibbits
> Date: Wed Jun  6 12:57:11 2018
> New Revision: 334708
> URL: https://svnweb.freebsd.org/changeset/base/334708
> 
> Log:
>   Add a memory barrier after taking a reference on the vnode holdcnt in _vhold
>   
>   This is needed to avoid a race between the VNASSERT() below, and another
>   thread updating the VI_FREE flag, on weakly-ordered architectures.
>   
>   On a 72-thread POWER9, without this barrier a 'make -j72 buildworld' would
>   panic on the assert regularly.
>   
>   It may be possible to use a weaker barrier, and I'll investigate that once
>   all stability issues are worked out on POWER9.
> 
> Modified:
>   head/sys/kern/vfs_subr.c
> 
> Modified: head/sys/kern/vfs_subr.c
> ==
> --- head/sys/kern/vfs_subr.c  Wed Jun  6 10:46:24 2018(r334707)
> +++ head/sys/kern/vfs_subr.c  Wed Jun  6 12:57:11 2018(r334708)
> @@ -2807,6 +2807,9 @@ _vhold(struct vnode *vp, bool locked)
>   CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
>   if (!locked) {
>   if (refcount_acquire_if_not_zero(>v_holdcnt)) {
> +#if !defined(__amd64__) && !defined(__i386__)
> + mb();
> +#endif
>   VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
>   ("_vhold: vnode with holdcnt is free"));
>   return;
First, mb() must not be used in the FreeBSD code at all.
Look at atomic_thread_fenceXXX(9) KPI.

Second, you need the reciprocal fence between clearing of VI_FREE and
refcount_acquire(), otherwise the added barrier is nop.  Most likely,
you got away with it because there is a mutex unlock between clearing
of VI_FREE and acquire, which release semantic you abused.

Does the fence needed for the non-invariants case ? 

Fourth, doesn't v_usecount has the same issues WRT inactivation ?

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


svn commit: r334712 - head/sys/compat/linuxkpi/common/include/asm

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 13:59:51 2018
New Revision: 334712
URL: https://svnweb.freebsd.org/changeset/base/334712

Log:
  Implement the atomic_dec_if_positive() function in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic.hWed Jun  6 
13:37:31 2018(r334711)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic.hWed Jun  6 
13:59:51 2018(r334712)
@@ -235,6 +235,22 @@ atomic_cmpxchg(atomic_t *v, int old, int new)
__ret.val;  \
 })
 
+static inline int
+atomic_dec_if_positive(atomic_t *v)
+{
+   int retval;
+   int curr;
+
+   do {
+   curr = atomic_read(v);
+   retval = curr - 1;
+   if (unlikely(retval < 0))
+   break;
+   } while (!likely(atomic_cmpset_int(>counter, curr, retval)));
+
+   return (retval);
+}
+
 #defineLINUX_ATOMIC_OP(op, c_op)   \
 static inline void atomic_##op(int i, atomic_t *v) \
 {  \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Ravi Pokala
-Original Message-
From:  on behalf of Benjamin Kaduk 

Date: 2018-06-06, Wednesday at 07:40
To: Ravi Pokala 
Cc: Mateusz Guzik , src-committers 
, , 

Subject: Re: svn commit: r334702 - head/sys/sys

> On Wed, Jun 6, 2018 at 6:35 AM, Ravi Pokala  wrote:
>> 
>> Hi Mateusz,
>> 
>> -Original Message-
>> From:  on behalf of Mateusz Guzik 
>> 
>> Date: 2018-06-06, Wednesday at 01:08
>> To: , , 
>> 
>> Subject: svn commit: r334702 - head/sys/sys
>> 
>>> ...
>>>  #ifdef _KERNEL
>>>  #define  malloc(size, type, flags) ({  
>>>   \
>> 
>> Now that I'm taking another look at this, I'm confused as to why the entire 
>> macro expansion is inside parentheses? (The braces make sense, since this is 
>> a block with local variables which need to be contained.)
> 
> This is a gcc (and clang) extension to allow the macro body to be a code 
> block -- standard C gets unhappy with just the curly braces.  
> https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html is a maybe-relevant 
> page that google found me.

"Neat." Thanks Ben.

-Ravi

> -Ben 





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


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

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 13:37:31 2018
New Revision: 334711
URL: https://svnweb.freebsd.org/changeset/base/334711

Log:
  Implement the ktime_compare() and ktime_after() functions in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

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

Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h
==
--- head/sys/compat/linuxkpi/common/include/linux/ktime.h   Wed Jun  6 
13:29:52 2018(r334710)
+++ head/sys/compat/linuxkpi/common/include/linux/ktime.h   Wed Jun  6 
13:37:31 2018(r334711)
@@ -127,6 +127,25 @@ ktime_add(ktime_t lhs, ktime_t rhs)
return (lhs + rhs);
 }
 
+static inline int
+ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
+{
+
+   if (cmp1 > cmp2)
+   return (1);
+   else if (cmp1 < cmp2)
+   return (-1);
+   else
+   return (0);
+}
+
+static inline bool
+ktime_after(const ktime_t cmp1, const ktime_t cmp2)
+{
+
+   return (ktime_compare(cmp1, cmp2) > 0);
+}
+
 static inline ktime_t
 timespec_to_ktime(struct timespec ts)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334710 - head/sys/compat/linuxkpi/common/include/asm

2018-06-06 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  6 13:29:52 2018
New Revision: 334710
URL: https://svnweb.freebsd.org/changeset/base/334710

Log:
  Implement the rdmsrl_safe() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/asm/msr.h

Modified: head/sys/compat/linuxkpi/common/include/asm/msr.h
==
--- head/sys/compat/linuxkpi/common/include/asm/msr.h   Wed Jun  6 13:01:53 
2018(r334709)
+++ head/sys/compat/linuxkpi/common/include/asm/msr.h   Wed Jun  6 13:29:52 
2018(r334710)
@@ -32,5 +32,6 @@
 #include 
 
 #definerdmsrl(msr, val)((val) = rdmsr(msr))
+#definerdmsrl_safe(msr, val)   rdmsr_safe(msr, val)
 
 #endif /* _ASM_MSR_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334089 - head/sbin/dumpon

2018-06-06 Thread John Baldwin
On 6/6/18 3:34 AM, Eitan Adler wrote:
> On 23 May 2018 at 09:30, John Baldwin  wrote:
>> On Wednesday, May 23, 2018 10:45:32 AM Eitan Adler wrote:
>>> Author: eadler
>>> Date: Wed May 23 10:45:32 2018
>>> New Revision: 334089
>>> URL: https://svnweb.freebsd.org/changeset/base/334089
>>>
>>> Log:
>>>   dumpon: point to better kernel debug symbols.
>>>
>>>   The objdir is temporary, and the current example points to GENERIC.
>>>   Instead point to the installed location of the debug symbols that are
>>>   supposed to match the kernel you are using.
>>>
>>>   PR: 223993
>>>   Submitted by:   trond.endres...@ximalas.info
> ...
> 
> What do y'all think of something like:
> 
> diff --git i/sbin/dumpon/dumpon.8 w/sbin/dumpon/dumpon.8
> index fd271b5..28162af 100644
> --- i/sbin/dumpon/dumpon.8
> +++ w/sbin/dumpon/dumpon.8
> @@ -311,15 +311,17 @@ The
>  can be now examined using
>  .Xr kgdb 1 :
>  .Pp
> -.Dl # kgdb /usr/lib/debug/boot/kernel/kernel.debug vmcore.#
> +.Dl # kgdb /boot/kernel/kernel vmcore.#
>  .Pp
>  or shorter:
>  .Pp
> -.Dl # kgdb -n # /usr/lib/debug/boot/kernel/kernel.debug
> +.Dl # kgdb -n # /boot/kernel/kernel

This can just be 'kgdb -n #'  kgdb uses the sysctl as the default
kernel location.

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


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

2018-06-06 Thread Andriy Gapon
On 06/06/2018 16:02, Warner Losh wrote:
> 
> 
> On Wed, Jun 6, 2018 at 8:57 AM, Justin Hibbits  > wrote:
> 
> Author: jhibbits
> Date: Wed Jun  6 12:57:11 2018
> New Revision: 334708
> URL: https://svnweb.freebsd.org/changeset/base/334708
> 
> 
> Log:
>   Add a memory barrier after taking a reference on the vnode holdcnt in 
> _vhold
> 
>   This is needed to avoid a race between the VNASSERT() below, and another
>   thread updating the VI_FREE flag, on weakly-ordered architectures.
> 
>   On a 72-thread POWER9, without this barrier a 'make -j72 buildworld' 
> would
>   panic on the assert regularly.
> 
>   It may be possible to use a weaker barrier, and I'll investigate that 
> once
>   all stability issues are worked out on POWER9.
> 
> Modified:
>   head/sys/kern/vfs_subr.c
> 
> Modified: head/sys/kern/vfs_subr.c
> 
> ==
> --- head/sys/kern/vfs_subr.c    Wed Jun  6 10:46:24 2018        (r334707)
> +++ head/sys/kern/vfs_subr.c    Wed Jun  6 12:57:11 2018        (r334708)
> @@ -2807,6 +2807,9 @@ _vhold(struct vnode *vp, bool locked)
>         CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
>         if (!locked) {
>                 if (refcount_acquire_if_not_zero(>v_holdcnt)) {
> +#if !defined(__amd64__) && !defined(__i386__)
> +                       mb();
> +#endif
>                         VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
>                             ("_vhold: vnode with holdcnt is free"));
>                         return;
> 
> 
> So why isn't the refcount_acquire() enough?

This is the wrong "acquire", "acquire" in a sense of "get" or "increment", not
in a sense of a memory barrier.



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


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

2018-06-06 Thread Justin Hibbits
On Wed, Jun 6, 2018 at 9:02 AM, Warner Losh  wrote:
>
>
> On Wed, Jun 6, 2018 at 8:57 AM, Justin Hibbits  wrote:
>>
>> Author: jhibbits
>> Date: Wed Jun  6 12:57:11 2018
>> New Revision: 334708
>> URL: https://svnweb.freebsd.org/changeset/base/334708
>>
>> Log:
>>   Add a memory barrier after taking a reference on the vnode holdcnt in
>> _vhold
>>
>>   This is needed to avoid a race between the VNASSERT() below, and another
>>   thread updating the VI_FREE flag, on weakly-ordered architectures.
>>
>>   On a 72-thread POWER9, without this barrier a 'make -j72 buildworld'
>> would
>>   panic on the assert regularly.
>>
>>   It may be possible to use a weaker barrier, and I'll investigate that
>> once
>>   all stability issues are worked out on POWER9.
>>
>> Modified:
>>   head/sys/kern/vfs_subr.c
>>
>> Modified: head/sys/kern/vfs_subr.c
>>
>> ==
>> --- head/sys/kern/vfs_subr.cWed Jun  6 10:46:24 2018(r334707)
>> +++ head/sys/kern/vfs_subr.cWed Jun  6 12:57:11 2018(r334708)
>> @@ -2807,6 +2807,9 @@ _vhold(struct vnode *vp, bool locked)
>> CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
>> if (!locked) {
>> if (refcount_acquire_if_not_zero(>v_holdcnt)) {
>> +#if !defined(__amd64__) && !defined(__i386__)
>> +   mb();
>> +#endif
>> VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
>> ("_vhold: vnode with holdcnt is free"));
>> return;
>>
>
> So why isn't the refcount_acquire() enough?
>
> Warner

I'm not entirely sure.  I had never seen this before, it's only
cropped up on my POWER9 system.  The refcount_acquire doesn't include
a memory barrier, and mjg is reluctant to add one, since most refcount
users don't care about ordering.  Adding the memory barrier appeases
the VNASSERT().  It may only be necessary for the VNASSERT(), and may
not be strictly necessary for proper operation, but I think it's
safest this way, until better performance metrics can be done.

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


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

2018-06-06 Thread Mateusz Guzik
On Wed, Jun 6, 2018 at 1:35 PM, Ravi Pokala  wrote:

> > + * Passing the flag down requires malloc to blindly zero the entire
> object.
> > + * In practice a lot of the zeroing can be avoided if most of the object
> > + * gets explicitly initialized after the allocation. Letting the
> compiler
> > + * zero in place gives it the opportunity to take advantage of this
> state.
>
> This part, I still don't understand. :-(
>
> The call to bzero() is still for the full length passed in, so how does
> this help?
>
>
bzero is:
#define bzero(buf, len) __builtin_memset((buf), 0, (len))

> ...
> > + *   _malloc_item = malloc(_size, type, (flags) &~ M_ZERO);
> > + *   if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL)
> > + *   bzero(_malloc_item, _size);
> > + *
> > + * If the flag is set, the compiler knows the left side is always true,
> > + * therefore the entire statement is true and the callsite is:
>
> I think you mean "... the *right* side is always true ...", since the left
> side is the check for the flag being set. "If the flag is set, compiler
> knows (the check for the flag being set) is always true" is tautological.
>

It explains how __builtin_constant_p(flags) being true allows the compiler
to optimize out the flags-based check.

I don't understand why this particular use runs into so much confusion.
Just above it there is a M_ZERO check relying on the same property and
receiving no attention.

> ...
> > + * If the flag is not set, the compiler knows the left size is always
> false
> > + * and the NULL check is needed, therefore the callsite is:
>
> Same issue here.
>
> > ...
> >  #ifdef _KERNEL
> >  #define  malloc(size, type, flags) ({
>   \
>
> Now that I'm taking another look at this, I'm confused as to why the
> entire macro expansion is inside parentheses? (The braces make sense, since
> this is a block with local variables which need to be contained.)
>
>
It is to return the value (the last expression).


> >   void *_malloc_item; \
> > @@ -193,7 +228,8 @@ void  *malloc(size_t size, struct malloc_type
> *type, in
> >   if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\
> >   ((flags) & M_ZERO) != 0) {  \
> >   _malloc_item = malloc(_size, type, (flags) &~ M_ZERO);  \
> > - if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL)  \
> > + if (((flags) & M_WAITOK) != 0 ||\
> > + __predict_true(_malloc_item != NULL))   \
> >   bzero(_malloc_item, _size); \
> >   } else {\
> >   _malloc_item = malloc(_size, type, flags);  \
>
> This confuses me too. If the constant-size/constant-flags/M_ZERO-is-set
> test fails, then it falls down to calling malloc(). Which we are in the
> middle of defining. So what does that expand to?
>
>
Expansion is not recursive, so this is an actual call to malloc.

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


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

2018-06-06 Thread Warner Losh
On Wed, Jun 6, 2018 at 8:57 AM, Justin Hibbits  wrote:

> Author: jhibbits
> Date: Wed Jun  6 12:57:11 2018
> New Revision: 334708
> URL: https://svnweb.freebsd.org/changeset/base/334708
>
> Log:
>   Add a memory barrier after taking a reference on the vnode holdcnt in
> _vhold
>
>   This is needed to avoid a race between the VNASSERT() below, and another
>   thread updating the VI_FREE flag, on weakly-ordered architectures.
>
>   On a 72-thread POWER9, without this barrier a 'make -j72 buildworld'
> would
>   panic on the assert regularly.
>
>   It may be possible to use a weaker barrier, and I'll investigate that
> once
>   all stability issues are worked out on POWER9.
>
> Modified:
>   head/sys/kern/vfs_subr.c
>
> Modified: head/sys/kern/vfs_subr.c
> 
> ==
> --- head/sys/kern/vfs_subr.cWed Jun  6 10:46:24 2018(r334707)
> +++ head/sys/kern/vfs_subr.cWed Jun  6 12:57:11 2018(r334708)
> @@ -2807,6 +2807,9 @@ _vhold(struct vnode *vp, bool locked)
> CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
> if (!locked) {
> if (refcount_acquire_if_not_zero(>v_holdcnt)) {
> +#if !defined(__amd64__) && !defined(__i386__)
> +   mb();
> +#endif
> VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
> ("_vhold: vnode with holdcnt is free"));
> return;
>
>
So why isn't the refcount_acquire() enough?

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


svn commit: r334709 - head/sys/netinet

2018-06-06 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jun  6 13:01:53 2018
New Revision: 334709
URL: https://svnweb.freebsd.org/changeset/base/334709

Log:
  Make in_delayed_cksum() be similar to IPv6 implementation.
  
  Use m_copyback() function to write checksum when it isn't located
  in the first mbuf of the chain. Handmade analog doesn't handle the
  case when parts of checksum are located in different mbufs.
  Also in case when mbuf is too short, m_copyback() will allocate new
  mbuf in the chain instead of making out of bounds write.
  
  Also wrap long line and remove now useless KASSERTs.
  
  X-MFC after:  r334705

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cWed Jun  6 12:57:11 2018
(r334708)
+++ head/sys/netinet/ip_output.cWed Jun  6 13:01:53 2018
(r334709)
@@ -933,10 +933,10 @@ in_delayed_cksum(struct mbuf *m)
if (m->m_pkthdr.csum_flags & CSUM_UDP) {
/* if udp header is not in the first mbuf copy udplen */
if (offset + sizeof(struct udphdr) > m->m_len)
-   m_copydata(m, offset + offsetof(struct udphdr, uh_ulen),
-   2, (caddr_t));
+   m_copydata(m, offset + offsetof(struct udphdr,
+   uh_ulen), sizeof(cklen), (caddr_t));
else {
-   uh = (struct udphdr *)((caddr_t)ip + offset);
+   uh = (struct udphdr *)mtodo(m, offset);
cklen = ntohs(uh->uh_ulen);
}
csum = in_cksum_skip(m, cklen + offset, offset);
@@ -948,14 +948,10 @@ in_delayed_cksum(struct mbuf *m)
}
offset += m->m_pkthdr.csum_data;/* checksum offset */
 
-   /* find the mbuf in the chain where the checksum starts*/
-   while ((m != NULL) && (offset >= m->m_len)) {
-   offset -= m->m_len;
-   m = m->m_next;
-   }
-   KASSERT(m != NULL, ("in_delayed_cksum: checksum outside mbuf chain."));
-   KASSERT(offset + sizeof(u_short) <= m->m_len, ("in_delayed_cksum: 
checksum split between mbufs."));
-   *(u_short *)(m->m_data + offset) = csum;
+   if (offset + sizeof(csum) > m->m_len)
+   m_copyback(m, offset, sizeof(csum), (caddr_t));
+   else
+   *(u_short *)mtodo(m, offset) = csum;
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334708 - head/sys/kern

2018-06-06 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jun  6 12:57:11 2018
New Revision: 334708
URL: https://svnweb.freebsd.org/changeset/base/334708

Log:
  Add a memory barrier after taking a reference on the vnode holdcnt in _vhold
  
  This is needed to avoid a race between the VNASSERT() below, and another
  thread updating the VI_FREE flag, on weakly-ordered architectures.
  
  On a 72-thread POWER9, without this barrier a 'make -j72 buildworld' would
  panic on the assert regularly.
  
  It may be possible to use a weaker barrier, and I'll investigate that once
  all stability issues are worked out on POWER9.

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Jun  6 10:46:24 2018(r334707)
+++ head/sys/kern/vfs_subr.cWed Jun  6 12:57:11 2018(r334708)
@@ -2807,6 +2807,9 @@ _vhold(struct vnode *vp, bool locked)
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
if (!locked) {
if (refcount_acquire_if_not_zero(>v_holdcnt)) {
+#if !defined(__amd64__) && !defined(__i386__)
+   mb();
+#endif
VNASSERT((vp->v_iflag & VI_FREE) == 0, vp,
("_vhold: vnode with holdcnt is free"));
return;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-06 Thread Bruce Evans

On Wed, 6 Jun 2018, Benjamin Kaduk wrote:


On Wed, Jun 6, 2018 at 6:35 AM, Ravi Pokala  wrote:


Hi Mateusz,
...

...
 #ifdef _KERNEL
 #define  malloc(size, type, flags) ({

  \

Now that I'm taking another look at this, I'm confused as to why the
entire macro expansion is inside parentheses? (The braces make sense, since
this is a block with local variables which need to be contained.)


This is a gcc (and clang) extension to allow the macro body to be a code
block -- standard C gets unhappy with just the curly braces.
https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html is a maybe-relevant
page that google found me.


Not really.

This is a syntax error which is only accepted by broken compilers,
since the language standard is doubly mis-specified by hard-coding it
to a wrong value using CSTD=c89 in kern.mk.  This asks for c99 with
no extensions, but many extensions are needed.  These bugs are missing
in the corresponding userland makefile bsd.sys.mk.  That uses CSTD?=gnu99.
This asks for c99 with gnu extensions, which is what is needed, but allows
the user to ask for another standard by setting CSTD.

To allow the user to ask for c99, or just to not depend on compiler bugs
when kern.mk asks for c99, use of this and other extensions should be
marked with __extension__, as is most often done for this particular
extension.

Braces in macros are perfectly standard.  The extension is to allow a
compound statement (delimited by braces) to return a value.  This is done
by enclosing the statement in parentheses.  The value of the statement is
the value of the last expression in it.  This is an extension of c99, since
in c99 about the only things that can be enclosed in parentheses are
expressions, but general statements are not expressions.  Especially
compound statements.

This used to be properly documented (in installed documentation) in
/usr/share/info/gcc.info.gz.

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


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Brad Davis
On Wed, Jun 6, 2018, at 2:25 AM, Stefan Esser wrote:
> Am 05.06.18 um 22:43 schrieb Brad Davis:
> > 
> > On Tue, Jun 5, 2018, at 1:07 PM, Renato Botelho wrote:
> >> On 05/06/18 15:26, Konstantin Belousov wrote:
> >> > On Tue, Jun 05, 2018 at 12:13:05PM -0600, Brad Davis wrote:
> >> >> On Tue, Jun 5, 2018, at 10:46 AM, Konstantin Belousov wrote:
> >> >>> I find it often very useful to do
> >> >>> (cd src/etc/rc.d && make install)
> >> >>> Same for defaults and several other directories which in fact contains
> >> >>> non-editable content.  Is this planned to keep working ?
> >> >>
> >> >> The short answer is, no.  All rc.d scripts get moved to the src of the
> > program they start.
> >> >>
> >> >> That said, if there is a big need for this, we can see about options to
> > keep them working.
> >> >>
> >> >> What are you trying to accomplish when you do this?  Just verify the 
> >> >> rc.d
> > scripts match your src tree?
> >> >
> >> > I avoid mergemaster/etcupdate and whatever else. rc.d and /etc/rc,
> >> > /etc/rc.subr /etc/rc.network are not suitable to etc, they are binaries
> >> > provided by the project not for the user editing.
> >> >
> >> > When upgrading the host, esp. on HEAD, i usually refresh scripts by this
> >> > procedure and avoid any editing and implied conflict resolution for real
> >> > configs.
> >> >
> >> > Not being able to easily install clean copies of these scripts would
> >> > be very inconvenient and time consuming.
> >>
> >> If I understood what Brad is saying, each rc.d script will be installed
> >> by the application it belongs to. So when it's installing SSH it will
> >> also install /etc/rc.d/sshd and you will not need to deal with rc.d
> >> files on mergemaster anymore.
> >>
> >> Is it correct, Brad?
> > 
> > Correct.
> I have for a long time (decades?) applied local changes to files in src/etc
> which (very seldom) may need a conflict resolution, and which make sure that
> /etc is populated with files that match my needs.
> 
> It is easy to change a file in /etc until it works as desired and then copy
> it to src/etc, where it is subject to updating via SVN, but still reflects
> my preferences.
> 
> With the move to source directories it will be necessary to modify rc files
> and other configuration file defaults (e.g. ttys) in a number of places.
> 
> E.g., mergemaster will try to remove the shells installed from ports from
> /etc/shells on each run and quite a number of other files will either never
> be automatically updated (by excluding them from mergemaster runs) or on
> every invocation of mergemaster, unless patched in their respective source
> directories spread over the whole source tree.
> 
> This is a BIG step backwards from my PoV, since src/etc currently is the
> equivalent of FreeBSD's concept of using /etc/rc.conf for configuration of
> all applicable system settings. Having sources of all files that are going
> to be installed in /etc (when a new system is setup or by mergemaster) is
> equivalent in the sense that the location where changes have to be applied
> is confined to just one directory, src/etc (and a few architecture dependent
> sub-directories).

You should really consider moving to etcupdate, as it uses 3-way merge and make 
this much easier.


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


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

2018-06-06 Thread Benjamin Kaduk
On Wed, Jun 6, 2018 at 6:35 AM, Ravi Pokala  wrote:

> Hi Mateusz,
>
> -Original Message-
> From:  on behalf of Mateusz Guzik
> 
> Date: 2018-06-06, Wednesday at 01:08
> To: , , <
> svn-src-h...@freebsd.org>
> Subject: svn commit: r334702 - head/sys/sys
>
> > ...
> >  #ifdef _KERNEL
> >  #define  malloc(size, type, flags) ({
>   \
>
> Now that I'm taking another look at this, I'm confused as to why the
> entire macro expansion is inside parentheses? (The braces make sense, since
> this is a block with local variables which need to be contained.)
>

This is a gcc (and clang) extension to allow the macro body to be a code
block -- standard C gets unhappy with just the curly braces.
https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html is a maybe-relevant
page that google found me.

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


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

2018-06-06 Thread Ravi Pokala
Hi Mateusz,

-Original Message-
From:  on behalf of Mateusz Guzik 

Date: 2018-06-06, Wednesday at 01:08
To: , , 

Subject: svn commit: r334702 - head/sys/sys

> Author: mjg
> Date: Wed Jun  6 05:08:05 2018
> New Revision: 334702
> URL: https://svnweb.freebsd.org/changeset/base/334702
> 
> Log:
>   malloc: elaborate on r334545 due to frequent questions

I was one of the questioners. :-) Thank you for explaining the conditional 
logic.

> ...
> + * Passing the flag down requires malloc to blindly zero the entire object.
> + * In practice a lot of the zeroing can be avoided if most of the object
> + * gets explicitly initialized after the allocation. Letting the compiler
> + * zero in place gives it the opportunity to take advantage of this state.

This part, I still don't understand. :-(

The call to bzero() is still for the full length passed in, so how does this 
help?

> ...
> + *   _malloc_item = malloc(_size, type, (flags) &~ M_ZERO);
> + *   if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL)
> + *   bzero(_malloc_item, _size);
> + *
> + * If the flag is set, the compiler knows the left side is always true,
> + * therefore the entire statement is true and the callsite is:

I think you mean "... the *right* side is always true ...", since the left side 
is the check for the flag being set. "If the flag is set, compiler knows (the 
check for the flag being set) is always true" is tautological.

> ...
> + * If the flag is not set, the compiler knows the left size is always false
> + * and the NULL check is needed, therefore the callsite is:

Same issue here.

> ...
>  #ifdef _KERNEL
>  #define  malloc(size, type, flags) ({
> \

Now that I'm taking another look at this, I'm confused as to why the entire 
macro expansion is inside parentheses? (The braces make sense, since this is a 
block with local variables which need to be contained.)

>   void *_malloc_item; \
> @@ -193,7 +228,8 @@ void  *malloc(size_t size, struct malloc_type *type, 
> in
>   if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\
>   ((flags) & M_ZERO) != 0) {  \
>   _malloc_item = malloc(_size, type, (flags) &~ M_ZERO);  \
> - if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL)  \
> + if (((flags) & M_WAITOK) != 0 ||\
> + __predict_true(_malloc_item != NULL))   \
>   bzero(_malloc_item, _size); \
>   } else {\
>   _malloc_item = malloc(_size, type, flags);  \

This confuses me too. If the constant-size/constant-flags/M_ZERO-is-set test 
fails, then it falls down to calling malloc(). Which we are in the middle of 
defining. So what does that expand to?

Thanks,

Ravi (rpokala@)


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


svn commit: r334707 - head/sys/netinet6

2018-06-06 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jun  6 10:46:24 2018
New Revision: 334707
URL: https://svnweb.freebsd.org/changeset/base/334707

Log:
  Use m_copyback() function to write delayed checksum when it isn't located
  in the first mbuf of the chain.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Wed Jun  6 07:13:27 2018
(r334706)
+++ head/sys/netinet6/ip6_output.c  Wed Jun  6 10:46:24 2018
(r334707)
@@ -199,18 +199,10 @@ in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_sho
csum = 0x;
offset += m->m_pkthdr.csum_data;/* checksum offset */
 
-   if (offset + sizeof(u_short) > m->m_len) {
-   printf("%s: delayed m_pullup, m->len: %d plen %u off %u "
-   "csum_flags=%b\n", __func__, m->m_len, plen, offset,
-   (int)m->m_pkthdr.csum_flags, CSUM_BITS);
-   /*
-* XXX this should not happen, but if it does, the correct
-* behavior may be to insert the checksum in the appropriate
-* next mbuf in the chain.
-*/
-   return;
-   }
-   *(u_short *)(m->m_data + offset) = csum;
+   if (offset + sizeof(csum) > m->m_len)
+   m_copyback(m, offset, sizeof(csum), (caddr_t));
+   else
+   *(u_short *)mtodo(m, offset) = csum;
 }
 
 int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334617 - in head: . etc

2018-06-06 Thread Stefan Esser
Am 05.06.18 um 22:43 schrieb Brad Davis:
> 
> On Tue, Jun 5, 2018, at 1:07 PM, Renato Botelho wrote:
>> On 05/06/18 15:26, Konstantin Belousov wrote:
>> > On Tue, Jun 05, 2018 at 12:13:05PM -0600, Brad Davis wrote:
>> >> On Tue, Jun 5, 2018, at 10:46 AM, Konstantin Belousov wrote:
>> >>> I find it often very useful to do
>> >>> (cd src/etc/rc.d && make install)
>> >>> Same for defaults and several other directories which in fact contains
>> >>> non-editable content.  Is this planned to keep working ?
>> >>
>> >> The short answer is, no.  All rc.d scripts get moved to the src of the
> program they start.
>> >>
>> >> That said, if there is a big need for this, we can see about options to
> keep them working.
>> >>
>> >> What are you trying to accomplish when you do this?  Just verify the rc.d
> scripts match your src tree?
>> >
>> > I avoid mergemaster/etcupdate and whatever else. rc.d and /etc/rc,
>> > /etc/rc.subr /etc/rc.network are not suitable to etc, they are binaries
>> > provided by the project not for the user editing.
>> >
>> > When upgrading the host, esp. on HEAD, i usually refresh scripts by this
>> > procedure and avoid any editing and implied conflict resolution for real
>> > configs.
>> >
>> > Not being able to easily install clean copies of these scripts would
>> > be very inconvenient and time consuming.
>>
>> If I understood what Brad is saying, each rc.d script will be installed
>> by the application it belongs to. So when it's installing SSH it will
>> also install /etc/rc.d/sshd and you will not need to deal with rc.d
>> files on mergemaster anymore.
>>
>> Is it correct, Brad?
> 
> Correct.
I have for a long time (decades?) applied local changes to files in src/etc
which (very seldom) may need a conflict resolution, and which make sure that
/etc is populated with files that match my needs.

It is easy to change a file in /etc until it works as desired and then copy
it to src/etc, where it is subject to updating via SVN, but still reflects
my preferences.

With the move to source directories it will be necessary to modify rc files
and other configuration file defaults (e.g. ttys) in a number of places.

E.g., mergemaster will try to remove the shells installed from ports from
/etc/shells on each run and quite a number of other files will either never
be automatically updated (by excluding them from mergemaster runs) or on
every invocation of mergemaster, unless patched in their respective source
directories spread over the whole source tree.

This is a BIG step backwards from my PoV, since src/etc currently is the
equivalent of FreeBSD's concept of using /etc/rc.conf for configuration of
all applicable system settings. Having sources of all files that are going
to be installed in /etc (when a new system is setup or by mergemaster) is
equivalent in the sense that the location where changes have to be applied
is confined to just one directory, src/etc (and a few architecture dependent
sub-directories).

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


Re: svn commit: r334089 - head/sbin/dumpon

2018-06-06 Thread Eitan Adler
On 23 May 2018 at 09:30, John Baldwin  wrote:
> On Wednesday, May 23, 2018 10:45:32 AM Eitan Adler wrote:
>> Author: eadler
>> Date: Wed May 23 10:45:32 2018
>> New Revision: 334089
>> URL: https://svnweb.freebsd.org/changeset/base/334089
>>
>> Log:
>>   dumpon: point to better kernel debug symbols.
>>
>>   The objdir is temporary, and the current example points to GENERIC.
>>   Instead point to the installed location of the debug symbols that are
>>   supposed to match the kernel you are using.
>>
>>   PR: 223993
>>   Submitted by:   trond.endres...@ximalas.info
...

What do y'all think of something like:

diff --git i/sbin/dumpon/dumpon.8 w/sbin/dumpon/dumpon.8
index fd271b5..28162af 100644
--- i/sbin/dumpon/dumpon.8
+++ w/sbin/dumpon/dumpon.8
@@ -311,15 +311,17 @@ The
 can be now examined using
 .Xr kgdb 1 :
 .Pp
-.Dl # kgdb /usr/lib/debug/boot/kernel/kernel.debug vmcore.#
+.Dl # kgdb /boot/kernel/kernel vmcore.#
 .Pp
 or shorter:
 .Pp
-.Dl # kgdb -n # /usr/lib/debug/boot/kernel/kernel.debug
+.Dl # kgdb -n # /boot/kernel/kernel
 .Pp
 The core was decrypted properly if
 .Xr kgdb 1
 does not print any errors.
+Note that the live kernel might be at a different path
+which can be examined by looking at the kern.bootfile sysctl.
 .Sh SEE ALSO
 .Xr gzip 1 ,
 .Xr kgdb 1 ,



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334650 - head/sys/dev/usb

2018-06-06 Thread Gary Jennejohn
On Tue, 5 Jun 2018 16:30:05 -0700
Eitan Adler  wrote:

> On 5 June 2018 at 07:01, Kevin Lo  wrote:
> > On Tue, Jun 05, 2018 at 09:52:38AM +, Eitan Adler wrote:  
> >> Author: eadler
> >> Date: Tue Jun  5 09:52:38 2018
> >> New Revision: 334650
> >> URL: https://svnweb.freebsd.org/changeset/base/334650
> >>
> >> Log:
> >>   usbdevs: sync from NetBSD
> >>
> >>   This adds several vendors from NetBSD's copy of the same file (r1.749).
> >>   Prefer longer more "canonical" names where the names differed.
> >>
> >>   Sort while here.
> >>
> >> Modified:
> >>   head/sys/dev/usb/usbdevs
> >>
> >> Modified: head/sys/dev/usb/usbdevs
> >> ==
> >> --- head/sys/dev/usb/usbdevs  Tue Jun  5 05:24:42 2018(r334649)
> >> +++ head/sys/dev/usb/usbdevs  Tue Jun  5 09:52:38 2018(r334650)
> >> @@ -60,7 +60,7 @@ vendor UNKNOWN2 0x0105  Unknown vendor
> >>  vendor EGALAX2   0x0123  eGalax, Inc.
> >>  vendor CHIPSBANK 0x0204  Chipsbank Microelectronics Co.
> >>  vendor HUMAX 0x02ad  HUMAX
> >> -vendor INTENSO   0x2109  INTENSO
> >> +vendor QUAN  0x01e1  Quan  
> >
> > Doesn't sort.
> >
> > [snip]
> >  
> >> +vendor INTENSO   0x2109  INTENSO
> >>  vendor VIALABS   0x2109  VIA Labs  
> >
> > INTENSO has the same vendor id as VIALABS?  This doesn't look right.  
> 
> From the origin (NetBSD):
> 
> vendor INTENSO  0x2109  INTENSO
> vendor VIALABS  0x2109  VIA Labs
> 
> I noticed this earlier and thought it might relate to vendor renames
> or the like. I'll try and spend more time on it. I have quite a few
> replies-to-commits to catch up on: I've spent too much time on "new"
> things and have to deal with the other stuff I've touched now.
> 

Looking at the usb.if from usb.org indicates that Intenso doesn't
even have a USB VID.  0x2109 is listed as VIA Labs.  This entry
may be the result of Intenso selling a rebadged VIA Labs product.

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


svn commit: r334706 - head/usr.bin/top

2018-06-06 Thread Eitan Adler
Author: eadler
Date: Wed Jun  6 07:13:27 2018
New Revision: 334706
URL: https://svnweb.freebsd.org/changeset/base/334706

Log:
  top(1): fix err again
  
  I am amazed at my ability to get a one-line error reporting line wrong
  thrice.

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Wed Jun  6 07:04:40 2018(r334705)
+++ head/usr.bin/top/machine.c  Wed Jun  6 07:13:27 2018(r334706)
@@ -379,7 +379,7 @@ machine_init(struct statics *statics)
GETSYSCTL("kern.smp.maxcpus", maxcpu);
times = calloc(maxcpu * CPUSTATES, sizeof(long));
if (times == NULL)
-   err(1, "calloc for kern.smp.maxcpus", size);
+   err(1, "calloc for kern.smp.maxcpus");
size = sizeof(long) * maxcpu * CPUSTATES;
if (sysctlbyname("kern.cp_times", times, , NULL, 0) == -1)
err(1, "sysctlbyname kern.cp_times");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334705 - head/sys/netinet

2018-06-06 Thread Tom Jones
Author: thj
Date: Wed Jun  6 07:04:40 2018
New Revision: 334705
URL: https://svnweb.freebsd.org/changeset/base/334705

Log:
  Use UDP len when calculating UDP checksums
  
  The length of the IP payload is normally equal to the UDP length, UDP Options
  (draft-ietf-tsvwg-udp-options-02) suggests using the difference between IP
  length and UDP length to create space for trailing data.
  
  Correct checksum length calculation to use the UDP length rather than the IP
  length when not offloading UDP checksums.
  
  Approved by: jtl (mentor)
  Differential Revision:https://reviews.freebsd.org/D15222

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cWed Jun  6 06:42:12 2018
(r334704)
+++ head/sys/netinet/ip_output.cWed Jun  6 07:04:40 2018
(r334705)
@@ -80,6 +80,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+
+#include 
+#include 
+
 #ifdef SCTP
 #include 
 #include 
@@ -920,14 +924,28 @@ void
 in_delayed_cksum(struct mbuf *m)
 {
struct ip *ip;
-   uint16_t csum, offset, ip_len;
+   struct udphdr *uh;
+   uint16_t cklen, csum, offset;
 
ip = mtod(m, struct ip *);
offset = ip->ip_hl << 2 ;
-   ip_len = ntohs(ip->ip_len);
-   csum = in_cksum_skip(m, ip_len, offset);
-   if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0)
-   csum = 0x;
+
+   if (m->m_pkthdr.csum_flags & CSUM_UDP) {
+   /* if udp header is not in the first mbuf copy udplen */
+   if (offset + sizeof(struct udphdr) > m->m_len)
+   m_copydata(m, offset + offsetof(struct udphdr, uh_ulen),
+   2, (caddr_t));
+   else {
+   uh = (struct udphdr *)((caddr_t)ip + offset);
+   cklen = ntohs(uh->uh_ulen);
+   }
+   csum = in_cksum_skip(m, cklen + offset, offset);
+   if (csum == 0)
+   csum = 0x;
+   } else {
+   cklen = ntohs(ip->ip_len);
+   csum = in_cksum_skip(m, cklen, offset);
+   }
offset += m->m_pkthdr.csum_data;/* checksum offset */
 
/* find the mbuf in the chain where the checksum starts*/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334557 - head/usr.bin/top

2018-06-06 Thread Eitan Adler
On 3 June 2018 at 22:42, Baptiste Daroussin  wrote:
> On Sun, Jun 03, 2018 at 01:41:24PM +, Eitan Adler wrote:
>> Author: eadler
>> Date: Sun Jun  3 13:41:23 2018
>> New Revision: 334557
>> URL: https://svnweb.freebsd.org/changeset/base/334557
>>
>> Log:
>>   top(1): restore size for kern.cp_times
>>
>>   Restore last minute change that broke top(1).
>>
>> Modified:
>>   head/usr.bin/top/machine.c
>>
>> Modified: head/usr.bin/top/machine.c
>> ==
>> --- head/usr.bin/top/machine.cSun Jun  3 13:40:58 2018
>> (r334556)
>> +++ head/usr.bin/top/machine.cSun Jun  3 13:41:23 2018
>> (r334557)
>> @@ -384,6 +384,7 @@ machine_init(struct statics *statics)
>>   times = calloc(maxcpu * CPUSTATES, sizeof(long));
>>   if (times == NULL)
>>   err(1, "calloc %zu bytes", size);
>> + size = sizeof(long) * maxcpu * CPUSTATES;
>
> The error message just above might also be unhappy about the size variable :)

r334704 - thanks!




-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334704 - head/usr.bin/top

2018-06-06 Thread Eitan Adler
Author: eadler
Date: Wed Jun  6 06:42:12 2018
New Revision: 334704
URL: https://svnweb.freebsd.org/changeset/base/334704

Log:
  top(1): make error message happy
  
  We don't use a "size" variable, so just don't report it.
  
  Reported by:  bapt

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Wed Jun  6 05:17:21 2018(r334703)
+++ head/usr.bin/top/machine.c  Wed Jun  6 06:42:12 2018(r334704)
@@ -379,7 +379,7 @@ machine_init(struct statics *statics)
GETSYSCTL("kern.smp.maxcpus", maxcpu);
times = calloc(maxcpu * CPUSTATES, sizeof(long));
if (times == NULL)
-   err(1, "calloc %zu bytes", size);
+   err(1, "calloc for kern.smp.maxcpus", size);
size = sizeof(long) * maxcpu * CPUSTATES;
if (sysctlbyname("kern.cp_times", times, , NULL, 0) == -1)
err(1, "sysctlbyname kern.cp_times");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"