Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread John-Mark Gurney
Bruce Evans wrote this message on Sun, Feb 15, 2015 at 17:53 +1100:
> On Sat, 14 Feb 2015, Pedro Giffuni wrote:
> 
> > On 02/14/15 13:33, Ian Lepore wrote:
> >> On Sat, 2015-02-14 at 21:15 +0300, Gleb Smirnoff wrote:
> >>> On Sat, Feb 14, 2015 at 08:46:58PM +1100, Bruce Evans wrote:
> >>> B> Using VLAs and also the C99 feature of declarations anwhere, and 
> >>> extensions
> >>> B> like __aligned(), we can almost implement a full alloca() using the 
> >>> fixed
> >>> B> version of this change:
> >>> B>
> >>> B> /*
> >>> B>   * XXX need extended statement-expression so that __buf doesn't go out
> >>> B>   * of scope after the right brace.
> >>> B>   */
> >>> B> #definemy_alloca(n) __extension__ ({
> >>> B>/* XXX need unique name. */ \
> >>> B>char __buf[__roundup2((n), MUMBLE)] __aligned(MUMBLE);  \
> >>> B>\
> >>> B>(void *)__buf;  \
> >>> B> })
> >>> 
> >>> I like this idea. But would this exact code work? The life of
> >>> __buf is limited by the code block, and we exit the block
> >>> immediately. Wouldn't the allocation be overwritten if we
> >>> enter any function or block later?

Could this just be changed to something like:
struct ng_mesg ng_mesg[(SORCVBUF_SIZE + sizeof(struct ng_mesg) - 1) /
sizeof(struct ng_mesg)];

It might allocate a few extra bytes, but no more than 55, and gets
alignment correct w/o lots of other hacks...

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread Bruce Evans

On Sun, 15 Feb 2015, Bruce Evans wrote:


On Sat, 14 Feb 2015, Pedro Giffuni wrote:

_
...
BUGS
The alloca() function is machine and compiler dependent; its use is dis-
couraged.


This became out of date with VLAs in C99.  Except for scopes, compilers
must have slightly more complications to support VLAs than alloca().
They might still not support alloca().  But FreeBSD never used ones that
don't.  That it would never use them was not so clear when this man page
was written.


I found this interesting related problem on the web: inline functions
with alloca() in them may blow out the stack.

But this is only with broken compilers.  For inline functions to work,
they must have the same semantics as when they aren't inlined,
especially when they are automatically inlined.  This means that any
alloca()'ed space in an inline function must be freed at the end of
that function, not at the end of its caller.

clang handles this correctly by doing requested inlining, and freeing
in the right place.  gcc documents the problem and normally refuse to
do requested inlining in functions that call alloca().  However, gcc
can be broken by forcing the inlining using __always_inline.  gcc-4.2
silently produces the stack-blowing code.  gcc-4.8 warns that the
forced inlining might be wrong.

alloca() in any macro would have this problem, unlike a [VL]A in a
compound statement in a macro.

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


Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread Bruce Evans

On Sat, 14 Feb 2015, Pedro Giffuni wrote:


On 02/14/15 13:33, Ian Lepore wrote:

On Sat, 2015-02-14 at 21:15 +0300, Gleb Smirnoff wrote:

On Sat, Feb 14, 2015 at 08:46:58PM +1100, Bruce Evans wrote:
B> Using VLAs and also the C99 feature of declarations anwhere, and 
extensions
B> like __aligned(), we can almost implement a full alloca() using the 
fixed

B> version of this change:
B>
B> /*
B>   * XXX need extended statement-expression so that __buf doesn't go out
B>   * of scope after the right brace.
B>   */
B> #define   my_alloca(n) __extension__ ({
B>   /* XXX need unique name. */ \
B>   char __buf[__roundup2((n), MUMBLE)] __aligned(MUMBLE);  \
B>   \
B>   (void *)__buf;  \
B> })

I like this idea. But would this exact code work? The life of
__buf is limited by the code block, and we exit the block
immediately. Wouldn't the allocation be overwritten if we
enter any function or block later?


I don't know how to do it.  The comment describes the problem.  C99
doesn't require the block, but the statement-expression does.

There is another scope problem with alloca().  I think the storage
allocated by it is live until the end of the function, so it doesn't
go out of scope if alloca() is called in an inner block.

  (This is not properly documented in the FreeBSD manpage.  It is
  stated that the space is freed on return, but it is not stated that
  the space is not freed earlier.

  This is not properly documented in a Linux manpage found on the web.
  This manpage has an almost identical DESCRIPTION section.  Then it
  is better, except it doesn't spell RETURN VALUES' name with an S.

  FreeBSD's RETURN VALUES section is seriously broken.  It says that
  NULL is returned on failure.  But that is only for the extern libc
  version which is almost unreachable.  Normally the builtin is used.
  The Linux man page states only the behaviour on error of the builtin.
  It is that the behaviour is undefined on stack overflow.

  The Linux manpage then has much larger STANDARDS and HISTORY sections
  (spelled CONFORMING TO and NOTES).  These also deprecate it, and give
  some reasons.)

VLAs and macros cannot duplicate alloca()'s scope behaviour if the
macro or declaration is placed in an inner block.  This is not a problem
for FreeBSD, since style(9) forbids placing declarations in inner
blocks and no one would break that rule :-).  'ptr = alloca(n);' isn't
a declaration, but placing it in the outermost block is even more
useful for making ptr and its related space visible.


Why put any effort into avoiding alloca() in the first place?  Is it
inefficient on some platforms?  On arm it's like 5 instructions, it just
adjusts the size to keep the stack dword-aligned and subtracts the
result from sp, done.


It should be more like 0 instructions relative to a local array.  It
does take 0 more on x86 with clang, but not with gcc.  Even gcc48 on
amd64 still does pessimal stack alignment and more for alloca().
Tested with 'void test(void *);' and:

test(alloca(2048));
vs
int arr[1024]; test(arr);

gcc produces an extra instruction or 2 to align the stack.  Hmm, the
clang code is actually broken, at least on i386.  It needs to do the
stack alignment even more than clang, due to to its non-pessimal
alignment for the usual case.  Apparently, the stack is always 16-byte
aligned on amd64 although this is excessive.  On i386, the stack is
16-byte aligned by default for gcc although this is pessimal.  This
can be changed by -mpreferred-stack boundary=N.  For clang, the
stack is only 4-byte aligned, and -mpreferred-stack-boundary is
broken (not supported).  clang is supposed to do alignment as necessary.
That is, almost never.  It does the stack adjustment for doubles, but
not for alloca() or even for long doubles:

double d; test(&d); /* adjusted */
test(alloca(8));/* broken */
long double d; test(&d);/* broken */

On i386, gcc depends on the default for doubles and long doubles (and
more importantly, for alignment directives and SSE variables), so it
never needs to adjust for alloca(), the same as on amd64,  but always
does it.

The stack allocation for multiple alloca()s or declarations (even ones
in inner blocks), should be coalesced and done at the start of a
function.  gcc but not clang pessimizes this too.  For alloca(8);
alloca(8); on both amd64 and i386, gcc generates 2 separate allocations
of 32 (?) bytes each with null (?) adjustments for each.

Of course, variable stack allocations cannot be coalesced before the
variables are known.  Handling the stack for this case requires more
care.  For example, the original stack pointer must be saved, since
subtraction to restore it cannot be used.  Similarly if the stack is
adjusted using andl.  Allocations may be intentionally delayed to
avoid wasting stack space, but this doesn't wor

Re: svn commit: r276747 - head/sys/netpfil/pf

2015-02-14 Thread Craig Rodrigues
On Thu, Jan 22, 2015 at 2:23 PM, Gleb Smirnoff  wrote:

> On Thu, Jan 22, 2015 at 10:09:41PM +0100, Nikos Vassiliadis wrote:
> N> > Sorry guys, I backed this out due to broken kldunload of pf module,
> which
> N> > is critical when you are working with pf bugs.
> N>
> N> For sure. 100% understood.
> N>
> N> > I had to backout r276746 as well, since it has numerous build
> breakages,
> N> > that are addressed by later revisions.
> N> >
> N> > That's my fault that I don't review in time, and I will try to improve
> N> > the situation.
> N> >
> N> > Can you please replay r276746 again, addressing all the build problems
> N> > and send the patch to me? You can user reviews.freebsd.org if you
> want.
> N> >
> N> > I'd like to get this in, but in a better quality.
> N>
> N> I'd like to get involved again and help you fixing pf. Craig could you
> N> replay 276746?
>



I wish you could have fixed the pf unload problem without backing out
all these changes.  I took all these changes from your projects/pf branch,
which was starting to bitrot because it was not being sync'd with head.

I got confirmation from several people that the fixes as they were (after
the build break fixes),
actually fixed their issues with PF and VIMAGE, which have been pending for
several
years now with no visible progress made.

Most regular users of PF don't really kldunload it once it is used.
For development use, I've been testing inside bhyve VM's, which doesn't
solve the kldunload problem but allows testing and forward progress.

Why do you want me to replay 276746 and give you a patch?

Why don't you just do it yourself?






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


svn commit: r278791 - head/sys/fs/ext2fs

2015-02-14 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 15 01:34:00 2015
New Revision: 278791
URL: https://svnweb.freebsd.org/changeset/base/278791

Log:
  Reuse value of cursize instead of recalculating.
  
  Reported by:  Clang static checker
  MFC after:1 week

Modified:
  head/sys/fs/ext2fs/ext2_htree.c

Modified: head/sys/fs/ext2fs/ext2_htree.c
==
--- head/sys/fs/ext2fs/ext2_htree.c Sun Feb 15 01:12:15 2015
(r278790)
+++ head/sys/fs/ext2fs/ext2_htree.c Sun Feb 15 01:34:00 2015
(r278791)
@@ -861,7 +861,7 @@ ext2_htree_add_entry(struct vnode *dvp, 
ext2_htree_split_dirblock((char *)bp->b_data, newdirblock, blksize,
fs->e3fs_hash_seed, hash_version, &split_hash, entry);
cursize = roundup(ip->i_size, blksize);
-   dirsize = roundup(ip->i_size, blksize) + blksize;
+   dirsize = cursize + blksize;
blknum = dirsize / blksize - 1;
 
/* Add index entry for the new directory block */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278790 - head/sys/fs/ext2fs

2015-02-14 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 15 01:12:15 2015
New Revision: 278790
URL: https://svnweb.freebsd.org/changeset/base/278790

Log:
  Initialize the allocation of variables related to the ext2 allocator.
  
  The e2fs_gd struct was not being initialized and garbage was
  being used for hinting the ext2 allocator variant.
  Use malloc to clear the values and also initialize e2fs_contigdirs
  during allocation to keep consistency.
  
  While here clean up small style issues.
  
  Reported by:  Clang static analyser
  MFC after:1 week

Modified:
  head/sys/fs/ext2fs/ext2_vfsops.c

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==
--- head/sys/fs/ext2fs/ext2_vfsops.cSat Feb 14 23:28:09 2015
(r278789)
+++ head/sys/fs/ext2fs/ext2_vfsops.cSun Feb 15 01:12:15 2015
(r278790)
@@ -355,7 +355,7 @@ compute_sb_data(struct vnode *devvp, str
}
 
fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs);
-   fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb;
+   fs->e2fs_itpg = fs->e2fs_ipg / fs->e2fs_ipb;
/* s_resuid / s_resgid ? */
fs->e2fs_gcount = (es->e2fs_bcount - es->e2fs_first_dblock +
EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs);
@@ -363,9 +363,9 @@ compute_sb_data(struct vnode *devvp, str
db_count = (fs->e2fs_gcount + e2fs_descpb - 1) / e2fs_descpb;
fs->e2fs_gdbcount = db_count;
fs->e2fs_gd = malloc(db_count * fs->e2fs_bsize,
-   M_EXT2MNT, M_WAITOK);
+   M_EXT2MNT, M_WAITOK | M_ZERO);
fs->e2fs_contigdirs = malloc(fs->e2fs_gcount *
-   sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK);
+   sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK | M_ZERO);
 
/*
 * Adjust logic_sb_block.
@@ -390,11 +390,11 @@ compute_sb_data(struct vnode *devvp, str
brelse(bp);
bp = NULL;
}
+   /* Initialization for the ext2 Orlov allocator variant. */
fs->e2fs_total_dir = 0;
-   for (i=0; i < fs->e2fs_gcount; i++){
+   for (i = 0; i < fs->e2fs_gcount; i++)
fs->e2fs_total_dir += fs->e2fs_gd[i].ext2bgd_ndirs;
-   fs->e2fs_contigdirs[i] = 0;
-   }
+
if (es->e2fs_rev == E2FS_REV0 ||
!EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_LARGEFILE))
fs->e2fs_maxfilesize = 0x7fff;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278789 - in stable: 10/contrib/llvm/patches 9/contrib/llvm/patches

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 23:28:09 2015
New Revision: 278789
URL: https://svnweb.freebsd.org/changeset/base/278789

Log:
  Add clang patches corresponding to r278788.

Added:
  
stable/10/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff

Changes in other areas also in this revision:
Added:
  
stable/9/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff

Added: 
stable/10/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
stable/10/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff
  Sat Feb 14 23:28:09 2015(r278789)
@@ -0,0 +1,67 @@
+Pull in r201130 from upstream clang trunk (by Ted Kremenek):
+
+  Fix PCH deserialization bug with local static symbols being treated
+  as local extern.
+
+  This triggered a miscompilation of code using Boost's
+  function_template.hpp when it was included inside a PCH file.  A
+  local static within that header would be treated as local extern,
+  resulting in the wrong mangling.  This only occurred during PCH
+  deserialization.
+
+  Fixes  and .
+
+This fixes a crash in audio/murmur, which is using both PCH and Boost.
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/278788
+
+Index: tools/clang/lib/Serialization/ASTReaderDecl.cpp
+===
+--- tools/clang/lib/Serialization/ASTReaderDecl.cpp
 tools/clang/lib/Serialization/ASTReaderDecl.cpp
+@@ -971,7 +971,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::V
+   VD->setCachedLinkage(VarLinkage);
+ 
+   // Reconstruct the one piece of the IdentifierNamespace that we need.
+-  if (VarLinkage != NoLinkage &&
++  if (VD->getStorageClass() == SC_Extern && VarLinkage != NoLinkage &&
+   VD->getLexicalDeclContext()->isFunctionOrMethod())
+ VD->setLocalExternDecl();
+ 
+Index: tools/clang/test/PCH/local_static.cpp
+===
+--- tools/clang/test/PCH/local_static.cpp
 tools/clang/test/PCH/local_static.cpp
+@@ -0,0 +1,20 @@
++// Test this without PCH.
++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include 
%S/local_static.h -fsyntax-only %s -emit-llvm -o %t.no_pch.ll %s
++// RUN: FileCheck --input-file %t.no_pch.ll %s
++
++// Test with PCH.
++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -x c++-header -emit-pch 
-o %t.pch %S/local_static.h
++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include-pch %t.pch 
-emit-llvm -o %t.pch.ll %s
++// RUN: FileCheck --input-file %t.pch.ll %s
++
++void test(Bar &b) {
++  b.f();
++  static int s;
++}
++
++// Check if the mangling of static and local extern variables
++// are correct and preserved by PCH.
++
++// CHECK: @_ZZ4testR3BarE1s = internal global i32 0, align 4
++// CHECK: @_ZZN3Bar1fIiEEvvE1y = linkonce_odr constant i32 0, align 4
++
+Index: tools/clang/test/PCH/local_static.h
+===
+--- tools/clang/test/PCH/local_static.h
 tools/clang/test/PCH/local_static.h
+@@ -0,0 +1,7 @@
++class Bar {
++public:
++  template
++  void f() {
++static const T y = 0;
++  }
++};
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278789 - in stable: 10/contrib/llvm/patches 9/contrib/llvm/patches

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 23:28:09 2015
New Revision: 278789
URL: https://svnweb.freebsd.org/changeset/base/278789

Log:
  Add clang patches corresponding to r278788.

Added:
  
stable/9/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff

Changes in other areas also in this revision:
Added:
  
stable/10/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff

Added: 
stable/9/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
stable/9/contrib/llvm/patches/patch-r278788-clang-r201130-pch-miscompilation.diff
   Sat Feb 14 23:28:09 2015(r278789)
@@ -0,0 +1,67 @@
+Pull in r201130 from upstream clang trunk (by Ted Kremenek):
+
+  Fix PCH deserialization bug with local static symbols being treated
+  as local extern.
+
+  This triggered a miscompilation of code using Boost's
+  function_template.hpp when it was included inside a PCH file.  A
+  local static within that header would be treated as local extern,
+  resulting in the wrong mangling.  This only occurred during PCH
+  deserialization.
+
+  Fixes  and .
+
+This fixes a crash in audio/murmur, which is using both PCH and Boost.
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/278788
+
+Index: tools/clang/lib/Serialization/ASTReaderDecl.cpp
+===
+--- tools/clang/lib/Serialization/ASTReaderDecl.cpp
 tools/clang/lib/Serialization/ASTReaderDecl.cpp
+@@ -971,7 +971,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::V
+   VD->setCachedLinkage(VarLinkage);
+ 
+   // Reconstruct the one piece of the IdentifierNamespace that we need.
+-  if (VarLinkage != NoLinkage &&
++  if (VD->getStorageClass() == SC_Extern && VarLinkage != NoLinkage &&
+   VD->getLexicalDeclContext()->isFunctionOrMethod())
+ VD->setLocalExternDecl();
+ 
+Index: tools/clang/test/PCH/local_static.cpp
+===
+--- tools/clang/test/PCH/local_static.cpp
 tools/clang/test/PCH/local_static.cpp
+@@ -0,0 +1,20 @@
++// Test this without PCH.
++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include 
%S/local_static.h -fsyntax-only %s -emit-llvm -o %t.no_pch.ll %s
++// RUN: FileCheck --input-file %t.no_pch.ll %s
++
++// Test with PCH.
++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -x c++-header -emit-pch 
-o %t.pch %S/local_static.h
++// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include-pch %t.pch 
-emit-llvm -o %t.pch.ll %s
++// RUN: FileCheck --input-file %t.pch.ll %s
++
++void test(Bar &b) {
++  b.f();
++  static int s;
++}
++
++// Check if the mangling of static and local extern variables
++// are correct and preserved by PCH.
++
++// CHECK: @_ZZ4testR3BarE1s = internal global i32 0, align 4
++// CHECK: @_ZZN3Bar1fIiEEvvE1y = linkonce_odr constant i32 0, align 4
++
+Index: tools/clang/test/PCH/local_static.h
+===
+--- tools/clang/test/PCH/local_static.h
 tools/clang/test/PCH/local_static.h
+@@ -0,0 +1,7 @@
++class Bar {
++public:
++  template
++  void f() {
++static const T y = 0;
++  }
++};
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278788 - in stable: 10/contrib/llvm/tools/clang/lib/Serialization 9/contrib/llvm/tools/clang/lib/Serialization

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 23:25:39 2015
New Revision: 278788
URL: https://svnweb.freebsd.org/changeset/base/278788

Log:
  Pull in r201130 from upstream clang trunk (by Ted Kremenek):
  
Fix PCH deserialization bug with local static symbols being treated
as local extern.
  
This triggered a miscompilation of code using Boost's
function_template.hpp when it was included inside a PCH file.  A
local static within that header would be treated as local extern,
resulting in the wrong mangling.  This only occurred during PCH
deserialization.
  
Fixes  and .
  
  This fixes a crash in audio/murmur, which is using both PCH and Boost.
  
  Direct commit to stable/10 and stable/9, since head has clang 3.5.1,
  which already includes this change.
  
  Reported by:  smh
  PR:   197389

Modified:
  stable/10/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp

Changes in other areas also in this revision:
Modified:
  stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp

Modified: stable/10/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp
==
--- stable/10/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp  
Sat Feb 14 22:12:17 2015(r278787)
+++ stable/10/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp  
Sat Feb 14 23:25:39 2015(r278788)
@@ -971,7 +971,7 @@ ASTDeclReader::RedeclarableResult ASTDec
   VD->setCachedLinkage(VarLinkage);
 
   // Reconstruct the one piece of the IdentifierNamespace that we need.
-  if (VarLinkage != NoLinkage &&
+  if (VD->getStorageClass() == SC_Extern && VarLinkage != NoLinkage &&
   VD->getLexicalDeclContext()->isFunctionOrMethod())
 VD->setLocalExternDecl();
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278788 - in stable: 10/contrib/llvm/tools/clang/lib/Serialization 9/contrib/llvm/tools/clang/lib/Serialization

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 23:25:39 2015
New Revision: 278788
URL: https://svnweb.freebsd.org/changeset/base/278788

Log:
  Pull in r201130 from upstream clang trunk (by Ted Kremenek):
  
Fix PCH deserialization bug with local static symbols being treated
as local extern.
  
This triggered a miscompilation of code using Boost's
function_template.hpp when it was included inside a PCH file.  A
local static within that header would be treated as local extern,
resulting in the wrong mangling.  This only occurred during PCH
deserialization.
  
Fixes  and .
  
  This fixes a crash in audio/murmur, which is using both PCH and Boost.
  
  Direct commit to stable/10 and stable/9, since head has clang 3.5.1,
  which already includes this change.
  
  Reported by:  smh
  PR:   197389

Modified:
  stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp

Modified: stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp
==
--- stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp   
Sat Feb 14 22:12:17 2015(r278787)
+++ stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp   
Sat Feb 14 23:25:39 2015(r278788)
@@ -971,7 +971,7 @@ ASTDeclReader::RedeclarableResult ASTDec
   VD->setCachedLinkage(VarLinkage);
 
   // Reconstruct the one piece of the IdentifierNamespace that we need.
-  if (VarLinkage != NoLinkage &&
+  if (VD->getStorageClass() == SC_Extern && VarLinkage != NoLinkage &&
   VD->getLexicalDeclContext()->isFunctionOrMethod())
 VD->setLocalExternDecl();
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278787 - head/sys/dev/atkbdc

2015-02-14 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Feb 14 22:12:17 2015
New Revision: 278787
URL: https://svnweb.freebsd.org/changeset/base/278787

Log:
  Quirk based support of Chromebook keyboard found in Acer C720
  
  This probably supports other devices based on SeaBIOS, which need
  to be added to the smbios based quirks table.
  
  The functionality has been ported from DragonFlyBSD and adapted
  to FreeBSD's more general purpose environment.
  
  Devices not covered by a quirk shouldn't be affected at all. Thanks
  to jhb and kostikbel for reviewing the code.
  
  Reviewed by:  kostikbel, jhb
  Approved by:  jhb, kostikbel
  Differential Revision: https://reviews.freebsd.org/D1802

Modified:
  head/sys/dev/atkbdc/atkbd.c
  head/sys/dev/atkbdc/atkbdc.c
  head/sys/dev/atkbdc/atkbdcreg.h
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/atkbd.c
==
--- head/sys/dev/atkbdc/atkbd.c Sat Feb 14 21:16:19 2015(r278786)
+++ head/sys/dev/atkbdc/atkbd.c Sat Feb 14 22:12:17 2015(r278787)
@@ -77,6 +77,10 @@ typedef struct atkbd_state {
 
 static voidatkbd_timeout(void *arg);
 static voidatkbd_shutdown_final(void *v);
+static int atkbd_reset(KBDC kbdc, int flags, int c);
+
+#define HAS_QUIRK(p, q)(((atkbdc_softc_t *)(p))->quirks & q)
+#define ALLOW_DISABLE_KBD(kbdc)!HAS_QUIRK(kbdc, 
KBDC_QUIRK_KEEP_ACTIVATED)
 
 int
 atkbd_probe_unit(device_t dev, int irq, int flags)
@@ -1095,6 +1099,39 @@ atkbd_shutdown_final(void *v)
 #endif
 }
 
+static int
+atkbd_reset(KBDC kbdc, int flags, int c)
+{
+   /* reset keyboard hardware */
+   if (!(flags & KB_CONF_NO_RESET) && !reset_kbd(kbdc)) {
+   /*
+* KEYBOARD ERROR
+* Keyboard reset may fail either because the keyboard
+* doen't exist, or because the keyboard doesn't pass
+* the self-test, or the keyboard controller on the
+* motherboard and the keyboard somehow fail to shake hands.
+* It is just possible, particularly in the last case,
+* that the keyboard controller may be left in a hung state.
+* test_controller() and test_kbd_port() appear to bring
+* the keyboard controller back (I don't know why and how,
+* though.)
+*/
+   empty_both_buffers(kbdc, 10);
+   test_controller(kbdc);
+   test_kbd_port(kbdc);
+   /*
+* We could disable the keyboard port and interrupt... but, 
+* the keyboard may still exist (see above). 
+*/
+   set_controller_command_byte(kbdc,
+   ALLOW_DISABLE_KBD(kbdc) ? 0xff : KBD_KBD_CONTROL_BITS, c);
+   if (bootverbose)
+   printf("atkbd: failed to reset the keyboard.\n");
+   return (EIO);
+   }
+   return (0);
+}
+
 /* local functions */
 
 static int
@@ -1250,13 +1287,14 @@ probe_keyboard(KBDC kbdc, int flags)
kbdc_set_device_mask(kbdc, m | KBD_KBD_CONTROL_BITS);
} else {
/* try to restore the command byte as before */
-   set_controller_command_byte(kbdc, 0xff, c);
+   set_controller_command_byte(kbdc,
+   ALLOW_DISABLE_KBD(kbdc) ? 0xff : KBD_KBD_CONTROL_BITS, c);
kbdc_set_device_mask(kbdc, m);
}
 #endif
 
kbdc_lock(kbdc, FALSE);
-   return err;
+   return (HAS_QUIRK(kbdc, KBDC_QUIRK_IGNORE_PROBE_RESULT) ? 0 : err);
 }
 
 static int
@@ -1299,6 +1337,12 @@ init_keyboard(KBDC kbdc, int *type, int 
return EIO;
}
 
+   if (HAS_QUIRK(kbdc, KBDC_QUIRK_RESET_AFTER_PROBE) &&
+   atkbd_reset(kbdc, flags, c)) {
+   kbdc_lock(kbdc, FALSE);
+   return EIO;
+   }
+
/* 
 * Check if we have an XT keyboard before we attempt to reset it. 
 * The procedure assumes that the keyboard and the controller have 
@@ -1343,31 +1387,9 @@ init_keyboard(KBDC kbdc, int *type, int 
if (bootverbose)
printf("atkbd: keyboard ID 0x%x (%d)\n", id, *type);
 
-   /* reset keyboard hardware */
-   if (!(flags & KB_CONF_NO_RESET) && !reset_kbd(kbdc)) {
-   /*
-* KEYBOARD ERROR
-* Keyboard reset may fail either because the keyboard
-* doen't exist, or because the keyboard doesn't pass
-* the self-test, or the keyboard controller on the
-* motherboard and the keyboard somehow fail to shake hands.
-* It is just possible, particularly in the last case,
-* that the keyboard controller may be left in a hung state.
-* test_controller() and test_kbd_port() appear to bring
-* the keyboard co

svn commit: r278786 - in stable/10/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/rockchip arm/samsung/exynos arm/ti arm/xscale/ixp425 dev/gpio mips/atheros mips...

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 21:16:19 2015
New Revision: 278786
URL: https://svnweb.freebsd.org/changeset/base/278786

Log:
  MFC r274670, r274671, r276168:
  
  Moves all the duplicate code to a single function.
  
  Verify for invalid modes and unwanted flags before pass the new flags to
  driver.
  
  Make gpio_default_map_gpios() static.  No functional changes.
  
  Improves the GPIO API description a little bit.
  
  gpio_pin_max must return the maximum supported pin number and not the total
  number of pins on the system.

Modified:
  stable/10/sys/arm/allwinner/a10_gpio.c
  stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
  stable/10/sys/arm/freescale/imx/imx_gpio.c
  stable/10/sys/arm/freescale/vybrid/vf_gpio.c
  stable/10/sys/arm/rockchip/rk30xx_gpio.c
  stable/10/sys/arm/samsung/exynos/exynos5_pad.c
  stable/10/sys/arm/ti/ti_gpio.c
  stable/10/sys/arm/xscale/ixp425/avila_gpio.c
  stable/10/sys/arm/xscale/ixp425/cambria_gpio.c
  stable/10/sys/dev/gpio/gpio_if.m
  stable/10/sys/dev/gpio/gpiobus.c
  stable/10/sys/dev/gpio/gpiobusvar.h
  stable/10/sys/dev/gpio/gpioc.c
  stable/10/sys/mips/atheros/ar71xx_gpio.c
  stable/10/sys/mips/cavium/octeon_gpio.c
  stable/10/sys/mips/rt305x/rt305x_gpio.c
  stable/10/sys/powerpc/wii/wii_gpio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/allwinner/a10_gpio.c
==
--- stable/10/sys/arm/allwinner/a10_gpio.c  Sat Feb 14 21:02:33 2015
(r278785)
+++ stable/10/sys/arm/allwinner/a10_gpio.c  Sat Feb 14 21:16:19 2015
(r278786)
@@ -302,20 +302,6 @@ a10_gpio_pin_setflags(device_t dev, uint
if (i >= sc->sc_gpio_npins)
return (EINVAL);
 
-   /* Check for unwanted flags. */
-   if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags)
-   return (EINVAL);
-
-   /* Can't mix input/output together. */
-   if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
-   (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
-   return (EINVAL);
-
-   /* Can't mix pull-up/pull-down together. */
-   if ((flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) ==
-   (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN))
-   return (EINVAL);
-
a10_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags);
 
return (0);

Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c   Sat Feb 14 21:02:33 
2015(r278785)
+++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c   Sat Feb 14 21:16:19 
2015(r278786)
@@ -399,20 +399,6 @@ bcm_gpio_pin_setflags(device_t dev, uint
if (bcm_gpio_pin_is_ro(sc, pin))
return (EINVAL);
 
-   /* Check for unwanted flags. */
-   if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags)
-   return (EINVAL);
-
-   /* Can't mix input/output together. */
-   if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
-   (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
-   return (EINVAL);
-
-   /* Can't mix pull-up/pull-down together. */
-   if ((flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) ==
-   (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN))
-   return (EINVAL);
-
bcm_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags);
 
return (0);

Modified: stable/10/sys/arm/freescale/imx/imx_gpio.c
==
--- stable/10/sys/arm/freescale/imx/imx_gpio.c  Sat Feb 14 21:02:33 2015
(r278785)
+++ stable/10/sys/arm/freescale/imx/imx_gpio.c  Sat Feb 14 21:16:19 2015
(r278786)
@@ -268,18 +268,8 @@ imx51_gpio_pin_setflags(device_t dev, ui
if (i >= sc->gpio_npins)
return (EINVAL);
 
-   /* Check for unwanted flags. */
-   if ((flags & sc->gpio_pins[i].gp_caps) != flags)
-   return (EINVAL);
-
-   /* Can't mix input/output together */
-   if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
-   (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
-   return (EINVAL);
-
imx51_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
 
-
return (0);
 }
 

Modified: stable/10/sys/arm/freescale/vybrid/vf_gpio.c
==
--- stable/10/sys/arm/freescale/vybrid/vf_gpio.cSat Feb 14 21:02:33 
2015(r278785)
+++ stable/10/sys/arm/freescale/vybrid/vf_gpio.cSat Feb 14 21:16:19 
2015(r278786)
@@ -312,15 +312,6 @@ vf_gpio_pin_setflags(device_t dev, uint3
if (i >= sc->gpio_npins)
return (EINVAL);
 
-   /* Check for unwanted flags. */
-   if ((flags & sc->gpio_pins[i].gp_caps) != flags)
-   return (EINVAL);
-
-   /* Can't mix input/output together */
-   if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
-  

svn commit: r278785 - stable/10/sys/dev/gpio

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 21:02:33 2015
New Revision: 278785
URL: https://svnweb.freebsd.org/changeset/base/278785

Log:
  MFC r274642, 274643:
  
  Remove unnecessary code.
  
  After r273566, the gpiobus version of bus_print_child() also works on FDT
  systems.
  
  Fix gpiobus_child_location_str() to return a real string with the mapped
  pins.
  
  Make gpiobus_print_pins() static again.

Modified:
  stable/10/sys/dev/gpio/gpiobus.c
  stable/10/sys/dev/gpio/gpiobusvar.h
  stable/10/sys/dev/gpio/ofw_gpiobus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/gpio/gpiobus.c
==
--- stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 20:57:27 2015
(r278784)
+++ stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 21:02:33 2015
(r278785)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #definedprintf(x, arg...)
 #endif
 
+static void gpiobus_print_pins(struct gpiobus_ivar *, char *, size_t);
 static int gpiobus_parse_pins(struct gpiobus_softc *, device_t, int);
 static int gpiobus_probe(device_t);
 static int gpiobus_attach(device_t);
@@ -69,11 +70,11 @@ static int gpiobus_pin_set(device_t, dev
 static int gpiobus_pin_get(device_t, device_t, uint32_t, unsigned int*);
 static int gpiobus_pin_toggle(device_t, device_t, uint32_t);
 
-void
-gpiobus_print_pins(struct gpiobus_ivar *devi)
+static void
+gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen)
 {
-   int range_start, range_stop, need_coma;
-   int i;
+   char tmp[128];
+   int i, range_start, range_stop, need_coma;
 
if (devi->npins == 0)
return;
@@ -83,11 +84,15 @@ gpiobus_print_pins(struct gpiobus_ivar *
for (i = 1; i < devi->npins; i++) {
if (devi->pins[i] != (range_stop + 1)) {
if (need_coma)
-   printf(",");
+   strlcat(buf, ",", buflen);
+   memset(tmp, 0, sizeof(tmp));
if (range_start != range_stop)
-   printf("%d-%d", range_start, range_stop);
+   snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
+   range_start, range_stop);
else
-   printf("%d", range_start);
+   snprintf(tmp, sizeof(tmp) - 1, "%d",
+   range_start);
+   strlcat(buf, tmp, buflen);
 
range_start = range_stop = devi->pins[i];
need_coma = 1;
@@ -97,11 +102,15 @@ gpiobus_print_pins(struct gpiobus_ivar *
}
 
if (need_coma)
-   printf(",");
+   strlcat(buf, ",", buflen);
+   memset(tmp, 0, sizeof(tmp));
if (range_start != range_stop)
-   printf("%d-%d", range_start, range_stop);
+   snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
+   range_start, range_stop);
else
-   printf("%d", range_start);
+   snprintf(tmp, sizeof(tmp) - 1, "%d",
+   range_start);
+   strlcat(buf, tmp, buflen);
 }
 
 int
@@ -273,12 +282,16 @@ gpiobus_resume(device_t dev)
 static int
 gpiobus_print_child(device_t dev, device_t child)
 {
-   struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
+   char pins[128];
int retval = 0;
+   struct gpiobus_ivar *devi;
 
+   devi = GPIOBUS_IVAR(child);
+   memset(pins, 0, sizeof(pins));
retval += bus_print_child_header(dev, child);
retval += printf(" at pin(s) ");
-   gpiobus_print_pins(devi);
+   gpiobus_print_pins(devi, pins, sizeof(pins));
+   retval += printf("%s", pins);
resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%ld");
retval += bus_print_child_footer(dev, child);
 
@@ -289,8 +302,12 @@ static int
 gpiobus_child_location_str(device_t bus, device_t child, char *buf,
 size_t buflen)
 {
+   struct gpiobus_ivar *devi;
+
+   devi = GPIOBUS_IVAR(child);
+   strlcpy(buf, "pin(s)=", buflen);
+   gpiobus_print_pins(devi, buf, buflen);
 
-   snprintf(buf, buflen, "pins=?");
return (0);
 }
 

Modified: stable/10/sys/dev/gpio/gpiobusvar.h
==
--- stable/10/sys/dev/gpio/gpiobusvar.h Sat Feb 14 20:57:27 2015
(r278784)
+++ stable/10/sys/dev/gpio/gpiobusvar.h Sat Feb 14 21:02:33 2015
(r278785)
@@ -94,7 +94,6 @@ gpio_map_gpios(device_t bus, phandle_t d
 
 device_t ofw_gpiobus_add_fdt_child(device_t, phandle_t);
 #endif
-void gpiobus_print_pins(struct gpiobus_ivar *);
 int gpiobus_init_softc(device_t);
 
 extern driver_t gpiobus_driver;

Modified: stable/10/sys/dev/gpio/ofw_gpiobus.c
==
--- stable/10/sys

svn commit: r278784 - stable/10/sys/dev/gpio

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 20:57:27 2015
New Revision: 278784
URL: https://svnweb.freebsd.org/changeset/base/278784

Log:
  MFC r274638:
  
  Add basic interrupt management code to gpiobus and ofw_gpiobus.
  
  This is the general support to allow the use of GPIO pins as interrupt
  sources for direct gpiobus children.
  
  The use of GPIO pins as generic interrupt sources (for an ethernet driver
  for example) will only be possible when arm/intrng is complete.  Then, most
  of this code will need to be rewritten, but it works for now, is better
  than what we have and will allow further developments.

Modified:
  stable/10/sys/dev/gpio/gpiobus.c
  stable/10/sys/dev/gpio/gpiobusvar.h
  stable/10/sys/dev/gpio/ofw_gpiobus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/gpio/gpiobus.c
==
--- stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 20:50:38 2015
(r278783)
+++ stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 20:57:27 2015
(r278784)
@@ -38,6 +38,13 @@ __FBSDID("$FreeBSD$");
 
 #include "gpiobus_if.h"
 
+#undef GPIOBUS_DEBUG
+#ifdef GPIOBUS_DEBUG
+#definedprintf printf
+#else
+#definedprintf(x, arg...)
+#endif
+
 static int gpiobus_parse_pins(struct gpiobus_softc *, device_t, int);
 static int gpiobus_probe(device_t);
 static int gpiobus_attach(device_t);
@@ -105,6 +112,11 @@ gpiobus_init_softc(device_t dev)
sc = GPIOBUS_SOFTC(dev);
sc->sc_busdev = dev;
sc->sc_dev = device_get_parent(dev);
+   sc->sc_intr_rman.rm_type = RMAN_ARRAY;
+   sc->sc_intr_rman.rm_descr = "GPIO Interrupts";
+   if (rman_init(&sc->sc_intr_rman) != 0 ||
+   rman_manage_region(&sc->sc_intr_rman, 0, ~0) != 0)
+   panic("%s: failed to set up rman.", __func__);
 
if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0)
return (ENXIO);
@@ -267,6 +279,7 @@ gpiobus_print_child(device_t dev, device
retval += bus_print_child_header(dev, child);
retval += printf(" at pin(s) ");
gpiobus_print_pins(devi);
+   resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%ld");
retval += bus_print_child_footer(dev, child);
 
return (retval);
@@ -304,7 +317,9 @@ gpiobus_add_child(device_t dev, u_int or
device_delete_child(dev, child);
return (0);
}
+   resource_list_init(&devi->rl);
device_set_ivars(child, devi);
+
return (child);
 }
 
@@ -314,14 +329,103 @@ gpiobus_hinted_child(device_t bus, const
struct gpiobus_softc *sc = GPIOBUS_SOFTC(bus);
struct gpiobus_ivar *devi;
device_t child;
-   int pins;
-
+   int irq, pins;
 
child = BUS_ADD_CHILD(bus, 0, dname, dunit);
devi = GPIOBUS_IVAR(child);
resource_int_value(dname, dunit, "pins", &pins);
if (gpiobus_parse_pins(sc, child, pins))
device_delete_child(bus, child);
+   if (resource_int_value(dname, dunit, "irq", &irq) == 0) {
+   if (bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1) != 0)
+   device_printf(bus,
+   "warning: bus_set_resource() failed\n");
+   }
+}
+
+static int
+gpiobus_set_resource(device_t dev, device_t child, int type, int rid,
+u_long start, u_long count)
+{
+   struct gpiobus_ivar *devi;
+   struct resource_list_entry *rle;
+
+   dprintf("%s: entry (%p, %p, %d, %d, %p, %ld)\n",
+   __func__, dev, child, type, rid, (void *)(intptr_t)start, count);
+   devi = GPIOBUS_IVAR(child);
+   rle = resource_list_add(&devi->rl, type, rid, start,
+   start + count - 1, count);
+   if (rle == NULL)
+   return (ENXIO);
+
+   return (0);
+}
+
+static struct resource *
+gpiobus_alloc_resource(device_t bus, device_t child, int type, int *rid,
+u_long start, u_long end, u_long count, u_int flags)
+{
+   struct gpiobus_softc *sc;
+   struct resource *rv;
+   struct resource_list *rl;
+   struct resource_list_entry *rle;
+   int isdefault;
+
+   if (type != SYS_RES_IRQ)
+   return (NULL);
+   isdefault = (start == 0UL && end == ~0UL && count == 1);
+   rle = NULL;
+   if (isdefault) {
+   rl = BUS_GET_RESOURCE_LIST(bus, child);
+   if (rl == NULL)
+   return (NULL);
+   rle = resource_list_find(rl, type, *rid);
+   if (rle == NULL)
+   return (NULL);
+   if (rle->res != NULL)
+   panic("%s: resource entry is busy", __func__);
+   start = rle->start;
+   count = rle->count;
+   end = rle->end;
+   }
+   sc = device_get_softc(bus);
+   rv = rman_reserve_resource(&sc->sc_intr_rman, start, end, count, flags,
+   child);
+   if (rv == NULL)
+   return (

svn commit: r278783 - stable/10/sys/dev/gpio

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 20:50:38 2015
New Revision: 278783
URL: https://svnweb.freebsd.org/changeset/base/278783

Log:
  MFC r273917, r273926:
  
  Fix the gpiobus locking by using a more sane model where it isn't necessary
  hold the gpiobus lock between the gpio calls.
  
  gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus
  what to do when the bus is already busy.
  
  When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep
  until the bus became free.
  
  With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right
  away and then it can act upon.
  
  This fixes the gpioiic(4) locking issues that arises when doing multiple
  concurrent access on the bus.
  
  Fix the build of non-FDT systems by moving the gpiobusvar.h header outside
  the FDT #ifdef.
  
  While here remove a few unused headers.

Modified:
  stable/10/sys/dev/gpio/gpiobus.c
  stable/10/sys/dev/gpio/gpiobus_if.m
  stable/10/sys/dev/gpio/gpiobusvar.h
  stable/10/sys/dev/gpio/gpioiic.c
  stable/10/sys/dev/gpio/gpioled.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/gpio/gpiobus.c
==
--- stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 20:37:33 2015
(r278782)
+++ stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 20:50:38 2015
(r278783)
@@ -53,9 +53,7 @@ static void gpiobus_hinted_child(device_
 /*
  * GPIOBUS interface
  */
-static void gpiobus_lock_bus(device_t);
-static void gpiobus_unlock_bus(device_t);
-static void gpiobus_acquire_bus(device_t, device_t);
+static int gpiobus_acquire_bus(device_t, device_t, int);
 static void gpiobus_release_bus(device_t, device_t);
 static int gpiobus_pin_setflags(device_t, device_t, uint32_t, uint32_t);
 static int gpiobus_pin_getflags(device_t, device_t, uint32_t, uint32_t*);
@@ -326,37 +324,26 @@ gpiobus_hinted_child(device_t bus, const
device_delete_child(bus, child);
 }
 
-static void
-gpiobus_lock_bus(device_t busdev)
+static int
+gpiobus_acquire_bus(device_t busdev, device_t child, int how)
 {
struct gpiobus_softc *sc;
 
sc = device_get_softc(busdev);
GPIOBUS_ASSERT_UNLOCKED(sc);
GPIOBUS_LOCK(sc);
-}
-
-static void
-gpiobus_unlock_bus(device_t busdev)
-{
-   struct gpiobus_softc *sc;
-
-   sc = device_get_softc(busdev);
-   GPIOBUS_ASSERT_LOCKED(sc);
+   if (sc->sc_owner != NULL) {
+   if (how == GPIOBUS_DONTWAIT) {
+   GPIOBUS_UNLOCK(sc);
+   return (EWOULDBLOCK);
+   }
+   while (sc->sc_owner != NULL)
+   mtx_sleep(sc, &sc->sc_mtx, 0, "gpiobuswait", 0);
+   }
+   sc->sc_owner = child;
GPIOBUS_UNLOCK(sc);
-}
 
-static void
-gpiobus_acquire_bus(device_t busdev, device_t child)
-{
-   struct gpiobus_softc *sc;
-
-   sc = device_get_softc(busdev);
-   GPIOBUS_ASSERT_LOCKED(sc);
-
-   if (sc->sc_owner)
-   panic("gpiobus: cannot serialize the access to device.");
-   sc->sc_owner = child;
+   return (0);
 }
 
 static void
@@ -365,14 +352,15 @@ gpiobus_release_bus(device_t busdev, dev
struct gpiobus_softc *sc;
 
sc = device_get_softc(busdev);
-   GPIOBUS_ASSERT_LOCKED(sc);
-
-   if (!sc->sc_owner)
+   GPIOBUS_ASSERT_UNLOCKED(sc);
+   GPIOBUS_LOCK(sc);
+   if (sc->sc_owner == NULL)
panic("gpiobus: releasing unowned bus.");
if (sc->sc_owner != child)
panic("gpiobus: you don't own the bus. game over.");
-
sc->sc_owner = NULL;
+   wakeup(sc);
+   GPIOBUS_UNLOCK(sc);
 }
 
 static int
@@ -469,8 +457,6 @@ static device_method_t gpiobus_methods[]
DEVMETHOD(bus_hinted_child, gpiobus_hinted_child),
 
/* GPIO protocol */
-   DEVMETHOD(gpiobus_lock_bus, gpiobus_lock_bus),
-   DEVMETHOD(gpiobus_unlock_bus,   gpiobus_unlock_bus),
DEVMETHOD(gpiobus_acquire_bus,  gpiobus_acquire_bus),
DEVMETHOD(gpiobus_release_bus,  gpiobus_release_bus),
DEVMETHOD(gpiobus_pin_getflags, gpiobus_pin_getflags),

Modified: stable/10/sys/dev/gpio/gpiobus_if.m
==
--- stable/10/sys/dev/gpio/gpiobus_if.m Sat Feb 14 20:37:33 2015
(r278782)
+++ stable/10/sys/dev/gpio/gpiobus_if.m Sat Feb 14 20:50:38 2015
(r278783)
@@ -32,25 +32,12 @@
 INTERFACE gpiobus;
 
 #
-# Lock the gpio bus
-#
-METHOD void lock_bus {
-   device_t busdev;
-};
-
-#
-# Unlock the gpio bus
-#
-METHOD void unlock_bus {
-   device_t busdev;
-};
-
-#
 # Dedicate the gpio bus control for a child
 #
-METHOD void acquire_bus {
+METHOD int acquire_bus {
device_t busdev;
device_t dev;
+   int how;
 };
 
 #

Modified: stable/10/sys/dev/gpio/gpiobusvar.h
==
--- 

svn commit: r278782 - in stable/10/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/rockchip arm/samsung/exynos arm/ti arm/xilinx arm/xscale/ixp425 mips/at...

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 20:37:33 2015
New Revision: 278782
URL: https://svnweb.freebsd.org/changeset/base/278782

Log:
  MFC r273799:
  
  Make the GPIO children attach to the first unit available and not only to
  unit 0.
  
  This fix a bug where a GPIO controller could fail to attach its children
  (gpioc and gpiobus) if another GPIO driver attach first.

Modified:
  stable/10/sys/arm/allwinner/a10_gpio.c
  stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
  stable/10/sys/arm/freescale/imx/imx_gpio.c
  stable/10/sys/arm/freescale/vybrid/vf_gpio.c
  stable/10/sys/arm/lpc/lpc_gpio.c
  stable/10/sys/arm/rockchip/rk30xx_gpio.c
  stable/10/sys/arm/samsung/exynos/exynos5_pad.c
  stable/10/sys/arm/ti/ti_gpio.c
  stable/10/sys/arm/xilinx/zy7_gpio.c
  stable/10/sys/arm/xscale/ixp425/avila_gpio.c
  stable/10/sys/arm/xscale/ixp425/cambria_gpio.c
  stable/10/sys/mips/atheros/ar71xx_gpio.c
  stable/10/sys/mips/cavium/octeon_gpio.c
  stable/10/sys/mips/rt305x/rt305x_gpio.c
  stable/10/sys/powerpc/wii/wii_gpio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/allwinner/a10_gpio.c
==
--- stable/10/sys/arm/allwinner/a10_gpio.c  Sat Feb 14 20:32:24 2015
(r278781)
+++ stable/10/sys/arm/allwinner/a10_gpio.c  Sat Feb 14 20:37:33 2015
(r278782)
@@ -474,8 +474,8 @@ a10_gpio_attach(device_t dev)
}
sc->sc_gpio_npins = i;
 
-   device_add_child(dev, "gpioc", device_get_unit(dev));
-   device_add_child(dev, "gpiobus", device_get_unit(dev));
+   device_add_child(dev, "gpioc", -1);
+   device_add_child(dev, "gpiobus", -1);
 
a10_gpio_sc = sc;
 

Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c   Sat Feb 14 20:32:24 
2015(r278781)
+++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c   Sat Feb 14 20:37:33 
2015(r278782)
@@ -747,8 +747,9 @@ bcm_gpio_attach(device_t dev)
 
bcm_gpio_sysctl_init(sc);
 
-   device_add_child(dev, "gpioc", device_get_unit(dev));
-   device_add_child(dev, "gpiobus", device_get_unit(dev));
+   device_add_child(dev, "gpioc", -1);
+   device_add_child(dev, "gpiobus", -1);
+
return (bus_generic_attach(dev));
 
 fail:

Modified: stable/10/sys/arm/freescale/imx/imx_gpio.c
==
--- stable/10/sys/arm/freescale/imx/imx_gpio.c  Sat Feb 14 20:32:24 2015
(r278781)
+++ stable/10/sys/arm/freescale/imx/imx_gpio.c  Sat Feb 14 20:37:33 2015
(r278782)
@@ -435,8 +435,8 @@ imx51_gpio_attach(device_t dev)
"imx_gpio%d.%d", device_get_unit(dev), i);
}
 
-   device_add_child(dev, "gpioc", device_get_unit(dev));
-   device_add_child(dev, "gpiobus", device_get_unit(dev));
+   device_add_child(dev, "gpioc", -1);
+   device_add_child(dev, "gpiobus", -1);
 
return (bus_generic_attach(dev));
 }

Modified: stable/10/sys/arm/freescale/vybrid/vf_gpio.c
==
--- stable/10/sys/arm/freescale/vybrid/vf_gpio.cSat Feb 14 20:32:24 
2015(r278781)
+++ stable/10/sys/arm/freescale/vybrid/vf_gpio.cSat Feb 14 20:37:33 
2015(r278782)
@@ -146,8 +146,8 @@ vf_gpio_attach(device_t dev)
"vf_gpio%d.%d", device_get_unit(dev), i);
}
 
-   device_add_child(dev, "gpioc", device_get_unit(dev));
-   device_add_child(dev, "gpiobus", device_get_unit(dev));
+   device_add_child(dev, "gpioc", -1);
+   device_add_child(dev, "gpiobus", -1);
 
return (bus_generic_attach(dev));
 }

Modified: stable/10/sys/arm/lpc/lpc_gpio.c
==
--- stable/10/sys/arm/lpc/lpc_gpio.cSat Feb 14 20:32:24 2015
(r278781)
+++ stable/10/sys/arm/lpc/lpc_gpio.cSat Feb 14 20:37:33 2015
(r278782)
@@ -192,8 +192,8 @@ lpc_gpio_attach(device_t dev)
 
lpc_gpio_sc = sc;
 
-   device_add_child(dev, "gpioc", device_get_unit(dev));
-   device_add_child(dev, "gpiobus", device_get_unit(dev));
+   device_add_child(dev, "gpioc", -1);
+   device_add_child(dev, "gpiobus", -1);
 
return (bus_generic_attach(dev));
 }

Modified: stable/10/sys/arm/rockchip/rk30xx_gpio.c
==
--- stable/10/sys/arm/rockchip/rk30xx_gpio.cSat Feb 14 20:32:24 2015
(r278781)
+++ stable/10/sys/arm/rockchip/rk30xx_gpio.cSat Feb 14 20:37:33 2015
(r278782)
@@ -504,8 +504,8 @@ rk30_gpio_attach(device_t dev)
}
sc->sc_gpio_npins = i;
 
-   device_add_child(dev, "gpioc", device_get_unit(dev));
-   device_add_child(dev, "gpiobus", device_get_un

svn commit: r278781 - stable/10/sys/dev/gpio

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 20:32:24 2015
New Revision: 278781
URL: https://svnweb.freebsd.org/changeset/base/278781

Log:
  MFC r273566, r273569:
  
  Provide a working GPIOBUS_IVAR() macro for FDT systems.
  
  Move the duplicated code to a single function.
  
  No functional changes.

Modified:
  stable/10/sys/dev/gpio/gpiobus.c
  stable/10/sys/dev/gpio/gpiobusvar.h
  stable/10/sys/dev/gpio/ofw_gpiobus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/gpio/gpiobus.c
==
--- stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 20:00:57 2015
(r278780)
+++ stable/10/sys/dev/gpio/gpiobus.cSat Feb 14 20:32:24 2015
(r278781)
@@ -99,6 +99,34 @@ gpiobus_print_pins(struct gpiobus_ivar *
printf("%d", range_start);
 }
 
+int
+gpiobus_init_softc(device_t dev)
+{
+   struct gpiobus_softc *sc;
+
+   sc = GPIOBUS_SOFTC(dev);
+   sc->sc_busdev = dev;
+   sc->sc_dev = device_get_parent(dev);
+
+   if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0)
+   return (ENXIO);
+
+   KASSERT(sc->sc_npins != 0, ("GPIO device with no pins"));
+
+   /* Pins = GPIO_PIN_MAX() + 1 */
+   sc->sc_npins++;
+
+   sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, 
+   M_NOWAIT | M_ZERO);
+   if (sc->sc_pins_mapped == NULL)
+   return (ENOMEM);
+
+   /* Initialize the bus lock. */
+   GPIOBUS_LOCK_INIT(sc);
+
+   return (0);
+}
+
 static int
 gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask)
 {
@@ -163,30 +191,11 @@ gpiobus_probe(device_t dev)
 static int
 gpiobus_attach(device_t dev)
 {
-   struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev);
-   int res;
-
-   sc->sc_busdev = dev;
-   sc->sc_dev = device_get_parent(dev);
-   res = GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins);
-   if (res)
-   return (ENXIO);
-
-   KASSERT(sc->sc_npins != 0, ("GPIO device with no pins"));
-
-   /*
-* Increase to get number of pins
-*/
-   sc->sc_npins++;
-
-   sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, 
-   M_NOWAIT | M_ZERO);
-
-   if (!sc->sc_pins_mapped)
-   return (ENOMEM);
+   int err;
 
-   /* init bus lock */
-   GPIOBUS_LOCK_INIT(sc);
+   err = gpiobus_init_softc(dev);
+   if (err != 0)
+   return (err);
 
/*
 * Get parent's pins and mark them as unmapped

Modified: stable/10/sys/dev/gpio/gpiobusvar.h
==
--- stable/10/sys/dev/gpio/gpiobusvar.h Sat Feb 14 20:00:57 2015
(r278780)
+++ stable/10/sys/dev/gpio/gpiobusvar.h Sat Feb 14 20:32:24 2015
(r278781)
@@ -41,7 +41,12 @@
 
 #include "gpio_if.h"
 
+#ifdef FDT
+#defineGPIOBUS_IVAR(d) (struct gpiobus_ivar *) 
\
+   &((struct ofw_gpiobus_devinfo *)device_get_ivars(d))->opd_dinfo
+#else
 #defineGPIOBUS_IVAR(d) (struct gpiobus_ivar *) device_get_ivars(d)
+#endif
 #defineGPIOBUS_SOFTC(d) (struct gpiobus_softc *) device_get_softc(d)
 #defineGPIOBUS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
 #defineGPIOBUS_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
@@ -84,6 +89,7 @@ gpio_map_gpios(device_t bus, phandle_t d
 device_t ofw_gpiobus_add_fdt_child(device_t, phandle_t);
 #endif
 void gpiobus_print_pins(struct gpiobus_ivar *);
+int gpiobus_init_softc(device_t);
 
 extern driver_t gpiobus_driver;
 

Modified: stable/10/sys/dev/gpio/ofw_gpiobus.c
==
--- stable/10/sys/dev/gpio/ofw_gpiobus.cSat Feb 14 20:00:57 2015
(r278780)
+++ stable/10/sys/dev/gpio/ofw_gpiobus.cSat Feb 14 20:32:24 2015
(r278781)
@@ -264,33 +264,13 @@ ofw_gpiobus_probe(device_t dev)
 static int
 ofw_gpiobus_attach(device_t dev)
 {
-   struct gpiobus_softc *sc;
+   int err;
phandle_t child;
 
-   sc = GPIOBUS_SOFTC(dev);
-   sc->sc_busdev = dev;
-   sc->sc_dev = device_get_parent(dev);
-
-   /* Read the pin max. value */
-   if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0)
-   return (ENXIO);
-
-   KASSERT(sc->sc_npins != 0, ("GPIO device with no pins"));
-
-   /*
-* Increase to get number of pins.
-*/
-   sc->sc_npins++;
-
-   sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, 
-   M_NOWAIT | M_ZERO);
-
-   if (!sc->sc_pins_mapped)
-   return (ENOMEM);
-
-   /* Init the bus lock. */
-   GPIOBUS_LOCK_INIT(sc);
-
+   err = gpiobus_init_softc(dev);
+   if (err != 0)
+   return (err);
+ 
bus_generic_probe(dev);
bus_enumerate_hinted_children(dev);
 
___
svn-src-all@freebsd.org mailing list
http://

Re: Phabricator + 'Reviewed by' [was Re: svn commit: r278472 - in head/sys: netinet netinet6]

2015-02-14 Thread Ian Lepore
On Sat, 2015-02-14 at 13:59 -0600, Bryan Drewery wrote:
> On 2/14/2015 9:17 AM, Steven Hartland wrote:
> > 
> > On 13/02/2015 23:56, Bryan Drewery wrote:
> >> On 2/9/2015 3:45 PM, Bjoern A. Zeeb wrote:
>    Commented upon by hiren and sbruno
>    See Phabricator D1777 for more details.
> 
>    Commented upon by hiren and sbruno
>    Reviewed by:adrian, jhb and bz
> >>> I have not reviewed this;  as a matter of fact you are aware that I
> >>> still wanted to do that.
> >>>
> >> Something about Phabricator is not jiving with our commit terminology.
> >> This has happened before as well with other commits. I'm sure everyone
> >> is good-intentioned as well.
> >>
> >> There's not 1 person on D1777 who has 'accepted' it. That is what
> >> warrants a 'Reviewed by' to me.
> >>
> >> It's clear to me, but seems unclear to others. I really think the
> >> reviewer list needs to be split up. Rather than using icons, use
> >> separate lists. Reviewers requested: accepted: commented: changes
> >> requested:.
> > I don't think it needs to be split up, that feels unnecessary, if
> > someone hasn't accepted it then they haven't review it period IMO.
> 
> Yes I too think it's obvious, yet I've seen at least 2 commits where the
> reviewed by line was essentially a lie. It's in SVN forever now with
> those names stamped as reviewers.
> 

You make that sound like some sort of huge crisis, but we have glitches
in commit messages (occasionally even a missing/empty message) from time
to time, and life goes on.  Phabricator is supposed to be a tool to make
our lives better and easier, but it could all too easily turn into a
stick to hit people with, and the first step on that path is making a
bunch of rigid formal rules and procedures.

-- Ian


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


svn commit: r278780 - head/sys/kern

2015-02-14 Thread Davide Italiano
Author: davide
Date: Sat Feb 14 20:00:57 2015
New Revision: 278780
URL: https://svnweb.freebsd.org/changeset/base/278780

Log:
  Don't access sockbuf fields directly, use accessor functions instead.
  It is safe to move the call to socantsendmore_locked() after
  sbdrop_locked() as long as we hold the sockbuf lock across the two
  calls.
  
  CR:   D1805
  Reviewed by:  adrian, kmacy, julian, rwatson

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Sat Feb 14 19:41:26 2015(r278779)
+++ head/sys/kern/uipc_socket.c Sat Feb 14 20:00:57 2015(r278780)
@@ -3439,11 +3439,9 @@ soisdisconnecting(struct socket *so)
SOCKBUF_LOCK(&so->so_rcv);
so->so_state &= ~SS_ISCONNECTING;
so->so_state |= SS_ISDISCONNECTING;
-   so->so_rcv.sb_state |= SBS_CANTRCVMORE;
-   sorwakeup_locked(so);
+   socantrcvmore_locked(so);
SOCKBUF_LOCK(&so->so_snd);
-   so->so_snd.sb_state |= SBS_CANTSENDMORE;
-   sowwakeup_locked(so);
+   socantsendmore_locked(so);
wakeup(&so->so_timeo);
 }
 
@@ -3458,12 +3456,10 @@ soisdisconnected(struct socket *so)
SOCKBUF_LOCK(&so->so_rcv);
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
so->so_state |= SS_ISDISCONNECTED;
-   so->so_rcv.sb_state |= SBS_CANTRCVMORE;
-   sorwakeup_locked(so);
+   socantrcvmore_locked(so);
SOCKBUF_LOCK(&so->so_snd);
-   so->so_snd.sb_state |= SBS_CANTSENDMORE;
sbdrop_locked(&so->so_snd, sbused(&so->so_snd));
-   sowwakeup_locked(so);
+   socantsendmore_locked(so);
wakeup(&so->so_timeo);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread Pedro Giffuni


On 02/14/15 13:33, Ian Lepore wrote:

On Sat, 2015-02-14 at 21:15 +0300, Gleb Smirnoff wrote:

   Bruce,

On Sat, Feb 14, 2015 at 08:46:58PM +1100, Bruce Evans wrote:
B> Using VLAs and also the C99 feature of declarations anwhere, and extensions
B> like __aligned(), we can almost implement a full alloca() using the fixed
B> version of this change:
B>
B> /*
B>   * XXX need extended statement-expression so that __buf doesn't go out
B>   * of scope after the right brace.
B>   */
B> #define   my_alloca(n) __extension__ ({
B>   /* XXX need unique name. */ \
B>   char __buf[__roundup2((n), MUMBLE)] __aligned(MUMBLE);  \
B>   \
B>   (void *)__buf;  \
B> })

I like this idea. But would this exact code work? The life of
__buf is limited by the code block, and we exit the block
immediately. Wouldn't the allocation be overwritten if we
enter any function or block later?


Why put any effort into avoiding alloca() in the first place?  Is it
inefficient on some platforms?  On arm it's like 5 instructions, it just
adjusts the size to keep the stack dword-aligned and subtracts the
result from sp, done.


Because it's non-standard and the alloca(3) man page discourages it:
_
...
BUGS
The alloca() function is machine and compiler dependent; its use is dis-
couraged.



It is not disappearing anytime soon though, some even say the man
page is wrong.

Pedro.

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


Re: Phabricator + 'Reviewed by' [was Re: svn commit: r278472 - in head/sys: netinet netinet6]

2015-02-14 Thread Bryan Drewery
On 2/14/2015 9:17 AM, Steven Hartland wrote:
> 
> On 13/02/2015 23:56, Bryan Drewery wrote:
>> On 2/9/2015 3:45 PM, Bjoern A. Zeeb wrote:
   Commented upon by hiren and sbruno
   See Phabricator D1777 for more details.

   Commented upon by hiren and sbruno
   Reviewed by:adrian, jhb and bz
>>> I have not reviewed this;  as a matter of fact you are aware that I
>>> still wanted to do that.
>>>
>> Something about Phabricator is not jiving with our commit terminology.
>> This has happened before as well with other commits. I'm sure everyone
>> is good-intentioned as well.
>>
>> There's not 1 person on D1777 who has 'accepted' it. That is what
>> warrants a 'Reviewed by' to me.
>>
>> It's clear to me, but seems unclear to others. I really think the
>> reviewer list needs to be split up. Rather than using icons, use
>> separate lists. Reviewers requested: accepted: commented: changes
>> requested:.
> I don't think it needs to be split up, that feels unnecessary, if
> someone hasn't accepted it then they haven't review it period IMO.

Yes I too think it's obvious, yet I've seen at least 2 commits where the
reviewed by line was essentially a lie. It's in SVN forever now with
those names stamped as reviewers.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r278779 - stable/10/sys/dev/netmap

2015-02-14 Thread Luigi Rizzo
Author: luigi
Date: Sat Feb 14 19:41:26 2015
New Revision: 278779
URL: https://svnweb.freebsd.org/changeset/base/278779

Log:
  sync the code with the version in head. which the exception of
  svn 275358 (M_FLOWID deprecation, only a couple of lines)
  which cannot be merged.
  
  if_lem_netmap.h, if_re_netmap.h:
  - use the same (commented out) function to update the stat counters
as in HEAD. This is a no-op here
  
  netmap.c
  - merge 274459 (support for private knote lock)
and minor changes on nm_config and comments
  
  netmap_freebsd.c
  - merge 274459 (support for private knote lock)
  - merge 274354 (initialize color if passed as argument)
  
  netmap_generic.c
  - fix a comment
  
  netmap_kern.h
  - revise the lock macros, using sx locks;
merge 274459 (private knote lock)
  
  netmap_monitor.c
  - use full memory barriers
  
  netmap_pipe.c
  - use full memory barriers, use length from the correct queue
(mostly cosmetic, since the queues typically have the same size)

Modified:
  stable/10/sys/dev/netmap/if_lem_netmap.h
  stable/10/sys/dev/netmap/if_re_netmap.h
  stable/10/sys/dev/netmap/netmap.c
  stable/10/sys/dev/netmap/netmap_freebsd.c
  stable/10/sys/dev/netmap/netmap_generic.c
  stable/10/sys/dev/netmap/netmap_kern.h
  stable/10/sys/dev/netmap/netmap_monitor.c
  stable/10/sys/dev/netmap/netmap_pipe.c

Modified: stable/10/sys/dev/netmap/if_lem_netmap.h
==
--- stable/10/sys/dev/netmap/if_lem_netmap.hSat Feb 14 19:28:26 2015
(r278778)
+++ stable/10/sys/dev/netmap/if_lem_netmap.hSat Feb 14 19:41:26 2015
(r278779)
@@ -410,7 +410,7 @@ lem_netmap_rxsync(struct netmap_kring *k
netmap_idx_n2k(kring, 
adapter->next_rx_desc_to_check),
kring->nr_hwtail);
adapter->next_rx_desc_to_check = nic_i;
-   // ifp->if_ipackets += n;
+   // if_inc_counter(ifp, IFCOUNTER_IPACKETS, n);
kring->nr_hwtail = nm_i;
}
kring->nr_kflags &= ~NKR_PENDINTR;

Modified: stable/10/sys/dev/netmap/if_re_netmap.h
==
--- stable/10/sys/dev/netmap/if_re_netmap.h Sat Feb 14 19:28:26 2015
(r278778)
+++ stable/10/sys/dev/netmap/if_re_netmap.h Sat Feb 14 19:41:26 2015
(r278779)
@@ -222,7 +222,7 @@ re_netmap_rxsync(struct netmap_kring *kr
/*  sync was in re_newbuf() */
bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag,
rxd[nic_i].rx_dmamap, BUS_DMASYNC_POSTREAD);
-   // sc->rl_ifp->if_ipackets++;
+   // if_inc_counter(sc->rl_ifp, IFCOUNTER_IPACKETS, 1);
nm_i = nm_next(nm_i, lim);
nic_i = nm_next(nic_i, lim);
}

Modified: stable/10/sys/dev/netmap/netmap.c
==
--- stable/10/sys/dev/netmap/netmap.c   Sat Feb 14 19:28:26 2015
(r278778)
+++ stable/10/sys/dev/netmap/netmap.c   Sat Feb 14 19:41:26 2015
(r278779)
@@ -375,9 +375,14 @@ ports attached to the switch)
 
 /* reduce conditional code */
 // linux API, use for the knlist in FreeBSD
-#define init_waitqueue_head(x) knlist_init_mtx(&(x)->si_note, NULL)
+/* use a private mutex for the knlist */
+#define init_waitqueue_head(x) do {\
+   struct mtx *m = &(x)->m;\
+   mtx_init(m, "nm_kn_lock", NULL, MTX_DEF);   \
+   knlist_init_mtx(&(x)->si.si_note, m);   \
+} while (0)
 
-void freebsd_selwakeup(struct selinfo *si, int pri);
+#define OS_selrecord(a, b) selrecord(a, &((b)->si))
 #define OS_selwakeup(a, b) freebsd_selwakeup(a, b)
 
 #elif defined(linux)
@@ -651,9 +656,8 @@ netmap_update_config(struct netmap_adapt
u_int txr, txd, rxr, rxd;
 
txr = txd = rxr = rxd = 0;
-   if (na->nm_config) {
-   na->nm_config(na, &txr, &txd, &rxr, &rxd);
-   } else {
+   if (na->nm_config == NULL ||
+   na->nm_config(na, &txr, &txd, &rxr, &rxd)) {
/* take whatever we had at init time */
txr = na->num_tx_rings;
txd = na->num_tx_desc;
@@ -806,6 +810,19 @@ netmap_krings_create(struct netmap_adapt
 }
 
 
+#ifdef __FreeBSD__
+static void
+netmap_knlist_destroy(NM_SELINFO_T *si)
+{
+   /* XXX kqueue(9) needed; these will mirror knlist_init. */
+   knlist_delete(&si->si.si_note, curthread, 0 /* not locked */ );
+   knlist_destroy(&si->si.si_note);
+   /* now we don't need the mutex anymore */
+   mtx_destroy(&si->m);
+}
+#endif /* __FreeBSD__ */
+
+
 /* undo the actions performed by netmap_krings_create */
 /* call with NMG_LOCK held */
 void
@@ -816,6 +833,7 @@ netmap_krings_dele

svn commit: r278778 - stable/10/sys/arm/broadcom/bcm2835

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 19:28:26 2015
New Revision: 278778
URL: https://svnweb.freebsd.org/changeset/base/278778

Log:
  MFC: r273264, r274409, r278212, r278213:
  
  Add a workaround needed to fix a bug of Arasan Host Controller where it may
  lose the contents of consecutive writes (that happens within two SD card
  clock cycles).
  
  This fixes the causes of instability during the SD card detection and
  identification on Raspberry Pi (which happens at 400 kHz and so was much
  more vulnerable to this issue).
  
  Remove the previous workaround which clearly can't provide the same effect.
  
  Remove stale comments about the issues with HS mode.
  
  Remove a previous workaround to limit the minimum sdhci frequency that
  isn't needed anymore.
  
  Remove some duplicate calls to bus_release_resource() and destroy the mutex
  on error cases.
  
  While here remove unnecessary includes.

Modified:
  stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
==
--- stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c  Sat Feb 14 19:24:38 
2015(r278777)
+++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c  Sat Feb 14 19:28:26 
2015(r278778)
@@ -29,32 +29,17 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-
-#include 
 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
 #include 
@@ -82,16 +67,9 @@ __FBSDID("$FreeBSD$");
 #define dprintf(fmt, args...)
 #endif
 
-/* 
- * Arasan HC seems to have problem with Data CRC on lower frequencies.
- * Use this tunable to cap initialization sequence frequency at higher
- * value. Default is standard 400kHz
- */
-static int bcm2835_sdhci_min_freq = 40;
 static int bcm2835_sdhci_hs = 1;
 static int bcm2835_sdhci_pio_mode = 0;
 
-TUNABLE_INT("hw.bcm2835.sdhci.min_freq", &bcm2835_sdhci_min_freq);
 TUNABLE_INT("hw.bcm2835.sdhci.hs", &bcm2835_sdhci_hs);
 TUNABLE_INT("hw.bcm2835.sdhci.pio_mode", &bcm2835_sdhci_pio_mode);
 
@@ -208,16 +186,12 @@ bcm_sdhci_attach(device_t dev)
RF_ACTIVE);
if (!sc->sc_irq_res) {
device_printf(dev, "cannot allocate interrupt\n");
-   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
err = ENXIO;
goto fail;
}
 
if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
-   NULL, bcm_sdhci_intr, sc, &sc->sc_intrhand))
-   {
-   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
-   bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
+   NULL, bcm_sdhci_intr, sc, &sc->sc_intrhand)) {
device_printf(dev, "cannot setup interrupt handler\n");
err = ENXIO;
goto fail;
@@ -283,6 +257,7 @@ fail:
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
if (sc->sc_mem_res)
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
+   mtx_destroy(&sc->sc_mtx);
 
return (err);
 }
@@ -319,21 +294,15 @@ RD4(struct bcm_sdhci_softc *sc, bus_size
 static inline void
 WR4(struct bcm_sdhci_softc *sc, bus_size_t off, uint32_t val)
 {
-   bus_space_write_4(sc->sc_bst, sc->sc_bsh, off, val);
 
-   if ((off != SDHCI_BUFFER && off != SDHCI_INT_STATUS && off != 
SDHCI_CLOCK_CONTROL))
-   {
-   int timeout = 10;
-   while (val != bus_space_read_4(sc->sc_bst, sc->sc_bsh, off) 
-   && --timeout > 0)
-   continue;
-
-   if (timeout <= 0)
-   printf("sdhci_brcm: writing 0x%X to reg 0x%X "
-   "always gives 0x%X\n",
-   val, (uint32_t)off, 
-   bus_space_read_4(sc->sc_bst, sc->sc_bsh, off));
-   }
+   bus_space_write_4(sc->sc_bst, sc->sc_bsh, off, val);
+   /*
+* The Arasan HC has a bug where it may lose the content of
+* consecutive writes to registers that are within two SD-card
+* clock cycles of each other (a clock domain crossing problem). 
+*/
+   if (sc->sc_slot.clock > 0)
+   DELAY(((2 * 100) / sc->sc_slot.clock) + 1);
 }
 
 static uint8_t
@@ -425,13 +394,6 @@ bcm_sdhci_write_multi_4(device_t dev, st
bus_space_write_multi_4(sc->sc_bst, sc->sc_bsh, off, data, count);
 }
 
-static uint32_t
-bcm_sdhci_min_freq(device_t dev, struct sdhci_slot *slot)
-{
-
-   return bcm2835_sdhci_min_freq;
-}
-
 static void
 bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc)
 {
@@ -684,7 +646,6 @@ static device_method_t bcm_sdhci_

svn commit: r278776 - head/bin/pkill/tests

2015-02-14 Thread Garrett Cooper
Author: ngie
Date: Sat Feb 14 19:21:04 2015
New Revision: 278776
URL: https://svnweb.freebsd.org/changeset/base/278776

Log:
  Refactor pkill-j_test to reflect the relevant changes done to pgrep-j_test
  
  r278742:
  
  Simplify jail_name_to_jid and try to be more fault tolerant when scanning for
  the jail ID (poll up to 10 times for the jail IDs to become available)
  
  If the scan fails, the code will fall through and fail as it does with Jenkins
  today
  
  r278636:
  
  Parameterize out the amount of sleep done in each test
  
  Set the value in each test to a different amount to avoid potential
  side-effects with other instances of the test (or lingering processes) still
  being present on the system
  
  r278633:
  
  Refactor the tests
  
  1. `id -u` -> 0 is now only checked once; the entire test script is now 
skipped
 if this assertion is violated
  2. De-dent whitespace, based on 1.
  3. Only setup the symlink for $sleep once at the top of the script, and tear 
it
 down once at the bottom of the script

Modified:
  head/bin/pkill/tests/pkill-j_test.sh

Modified: head/bin/pkill/tests/pkill-j_test.sh
==
--- head/bin/pkill/tests/pkill-j_test.shSat Feb 14 19:18:56 2015
(r278775)
+++ head/bin/pkill/tests/pkill-j_test.shSat Feb 14 19:21:04 2015
(r278776)
@@ -4,99 +4,90 @@
 jail_name_to_jid()
 {
local check_name="$1"
-   (
-   line="$(jls -n 2> /dev/null | grep  name=$check_name  )"
-   for nv in $line; do
-   local name="${nv%=*}"
-   if [ "${name}" = "jid" ]; then
-   eval $nv
-   echo $jid
-   break
-   fi
-   done
-   )
+   jls -j "$check_name" -s 2>/dev/null | tr ' ' '\n' | grep jid= | sed -e 
's/.*=//g'
 }
 
 base=pkill_j_test
 
+if [ `id -u` -ne 0 ]; then
+   echo "1..0 # skip Test needs uid 0."
+   exit 0
+fi
+
 echo "1..3"
 
+sleep=$(pwd)/sleep.txt
+ln -sf /bin/sleep $sleep
+
 name="pkill -j "
-if [ `id -u` -eq 0 ]; then
-   sleep=$(pwd)/sleep.txt
-   ln -sf /bin/sleep $sleep
-jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
+sleep_amount=5
+jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
+command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount &
+
+jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
+command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount &
 
-jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
+$sleep $sleep_amount &
 
-   $sleep 5 &
-   sleep 0.5
+for i in `seq 1 10`; do
jid1=$(jail_name_to_jid ${base}_1_1)
jid2=$(jail_name_to_jid ${base}_1_2)
jid="${jid1},${jid2}"
-   if pkill -f -j "$jid" $sleep && sleep 0.5 &&
-   ! -f ${PWD}/${base}_1_1.pid &&
-   ! -f ${PWD}/${base}_1_2.pid ; then
-   echo "ok 1 - $name"
-   else
-   echo "not ok 1 - $name"
-   fi 2>/dev/null
-   rm -f $sleep
-   [ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
-   [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
-   wait
+   case "$jid" in
+   [0-9]+,[0-9]+)
+   break
+   ;;
+   esac
+   sleep 0.1
+done
+
+if pkill -f -j "$jid" $sleep && sleep 0.5 &&
+! -f ${PWD}/${base}_1_1.pid &&
+! -f ${PWD}/${base}_1_2.pid ; then
+   echo "ok 1 - $name"
 else
-   echo "ok 1 - $name # skip Test needs uid 0."
-fi
+   echo "not ok 1 - $name"
+fi 2>/dev/null
+[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
+[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
+wait
 
 name="pkill -j any"
-if [ `id -u` -eq 0 ]; then
-   sleep=$(pwd)/sleep.txt
-   ln -sf /bin/sleep $sleep
-jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
-
-jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
-
-   $sleep 5 &
-   sleep 0.5
-   chpid3=$!
-   if pkill -f -j any $sleep && sleep 0.5 &&
-   [ ! -f ${PWD}/${base}_2_1.pid -a
- ! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then
-   echo "ok 2 - $name"
-   else
-   echo "not ok 2 - $name"
-   fi 2>/dev/null
-   rm -f $sleep
-   [ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
-   [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
-   wait
+sleep_amount=6
+jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
+command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount &
+
+jail -c pat

svn commit: r278775 - stable/10/sys/net

2015-02-14 Thread Luigi Rizzo
Author: luigi
Date: Sat Feb 14 19:18:56 2015
New Revision: 278775
URL: https://svnweb.freebsd.org/changeset/base/278775

Log:
  sync with the version in head (r274338):
  fix one comment, and return kernel-supplied error if available.
  no API changes.

Modified:
  stable/10/sys/net/netmap_user.h

Modified: stable/10/sys/net/netmap_user.h
==
--- stable/10/sys/net/netmap_user.h Sat Feb 14 19:03:11 2015
(r278774)
+++ stable/10/sys/net/netmap_user.h Sat Feb 14 19:18:56 2015
(r278775)
@@ -40,7 +40,7 @@
  * From there:
  * struct netmap_ring *NETMAP_TXRING(nifp, index)
  * struct netmap_ring *NETMAP_RXRING(nifp, index)
- * we can access ring->nr_cur, ring->nr_avail, ring->nr_flags
+ * we can access ring->cur, ring->head, ring->tail, etc.
  *
  * ring->slot[i] gives us the i-th slot (we can access
  * directly len, flags, buf_idx)
@@ -543,7 +543,8 @@ fail:
nm_close(d);
if (errmsg)
D("%s %s", errmsg, ifname);
-   errno = EINVAL;
+   if (errno == 0)
+   errno = EINVAL;
return NULL;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278774 - head/sys/dev/netmap

2015-02-14 Thread Luigi Rizzo
Author: luigi
Date: Sat Feb 14 19:03:11 2015
New Revision: 278774
URL: https://svnweb.freebsd.org/changeset/base/278774

Log:
  two minor changes from the master netmap version:
  1. handle errors from nm_config(), if any (none of the FreeBSD drivers
 currently returns an error on this function, so this change
 is a no-op at this time
  2. use a full memory barrier on ioctls

Modified:
  head/sys/dev/netmap/netmap.c

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cSat Feb 14 18:59:31 2015
(r278773)
+++ head/sys/dev/netmap/netmap.cSat Feb 14 19:03:11 2015
(r278774)
@@ -656,9 +656,8 @@ netmap_update_config(struct netmap_adapt
u_int txr, txd, rxr, rxd;
 
txr = txd = rxr = rxd = 0;
-   if (na->nm_config) {
-   na->nm_config(na, &txr, &txd, &rxr, &rxd);
-   } else {
+   if (na->nm_config == NULL ||
+   na->nm_config(na, &txr, &txd, &rxr, &rxd)) {
/* take whatever we had at init time */
txr = na->num_tx_rings;
txd = na->num_tx_desc;
@@ -2168,7 +2167,7 @@ netmap_ioctl(struct cdev *dev, u_long cm
error = ENXIO;
break;
}
-   rmb(); /* make sure following reads are not from cache */
+   mb(); /* make sure following reads are not from cache */
 
na = priv->np_na;  /* we have a reference */
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278773 - head/sys/dev/netmap

2015-02-14 Thread Luigi Rizzo
Author: luigi
Date: Sat Feb 14 18:59:31 2015
New Revision: 278773
URL: https://svnweb.freebsd.org/changeset/base/278773

Log:
  whitespace change:
  clarify the role of MAKEDEV_ETERNAL_KLD, and remove an old
  #ifdef __FreeBSD__ since the code is valid on all platforms.

Modified:
  head/sys/dev/netmap/netmap.c

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cSat Feb 14 18:57:02 2015
(r278772)
+++ head/sys/dev/netmap/netmap.cSat Feb 14 18:59:31 2015
(r278773)
@@ -3071,16 +3071,14 @@ netmap_init(void)
error = netmap_mem_init();
if (error != 0)
goto fail;
-   /* XXX could use make_dev_credv() to get error number */
-#ifdef __FreeBSD__
-   /* support for the 'eternal' flag */
+   /*
+* MAKEDEV_ETERNAL_KLD avoids an expensive check on syscalls
+* when the module is compiled in.
+* XXX could use make_dev_credv() to get error number
+*/
netmap_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD,
&netmap_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0600,
  "netmap");
-#else
-   netmap_dev = make_dev(&netmap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
- "netmap");
-#endif
if (!netmap_dev)
goto fail;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278772 - in stable/9/etc: . rc.d

2015-02-14 Thread Hiroki Sato
Author: hrs
Date: Sat Feb 14 18:57:02 2015
New Revision: 278772
URL: https://svnweb.freebsd.org/changeset/base/278772

Log:
  MFC r273999 and r271545:
  
  Do not try to create a /dev/log symlink in a jail.
  
  PR:   179828

Modified:
  stable/9/etc/rc.d/syslogd
  stable/9/etc/rc.subr
Directory Properties:
  stable/9/etc/   (props changed)
  stable/9/etc/rc.d/   (props changed)

Modified: stable/9/etc/rc.d/syslogd
==
--- stable/9/etc/rc.d/syslogd   Sat Feb 14 18:56:44 2015(r278771)
+++ stable/9/etc/rc.d/syslogd   Sat Feb 14 18:57:02 2015(r278772)
@@ -29,7 +29,7 @@ syslogd_precmd()
 
#   Transitional symlink for old binaries
#
-   if [ ! -L /dev/log ]; then
+   if [ ! -L /dev/log ] && ! check_jail jailed; then
ln -sf /var/run/log /dev/log
fi
rm -f /var/run/log

Modified: stable/9/etc/rc.subr
==
--- stable/9/etc/rc.subrSat Feb 14 18:56:44 2015(r278771)
+++ stable/9/etc/rc.subrSat Feb 14 18:57:02 2015(r278772)
@@ -2011,6 +2011,22 @@ check_required_after()
return 0
 }
 
+# check_jail mib
+#  Return true if security.jail.$mib exists and set to 1.
+
+check_jail()
+{
+   local _mib _v
+
+   _mib=$1
+   if _v=$(${SYSCTL_N} "security.jail.$_mib" 2> /dev/null); then
+   case $_v in
+   1)  return 0;;
+   esac
+   fi
+   return 1
+}
+
 # check_kern_features mib
 #  Return existence of kern.features.* sysctl MIB as true or
 #  false.  The result will be cached in $_rc_cache_kern_features_
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278771 - stable/10/etc/rc.d

2015-02-14 Thread Hiroki Sato
Author: hrs
Date: Sat Feb 14 18:56:44 2015
New Revision: 278771
URL: https://svnweb.freebsd.org/changeset/base/278771

Log:
  MFC r273999:
  
  Do not try to create a /dev/log symlink in a jail.
  
  PR:   179828

Modified:
  stable/10/etc/rc.d/syslogd
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/syslogd
==
--- stable/10/etc/rc.d/syslogd  Sat Feb 14 18:54:52 2015(r278770)
+++ stable/10/etc/rc.d/syslogd  Sat Feb 14 18:56:44 2015(r278771)
@@ -28,7 +28,7 @@ syslogd_precmd()
 
#   Transitional symlink for old binaries
#
-   if [ ! -L /dev/log ]; then
+   if [ ! -L /dev/log ] && ! check_jail jailed; then
ln -sf /var/run/log /dev/log
fi
rm -f /var/run/log
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278770 - head/sys/arm/arm

2015-02-14 Thread Ian Lepore
Author: ian
Date: Sat Feb 14 18:54:52 2015
New Revision: 278770
URL: https://svnweb.freebsd.org/changeset/base/278770

Log:
  Add logic for handling new-style ARM cpu ID info.
  
  Submitted by: Michal Meloun 

Modified:
  head/sys/arm/arm/cpuinfo.c

Modified: head/sys/arm/arm/cpuinfo.c
==
--- head/sys/arm/arm/cpuinfo.c  Sat Feb 14 18:45:43 2015(r278769)
+++ head/sys/arm/arm/cpuinfo.c  Sat Feb 14 18:54:52 2015(r278770)
@@ -58,9 +58,13 @@ cpuinfo_init(void)
/* ARMv4T CPU */
cpuinfo.architecture = 1;
cpuinfo.revision = (cpuinfo.midr >> 16) & 0x7F;
-   } 
+   } else {
+   /* ARM new id scheme */
+   cpuinfo.architecture = (cpuinfo.midr >> 16) & 0x0F;
+   cpuinfo.revision = (cpuinfo.midr >> 20) & 0x0F;
+   }
} else {
-   /* must be new id scheme */
+   /* non ARM -> must be new id scheme */
cpuinfo.architecture = (cpuinfo.midr >> 16) & 0x0F;
cpuinfo.revision = (cpuinfo.midr >> 20) & 0x0F;
}   
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278769 - stable/10/sys/arm/broadcom/bcm2835

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 18:45:43 2015
New Revision: 278769
URL: https://svnweb.freebsd.org/changeset/base/278769

Log:
  MFC r276298, r276303:
  
  Remove the '#undef DEBUG' that should not be committed.
  
  Removes unused and duplicate headers.
  
  Bring the wait limit on mailbox write to a more sane value.
  
  Fix a off-by-one bug on wait time limit.
  
  Remove extra blank line.

Modified:
  stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c   Sat Feb 14 18:37:36 
2015(r278768)
+++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c   Sat Feb 14 18:45:43 
2015(r278769)
@@ -31,25 +31,16 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
 
-#include 
-#include 
 #include 
 #include 
 
-#include 
-#include 
-
 #include 
 
 #include "mbox_if.h"
@@ -76,7 +67,6 @@ __FBSDID("$FreeBSD$");
mtx_unlock(&(sc)->lock);\
 } while(0)
 
-#undef DEBUG
 #ifdef  DEBUG
 #define dprintf(fmt, args...) printf(fmt, ##args)
 #else
@@ -189,25 +179,21 @@ bcm_mbox_attach(device_t dev)
 static int
 bcm_mbox_write(device_t dev, int chan, uint32_t data)
 {
-   int limit = 2;
+   int limit = 1000;
struct bcm_mbox_softc *sc = device_get_softc(dev);
 
dprintf("bcm_mbox_write: chan %d, data %08x\n", chan, data);
MBOX_LOCK(sc);
-
-   while ((mbox_read_4(sc, REG_STATUS) & STATUS_FULL) && limit--) {
-   DELAY(2);
-   }
-
+   while ((mbox_read_4(sc, REG_STATUS) & STATUS_FULL) && --limit)
+   DELAY(5);
if (limit == 0) {
printf("bcm_mbox_write: STATUS_FULL stuck");
MBOX_UNLOCK(sc);
return (EAGAIN);
}
-   
mbox_write_4(sc, REG_WRITE, MBOX_MSG(chan, data));
-
MBOX_UNLOCK(sc);
+
return (0);
 }
 
@@ -255,4 +241,3 @@ static driver_t bcm_mbox_driver = {
 static devclass_t bcm_mbox_devclass;
 
 DRIVER_MODULE(mbox, simplebus, bcm_mbox_driver, bcm_mbox_devclass, 0, 0);
-
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278768 - stable/10/sys/arm/broadcom/bcm2835

2015-02-14 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 14 18:37:36 2015
New Revision: 278768
URL: https://svnweb.freebsd.org/changeset/base/278768

Log:
  MFC r276296, r277207:
  
  Make consistent use of the correct debug macros across the file.
  
  Fix the C -> K temperature conversion for the dev.cpu.0.temperature sysctl.
  
  Remove the unused temperature conversion macros.

Modified:
  stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.cSat Feb 14 
18:22:31 2015(r278767)
+++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.cSat Feb 14 
18:37:36 2015(r278768)
@@ -64,8 +64,6 @@ __FBSDID("$FreeBSD$");
 #define MHZ2HZ(freq) ((freq) * (1000 * 1000))
 #define OFFSET2MVOLT(val) (1200 + ((val) * 25))
 #define MVOLT2OFFSET(val) (((val) - 1200) / 25)
-#define RAW2K(temp) (((temp) + 273150) / 1000)
-#define K2RAW(temp) (((temp) * 1000) - 273150)
 
 #define DEFAULT_ARM_FREQUENCY   700
 #define DEFAULT_CORE_FREQUENCY  250
@@ -77,6 +75,7 @@ __FBSDID("$FreeBSD$");
 #define MSG_ERROR-9
 #define MHZSTEP 100
 #define HZSTEP(MHZ2HZ(MHZSTEP))
+#defineTZ_ZEROC2732
 
 #define VC_LOCK(sc) do {   \
sema_wait(&vc_sema);\
@@ -125,7 +124,7 @@ TUNABLE_INT("hw.bcm2835.cpufreq.verbose"
 static int cpufreq_lowest_freq = DEFAULT_LOWEST_FREQ;
 TUNABLE_INT("hw.bcm2835.cpufreq.lowest_freq", &cpufreq_lowest_freq);
 
-#ifdef DEBUG
+#ifdef PROP_DEBUG
 static void
 bcm2835_dump(const void *data, int len)
 {
@@ -1215,7 +1214,7 @@ sysctl_bcm2835_devcpu_temperature(SYSCTL
return (EIO);
 
/* 1/1000 celsius (raw) to 1/10 kelvin */
-   val = RAW2K(val) * 10;
+   val = val / 100 + TZ_ZEROC;
 
err = sysctl_handle_int(oidp, &val, 0, req);
if (err || !req->newptr) /* error || read request */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread Ian Lepore
On Sat, 2015-02-14 at 21:15 +0300, Gleb Smirnoff wrote:
>   Bruce,
> 
> On Sat, Feb 14, 2015 at 08:46:58PM +1100, Bruce Evans wrote:
> B> Using VLAs and also the C99 feature of declarations anwhere, and extensions
> B> like __aligned(), we can almost implement a full alloca() using the fixed
> B> version of this change:
> B> 
> B> /*
> B>   * XXX need extended statement-expression so that __buf doesn't go out
> B>   * of scope after the right brace.
> B>   */
> B> #definemy_alloca(n) __extension__ ({
> B>/* XXX need unique name. */ \
> B>char __buf[__roundup2((n), MUMBLE)] __aligned(MUMBLE);  \
> B>\
> B>(void *)__buf;  \
> B> })
> 
> I like this idea. But would this exact code work? The life of
> __buf is limited by the code block, and we exit the block
> immediately. Wouldn't the allocation be overwritten if we
> enter any function or block later?
> 

Why put any effort into avoiding alloca() in the first place?  Is it
inefficient on some platforms?  On arm it's like 5 instructions, it just
adjusts the size to keep the stack dword-aligned and subtracts the
result from sp, done.

-- Ian

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


svn commit: r278767 - head/usr.sbin/pw/tests

2015-02-14 Thread Brad Davis
Author: brd (doc committer)
Date: Sat Feb 14 18:22:31 2015
New Revision: 278767
URL: https://svnweb.freebsd.org/changeset/base/278767

Log:
  Remove an extra curly bracket that was causing intermittent failures.
  
  PR:   197612
  Submitted by: Robert O'Niel 
  Approved by:  will

Modified:
  head/usr.sbin/pw/tests/pw_usernext.sh

Modified: head/usr.sbin/pw/tests/pw_usernext.sh
==
--- head/usr.sbin/pw/tests/pw_usernext.sh   Sat Feb 14 18:15:14 2015
(r278766)
+++ head/usr.sbin/pw/tests/pw_usernext.sh   Sat Feb 14 18:22:31 2015
(r278767)
@@ -32,7 +32,7 @@ usernext_assigned_group_body() {
atf_check -s exit:0 ${PW} useradd -n test$var0 -g 0
var0=`expr $var0 + 1`
done
-   atf_check -s exit:0 -o match:"100${LIMIT}:1001}" \
+   atf_check -s exit:0 -o match:"100${LIMIT}:1001" \
${PW} usernext
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-02-14 Thread Mateusz Guzik
On Sat, Feb 14, 2015 at 05:02:51PM +, John Baldwin wrote:
> +SYSCTL_ULONG(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created,
> +0, "Number of vnodes created by getnewvnode");
> +
[..]
> +static u_long recycles_count;
> +SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0,
> +"Number of vnodes recycled to avoid exceding kern.maxvnodes");
> +

CTLFLAG_MPSAFE?

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


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

2015-02-14 Thread Gleb Smirnoff
On Sat, Feb 14, 2015 at 05:02:51PM +, John Baldwin wrote:
J> Author: jhb
J> Date: Sat Feb 14 17:02:51 2015
J> New Revision: 278760
J> URL: https://svnweb.freebsd.org/changeset/base/278760
J> 
J> Log:
J>   Add two new counters for vnode life cycle events:
J>   - vfs.recycles counts the number of vnodes forcefully recycled to avoid
J> exceeding kern.maxvnodes.
J>   - vfs.vnodes_created counts the number of vnodes created by successful
J> calls to getnewvnode().
J>   
J>   Differential Revision: https://reviews.freebsd.org/D1671
J>   Reviewed by:   kib
J>   MFC after: 1 week

Why don't use counter(9) for that? Would avoid atomics.


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


svn commit: r278765 - head/sys/dev/ath

2015-02-14 Thread Adrian Chadd
Author: adrian
Date: Sat Feb 14 18:14:45 2015
New Revision: 278765
URL: https://svnweb.freebsd.org/changeset/base/278765

Log:
  Move the lock destruction/creation to earlier in the process - if
  interrupts are enabled and the NIC is awake (think: loading a module)
  then there's a not-quite-zero window where we'll get an interrupt
  for the device before the attach method is called to finish setting
  up the hardware.
  
  Since I grab locks in ath_intr() to check various things, the locks
  need to be ready much earlier.

Modified:
  head/sys/dev/ath/if_ath_pci.c

Modified: head/sys/dev/ath/if_ath_pci.c
==
--- head/sys/dev/ath/if_ath_pci.c   Sat Feb 14 17:45:53 2015
(r278764)
+++ head/sys/dev/ath/if_ath_pci.c   Sat Feb 14 18:14:45 2015
(r278765)
@@ -279,6 +279,13 @@ ath_pci_attach(device_t dev)
 */
sc->sc_invalid = 1;
 
+   ATH_LOCK_INIT(sc);
+   ATH_PCU_LOCK_INIT(sc);
+   ATH_RX_LOCK_INIT(sc);
+   ATH_TX_LOCK_INIT(sc);
+   ATH_TX_IC_LOCK_INIT(sc);
+   ATH_TXSTATUS_LOCK_INIT(sc);
+
/*
 * Arrange interrupt line.
 */
@@ -329,7 +336,7 @@ ath_pci_attach(device_t dev)
if (fw == NULL) {
device_printf(dev, "%s: couldn't find firmware\n",
__func__);
-   goto bad3;
+   goto bad4;
}
 
device_printf(dev, "%s: EEPROM firmware @ %p\n",
@@ -339,30 +346,20 @@ ath_pci_attach(device_t dev)
if (! sc->sc_eepromdata) {
device_printf(dev, "%s: can't malloc eepromdata\n",
__func__);
-   goto bad3;
+   goto bad4;
}
memcpy(sc->sc_eepromdata, fw->data, fw->datasize);
firmware_put(fw, 0);
}
 #endif /* ATH_EEPROM_FIRMWARE */
 
-   ATH_LOCK_INIT(sc);
-   ATH_PCU_LOCK_INIT(sc);
-   ATH_RX_LOCK_INIT(sc);
-   ATH_TX_LOCK_INIT(sc);
-   ATH_TX_IC_LOCK_INIT(sc);
-   ATH_TXSTATUS_LOCK_INIT(sc);
-
error = ath_attach(pci_get_device(dev), sc);
if (error == 0) /* success */
return 0;
 
-   ATH_TXSTATUS_LOCK_DESTROY(sc);
-   ATH_PCU_LOCK_DESTROY(sc);
-   ATH_RX_LOCK_DESTROY(sc);
-   ATH_TX_IC_LOCK_DESTROY(sc);
-   ATH_TX_LOCK_DESTROY(sc);
-   ATH_LOCK_DESTROY(sc);
+#ifdef ATH_EEPROM_FIRMWARE
+bad4:
+#endif
bus_dma_tag_destroy(sc->sc_dmat);
 bad3:
bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih);
@@ -370,6 +367,14 @@ bad2:
bus_release_resource(dev, SYS_RES_IRQ, 0, psc->sc_irq);
 bad1:
bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, psc->sc_sr);
+
+   ATH_TXSTATUS_LOCK_DESTROY(sc);
+   ATH_PCU_LOCK_DESTROY(sc);
+   ATH_RX_LOCK_DESTROY(sc);
+   ATH_TX_IC_LOCK_DESTROY(sc);
+   ATH_TX_LOCK_DESTROY(sc);
+   ATH_LOCK_DESTROY(sc);
+
 bad:
return (error);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278766 - head/sys/net

2015-02-14 Thread Hiroki Sato
Author: hrs
Date: Sat Feb 14 18:15:14 2015
New Revision: 278766
URL: https://svnweb.freebsd.org/changeset/base/278766

Log:
  Fix a panic when tearing down a vnet on a VIMAGE-enabled kernel.
  There was a race that bridge_ifdetach() could be called via
  ifnet_departure event handler after vnet_bridge_uninit().
  
  PR:   195859
  Reported by:  Danilo Egea Gondolfo

Modified:
  head/sys/net/if_bridge.c

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cSat Feb 14 18:14:45 2015(r278765)
+++ head/sys/net/if_bridge.cSat Feb 14 18:15:14 2015(r278766)
@@ -228,7 +228,7 @@ struct bridge_softc {
 
 static VNET_DEFINE(struct mtx, bridge_list_mtx);
 #defineV_bridge_list_mtx   VNET(bridge_list_mtx)
-eventhandler_tag   bridge_detach_cookie = NULL;
+static eventhandler_tag bridge_detach_cookie;
 
 intbridge_rtable_prune_period = BRIDGE_RTABLE_PRUNE_PERIOD;
 
@@ -538,6 +538,7 @@ vnet_bridge_uninit(const void *unused __
 {
 
if_clone_detach(V_bridge_cloner);
+   V_bridge_cloner = NULL;
BRIDGE_LIST_LOCK_DESTROY();
 }
 VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
@@ -1797,7 +1798,13 @@ bridge_ifdetach(void *arg __unused, stru
 
if (ifp->if_flags & IFF_RENAMING)
return;
-
+   if (V_bridge_cloner == NULL) {
+   /*
+* This detach handler can be called after
+* vnet_bridge_uninit().  Just return in that case.
+*/
+   return;
+   }
/* Check if the interface is a bridge member */
if (sc != NULL) {
BRIDGE_LOCK(sc);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread Gleb Smirnoff
  Bruce,

On Sat, Feb 14, 2015 at 08:46:58PM +1100, Bruce Evans wrote:
B> Using VLAs and also the C99 feature of declarations anwhere, and extensions
B> like __aligned(), we can almost implement a full alloca() using the fixed
B> version of this change:
B> 
B> /*
B>   * XXX need extended statement-expression so that __buf doesn't go out
B>   * of scope after the right brace.
B>   */
B> #define  my_alloca(n) __extension__ ({
B>  /* XXX need unique name. */ \
B>  char __buf[__roundup2((n), MUMBLE)] __aligned(MUMBLE);  \
B>  \
B>  (void *)__buf;  \
B> })

I like this idea. But would this exact code work? The life of
__buf is limited by the code block, and we exit the block
immediately. Wouldn't the allocation be overwritten if we
enter any function or block later?

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


svn commit: r278764 - head/sys/dev/wpi

2015-02-14 Thread Adrian Chadd
Author: adrian
Date: Sat Feb 14 17:45:53 2015
New Revision: 278764
URL: https://svnweb.freebsd.org/changeset/base/278764

Log:
  More fixes to wpi(4), again not by me! Woo!
  
  - Use IEEE80211_F_DATAPAD;
  - (c->ic_flags & IEEE80211_CHAN_PASSIVE) -> IEEE80211_IS_CHAN_PASSIVE(c);
  - Convert ackfailcnt to int (there is dereference to *(int *) in 
ieee80211_ratectl_tx_complete());
  - Fix & move cleanup to the end in wpi_rx_done();
  - Add missed lock in wpi_update_beacon();
  - Try to fix powersave.
  
  PR:   kern/197143
  Submitted by:  Andriy Voskoboinyk 

Modified:
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wpi/if_wpireg.h

Modified: head/sys/dev/wpi/if_wpi.c
==
--- head/sys/dev/wpi/if_wpi.c   Sat Feb 14 17:44:24 2015(r278763)
+++ head/sys/dev/wpi/if_wpi.c   Sat Feb 14 17:45:53 2015(r278764)
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
  *
  * A similar thing happens with the tx rings. The difference is the firmware
  * stop processing buffers once the queue is full and until confirmation
- * of a successful transmition (tx_intr) has occurred.
+ * of a successful transmition (tx_done) has occurred.
  *
  * The command ring operates in the same manner as the tx queues.
  *
@@ -447,6 +447,8 @@ wpi_attach(device_t dev)
ic->ic_cryptocaps =
  IEEE80211_CRYPTO_AES_CCM;
 
+   ic->ic_flags |= IEEE80211_F_DATAPAD;
+
/*
 * Read in the eeprom and also setup the channels for
 * net80211. We don't set the rates as net80211 does this for us
@@ -1378,8 +1380,7 @@ wpi_read_eeprom_band(struct wpi_softc *s
"adding chan %d (%dMHz) flags=0x%x maxpwr=%d passive=%d,"
" offset %d\n", chan, c->ic_freq,
channels[i].flags, sc->maxpwr[chan],
-   (c->ic_flags & IEEE80211_CHAN_PASSIVE) != 0,
-   ic->ic_nchans);
+   IEEE80211_IS_CHAN_PASSIVE(c), ic->ic_nchans);
}
 }
 
@@ -1695,8 +1696,7 @@ wpi_rx_done(struct wpi_softc *sc, struct
 
if (stat->len > WPI_STAT_MAXLEN) {
device_printf(sc->sc_dev, "invalid RX statistic header\n");
-   if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   return;
+   goto fail1;
}
 
bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
@@ -1714,23 +1714,20 @@ wpi_rx_done(struct wpi_softc *sc, struct
if ((flags & WPI_RX_NOERROR) != WPI_RX_NOERROR) {
DPRINTF(sc, WPI_DEBUG_RECV, "%s: RX flags error %x\n",
__func__, flags);
-   if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   return;
+   goto fail1;
}
/* Discard frames that are too short. */
if (len < sizeof (*wh)) {
DPRINTF(sc, WPI_DEBUG_RECV, "%s: frame too short: %d\n",
__func__, len);
-   if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   return;
+   goto fail1;
}
 
m1 = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUMPAGESIZE);
if (m1 == NULL) {
DPRINTF(sc, WPI_DEBUG_ANY, "%s: no mbuf to restock ring\n",
__func__);
-   if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   return;
+   goto fail1;
}
bus_dmamap_unload(ring->data_dmat, data->map);
 
@@ -1752,8 +1749,7 @@ wpi_rx_done(struct wpi_softc *sc, struct
ring->desc[ring->cur] = htole32(paddr);
bus_dmamap_sync(ring->data_dmat, ring->desc_dma.map,
BUS_DMASYNC_PREWRITE);
-   if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   return;
+   goto fail1;
}
 
m = data->m;
@@ -1777,18 +1773,14 @@ wpi_rx_done(struct wpi_softc *sc, struct
if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) &&
!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
cip != NULL && cip->ic_cipher == IEEE80211_CIPHER_AES_CCM) {
-   if ((flags & WPI_RX_CIPHER_MASK) != WPI_RX_CIPHER_CCMP) {
-   if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   m_freem(m);
-   return;
-   }
+   if ((flags & WPI_RX_CIPHER_MASK) != WPI_RX_CIPHER_CCMP)
+   goto fail2;
+
/* Check whether decryption was successful or not. */
if ((flags & WPI_RX_DECRYPT_MASK) != WPI_RX_DECRYPT_OK) {
DPRINTF(sc, WPI_DEBUG_RECV,
"CCMP decryption failed 0x%x\n", flags);
-   if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   m_freem(m);
-   return;
+   goto fail2;
}
m->m_flags |= M_WEP;
}
@@ -1817,6 +1809,13 @@ wpi_rx_done(struct wpi_softc *sc, struct
 

svn commit: r278762 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-02-14 Thread Adrian Chadd
Author: adrian
Date: Sat Feb 14 17:43:54 2015
New Revision: 278762
URL: https://svnweb.freebsd.org/changeset/base/278762

Log:
  Quieten a clang warning.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c   Sat Feb 14 
17:12:31 2015(r278761)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c   Sat Feb 14 
17:43:54 2015(r278762)
@@ -394,7 +394,7 @@ ar9300_gpio_get(struct ath_hal *ah, u_in
 {
 u_int32_t gpio_in;
 HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
-if ((gpio == AR9382_GPIO_PIN_8_RESERVED))
+if (gpio == AR9382_GPIO_PIN_8_RESERVED)
 {
 return 0x;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278763 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-02-14 Thread Adrian Chadd
Author: adrian
Date: Sat Feb 14 17:44:24 2015
New Revision: 278763
URL: https://svnweb.freebsd.org/changeset/base/278763

Log:
  Comment out a double declaration of this particular function name.
  It trips up gcc builds.
  
  Pointy-hat-from:  jenkins, kib

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hSat Feb 14 17:43:54 
2015(r278762)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.hSat Feb 14 17:44:24 
2015(r278763)
@@ -1239,7 +1239,9 @@ extern  HAL_BOOL ar9300_set_mac_address(
 extern  void ar9300_get_bss_id_mask(struct ath_hal *ah, u_int8_t *mac);
 extern  HAL_BOOL ar9300_set_bss_id_mask(struct ath_hal *, const u_int8_t *);
 extern  HAL_STATUS ar9300_select_ant_config(struct ath_hal *ah, u_int32_t cfg);
+#if 0
 extern  u_int32_t ar9300_ant_ctrl_common_get(struct ath_hal *ah, HAL_BOOL 
is_2ghz);
+#endif
 extern HAL_BOOL ar9300_ant_swcom_sel(struct ath_hal *ah, u_int8_t ops,
 u_int32_t *common_tbl1, u_int32_t 
*common_tbl2);
 extern  HAL_BOOL ar9300_set_regulatory_domain(struct ath_hal *ah,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278761 - in head: sys/kern usr.bin/gcore

2015-02-14 Thread John Baldwin
Author: jhb
Date: Sat Feb 14 17:12:31 2015
New Revision: 278761
URL: https://svnweb.freebsd.org/changeset/base/278761

Log:
  Include OBJT_PHYS VM objects in ELF core dumps. In particular this
  includes the shared page allowing debuggers to use the signal trampoline
  code to identify signal frames in core dumps.
  
  Differential Revision:https://reviews.freebsd.org/D1828
  Reviewed by:  alc, kib
  MFC after:1 week

Modified:
  head/sys/kern/imgact_elf.c
  head/usr.bin/gcore/elfcore.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Sat Feb 14 17:02:51 2015(r278760)
+++ head/sys/kern/imgact_elf.c  Sat Feb 14 17:12:31 2015(r278761)
@@ -1401,7 +1401,8 @@ each_writable_segment(td, func, closure)
object = backing_object;
}
ignore_entry = object->type != OBJT_DEFAULT &&
-   object->type != OBJT_SWAP && object->type != OBJT_VNODE;
+   object->type != OBJT_SWAP && object->type != OBJT_VNODE &&
+   object->type != OBJT_PHYS;
VM_OBJECT_RUNLOCK(object);
if (ignore_entry)
continue;

Modified: head/usr.bin/gcore/elfcore.c
==
--- head/usr.bin/gcore/elfcore.cSat Feb 14 17:02:51 2015
(r278760)
+++ head/usr.bin/gcore/elfcore.cSat Feb 14 17:12:31 2015
(r278761)
@@ -511,7 +511,8 @@ readmap(pid_t pid)
((pflags & PFLAGS_FULL) == 0 &&
kve->kve_type != KVME_TYPE_DEFAULT &&
kve->kve_type != KVME_TYPE_VNODE &&
-   kve->kve_type != KVME_TYPE_SWAP))
+   kve->kve_type != KVME_TYPE_SWAP &&
+   kve->kve_type != KVME_TYPE_PHYS))
continue;
 
ent = calloc(1, sizeof(*ent));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278760 - head/sys/kern

2015-02-14 Thread John Baldwin
Author: jhb
Date: Sat Feb 14 17:02:51 2015
New Revision: 278760
URL: https://svnweb.freebsd.org/changeset/base/278760

Log:
  Add two new counters for vnode life cycle events:
  - vfs.recycles counts the number of vnodes forcefully recycled to avoid
exceeding kern.maxvnodes.
  - vfs.vnodes_created counts the number of vnodes created by successful
calls to getnewvnode().
  
  Differential Revision:https://reviews.freebsd.org/D1671
  Reviewed by:  kib
  MFC after:1 week

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cSat Feb 14 16:23:04 2015(r278759)
+++ head/sys/kern/vfs_subr.cSat Feb 14 17:02:51 2015(r278760)
@@ -122,6 +122,10 @@ static unsigned long   numvnodes;
 SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0,
 "Number of vnodes in existence");
 
+static u_long vnodes_created;
+SYSCTL_ULONG(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created,
+0, "Number of vnodes created by getnewvnode");
+
 /*
  * Conversion tables for conversion from vnode types to inode formats
  * and back.
@@ -156,6 +160,10 @@ static int vlru_allow_cache_src;
 SYSCTL_INT(_vfs, OID_AUTO, vlru_allow_cache_src, CTLFLAG_RW,
 &vlru_allow_cache_src, 0, "Allow vlru to reclaim source vnode");
 
+static u_long recycles_count;
+SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0,
+"Number of vnodes recycled to avoid exceding kern.maxvnodes");
+
 /*
  * Various variables used for debugging the new implementation of
  * reassignbuf().
@@ -788,6 +796,7 @@ vlrureclaim(struct mount *mp)
}
KASSERT((vp->v_iflag & VI_DOOMED) == 0,
("VI_DOOMED unexpectedly detected in vlrureclaim()"));
+   atomic_add_long(&recycles_count, 1);
vgonel(vp);
VOP_UNLOCK(vp, 0);
vdropl(vp);
@@ -988,8 +997,10 @@ vtryrecycle(struct vnode *vp)
__func__, vp);
return (EBUSY);
}
-   if ((vp->v_iflag & VI_DOOMED) == 0)
+   if ((vp->v_iflag & VI_DOOMED) == 0) {
+   atomic_add_long(&recycles_count, 1);
vgonel(vp);
+   }
VOP_UNLOCK(vp, LK_INTERLOCK);
vn_finished_write(vnmp);
return (0);
@@ -1093,6 +1104,7 @@ getnewvnode(const char *tag, struct moun
atomic_add_long(&numvnodes, 1);
mtx_unlock(&vnode_free_list_mtx);
 alloc:
+   atomic_add_long(&vnodes_created, 1);
vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK|M_ZERO);
/*
 * Setup locks.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278759 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-02-14 Thread Adrian Chadd
Author: adrian
Date: Sat Feb 14 16:23:04 2015
New Revision: 278759
URL: https://svnweb.freebsd.org/changeset/base/278759

Log:
  Remove the reserved pin 11 from the HAL check.
  
  The QCA9565 can have RFKILL on GPIO Pin 11, and thus we need to configure
  it up correctly or the NIC may not function.
  
  I'm not sure why the AR9382 can't use GPIO 8 / GPIO 11 ; it's likely
  hooked up to some external LNA or filter.  The real solution is to
  make it only block pin 8 / pin 11 for AR9382, but the AR9382 probes
  like an AR9380.  Sigh.
  
  Submitted by: Anthony Jenkins 

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c   Sat Feb 14 
15:14:41 2015(r278758)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c   Sat Feb 14 
16:23:04 2015(r278759)
@@ -162,7 +162,6 @@ ar9300_gpio_cfg_output(
 
 HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
 if ((gpio == AR9382_GPIO_PIN_8_RESERVED)  ||
-(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
 (gpio == AR9382_GPIO_9_INPUT_ONLY))
 {
 return AH_FALSE;
@@ -348,7 +347,6 @@ ar9300_gpio_cfg_input(struct ath_hal *ah
 
 HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
 if ((gpio == AR9382_GPIO_PIN_8_RESERVED)  ||
-(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
 (gpio > AR9382_MAX_GPIO_INPUT_PIN_NUM))
 {
 return AH_FALSE;
@@ -378,7 +376,6 @@ ar9300_gpio_set(struct ath_hal *ah, u_in
 {
 HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
 if ((gpio == AR9382_GPIO_PIN_8_RESERVED)  ||
-(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
 (gpio == AR9382_GPIO_9_INPUT_ONLY))
 {
 return AH_FALSE;
@@ -397,8 +394,7 @@ ar9300_gpio_get(struct ath_hal *ah, u_in
 {
 u_int32_t gpio_in;
 HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
-if ((gpio == AR9382_GPIO_PIN_8_RESERVED) ||
-(gpio == AR9382_GPIO_PIN_11_RESERVED))
+if ((gpio == AR9382_GPIO_PIN_8_RESERVED))
 {
 return 0x;
 }
@@ -453,7 +449,6 @@ ar9300_gpio_set_intr(struct ath_hal *ah,
 HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
 
 if ((gpio == AR9382_GPIO_PIN_8_RESERVED) ||
-(gpio == AR9382_GPIO_PIN_11_RESERVED) ||
 (gpio > AR9382_MAX_GPIO_INPUT_PIN_NUM))
 {
 return;
@@ -549,8 +544,7 @@ ar9300_gpio_get_mask(struct ath_hal *ah)
 
 if (AH_PRIVATE(ah)->ah_devid == AR9300_DEVID_AR9380_PCIE) {
 mask = (1 << AR9382_MAX_GPIO_PIN_NUM) - 1;
-mask &= ~(1 << AR9382_GPIO_PIN_8_RESERVED |
-  1 << AR9382_GPIO_PIN_11_RESERVED);
+mask &= ~(1 << AR9382_GPIO_PIN_8_RESERVED);
 }
 return mask;
 }
@@ -562,8 +556,7 @@ ar9300_gpio_set_mask(struct ath_hal *ah,
 
 if (AH_PRIVATE(ah)->ah_devid == AR9300_DEVID_AR9380_PCIE) {
 invalid = ~((1 << AR9382_MAX_GPIO_PIN_NUM) - 1);
-invalid |= 1 << AR9382_GPIO_PIN_8_RESERVED |
-   1 << AR9382_GPIO_PIN_11_RESERVED;
+invalid |= 1 << AR9382_GPIO_PIN_8_RESERVED;
 }
 if (mask & invalid) {
 ath_hal_printf(ah, "%s: invalid GPIO mask 0x%x\n", __func__, mask);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: Phabricator + 'Reviewed by' [was Re: svn commit: r278472 - in head/sys: netinet netinet6]

2015-02-14 Thread Steven Hartland


On 13/02/2015 23:56, Bryan Drewery wrote:

On 2/9/2015 3:45 PM, Bjoern A. Zeeb wrote:

  Commented upon by hiren and sbruno
  See Phabricator D1777 for more details.

  Commented upon by hiren and sbruno
  Reviewed by:  adrian, jhb and bz

I have not reviewed this;  as a matter of fact you are aware that I still 
wanted to do that.


Something about Phabricator is not jiving with our commit terminology.
This has happened before as well with other commits. I'm sure everyone
is good-intentioned as well.

There's not 1 person on D1777 who has 'accepted' it. That is what
warrants a 'Reviewed by' to me.

It's clear to me, but seems unclear to others. I really think the
reviewer list needs to be split up. Rather than using icons, use
separate lists. Reviewers requested: accepted: commented: changes
requested:.
I don't think it needs to be split up, that feels unnecessary, if 
someone hasn't accepted it then they haven't review it period IMO.

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


svn commit: r278758 - head/lib/libc/gen

2015-02-14 Thread Tijl Coosemans
Author: tijl
Date: Sat Feb 14 15:14:41 2015
New Revision: 278758
URL: https://svnweb.freebsd.org/changeset/base/278758

Log:
  The ld(1) flag is -Bsymbolic not -Wsymbolic.

Modified:
  head/lib/libc/gen/dlopen.3

Modified: head/lib/libc/gen/dlopen.3
==
--- head/lib/libc/gen/dlopen.3  Sat Feb 14 14:13:00 2015(r278757)
+++ head/lib/libc/gen/dlopen.3  Sat Feb 14 15:14:41 2015(r278758)
@@ -32,7 +32,7 @@
 .\" @(#) dlopen.3 1.6 90/01/31 SMI
 .\" $FreeBSD$
 .\"
-.Dd December 21, 2011
+.Dd February 14, 2015
 .Dt DLOPEN 3
 .Os
 .Sh NAME
@@ -236,7 +236,7 @@ as follows, in the given order:
 The referencing object itself (or the object from which the call to
 .Fn dlsym
 is made), if that object was linked using the
-.Fl Wsymbolic
+.Fl Bsymbolic
 option to
 .Xr ld 1 .
 .It
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278755 - vendor/clang/clang-release_360-r229040

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 12:19:35 2015
New Revision: 278755
URL: https://svnweb.freebsd.org/changeset/base/278755

Log:
  Tag clang tags/RELEASE_360/rc3 r229040 (effectively, 3.6.0 RC3).

Added:
  vendor/clang/clang-release_360-r229040/
 - copied from r278754, vendor/clang/dist/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278754 - in vendor/clang/dist: docs include/clang/Basic lib/AST lib/CodeGen lib/Driver lib/Parse lib/Sema lib/Serialization test/CXX/expr/expr.prim/expr.prim.lambda test/CodeGenCUDA te...

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 12:18:48 2015
New Revision: 278754
URL: https://svnweb.freebsd.org/changeset/base/278754

Log:
  Vendor import of clang RELEASE_360/rc3 tag r229040 (effectively, 3.6.0 RC3):
  https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc3@229040

Added:
  vendor/clang/dist/test/CodeGenCUDA/llvm-used.cu
  vendor/clang/dist/test/PCH/implicitly-deleted.cpp   (contents, props changed)
Modified:
  vendor/clang/dist/docs/ReleaseNotes.rst
  vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td
  vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td
  vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
  vendor/clang/dist/lib/AST/DeclCXX.cpp
  vendor/clang/dist/lib/CodeGen/CGClass.cpp
  vendor/clang/dist/lib/CodeGen/CGExprScalar.cpp
  vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp
  vendor/clang/dist/lib/CodeGen/CodeGenModule.h
  vendor/clang/dist/lib/Driver/Tools.cpp
  vendor/clang/dist/lib/Parse/ParseExprCXX.cpp
  vendor/clang/dist/lib/Sema/SemaDecl.cpp
  vendor/clang/dist/lib/Sema/SemaLookup.cpp
  vendor/clang/dist/lib/Serialization/ASTWriterDecl.cpp
  vendor/clang/dist/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp
  vendor/clang/dist/test/CodeGenCXX/ctor-dtor-alias.cpp
  vendor/clang/dist/test/CodeGenCXX/debug-info-line.cpp
  vendor/clang/dist/test/Parser/cxx0x-lambda-expressions.cpp
  vendor/clang/dist/test/Parser/objcxx0x-lambda-expressions.mm
  vendor/clang/dist/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
  vendor/clang/dist/test/SemaCXX/lambda-expressions.cpp

Modified: vendor/clang/dist/docs/ReleaseNotes.rst
==
--- vendor/clang/dist/docs/ReleaseNotes.rst Sat Feb 14 12:18:37 2015
(r278753)
+++ vendor/clang/dist/docs/ReleaseNotes.rst Sat Feb 14 12:18:48 2015
(r278754)
@@ -98,6 +98,8 @@ Windows Support
 
 - Basic support for DWARF debug information in COFF files
 
+- Support for Visual C++ '__super' keyword
+
 
 C Language Changes in Clang
 ---
@@ -118,10 +120,35 @@ C++ Language Changes in Clang
 - Clang will put individual ``.init_array/.ctors`` sections in
   comdats, reducing code duplication and speeding up startup.
 
-C++11 Feature Support
+C++17 Feature Support
 ^
 
-...
+Clang has experimental support for some proposed C++1z (tentatively, C++17)
+features. This support can be enabled using the `-std=c++1z` flag.
+
+New in Clang 3.6 is support for:
+
+- Fold expressions
+
+- `u8` character literals
+
+- Nested namespace definitions: `namespace A::B { ... }` as a shorthand for
+  `namespace A { namespace B { ... } }`
+
+- Attributes for namespaces and enumerators
+
+- Constant evaluation for all non-type template arguments
+
+Note that these features may be changed or removed in future Clang releases
+without notice.
+
+Support for `for (identifier : range)` as a synonym for
+`for (auto &&identifier : range)` has been removed as it is no longer currently
+considered for C++17.
+
+For more details on C++ feature support, see
+`the C++ status page `_.
+
 
 Objective-C Language Changes in Clang
 -
@@ -133,6 +160,19 @@ OpenCL C Language Changes in Clang
 
 ...
 
+OpenMP Language Changes in Clang
+
+
+Clang 3.6 contains codegen for many individual pragmas for OpenMP but 
combinations are not completed as yet. 
+We plan to continue codegen code drop aiming for completion for 3.7. Please 
see this link for up-to-date 
+`status 
_`
+LLVM�s OpenMP runtime library, originally developed by Intel, has been 
modified to work on ARM, PowerPC, 
+as well as X86. The Runtime Library's compatibility with GCC 4.9 is improved 
+- missed entry points added, Barrier and fork/join code improved, one more 
type of barrier enabled.
+Support for ppc64le architecture is now available and automatically detected 
when using cmake system. 
+Using makefile the new "ppc64le" arch type is available. 
+Contributors to this work include AMD, Argonne National Lab., IBM, Intel, 
Texas Instruments, University of Houston and many others. 
+
 Internal API Changes
 
 

Modified: vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td
==
--- vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td   Sat Feb 14 
12:18:37 2015(r278753)
+++ vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td   Sat Feb 14 
12:18:48 2015(r278754)
@@ -749,3 +749,6 @@ def SerializedDiagnostics : DiagGroup<"s
 // A warning group for warnings about code that clang accepts when
 // compiling CUDA C/C++ but which is not compatible with the CUDA spec.
 def CudaCompat : DiagGroup<"cuda-compat">;
+
+// A warning group for things that will change semantics in the future.

svn commit: r278753 - vendor/llvm/llvm-release_360-r229040

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 12:18:37 2015
New Revision: 278753
URL: https://svnweb.freebsd.org/changeset/base/278753

Log:
  Tag llvm tags/RELEASE_360/rc3 r229040 (effectively, 3.6.0 RC3).

Added:
  vendor/llvm/llvm-release_360-r229040/
 - copied from r278752, vendor/llvm/dist/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278752 - in vendor/llvm/dist: cmake/modules docs include/llvm/CodeGen include/llvm/IR lib/Analysis lib/Analysis/IPA lib/Bitcode/Reader lib/CodeGen lib/CodeGen/AsmPrinter lib/CodeGen/Se...

2015-02-14 Thread Dimitry Andric
Author: dim
Date: Sat Feb 14 12:17:42 2015
New Revision: 278752
URL: https://svnweb.freebsd.org/changeset/base/278752

Log:
  Vendor import of llvm RELEASE_360/rc3 tag r229040 (effectively, 3.6.0 RC3):
  https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/rc3@229040

Added:
  vendor/llvm/dist/test/Bindings/llvm-c/Inputs/
  vendor/llvm/dist/test/Bindings/llvm-c/Inputs/invalid.ll.bc   (contents, props 
changed)
  vendor/llvm/dist/test/Bindings/llvm-c/invalid-bitcode.test
  vendor/llvm/dist/test/CodeGen/AArch64/setcc-type-mismatch.ll
  vendor/llvm/dist/test/CodeGen/ARM/setcc-type-mismatch.ll
  vendor/llvm/dist/test/CodeGen/PowerPC/vsel-prom.ll
  vendor/llvm/dist/test/CodeGen/R600/endcf-loop-header.ll
  vendor/llvm/dist/test/CodeGen/R600/tti-unroll-prefs.ll
  vendor/llvm/dist/test/CodeGen/X86/constant-combines.ll
  vendor/llvm/dist/test/CodeGen/X86/sse-unaligned-mem-feature.ll
  vendor/llvm/dist/test/DebugInfo/location-verifier.ll
  vendor/llvm/dist/test/Linker/distinct-cycles.ll
  vendor/llvm/dist/test/MC/ARM/pr22395-2.s   (contents, props changed)
  vendor/llvm/dist/test/Transforms/Inline/inline-indirect.ll
  vendor/llvm/dist/test/Transforms/MemCpyOpt/callslot_aa.ll
  vendor/llvm/dist/test/Transforms/SLPVectorizer/X86/bad_types.ll
  vendor/llvm/dist/test/Transforms/Util/combine-alias-scope-metadata.ll
  vendor/llvm/dist/test/tools/gold/no-map-whole-file.ll
Deleted:
  vendor/llvm/dist/test/CodeGen/ARM/vector-load.ll
  vendor/llvm/dist/test/CodeGen/ARM/vector-store.ll
  vendor/llvm/dist/test/CodeGen/X86/2010-01-07-UAMemFeature.ll
  vendor/llvm/dist/test/CodeGen/X86/seh-basic.ll
  vendor/llvm/dist/test/CodeGen/X86/seh-safe-div.ll
Modified:
  vendor/llvm/dist/cmake/modules/AddLLVM.cmake
  vendor/llvm/dist/docs/ReleaseNotes.rst
  vendor/llvm/dist/include/llvm/CodeGen/MachineModuleInfo.h
  vendor/llvm/dist/include/llvm/CodeGen/RegAllocPBQP.h
  vendor/llvm/dist/include/llvm/IR/Metadata.h
  vendor/llvm/dist/lib/Analysis/IPA/InlineCost.cpp
  vendor/llvm/dist/lib/Analysis/TypeBasedAliasAnalysis.cpp
  vendor/llvm/dist/lib/Bitcode/Reader/BitReader.cpp
  vendor/llvm/dist/lib/CodeGen/AsmPrinter/EHStreamer.cpp
  vendor/llvm/dist/lib/CodeGen/AsmPrinter/EHStreamer.h
  vendor/llvm/dist/lib/CodeGen/AsmPrinter/Win64Exception.cpp
  vendor/llvm/dist/lib/CodeGen/AsmPrinter/Win64Exception.h
  vendor/llvm/dist/lib/CodeGen/MachineModuleInfo.cpp
  vendor/llvm/dist/lib/CodeGen/Passes.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  vendor/llvm/dist/lib/IR/DebugInfo.cpp
  vendor/llvm/dist/lib/IR/Metadata.cpp
  vendor/llvm/dist/lib/IR/Type.cpp
  vendor/llvm/dist/lib/MC/MCSectionCOFF.cpp
  vendor/llvm/dist/lib/MC/WinCOFFObjectWriter.cpp
  vendor/llvm/dist/lib/Support/regcomp.c
  vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMBaseInstrInfo.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp
  vendor/llvm/dist/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  vendor/llvm/dist/lib/Target/PowerPC/PPCInstrInfo.td
  vendor/llvm/dist/lib/Target/R600/AMDGPUTargetTransformInfo.cpp
  vendor/llvm/dist/lib/Target/R600/SIAnnotateControlFlow.cpp
  vendor/llvm/dist/lib/Target/R600/SIRegisterInfo.cpp
  vendor/llvm/dist/lib/Target/X86/X86.td
  vendor/llvm/dist/lib/Target/X86/X86AsmPrinter.cpp
  vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist/lib/Target/X86/X86InstrFragmentsSIMD.td
  vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp
  vendor/llvm/dist/lib/Target/X86/X86Subtarget.h
  vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
  vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  vendor/llvm/dist/lib/Transforms/Instrumentation/InstrProfiling.cpp
  vendor/llvm/dist/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/EarlyCSE.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  vendor/llvm/dist/lib/Transforms/Utils/Local.cpp
  vendor/llvm/dist/lib/Transforms/Utils/ValueMapper.cpp
  vendor/llvm/dist/lib/Transforms/Vectorize/SLPVectorizer.cpp
  vendor/llvm/dist/test/CodeGen/ARM/Windows/read-only-data.ll
  vendor/llvm/dist/test/CodeGen/ARM/Windows/structors.ll
  vendor/llvm/dist/test/CodeGen/ARM/alloc-no-stack-realign.ll
  vendor/llvm/dist/test/CodeGen/ARM/memcpy-inline.ll
  vendor/llvm/dist/test/CodeGen/ARM/sub-cmp-peephole.ll
  vendor/llvm/dist/test/CodeGen/X86/coff-comdat.ll
  vendor/llvm/dist/test/CodeGen/X86/dllexport-x86_64.ll
  vendor/llvm/dist/test/CodeGen/X86/dllexport.ll
  vendor/llvm/dist/test/CodeGen/X86/fold-vex.ll
  vendor/llvm/dist/test/CodeGen/X86/global-sections.ll
  vendor/llvm/dist/test/CodeGen/X86/pr15267.ll
  vendor/llvm/dist/test/CodeGen/X86/pshufb-mask-comments.ll
  vendor/llvm/dist/tes

svn commit: r278751 - in head/lib: libc/gen libc/include libc/sys libthr/thread

2015-02-14 Thread Konstantin Belousov
Author: kib
Date: Sat Feb 14 11:47:40 2015
New Revision: 278751
URL: https://svnweb.freebsd.org/changeset/base/278751

Log:
  Properly interpose libc spinlocks, was missed in r276630.  In
  particular, stdio locking was affected.
  
  Reported and tested by:   "Matthew D. Fuller" 
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/lib/libc/gen/_spinlock_stub.c
  head/lib/libc/include/libc_private.h
  head/lib/libc/sys/interposing_table.c
  head/lib/libthr/thread/thr_private.h
  head/lib/libthr/thread/thr_spinlock.c
  head/lib/libthr/thread/thr_syscalls.c

Modified: head/lib/libc/gen/_spinlock_stub.c
==
--- head/lib/libc/gen/_spinlock_stub.c  Sat Feb 14 10:56:03 2015
(r278750)
+++ head/lib/libc/gen/_spinlock_stub.c  Sat Feb 14 11:47:40 2015
(r278751)
@@ -33,51 +33,48 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "spinlock.h"
+#include "libc_private.h"
 
 long _atomic_lock_stub(volatile long *);
 void _spinlock_stub(spinlock_t *);
 void _spinunlock_stub(spinlock_t *);
 void _spinlock_debug_stub(spinlock_t *, char *, int);
 
-/*
- * Declare weak definitions in case the application is not linked
- * with libpthread.
- */
 __weak_reference(_atomic_lock_stub, _atomic_lock);
-__weak_reference(_spinlock_stub, _spinlock);
-__weak_reference(_spinunlock_stub, _spinunlock);
-__weak_reference(_spinlock_debug_stub, _spinlock_debug);
-
-/*
- * This function is a stub for the _atomic_lock function in libpthread.
- */
+
 long
 _atomic_lock_stub(volatile long *lck __unused)
 {
return (0L);
 }
 
+__weak_reference(_spinlock, _spinlock_debug);
+#pragma weak _spinlock
+void
+_spinlock(spinlock_t *lck)
+{
+
+   ((void (*)(spinlock_t *lck))__libc_interposing[INTERPOS_spinlock])
+   (lck);
 
-/*
- * This function is a stub for the spinlock function in libpthread.
- */
+}
+
+#pragma weak _spinlock
 void
-_spinlock_stub(spinlock_t *lck __unused)
+_spinunlock(spinlock_t *lck)
 {
+
+   ((void (*)(spinlock_t *lck))__libc_interposing[INTERPOS_spinunlock])
+   (lck);
+
 }
 
-/*
- * This function is a stub for the spinunlock function in libpthread.
- */
 void
-_spinunlock_stub(spinlock_t *lck __unused)
+__libc_spinlock_stub(spinlock_t *lck __unused)
 {
 }
 
-/*
- * This function is a stub for the debug spinlock function in libpthread.
- */
 void
-_spinlock_debug_stub(spinlock_t *lck __unused, char *fname __unused, int 
lineno __unused)
+__libc_spinunlock_stub(spinlock_t *lck __unused)
 {
 }

Modified: head/lib/libc/include/libc_private.h
==
--- head/lib/libc/include/libc_private.hSat Feb 14 10:56:03 2015
(r278750)
+++ head/lib/libc/include/libc_private.hSat Feb 14 11:47:40 2015
(r278751)
@@ -95,6 +95,9 @@ do {  \
_SPINUNLOCK(&__stdio_thread_lock);  \
 } while (0)
 
+void   __libc_spinlock_stub(struct _spinlock *);
+void   __libc_spinunlock_stub(struct _spinlock *);
+
 /*
  * Indexes into the pthread jump table.
  *
@@ -216,6 +219,8 @@ enum {
INTERPOS_write,
INTERPOS_writev,
INTERPOS__pthread_mutex_init_calloc_cb,
+   INTERPOS_spinlock,
+   INTERPOS_spinunlock,
INTERPOS_MAX
 };
 

Modified: head/lib/libc/sys/interposing_table.c
==
--- head/lib/libc/sys/interposing_table.c   Sat Feb 14 10:56:03 2015
(r278750)
+++ head/lib/libc/sys/interposing_table.c   Sat Feb 14 11:47:40 2015
(r278751)
@@ -73,6 +73,8 @@ interpos_func_t __libc_interposing[INTER
SLOT(write, __sys_write),
SLOT(writev, __sys_writev),
SLOT(_pthread_mutex_init_calloc_cb, _pthread_mutex_init_calloc_cb_stub),
+   SLOT(spinlock, __libc_spinlock_stub),
+   SLOT(spinunlock, __libc_spinunlock_stub),
 };
 #undef SLOT
 

Modified: head/lib/libthr/thread/thr_private.h
==
--- head/lib/libthr/thread/thr_private.hSat Feb 14 10:56:03 2015
(r278750)
+++ head/lib/libthr/thread/thr_private.hSat Feb 14 11:47:40 2015
(r278751)
@@ -928,6 +928,10 @@ int __thr_sigwait(const sigset_t *set, i
 int __thr_sigwaitinfo(const sigset_t *set, siginfo_t *info);
 int __thr_swapcontext(ucontext_t *oucp, const ucontext_t *ucp);
 
+struct _spinlock;
+void __thr_spinunlock(struct _spinlock *lck);
+void __thr_spinlock(struct _spinlock *lck);
+
 struct tcb *_tcb_ctor(struct pthread *, int);
 void   _tcb_dtor(struct tcb *);
 

Modified: head/lib/libthr/thread/thr_spinlock.c
==
--- head/lib/libthr/thread/thr_spinlock.c   Sat Feb 14 10:56:03 2015
(r278750)
+++ head/lib/libthr/thread/thr_spinlock.c   Sat Feb 1

Re: svn commit: r278739 - head/lib/libc/regex

2015-02-14 Thread Bruce Evans

On Fri, 13 Feb 2015, Bryan Drewery wrote:


On 2/13/2015 6:37 PM, Bryan Drewery wrote:

On 2/13/2015 6:23 PM, Xin LI wrote:

Author: delphij
Date: Sat Feb 14 00:23:53 2015
New Revision: 278739
URL: https://svnweb.freebsd.org/changeset/base/278739

Log:
  Disallow pattern spaces which would cause intermediate calculations to
  overflow size_t.
...
Modified: head/lib/libc/regex/regcomp.c
==
--- head/lib/libc/regex/regcomp.c   Sat Feb 14 00:03:43 2015
(r278738)
+++ head/lib/libc/regex/regcomp.c   Sat Feb 14 00:23:53 2015
(r278739)
@@ -192,6 +192,7 @@ regcomp(regex_t * __restrict preg,
struct parse *p = &pa;
int i;
size_t len;
+   size_t maxlen;
 #ifdef REDEBUG
 #  define  GOODFLAGS(f)(f)
 #else
@@ -213,7 +214,23 @@ regcomp(regex_t * __restrict preg,
g = (struct re_guts *)malloc(sizeof(struct re_guts));
if (g == NULL)
return(REG_ESPACE);
+   /*
+* Limit the pattern space to avoid a 32-bit overflow on buffer
+* extension.  Also avoid any signed overflow in case of conversion
+* so make the real limit based on a 31-bit overflow.
+*
+* Likely not applicable on 64-bit systems but handle the case
+* generically (who are we to stop people from using ~715MB+
+* patterns?).
+*/
+   maxlen = ((size_t)-1 >> 1) / sizeof(sop) * 2 / 3;
+   if (len >= maxlen) {
+   free((char *)g);


I was planning to submit a patch for review to remove all of this
casting / and discuss.


To be clear, I only mean in free(3) calls.


But they are least bogus for the free() calls.


In this example the malloc is casted to struct re_gets* but the free is
casted to char *. Why different and why cast in free at all?


Because this code attempted to be portable to K&R compilers (including
broken ones, but with no standard it was hard to tell what was broken).

With no prototypes, the arg to free() had to be cast.
  (Except, all pointers have the same representation except on exotic
  machines, so the cast was rarely necessary then or now.)
With no void * in K&R1, free() took a char * arg and the cast had to be
to that.  STDC have the grandfather kludge of requiring char * and void *
to be almost interchangable, so you can probably cast to either.  I
forget if it requires char * and void * to have the same representation,
so that you can certainly cast to either.  Even more than the same
representation is required -- they must be passed in the same way.

Old programs cast the result of malloc() to break warnings about malloc()
not being declared, or possibly for portability to broken compilers
which require the cast.  Actually, it was unclear if they were broken --
before void * existed, malloc() returned char *, and it is not so clear
for old char * as for not so old void * that automatic conversion from
char * to any pointer type does or should happen (without a warning).
New C++ programs require the cast even for void *.  I don't like this.

I also don't like the spelling of the sizeof arg in:

g = (struct re_guts *)malloc(sizeof(struct re_guts));

It is clearer to write:

g = malloc(sizeof(*g));

This works for any pointer g.

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


Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread Bruce Evans

On Fri, 13 Feb 2015, Gleb Smirnoff wrote:


Author: glebius
Date: Fri Feb 13 23:57:20 2015
New Revision: 278737
URL: https://svnweb.freebsd.org/changeset/base/278737

Log:
 Use less ugly code to allocate buffer of SORCVBUF_SIZE.


Less ugly, but wrong.  The version that used alloca() was correct.


Modified: head/usr.sbin/flowctl/flowctl.c
==
--- head/usr.sbin/flowctl/flowctl.c Fri Feb 13 23:43:59 2015
(r278736)
+++ head/usr.sbin/flowctl/flowctl.c Fri Feb 13 23:57:20 2015
(r278737)
@@ -222,10 +222,12 @@ ctl_show(int argc, char **argv)
static void
do_show(int version, void (*func)(struct ngnf_show_header *))
{
-   struct ng_mesg ng_mesg[SORCVBUF_SIZE];
+   char buf[SORCVBUF_SIZE];


alloca(), like malloc(), gave a buffer suitably aligned for any object.
This only gives a buffer suitably aligned for char objects.  It may
accidentally be suitably aligned for other objects.  The accident often
happens because objects on the stack are usually given larger alignment
than necessary.  Depending on this is unportable at best.


+   struct ng_mesg *ng_mesg;
struct ngnf_show_header req, *resp;
int token, nread;

+   ng_mesg = (struct ng_mesg *)buf;


The new bug is detected at high warning levels.  WARNS >= 4 gives
-Wcast-align unless the MK option to break this warning is configured.
The bug is detected by -Wcast0align even on amd64.

The bug is not detected by default because flowctl has many other
warnings at the default WARNS of 6 (mainly -Wcast-align and
-Wsign-compare ones), so it breaks the warnings using WARNGS?=2.

I think arches with strict alignment requirements have a warning about
this without -Wcast-align, but couldn't find one on ia64.  Certainly,
related warnings turned up on ia64 when they didn't on amd64 with the
same WARNS.

The runtime bug can be fixed using __aligned(__ALIGN_MUMBLE).  This
exposes a bug in -Wcast-align -- it still warns although the char buffer
is obviously aligned.  Compilers should also know that the buffer is
suitably aligned when they just allocated it on the stack and the
alignment happens to be enough.  But in this case, compilers should
also know that the suitable alignment is only accidental, and still
warn unless portability warnings are supressed.

This and the non-spurious warning can be broken using another cast:

ng_mesg = (struct ng_mesg *)(void *)buf;

This depends on the compiler being too stupid to remember the alignment
of the original char buffer.

This fixed version is still worse than the old one using alloca(),
because it is longer and more complicated.  alloca(), like malloc(),
returns a void * so that the compiler cannot know the alignment of the buffer
  (except it can for alloca() because it just allocated the buffer -- it
   must do a (void *) cast internally and forget the actual alignment,
   just like the above cast does but with more intentional forgetfulness).
We are basically using a home made alloca(N) for the easier case where N
is constant.

Using VLAs and also the C99 feature of declarations anwhere, and extensions
like __aligned(), we can almost implement a full alloca() using the fixed
version of this change:

/*
 * XXX need extended statement-expression so that __buf doesn't go out
 * of scope after the right brace.
 */
#define my_alloca(n) __extension__ ({
/* XXX need unique name. */ \
char __buf[__roundup2((n), MUMBLE)] __aligned(MUMBLE);  \
\
(void *)__buf;  \
})

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


svn commit: r278749 - in head/sys/x86: acpica include

2015-02-14 Thread Konstantin Belousov
Author: kib
Date: Sat Feb 14 09:00:12 2015
New Revision: 278749
URL: https://svnweb.freebsd.org/changeset/base/278749

Log:
  Detect whether x2APIC on VMWare is usable without interrupt
  redirection support.  Older versions of the hypervisor mis-interpret
  the cpuid format in ioapic registers when x2APIC is turned on, but IR
  is not used by the guest OS.
  
  Based on: Linux commit 4cca6ea04d31c22a7d0436949c072b27bde41f86
  Tested by:markj
  Sponsored by: The FreeBSD Foundation
  MFC after:2 months

Modified:
  head/sys/x86/acpica/madt.c
  head/sys/x86/include/vmware.h

Modified: head/sys/x86/acpica/madt.c
==
--- head/sys/x86/acpica/madt.c  Sat Feb 14 08:52:52 2015(r278748)
+++ head/sys/x86/acpica/madt.c  Sat Feb 14 09:00:12 2015(r278749)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -130,6 +132,7 @@ madt_setup_local(void)
 {
ACPI_TABLE_DMAR *dmartbl;
vm_paddr_t dmartbl_physaddr;
+   u_int p[4];
 
madt = pmap_mapbios(madt_physaddr, madt_length);
if ((cpu_feature2 & CPUID2_X2APIC) != 0) {
@@ -146,6 +149,16 @@ madt_setup_local(void)
}
acpi_unmap_table(dmartbl);
}
+   if (vm_guest == VM_GUEST_VMWARE) {
+   vmware_hvcall(VMW_HVCMD_GETVCPU_INFO, p);
+   if ((p[0] & VMW_VCPUINFO_VCPU_RESERVED) != 0 ||
+   (p[0] & VMW_VCPUINFO_LEGACY_X2APIC) == 0) {
+   x2apic_mode = 0;
+   if (bootverbose)
+   printf(
+   "x2APIC available but disabled inside VMWare without intr 
redirection\n");
+   }
+   }
TUNABLE_INT_FETCH("hw.x2apic_enable", &x2apic_mode);
}
 

Modified: head/sys/x86/include/vmware.h
==
--- head/sys/x86/include/vmware.h   Sat Feb 14 08:52:52 2015
(r278748)
+++ head/sys/x86/include/vmware.h   Sat Feb 14 09:00:12 2015
(r278749)
@@ -31,8 +31,13 @@
 
 #defineVMW_HVMAGIC 0x564d5868
 #defineVMW_HVPORT  0x5658
+
 #defineVMW_HVCMD_GETVERSION10
 #defineVMW_HVCMD_GETHZ 45
+#defineVMW_HVCMD_GETVCPU_INFO  68
+
+#defineVMW_VCPUINFO_LEGACY_X2APIC  (1 << 3)
+#defineVMW_VCPUINFO_VCPU_RESERVED  (1 << 31)
 
 static __inline void
 vmware_hvcall(u_int cmd, u_int *p)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278748 - stable/9/usr.bin/ctlstat

2015-02-14 Thread Alexander Motin
Author: mav
Date: Sat Feb 14 08:52:52 2015
New Revision: 278748
URL: https://svnweb.freebsd.org/changeset/base/278748

Log:
  MFC r278362: Fix couple issues in ctlstat header printing.

Modified:
  stable/9/usr.bin/ctlstat/ctlstat.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/usr.bin/   (props changed)
  stable/9/usr.bin/ctlstat/   (props changed)

Modified: stable/9/usr.bin/ctlstat/ctlstat.c
==
--- stable/9/usr.bin/ctlstat/ctlstat.c  Sat Feb 14 08:52:09 2015
(r278747)
+++ stable/9/usr.bin/ctlstat/ctlstat.c  Sat Feb 14 08:52:52 2015
(r278748)
@@ -449,7 +449,7 @@ ctlstat_standard(struct ctlstat_context 
(F_LUNVAL(ctx) != 0) ? " " : "",
(F_LUNVAL(ctx) != 0) ? " " : "",
(F_LUNVAL(ctx) != 0) ? " " : "",
-   (F_CPU(ctx) == 0)   ? "CPU" : "");
+   (F_CPU(ctx))   ? "CPU" : "");
hdr_devs = 3;
} else {
if (F_CPU(ctx))
@@ -468,8 +468,9 @@ ctlstat_standard(struct ctlstat_context 
 
if (bit_test(ctx->lun_mask, lun) == 0)
continue;
-   fprintf(stdout, "%15.6s%d ",
-   "lun", lun);
+   fprintf(stdout, "%15.6s%d %s",
+   "lun", lun,
+   (F_LUNVAL(ctx) != 0) ? " " : 
"");
hdr_devs++;
}
fprintf(stdout, "\n");
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278747 - stable/10/usr.bin/ctlstat

2015-02-14 Thread Alexander Motin
Author: mav
Date: Sat Feb 14 08:52:09 2015
New Revision: 278747
URL: https://svnweb.freebsd.org/changeset/base/278747

Log:
  MFC r278362: Fix couple issues in ctlstat header printing.

Modified:
  stable/10/usr.bin/ctlstat/ctlstat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/ctlstat/ctlstat.c
==
--- stable/10/usr.bin/ctlstat/ctlstat.c Sat Feb 14 08:44:12 2015
(r278746)
+++ stable/10/usr.bin/ctlstat/ctlstat.c Sat Feb 14 08:52:09 2015
(r278747)
@@ -449,7 +449,7 @@ ctlstat_standard(struct ctlstat_context 
(F_LUNVAL(ctx) != 0) ? " " : "",
(F_LUNVAL(ctx) != 0) ? " " : "",
(F_LUNVAL(ctx) != 0) ? " " : "",
-   (F_CPU(ctx) == 0)   ? "CPU" : "");
+   (F_CPU(ctx))   ? "CPU" : "");
hdr_devs = 3;
} else {
if (F_CPU(ctx))
@@ -468,8 +468,9 @@ ctlstat_standard(struct ctlstat_context 
 
if (bit_test(ctx->lun_mask, lun) == 0)
continue;
-   fprintf(stdout, "%15.6s%d ",
-   "lun", lun);
+   fprintf(stdout, "%15.6s%d %s",
+   "lun", lun,
+   (F_LUNVAL(ctx) != 0) ? " " : 
"");
hdr_devs++;
}
fprintf(stdout, "\n");
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278746 - in stable/10/sys: arm/arm dev/mem i386/i386 mips/mips sparc64/sparc64

2015-02-14 Thread Konstantin Belousov
Author: kib
Date: Sat Feb 14 08:44:12 2015
New Revision: 278746
URL: https://svnweb.freebsd.org/changeset/base/278746

Log:
  MFC r277643:
  Remove Giant from /dev/mem and /dev/kmem.
  
  MFC r277743:
  Arm: ensure that _tmppt KVA is used exclusively.

Modified:
  stable/10/sys/arm/arm/mem.c
  stable/10/sys/dev/mem/memdev.c
  stable/10/sys/i386/i386/mem.c
  stable/10/sys/mips/mips/mem.c
  stable/10/sys/sparc64/sparc64/mem.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/arm/mem.c
==
--- stable/10/sys/arm/arm/mem.c Sat Feb 14 08:20:31 2015(r278745)
+++ stable/10/sys/arm/arm/mem.c Sat Feb 14 08:44:12 2015(r278746)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -72,6 +73,9 @@ MALLOC_DEFINE(M_MEMDESC, "memdesc", "mem
 
 struct mem_range_softc mem_range_softc;
 
+static struct sx tmppt_lock;
+SX_SYSINIT(tmppt, &tmppt_lock, "mem4map");
+
 /* ARGSUSED */
 int
 memrw(struct cdev *dev, struct uio *uio, int flags)
@@ -82,8 +86,6 @@ memrw(struct cdev *dev, struct uio *uio,
int error = 0;
vm_offset_t addr, eaddr;
 
-   GIANT_REQUIRED;
-
while (uio->uio_resid > 0 && error == 0) {
iov = uio->uio_iov;
if (iov->iov_len == 0) {
@@ -109,6 +111,7 @@ memrw(struct cdev *dev, struct uio *uio,
}
if (!address_valid)
return (EINVAL);
+   sx_xlock(&tmppt_lock);
pmap_kenter((vm_offset_t)_tmppt, v);
o = (int)uio->uio_offset & PAGE_MASK;
c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & 
PAGE_MASK));
@@ -116,6 +119,7 @@ memrw(struct cdev *dev, struct uio *uio,
c = min(c, (u_int)iov->iov_len);
error = uiomove((caddr_t)&_tmppt[o], (int)c, uio);
pmap_qremove((vm_offset_t)_tmppt, 1);
+   sx_xunlock(&tmppt_lock);
continue;
}
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {

Modified: stable/10/sys/dev/mem/memdev.c
==
--- stable/10/sys/dev/mem/memdev.c  Sat Feb 14 08:20:31 2015
(r278745)
+++ stable/10/sys/dev/mem/memdev.c  Sat Feb 14 08:44:12 2015
(r278746)
@@ -52,7 +52,7 @@ static struct cdev *memdev, *kmemdev;
 
 static struct cdevsw mem_cdevsw = {
.d_version =D_VERSION,
-   .d_flags =  D_MEM|D_NEEDGIANT,
+   .d_flags =  D_MEM,
.d_open =   memopen,
.d_read =   memrw,
.d_write =  memrw,

Modified: stable/10/sys/i386/i386/mem.c
==
--- stable/10/sys/i386/i386/mem.c   Sat Feb 14 08:20:31 2015
(r278745)
+++ stable/10/sys/i386/i386/mem.c   Sat Feb 14 08:44:12 2015
(r278746)
@@ -86,10 +86,6 @@ memrw(struct cdev *dev, struct uio *uio,
int error = 0;
vm_offset_t addr;
 
-   /* XXX UPS Why ? */
-   GIANT_REQUIRED;
-
-
if (dev2unit(dev) != CDEV_MINOR_MEM && dev2unit(dev) != CDEV_MINOR_KMEM)
return EIO;
 

Modified: stable/10/sys/mips/mips/mem.c
==
--- stable/10/sys/mips/mips/mem.c   Sat Feb 14 08:20:31 2015
(r278745)
+++ stable/10/sys/mips/mips/mem.c   Sat Feb 14 08:44:12 2015
(r278746)
@@ -85,8 +85,6 @@ memrw(struct cdev *dev, struct uio *uio,
cnt = 0;
error = 0;
 
-   GIANT_REQUIRED;
-
pmap_page_init(&m);
while (uio->uio_resid > 0 && !error) {
iov = uio->uio_iov;

Modified: stable/10/sys/sparc64/sparc64/mem.c
==
--- stable/10/sys/sparc64/sparc64/mem.c Sat Feb 14 08:20:31 2015
(r278745)
+++ stable/10/sys/sparc64/sparc64/mem.c Sat Feb 14 08:44:12 2015
(r278746)
@@ -100,8 +100,6 @@ memrw(struct cdev *dev, struct uio *uio,
error = 0;
ova = 0;
 
-   GIANT_REQUIRED;
-
while (uio->uio_resid > 0 && error == 0) {
iov = uio->uio_iov;
if (iov->iov_len == 0) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"