svn commit: r303655 - head/sys/kern

2016-08-01 Thread Mateusz Guzik
Author: mjg
Date: Tue Aug  2 03:05:59 2016
New Revision: 303655
URL: https://svnweb.freebsd.org/changeset/base/303655

Log:
  locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case
  
  Reported by:  Michael Butler 

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Tue Aug  2 02:32:00 2016(r303654)
+++ head/sys/kern/kern_mutex.c  Tue Aug  2 03:05:59 2016(r303655)
@@ -452,8 +452,10 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_MUTEXES)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
m = mtxlock2mtx(c);
 

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Tue Aug  2 02:32:00 2016(r303654)
+++ head/sys/kern/kern_rwlock.c Tue Aug  2 03:05:59 2016(r303655)
@@ -396,8 +396,10 @@ __rw_rlock(volatile uintptr_t *c, const 
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
rw = rwlock2rw(c);
 
@@ -782,8 +784,10 @@ __rw_wlock_hard(volatile uintptr_t *c, u
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
rw = rwlock2rw(c);
 

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Tue Aug  2 02:32:00 2016(r303654)
+++ head/sys/kern/kern_sx.c Tue Aug  2 03:05:59 2016(r303655)
@@ -554,8 +554,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
 
/* If we already hold an exclusive lock, then recurse. */
@@ -861,8 +863,10 @@ _sx_slock_hard(struct sx *sx, int opts, 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX)
lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, NULL);
 #endif
 #ifdef KDTRACE_HOOKS
state = sx->sx_lock;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Conrad Meyer
That would be difficult, as this is completely dead code in base.  It
could be accessed through the /dev/crypto device by a port, however.
You haven't convinced me there is a security issue.

Cheers,
Conrad

On Mon, Aug 1, 2016 at 4:58 PM, Shawn Webb  wrote:
> Adding CTurt to see if he wants to take a stab at writing a PoC exploit.
> It'd be cool for an offensive researcher to determine if it's simply a
> DoS. But regardless, a security fix is a security fix. All
> currently-supported branches really should be updated.
>
> Thanks,
>
> Shawn
>
> On Mon, Aug 01, 2016 at 04:41:02PM -0700, Conrad Meyer wrote:
>> Hey Shawn,
>>
>> I don't think this is security-related despite being a bug in
>> crypto-adjacent code.  At best it's a DoS, I think.
>>
>> Cheers,
>> Conrad
>>
>> On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb  
>> wrote:
>> > -BEGIN PGP SIGNED MESSAGE-
>> > Hash: SHA512
>> >
>> >
>> >
>> > On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer"  
>> > wrote:
>> >>Author: cem
>> >>Date: Mon Aug  1 22:57:03 2016
>> >>New Revision: 303650
>> >>URL: https://svnweb.freebsd.org/changeset/base/303650
>> >>
>> >>Log:
>> >>  opencrypto AES-ICM: Fix heap corruption typo
>> >>
>> >>This error looks like it was a simple copy-paste typo in the original
>> >>commit
>> >>  for this code (r275732).
>> >>
>> >>  PR:  204009
>> >>  Reported by: Chang-Hsien Tsai 
>> >>  Sponsored by:EMC / Isilon Storage
>> >
>> > Since cem@ refuses to MFC even security fixes, can someone with a commit 
>> > bit please MFC this within normal security-related MFC timeframe? 
>> > Additionally, does a security advisory need to be sent out? CC'ing 
>> > secteam@.
>> >
>> > Thanks,
>> >
>> > Shawn
>> >
>> > - --
>> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
>> > -BEGIN PGP SIGNATURE-
>> > Version: APG v1.1.1
>> >
>> > iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m
>> > bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI
>> > FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa
>> > UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS
>> > cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht
>> > 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx
>> > IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v
>> > x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6
>> > UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os
>> > rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8
>> > ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk
>> > 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3
>> > +YQ=
>> > =B3c1
>> > -END PGP SIGNATURE-
>> >
>> >
>
> --
> Shawn Webb
> Cofounder and Security Engineer
> HardenedBSD
>
> GPG Key ID:  0x6A84658F52456EEE
> GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303652 - head/sys/kern

2016-08-01 Thread Mateusz Guzik
Author: mjg
Date: Tue Aug  2 00:15:08 2016
New Revision: 303652
URL: https://svnweb.freebsd.org/changeset/base/303652

Log:
  locks: fix up ifdef guards introduced in r303643
  
  Both sx and rwlocks had copy-pasted ADAPTIVE_MUTEXES instead of the correct
  define.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Mon Aug  1 23:07:31 2016(r303651)
+++ head/sys/kern/kern_rwlock.c Tue Aug  2 00:15:08 2016(r303652)
@@ -383,7 +383,7 @@ __rw_rlock(volatile uintptr_t *c, const 
int contested = 0;
 #endif
uintptr_t v;
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -396,7 +396,7 @@ __rw_rlock(volatile uintptr_t *c, const 
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
rw = rwlock2rw(c);
@@ -769,7 +769,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u
uint64_t waittime = 0;
int contested = 0;
 #endif
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -782,7 +782,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
rw = rwlock2rw(c);

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Mon Aug  1 23:07:31 2016(r303651)
+++ head/sys/kern/kern_sx.c Tue Aug  2 00:15:08 2016(r303652)
@@ -541,7 +541,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
int contested = 0;
 #endif
int error = 0;
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -554,7 +554,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
 
@@ -848,7 +848,7 @@ _sx_slock_hard(struct sx *sx, int opts, 
 #endif
uintptr_t x;
int error = 0;
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
struct lock_delay_arg lda;
 #endif
 #ifdef KDTRACE_HOOKS
@@ -861,7 +861,7 @@ _sx_slock_hard(struct sx *sx, int opts, 
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS)
lock_delay_arg_init(, _delay);
 #endif
 #ifdef KDTRACE_HOOKS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Conrad Meyer
Hey Shawn,

I don't think this is security-related despite being a bug in
crypto-adjacent code.  At best it's a DoS, I think.

Cheers,
Conrad

On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
>
>
> On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer"  wrote:
>>Author: cem
>>Date: Mon Aug  1 22:57:03 2016
>>New Revision: 303650
>>URL: https://svnweb.freebsd.org/changeset/base/303650
>>
>>Log:
>>  opencrypto AES-ICM: Fix heap corruption typo
>>
>>This error looks like it was a simple copy-paste typo in the original
>>commit
>>  for this code (r275732).
>>
>>  PR:  204009
>>  Reported by: Chang-Hsien Tsai 
>>  Sponsored by:EMC / Isilon Storage
>
> Since cem@ refuses to MFC even security fixes, can someone with a commit bit 
> please MFC this within normal security-related MFC timeframe? Additionally, 
> does a security advisory need to be sent out? CC'ing secteam@.
>
> Thanks,
>
> Shawn
>
> - --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> -BEGIN PGP SIGNATURE-
> Version: APG v1.1.1
>
> iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m
> bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI
> FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa
> UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS
> cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht
> 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx
> IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v
> x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6
> UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os
> rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8
> ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk
> 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3
> +YQ=
> =B3c1
> -END PGP SIGNATURE-
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Shawn Webb
Adding CTurt to see if he wants to take a stab at writing a PoC exploit.
It'd be cool for an offensive researcher to determine if it's simply a
DoS. But regardless, a security fix is a security fix. All
currently-supported branches really should be updated.

Thanks,

Shawn

On Mon, Aug 01, 2016 at 04:41:02PM -0700, Conrad Meyer wrote:
> Hey Shawn,
> 
> I don't think this is security-related despite being a bug in
> crypto-adjacent code.  At best it's a DoS, I think.
> 
> Cheers,
> Conrad
> 
> On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb  wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA512
> >
> >
> >
> > On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer"  
> > wrote:
> >>Author: cem
> >>Date: Mon Aug  1 22:57:03 2016
> >>New Revision: 303650
> >>URL: https://svnweb.freebsd.org/changeset/base/303650
> >>
> >>Log:
> >>  opencrypto AES-ICM: Fix heap corruption typo
> >>
> >>This error looks like it was a simple copy-paste typo in the original
> >>commit
> >>  for this code (r275732).
> >>
> >>  PR:  204009
> >>  Reported by: Chang-Hsien Tsai 
> >>  Sponsored by:EMC / Isilon Storage
> >
> > Since cem@ refuses to MFC even security fixes, can someone with a commit 
> > bit please MFC this within normal security-related MFC timeframe? 
> > Additionally, does a security advisory need to be sent out? CC'ing secteam@.
> >
> > Thanks,
> >
> > Shawn
> >
> > - --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> > -BEGIN PGP SIGNATURE-
> > Version: APG v1.1.1
> >
> > iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m
> > bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI
> > FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa
> > UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS
> > cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht
> > 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx
> > IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v
> > x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6
> > UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os
> > rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8
> > ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk
> > 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3
> > +YQ=
> > =B3c1
> > -END PGP SIGNATURE-
> >
> >

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


svn commit: r303651 - head/sys/net

2016-08-01 Thread Conrad E. Meyer
Author: cem
Date: Mon Aug  1 23:07:31 2016
New Revision: 303651
URL: https://svnweb.freebsd.org/changeset/base/303651

Log:
  rtentry: Initialize rt_mtx with MTX_NEW
  
  The "rtentry" zone does not use UMA_ZONE_ZINIT, so it is invalid to assume the
  mutex's memory will be zero.  Without MTX_NEW, garbage backing memory may
  trigger the "re-initializing a mutex" assertion.
  
  PR:   200991
  Submitted by: Chang-Hsien Tsai 

Modified:
  head/sys/net/route.h

Modified: head/sys/net/route.h
==
--- head/sys/net/route.hMon Aug  1 22:57:03 2016(r303650)
+++ head/sys/net/route.hMon Aug  1 23:07:31 2016(r303651)
@@ -360,7 +360,7 @@ struct rt_addrinfo {
 || (ifp)->if_link_state == LINK_STATE_UP)
 
 #defineRT_LOCK_INIT(_rt) \
-   mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK)
+   mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW)
 #defineRT_LOCK(_rt)mtx_lock(&(_rt)->rt_mtx)
 #defineRT_UNLOCK(_rt)  mtx_unlock(&(_rt)->rt_mtx)
 #defineRT_LOCK_DESTROY(_rt)mtx_destroy(&(_rt)->rt_mtx)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-01 Thread Mateusz Guzik
On Mon, Aug 01, 2016 at 09:48:37PM +, Mateusz Guzik wrote:
>   Implement trivial backoff for locking primitives.
>   
[..]
>   For simplicity, this first thouch implementation only modifies spinning
>   loops where the lock owner is running. spin mutexes and thread lock were
>   not modified.
>   

What maybe I should have noted in the commit message.

This is a perfectly MFCable and much needed band-aid, which will later
be extended to cover the rest of the loops and other primitives.

There are several approaches which give better results but are also
significantly more complicated to implement. Until a suitable approach
is worked out and tested, the work here hopefully helps enough.

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


svn commit: r303650 - head/sys/opencrypto

2016-08-01 Thread Conrad E. Meyer
Author: cem
Date: Mon Aug  1 22:57:03 2016
New Revision: 303650
URL: https://svnweb.freebsd.org/changeset/base/303650

Log:
  opencrypto AES-ICM: Fix heap corruption typo
  
  This error looks like it was a simple copy-paste typo in the original commit
  for this code (r275732).
  
  PR:   204009
  Reported by:  Chang-Hsien Tsai 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/opencrypto/xform_aes_icm.c

Modified: head/sys/opencrypto/xform_aes_icm.c
==
--- head/sys/opencrypto/xform_aes_icm.c Mon Aug  1 22:53:28 2016
(r303649)
+++ head/sys/opencrypto/xform_aes_icm.c Mon Aug  1 22:57:03 2016
(r303650)
@@ -65,7 +65,7 @@ struct enc_xform enc_xform_aes_icm = {
aes_icm_crypt,
aes_icm_crypt,
aes_icm_setkey,
-   rijndael128_zerokey,
+   aes_icm_zerokey,
aes_icm_reinit,
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303648 - head/sys/ddb

2016-08-01 Thread Conrad E. Meyer
Author: cem
Date: Mon Aug  1 22:41:50 2016
New Revision: 303648
URL: https://svnweb.freebsd.org/changeset/base/303648

Log:
  Fix ddb "show proc" to show full arguments
  
  PR:   200052
  Submitted by: Chang-Hsien Tsai 

Modified:
  head/sys/ddb/db_ps.c

Modified: head/sys/ddb/db_ps.c
==
--- head/sys/ddb/db_ps.cMon Aug  1 22:39:51 2016(r303647)
+++ head/sys/ddb/db_ps.cMon Aug  1 22:41:50 2016(r303648)
@@ -440,9 +440,16 @@ DB_SHOW_COMMAND(proc, db_show_proc)
p->p_leader);
if (p->p_sysent != NULL)
db_printf(" ABI: %s\n", p->p_sysent->sv_name);
-   if (p->p_args != NULL)
-   db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length,
-   p->p_args->ar_args);
+   if (p->p_args != NULL) {
+   db_printf(" arguments: ");
+   for (i = 0; i < (int)p->p_args->ar_length; i++) {
+   if (p->p_args->ar_args[i] == '\0')
+   db_printf(" ");
+   else
+   db_printf("%c", p->p_args->ar_args[i]);
+   }
+   db_printf("\n");
+   }
db_printf(" threads: %d\n", p->p_numthreads);
FOREACH_THREAD_IN_PROC(p, td) {
dumpthread(p, td, 1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303647 - in head/sys/dev/cxgbe: . iw_cxgbe

2016-08-01 Thread John Baldwin
Author: jhb
Date: Mon Aug  1 22:39:51 2016
New Revision: 303647
URL: https://svnweb.freebsd.org/changeset/base/303647

Log:
  Store the offset of the KDOORBELL and GTS registers in the softc.
  
  VF devices use a different register layout than PF devices.  Storing
  the offset in a value in the softc allows code to be shared between the
  PF and VF drivers.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7389

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/iw_cxgbe/cq.c
  head/sys/dev/cxgbe/iw_cxgbe/qp.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_netmap.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/adapter.hMon Aug  1 22:39:51 2016
(r303647)
@@ -781,6 +781,8 @@ struct adapter {
struct sge_rxq *rxq;
struct sge_nm_rxq *nm_rxq;
} __aligned(CACHE_LINE_SIZE) *irq;
+   int sge_gts_reg;
+   int sge_kdoorbell_reg;
 
bus_dma_tag_t dmat; /* Parent DMA tag */
 

Modified: head/sys/dev/cxgbe/iw_cxgbe/cq.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cq.cMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/iw_cxgbe/cq.cMon Aug  1 22:39:51 2016
(r303647)
@@ -172,7 +172,7 @@ create_cq(struct c4iw_rdev *rdev, struct
 
cq->gen = 1;
cq->gts = (void *)((unsigned long)rman_get_virtual(sc->regs_res) +
-   MYPF_REG(SGE_PF_GTS));
+   sc->sge_gts_reg);
cq->rdev = rdev;
 
if (user) {

Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/qp.cMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/iw_cxgbe/qp.cMon Aug  1 22:39:51 2016
(r303647)
@@ -182,9 +182,9 @@ static int create_qp(struct c4iw_rdev *r
pci_unmap_addr_set(>rq, mapping, wq->rq.dma_addr);
 
wq->db = (void *)((unsigned long)rman_get_virtual(sc->regs_res) +
-   MYPF_REG(SGE_PF_KDOORBELL));
+   sc->sge_kdoorbell_reg);
wq->gts = (void *)((unsigned long)rman_get_virtual(rdev->adap->regs_res)
-  + MYPF_REG(SGE_PF_GTS));
+  + sc->sge_gts_reg);
if (user) {
wq->sq.udb = 
(u64)((char*)rman_get_virtual(rdev->adap->udbs_res) +
(wq->sq.qid << rdev->qpshift));

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cMon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/t4_main.cMon Aug  1 22:39:51 2016
(r303647)
@@ -697,6 +697,8 @@ t4_attach(device_t dev)
sc->params.pci.mps = 128 << ((v & PCIEM_CTL_MAX_PAYLOAD) >> 5);
}
 
+   sc->sge_gts_reg = MYPF_REG(A_SGE_PF_GTS);
+   sc->sge_kdoorbell_reg = MYPF_REG(A_SGE_PF_KDOORBELL);
sc->traceq = -1;
mtx_init(>ifp_lock, sc->ifp_lockname, 0, MTX_DEF);
snprintf(sc->ifp_lockname, sizeof(sc->ifp_lockname), "%s tracer",

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Mon Aug  1 22:22:11 2016
(r303646)
+++ head/sys/dev/cxgbe/t4_netmap.c  Mon Aug  1 22:39:51 2016
(r303647)
@@ -204,7 +204,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, str
}
}
 
-   t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS),
+   t4_write_reg(sc, sc->sge_gts_reg,
V_INGRESSQID(nm_rxq->iq_cntxt_id) |
V_SEINTARM(V_QINTR_TIMER_IDX(holdoff_tmr_idx)));
 
@@ -364,7 +364,7 @@ cxgbe_netmap_on(struct adapter *sc, stru
MPASS((j & 7) == 0);
j /= 8; /* driver pidx to hardware pidx */
wmb();
-   t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL),
+   t4_write_reg(sc, sc->sge_kdoorbell_reg,
nm_rxq->fl_db_val | V_PIDX(j));
 
atomic_cmpset_int(>nm_state, NM_OFF, NM_ON);
@@ -537,7 +537,7 @@ ring_nm_txq_db(struct adapter *sc, struc
break;
 
case DOORBELL_KDB:
-   t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL),
+   t4_write_reg(sc, sc->sge_kdoorbell_reg,
V_QID(nm_txq->cntxt_id) | V_PIDX(n));
break;
}
@@ -818,7 +818,7 @@ cxgbe_netmap_rxsync(struct netmap_kring 
}
if (++dbinc == 8 && n >= 32) {
wmb();
-   t4_write_reg(sc, 

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

2016-08-01 Thread Mark Johnston
Author: markj
Date: Mon Aug  1 22:22:11 2016
New Revision: 303646
URL: https://svnweb.freebsd.org/changeset/base/303646

Log:
  ipoib: Bound the number of egress mbufs buffered during pathrec lookups.
  
  In pathological situations where the master subnet manager becomes
  unresponsive for an extended period, we may otherwise end up queuing all
  of the system's mbufs while waiting for a response to a path record lookup.
  
  This addresses the same issue as commit 1e85b806f9 in Linux.
  
  Reviewed by:  cem, ngie
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug  1 
22:19:23 2016(r303645)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug  1 
22:22:11 2016(r303646)
@@ -660,7 +660,13 @@ ipoib_unicast_send(struct mbuf *mb, stru
new_path = 1;
}
if (path) {
-   _IF_ENQUEUE(>queue, mb);
+   if (_IF_QLEN(>queue) < IPOIB_MAX_PATH_REC_QUEUE)
+   _IF_ENQUEUE(>queue, mb);
+   else {
+   if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
+   m_freem(mb);
+   }
+
if (!path->query && path_rec_start(priv, path)) {
spin_unlock_irqrestore(>lock, flags);
if (new_path)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-01 Thread John Baldwin
Author: jhb
Date: Mon Aug  1 22:19:23 2016
New Revision: 303645
URL: https://svnweb.freebsd.org/changeset/base/303645

Log:
  Disable PCI hotplug support for slots with power controllers.
  
  After further review of the spec, I do not think the current HotPlug
  code handles slots with power controllers correctly.  In particular,
  the power state of the slot is to be inferred from other events, not
  from examining the state of the power control bit in SLOT_CTL.  For now,
  disable PCI hotplug support on such slots.
  
  PR:   211081
  Tested by:Jeffrey E Pieper 
  MFC after:3 days

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

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Mon Aug  1 21:49:35 2016(r303644)
+++ head/sys/dev/pci/pci_pci.c  Mon Aug  1 22:19:23 2016(r303645)
@@ -932,6 +932,13 @@ pcib_probe_hotplug(struct pcib_softc *sc
sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4);
sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4);
 
+   /*
+* XXX: Handling of slots with a power controller needs to be
+* reexamined.  Ignore hotplug on such slots for now.
+*/
+   if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP)
+   return;
+   
if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC)
sc->flags |= PCIB_HOTPLUG;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-01 Thread Mateusz Guzik
Author: mjg
Date: Mon Aug  1 21:48:37 2016
New Revision: 303643
URL: https://svnweb.freebsd.org/changeset/base/303643

Log:
  Implement trivial backoff for locking primitives.
  
  All current spinning loops retry an atomic op the first chance they get,
  which leads to performance degradation under load.
  
  One classic solution to the problem consists of delaying the test to an
  extent. This implementation has a trivial linear increment and a random
  factor for each attempt.
  
  For simplicity, this first thouch implementation only modifies spinning
  loops where the lock owner is running. spin mutexes and thread lock were
  not modified.
  
  Current parameters are autotuned on boot based on mp_cpus.
  
  Autotune factors are very conservative and are subject to change later.
  
  Reviewed by:  kib, jhb
  Tested by:pho
  MFC after:1 week

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/kern/subr_lock.c
  head/sys/sys/lock.h

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Mon Aug  1 21:28:34 2016(r303642)
+++ head/sys/kern/kern_mutex.c  Mon Aug  1 21:48:37 2016(r303643)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -138,6 +139,37 @@ struct lock_class lock_class_mtx_spin = 
 #endif
 };
 
+#ifdef ADAPTIVE_MUTEXES
+static SYSCTL_NODE(_debug, OID_AUTO, mtx, CTLFLAG_RD, NULL, "mtx debugging");
+
+static struct lock_delay_config mtx_delay = {
+   .initial= 1000,
+   .step   = 500,
+   .min= 100,
+   .max= 5000,
+};
+
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_initial, CTLFLAG_RW, _delay.initial,
+0, "");
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_step, CTLFLAG_RW, _delay.step,
+0, "");
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_min, CTLFLAG_RW, _delay.min,
+0, "");
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_max, CTLFLAG_RW, _delay.max,
+0, "");
+
+static void
+mtx_delay_sysinit(void *dummy)
+{
+
+   mtx_delay.initial = mp_ncpus * 25;
+   mtx_delay.step = (mp_ncpus * 25) / 2;
+   mtx_delay.min = mp_ncpus * 5;
+   mtx_delay.max = mp_ncpus * 25 * 10;
+}
+LOCK_DELAY_SYSINIT(mtx_delay_sysinit);
+#endif
+
 /*
  * System-wide mutexes
  */
@@ -408,8 +440,10 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
int contested = 0;
uint64_t waittime = 0;
 #endif
+#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+   struct lock_delay_arg lda;
+#endif
 #ifdef KDTRACE_HOOKS
-   u_int spin_cnt = 0;
u_int sleep_cnt = 0;
int64_t sleep_time = 0;
int64_t all_time = 0;
@@ -418,6 +452,9 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
if (SCHEDULER_STOPPED())
return;
 
+#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS)
+   lock_delay_arg_init(, _delay);
+#endif
m = mtxlock2mtx(c);
 
if (mtx_owned(m)) {
@@ -451,7 +488,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
if (m->mtx_lock == MTX_UNOWNED && _mtx_obtain_lock(m, tid))
break;
 #ifdef KDTRACE_HOOKS
-   spin_cnt++;
+   lda.spin_cnt++;
 #endif
 #ifdef ADAPTIVE_MUTEXES
/*
@@ -471,12 +508,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
"spinning", "lockname:\"%s\"",
m->lock_object.lo_name);
while (mtx_owner(m) == owner &&
-   TD_IS_RUNNING(owner)) {
-   cpu_spinwait();
-#ifdef KDTRACE_HOOKS
-   spin_cnt++;
-#endif
-   }
+   TD_IS_RUNNING(owner))
+   lock_delay();
KTR_STATE0(KTR_SCHED, "thread",
sched_tdname((struct thread *)tid),
"running");
@@ -570,7 +603,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
/*
 * Only record the loops spinning and not sleeping. 
 */
-   if (spin_cnt > sleep_cnt)
+   if (lda.spin_cnt > sleep_cnt)
LOCKSTAT_RECORD1(adaptive__spin, m, all_time - sleep_time);
 #endif
 }

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Mon Aug  1 21:28:34 2016(r303642)
+++ head/sys/kern/kern_rwlock.c Mon Aug  1 21:48:37 2016(r303643)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -65,15 +66,6 @@ PMC_SOFT_DECLARE( , , lock, failed);
  */
 #definerwlock2rw(c)(__containerof(c, struct rwlock, rw_lock))
 
-#ifdef ADAPTIVE_RWLOCKS
-static 

svn commit: r303638 - head/sys/dev/e1000

2016-08-01 Thread Sean Bruno
Author: sbruno
Date: Mon Aug  1 21:19:51 2016
New Revision: 303638
URL: https://svnweb.freebsd.org/changeset/base/303638

Log:
  r293331 mistakingly failed to add an assignment of paddr to the rxbuf
  but only in the NETMAP code.  This lead to the NETMAP code paths
  passing nothing up to userland.
  
  Submitted by: Ad Schellevis 
  Reported by:  Franco Fichtner 
  MFC after:1 day

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Mon Aug  1 20:54:54 2016(r303637)
+++ head/sys/dev/e1000/if_em.c  Mon Aug  1 21:19:51 2016(r303638)
@@ -4392,6 +4392,7 @@ em_setup_receive_ring(struct rx_ring *rx
 
addr = PNMB(na, slot + si, );
netmap_load_map(na, rxr->rxtag, rxbuf->map, addr);
+   rxbuf->paddr = paddr;
em_setup_rxdesc(>rx_base[j], rxbuf);
continue;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303637 - head/sys/geom

2016-08-01 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug  1 20:54:54 2016
New Revision: 303637
URL: https://svnweb.freebsd.org/changeset/base/303637

Log:
  Do not invoke resize event if initial disk size is zero. Some disks
  report the size only after first opening.  And due to the events are
  asynchronous, some consumers can receive this event too late and
  this confuses them. This partially restores previous behaviour, and
  at the same time this should fix the problem, when already opened
  provider loses resize event.
  
  PR:   211028
  MFC after:3 weeks

Modified:
  head/sys/geom/geom_disk.c

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Mon Aug  1 20:29:09 2016(r303636)
+++ head/sys/geom/geom_disk.c   Mon Aug  1 20:54:54 2016(r303637)
@@ -142,7 +142,14 @@ g_disk_access(struct g_provider *pp, int
pp->stripeoffset = dp->d_stripeoffset;
pp->stripesize = dp->d_stripesize;
dp->d_flags |= DISKFLAG_OPEN;
-   g_resize_provider(pp, dp->d_mediasize);
+   /*
+* Do not invoke resize event when initial size was zero.
+* Some disks report its size only after first opening.
+*/
+   if (pp->mediasize == 0)
+   pp->mediasize = dp->d_mediasize;
+   else
+   g_resize_provider(pp, dp->d_mediasize);
} else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) {
if (dp->d_close != NULL) {
error = dp->d_close(dp);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303636 - head/sys/ofed/drivers/infiniband/core

2016-08-01 Thread Mark Johnston
Author: markj
Date: Mon Aug  1 20:29:09 2016
New Revision: 303636
URL: https://svnweb.freebsd.org/changeset/base/303636

Log:
  MFV be9130cc9: "IB/cma: Check for GID on listening devices first"
  
  This is an optimization that improves IB connection setup times.
  
  Discussed with:   hselasky
  Obtained from:Linux
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/ofed/drivers/infiniband/core/cma.c

Modified: head/sys/ofed/drivers/infiniband/core/cma.c
==
--- head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:27:11 2016
(r303635)
+++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:29:09 2016
(r303636)
@@ -479,7 +479,8 @@ err:
 }
 EXPORT_SYMBOL(rdma_find_cmid_laddr);
 
-static int cma_acquire_dev(struct rdma_id_private *id_priv)
+static int cma_acquire_dev(struct rdma_id_private *id_priv,
+  struct rdma_id_private *listen_id_priv)
 {
struct rdma_dev_addr *dev_addr = _priv->id.route.addr.dev_addr;
struct cma_device *cma_dev;
@@ -499,8 +500,30 @@ static int cma_acquire_dev(struct rdma_i
 
memcpy(, dev_addr->src_dev_addr +
   rdma_addr_gid_offset(dev_addr), sizeof gid);
+   if (listen_id_priv &&
+   rdma_port_get_link_layer(listen_id_priv->id.device,
+listen_id_priv->id.port_num) == dev_ll) {
+   cma_dev = listen_id_priv->cma_dev;
+   port = listen_id_priv->id.port_num;
+   if (rdma_node_get_transport(cma_dev->device->node_type) == 
RDMA_TRANSPORT_IB &&
+   rdma_port_get_link_layer(cma_dev->device, port) == 
IB_LINK_LAYER_ETHERNET)
+   ret = ib_find_cached_gid(cma_dev->device, _gid,
+_port, NULL);
+   else
+   ret = ib_find_cached_gid(cma_dev->device, ,
+_port, NULL);
+
+   if (!ret && (port  == found_port)) {
+   id_priv->id.port_num = found_port;
+   goto out;
+   }
+   }
list_for_each_entry(cma_dev, _list, list) {
-   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port)
+   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) {
+   if (listen_id_priv &&
+   listen_id_priv->cma_dev == cma_dev &&
+   listen_id_priv->id.port_num == port)
+   continue;
if (rdma_port_get_link_layer(cma_dev->device, port) == 
dev_ll) {
if 
(rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB &&
rdma_port_get_link_layer(cma_dev->device, 
port) == IB_LINK_LAYER_ETHERNET)
@@ -514,6 +537,7 @@ static int cma_acquire_dev(struct rdma_i
} else if (ret == 1)
break;
}
+   }
}
 
 out:
@@ -1423,7 +1447,7 @@ static int cma_req_handler(struct ib_cm_
}
 
mutex_lock_nested(_id->handler_mutex, SINGLE_DEPTH_NESTING);
-   ret = cma_acquire_dev(conn_id);
+   ret = cma_acquire_dev(conn_id, listen_id);
if (ret)
goto err2;
 
@@ -1656,7 +1680,7 @@ static int iw_conn_req_handler(struct iw
goto out;
}
 
-   ret = cma_acquire_dev(conn_id);
+   ret = cma_acquire_dev(conn_id, listen_id);
if (ret) {
mutex_unlock(_id->handler_mutex);
rdma_destroy_id(new_cm_id);
@@ -2218,7 +2242,7 @@ static void addr_handler(int status, str
memcpy(_priv->id.route.addr.src_addr, src_addr,
   ip_addr_size(src_addr));
if (!status && !id_priv->cma_dev)
-   status = cma_acquire_dev(id_priv);
+   status = cma_acquire_dev(id_priv, NULL);
 
if (status) {
if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_RESOLVED,
@@ -2744,7 +2768,7 @@ int rdma_bind_addr(struct rdma_cm_id *id
if (ret)
goto err1;
 
-   ret = cma_acquire_dev(id_priv);
+   ret = cma_acquire_dev(id_priv, NULL);
if (ret)
goto err1;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303635 - head/sys/ofed/drivers/infiniband/core

2016-08-01 Thread Mark Johnston
Author: markj
Date: Mon Aug  1 20:27:11 2016
New Revision: 303635
URL: https://svnweb.freebsd.org/changeset/base/303635

Log:
  MFV 29f27e847: "IB/cma: Use cached gids"
  
  This addresses a regression from an earlier upstream change which caused
  cma_acquire_dev() to bypass the port GID cache and instead query the HCA
  for each entry in its GID table. These queries can become extremely slow on
  multiport devices, which has a negative impact on connection setup times.
  
  Discussed with:   hselasky
  Obtained from:Linux
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/ofed/drivers/infiniband/core/cma.c

Modified: head/sys/ofed/drivers/infiniband/core/cma.c
==
--- head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:02:59 2016
(r303634)
+++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug  1 20:27:11 2016
(r303635)
@@ -485,7 +485,7 @@ static int cma_acquire_dev(struct rdma_i
struct cma_device *cma_dev;
union ib_gid gid, iboe_gid;
int ret = -ENODEV;
-   u8 port;
+   u8 port, found_port;
enum rdma_link_layer dev_ll = dev_addr->dev_type == ARPHRD_INFINIBAND ?
IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET;
 
@@ -500,21 +500,20 @@ static int cma_acquire_dev(struct rdma_i
memcpy(, dev_addr->src_dev_addr +
   rdma_addr_gid_offset(dev_addr), sizeof gid);
list_for_each_entry(cma_dev, _list, list) {
-   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) {
+   for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port)
if (rdma_port_get_link_layer(cma_dev->device, port) == 
dev_ll) {
if 
(rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB &&
rdma_port_get_link_layer(cma_dev->device, 
port) == IB_LINK_LAYER_ETHERNET)
-   ret = find_gid_port(cma_dev->device, 
_gid, port);
+   ret = 
ib_find_cached_gid(cma_dev->device, _gid, _port, NULL);
else
-   ret = find_gid_port(cma_dev->device, 
, port);
+   ret = 
ib_find_cached_gid(cma_dev->device, , _port, NULL);
 
-   if (!ret) {
+   if (!ret && (port == found_port)) {
id_priv->id.port_num = port;
goto out;
} else if (ret == 1)
-   break;
-   }
-   }
+   break;
+   }
}
 
 out:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303631 - head/usr.sbin/bsdinstall/scripts

2016-08-01 Thread Dimitry Andric
Author: dim
Date: Mon Aug  1 19:49:42 2016
New Revision: 303631
URL: https://svnweb.freebsd.org/changeset/base/303631

Log:
  Fix non-functional bsdinstall services dialog.
  
  The most recent version of bsdinstall does not seem to respect any of
  the checkboxes in the "Choose the services you would like to be started
  at boot" dialog.  None of the chosen services end up in the rc.conf file
  that is installed onto the target system.
  
  This is caused by the bsdinstall/scripts/hardening script, which
  implements the new hardening options dialog.  The script starts by
  overwriting the previously written rc.conf.services file:
  
  echo -n > $BSDINSTALL_TMPETC/rc.conf.services
  
  which is obviously incorrect.  It should clear out rc.conf.hardening
  instead.
  
  Reviewed by:  allanjude
  PR:   211506
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D7387

Modified:
  head/usr.sbin/bsdinstall/scripts/hardening

Modified: head/usr.sbin/bsdinstall/scripts/hardening
==
--- head/usr.sbin/bsdinstall/scripts/hardening  Mon Aug  1 19:37:43 2016
(r303630)
+++ head/usr.sbin/bsdinstall/scripts/hardening  Mon Aug  1 19:49:42 2016
(r303631)
@@ -28,7 +28,7 @@
 
 : ${DIALOG_OK=0}
 
-echo -n > $BSDINSTALL_TMPETC/rc.conf.services
+echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening
 
 exec 3>&1
 FEATURES=$( dialog --backtitle "FreeBSD Installer" \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303630 - in head/sys: boot/zfs cddl/boot/zfs

2016-08-01 Thread Allan Jude
Author: allanjude
Date: Mon Aug  1 19:37:43 2016
New Revision: 303630
URL: https://svnweb.freebsd.org/changeset/base/303630

Log:
  Make boot code and loader check for unsupported ZFS feature flags
  
  OpenZFS uses feature flags instead of a zpool version number to track
  features since the split from Oracle. In addition to avoiding confusion
  on ZFS vs OpenZFS version numbers, this also allows features to be added
  to different operating systems that use OpenZFS in different order.
  
  The previous zfs boot code (gptzfsboot) and loader (zfsloader) blindly
  tries to read the pool, and if failed provided only a vague error message.
  
  With this change, both the boot code and loader check the MOS features
  list in the ZFS label and compare it against the list of features that
  the loader supports. If any unsupported feature is active, the pool is
  not considered as a candidate for booting, and a helpful diagnostic
  message is printed to the screen. Features that are merely enabled via
  zpool upgrade, but not in use, do not block booting from the pool.
  
  Submitted by: Toomas Soome 
  Reviewed by:  delphij, mav
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D6857

Modified:
  head/sys/boot/zfs/libzfs.h
  head/sys/boot/zfs/zfs.c
  head/sys/boot/zfs/zfsimpl.c
  head/sys/cddl/boot/zfs/zfsimpl.h

Modified: head/sys/boot/zfs/libzfs.h
==
--- head/sys/boot/zfs/libzfs.h  Mon Aug  1 19:24:01 2016(r303629)
+++ head/sys/boot/zfs/libzfs.h  Mon Aug  1 19:37:43 2016(r303630)
@@ -65,7 +65,7 @@ int   zfs_probe_dev(const char *devname, u
 intzfs_list(const char *name);
 void   init_zfs_bootenv(char *currdev);
 intzfs_bootenv(const char *name);
-intzfs_belist_add(const char *name);
+intzfs_belist_add(const char *name, uint64_t __unused);
 intzfs_set_env(void);
 
 extern struct devsw zfs_dev;

Modified: head/sys/boot/zfs/zfs.c
==
--- head/sys/boot/zfs/zfs.c Mon Aug  1 19:24:01 2016(r303629)
+++ head/sys/boot/zfs/zfs.c Mon Aug  1 19:37:43 2016(r303630)
@@ -801,7 +801,7 @@ zfs_bootenv(const char *name)
 }
 
 int
-zfs_belist_add(const char *name)
+zfs_belist_add(const char *name, uint64_t value __unused)
 {
 
/* Skip special datasets that start with a $ character */

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Mon Aug  1 19:24:01 2016(r303629)
+++ head/sys/boot/zfs/zfsimpl.c Mon Aug  1 19:37:43 2016(r303630)
@@ -1473,12 +1473,12 @@ zap_lookup(const spa_t *spa, const dnode
  * the directory contents.
  */
 static int
-mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *))
+mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t))
 {
const mzap_phys_t *mz;
const mzap_ent_phys_t *mze;
size_t size;
-   int chunks, i;
+   int chunks, i, rc;
 
/*
 * Microzap objects use exactly one block. Read the whole
@@ -1490,9 +1490,11 @@ mzap_list(const dnode_phys_t *dnode, int
 
for (i = 0; i < chunks; i++) {
mze = >mz_chunk[i];
-   if (mze->mze_name[0])
-   //printf("%-32s 0x%jx\n", mze->mze_name, 
(uintmax_t)mze->mze_value);
-   callback(mze->mze_name);
+   if (mze->mze_name[0]) {
+   rc = callback(mze->mze_name, mze->mze_value);
+   if (rc != 0)
+   return (rc);
+   }
}
 
return (0);
@@ -1503,12 +1505,12 @@ mzap_list(const dnode_phys_t *dnode, int
  * the directory header.
  */
 static int
-fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const 
char *))
+fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const 
char *, uint64_t))
 {
int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
zap_phys_t zh = *(zap_phys_t *) zap_scratch;
fat_zap_t z;
-   int i, j;
+   int i, j, rc;
 
if (zh.zap_magic != ZAP_MAGIC)
return (EIO);
@@ -1566,14 +1568,16 @@ fzap_list(const spa_t *spa, const dnode_
value = fzap_leaf_value(, zc);
 
//printf("%s 0x%jx\n", name, (uintmax_t)value);
-   callback((const char *)name);
+   rc = callback((const char *)name, value);
+   if (rc != 0)
+   return (rc);
}
}
 
return (0);
 }
 
-static int zfs_printf(const char *name)
+static int zfs_printf(const char *name, uint64_t value __unused)
 {
 
printf("%s\n", name);
@@ -1868,7 +1872,7 @@ zfs_list_dataset(const spa_t *spa, uint6
 }
 
 int

svn commit: r303629 - head/usr.bin/indent

2016-08-01 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Aug  1 19:24:01 2016
New Revision: 303629
URL: https://svnweb.freebsd.org/changeset/base/303629

Log:
  indent: Avoid using values of pointers that refer to deallocated space.
  
  For now maintain the local style in this file.
  
  Reviewed by:  jilles
  
  Reference:
  
https://github.com/pstef/freebsd_indent/commit/9099a9f17bc5f579514a4c1f5cf3df6624c6
  
  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by: Piotr Stefaniak

Modified:
  head/usr.bin/indent/indent_globs.h

Modified: head/usr.bin/indent/indent_globs.h
==
--- head/usr.bin/indent/indent_globs.h  Mon Aug  1 17:51:35 2016
(r303628)
+++ head/usr.bin/indent/indent_globs.h  Mon Aug  1 19:24:01 2016
(r303629)
@@ -57,41 +57,46 @@ FILE   *output; /* the output file 
 #define CHECK_SIZE_CODE \
if (e_code >= l_code) { \
int nsize = l_code-s_code+400; \
+   int code_len = e_code-s_code; \
codebuf = (char *) realloc(codebuf, nsize); \
if (codebuf == NULL) \
err(1, NULL); \
-   e_code = codebuf + (e_code-s_code) + 1; \
+   e_code = codebuf + code_len + 1; \
l_code = codebuf + nsize - 5; \
s_code = codebuf + 1; \
}
 #define CHECK_SIZE_COM \
if (e_com >= l_com) { \
int nsize = l_com-s_com+400; \
+   int com_len = e_com - s_com; \
+   int blank_pos = last_bl - s_com; \
combuf = (char *) realloc(combuf, nsize); \
if (combuf == NULL) \
err(1, NULL); \
-   e_com = combuf + (e_com-s_com) + 1; \
-   last_bl = combuf + (last_bl-s_com) + 1; \
+   e_com = combuf + com_len + 1; \
+   last_bl = combuf + blank_pos + 1; \
l_com = combuf + nsize - 5; \
s_com = combuf + 1; \
}
 #define CHECK_SIZE_LAB \
if (e_lab >= l_lab) { \
int nsize = l_lab-s_lab+400; \
+   int label_len = e_lab - s_lab; \
labbuf = (char *) realloc(labbuf, nsize); \
if (labbuf == NULL) \
err(1, NULL); \
-   e_lab = labbuf + (e_lab-s_lab) + 1; \
+   e_lab = labbuf + label_len + 1; \
l_lab = labbuf + nsize - 5; \
s_lab = labbuf + 1; \
}
 #define CHECK_SIZE_TOKEN \
if (e_token >= l_token) { \
int nsize = l_token-s_token+400; \
+   int token_len = e_token - s_token; \
tokenbuf = (char *) realloc(tokenbuf, nsize); \
if (tokenbuf == NULL) \
err(1, NULL); \
-   e_token = tokenbuf + (e_token-s_token) + 1; \
+   e_token = tokenbuf + token_len + 1; \
l_token = tokenbuf + nsize - 5; \
s_token = tokenbuf + 1; \
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-01 Thread John Baldwin
On Saturday, July 30, 2016 10:38:34 AM Bruce Evans wrote:
> On Fri, 29 Jul 2016, John Baldwin wrote:
> 
> > Log:
> >  Don't treat NOCPU as a valid CPU to CPU_ISSET.
> >
> >  If a thread is created bound to a cpuset it might already be bound before
> >  it's very first timeslice, and td_lastcpu will be NOCPU in that case.
> >
> >  MFC after: 1 week
> 
> Thanks.  Did you get this from your mail queue on 2016/05/08?

No. :(  I will go back and check that mail to see what else I missed.

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


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

2016-08-01 Thread Andrew Gallatin
Author: gallatin
Date: Mon Aug  1 17:02:21 2016
New Revision: 303626
URL: https://svnweb.freebsd.org/changeset/base/303626

Log:
  Rework IPV6 TCP path MTU discovery to match IPv4
  
  - Re-write tcp_ctlinput6() to closely mimic the IPv4 tcp_ctlinput()
  
  - Now that tcp_ctlinput6() updates t_maxseg, we can allow ip6_output()
to send TCP packets without looking at the tcp host cache for every
single transmit.
  
  - Make the icmp6 code mimic the IPv4 code & avoid returning
PRC_HOSTDEAD because it is so expensive.
  
  Without these changes in place, every TCP6 pmtu discovery or host
  unreachable ICMP resulted in a call to in6_pcbnotify() which walks the
  tcbinfo table with the write lock held.  Because the tcbinfo table is
  shared between IPv4 and IPv6, this causes huge scalabilty issues on
  servers with lots of (~100K) TCP connections, to the point where even
  a small percent of IPv6 traffic had a disproportionate impact on
  overall throughput.
  
  Reviewed by:  bz, rrs, ae (all earlier versions), lstewart (in Netflix's tree)
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D7272

Modified:
  head/sys/netinet/tcp_subr.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Mon Aug  1 16:40:42 2016(r303625)
+++ head/sys/netinet/tcp_subr.c Mon Aug  1 17:02:21 2016(r303626)
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #ifdef INET6
+#include 
 #include 
 #include 
 #include 
@@ -2040,72 +2041,146 @@ tcp_ctlinput(int cmd, struct sockaddr *s
 void
 tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d)
 {
-   struct tcphdr th;
+   struct in6_addr *dst;
+   struct tcphdr *th;
struct inpcb *(*notify)(struct inpcb *, int) = tcp_notify;
struct ip6_hdr *ip6;
struct mbuf *m;
+   struct inpcb *inp;
+   struct tcpcb *tp;
+   struct icmp6_hdr *icmp6;
struct ip6ctlparam *ip6cp = NULL;
const struct sockaddr_in6 *sa6_src = NULL;
-   int off;
-   struct tcp_portonly {
-   u_int16_t th_sport;
-   u_int16_t th_dport;
-   } *thp;
+   struct in_conninfo inc;
+   tcp_seq icmp_tcp_seq;
+   unsigned int mtu;
+   unsigned int off;
+
 
if (sa->sa_family != AF_INET6 ||
sa->sa_len != sizeof(struct sockaddr_in6))
return;
 
-   if (cmd == PRC_MSGSIZE)
-   notify = tcp_mtudisc_notify;
-   else if (!PRC_IS_REDIRECT(cmd) &&
-((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0))
-   return;
-
/* if the parameter is from icmp6, decode it. */
if (d != NULL) {
ip6cp = (struct ip6ctlparam *)d;
+   icmp6 = ip6cp->ip6c_icmp6;
m = ip6cp->ip6c_m;
ip6 = ip6cp->ip6c_ip6;
off = ip6cp->ip6c_off;
sa6_src = ip6cp->ip6c_src;
+   dst = ip6cp->ip6c_finaldst;
} else {
m = NULL;
ip6 = NULL;
off = 0;/* fool gcc */
sa6_src = _any;
+   dst = NULL;
}
 
-   if (ip6 != NULL) {
-   struct in_conninfo inc;
-   /*
-* XXX: We assume that when IPV6 is non NULL,
-* M and OFF are valid.
-*/
+   if (cmd == PRC_MSGSIZE)
+   notify = tcp_mtudisc_notify;
+   else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB ||
+   cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) &&
+   ip6 != NULL)
+   notify = tcp_drop_syn_sent;
 
-   /* check if we can safely examine src and dst ports */
-   if (m->m_pkthdr.len < off + sizeof(*thp))
-   return;
+   /*
+* Hostdead is ugly because it goes linearly through all PCBs.
+* XXX: We never get this from ICMP, otherwise it makes an
+* excellent DoS attack on machines with many connections.
+*/
+   else if (cmd == PRC_HOSTDEAD)
+   ip6 = NULL;
+   else if ((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0)
+   return;
 
-   bzero(, sizeof(th));
-   m_copydata(m, off, sizeof(*thp), (caddr_t));
+   if (ip6 == NULL) {
+   in6_pcbnotify(_tcbinfo, sa, 0,
+ (const struct sockaddr *)sa6_src,
+ 0, cmd, NULL, notify);
+   return;
+   }
 
-   in6_pcbnotify(_tcbinfo, sa, th.th_dport,
-   (struct sockaddr *)ip6cp->ip6c_src,
-   th.th_sport, cmd, NULL, notify);
+   /* Check if we can safely get the ports from the tcp hdr */
+   if (m == NULL ||
+   (m->m_pkthdr.len <
+   

Re: svn commit: r303522 - head/sys/dev/cxgbe

2016-08-01 Thread Ian Lepore
On Mon, 2016-08-01 at 16:38 +0100, Bruce Simpson wrote:
> "Yes, I know it's not a typewriter. Why is this command not working?"
> 
> Perhaps this errno code should be aliased... and strerror() massaged
> in 
> places... assuming we strictly follow the POSIX.
> 

It's not clear just what point you're trying to make.

ENOTTY has a special meaning as a return value from an ioctl call in
some contexts (it specifically means the called routine did not handle
the command and other routines hooked into the ioctl call chain may be
able to do the job).

In addition, the strerror() output for ENOTTY says nothing about a
typewriter, the text is "Inappropriate ioctl for device."

-- Ian

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


Re: svn commit: r303522 - head/sys/dev/cxgbe

2016-08-01 Thread Bruce Simpson

On 01/08/16 17:49, Ian Lepore wrote:
...

In addition, the strerror() output for ENOTTY says nothing about a
typewriter, the text is "Inappropriate ioctl for device."


If that semantic gap has already been plugged, ignore my message.

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


Re: svn commit: r303586 - head/bin/sh

2016-08-01 Thread Ian Lepore
On Sun, 2016-07-31 at 13:43 +, Alexey Dokuchaev wrote:
> On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote:
> > New Revision: 303586
> > URL: https://svnweb.freebsd.org/changeset/base/303586
> > 
> > Log:
> >   sh: Fix a clang warning.
> >   
> >   Submitted by: bdrewery
> > 
> > Modified:
> >   head/bin/sh/expand.c
> > 
> > Modified: head/bin/sh/expand.c
> > ===
> > ===
> > --- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r3
> > 03585)
> > +++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r3
> > 03586)
> > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in
> > if (--in.nleft < 0) {
> > if (in.fd < 0)
> > break;
> > -   while ((i = read(in.fd, buf, sizeof buf))
> > < 0 && errno == EINTR);
> > +   while ((i = read(in.fd, buf, sizeof buf))
> > < 0 && errno == EINTR)
> > +   ;
> 
> `continue;' would be even better; some tools might barf at stray
> semicolon.
> 
> ./danfe
> 

I strongly agree that the right way to do an empty loop is to use
"continue;" on a line by itself.  Unfortunately, what style(9) suggests
by way of example is a single semicolon on a line by itself with a
comment of "/* nothing */" to the right on the same line.  Ick.

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


svn commit: r303625 - head/usr.bin/indent

2016-08-01 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Aug  1 16:40:42 2016
New Revision: 303625
URL: https://svnweb.freebsd.org/changeset/base/303625

Log:
  indent(1): Use a dash in the license headers.
  
  Use of the canonical dash avoids indent(1) from reformatting the
  license headers.

Modified:
  head/usr.bin/indent/args.c
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/indent.h
  head/usr.bin/indent/indent_codes.h
  head/usr.bin/indent/indent_globs.h
  head/usr.bin/indent/io.c
  head/usr.bin/indent/lexi.c
  head/usr.bin/indent/parse.c
  head/usr.bin/indent/pr_comment.c

Modified: head/usr.bin/indent/args.c
==
--- head/usr.bin/indent/args.c  Mon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/args.c  Mon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cMon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent.cMon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1976 Board of Trustees of the University of Illinois.
  * Copyright (c) 1980, 1993

Modified: head/usr.bin/indent/indent.h
==
--- head/usr.bin/indent/indent.hMon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent.hMon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2001 Jens Schweikhardt
  * All rights reserved.
  *

Modified: head/usr.bin/indent/indent_codes.h
==
--- head/usr.bin/indent/indent_codes.h  Mon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent_codes.h  Mon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/indent_globs.h
==
--- head/usr.bin/indent/indent_globs.h  Mon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/indent_globs.h  Mon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cMon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/io.cMon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/lexi.c
==
--- head/usr.bin/indent/lexi.c  Mon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/lexi.c  Mon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/parse.c
==
--- head/usr.bin/indent/parse.c Mon Aug  1 16:39:40 2016(r303624)
+++ head/usr.bin/indent/parse.c Mon Aug  1 16:40:42 2016(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.

Modified: head/usr.bin/indent/pr_comment.c
==
--- head/usr.bin/indent/pr_comment.cMon Aug  1 16:39:40 2016
(r303624)
+++ head/usr.bin/indent/pr_comment.cMon Aug  1 16:40:42 2016
(r303625)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1985 Sun Microsystems, Inc.
  * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303622 - in head/sys: arm/arm conf

2016-08-01 Thread Andrew Turner
Author: andrew
Date: Mon Aug  1 16:29:04 2016
New Revision: 303622
URL: https://svnweb.freebsd.org/changeset/base/303622

Log:
  Split out the FDT parts of the GICv2 interrupt controller driver. This will
  allow us to add an ACPI attachment for arm64.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D7307

Added:
  head/sys/arm/arm/gic.h   (contents, props changed)
  head/sys/arm/arm/gic_fdt.c
 - copied, changed from r303614, head/sys/arm/arm/gic.c
Modified:
  head/sys/arm/arm/gic.c
  head/sys/conf/files.arm
  head/sys/conf/files.arm64

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Mon Aug  1 16:26:08 2016(r303621)
+++ head/sys/arm/arm/gic.c  Mon Aug  1 16:29:04 2016(r303622)
@@ -62,17 +62,15 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
-#include 
 #include 
 
+#include 
+
 #ifdef INTRNG
 #include "pic_if.h"
 #include "msi_if.h"
 #endif
 
-#define GIC_DEBUG_SPURIOUS
-
 /* We are using GICv2 register naming */
 
 /* Distributor Registers */
@@ -102,12 +100,6 @@ __FBSDID("$FreeBSD$");
 #define GICC_ABPR  0x001C  /* v1 ICCABPR */
 #define GICC_IIDR  0x00FC  /* v1 ICCIIDR*/
 
-#defineGIC_FIRST_SGI0  /* Irqs 0-15 are SGIs/IPIs. */
-#defineGIC_LAST_SGI15
-#defineGIC_FIRST_PPI   16  /* Irqs 16-31 are private (per 
*/
-#defineGIC_LAST_PPI31  /* core) peripheral interrupts. 
*/
-#defineGIC_FIRST_SPI   32  /* Irqs 32+ are shared 
peripherals. */
-
 /* TYPER Registers */
 #defineGICD_TYPER_SECURITYEXT  0x400
 #defineGIC_SUPPORT_SECEXT(_sc) \
@@ -141,58 +133,26 @@ struct gic_irqsrc {
 };
 
 static u_int gic_irq_cpu;
-static int arm_gic_intr(void *);
 static int arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc);
 
 #ifdef SMP
 static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
 static u_int sgi_first_unused = GIC_FIRST_SGI;
 #endif
-#endif
 
-#ifdef INTRNG
-struct arm_gic_range {
-   uint64_t bus;
-   uint64_t host;
-   uint64_t size;
-};
-
-struct arm_gic_devinfo {
-   struct ofw_bus_devinfo  obdinfo;
-   struct resource_listrl;
-};
-#endif
-
-struct arm_gic_softc {
-   device_tgic_dev;
-#ifdef INTRNG
-   void *  gic_intrhand;
-   struct gic_irqsrc * gic_irqs;
-#endif
-   struct resource *   gic_res[3];
-   bus_space_tag_t gic_c_bst;
-   bus_space_tag_t gic_d_bst;
-   bus_space_handle_t  gic_c_bsh;
-   bus_space_handle_t  gic_d_bsh;
-   uint8_t ver;
-   struct mtx  mutex;
-   uint32_tnirqs;
-   uint32_ttyper;
-#ifdef GIC_DEBUG_SPURIOUS
-   uint32_tlast_irq[MAXCPU];
-#endif
-
-#ifdef INTRNG
-   /* FDT child data */
-   pcell_t addr_cells;
-   pcell_t size_cells;
-   int nranges;
-   struct arm_gic_range *  ranges;
-#endif
-};
-
-#ifdef INTRNG
 #define GIC_INTR_ISRC(sc, irq) (>gic_irqs[irq].gi_isrc)
+#else /* !INTRNG */
+static struct ofw_compat_data compat_data[] = {
+   {"arm,gic", true},  /* Non-standard, used in FreeBSD dts. */
+   {"arm,gic-400", true},
+   {"arm,cortex-a15-gic",  true},
+   {"arm,cortex-a9-gic",   true},
+   {"arm,cortex-a7-gic",   true},
+   {"arm,arm11mp-gic", true},
+   {"brcm,brahma-b15-gic", true},
+   {"qcom,msm-qgic2",  true},
+   {NULL,  false}
+};
 #endif
 
 static struct resource_spec arm_gic_spec[] = {
@@ -225,31 +185,6 @@ static int gic_config_irq(int irq, enum 
 static void gic_post_filter(void *);
 #endif
 
-static struct ofw_compat_data compat_data[] = {
-   {"arm,gic", true},  /* Non-standard, used in FreeBSD dts. */
-   {"arm,gic-400", true},
-   {"arm,cortex-a15-gic",  true},
-   {"arm,cortex-a9-gic",   true},
-   {"arm,cortex-a7-gic",   true},
-   {"arm,arm11mp-gic", true},
-   {"brcm,brahma-b15-gic", true},
-   {"qcom,msm-qgic2",  true},
-   {NULL,  false}
-};
-
-static int
-arm_gic_probe(device_t dev)
-{
-
-   if (!ofw_bus_status_okay(dev))
-   return (ENXIO);
-
-   if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)
-   return (ENXIO);
-   device_set_desc(dev, "ARM Generic Interrupt Controller");
-   return (BUS_PROBE_DEFAULT);
-}
-
 #ifdef INTRNG
 static inline void
 gic_irq_unmask(struct arm_gic_softc *sc, u_int irq)
@@ -427,16 +362,6 @@ gic_decode_fdt(phandle_t iparent, pcell_
 #endif
 
 #ifdef INTRNG
-static inline intptr_t

svn commit: r303621 - head/sys/dev/cfe

2016-08-01 Thread Landon J. Fuller
Author: landonf
Date: Mon Aug  1 16:26:08 2016
New Revision: 303621
URL: https://svnweb.freebsd.org/changeset/base/303621

Log:
  Sync CFE interface with upstream cfe-1.4.2 release.
  
  Approved by:  adrian (mentor)
  Obtained from:
https://www.broadcom.com/support/communications-processors
  Differential Revision:https://reviews.freebsd.org/D7375

Modified:
  head/sys/dev/cfe/cfe_api.c
  head/sys/dev/cfe/cfe_api.h
  head/sys/dev/cfe/cfe_api_int.h
  head/sys/dev/cfe/cfe_error.h
  head/sys/dev/cfe/cfe_ioctl.h

Modified: head/sys/dev/cfe/cfe_api.c
==
--- head/sys/dev/cfe/cfe_api.c  Mon Aug  1 16:24:46 2016(r303620)
+++ head/sys/dev/cfe/cfe_api.c  Mon Aug  1 16:26:08 2016(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_api.c,v 1.5 2005/12/11 12:18:07 christos Exp $ */
-/* from: SiByte Id: cfe_api.c,v 1.16 2002/07/09 23:29:11 cgd Exp $ */
+/* from: Broadcom Id: cfe_api.c,v 1.18 2006/08/24 02:13:56 binh Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002
@@ -177,6 +176,27 @@ cfe_enumenv(int idx, char *name, int nam
 }
 #endif /* CFE_API_enumenv || CFE_API_ALL */
 
+#if defined(CFE_API_enumdev) || defined(CFE_API_ALL)
+int
+cfe_enumdev(int idx, char *name, int namelen)
+{
+cfe_xiocb_t xiocb;
+
+xiocb.xiocb_fcode = CFE_CMD_DEV_ENUM;
+xiocb.xiocb_status = 0;
+xiocb.xiocb_handle = 0;
+xiocb.xiocb_flags = 0;
+xiocb.xiocb_psize = sizeof(xiocb_envbuf_t);
+xiocb.plist.xiocb_envbuf.enum_idx = idx;
+xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name);
+xiocb.plist.xiocb_envbuf.name_length = namelen;
+
+cfe_iocb_dispatch();
+
+return xiocb.xiocb_status;
+}
+#endif /* CFE_API_enumdev || CFE_API_ALL */
+
 #if defined(CFE_API_enummem) || defined(CFE_API_ALL)
 int
 cfe_enummem(int idx, int flags, cfe_xuint_t *start, cfe_xuint_t *length,

Modified: head/sys/dev/cfe/cfe_api.h
==
--- head/sys/dev/cfe/cfe_api.h  Mon Aug  1 16:24:46 2016(r303620)
+++ head/sys/dev/cfe/cfe_api.h  Mon Aug  1 16:26:08 2016(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_api.h,v 1.3 2003/02/07 17:38:48 cgd Exp $ */
-/* from: SiByte Id: cfe_api.h,v 1.29 2002/07/09 23:29:11 cgd Exp $ */
+/* from: Broadcom Id: cfe_api.h,v 1.31 2006/08/24 02:13:56 binh Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002
@@ -154,6 +153,7 @@ int64_t cfe_getticks(void);
 #define cfe_cpu_start(a,b,c,d,e)   __cfe_cpu_start(a,b,c,d,e)
 #define cfe_cpu_stop(a)__cfe_cpu_stop(a)
 #define cfe_enumenv(a,b,d,e,f) __cfe_enumenv(a,b,d,e,f)
+#define cfe_enumdev(a,b,c) __cfe_enumdev(a,b,c)
 #define cfe_enummem(a,b,c,d,e) __cfe_enummem(a,b,c,d,e)
 #define cfe_exit(a,b)  __cfe_exit(a,b)
 #define cfe_flushcache(a)  __cfe_cacheflush(a)
@@ -176,6 +176,7 @@ int cfe_close(int handle);
 int cfe_cpu_start(int cpu, void (*fn)(void), long sp, long gp, long a1);
 int cfe_cpu_stop(int cpu);
 int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
+int cfe_enumdev(int idx, char *name, int namelen);
 int cfe_enummem(int idx, int flags, uint64_t *start, uint64_t *length,
uint64_t *type);
 int cfe_exit(int warm,int status);

Modified: head/sys/dev/cfe/cfe_api_int.h
==
--- head/sys/dev/cfe/cfe_api_int.h  Mon Aug  1 16:24:46 2016
(r303620)
+++ head/sys/dev/cfe/cfe_api_int.h  Mon Aug  1 16:26:08 2016
(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_api_int.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */
-/* from: SiByte Id: cfe_api_int.h,v 1.21 2002/07/09 23:29:11 cgd Exp $ */
+/* from: Broadcom Id: cfe_api_int.h,v 1.22 2003/02/07 17:27:56 cgd Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002

Modified: head/sys/dev/cfe/cfe_error.h
==
--- head/sys/dev/cfe/cfe_error.hMon Aug  1 16:24:46 2016
(r303620)
+++ head/sys/dev/cfe/cfe_error.hMon Aug  1 16:26:08 2016
(r303621)
@@ -1,5 +1,4 @@
-/* $NetBSD: cfe_error.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */
-/* from: SiByte Id: cfe_error.h,v 1.2 2002/07/09 19:37:52 cgd Exp $ */
+/* from: Broadcom Id: cfe_error.h,v 1.3 2003/02/07 17:27:56 cgd Exp $ */
 
 /*-
  * Copyright 2000, 2001, 2002

Modified: head/sys/dev/cfe/cfe_ioctl.h
==
--- head/sys/dev/cfe/cfe_ioctl.hMon Aug  1 16:24:46 2016
(r303620)
+++ head/sys/dev/cfe/cfe_ioctl.hMon Aug  1 16:26:08 2016
(r303621)
@@ -1,14 +1,13 @@
-/* $NetBSD: cfe_ioctl.h,v 1.2 2003/02/07 17:52:08 cgd Exp $ */
-
 /*-
- * Copyright 2000, 2001
+ * Copyright 2000, 2001, 2002, 2003
  * Broadcom Corporation. All rights reserved.
  *
- * This software is furnished under license and may be used and copied only

Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Pedro Giffuni



On 08/01/16 01:08, Bruce Evans wrote:

On Sun, 31 Jul 2016, Xin Li wrote:


On 7/31/16 14:36, Pedro F. Giffuni wrote:


Log:
  indent(1): replace function call to bzero with memset.

  Reference:

https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235


  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by:Piotr Stefaniak

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==

--- head/usr.bin/indent/io.cSun Jul 31 21:29:10 2016(r303599)
+++ head/usr.bin/indent/io.cSun Jul 31 21:36:40 2016(r303600)
@@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
 const char *s = s0;
 int sizedelta = 0;

-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

   ^  This is much more error-prone
than sizeof(*f) IMHO.


I also prefer bzero().



bzero --> memset changes are done to ease portability ...

On another BSD such replacements were done for performance but then
they discovered it was their bzero that was broken.


Removal of the space after sizeof is another regression.  KNF disallows
the space, but indent's style is very far from KNF.  It isn't clear if
indent's style is to require the space, since old versions of indent
never used sizeof(typename), and 'sizeof object' requires the space.
Regressions started in r93440 with sizeof(object) in an nitems() expansion.


OK ... that was in 2002.
We are using nitems() now, which undoes the portability meant to be 
brought by memset. OTOH, using sys/param.h is implicit permission

to use nitems() and may involve other portability issues already.
Can't keep everybody happy.

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


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Pedro Giffuni



On 08/01/16 10:24, Piotr Stefaniak wrote:

On 2016-08-01 08:08, Bruce Evans wrote:

On Sun, 31 Jul 2016, Xin Li wrote:


On 7/31/16 14:36, Pedro F. Giffuni wrote:



-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

   ^  This is much more error-prone
than sizeof(*f) IMHO.


I also prefer bzero().


I hope this is merely a preference and not a hard rule, because I'm of
the opinion that the memset()-based equivalent of bzero() has fewer
portability consequences, which is worth paying attention to. Please
consider the fact that NetBSD has done this replacement.



It is a preference, not a hard rule.

In general, replacing bzero with memset is seen as a portability
enhancement but bzero is not going away from FreeBSD and replacing it
is not a priority.


I do agree that replacing the expression with the type name was a
regression; it was my mistake.


Removal of the space after sizeof is another regression.  KNF disallows
the space, but indent's style is very far from KNF.  It isn't clear if
indent's style is to require the space, since old versions of indent
never used sizeof(typename), and 'sizeof object' requires the space.


I was specifically asked in the D6966 differential review to adhere to
style(9). I have changed both my own code submitted for review and the
rest of style violations of this kind as a separate patch
(https://github.com/pstef/freebsd_indent/commit/a2befd74fa54c91d96a38317e90d38ef17682f4b).
I had expected the style fixes to get committed before the change in
r303600, in belief that doing so would render possible complaints as the
one quoted above as not relevant anymore.



The idea is that new code should try to adhere to style(9) but it is
not an obligation to do so if the codebase already uses a different
style.


Regressions started in r93440 with sizeof(object) in an nitems() expansion.
The style of this is very different from an nitems() expansion in r1590.
There was 1 more sizeof(object) and 1 sizeof(int).  This is the first
sizeof(typename) where 'sizeof object' cannot be used for technical
reasons.

KNF also requires parentheses for sizeof(object).  Then the space is
unnecessary and disallowed.


On a more general note, I imagined we're heading towards slowly changing
indent(1)'s code to make it more style(9)-compliant (not least because
it's tempting to imagine indent(1) being able to re-indent itself in
accordance with style(9) at some point) but right now I'm confused as to
what style decisions in the patches I submit are expected of me.



You are doing a great job!

In the case of indent, while it would be desirable to move it all to 
KNF, that involves way too many cosmetic changes that have no use.


Reviewers can get things wrong, and in general it is up to the
committer, IMO, style cleanups are generally very low priority.
It is preferable to have smaller to-the-point changes than style
issues mixed with effective code changes.

Going out of your way to clean indent style --> KNF is a waste of time.
IMHO, of course.

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


Re: svn commit: r303522 - head/sys/dev/cxgbe

2016-08-01 Thread Bruce Simpson

"Yes, I know it's not a typewriter. Why is this command not working?"

Perhaps this errno code should be aliased... and strerror() massaged in 
places... assuming we strictly follow the POSIX.

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


Re: svn commit: r303574 - head/sys/dev/gpio

2016-08-01 Thread Bruce Simpson

On 31/07/16 07:24, Adrian Chadd wrote:

  [gpioled] add support for inverting the LED polarity.
  No, this isn't a star trek science joke - sometimes LEDs are wired
  up to be active low, so this is needed.


Actually, just about every bit of hardware I have interacted with on 
that level recently lights on low.

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


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Pedro Giffuni



On 08/01/16 00:28, Xin Li wrote:



On 7/31/16 14:36, Pedro F. Giffuni wrote:

Author: pfg
Date: Sun Jul 31 21:36:40 2016
New Revision: 303600
URL: https://svnweb.freebsd.org/changeset/base/303600

Log:
  indent(1): replace function call to bzero with memset.

  Reference:
  
https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235

  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by: Piotr Stefaniak

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cSun Jul 31 21:29:10 2016(r303599)
+++ head/usr.bin/indent/io.cSun Jul 31 21:36:40 2016(r303600)
@@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
 const char *s = s0;
 int sizedelta = 0;

-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

^  This is much more error-prone
than sizeof(*f) IMHO.

Cheers,


Does this look better?

Cheers,

Pedro.
Index: usr.bin/indent/io.c
===
--- usr.bin/indent/io.c	(revision 303615)
+++ usr.bin/indent/io.c	(working copy)
@@ -629,7 +629,7 @@
 const char *s = s0;
 int sizedelta = 0;
 
-memset(f, 0, sizeof(struct fstate));
+memset(f, '\0', sizeof(*f));
 while (*s) {
 	if (isdigit(*s))
 	f->size = f->size * 10 + *s - '0';
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Piotr Stefaniak
On 2016-08-01 08:08, Bruce Evans wrote:
> On Sun, 31 Jul 2016, Xin Li wrote:
>
>> On 7/31/16 14:36, Pedro F. Giffuni wrote:

>>> -bzero(f, sizeof *f);
>>> +memset(f, 0, sizeof(struct fstate));
>>^  This is much more error-prone
>> than sizeof(*f) IMHO.
>
> I also prefer bzero().

I hope this is merely a preference and not a hard rule, because I'm of 
the opinion that the memset()-based equivalent of bzero() has fewer 
portability consequences, which is worth paying attention to. Please 
consider the fact that NetBSD has done this replacement.

I do agree that replacing the expression with the type name was a 
regression; it was my mistake.

> Removal of the space after sizeof is another regression.  KNF disallows
> the space, but indent's style is very far from KNF.  It isn't clear if
> indent's style is to require the space, since old versions of indent
> never used sizeof(typename), and 'sizeof object' requires the space.

I was specifically asked in the D6966 differential review to adhere to 
style(9). I have changed both my own code submitted for review and the 
rest of style violations of this kind as a separate patch 
(https://github.com/pstef/freebsd_indent/commit/a2befd74fa54c91d96a38317e90d38ef17682f4b).
 
I had expected the style fixes to get committed before the change in 
r303600, in belief that doing so would render possible complaints as the 
one quoted above as not relevant anymore.

> Regressions started in r93440 with sizeof(object) in an nitems() expansion.
> The style of this is very different from an nitems() expansion in r1590.
> There was 1 more sizeof(object) and 1 sizeof(int).  This is the first
> sizeof(typename) where 'sizeof object' cannot be used for technical
> reasons.
>
> KNF also requires parentheses for sizeof(object).  Then the space is
> unnecessary and disallowed.

On a more general note, I imagined we're heading towards slowly changing 
indent(1)'s code to make it more style(9)-compliant (not least because 
it's tempting to imagine indent(1) being able to re-indent itself in 
accordance with style(9) at some point) but right now I'm confused as to 
what style decisions in the patches I submit are expected of me.

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


svn commit: r303615 - head/sbin/ipfw

2016-08-01 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug  1 13:38:48 2016
New Revision: 303615
URL: https://svnweb.freebsd.org/changeset/base/303615

Log:
  An old tables implementation had all tables preallocated,
  so when user did `ipfw table N flush` it always worked, but now
  when table N doesn't exist the kernel returns ESRCH error.
  This isn't fatal error for flush and destroy commands. Do not
  call err(3) when errno is equal to ESRCH. Also warn only when
  quiet mode isn't enabled. This fixes a regression in behavior,
  when old rules are loaded from file.
  Also use correct value for switch in the table_swap().
  
  Reported by:  Kevin Oberman
  MFC after:3 days

Modified:
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/tables.c
==
--- head/sbin/ipfw/tables.c Mon Aug  1 12:17:44 2016(r303614)
+++ head/sbin/ipfw/tables.c Mon Aug  1 13:38:48 2016(r303615)
@@ -225,18 +225,30 @@ ipfw_table_handler(int ac, char *av[])
table_modify(, ac, av);
break;
case TOK_DESTROY:
-   if (table_destroy() != 0)
+   if (table_destroy() == 0)
+   break;
+   if (errno != ESRCH)
err(EX_OSERR, "failed to destroy table %s", tablename);
+   /* ESRCH isn't fatal, warn if not quiet mode */
+   if (co.do_quiet == 0)
+   warn("failed to destroy table %s", tablename);
break;
case TOK_FLUSH:
if (is_all == 0) {
-   if ((error = table_flush()) != 0)
+   if ((error = table_flush()) == 0)
+   break;
+   if (errno != ESRCH)
err(EX_OSERR, "failed to flush table %s info",
tablename);
+   /* ESRCH isn't fatal, warn if not quiet mode */
+   if (co.do_quiet == 0)
+   warn("failed to flush table %s info",
+   tablename);
} else {
error = tables_foreach(table_flush_one, , 1);
if (error != 0)
err(EX_OSERR, "failed to flush tables list");
+   /* XXX: we ignore errors here */
}
break;
case TOK_SWAP:
@@ -593,14 +605,14 @@ table_do_swap(ipfw_obj_header *oh, char 
 static int
 table_swap(ipfw_obj_header *oh, char *second)
 {
-   int error;
 
if (table_check_name(second) != 0)
errx(EX_USAGE, "table name %s is invalid", second);
 
-   error = table_do_swap(oh, second);
+   if (table_do_swap(oh, second) == 0)
+   return (0);
 
-   switch (error) {
+   switch (errno) {
case EINVAL:
errx(EX_USAGE, "Unable to swap table: check types");
case EFBIG:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303614 - in head/sys/arm64: arm64 include

2016-08-01 Thread Andrew Turner
Author: andrew
Date: Mon Aug  1 12:17:44 2016
New Revision: 303614
URL: https://svnweb.freebsd.org/changeset/base/303614

Log:
  Add a kernel variable to let the user to select their preferred order
  between ACPI and FDT. This will be needed on machines with both, e.g. the
  SoftIron Overdrive 3000. The kernel will accept one or more comma separated
  values of either 'acpi' or 'fdt'. Any other values are skipped.
  
  To set it the user can either set it on the loader command line, or
  in loader.conf e.g. in loader.conf:
  kern.cfg.order=acpi,fdt
  
  This will try using ACPI then FDT. If none of the selected options work the
  kernel tries to use one to get the serial console, then panics.
  
  Reviewed by:  emaste (earlier version)
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D7274

Modified:
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/machdep.h

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Mon Aug  1 12:14:21 2016
(r303613)
+++ head/sys/arm64/arm64/machdep.c  Mon Aug  1 12:17:44 2016
(r303614)
@@ -25,6 +25,7 @@
  *
  */
 
+#include "opt_acpi.h"
 #include "opt_platform.h"
 #include "opt_ddb.h"
 
@@ -82,11 +83,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#ifdef DEV_ACPI
+#include 
+#include 
+#endif
+
 #ifdef FDT
 #include 
 #include 
 #endif
 
+
+enum arm64_bus arm64_bus_method = ARM64_BUS_NONE;
+
 struct pcpu __pcpu[MAXCPU];
 
 static struct trapframe proc0_tf;
@@ -802,6 +811,61 @@ try_load_dtb(caddr_t kmdp)
 }
 #endif
 
+static bool
+bus_probe(void)
+{
+   bool has_acpi, has_fdt;
+   char *order, *env;
+
+   has_acpi = has_fdt = false;
+
+#ifdef FDT
+   has_fdt = (OF_peer(0) != 0);
+#endif
+#ifdef DEV_ACPI
+   has_acpi = (acpi_find_table(ACPI_SIG_SPCR) != 0);
+#endif
+
+   env = kern_getenv("kern.cfg.order");
+   if (env != NULL) {
+   order = env;
+   while (order != NULL) {
+   if (has_acpi &&
+   strncmp(order, "acpi", 4) == 0 &&
+   (order[4] == ',' || order[4] == '\0')) {
+   arm64_bus_method = ARM64_BUS_ACPI;
+   break;
+   }
+   if (has_fdt &&
+   strncmp(order, "fdt", 3) == 0 &&
+   (order[3] == ',' || order[3] == '\0')) {
+   arm64_bus_method = ARM64_BUS_FDT;
+   break;
+   }
+   order = strchr(order, ',');
+   }
+   freeenv(env);
+
+   /* If we set the bus method it is valid */
+   if (arm64_bus_method != ARM64_BUS_NONE)
+   return (true);
+   }
+   /* If no order or an invalid order was set use the default */
+   if (arm64_bus_method == ARM64_BUS_NONE) {
+   if (has_fdt)
+   arm64_bus_method = ARM64_BUS_FDT;
+   else if (has_acpi)
+   arm64_bus_method = ARM64_BUS_ACPI;
+   }
+
+   /*
+* If no option was set the default is valid, otherwise we are
+* setting one to get cninit() working, then calling panic to tell
+* the user about the invalid bus setup.
+*/
+   return (env == NULL);
+}
+
 static void
 cache_setup(void)
 {
@@ -849,6 +913,7 @@ initarm(struct arm64_bootparams *abp)
vm_offset_t lastaddr;
caddr_t kmdp;
vm_paddr_t mem_len;
+   bool valid;
int i;
 
/* Set the module data location */
@@ -921,8 +986,14 @@ initarm(struct arm64_bootparams *abp)
 
devmap_bootstrap(0, NULL);
 
+   valid = bus_probe();
+
cninit();
 
+   if (!valid)
+   panic("Invalid bus configuration: %s",
+   kern_getenv("kern.cfg.order"));
+
init_proc0(abp->kern_stack);
msgbufinit(msgbufp, msgbufsize);
mutex_init();

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon Aug  1 12:14:21 2016
(r303613)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon Aug  1 12:17:44 2016
(r303614)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #ifdef VFP
@@ -90,13 +91,6 @@ boolean_t ofw_cpu_reg(phandle_t node, u_
 
 extern struct pcpu __pcpu[];
 
-static enum {
-   CPUS_UNKNOWN,
-#ifdef FDT
-   CPUS_FDT,
-#endif
-} cpu_enum_method;
-
 static device_identify_t arm64_cpu_identify;
 static device_probe_t arm64_cpu_probe;
 static device_attach_t arm64_cpu_attach;
@@ 

svn commit: r303613 - head/share/man/man4

2016-08-01 Thread Julian Elischer
Author: julian
Date: Mon Aug  1 12:14:21 2016
New Revision: 303613
URL: https://svnweb.freebsd.org/changeset/base/303613

Log:
  Man page for the new checksum netgraph module.
  
  PR:   206186
  Submitted by: Dmitry Vagin 
  MFC after: 1 month

Added:
  head/share/man/man4/ng_checksum.4   (contents, props changed)

Added: head/share/man/man4/ng_checksum.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/ng_checksum.4   Mon Aug  1 12:14:21 2016
(r303613)
@@ -0,0 +1,141 @@
+.\" Copyright (c) 2015 Dmitry Vagin 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 29, 2015
+.Dt NG_CHECKSUM 4
+.Os
+.Sh NAME
+.Nm ng_checksum
+.Nd IP checksum node type
+.Sh SYNOPSIS
+.In netgraph/ng_checksum.h
+.Sh DESCRIPTION
+The
+.Nm checksum
+node can calculate and prepare for calculation in hardware
+IPv4 header, TCP, UDP checksum.
+.Sh HOOKS
+This node type has two hooks:
+.Bl -tag -width ".Va out"
+.It Va in
+Packets received on this hook are processed according to settings specified
+in config and then forwarded to
+.Ar out
+hook, if it exists and connected. Otherwise they are reflected back to the
+.Ar in
+hook.
+.It Va out
+Packets received on this hook are forwarded to
+.Ar in
+hook without any changes.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_CHECKSUM_SETDLT Pq Ic setdlt
+Sets data link type on the
+.Va in
+hook. Currently, supported types are
+.Cm DLT_RAW
+(raw IP datagrams) and
+.Cm DLT_EN10MB
+(Ethernet). DLT_ definitions can be found in
+.In net/bpf.h
+header. Currently used values are
+.Cm DLT_EN10MB
+= 1 and
+.Cm DLT_RAW
+= 12.
+.It Dv NGM_CHECKSUM_GETDLT Pq Ic getdlt
+This control message obtains data link type on the
+.Va in
+hook.
+.It Dv NGM_CHECKSUM_SETCONFIG Pq Ic setconfig
+Sets node configuration. The following
+.Vt "struct ng_checksum_config"
+must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ng_checksum_config {
+   uint64_tcsum_flags;
+   uint64_tcsum_offload;
+};
+.Ed
+.Pp
+The
+.Va csum_flags
+can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 
and CSUM_UDP_IPV6
+(other values are ignored) for instructing node need calculate the 
corresponding checksum.
+.Pp
+The
+.Va csum_offload
+can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 
and CSUM_UDP_IPV6
+(other values are ignored) for instructing node what checksum can calculate in 
hardware.
+.Pp
+Also processed any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 
and CSUM_UDP_IPV6 sets before on mbuf.
+.It Dv NGM_CHECKSUM_GETCONFIG Pq Ic getconfig
+This control message obtains current node configuration,
+returned as
+.Vt "struct ng_checksum_config" .
+.It Dv NGM_CHECKSUM_GET_STATS Pq Ic getstats
+Returns node statistics as a
+.Vt "struct ng_checksum_stats" .
+.It Dv NGM_CHECKSUM_CLR_STATS Pq Ic clrstats
+Clear node statistics.
+.It Dv NGM_CHECKSUM_GETCLR_STATS Pq Ic getclrstats
+This command is identical to
+.Dv NGM_CHECKSUM_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+.Xr ngctl 8
+script:
+.Bd -literal -offset 4n
+/usr/sbin/ngctl -f- <<-SEQ
+   msg checksum-1: "setdlt 1"
+   ngctl msg checksum-1: "setconfig { csum_flags=0 csum_offload=6 }"
+.Ed
+.Pp
+Set data link type to
+.Cm 

svn commit: r303612 - in head/sys: modules/netgraph/checksum netgraph

2016-08-01 Thread Julian Elischer
Author: julian
Date: Mon Aug  1 12:09:04 2016
New Revision: 303612
URL: https://svnweb.freebsd.org/changeset/base/303612

Log:
  netgraph module for reconstructing checksums
  
  PR:   206108
  Submitted by: Dmitry Vagin  daemon.ham...@ya.ru
  MFC after:1 month

Added:
  head/sys/modules/netgraph/checksum/
  head/sys/modules/netgraph/checksum/Makefile   (contents, props changed)
  head/sys/netgraph/ng_checksum.c   (contents, props changed)
  head/sys/netgraph/ng_checksum.h   (contents, props changed)

Added: head/sys/modules/netgraph/checksum/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/netgraph/checksum/Makefile Mon Aug  1 12:09:04 2016
(r303612)
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include 
+
+KMOD=  ng_checksum
+SRCS=  ng_checksum.c opt_inet.h opt_inet6.h
+
+#.if !defined(KERNBUILDDIR)
+#
+#.if ${MK_INET_SUPPORT} != "no"
+#opt_inet.h:
+#  echo "#define INET 1" > ${.TARGET}
+#.endif
+#.if ${MK_INET6_SUPPORT} != "no"
+#opt_inet6.h:
+#  echo "#define INET6 1" > ${.TARGET}
+#.endif
+#.endif
+
+.include 

Added: head/sys/netgraph/ng_checksum.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/netgraph/ng_checksum.c Mon Aug  1 12:09:04 2016
(r303612)
@@ -0,0 +1,729 @@
+/*-
+ * Copyright (c) 2015 Dmitry Vagin 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_inet.h"
+#include "opt_inet6.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+/* private data */
+struct ng_checksum_priv {
+   hook_p in;
+   hook_p out;
+   uint8_t dlt;/* DLT_XXX from bpf.h */
+   struct ng_checksum_config *conf;
+   struct ng_checksum_stats stats;
+};
+
+typedef struct ng_checksum_priv *priv_p;
+
+/* Netgraph methods */
+static ng_constructor_tng_checksum_constructor;
+static ng_rcvmsg_t ng_checksum_rcvmsg;
+static ng_shutdown_t   ng_checksum_shutdown;
+static ng_newhook_tng_checksum_newhook;
+static ng_rcvdata_tng_checksum_rcvdata;
+static ng_disconnect_t ng_checksum_disconnect;
+
+#define ERROUT(x) { error = (x); goto done; }
+
+static const struct ng_parse_struct_field ng_checksum_config_type_fields[]
+   = NG_CHECKSUM_CONFIG_TYPE;
+static const struct ng_parse_type ng_checksum_config_type = {
+   _parse_struct_type,
+   _checksum_config_type_fields
+};
+
+static const struct ng_parse_struct_field ng_checksum_stats_fields[]
+   = NG_CHECKSUM_STATS_TYPE;
+static const struct ng_parse_type ng_checksum_stats_type = {
+   _parse_struct_type,
+   _checksum_stats_fields
+};
+
+static const struct ng_cmdlist ng_checksum_cmdlist[] = {
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_GETDLT,
+   "getdlt",
+   NULL,
+   _parse_uint8_type
+   },
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_SETDLT,
+   "setdlt",
+   _parse_uint8_type,
+   NULL
+   },
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_GETCONFIG,
+   "getconfig",
+   NULL,
+   _checksum_config_type
+   },
+   {
+   NGM_CHECKSUM_COOKIE,
+   NGM_CHECKSUM_SETCONFIG,
+   

svn commit: r303610 - head/sys/arm64/include

2016-08-01 Thread Andrew Turner
Author: andrew
Date: Mon Aug  1 10:36:58 2016
New Revision: 303610
URL: https://svnweb.freebsd.org/changeset/base/303610

Log:
  Add the fields for the PAR_EL1 register. This is used when performing an
  address lookup with the AT instructions.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Mon Aug  1 06:59:35 2016
(r303609)
+++ head/sys/arm64/include/armreg.h Mon Aug  1 10:36:58 2016
(r303610)
@@ -312,6 +312,27 @@
 #defineMAIR_ATTR_MASK(idx) (0xff << ((n)* 8))
 #defineMAIR_ATTR(attr, idx) ((attr) << ((idx) * 8))
 
+/* PAR_EL1 - Physical Address Register */
+#definePAR_F_SHIFT 0
+#definePAR_F   (0x1 << PAR_F_SHIFT)
+#definePAR_SUCCESS(x)  (((x) & PAR_F) == 0)
+/* When PAR_F == 0 (success) */
+#definePAR_SH_SHIFT7
+#definePAR_SH_MASK (0x3 << PAR_SH_SHIFT)
+#definePAR_NS_SHIFT9
+#definePAR_NS_MASK (0x3 << PAR_NS_SHIFT)
+#definePAR_PA_SHIFT12
+#definePAR_PA_MASK 0xf000
+#definePAR_ATTR_SHIFT  56
+#definePAR_ATTR_MASK   (0xff << PAR_ATTR_SHIFT)
+/* When PAR_F == 1 (aborted) */
+#definePAR_FST_SHIFT   1
+#definePAR_FST_MASK(0x3f << PAR_FST_SHIFT)
+#definePAR_PTW_SHIFT   8
+#definePAR_PTW_MASK(0x1 << PAR_PTW_SHIFT)
+#definePAR_S_SHIFT 9
+#definePAR_S_MASK  (0x1 << PAR_S_SHIFT)
+
 /* SCTLR_EL1 - System Control Register */
 #defineSCTLR_RES0  0xc8222400  /* Reserved, write 0 */
 #defineSCTLR_RES1  0x30d00800  /* Reserved, write 1 */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Bruce Evans

On Sun, 31 Jul 2016, Xin Li wrote:


On 7/31/16 14:36, Pedro F. Giffuni wrote:


Log:
  indent(1): replace function call to bzero with memset.

  Reference:
  
https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235

  Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
  Submitted by: Piotr Stefaniak

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cSun Jul 31 21:29:10 2016(r303599)
+++ head/usr.bin/indent/io.cSun Jul 31 21:36:40 2016(r303600)
@@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
 const char *s = s0;
 int sizedelta = 0;

-bzero(f, sizeof *f);
+memset(f, 0, sizeof(struct fstate));

   ^  This is much more error-prone
than sizeof(*f) IMHO.


I also prefer bzero().

Removal of the space after sizeof is another regression.  KNF disallows
the space, but indent's style is very far from KNF.  It isn't clear if
indent's style is to require the space, since old versions of indent
never used sizeof(typename), and 'sizeof object' requires the space.
Regressions started in r93440 with sizeof(object) in an nitems() expansion.
The style of this is very different from an nitems() expansion in r1590.
There was 1 more sizeof(object) and 1 sizeof(int).  This is the first
sizeof(typename) where 'sizeof object' cannot be used for technical
reasons.

KNF also requires parentheses for sizeof(object).  Then the space is
unnecessary and disallowed.

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


Re: svn commit: r303586 - head/bin/sh

2016-08-01 Thread Warner Losh
On Sun, Jul 31, 2016 at 11:51 PM, Bruce Evans  wrote:
> On Sun, 31 Jul 2016, Warner Losh wrote:
>
>> On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker  wrote:
>>>
>>> On Sun, Jul 31, 2016 at 01:43:16PM +, Alexey Dokuchaev wrote:

 On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote:
>
> New Revision: 303586
> URL: https://svnweb.freebsd.org/changeset/base/303586
>>>
>>>
> Log:
>   sh: Fix a clang warning.
>>>
>>>
>   Submitted by: bdrewery
>>>
>>>
> Modified:
>   head/bin/sh/expand.c
>>>
>>>
> Modified: head/bin/sh/expand.c
>
> ==
> --- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r303585)
> +++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r303586)
> @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in
> if (--in.nleft < 0) {
> if (in.fd < 0)
> break;
> -   while ((i = read(in.fd, buf, sizeof buf)) < 0 &&
> errno == EINTR);
> +   while ((i = read(in.fd, buf, sizeof buf)) < 0 &&
> errno == EINTR)
> +   ;
>>>
>>>
 `continue;' would be even better; some tools might barf at stray
 semicolon.
>>>
>>>
>>> Both continue; and ; (the latter with and without comment) occur in the
>>> source tree many times. I don't really like a continue that does nothing
>>> because it is at the end of a loop, so I prefer to make this whitespace
>>> change only (there are two more instances in bin/sh). I think a sole
>>> semicolon on a line is conspicuous enough that nothing additional is
>>> required.
>>
>>
>> For humans, yes. For picky tools that warn about strange constructs, no.
>> Clang may be happy, but there's many other tools that expect you to
>> declare
>> an 'empty' while loop with continue. This tradition has dated back to
>> at least the
>> late 80's...
>
>
> Buggy tools.  I thought that programmers used the stand-alone semicolon
> since that is shorter and clearer.

It cannot be on the same line though.

> The stand-alone semicolon is bad if it is misformatted.  'while(foo());'
> is shorter and unclearer.  A C parser must ignore whitespace, so you
> need a tool like indent that sort of understands whitespace to disallow
> while(foo()); but accept 'while (foo())\n\t;'.  It is not far from full
> indent(1) and insisting on the correct number of \t's before the semicolon.

A C parser doesn't completely ignore the whitespace if it doesn't warn
in both cases...

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


Re: svn commit: r303586 - head/bin/sh

2016-08-01 Thread Bruce Evans

On Sun, 31 Jul 2016, Warner Losh wrote:


On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker  wrote:

On Sun, Jul 31, 2016 at 01:43:16PM +, Alexey Dokuchaev wrote:

On Sun, Jul 31, 2016 at 01:11:34PM +, Jilles Tjoelker wrote:

New Revision: 303586
URL: https://svnweb.freebsd.org/changeset/base/303586



Log:
  sh: Fix a clang warning.



  Submitted by: bdrewery



Modified:
  head/bin/sh/expand.c



Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSun Jul 31 12:59:10 2016(r303585)
+++ head/bin/sh/expand.cSun Jul 31 13:11:34 2016(r303586)
@@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in
if (--in.nleft < 0) {
if (in.fd < 0)
break;
-   while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == 
EINTR);
+   while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == 
EINTR)
+   ;



`continue;' would be even better; some tools might barf at stray semicolon.


Both continue; and ; (the latter with and without comment) occur in the
source tree many times. I don't really like a continue that does nothing
because it is at the end of a loop, so I prefer to make this whitespace
change only (there are two more instances in bin/sh). I think a sole
semicolon on a line is conspicuous enough that nothing additional is
required.


For humans, yes. For picky tools that warn about strange constructs, no.
Clang may be happy, but there's many other tools that expect you to declare
an 'empty' while loop with continue. This tradition has dated back to
at least the
late 80's...


Buggy tools.  I thought that programmers used the stand-alone semicolon
since that is shorter and clearer.

The stand-alone semicolon is bad if it is misformatted.  'while(foo());'
is shorter and unclearer.  A C parser must ignore whitespace, so you
need a tool like indent that sort of understands whitespace to disallow
while(foo()); but accept 'while (foo())\n\t;'.  It is not far from full
indent(1) and insisting on the correct number of \t's before the semicolon.

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


Re: svn commit: r303600 - head/usr.bin/indent

2016-08-01 Thread Xin Li


On 7/31/16 14:36, Pedro F. Giffuni wrote:
> Author: pfg
> Date: Sun Jul 31 21:36:40 2016
> New Revision: 303600
> URL: https://svnweb.freebsd.org/changeset/base/303600
> 
> Log:
>   indent(1): replace function call to bzero with memset.
>   
>   Reference:
>   
> https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235
>   
>   Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
>   Submitted by:   Piotr Stefaniak
> 
> Modified:
>   head/usr.bin/indent/io.c
> 
> Modified: head/usr.bin/indent/io.c
> ==
> --- head/usr.bin/indent/io.c  Sun Jul 31 21:29:10 2016(r303599)
> +++ head/usr.bin/indent/io.c  Sun Jul 31 21:36:40 2016(r303600)
> @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char *
>  const char *s = s0;
>  int sizedelta = 0;
>  
> -bzero(f, sizeof *f);
> +memset(f, 0, sizeof(struct fstate));
^  This is much more error-prone
than sizeof(*f) IMHO.

Cheers,



signature.asc
Description: OpenPGP digital signature