svn commit: r253204 - head/sys/kern

2013-07-11 Thread Andre Oppermann
Author: andre
Date: Thu Jul 11 12:46:35 2013
New Revision: 253204
URL: http://svnweb.freebsd.org/changeset/base/253204

Log:
  Fix style issues, a typo in "kern.ipc.nmbufs" and correctly plave and
  expose the value of the tunable maxmbufmem as "kern.ipc.maxmbufmem"
  through sysctl.
  
  Reported by:  smh
  MFC after:1 day

Modified:
  head/sys/kern/kern_mbuf.c

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Thu Jul 11 12:42:46 2013(r253203)
+++ head/sys/kern/kern_mbuf.c   Thu Jul 11 12:46:35 2013(r253204)
@@ -104,13 +104,18 @@ int nmbjumbo9;/* limits number of 9k 
 int nmbjumbo16;/* limits number of 16k jumbo clusters 
*/
 struct mbstat mbstat;
 
+static quad_t maxmbufmem;  /* overall real memory limit for all mbufs */
+
+SYSCTL_QUAD(_kern_ipc, OID_AUTO, maxmbufmem, CTLFLAG_RDTUN, &maxmbufmem, 0,
+"Maximum real memory allocateable to various mbuf types");
+
 /*
  * tunable_mbinit() has to be run before any mbuf allocations are done.
  */
 static void
 tunable_mbinit(void *dummy)
 {
-   quad_t realmem, maxmbufmem;
+   quad_t realmem;
 
/*
 * The default limit for all mbuf related memory is 1/2 of all
@@ -120,7 +125,7 @@ tunable_mbinit(void *dummy)
realmem = qmin((quad_t)physmem * PAGE_SIZE,
vm_map_max(kmem_map) - vm_map_min(kmem_map));
maxmbufmem = realmem / 2;
-   TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
+   TUNABLE_QUAD_FETCH("kern.ipc.maxmbufmem", &maxmbufmem);
if (maxmbufmem > realmem / 4 * 3)
maxmbufmem = realmem / 4 * 3;
 
@@ -204,7 +209,7 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS)
newnmbjumbo9 = nmbjumbo9;
error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req);
if (error == 0 && req->newptr) {
-   if (newnmbjumbo9 > nmbjumbo9&&
+   if (newnmbjumbo9 > nmbjumbo9 &&
nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) 
{
nmbjumbo9 = newnmbjumbo9;
uma_zone_set_max(zone_jumbo9, nmbjumbo9);
@@ -258,7 +263,7 @@ sysctl_nmbufs(SYSCTL_HANDLER_ARGS)
}
return (error);
 }
-SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbuf, CTLTYPE_INT|CTLFLAG_RW,
+SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbufs, CTLTYPE_INT|CTLFLAG_RW,
 &nmbufs, 0, sysctl_nmbufs, "IU",
 "Maximum number of mbufs allowed");
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253207 - head/sys/kern

2013-07-11 Thread Andre Oppermann
Author: andre
Date: Thu Jul 11 12:53:13 2013
New Revision: 253207
URL: http://svnweb.freebsd.org/changeset/base/253207

Log:
  Make use of the fact that uma_zone_set_max(9) already returns the
  rounded limit making a call to uma_zone_get_max(9) unnecessary.
  
  MFC after:1 day

Modified:
  head/sys/kern/kern_mbuf.c

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Thu Jul 11 12:49:12 2013(r253206)
+++ head/sys/kern/kern_mbuf.c   Thu Jul 11 12:53:13 2013(r253207)
@@ -167,8 +167,7 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS)
if (newnmbclusters > nmbclusters &&
nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) 
{
nmbclusters = newnmbclusters;
-   uma_zone_set_max(zone_clust, nmbclusters);
-   nmbclusters = uma_zone_get_max(zone_clust);
+   nmbclusters = uma_zone_set_max(zone_clust, nmbclusters);
EVENTHANDLER_INVOKE(nmbclusters_change);
} else
error = EINVAL;
@@ -190,8 +189,7 @@ sysctl_nmbjumbop(SYSCTL_HANDLER_ARGS)
if (newnmbjumbop > nmbjumbop &&
nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) 
{
nmbjumbop = newnmbjumbop;
-   uma_zone_set_max(zone_jumbop, nmbjumbop);
-   nmbjumbop = uma_zone_get_max(zone_jumbop);
+   nmbjumbop = uma_zone_set_max(zone_jumbop, nmbjumbop);
} else
error = EINVAL;
}
@@ -212,8 +210,7 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS)
if (newnmbjumbo9 > nmbjumbo9 &&
nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) 
{
nmbjumbo9 = newnmbjumbo9;
-   uma_zone_set_max(zone_jumbo9, nmbjumbo9);
-   nmbjumbo9 = uma_zone_get_max(zone_jumbo9);
+   nmbjumbo9 = uma_zone_set_max(zone_jumbo9, nmbjumbo9);
} else
error = EINVAL;
}
@@ -234,8 +231,7 @@ sysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS)
if (newnmbjumbo16 > nmbjumbo16 &&
nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) 
{
nmbjumbo16 = newnmbjumbo16;
-   uma_zone_set_max(zone_jumbo16, nmbjumbo16);
-   nmbjumbo16 = uma_zone_get_max(zone_jumbo16);
+   nmbjumbo16 = uma_zone_set_max(zone_jumbo16, nmbjumbo16);
} else
error = EINVAL;
}
@@ -255,8 +251,7 @@ sysctl_nmbufs(SYSCTL_HANDLER_ARGS)
if (error == 0 && req->newptr) {
if (newnmbufs > nmbufs) {
nmbufs = newnmbufs;
-   uma_zone_set_max(zone_mbuf, nmbufs);
-   nmbufs = uma_zone_get_max(zone_mbuf);
+   nmbufs = uma_zone_set_max(zone_mbuf, nmbufs);
EVENTHANDLER_INVOKE(nmbufs_change);
} else
error = EINVAL;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253048 - in head/sys/ofed: drivers/net/mlx4 include/linux

2013-07-11 Thread John Baldwin
On Wednesday, July 10, 2013 7:58:30 pm Garrett Cooper wrote:
> On Tue, Jul 9, 2013 at 8:20 AM, John Baldwin  wrote:
> 
> ...
> 
> > I hadn't seen it.  I had wondered if the '\n' issue was a generic sysfs 
> > thing.
> > It sounds like it is and I'd be happy to revert the mlx4 change and alter 
> > the
> > sysfs bits to manage the newline directly if that is more appropriate.
> 
> I'll doublecheck this, but basically I'm really adverse to diverging
> from Linux in this area -- hence that's why I did what I did in the PR
> I mentioned.

I checked the other sysfs attributes under sys/ofed and all the ones that deal
with strings expect the newline.  There might be some that are "blobs" that do
not expect newlines, but it wasn't clear.  I do agree that it would be best to
avoid diffs for this case if possible in all the sysfs handlers.

(It would be even nicer if ofed used a more abstract notion for device 
attributes
in its drivers that could map to sysctl on FreeBSD and sysfs device attributes 
on
Linux, but that's a much larger change, and one OFED would have to want to do.)

> > I'd also like this to use sysctl_handle_string() if at all possible.  Are 
> > you in
> > a position to test patches still?
> 
> Unfortunately I'm not right now :(. Anthony may or may not be able to
> test this out (I used his machine when we were hacking around on IB
> stuff).
> 
> > If so, maybe give this a whirl.  It's similar to yours except it uses
> > sysctl_handle_string() and strlcat() rather than continuing to do things
> > by hand.  It also outputs an empty string to userland if the attribute
> > doesn't have a show method (your version would never pass out an old
> > string in that case unlike the original code).
> 
> Can you please pass along a patch to Anthony and me so we can try and
> apply it to test it out (Gmail's going to taint the inline patch, as
> is the EMC Exchange server with the patch attachment)? If Anthony
> still has the machine setup, then I'd be more than happy to test out
> the patch :).

Ok, I've put the patch at a URL.  Note that it is relative to what was just
committed to HEAD, so to test on 9 you'd have to apply both patches.

http://www.freebsd.org/~jhb/patches/ofed_sysfs.patch

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


svn commit: r253208 - head/sys/crypto/siphash

2013-07-11 Thread Andre Oppermann
Author: andre
Date: Thu Jul 11 14:18:38 2013
New Revision: 253208
URL: http://svnweb.freebsd.org/changeset/base/253208

Log:
  SipHash is a cryptographically strong pseudo-random function (a.k.a. keyed
  hash function) optimized for speed on short messages returning a 64bit hash/
  digest value.
  
  SipHash is simpler and much faster than other secure MACs and competitive
  in speed with popular non-cryptographic hash functions.  It uses a 128-bit
  key without the hidden cost of a key expansion step.  SipHash iterates a
  simple round function consisting of four additions, four xors, and six
  rotations, interleaved with xors of message blocks for a pre-defined number
  of compression and finalization rounds.  The absence of  secret load/store
  addresses or secret branch conditions avoid timing attacks.  No state is
  shared between messages.  Hashing is deterministic and doesn't use nonces.
  It is not susceptible to length extension attacks.
  
  Target applications include network traffic authentication, message
  authentication (MAC) and hash-tables protection against hash-flooding
  denial-of-service attacks.
  
  The number of update/finalization rounds is defined during initialization:
  
   SipHash24_Init() for the fast and reasonable strong version.
   SipHash48_Init() for the strong version (half as fast).
  
  SipHash usage is similar to other hash functions:
  
   struct SIPHASH_CTX ctx;
   char *k = "16bytes long key"
   char *s = "string";
   uint64_t h = 0;
   SipHash24_Init(&ctx);
   SipHash_SetKey(&ctx, k);
   SipHash_Update(&ctx, s, strlen(s));
   SipHash_Final(&h, &ctx);  /* or */
   h = SipHash_End(&ctx);/* or */
   h = SipHash24(&ctx, k, s, strlen(s));
  
  It was designed by Jean-Philippe Aumasson and Daniel J. Bernstein and
  is described in the paper "SipHash: a fast short-input PRF", 2012.09.18:
   https://131002.net/siphash/siphash.pdf
   Permanent ID: b9a943a805fbfc6fde808af9fc0ecdfa
  
  Implemented by:   andre (based on the paper)
  Reviewed by:  cperciva

Added:
  head/sys/crypto/siphash/
  head/sys/crypto/siphash/siphash.c   (contents, props changed)
  head/sys/crypto/siphash/siphash.h   (contents, props changed)
  head/sys/crypto/siphash/siphash_test.c   (contents, props changed)

Added: head/sys/crypto/siphash/siphash.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/crypto/siphash/siphash.c   Thu Jul 11 14:18:38 2013
(r253208)
@@ -0,0 +1,241 @@
+/*-
+ * Copyright (c) 2013 Andre Oppermann 
+ * 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.
+ * 3. The name of the author may not be used to endorse or promote
+ *products derived from this software without specific prior written
+ *permission.
+ *
+ * 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.
+ */
+
+/*
+ * SipHash is a family of PRFs SipHash-c-d where the integer parameters c and d
+ * are the number of compression rounds and the number of finalization rounds.
+ * A compression round is identical to a finalization round and this round
+ * function is called SipRound.  Given a 128-bit key k and a (possibly empty)
+ * byte string m, SipHash-c-d returns a 64-bit value SipHash-c-d(k; m).
+ *
+ * Implemented from the paper "SipHash: a fast short-input PRF", 2012.09.18,
+ * by Jean-Philippe Aumasson and Daniel J. Bernstein,
+ * Permanent Document ID b9a943a805fbfc6fde808af9fc0ecdfa
+ * https://131002.net/siphash/siphash.pdf
+ * https://131002.net/siphash/
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static voidSipRounds(SIPHASH_CTX *ctx, int final);
+
+void
+SipHash_InitX(SIPHASH_CTX *ctx, int rc, int rf)
+{
+
+   

svn commit: r253209 - head/sys/dev/nvme

2013-07-11 Thread Jim Harris
Author: jimharris
Date: Thu Jul 11 15:02:38 2013
New Revision: 253209
URL: http://svnweb.freebsd.org/changeset/base/253209

Log:
  Fix a poorly worded comment in nvme(4).
  
  MFC after:3 days

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

Modified: head/sys/dev/nvme/nvme.h
==
--- head/sys/dev/nvme/nvme.hThu Jul 11 14:18:38 2013(r253208)
+++ head/sys/dev/nvme/nvme.hThu Jul 11 15:02:38 2013(r253209)
@@ -765,10 +765,10 @@ struct nvme_pt_command {
 
/*
 * is_read = 1 if the passthrough command will read data into the
-*  supplied buffer.
+*  supplied buffer from the controller.
 *
-* is_read = 0 if the passthrough command will write data into the
-*  supplied buffer.
+* is_read = 0 if the passthrough command will write data from the
+*  supplied buffer to the controller.
 */
uint32_tis_read;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253210 - in head/sys: conf netinet

2013-07-11 Thread Andre Oppermann
Author: andre
Date: Thu Jul 11 15:29:25 2013
New Revision: 253210
URL: http://svnweb.freebsd.org/changeset/base/253210

Log:
  Improve SYN cookies by encoding the MSS, WSCALE (window scaling) and SACK
  information into the ISN (initial sequence number) without the additional
  use of timestamp bits and switching to the very fast and cryptographically
  strong SipHash-2-4 MAC hash algorithm to protect the SYN cookie against
  forgeries.
  
  The purpose of SYN cookies is to encode all necessary session state in
  the 32 bits of our initial sequence number to avoid storing any information
  locally in memory.  This is especially important when under heavy spoofed
  SYN attacks where we would either run out of memory or the syncache would
  fill with bogus connection attempts swamping out legitimate connections.
  
  The original SYN cookies method only stored an indexed MSS values in the
  cookie.  This isn't sufficient anymore and breaks down in the presence of
  WSCALE information which is only exchanged during SYN and SYN-ACK.  If we
  can't keep track of it then we may severely underestimate the available
  send or receive window. This is compounded with large windows whose size
  information on the TCP segment header is even lower numerically.  A number
  of years back SYN cookies were extended to store the additional state in
  the TCP timestamp fields, if available on a connection.  While timestamps
  are common among the BSD, Linux and other *nix systems Windows never enabled
  them by default and thus are not present for the vast majority of clients
  seen on the Internet.
  
  The common parameters used on TCP sessions have changed quite a bit since
  SYN cookies very invented some 17 years ago.  Today we have a lot more
  bandwidth available making the use window scaling almost mandatory.  Also
  SACK has become standard making recovering from packet loss much more
  efficient.
  
  This change moves all necessary information into the ISS removing the need
  for timestamps.  Both the MSS (16 bits) and send WSCALE (4 bits) are stored
  in 3 bit indexed form together with a single bit for SACK.  While this is
  significantly less than the original range, it is sufficient to encode all
  common values with minimal rounding.
  
  The MSS depends on the MTU of the path and with the dominance of ethernet
  the main value seen is around 1460 bytes.  Encapsulations for DSL lines
  and some other overheads reduce it by a few more bytes for many connections
  seen.  Rounding down to the next lower value in some cases isn't a problem
  as we send only slightly more packets for the same amount of data.
  
  The send WSCALE index is bit more tricky as rounding down under-estimates
  the available send space available towards the remote host, however a small
  number values dominate and are carefully selected again.
  
  The receive WSCALE isn't encoded at all but recalculated based on the local
  receive socket buffer size when a valid SYN cookie returns.  A listen socket
  buffer size is unlikely to change while active.
  
  The index values for MSS and WSCALE are selected for minimal rounding errors
  based on large traffic surveys.  These values have to be periodically
  validated against newer traffic surveys adjusting the arrays tcp_sc_msstab[]
  and tcp_sc_wstab[] if necessary.
  
  In addition the hash MAC to protect the SYN cookies is changed from MD5
  to SipHash-2-4, a much faster and cryptographically secure algorithm.
  
  Reviewed by:  dwmalone
  Tested by:Fabian Keil 

Modified:
  head/sys/conf/files
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_syncache.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jul 11 15:02:38 2013(r253209)
+++ head/sys/conf/files Thu Jul 11 15:29:25 2013(r253210)
@@ -547,6 +547,8 @@ crypto/sha1.c   optional carp | crypto |
 netgraph_mppc_encryption | sctp
 crypto/sha2/sha2.c optional crypto | geom_bde | ipsec | random | \
 sctp | zfs
+crypto/siphash/siphash.c   optional inet | inet6
+crypto/siphash/siphash_test.c  optional inet | inet6
 ddb/db_access.coptional ddb
 ddb/db_break.c optional ddb
 ddb/db_capture.c   optional ddb

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Thu Jul 11 15:02:38 2013
(r253209)
+++ head/sys/netinet/tcp_syncache.c Thu Jul 11 15:29:25 2013
(r253210)
@@ -1,12 +1,12 @@
 /*-
  * Copyright (c) 2001 McAfee, Inc.
- * Copyright (c) 2006 Andre Oppermann, Internet Business Solutions AG
+ * Copyright (c) 2006,2013 Andre Oppermann, Internet Business Solutions AG
  * All rights reserved.
  *
  * This software was developed for the FreeBSD 

Re: svn commit: r253208 - head/sys/crypto/siphash

2013-07-11 Thread Andre Oppermann

On 11.07.2013 16:18, Andre Oppermann wrote:

Author: andre
Date: Thu Jul 11 14:18:38 2013
New Revision: 253208
URL: http://svnweb.freebsd.org/changeset/base/253208

Log:
   SipHash is a cryptographically strong pseudo-random function (a.k.a. keyed
   hash function) optimized for speed on short messages returning a 64bit hash/
   digest value.

...

   The number of update/finalization rounds is defined during initialization:

SipHash24_Init() for the fast and reasonable strong version.
SipHash48_Init() for the strong version (half as fast).

   SipHash usage is similar to other hash functions:

struct SIPHASH_CTX ctx;
char *k = "16bytes long key"
char *s = "string";
uint64_t h = 0;
SipHash24_Init(&ctx);
SipHash_SetKey(&ctx, k);
SipHash_Update(&ctx, s, strlen(s));
SipHash_Final(&h, &ctx);  /* or */
h = SipHash_End(&ctx);/* or */
h = SipHash24(&ctx, k, s, strlen(s));


Looking for a man page whiz to hack one up. :)

--
Andre

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


svn commit: r253214 - head/sys/crypto/siphash

2013-07-11 Thread Andre Oppermann
Author: andre
Date: Thu Jul 11 16:27:11 2013
New Revision: 253214
URL: http://svnweb.freebsd.org/changeset/base/253214

Log:
  Fix const propagation issues to make GCC happy.
  
  Submitted by: Michael Butler 

Modified:
  head/sys/crypto/siphash/siphash.c

Modified: head/sys/crypto/siphash/siphash.c
==
--- head/sys/crypto/siphash/siphash.c   Thu Jul 11 15:55:57 2013
(r253213)
+++ head/sys/crypto/siphash/siphash.c   Thu Jul 11 16:27:11 2013
(r253214)
@@ -119,7 +119,8 @@ SipBuf(SIPHASH_CTX *ctx, const uint8_t *
 void
 SipHash_Update(SIPHASH_CTX *ctx, const void *src, size_t len)
 {
-   uint64_t m, *p;
+   uint64_t m;
+   const uint64_t *p;
const uint8_t *s;
size_t rem;
 
@@ -144,13 +145,13 @@ SipHash_Update(SIPHASH_CTX *ctx, const v
 
/* Optimze for 64bit aligned/unaligned access. */
if (((uintptr_t)s & 0x7) == 0) {
-   for (p = (uint64_t *)s; len > 0; len--, p++) {
+   for (p = (const uint64_t *)s; len > 0; len--, p++) {
m = le64toh(*p);
ctx->v[3] ^= m;
SipRounds(ctx, 0);
ctx->v[0] ^= m;
}
-   s = (uint8_t *)p;
+   s = (const uint8_t *)p;
} else {
for (; len > 0; len--, s += 8) {
m = le64dec(s);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253215 - head/lib/msun/src

2013-07-11 Thread David Chisnall
Author: theraven
Date: Thu Jul 11 17:41:04 2013
New Revision: 253215
URL: http://svnweb.freebsd.org/changeset/base/253215

Log:
  Cleanups to math.h that prevent namespace conflicts with C++.
  
  Reviewed by:  bde
  MFC after:3 days

Modified:
  head/lib/msun/src/math.h

Modified: head/lib/msun/src/math.h
==
--- head/lib/msun/src/math.hThu Jul 11 16:27:11 2013(r253214)
+++ head/lib/msun/src/math.hThu Jul 11 17:41:04 2013(r253215)
@@ -80,27 +80,33 @@ extern const union __nan_un {
 #defineFP_NORMAL   0x04
 #defineFP_SUBNORMAL0x08
 #defineFP_ZERO 0x10
+
+#if __STDC_VERSION__ >= 201112L
+#define__fp_type_select(x, f, d, ld) _Generic((x), \
+   float: f(x),\
+   double: d(x),   \
+   long double: ld(x))
+#elif __GNUC_PREREQ__(5, 1)
+#define__fp_type_select(x, f, d, ld) __builtin_choose_expr(
  \
+   __builtin_types_compatible_p(__typeof(x), long double), ld(x),\
+   __builtin_choose_expr(\
+   __builtin_types_compatible_p(__typeof(x), double), d(x),  \
+   __builtin_choose_expr(\
+   __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
+#else
+#define __fp_type_select(x, f, d, ld) \
+   ((sizeof(x) == sizeof(float)) ? f(x)   \
+   : (sizeof(x) == sizeof(double)) ? d(x) \
+   : ld(x))
+#endif
+
 #definefpclassify(x) \
-((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \
-: (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \
-: __fpclassifyl(x))
-
-#defineisfinite(x) \
-((sizeof (x) == sizeof (float)) ? __isfinitef(x)   \
-: (sizeof (x) == sizeof (double)) ? __isfinite(x)  \
-: __isfinitel(x))
-#defineisinf(x)\
-((sizeof (x) == sizeof (float)) ? __isinff(x)  \
-: (sizeof (x) == sizeof (double)) ? isinf(x)   \
-: __isinfl(x))
-#defineisnan(x)\
-((sizeof (x) == sizeof (float)) ? __isnanf(x)  \
-: (sizeof (x) == sizeof (double)) ? isnan(x)   \
-: __isnanl(x))
-#defineisnormal(x) \
-((sizeof (x) == sizeof (float)) ? __isnormalf(x)   \
-: (sizeof (x) == sizeof (double)) ? __isnormal(x)  \
-: __isnormall(x))
+   __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyd)
+#defineisfinite(x) __fp_type_select(x, __isfinitef, __isfinite, 
__isfinitel)
+#defineisinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
+#defineisnan(x) \
+   __fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
+#defineisnormal(x) __fp_type_select(x, __isnormalf, __isnormal, 
__isnormall)
 
 #ifdef __MATH_BUILTIN_RELOPS
 #defineisgreater(x, y) __builtin_isgreater((x), (y))
@@ -119,10 +125,7 @@ extern const union __nan_un {
 #defineisunordered(x, y)   (isnan(x) || isnan(y))
 #endif /* __MATH_BUILTIN_RELOPS */
 
-#definesignbit(x)  \
-((sizeof (x) == sizeof (float)) ? __signbitf(x)\
-: (sizeof (x) == sizeof (double)) ? __signbit(x)   \
-: __signbitl(x))
+#definesignbit(x) __fp_type_select(x, __signbitf, __signbit, 
__signbitl)
 
 typedef__double_t  double_t;
 typedef__float_t   float_t;
@@ -175,9 +178,8 @@ int __isfinitef(float) __pure2;
 int__isfinite(double) __pure2;
 int__isfinitel(long double) __pure2;
 int__isinff(float) __pure2;
+int__isinf(double) __pure2;
 int__isinfl(long double) __pure2;
-int__isnanf(float) __pure2;
-int__isnanl(long double) __pure2;
 int__isnormalf(float) __pure2;
 int__isnormal(double) __pure2;
 int__isnormall(long double) __pure2;
@@ -185,6 +187,27 @@ int__signbit(double) __pure2;
 int__signbitf(float) __pure2;
 int__signbitl(long double) __pure2;
 
+static __inline int
+__inline_isnan(double __x)
+{
+
+   return (__x != __x);
+}
+
+static __inline int
+__inline_isnanf(float __x)
+{
+
+   return (__x != __x);
+}
+
+static __inline int
+__inline_isnanl(long double __x)
+{
+
+   return (__x != __x);
+}
+
 double acos(double);
 double asin(double);
 double atan(double);
@@ -227,8 +250,6 @@ double  expm1(double);
 double fma(double, double, double);
 double hypot(double, double);
 intilogb(double) __pure2;
-int(isinf)(double) __pure2;
-int(isnan)(double) __pure2;
 double lgamma(double);
 long long llrint(double);
 long long llround(double);
___
svn-src-head@freebsd.org mailing list
http://lis

Re: svn commit: r253161 - head/sys/dev/uart

2013-07-11 Thread John Baldwin
On Wednesday, July 10, 2013 3:59:40 pm Marcel Moolenaar wrote:
> 
> On Jul 10, 2013, at 11:09 AM, John Baldwin  wrote:
> 
> > On Wednesday, July 10, 2013 2:05:43 pm John Baldwin wrote:
> >> On Wednesday, July 10, 2013 1:42:20 pm Marcel Moolenaar wrote:
> >>> Author: marcel
> >>> Date: Wed Jul 10 17:42:20 2013
> >>> New Revision: 253161
> >>> URL: http://svnweb.freebsd.org/changeset/base/253161
> >>> 
> >>> Log:
> >>>  Protect against broken hardware. In this particular case, protect against
> >>>  H/W not de-asserting the interrupt at all. On x86, and because of the
> >>>  following conditions, this results in a hard hang with interrupts 
> >>> disabled:
> >>>  1.  The uart(4) driver uses a spin lock to protect against concurrent
> >>>  access to the H/W. Spin locks disable and restore interrupts.
> >>>  2.  Restoring the interrupt on x86 always writes the flags register. Even
> >>>  if we're restoring the interrupt from disabled to disabled.
> >>>  3.  The x86 CPU has a short window in which interrupts are enabled when 
> >>> the
> >>>  flags register is written.
> >> 
> >> Do you have proof of this?
> 
> No. I only have proof of a hard hang during auto configuration that
> cannot be fixed in any other way than not to setup the interrupt at
> all.

Ok.  I think what is happening is that you are just spinning in the interrupt
handler forever due to the hardware being stuck in that case in the old code.
I assume you tried just using the count first but it still hung?  (Perhaps the
interrupt was for a PCI device and level-triggered and so it kept reasserting
anyway?)

I think your change is correct for a uart that is stuck in this way regardless,
I just think the hang isn't related to weirdness with x86 temporarily
re-enabling interrupts.

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


Re: svn commit: r253215 - head/lib/msun/src

2013-07-11 Thread Tijl Coosemans
On 2013-07-11 19:41, David Chisnall wrote:
> Author: theraven
> Date: Thu Jul 11 17:41:04 2013
> New Revision: 253215
> URL: http://svnweb.freebsd.org/changeset/base/253215
> 
> Log:
>   Cleanups to math.h that prevent namespace conflicts with C++.
>   
>   Reviewed by:bde
>   MFC after:  3 days
> 
> Modified:
>   head/lib/msun/src/math.h
> 
> Modified: head/lib/msun/src/math.h
> ==
> --- head/lib/msun/src/math.h  Thu Jul 11 16:27:11 2013(r253214)
> +++ head/lib/msun/src/math.h  Thu Jul 11 17:41:04 2013(r253215)
> @@ -80,27 +80,33 @@ extern const union __nan_un {
>  #define  FP_NORMAL   0x04
>  #define  FP_SUBNORMAL0x08
>  #define  FP_ZERO 0x10
> +
> +#if __STDC_VERSION__ >= 201112L
> +#define  __fp_type_select(x, f, d, ld) _Generic((x), \
> + float: f(x),\
> + double: d(x),   \
> + long double: ld(x))

GCC doesn't support _Generic yet for -std=c11.

> +#elif __GNUC_PREREQ__(5, 1)

GCC 3.1?

> +#define  __fp_type_select(x, f, d, ld) __builtin_choose_expr(
>   \
> + __builtin_types_compatible_p(__typeof(x), long double), ld(x),\
> + __builtin_choose_expr(\
> + __builtin_types_compatible_p(__typeof(x), double), d(x),  \
> + __builtin_choose_expr(\
> + __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
> +#else
> +#define   __fp_type_select(x, f, d, ld) \
> + ((sizeof(x) == sizeof(float)) ? f(x)   \
> + : (sizeof(x) == sizeof(double)) ? d(x) \
> + : ld(x))
> +#endif
> +
>  #define  fpclassify(x) \
> -((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \
> -: (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \
> -: __fpclassifyl(x))
> -
> -#define  isfinite(x) \
> -((sizeof (x) == sizeof (float)) ? __isfinitef(x) \
> -: (sizeof (x) == sizeof (double)) ? __isfinite(x)\
> -: __isfinitel(x))
> -#define  isinf(x)\
> -((sizeof (x) == sizeof (float)) ? __isinff(x)\
> -: (sizeof (x) == sizeof (double)) ? isinf(x) \
> -: __isinfl(x))
> -#define  isnan(x)\
> -((sizeof (x) == sizeof (float)) ? __isnanf(x)\
> -: (sizeof (x) == sizeof (double)) ? isnan(x) \
> -: __isnanl(x))
> -#define  isnormal(x) \
> -((sizeof (x) == sizeof (float)) ? __isnormalf(x) \
> -: (sizeof (x) == sizeof (double)) ? __isnormal(x)\
> -: __isnormall(x))
> + __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyd)

Last __fpclassifyd should be __fpclassifyl.

> @@ -227,8 +250,6 @@ doubleexpm1(double);
>  double   fma(double, double, double);
>  double   hypot(double, double);
>  int  ilogb(double) __pure2;
> -int  (isinf)(double) __pure2;
> -int  (isnan)(double) __pure2;

I think they should stay for the C90 case.



signature.asc
Description: OpenPGP digital signature


svn commit: r253217 - head/sys/dev/cxgbe

2013-07-11 Thread Navdeep Parhar
Author: np
Date: Thu Jul 11 19:09:31 2013
New Revision: 253217
URL: http://svnweb.freebsd.org/changeset/base/253217

Log:
  Attach to the 4x10G T540-CR card.

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu Jul 11 19:04:19 2013
(r253216)
+++ head/sys/dev/cxgbe/t4_main.cThu Jul 11 19:09:31 2013
(r253217)
@@ -448,13 +448,13 @@ struct {
{0xb000, "Chelsio Terminator 5 FPGA"},
{0x5400, "Chelsio T580-dbg"},
{0x5401,  "Chelsio T520-CR"},
+   {0x5403,  "Chelsio T540-CR"},   /* 4 x 10G */
{0x5407,  "Chelsio T520-SO"},
{0x5408,  "Chelsio T520-CX"},
{0x5410,  "Chelsio T580-LP-CR"},/* 2 x 40G */
{0x5411,  "Chelsio T520-LL-CR"},
 #ifdef notyet
{0x5402,  "Chelsio T522-CR"},
-   {0x5403,  "Chelsio T540-CR"},
{0x5404,  "Chelsio T520-BCH"},
{0x5405,  "Chelsio T540-BCH"},
{0x5406,  "Chelsio T540-CH"},
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253219 - head/lib/msun/src

2013-07-11 Thread David Chisnall
Author: theraven
Date: Thu Jul 11 19:34:16 2013
New Revision: 253219
URL: http://svnweb.freebsd.org/changeset/base/253219

Log:
  Fix some typoes in math.h cleanup.

Modified:
  head/lib/msun/src/math.h

Modified: head/lib/msun/src/math.h
==
--- head/lib/msun/src/math.hThu Jul 11 19:18:13 2013(r253218)
+++ head/lib/msun/src/math.hThu Jul 11 19:34:16 2013(r253219)
@@ -81,12 +81,12 @@ extern const union __nan_un {
 #defineFP_SUBNORMAL0x08
 #defineFP_ZERO 0x10
 
-#if __STDC_VERSION__ >= 201112L
+#if __STDC_VERSION__ >= 201112L && defined(__clang__)
 #define__fp_type_select(x, f, d, ld) _Generic((x), \
float: f(x),\
double: d(x),   \
long double: ld(x))
-#elif __GNUC_PREREQ__(5, 1)
+#elif __GNUC_PREREQ__(3, 1)
 #define__fp_type_select(x, f, d, ld) __builtin_choose_expr(
  \
__builtin_types_compatible_p(__typeof(x), long double), ld(x),\
__builtin_choose_expr(\
@@ -101,7 +101,7 @@ extern const union __nan_un {
 #endif
 
 #definefpclassify(x) \
-   __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyd)
+   __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
 #defineisfinite(x) __fp_type_select(x, __isfinitef, __isfinite, 
__isfinitel)
 #defineisinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
 #defineisnan(x) \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253215 - head/lib/msun/src

2013-07-11 Thread David Chisnall
On 11 Jul 2013, at 19:52, Tijl Coosemans  wrote:

> GCC doesn't support _Generic yet for -std=c11.

Ugh.  Given that they also lack a fine-grained feature check mechanism, they 
really should not advertise support for a language dialect if they don't 
support it.

> 
>> +#elif __GNUC_PREREQ__(5, 1)
> 
> GCC 3.1?

Ooops, I changed this to 5.1 to test the other code path and forgot to revert 
it.

> Last __fpclassifyd should be __fpclassifyl.

Fixed.

>> @@ -227,8 +250,6 @@ double   expm1(double);
>> double   fma(double, double, double);
>> double   hypot(double, double);
>> int  ilogb(double) __pure2;
>> -int (isinf)(double) __pure2;
>> -int (isnan)(double) __pure2;
> 
> I think they should stay for the C90 case.

That would completely defeat the point of this entire exercise and be redundant 
unless we aim to support a compiler that only supports C90 and no GNU 
extensions, in which case you'll hit errors in cdefs.h, long before you get to 
this point in an include.  

David




signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r253215 - head/lib/msun/src

2013-07-11 Thread Tijl Coosemans
On 2013-07-11 21:36, David Chisnall wrote:
> On 11 Jul 2013, at 19:52, Tijl Coosemans  wrote:
>>> @@ -227,8 +250,6 @@ double  expm1(double);
>>> double  fma(double, double, double);
>>> double  hypot(double, double);
>>> int ilogb(double) __pure2;
>>> -int(isinf)(double) __pure2;
>>> -int(isnan)(double) __pure2;
>>
>> I think they should stay for the C90 case.
> 
> That would completely defeat the point of this entire exercise and be
> redundant unless we aim to support a compiler that only supports C90
> and no GNU extensions, in which case you'll hit errors in cdefs.h,
> long before you get to this point in an include.

isnan(double) is part of SUSv2. It should be visible when compiling with
-D_XOPEN_SOURCE=500. I think you need something like this:

#if (__BSD_VISIBLE || __XSI_VISIBLE <= 500) && __ISO_C_VISIBLE < 1999
int isinf(double) __pure2;
int isnan(double) __pure2;
#endif



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r253215 - head/lib/msun/src

2013-07-11 Thread Tijl Coosemans
On 2013-07-11 22:03, Tijl Coosemans wrote:
> On 2013-07-11 21:36, David Chisnall wrote:
>> On 11 Jul 2013, at 19:52, Tijl Coosemans  wrote:
 @@ -227,8 +250,6 @@ double expm1(double);
 double fma(double, double, double);
 double hypot(double, double);
 intilogb(double) __pure2;
 -int   (isinf)(double) __pure2;
 -int   (isnan)(double) __pure2;
>>>
>>> I think they should stay for the C90 case.
>>
>> That would completely defeat the point of this entire exercise and be
>> redundant unless we aim to support a compiler that only supports C90
>> and no GNU extensions, in which case you'll hit errors in cdefs.h,
>> long before you get to this point in an include.
> 
> isnan(double) is part of SUSv2. It should be visible when compiling with
> -D_XOPEN_SOURCE=500. I think you need something like this:
> 
> #if (__BSD_VISIBLE || __XSI_VISIBLE <= 500) && __ISO_C_VISIBLE < 1999
> int   isinf(double) __pure2;
> int   isnan(double) __pure2;
> #endif

Actually this:

#if (__BSD_VISIBLE || (defined(__XSI_VISIBLE) && __XSI_VISIBLE <= 500)) && 
__ISO_C_VISIBLE < 1999





signature.asc
Description: OpenPGP digital signature


svn commit: r253221 - head/sys/vm

2013-07-11 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 20:33:57 2013
New Revision: 253221
URL: http://svnweb.freebsd.org/changeset/base/253221

Log:
  When swap pager allocates metadata in the pagedaemon context, allow it
  to drain the reserve.  This was broken in r243040, causing deadlock.
  Note that VM_WAIT call in case of uma_zalloc() failure from pagedaemon
  would only wait for the v_pageout_free_min anyway.
  
  Reported and tested by:   pho
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cThu Jul 11 20:09:46 2013(r253220)
+++ head/sys/vm/swap_pager.cThu Jul 11 20:33:57 2013(r253221)
@@ -1855,7 +1855,8 @@ retry:
if (swapblk == SWAPBLK_NONE)
goto done;
 
-   swap = *pswap = uma_zalloc(swap_zone, M_NOWAIT);
+   swap = *pswap = uma_zalloc(swap_zone, M_NOWAIT |
+   (curproc == pageproc ? M_USE_RESERVE : 0));
if (swap == NULL) {
mtx_unlock(&swhash_mtx);
VM_OBJECT_WUNLOCK(object);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253210 - in head/sys: conf netinet

2013-07-11 Thread Mikolaj Golub
Hi, Andre

On Thu, Jul 11, 2013 at 03:29:25PM +, Andre Oppermann wrote:
> Author: andre
> Date: Thu Jul 11 15:29:25 2013
> New Revision: 253210
> URL: http://svnweb.freebsd.org/changeset/base/253210
> 
> Log:
>   Improve SYN cookies by encoding the MSS, WSCALE (window scaling) and SACK
>   information into the ISN (initial sequence number) without the additional
>   use of timestamp bits and switching to the very fast and cryptographically
>   strong SipHash-2-4 MAC hash algorithm to protect the SYN cookie against
>   forgeries.

It fails to build with VIMAGE:

cc  -c -O2 -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls 
-Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith 
-Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  
-Wmissing-include-dirs -fdiagnostics-show-option  
-Wno-error-tautological-compare -Wno-error-empty-body  
-Wno-error-parentheses-equality  -nostdinc  -I. 
-I/home/golub/freebsd/base/head/sys 
-I/home/golub/freebsd/base/head/sys/contrib/altq 
-I/home/golub/freebsd/base/head/sys/contrib/libfdt -D_KERNEL 
-DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone 
-mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding 
-fstack-protector -Werror  
/home/golub/freebsd/base/head/sys/netinet/tcp_syncache.c
/home/golub/freebsd/base/head/sys/netinet/tcp_syncache.c:266:17: error: no 
member named 'vnet' in
  'struct tcp_syncache'
V_tcp_syncache.vnet = curvnet;
~~ ^
/home/golub/freebsd/base/head/sys/netinet/tcp_syncache.c:438:27: error: no 
member named 'vnet' in
  'struct tcp_syncache'
CURVNET_SET(sch->sch_sc->vnet);
~~~  ^

> Modified: head/sys/netinet/tcp_syncache.h
> ==
...
>  struct tcp_syncache {
> @@ -115,6 +118,19 @@ struct tcp_syncache {
>   u_int   cache_limit;
>   u_int   rexmt_limit;
>   u_int   hash_secret;
> + struct vnet *sch_vnet;

I think you meant here:

+   struct vnet *vnet;

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


Re: svn commit: r253161 - head/sys/dev/uart

2013-07-11 Thread Marcel Moolenaar

On Jul 11, 2013, at 6:41 AM, John Baldwin  wrote:

> On Wednesday, July 10, 2013 3:59:40 pm Marcel Moolenaar wrote:
>> 
>> On Jul 10, 2013, at 11:09 AM, John Baldwin  wrote:
>> 
>>> On Wednesday, July 10, 2013 2:05:43 pm John Baldwin wrote:
 On Wednesday, July 10, 2013 1:42:20 pm Marcel Moolenaar wrote:
> Author: marcel
> Date: Wed Jul 10 17:42:20 2013
> New Revision: 253161
> URL: http://svnweb.freebsd.org/changeset/base/253161
> 
> Log:
> Protect against broken hardware. In this particular case, protect against
> H/W not de-asserting the interrupt at all. On x86, and because of the
> following conditions, this results in a hard hang with interrupts 
> disabled:
> 1.  The uart(4) driver uses a spin lock to protect against concurrent
> access to the H/W. Spin locks disable and restore interrupts.
> 2.  Restoring the interrupt on x86 always writes the flags register. Even
> if we're restoring the interrupt from disabled to disabled.
> 3.  The x86 CPU has a short window in which interrupts are enabled when 
> the
> flags register is written.
 
 Do you have proof of this?
>> 
>> No. I only have proof of a hard hang during auto configuration that
>> cannot be fixed in any other way than not to setup the interrupt at
>> all.
> 
> Ok.  I think what is happening is that you are just spinning in the interrupt
> handler forever due to the hardware being stuck in that case in the old code.
> I assume you tried just using the count first but it still hung?  (Perhaps the
> interrupt was for a PCI device and level-triggered and so it kept reasserting
> anyway?)

Yes, the count alone didn't do the trick. It's really a H/W
problem. I suspect a floating line to an FPGA. The condition
is cleared by means that go beyond FreeBSD, let me put it
that way :-)

> I think your change is correct for a uart that is stuck in this way 
> regardless,
> I just think the hang isn't related to weirdness with x86 temporarily
> re-enabling interrupts.

You're right. I looked at configure() this time and it
starts with enable_intr(). For some reason I had it in
my head that we auto-configure with interrupts disabled.
We do on most platforms, just not on x86...

-- 
Marcel Moolenaar
mar...@xcllnt.net


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


svn commit: r253224 - head/usr.sbin/portsnap/portsnap

2013-07-11 Thread Colin Percival
Author: cperciva
Date: Thu Jul 11 22:19:18 2013
New Revision: 253224
URL: http://svnweb.freebsd.org/changeset/base/253224

Log:
  Fix bug in deleting files: If two ports had the same tarball and one of
  them changed (or was removed from the tree) then portsnap would delete
  that file.  This happened earlier today when one of two empty port
  directories was removed.  Uniquifying the lists of needed files fixes
  this.
  
  9.2-RELEASE candidate.
  
  MFC after:3 days

Modified:
  head/usr.sbin/portsnap/portsnap/portsnap.sh

Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh
==
--- head/usr.sbin/portsnap/portsnap/portsnap.sh Thu Jul 11 22:15:14 2013
(r253223)
+++ head/usr.sbin/portsnap/portsnap/portsnap.sh Thu Jul 11 22:19:18 2013
(r253224)
@@ -864,8 +864,8 @@ fetch_update() {
echo "done."
 
 # Remove files which are no longer needed
-   cut -f 2 -d '|' tINDEX INDEX | sort > oldfiles
-   cut -f 2 -d '|' tINDEX.new INDEX.new | sort | comm -13 - oldfiles |
+   cut -f 2 -d '|' tINDEX INDEX | sort -u > oldfiles
+   cut -f 2 -d '|' tINDEX.new INDEX.new | sort -u | comm -13 - oldfiles |
lam -s "files/" - -s ".gz" | xargs rm -f
rm patchlist filelist oldfiles
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253228 - head/sys/cam/scsi

2013-07-11 Thread Scott Long
Author: scottl
Date: Fri Jul 12 00:50:25 2013
New Revision: 253228
URL: http://svnweb.freebsd.org/changeset/base/253228

Log:
  Refactor the various delete methods out of dastart().  Cleans up a bunch
  of style and adds more modularity and clarity.
  
  Obtained from:Netflix
  MFC after:3 days

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Fri Jul 12 00:40:49 2013(r253227)
+++ head/sys/cam/scsi/scsi_da.c Fri Jul 12 00:50:25 2013(r253228)
@@ -144,6 +144,22 @@ typedef enum {
DA_DELETE_MAX = DA_DELETE_ZERO
 } da_delete_methods;
 
+typedef void da_delete_func_t (struct cam_periph *periph, union ccb *ccb,
+ struct bio *bp);
+static da_delete_func_t da_delete_trim;
+static da_delete_func_t da_delete_unmap;
+static da_delete_func_t da_delete_ws;
+
+static void * da_delete_functions[] = {
+   NULL,
+   NULL,
+   da_delete_trim,
+   da_delete_unmap,
+   da_delete_ws,
+   da_delete_ws,
+   da_delete_ws
+};
+
 static const char *da_delete_method_names[] =
 { "NONE", "DISABLE", "ATA_TRIM", "UNMAP", "WS16", "WS10", "ZERO" };
 static const char *da_delete_method_desc[] =
@@ -198,6 +214,7 @@ struct da_softc {
uint32_tunmap_max_lba;
uint64_tws_max_blks;
da_delete_methods   delete_method;
+   da_delete_func_t*delete_func;
struct   disk_params params;
struct   disk *disk;
unionccb saved_ccb;
@@ -1801,6 +1818,10 @@ dadeletemethodset(struct da_softc *softc
 
softc->delete_method = delete_method;
softc->disk->d_delmaxsize = dadeletemaxsize(softc, delete_method);
+   if (delete_method <= DA_DELETE_MAX)
+   softc->delete_func = da_delete_functions[delete_method];
+   else
+   softc->delete_func = NULL;
 
if (softc->delete_method > DA_DELETE_DISABLE)
softc->disk->d_flags |= DISKFLAG_CANDELETE;
@@ -2160,7 +2181,7 @@ skipstate:
switch (softc->state) {
case DA_STATE_NORMAL:
{
-   struct bio *bp, *bp1;
+   struct bio *bp;
uint8_t tag_code;
 
/* Execute immediate CCB if waiting. */
@@ -2180,237 +2201,13 @@ skipstate:
/* Run BIO_DELETE if not running yet. */
if (!softc->delete_running &&
(bp = bioq_first(&softc->delete_queue)) != NULL) {
-   uint64_t lba;
-   uint64_t count; /* forward compat with WS32 */
-
-   /*
-* In each of the methods below, while its the caller's
-* responsibility to ensure the request will fit into a
-* single device request, we might have changed the delete
-* method due to the device incorrectly advertising either
-* its supported methods or limits.
-* 
-* To prevent this causing further issues we validate the
-* against the methods limits, and warn which would
-* otherwise be unnecessary.
-*/
-
-   if (softc->delete_method == DA_DELETE_UNMAP) {
-   uint8_t *buf = softc->unmap_buf;
-   uint64_t lastlba = (uint64_t)-1;
-   uint32_t lastcount = 0, c;
-   uint64_t totalcount = 0;
-   uint32_t off, ranges = 0;
-
-   /*
-* Currently this doesn't take the UNMAP
-* Granularity and Granularity Alignment
-* fields into account.
-*
-* This could result in both unoptimal unmap
-* requests as as well as UNMAP calls unmapping
-* fewer LBA's than requested.
-*/
-
-   softc->delete_running = 1;
-   bzero(softc->unmap_buf, sizeof(softc->unmap_buf));
-   bp1 = bp;
-   do {
-   bioq_remove(&softc->delete_queue, bp1);
-   if (bp1 != bp)
-   
bioq_insert_tail(&softc->delete_run_queue, bp1);
-   lba = bp1->bio_pblkno;
-   count = bp1->bio_bcount / softc->params.secsize;
-
-   /* Try to extend the previous range. */
-   if (lba == lastlba) {
-   c = min(count, softc->unmap_max_lba -
-   lastcount);
-   lastcount += c;
- 

svn commit: r253247 - head/lib/libgeom

2013-07-11 Thread Hiroki Sato
Author: hrs
Date: Fri Jul 12 02:36:00 2013
New Revision: 253247
URL: http://svnweb.freebsd.org/changeset/base/253247

Log:
  Use strtoumax() instead of strtoul() for id/ref attr in XML elements.
  This improves compatibility when running an ILP32 binary on LP64 kernel.
  
  Spotted by:   gjb

Modified:
  head/lib/libgeom/geom_xml2tree.c

Modified: head/lib/libgeom/geom_xml2tree.c
==
--- head/lib/libgeom/geom_xml2tree.cFri Jul 12 02:28:35 2013
(r253246)
+++ head/lib/libgeom/geom_xml2tree.cFri Jul 12 02:36:00 2013
(r253247)
@@ -75,10 +75,10 @@ StartElement(void *userData, const char 
ref = NULL;
for (i = 0; attr[i] != NULL; i += 2) {
if (!strcmp(attr[i], "id")) {
-   id = (void *)strtoul(attr[i + 1], NULL, 0);
+   id = (void *)strtoumax(attr[i + 1], NULL, 0);
mt->nident++;
} else if (!strcmp(attr[i], "ref")) {
-   ref = (void *)strtoul(attr[i + 1], NULL, 0);
+   ref = (void *)strtoumax(attr[i + 1], NULL, 0);
} else
printf("%*.*s[%s = %s]\n",
mt->level + 1, mt->level + 1, "",
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253249 - head/lib/libgeom

2013-07-11 Thread Hiroki Sato
Author: hrs
Date: Fri Jul 12 04:22:46 2013
New Revision: 253249
URL: http://svnweb.freebsd.org/changeset/base/253249

Log:
  Revert r253247.  This change should be improved based on a lesson learnt
  from r233646 first.
  
  Pointed out by:   jmallett

Modified:
  head/lib/libgeom/geom_xml2tree.c

Modified: head/lib/libgeom/geom_xml2tree.c
==
--- head/lib/libgeom/geom_xml2tree.cFri Jul 12 02:42:37 2013
(r253248)
+++ head/lib/libgeom/geom_xml2tree.cFri Jul 12 04:22:46 2013
(r253249)
@@ -75,10 +75,10 @@ StartElement(void *userData, const char 
ref = NULL;
for (i = 0; attr[i] != NULL; i += 2) {
if (!strcmp(attr[i], "id")) {
-   id = (void *)strtoumax(attr[i + 1], NULL, 0);
+   id = (void *)strtoul(attr[i + 1], NULL, 0);
mt->nident++;
} else if (!strcmp(attr[i], "ref")) {
-   ref = (void *)strtoumax(attr[i + 1], NULL, 0);
+   ref = (void *)strtoul(attr[i + 1], NULL, 0);
} else
printf("%*.*s[%s = %s]\n",
mt->level + 1, mt->level + 1, "",
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253252 - head/sbin/devfs

2013-07-11 Thread Jaakko Heinonen
Author: jh
Date: Fri Jul 12 06:03:25 2013
New Revision: 253252
URL: http://svnweb.freebsd.org/changeset/base/253252

Log:
  Clarify how "hide" and "unhide" commands work on directories.

Modified:
  head/sbin/devfs/devfs.8

Modified: head/sbin/devfs/devfs.8
==
--- head/sbin/devfs/devfs.8 Fri Jul 12 05:58:54 2013(r253251)
+++ head/sbin/devfs/devfs.8 Fri Jul 12 06:03:25 2013(r253252)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 21, 2013
+.Dd July 12, 2013
 .Dt DEVFS 8
 .Os
 .Sh NAME
@@ -190,6 +190,7 @@ Nodes may later be revived manually with
 or with the
 .Cm unhide
 action.
+Hiding a directory node effectively hides all of its child nodes.
 .It Cm include Ar ruleset
 Apply all the rules in ruleset number
 .Ar ruleset
@@ -213,6 +214,8 @@ which may be a user name
 or number.
 .It Cm unhide
 Unhide the node.
+If the node resides in a subdirectory,
+all parent directory nodes must be visible to be able to access the node.
 .El
 .Sh IMPLEMENTATION NOTES
 Rulesets are created by the kernel at the first reference
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253253 - head/usr.sbin/ypserv

2013-07-11 Thread Hiroki Sato
Author: hrs
Date: Fri Jul 12 06:54:29 2013
New Revision: 253253
URL: http://svnweb.freebsd.org/changeset/base/253253

Log:
  Fix a wrong memcpy of struct sockaddr.
  
  Spotted by:   d...@gmx.com

Modified:
  head/usr.sbin/ypserv/yp_main.c

Modified: head/usr.sbin/ypserv/yp_main.c
==
--- head/usr.sbin/ypserv/yp_main.c  Fri Jul 12 06:03:25 2013
(r253252)
+++ head/usr.sbin/ypserv/yp_main.c  Fri Jul 12 06:54:29 2013
(r253253)
@@ -329,9 +329,8 @@ create_service(const int sock, const str
return -1;
}
memset(slep, 0, sizeof(*slep));
-   memcpy(&slep->sle_ss,
-   (struct sockaddr *)(res->ai_addr),
-   sizeof(res->ai_addr));
+   memcpy(&slep->sle_ss, res->ai_addr,
+   res->ai_addrlen);
slep->sle_sock = s;
SLIST_INSERT_HEAD(&sle_head, slep, sle_next);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"