svn commit: r230421 - stable/9/sys/i386/include

2012-01-21 Thread Alan Cox
Author: alc
Date: Sat Jan 21 08:26:41 2012
New Revision: 230421
URL: http://svn.freebsd.org/changeset/base/230421

Log:
  MFC r228398
Avoid the possibility of integer overflow in the calculation of
VM_KMEM_SIZE_MAX.  Specifically, if the user/kernel address space split
was changed such that the kernel address space was greater than or equal
to 2 GB, then overflow would occur.
  
  PR:   161721

Modified:
  stable/9/sys/i386/include/vmparam.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/i386/include/vmparam.h
==
--- stable/9/sys/i386/include/vmparam.h Sat Jan 21 07:57:27 2012
(r230420)
+++ stable/9/sys/i386/include/vmparam.h Sat Jan 21 08:26:41 2012
(r230421)
@@ -186,11 +186,12 @@
 #endif
 
 /*
- * Ceiling on amount of kmem_map kva space.
+ * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space
+ * rounded to the nearest multiple of the superpage size.
  */
 #ifndef VM_KMEM_SIZE_MAX
-#defineVM_KMEM_SIZE_MAX((VM_MAX_KERNEL_ADDRESS - \
-VM_MIN_KERNEL_ADDRESS) * 2 / 5)
+#defineVM_KMEM_SIZE_MAX(VM_MAX_KERNEL_ADDRESS - \
+VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT)
 #endif
 
 /* initial pagein size of beginning of executable file */
___
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: r229693 - in head/lib/libc: powerpc powerpc64

2012-01-21 Thread Andreas Tobler

I write this reply from another machine...

Here is what I have tested so far.

Is this the right approach?

Thank you in advance,
Andreas




Index: lib/libc/powerpc/SYS.h
===
--- lib/libc/powerpc/SYS.h  (revision 230383)
+++ lib/libc/powerpc/SYS.h  (working copy)
@@ -33,38 +33,38 @@
 #include 
 #include 
 
-#define _SYSCALL(x)\
-   .text;  \
-   .align 2;   \
-   li  0,(__CONCAT(SYS_,x));   \
+#define _SYSCALL(name) \
+   .text;  \
+   .align 2;   \
+   li  0,(__CONCAT(SYS_, name));   \
sc
 
-#defineSYSCALL(x)  \
-   .text;  \
-   .align 2;   \
-2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
+#defineSYSCALL(name)   
\
+   .text;  \
+   .align 2;   \
+2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));  \
+   _SYSCALL(name); \
bso 2b
 
-#definePSEUDO(x)   \
-   .text;  \
-   .align 2;   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
-   bnslr;  \
+#definePSEUDO(name)
\
+   .text;  \
+   .align 2;   \
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));  \
+   _SYSCALL(name); \
+   bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
 
-#defineRSYSCALL(x) \
-   .text;  \
-   .align 2;   \
-2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x));  \
-   _SYSCALL(x);\
-   bnslr;  \
+#defineRSYSCALL(name)  
\
+   .text;  \
+   .align 2;   \
+2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));  \
+   _SYSCALL(name); \
+   bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
Index: lib/libc/powerpc/gen/setjmp.S
===
--- lib/libc/powerpc/gen/setjmp.S   (revision 230383)
+++ lib/libc/powerpc/gen/setjmp.S   (working copy)
@@ -69,7 +69,7 @@
li  %r3,0   /* return (0) */
blr
 
-   WEAK_ALIAS(longjmp, __longjmp)
+   WEAK_REFERENCE(CNAME(__longjmp), longjmp)
 ENTRY(__longjmp)
lmw %r9,20(%r3) /* restore regs */
mr  %r6,%r4   

Re: svn commit: r230390 - head/sys/conf

2012-01-21 Thread Bruce Evans

On Sat, 21 Jan 2012, Andreas Tobler wrote:


On 21.01.12 03:52, Bruce Evans wrote:

On Fri, 20 Jan 2012, Andreas Tobler wrote:


Log:
  Disable GUPROF on archs other than i386/amd64 since the fine details are 
not

  implemented.


This was intentionally not done.  Just don't use config -pp on arches that
don't suppport it.  "profile 2" is already left out of NOTES for all
arches except amd64, i386 and powerpc.  But the configuration of "profile"
in the NOTES for these arches is broken anyway.  It doesn't exist.  Thus
even normal profiling is not tested by NOTES on these arches.


I sent this patch to -CURRENT:

http://lists.freebsd.org/pipermail/freebsd-current/2012-January/031095.html

...and got no feedback.

Is there a better place to send such patches for review?


Probably not, but I don't read -current.


I got positive feedback from marius regarding the sparc64 case.


Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk	Fri Jan 20 17:25:15 2012 
(r230389)
+++ head/sys/conf/kern.pre.mk	Fri Jan 20 18:49:47 2012 
(r230390)

@@ -103,11 +103,14 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO

.if defined(PROFLEVEL)&&  ${PROFLEVEL}>= 1
CFLAGS+=-DGPROF -falign-functions=16
+PROF=  -pg
.if ${PROFLEVEL}>= 2
CFLAGS+=-DGPROF4 -DGUPROF
-PROF=  -pg -mprofiler-epilogue
+.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"


Style bug: unsorted tests.


Copied from here:

sys/conf/kern.post.mk: line 174


There are lots of bad examples to copy from.  I sometimes complain about
them to try to stop them spreading :-).






+PROF+= -mprofiler-epilogue



Do you want me to revert?


Yes.  There is no point in having several layers of ifdefs for this.

I have already reduced the ifdef tangle for this once before.  In 2006
I removed the ifdefs for icc.  These reduced to a .error failure
followed by about 8 unreachable lines.  I changed this to just the
.error failure.  Someone later removed the icc support.  But none of
this was messy enough to be correct even on i386.  i386 NOTES puts
sets PROFLEVEL to 2 unconditionally, so icc can never have possibly
worked with NOTES.

Bute you might want to look at the porability of the ordinary profiling
case.  Here it is again, copied from above.  Beware that something
mangled the whitespace (space characters but not tabs):

% .if defined(PROFLEVEL)&&  ${PROFLEVEL}>= 1
% CFLAGS+=  -DGPROF -falign-functions=16
% +PROF=-pg
% .if ${PROFLEVEL}>= 2
% ...

-DGPROF sets a kernel option so is OK.  -pg is unportable but the same
for all supported arches (?) so OK.  -falign-functions=LARGE is used
to reduce the size of profiling buffs.  Function alignment used to
default to 4 on i386 but is now often 16 or more.  Probably it is
larger on other arches.  It should match the definition of
FUNCTION_ALIGNMENT in , and in fact matches for all arches
except powerpc* and sparc64:

% amd64/include/profile.h:#define   FUNCTION_ALIGNMENT  16
% amd64/include/profile.h:#define   FUNCTION_ALIGNMENT  4
% arm/include/profile.h:#define FUNCTION_ALIGNMENT  16

The tab after #define is corrupt only for arm.

% i386/include/profile.h:#defineFUNCTION_ALIGNMENT  16
% i386/include/profile.h:#defineFUNCTION_ALIGNMENT  4

On amd64 and i386, 4 is for userland and 16 is for the kernel.  Userland
should use the same as the kernel to save space in the same way, but
I never got around to fixing it.  (Same for the histcounter size.  It
should be 32 or 64 bits, since 16 bits overflows after as little as
64 seconds with profhz = 1024, or after a fraction of a second with
an adequately large profhz.  GUPROF uses 64-bit counters since even
32 bits overflowed ~10 years ago when the profiling pseudo-frequency
of the CPU clock frequency reached ~1GHz).

% ia64/include/profile.h:#defineFUNCTION_ALIGNMENT  16

arm and ia64 use 16 for userland too.  This seems too large for arm.
arm's ALIGN_TEXT gives no aligment at all (.align 0.  Isn't that
impossible?  It may be a misspelling of .p2align 0).  This seems too
small for ia64.  ia64's ALIGN_TEXT gives 32-byte alignment.

% mips/include/profile.h:#defineFUNCTION_ALIGNMENT  16
% mips/include/profile.h:#defineFUNCTION_ALIGNMENT  4

Mips copies i386 for the different kernel/user alignments.  Its asm.h
doesn't define ALIGN_TEXT, and only has one alignment statement -- an
apparently nonsensical ".align 3" one.  Maybe .align still means
.p2align on arm and mips, but this .align is weirdly placed (after
a data allocation for a string instead of before).  In asm code,
mips uses just 3 alignment statements: 1 .align 4 for data, 1 .align 4
for a label, and 1 .align 5 for another label.  Apparently .align does
still mean .p2align on mips.

% powerpc/include/profile.h:#define FUNCTION_ALIGNMENT  4

powerpc* mostly uses .align 2.  This agrees with FUNCTION_ALIGNMENT,
assuming th

Re: svn commit: r230307 - in head: lib/libfetch usr.bin/fetch

2012-01-21 Thread Pawel Jakub Dawidek
On Wed, Jan 18, 2012 at 03:13:22PM +, Dag-Erling Smorgrav wrote:
> Author: des
> Date: Wed Jan 18 15:13:21 2012
> New Revision: 230307
> URL: http://svn.freebsd.org/changeset/base/230307
> 
> Log:
>   Fix two issues related to the use of SIGINFO in fetch(1) to display
>   progress information.  The first is that fetch_read() (used in the HTTP
>   code but not the FTP code) can enter an infinite loop if it has previously
>   been interrupted by a signal.  The second is that when it is interrupted,
>   fetch_read() will discard any data it may have read up to that point.
>   Luckily, both bugs are extremely timing-sensitive and therefore difficult
>   to trigger.
>   
>   PR: bin/153240
>   Submitted by:   Mark 
>   MFC after:  3 weeks
[...]
> +static int
> +fetch_cache_data(conn_t *conn, char *src, size_t nbytes)
> +{
> + char *tmp;
> +
> + if (conn->cache.size < nbytes) {
> + tmp = realloc(conn->cache.buf, nbytes);
> + if (tmp == NULL) {
> + errno = ENOMEM;

realloc(3) on failures sets errno to ENOMEM for you already.

> + conn->cache.len -= total;
> + conn->cache.pos += total;
> + len -= total;
> + buf+= total;

Style nit (missing space before +=).

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl


pgpgLDJI2Gt0M.pgp
Description: PGP signature


Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller

2012-01-21 Thread Hans Petter Selasky
On Friday 20 January 2012 22:43:29 Robert N. M. Watson wrote:
> On 20 Jan 2012, at 21:29, Hans Petter Selasky wrote:
> > On Friday 20 January 2012 16:16:00 Robert Watson wrote:
> >> On Wed, 18 Jan 2012, Hans Petter Selasky wrote:
> >>> Author: hselasky
> >>> Date: Wed Jan 18 07:57:17 2012
> >>> New Revision: 230302
> >>> URL: http://svn.freebsd.org/changeset/base/230302
> >>> 
> >>> Log:
> >>> MFC r230032, r230050, r230090, r230091 and r228493.
> >>> - Various XHCI and USB 3.0 related issues.
> >>> - USB 3.0 HUBs should work after this change.
> >> 
> >> Should some portion of this be issued as an Errata Note against
> >> supported 8.x and 9.x releases -- in particular, support for USB 3.0
> >> hubs?
> > 
> > hrs @ already did that with the 9-release errata I believe.
> 
> Sorry, I may have been unclear -- I meant Errata Note in the freebsd-update
> sense, not as in the release note errata.

I think there is no such notice at the present moment.

--HPS
___
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: r230422 - head/sys/conf

2012-01-21 Thread Andreas Tobler
Author: andreast
Date: Sat Jan 21 11:42:40 2012
New Revision: 230422
URL: http://svn.freebsd.org/changeset/base/230422

Log:
  Revert r230390.

Modified:
  head/sys/conf/kern.pre.mk

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Sat Jan 21 08:26:41 2012(r230421)
+++ head/sys/conf/kern.pre.mk   Sat Jan 21 11:42:40 2012(r230422)
@@ -103,14 +103,11 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO
 
 .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
 CFLAGS+=   -DGPROF -falign-functions=16
-PROF=  -pg
 .if ${PROFLEVEL} >= 2
 CFLAGS+=   -DGPROF4 -DGUPROF
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-PROF+= -mprofiler-epilogue
+PROF=  -pg -mprofiler-epilogue
 .else
-.error "GUPROF not supported on ${MACHINE_CPUARCH}."
-.endif
+PROF=  -pg
 .endif
 .endif
 DEFINED_PROF=  ${PROF}
___
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: r229693 - in head/lib/libc: powerpc powerpc64

2012-01-21 Thread Bruce Evans

On Sat, 21 Jan 2012, Andreas Tobler wrote:


I write this reply from another machine...

Here is what I have tested so far.

Is this the right approach?


Seems mostly what I want.  I wouldn't change the right-justification
of the backslashes, since most places don't need it and it gives
unreadable diffs.  More later.

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: r230423 - head/sbin/mdconfig

2012-01-21 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Jan 21 11:48:48 2012
New Revision: 230423
URL: http://svn.freebsd.org/changeset/base/230423

Log:
  Replace the beerware license on mdconfig(8) with standard 2-clause BSD.
  
  Approved by:  phk@

Modified:
  head/sbin/mdconfig/mdconfig.c

Modified: head/sbin/mdconfig/mdconfig.c
==
--- head/sbin/mdconfig/mdconfig.c   Sat Jan 21 11:42:40 2012
(r230422)
+++ head/sbin/mdconfig/mdconfig.c   Sat Jan 21 11:48:48 2012
(r230423)
@@ -1,14 +1,31 @@
-/*
- * 
- * "THE BEER-WARE LICENSE" (Revision 42):
- *  wrote this file.  As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
- * 
+/*-
+ * Copyright (c) 2000-2004 Poul-Henning Kamp 
+ * All rights reserved.
  *
- * $FreeBSD$
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
+ * $FreeBSD$
  */
+
 #include 
 #include 
 #include 
___
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: r230302 - in stable/9/sys/dev/usb: . controller

2012-01-21 Thread Robert N. M. Watson

On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote:

> Author: hselasky
> Date: Wed Jan 18 07:57:17 2012
> New Revision: 230302
> URL: http://svn.freebsd.org/changeset/base/230302
> 
> Log:
> MFC r230032, r230050, r230090, r230091 and r228493.
> - Various XHCI and USB 3.0 related issues.
> - USB 3.0 HUBs should work after this change.
 
 Should some portion of this be issued as an Errata Note against
 supported 8.x and 9.x releases -- in particular, support for USB 3.0
 hubs?
>>> 
>>> hrs @ already did that with the 9-release errata I believe.
>> 
>> Sorry, I may have been unclear -- I meant Errata Note in the freebsd-update
>> sense, not as in the release note errata.
> 
> I think there is no such notice at the present moment.

Just to clarify, are you saying that:

(1) We should not ever do an errata note + binary update for the most important 
of these bug fixes, just wait for them to ship in FreeBSD 8.3/9.1?

(2) We should do errata notes + binary updates for the most important of these 
bug fixes, but we need to let them settle for a while to ensure there are no 
unexpected consequences/etc?

Do we think that the impact of the USB 3.0 hub issue will be significant to our 
userbase -- e.g., excluding use of USB on many recent systems?

Thanks,

Robert___
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: r230302 - in stable/9/sys/dev/usb: . controller

2012-01-21 Thread Hans Petter Selasky
On Saturday 21 January 2012 13:22:02 Robert N. M. Watson wrote:
> On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote:
> > Author: hselasky
> > Date: Wed Jan 18 07:57:17 2012
> > New Revision: 230302
> > URL: http://svn.freebsd.org/changeset/base/230302
> > 
> > Log:
> > MFC r230032, r230050, r230090, r230091 and r228493.
> > - Various XHCI and USB 3.0 related issues.
> > - USB 3.0 HUBs should work after this change.
>  
>  Should some portion of this be issued as an Errata Note against
>  supported 8.x and 9.x releases -- in particular, support for USB 3.0
>  hubs?
> >>> 
> >>> hrs @ already did that with the 9-release errata I believe.
> >> 
> >> Sorry, I may have been unclear -- I meant Errata Note in the
> >> freebsd-update sense, not as in the release note errata.
> > 
> > I think there is no such notice at the present moment.
> 
> Just to clarify, are you saying that:
> 
> (1) We should not ever do an errata note + binary update for the most
> important of these bug fixes, just wait for them to ship in FreeBSD
> 8.3/9.1?
> 
> (2) We should do errata notes + binary updates for the most important of
> these bug fixes, but we need to let them settle for a while to ensure
> there are no unexpected consequences/etc?
> 
> Do we think that the impact of the USB 3.0 hub issue will be significant to
> our userbase -- e.g., excluding use of USB on many recent systems?

I mean (2). I'm not familiar with the process of binary updates. Does that 
mean I should commit fixes to the release branches in SVN instead of the 
stable ones? I think I maybe need some help there. Never done that before :-)

--HPS
___
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: r230302 - in stable/9/sys/dev/usb: . controller

2012-01-21 Thread Bjoern A. Zeeb

On 21. Jan 2012, at 12:44 , Hans Petter Selasky wrote:

> On Saturday 21 January 2012 13:22:02 Robert N. M. Watson wrote:
>> On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote:
>>> Author: hselasky
>>> Date: Wed Jan 18 07:57:17 2012
>>> New Revision: 230302
>>> URL: http://svn.freebsd.org/changeset/base/230302
>>> 
>>> Log:
>>> MFC r230032, r230050, r230090, r230091 and r228493.
>>> - Various XHCI and USB 3.0 related issues.
>>> - USB 3.0 HUBs should work after this change.
>> 
>> Should some portion of this be issued as an Errata Note against
>> supported 8.x and 9.x releases -- in particular, support for USB 3.0
>> hubs?
> 
> hrs @ already did that with the 9-release errata I believe.
 
 Sorry, I may have been unclear -- I meant Errata Note in the
 freebsd-update sense, not as in the release note errata.
>>> 
>>> I think there is no such notice at the present moment.
>> 
>> Just to clarify, are you saying that:
>> 
>> (1) We should not ever do an errata note + binary update for the most
>> important of these bug fixes, just wait for them to ship in FreeBSD
>> 8.3/9.1?
>> 
>> (2) We should do errata notes + binary updates for the most important of
>> these bug fixes, but we need to let them settle for a while to ensure
>> there are no unexpected consequences/etc?
>> 
>> Do we think that the impact of the USB 3.0 hub issue will be significant to
>> our userbase -- e.g., excluding use of USB on many recent systems?
> 
> I mean (2). I'm not familiar with the process of binary updates. Does that 
> mean I should commit fixes to the release branches in SVN instead of the 
> stable ones? I think I maybe need some help there. Never done that before :-)

Because you cannot.   It would surely help if you could provide the relevant
part of the change as patch to re@ and you can find two samples of ENs linked
from the box in the right lower corner of the front page of www.freebsd.org
and providing parts of the text (ignore revisions etc for now) would certainly
help as well.

/bz

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!
___
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: r230424 - head/sys/dev/usb/controller

2012-01-21 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Jan 21 13:31:38 2012
New Revision: 230424
URL: http://svn.freebsd.org/changeset/base/230424

Log:
  Add support for the DesignWare USB 2.0 OTG controller chipset.
  Currently the code is not built by any modules. That will
  be fixed later. The Atmel ARM bus interface file part of this
  commit is just for sake of example. All registers and bits are
  declared like macros and not C-structures like in official
  Synopsis header files. This driver mostly origins from the
  musb_otg.c driver in FreeBSD except that the chip specific
  programming has been replaced by the one for DWC 2.0 USB OTG.
  Some parts related to system suspend and resume have been left
  like empty functions for the future. USB suspend and resume is
  fully supported.

Added:
  head/sys/dev/usb/controller/dwc_otg.c   (contents, props changed)
  head/sys/dev/usb/controller/dwc_otg.h   (contents, props changed)
  head/sys/dev/usb/controller/dwc_otg_atmelarm.c   (contents, props changed)

Added: head/sys/dev/usb/controller/dwc_otg.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/controller/dwc_otg.c   Sat Jan 21 13:31:38 2012
(r230424)
@@ -0,0 +1,2612 @@
+/*-
+ * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This file contains the driver for the DesignWare series USB 2.0 OTG
+ * Controller. This driver currently only supports the device mode of
+ * the USB hardware.
+ */
+
+/*
+ * LIMITATION: Drivers must be bound to all OUT endpoints in the
+ * active configuration for this driver to work properly. Blocking any
+ * OUT endpoint will block all OUT endpoints including the control
+ * endpoint. Usually this is not a problem.
+ */
+
+/*
+ * NOTE: Writing to non-existing registers appears to cause an
+ * internal reset.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#defineUSB_DEBUG_VAR dwc_otg_debug
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#defineDWC_OTG_BUS2SC(bus) \
+   ((struct dwc_otg_softc *)(((uint8_t *)(bus)) - \
+((uint8_t *)&(((struct dwc_otg_softc *)0)->sc_bus
+
+#defineDWC_OTG_PC2SC(pc) \
+   DWC_OTG_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
+
+#defineDWC_OTG_MSK_GINT_ENABLED\
+   (DWC_OTG_MSK_GINT_ENUM_DONE |   \
+   DWC_OTG_MSK_GINT_USB_SUSPEND |  \
+   DWC_OTG_MSK_GINT_INEP | \
+   DWC_OTG_MSK_GINT_RXFLVL |   \
+   DWC_OTG_MSK_GINT_SESSREQINT)
+
+#define DWC_OTG_USE_HSIC 0
+
+#ifdef USB_DEBUG
+static int dwc_otg_debug = 0;
+
+static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG");
+SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, debug, CTLFLAG_RW,
+&dwc_otg_debug, 0, "DWC OTG debug level");
+#endif
+
+#defineDWC_OTG_INTR_ENDPT 1
+
+/* prototypes */
+
+struct usb_bus_methods dwc_otg_bus_methods;
+struct usb_pipe_methods dwc_otg_device_non_isoc_methods;
+struct usb_pipe_methods dwc_otg_device_isoc_fs_methods;
+
+static dwc_otg_cmd_t dwc_otg_setup_rx;
+static dwc_otg_cmd_t dwc_otg_data_rx;
+static dwc_otg_cmd_t dwc_otg_data_tx;
+static dwc_otg_cmd_t dwc_otg_data_tx_sync;
+static void dwc_otg_device_done(struct usb_xfer *, usb_error_t);
+static void dwc_otg_do_poll(struct usb_bus *);
+static void dwc_otg_standard_done(struct usb_xfer *);
+static void 

Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller

2012-01-21 Thread Hans Petter Selasky
On Saturday 21 January 2012 13:59:10 Bjoern A. Zeeb wrote:
> On 21. Jan 2012, at 12:44 , Hans Petter Selasky wrote:
> > On Saturday 21 January 2012 13:22:02 Robert N. M. Watson wrote:
> >> On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote:
> >>> Author: hselasky
> >>> Date: Wed Jan 18 07:57:17 2012
> >>> New Revision: 230302
> >>> URL: http://svn.freebsd.org/changeset/base/230302
> >>> 
> >>> Log:
> >>> MFC r230032, r230050, r230090, r230091 and r228493.
> >>> - Various XHCI and USB 3.0 related issues.
> >>> - USB 3.0 HUBs should work after this change.
> >> 
> >> Should some portion of this be issued as an Errata Note against
> >> supported 8.x and 9.x releases -- in particular, support for USB 3.0
> >> hubs?
> > 
> > hrs @ already did that with the 9-release errata I believe.
>  
>  Sorry, I may have been unclear -- I meant Errata Note in the
>  freebsd-update sense, not as in the release note errata.
> >>> 
> >>> I think there is no such notice at the present moment.
> >> 
> >> Just to clarify, are you saying that:
> >> 
> >> (1) We should not ever do an errata note + binary update for the most
> >> important of these bug fixes, just wait for them to ship in FreeBSD
> >> 8.3/9.1?
> >> 
> >> (2) We should do errata notes + binary updates for the most important of
> >> these bug fixes, but we need to let them settle for a while to ensure
> >> there are no unexpected consequences/etc?
> >> 
> >> Do we think that the impact of the USB 3.0 hub issue will be significant
> >> to our userbase -- e.g., excluding use of USB on many recent systems?
> > 
> > I mean (2). I'm not familiar with the process of binary updates. Does
> > that mean I should commit fixes to the release branches in SVN instead
> > of the stable ones? I think I maybe need some help there. Never done
> > that before :-)
> 
> Because you cannot.   It would surely help if you could provide the
> relevant part of the change as patch to re@ and you can find two samples
> of ENs linked from the box in the right lower corner of the front page of
> www.freebsd.org and providing parts of the text (ignore revisions etc for
> now) would certainly help as well.

Ok, I'll have a look at this once I find some time.

--HPS
___
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: r230424 - head/sys/dev/usb/controller

2012-01-21 Thread Aleksandr Rybalko
On Sat, 21 Jan 2012 13:31:38 + (UTC)
Hans Petter Selasky  wrote:

> Author: hselasky
> Date: Sat Jan 21 13:31:38 2012
> New Revision: 230424
> URL: http://svn.freebsd.org/changeset/base/230424
> 
> Log:
>   Add support for the DesignWare USB 2.0 OTG controller chipset.
>   Currently the code is not built by any modules. That will
>   be fixed later. The Atmel ARM bus interface file part of this
>   commit is just for sake of example. All registers and bits are
>   declared like macros and not C-structures like in official
>   Synopsis header files. This driver mostly origins from the
>   musb_otg.c driver in FreeBSD except that the chip specific
>   programming has been replaced by the one for DWC 2.0 USB OTG.
>   Some parts related to system suspend and resume have been left
>   like empty functions for the future. USB suspend and resume is
>   fully supported.

Wow, it is very cool! This is same controller about which i mailed you
year ago Hans. It can be found not only in Atmel ARM, but also in:
1. Cavium Octeon SoC's (some have EHCI, but most DWC OTG)
2. many PowerPC SoC's
3. Ralink RT3050F/RT3052F 

And I think list much longer. Last (#3) answer your question to me
(Subject: Where is controller/dotg.h ?). sorry for long silent about
that. But I will rework a bit mips/rt305x and reconnect it with your
new driver.

Thank you so much!

> 
> Added:
>   head/sys/dev/usb/controller/dwc_otg.c   (contents, props changed)
>   head/sys/dev/usb/controller/dwc_otg.h   (contents, props changed)
>   head/sys/dev/usb/controller/dwc_otg_atmelarm.c   (contents, props
> changed)
> 
> Added: head/sys/dev/usb/controller/dwc_otg.c
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is
> newly added) +++ head/sys/dev/usb/controller/dwc_otg.cSat Jan
> 21 13:31:38 2012  (r230424) @@ -0,0 +1,2612 @@
> +/*-
> + * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above
> copyright
> + *notice, this list of conditions and the following disclaimer
> in the
> + *documentation and/or other materials provided with the
> distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS
> IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
> THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
> LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
> GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
> ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +/*
> + * This file contains the driver for the DesignWare series USB 2.0
> OTG
> + * Controller. This driver currently only supports the device mode of
> + * the USB hardware.
> + */
> +
> +/*
> + * LIMITATION: Drivers must be bound to all OUT endpoints in the
> + * active configuration for this driver to work properly. Blocking
> any
> + * OUT endpoint will block all OUT endpoints including the control
> + * endpoint. Usually this is not a problem.
> + */
> +
> +/*
> + * NOTE: Writing to non-existing registers appears to cause an
> + * internal reset.
> + */
> +
> +#include 
> +__FBSDID("$FreeBSD$");
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +#define  USB_DEBUG_VAR dwc_otg_debug
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +#include 
> +
> +#define  DWC_OTG_BUS2SC(bus) \
> +   ((struct dwc_otg_softc *)(((uint8_t *)(bus)) - \
> +((uint8_t *)&(((struct dwc_otg_softc *)0)->sc_bus
> +
> +#define  DWC_OTG_PC2SC(pc) \
> +   DWC_OTG_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
> +
> +#define  DWC_OTG_MSK_GINT_ENABLED\
> +   (DWC_OTG_MSK_GINT_ENUM_DONE | \
> +   DWC_OTG_MSK_GINT_USB_SUSPEND |\
> +   DWC_OTG_MSK_GINT_INEP |   \
> +   DWC_OTG_MSK_GINT_RXFLVL | \
> +   DWC_OTG_MSK_GINT_SESSREQINT)
> +
> +#define DWC_OTG_USE

Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64

2012-01-21 Thread Andreas Tobler

On 01/21/12 12:46, Bruce Evans wrote:

On Sat, 21 Jan 2012, Andreas Tobler wrote:


I write this reply from another machine...

Here is what I have tested so far.

Is this the right approach?


Seems mostly what I want. I wouldn't change the right-justification
of the backslashes, since most places don't need it and it gives
unreadable diffs. More later.


Ok, removed right-justification.

Would you like to see the ALIGN_TEXT in the same diff/commit or do you 
agree if I do two steps?


Thanks again for the review. I appreciate your input!

Andreas


Index: sys/powerpc/include/asm.h
===
--- sys/powerpc/include/asm.h   (revision 230401)
+++ sys/powerpc/include/asm.h   (working copy)
@@ -116,9 +116,9 @@
 #define __FBSDID(s)/* nothing */
 #endif /* not lint and not STRIP_FBSDID */
 
-#defineWEAK_ALIAS(alias,sym)   \
+#define WEAK_REFERENCE(sym, alias) \
.weak alias;\
-   alias = sym
+   .equ alias, sym
 
 #ifdef __STDC__
 #defineWARN_REFERENCES(_sym,_msg)  \
Index: lib/libc/powerpc/SYS.h
===
--- lib/libc/powerpc/SYS.h  (revision 230383)
+++ lib/libc/powerpc/SYS.h  (working copy)
@@ -33,38 +33,38 @@
 #include 
 #include 
 
-#define _SYSCALL(x)\
+#define_SYSCALL(name)  \
.text;  \
.align 2;   \
-   li  0,(__CONCAT(SYS_,x));   \
+   li  0,(__CONCAT(SYS_, name));   \
sc
 
-#defineSYSCALL(x)  \
+#defineSYSCALL(name)   \
.text;  \
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+   _SYSCALL(name); \
bso 2b
 
-#definePSEUDO(x)   \
+#definePSEUDO(name)\
.text;  \
.align 2;   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+   _SYSCALL(name); \
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
 
-#defineRSYSCALL(x) \
+#defineRSYSCALL(name)  \
.text;  \
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x));  \
-   _SYSCALL(x);\
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+   _SYSCALL(name); \
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
Index: lib/libc/powerpc/gen/setjmp.S
===
--- lib/libc/powerpc/gen/setjmp.S   (revision 230383)
+++ lib/libc/powerpc/gen/setjmp.S   (working copy)
@@ -69,7 +69,7 @@
li  %r3,0   /* return (0) */
blr
 
-   WEAK_ALIAS(longjmp, __longjmp)
+   WEAK_REFERENCE(CNAME(__longjmp), longjmp)
 ENTRY(__longjmp)
lmw %r9,20(%r3) /* restore regs */

Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller

2012-01-21 Thread Robert N. M. Watson

On 21 Jan 2012, at 13:33, Hans Petter Selasky wrote:

 Just to clarify, are you saying that:
 
 (1) We should not ever do an errata note + binary update for the most
 important of these bug fixes, just wait for them to ship in FreeBSD
 8.3/9.1?
 
 (2) We should do errata notes + binary updates for the most important of
 these bug fixes, but we need to let them settle for a while to ensure
 there are no unexpected consequences/etc?
 
 Do we think that the impact of the USB 3.0 hub issue will be significant
 to our userbase -- e.g., excluding use of USB on many recent systems?
>>> 
>>> I mean (2). I'm not familiar with the process of binary updates. Does
>>> that mean I should commit fixes to the release branches in SVN instead
>>> of the stable ones? I think I maybe need some help there. Never done
>>> that before :-)
>> 
>> Because you cannot.   It would surely help if you could provide the
>> relevant part of the change as patch to re@ and you can find two samples
>> of ENs linked from the box in the right lower corner of the front page of
>> www.freebsd.org and providing parts of the text (ignore revisions etc for
>> now) would certainly help as well.
> 
> Ok, I'll have a look at this once I find some time.

Sounds good -- the first step is really to let the change settle in the tree 
for a month or so to make sure we have a high confidence that it is without 
serious unfortunate side effects, and cleanly resolves any issues users are 
experiencing. Then, as Bjoern says, the next step is to contact re@ with a 
proposed patch and some draft text, and we can take it from there.

Robert___
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: r230425 - stable/9/sys/sys

2012-01-21 Thread Robert Millan
Author: rmh
Date: Sat Jan 21 17:22:50 2012
New Revision: 230425
URL: http://svn.freebsd.org/changeset/base/230425

Log:
  MFC r227827
Define __FreeBSD_kernel__ macro in sys/param.h.
  
__FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
which by definition is always true on FreeBSD. This macro is also defined
on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD.
  
It is tempting to use this macro in userland code when we want to enable
kernel-specific routines, and in fact it's fine to do this in code that
is part of FreeBSD itself.  However, be aware that as presence of this
macro is still not widespread (e.g. older FreeBSD versions, 3rd party
compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in
external applications without also checking for __FreeBSD__ as an
alternative.
  
  Approved by:  kib (mentor)

Modified:
  stable/9/sys/sys/param.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/sys/param.h
==
--- stable/9/sys/sys/param.hSat Jan 21 13:31:38 2012(r230424)
+++ stable/9/sys/sys/param.hSat Jan 21 17:22:50 2012(r230425)
@@ -60,6 +60,22 @@
 #undef __FreeBSD_version
 #define __FreeBSD_version 900502   /* Master, propagated to newvers */
 
+/*
+ * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
+ * which by definition is always true on FreeBSD. This macro is also defined
+ * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD.
+ *
+ * It is tempting to use this macro in userland code when we want to enable
+ * kernel-specific routines, and in fact it's fine to do this in code that
+ * is part of FreeBSD itself.  However, be aware that as presence of this
+ * macro is still not widespread (e.g. older FreeBSD versions, 3rd party
+ * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in
+ * external applications without also checking for __FreeBSD__ as an
+ * alternative.
+ */
+#undef __FreeBSD_kernel__
+#define __FreeBSD_kernel__
+
 #ifdef _KERNEL
 #defineP_OSREL_SIGWAIT 70
 #defineP_OSREL_SIGSEGV 74
___
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: r230426 - in head/sys: amd64/acpica amd64/amd64 amd64/ia32 amd64/include compat/ia32 conf crypto/aesni crypto/via dev/random i386/i386 i386/include i386/isa pc98/pc98

2012-01-21 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 21 17:45:27 2012
New Revision: 230426
URL: http://svn.freebsd.org/changeset/base/230426

Log:
  Add support for the extended FPU states on amd64, both for native
  64bit and 32bit ABIs.  As a side-effect, it enables AVX on capable
  CPUs.
  
  In particular:
  
  - Query the CPU support for XSAVE, list of the supported extensions
and the required size of FPU save area. The hw.use_xsave tunable is
provided for disabling XSAVE, and hw.xsave_mask may be used to
select the enabled extensions.
  
  - Remove the FPU save area from PCB and dynamically allocate the
(run-time sized) user save area on the top of the kernel stack,
right above the PCB. Reorganize the thread0 PCB initialization to
postpone it after BSP is queried for save area size.
  
  - The dumppcb, stoppcbs and susppcbs now do not carry the FPU state as
well. FPU state is only useful for suspend, where it is saved in
dynamically allocated suspfpusave area.
  
  - Use XSAVE and XRSTOR to save/restore FPU state, if supported and
enabled.
  
  - Define new mcontext_t flag _MC_HASFPXSTATE, indicating that
mcontext_t has a valid pointer to out-of-struct extended FPU
state. Signal handlers are supplied with stack-allocated fpu
state. The sigreturn(2) and setcontext(2) syscall honour the flag,
allowing the signal handlers to inspect and manipilate extended
state in the interrupted context.
  
  - The getcontext(2) never returns extended state, since there is no
place in the fixed-sized mcontext_t to place variable-sized save
area. And, since mcontext_t is embedded into ucontext_t, makes it
impossible to fix in a reasonable way.  Instead of extending
getcontext(2) syscall, provide a sysarch(2) facility to query
extended FPU state.
  
  - Add ptrace(2) support for getting and setting extended state; while
there, implement missed PT_I386_{GET,SET}XMMREGS for 32bit binaries.
  
  - Change fpu_kern KPI to not expose struct fpu_kern_ctx layout to
consumers, making it opaque. Internally, struct fpu_kern_ctx now
contains a space for the extended state. Convert in-kernel consumers
of fpu_kern KPI both on i386 and amd64.
  
  First version of the support for AVX was submitted by Tim Bird
   on behalf of Sony. This version was written
  from scratch.
  
  Tested by:pho (previous version), Yamagi Burmeister 
  MFC after:1 month

Added:
  head/sys/amd64/amd64/ptrace_machdep.c   (contents, props changed)
Modified:
  head/sys/amd64/acpica/acpi_switch.S
  head/sys/amd64/acpica/acpi_wakecode.S
  head/sys/amd64/acpica/acpi_wakeup.c
  head/sys/amd64/amd64/cpu_switch.S
  head/sys/amd64/amd64/fpu.c
  head/sys/amd64/amd64/genassym.c
  head/sys/amd64/amd64/initcpu.c
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/amd64/ia32/ia32_reg.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/amd64/include/fpu.h
  head/sys/amd64/include/frame.h
  head/sys/amd64/include/md_var.h
  head/sys/amd64/include/pcb.h
  head/sys/amd64/include/ptrace.h
  head/sys/amd64/include/sysarch.h
  head/sys/amd64/include/ucontext.h
  head/sys/compat/ia32/ia32_signal.h
  head/sys/conf/files.amd64
  head/sys/crypto/aesni/aesni.c
  head/sys/crypto/aesni/aesni.h
  head/sys/crypto/aesni/aesni_wrap.c
  head/sys/crypto/via/padlock.c
  head/sys/crypto/via/padlock.h
  head/sys/crypto/via/padlock_cipher.c
  head/sys/crypto/via/padlock_hash.c
  head/sys/dev/random/nehemiah.c
  head/sys/i386/i386/machdep.c
  head/sys/i386/include/npx.h
  head/sys/i386/include/ptrace.h
  head/sys/i386/include/sysarch.h
  head/sys/i386/include/ucontext.h
  head/sys/i386/isa/npx.c
  head/sys/pc98/pc98/machdep.c

Modified: head/sys/amd64/acpica/acpi_switch.S
==
--- head/sys/amd64/acpica/acpi_switch.S Sat Jan 21 17:22:50 2012
(r230425)
+++ head/sys/amd64/acpica/acpi_switch.S Sat Jan 21 17:45:27 2012
(r230426)
@@ -146,11 +146,22 @@ ENTRY(acpi_restorecpu)
 
/* Restore FPU state. */
fninit
-   fxrstor PCB_USERFPU(%rdi)
+   movqWAKEUP_CTX(fpusave),%rdi
+   cmpl$0,use_xsave
+   jne 1f
+   fxrstor (%rdi)
+   jmp 2f
+1: movlxsave_mask,%eax
+   movlxsave_mask+4,%edx
+/* xrstor  (%rdi) */
+   .byte   0x0f,0xae,0x2f
+2:
 
/* Reload CR0. */
movq%rcx, %cr0
 
+   movqWAKEUP_CTX(pcb),%rdi
+
/* Restore return address. */
movqPCB_RIP(%rdi), %rax
movq%rax, (%rsp)

Modified: head/sys/amd64/acpica/acpi_wakecode.S
==
--- head/sys/amd64/acpica/acpi_wakecode.S   Sat Jan 21 17:22:50 2012
(r230425)
+++ head/sys/amd64/acpica/acpi_wakecode.S   Sat Jan 21 17:45:27 2012
(r230426)
@@ -270,6

svn commit: r230427 - head/gnu/usr.bin/gdb/kgdb

2012-01-21 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 21 17:50:14 2012
New Revision: 230427
URL: http://svn.freebsd.org/changeset/base/230427

Log:
  Adopt to new layout of struct pcb.
  
  MFC after:1 month

Modified:
  head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c  Sat Jan 21 17:45:27 2012
(r230426)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c  Sat Jan 21 17:50:14 2012
(r230427)
@@ -66,7 +66,7 @@ kgdb_trgt_fetch_registers(int regno __un
supply_register(AMD64_R8_REGNUM + 6, (char *)&pcb.pcb_r14);
supply_register(AMD64_R15_REGNUM, (char *)&pcb.pcb_r15);
supply_register(AMD64_RIP_REGNUM, (char *)&pcb.pcb_rip);
-   amd64_supply_fxsave(current_regcache, -1, &pcb.pcb_user_save);
+   amd64_supply_fxsave(current_regcache, -1, (struct fpusave *)(&pcb + 1));
 }
 
 void
___
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: r230429 - in head: lib/libc/amd64/gen lib/libc/arm/gen lib/libc/gen lib/libc/i386/gen lib/libc/ia64/gen lib/libc/mips/gen lib/libc/powerpc/gen lib/libc/powerpc64/gen lib/libc/sparc64/ge...

2012-01-21 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 21 18:00:28 2012
New Revision: 230429
URL: http://svn.freebsd.org/changeset/base/230429

Log:
  Add API for obtaining extended machine context states that cannot be
  fit into existing mcontext_t.
  
  On i386 and amd64 do return the extended FPU states using
  getcontextx(3). For other architectures, getcontextx(3) returns the
  same information as getcontext(2).
  
  Tested by:  pho
  MFC after:  1 month

Added:
  head/lib/libc/amd64/gen/getcontextx.c   (contents, props changed)
  head/lib/libc/arm/gen/getcontextx.c   (contents, props changed)
  head/lib/libc/i386/gen/getcontextx.c   (contents, props changed)
  head/lib/libc/ia64/gen/getcontextx.c   (contents, props changed)
  head/lib/libc/mips/gen/getcontextx.c   (contents, props changed)
  head/lib/libc/powerpc/gen/getcontextx.c   (contents, props changed)
  head/lib/libc/powerpc64/gen/getcontextx.c   (contents, props changed)
  head/lib/libc/sparc64/gen/getcontextx.c   (contents, props changed)
Modified:
  head/lib/libc/amd64/gen/Makefile.inc
  head/lib/libc/arm/gen/Makefile.inc
  head/lib/libc/gen/Symbol.map
  head/lib/libc/gen/getcontext.3
  head/lib/libc/gen/ucontext.3
  head/lib/libc/i386/gen/Makefile.inc
  head/lib/libc/ia64/gen/Makefile.inc
  head/lib/libc/mips/gen/Makefile.inc
  head/lib/libc/powerpc/gen/Makefile.inc
  head/lib/libc/powerpc64/gen/Makefile.inc
  head/lib/libc/sparc64/gen/Makefile.inc
  head/sys/sys/ucontext.h

Modified: head/lib/libc/amd64/gen/Makefile.inc
==
--- head/lib/libc/amd64/gen/Makefile.incSat Jan 21 17:59:50 2012
(r230428)
+++ head/lib/libc/amd64/gen/Makefile.incSat Jan 21 18:00:28 2012
(r230429)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 SRCS+= _setjmp.S _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \
-   fabs.S \
+   fabs.S getcontextx.c \
infinity.c ldexp.c makecontext.c signalcontext.c \
flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \
fpgetround.c fpsetround.c fpgetsticky.c

Added: head/lib/libc/amd64/gen/getcontextx.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/amd64/gen/getcontextx.c   Sat Jan 21 18:00:28 2012
(r230429)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2011 Konstantin Belousov 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int xstate_sz = -1;
+
+size_t
+__getcontextx_size(void)
+{
+   u_int p[4];
+
+   if (xstate_sz == -1) {
+   do_cpuid(1, p);
+   if ((p[2] & CPUID2_OSXSAVE) != 0) {
+   cpuid_count(0xd, 0x0, p);
+   xstate_sz = p[1] - sizeof(struct savefpu);
+   } else
+   xstate_sz = 0;
+   }
+
+   return (sizeof(ucontext_t) + xstate_sz);
+}
+
+int
+__fillcontextx(char *ctx)
+{
+   struct amd64_get_xfpustate xfpu;
+   ucontext_t *ucp;
+
+   ucp = (ucontext_t *)ctx;
+   if (getcontext(ucp) == -1)
+   return (-1);
+   if (xstate_sz != 0) {
+   xfpu.addr = (char *)(ucp + 1);
+   xfpu.len = xstate_sz;
+   if (sysarch(AMD64_GET_XFPUSTATE, &xfpu) == -1)
+   return (-1);
+   ucp->uc_mcontext.mc_xfpustate = (__register_t)xfpu.addr;
+   ucp->uc_mcontext.mc_xfpustate_len = xstate_sz;
+   ucp->uc_mcontext.mc_flags |= _MC_HASFPXSTATE;
+   } else {
+   ucp->uc_mcontext.mc_xfpustate = 0;
+

svn commit: r230430 - head/lib/libthr/thread

2012-01-21 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 21 18:06:18 2012
New Revision: 230430
URL: http://svn.freebsd.org/changeset/base/230430

Log:
  Use getcontextx(3) internal API instead of getcontext(2) to provide
  the signal handlers with the context information in the deferrred
  case.
  
  Only enable the use of getcontextx(3) in the deferred signal delivery
  code on amd64 and i386. Sparc64 seems to have some undetermined issues
  with interaction of alloca(3) and signal delivery.
  
  Tested by:flo (who also provided sparc64 harware access for me), pho
  Discussed with:   marius
  MFC after:1 month

Modified:
  head/lib/libthr/thread/thr_sig.c

Modified: head/lib/libthr/thread/thr_sig.c
==
--- head/lib/libthr/thread/thr_sig.cSat Jan 21 18:00:28 2012
(r230429)
+++ head/lib/libthr/thread/thr_sig.cSat Jan 21 18:06:18 2012
(r230430)
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "un-namespace.h"
@@ -314,16 +315,24 @@ check_cancel(struct pthread *curthread, 
 static void
 check_deferred_signal(struct pthread *curthread)
 {
-   ucontext_t uc;
+   ucontext_t *uc;
struct sigaction act;
siginfo_t info;
 
if (__predict_true(curthread->deferred_siginfo.si_signo == 0))
return;
-   getcontext(&uc);
+
+#if defined(__amd64__) || defined(__i386__)
+   uc = alloca(__getcontextx_size());
+   __fillcontextx((char *)uc);
+#else
+   ucontext_t ucv;
+   uc = &ucv;
+   getcontext(uc);
+#endif
if (curthread->deferred_siginfo.si_signo != 0) {
act = curthread->deferred_sigact;
-   uc.uc_sigmask = curthread->deferred_sigmask;
+   uc->uc_sigmask = curthread->deferred_sigmask;
memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t));
/* remove signal */
curthread->deferred_siginfo.si_signo = 0;
@@ -334,7 +343,7 @@ check_deferred_signal(struct pthread *cu
tact.sa_handler = SIG_DFL;
_sigaction(info.si_signo, &tact, NULL);
}
-   handle_signal(&act, info.si_signo, &info, &uc);
+   handle_signal(&act, info.si_signo, &info, uc);
}
 }
 
___
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: r230431 - stable/9/sys/i386/xen

2012-01-21 Thread Alan Cox
Author: alc
Date: Sat Jan 21 18:11:12 2012
New Revision: 230431
URL: http://svn.freebsd.org/changeset/base/230431

Log:
  MFC r228746
The Xen pmap doesn't support superpages.  So, there is no point in it
initializing structures, like the pv table, that are only used to
implement superpages.  In fact, some of the unnecessary code in
pmap_init() was actually doing harm.  It was preventing the kernel from
booting on virtual machines with more than 768 MB of memory.

Modified:
  stable/9/sys/i386/xen/pmap.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/i386/xen/pmap.c
==
--- stable/9/sys/i386/xen/pmap.cSat Jan 21 18:06:18 2012
(r230430)
+++ stable/9/sys/i386/xen/pmap.cSat Jan 21 18:11:12 2012
(r230431)
@@ -184,9 +184,6 @@ __FBSDID("$FreeBSD$");
 #define PV_STAT(x) do { } while (0)
 #endif
 
-#definepa_index(pa)((pa) >> PDRSHIFT)
-#definepa_to_pvh(pa)   (&pv_table[pa_index(pa)])
-
 /*
  * Get PDEs and PTEs for user/kernel address space
  */
@@ -230,7 +227,6 @@ static int pat_works;   /* Is page attri
  * Data for the pv entry allocation mechanism
  */
 static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
-static struct md_page *pv_table;
 static int shpgperproc = PMAP_SHPGPERPROC;
 
 struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */
@@ -278,9 +274,6 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchan
 static struct mtx PMAP2mutex;
 
 SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
-static int pg_ps_enabled;
-SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0,
-"Are large page mappings enabled?");
 
 SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0,
"Max number of PV entries");
@@ -636,24 +629,8 @@ pmap_ptelist_init(vm_offset_t *head, voi
 void
 pmap_init(void)
 {
-   vm_page_t mpte;
-   vm_size_t s;
-   int i, pv_npg;
 
/*
-* Initialize the vm page array entries for the kernel pmap's
-* page table pages.
-*/ 
-   for (i = 0; i < nkpt; i++) {
-   mpte = PHYS_TO_VM_PAGE(xpmap_mtop(PTD[i + KPTDI] & PG_FRAME));
-   KASSERT(mpte >= vm_page_array &&
-   mpte < &vm_page_array[vm_page_array_size],
-   ("pmap_init: page table page is out of range"));
-   mpte->pindex = i + KPTDI;
-   mpte->phys_addr = xpmap_mtop(PTD[i + KPTDI] & PG_FRAME);
-   }
-
-/*
 * Initialize the address space (zone) for the pv entries.  Set a
 * high water mark so that the system can recover from excessive
 * numbers of pv entries.
@@ -664,26 +641,6 @@ pmap_init(void)
pv_entry_max = roundup(pv_entry_max, _NPCPV);
pv_entry_high_water = 9 * (pv_entry_max / 10);
 
-   /*
-* Are large page mappings enabled?
-*/
-   TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
-
-   /*
-* Calculate the size of the pv head table for superpages.
-*/
-   for (i = 0; phys_avail[i + 1]; i += 2);
-   pv_npg = round_4mpage(phys_avail[(i - 2) + 1]) / NBPDR;
-
-   /*
-* Allocate memory for the pv head table for superpages.
-*/
-   s = (vm_size_t)(pv_npg * sizeof(struct md_page));
-   s = round_page(s);
-   pv_table = (struct md_page *)kmem_alloc(kernel_map, s);
-   for (i = 0; i < pv_npg; i++)
-   TAILQ_INIT(&pv_table[i].pv_list);
-
pv_maxchunks = MAX(pv_entry_max / _NPCPV, maxproc);
pv_chunkbase = (struct pv_chunk *)kmem_alloc_nofault(kernel_map,
PAGE_SIZE * pv_maxchunks);
@@ -3452,21 +3409,15 @@ pmap_page_wired_mappings(vm_page_t m)
 }
 
 /*
- * Returns TRUE if the given page is mapped individually or as part of
- * a 4mpage.  Otherwise, returns FALSE.
+ * Returns TRUE if the given page is mapped.  Otherwise, returns FALSE.
  */
 boolean_t
 pmap_page_is_mapped(vm_page_t m)
 {
-   boolean_t rv;
 
if ((m->oflags & VPO_UNMANAGED) != 0)
return (FALSE);
-   vm_page_lock_queues();
-   rv = !TAILQ_EMPTY(&m->md.pv_list) ||
-   !TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv

svn commit: r230432 - stable/8/sys/sys

2012-01-21 Thread Robert Millan
Author: rmh
Date: Sat Jan 21 18:21:44 2012
New Revision: 230432
URL: http://svn.freebsd.org/changeset/base/230432

Log:
  MFC r227827
Define __FreeBSD_kernel__ macro in sys/param.h.
  
__FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
which by definition is always true on FreeBSD. This macro is also defined
on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD.
  
It is tempting to use this macro in userland code when we want to enable
kernel-specific routines, and in fact it's fine to do this in code that
is part of FreeBSD itself.  However, be aware that as presence of this
macro is still not widespread (e.g. older FreeBSD versions, 3rd party
compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in
external applications without also checking for __FreeBSD__ as an
alternative.
  
  Approved by:  kib (mentor)

Modified:
  stable/8/sys/sys/param.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/sys/param.h
==
--- stable/8/sys/sys/param.hSat Jan 21 18:11:12 2012(r230431)
+++ stable/8/sys/sys/param.hSat Jan 21 18:21:44 2012(r230432)
@@ -60,6 +60,22 @@
 #undef __FreeBSD_version
 #define __FreeBSD_version 802516   /* Master, propagated to newvers */
 
+/*
+ * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
+ * which by definition is always true on FreeBSD. This macro is also defined
+ * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD.
+ *
+ * It is tempting to use this macro in userland code when we want to enable
+ * kernel-specific routines, and in fact it's fine to do this in code that
+ * is part of FreeBSD itself.  However, be aware that as presence of this
+ * macro is still not widespread (e.g. older FreeBSD versions, 3rd party
+ * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in
+ * external applications without also checking for __FreeBSD__ as an
+ * alternative.
+ */
+#undef __FreeBSD_kernel__
+#define __FreeBSD_kernel__
+
 #ifdef _KERNEL
 #defineP_OSREL_SIGWAIT 70
 #defineP_OSREL_SIGSEGV 74
___
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: r230433 - stable/8/sys/i386/xen

2012-01-21 Thread Alan Cox
Author: alc
Date: Sat Jan 21 18:38:57 2012
New Revision: 230433
URL: http://svn.freebsd.org/changeset/base/230433

Log:
  MFC r228746
The Xen pmap doesn't support superpages.  So, there is no point in it
initializing structures, like the pv table, that are only used to
implement superpages.  In fact, some of the unnecessary code in
pmap_init() was actually doing harm.  It was preventing the kernel from
booting on virtual machines with more than 768 MB of memory.
  
  Note: The change to pmap_page_is_mapped() differs slightly from r228746
because of differences in how the page queues lock is used in
FreeBSD 8.x.

Modified:
  stable/8/sys/i386/xen/pmap.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/i386/xen/pmap.c
==
--- stable/8/sys/i386/xen/pmap.cSat Jan 21 18:21:44 2012
(r230432)
+++ stable/8/sys/i386/xen/pmap.cSat Jan 21 18:38:57 2012
(r230433)
@@ -184,9 +184,6 @@ __FBSDID("$FreeBSD$");
 #define PV_STAT(x) do { } while (0)
 #endif
 
-#definepa_index(pa)((pa) >> PDRSHIFT)
-#definepa_to_pvh(pa)   (&pv_table[pa_index(pa)])
-
 /*
  * Get PDEs and PTEs for user/kernel address space
  */
@@ -233,7 +230,6 @@ static int pat_works;   /* Is page attri
  * Data for the pv entry allocation mechanism
  */
 static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
-static struct md_page *pv_table;
 static int shpgperproc = PMAP_SHPGPERPROC;
 
 struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */
@@ -282,9 +278,6 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchan
 static struct mtx PMAP2mutex;
 
 SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
-static int pg_ps_enabled;
-SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0,
-"Are large page mappings enabled?");
 
 SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0,
"Max number of PV entries");
@@ -687,24 +680,8 @@ pmap_ptelist_init(vm_offset_t *head, voi
 void
 pmap_init(void)
 {
-   vm_page_t mpte;
-   vm_size_t s;
-   int i, pv_npg;
 
/*
-* Initialize the vm page array entries for the kernel pmap's
-* page table pages.
-*/ 
-   for (i = 0; i < nkpt; i++) {
-   mpte = PHYS_TO_VM_PAGE(xpmap_mtop(PTD[i + KPTDI] & PG_FRAME));
-   KASSERT(mpte >= vm_page_array &&
-   mpte < &vm_page_array[vm_page_array_size],
-   ("pmap_init: page table page is out of range"));
-   mpte->pindex = i + KPTDI;
-   mpte->phys_addr = xpmap_mtop(PTD[i + KPTDI] & PG_FRAME);
-   }
-
-/*
 * Initialize the address space (zone) for the pv entries.  Set a
 * high water mark so that the system can recover from excessive
 * numbers of pv entries.
@@ -715,26 +692,6 @@ pmap_init(void)
pv_entry_max = roundup(pv_entry_max, _NPCPV);
pv_entry_high_water = 9 * (pv_entry_max / 10);
 
-   /*
-* Are large page mappings enabled?
-*/
-   TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
-
-   /*
-* Calculate the size of the pv head table for superpages.
-*/
-   for (i = 0; phys_avail[i + 1]; i += 2);
-   pv_npg = round_4mpage(phys_avail[(i - 2) + 1]) / NBPDR;
-
-   /*
-* Allocate memory for the pv head table for superpages.
-*/
-   s = (vm_size_t)(pv_npg * sizeof(struct md_page));
-   s = round_page(s);
-   pv_table = (struct md_page *)kmem_alloc(kernel_map, s);
-   for (i = 0; i < pv_npg; i++)
-   TAILQ_INIT(&pv_table[i].pv_list);
-
pv_maxchunks = MAX(pv_entry_max / _NPCPV, maxproc);
pv_chunkbase = (struct pv_chunk *)kmem_alloc_nofault(kernel_map,
PAGE_SIZE * pv_maxchunks);
@@ -3537,22 +3494,16 @@ pmap_page_wired_mappings(vm_page_t m)
 }
 
 /*
- * Returns TRUE if the given page is mapped individually or as part of
- * a 4mpage.  Otherwise, returns FALSE.
+ * Returns TRUE if the given page is mapped.  Otherwise, returns FALSE.
  */
 boolean_t
 pmap_page_is_mapped(vm_page_t m)
 {
-   struct md_page *pvh;
 
if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
return (FALSE);
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-   if (TAILQ_EMPTY(&m->md.pv_list)) {
-   pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
-   return (!TAILQ_EMPTY(&pvh->pv_list));
-   } else
-   return (TRUE);
+   return (!TAILQ_EMPTY(&m->md.pv_list));
 }
 
 /*
___
svn-src-all@freebsd.org mailing lis

svn commit: r230435 - in stable/9/sys: amd64/amd64 i386/i386 i386/xen

2012-01-21 Thread Alan Cox
Author: alc
Date: Sat Jan 21 19:21:42 2012
New Revision: 230435
URL: http://svn.freebsd.org/changeset/base/230435

Log:
  MFC r228923, r228935, and r229007
Eliminate many of the unnecessary differences between the native and
paravirtualized pmap implementations for i386.
  
Fix a bug in the Xen pmap's implementation of
pmap_extract_and_hold(): If the page lock acquisition is retried,
then the underlying thread is not unpinned.
  
Wrap nearby lines that exceed 80 columns.
  
Merge r216333 and r216555 from the native pmap
  When r207410 eliminated the acquisition and release of the page
  queues lock from pmap_extract_and_hold(), it didn't take into
  account that pmap_pte_quick() sometimes requires the page queues
  lock to be held.  This change reimplements pmap_extract_and_hold()
  such that it no longer uses pmap_pte_quick(), and thus never
  requires the page queues lock.
  
Merge r177525 from the native pmap
  Prevent the overflow in the calculation of the next page
  directory.  The overflow causes the wraparound with consequent
  corruption of the (almost) whole address space mapping.
  
Strictly speaking, r177525 is not required by the Xen pmap because
the hypervisor steals the uppermost region of the normal kernel
address space.  I am nonetheless merging it in order to reduce the
number of unnecessary differences between the native and Xen pmap
implementations.

Modified:
  stable/9/sys/amd64/amd64/pmap.c
  stable/9/sys/i386/i386/pmap.c
  stable/9/sys/i386/xen/pmap.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/amd64/amd64/pmap.c
==
--- stable/9/sys/amd64/amd64/pmap.c Sat Jan 21 18:54:19 2012
(r230434)
+++ stable/9/sys/amd64/amd64/pmap.c Sat Jan 21 19:21:42 2012
(r230435)
@@ -1255,8 +1255,8 @@ retry:
if (pdep != NULL && (pde = *pdep)) {
if (pde & PG_PS) {
if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
-   if (vm_page_pa_tryrelock(pmap, (pde & 
PG_PS_FRAME) |
-  (va & PDRMASK), &pa))
+   if (vm_page_pa_tryrelock(pmap, (pde &
+   PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
(va & PDRMASK));
@@ -1266,7 +1266,8 @@ retry:
pte = *pmap_pde_to_pte(pdep, va);
if ((pte & PG_V) &&
((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
-   if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, 
&pa))
+   if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME,
+   &pa))
goto retry;
m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
vm_page_hold(m);

Modified: stable/9/sys/i386/i386/pmap.c
==
--- stable/9/sys/i386/i386/pmap.c   Sat Jan 21 18:54:19 2012
(r230434)
+++ stable/9/sys/i386/i386/pmap.c   Sat Jan 21 19:21:42 2012
(r230435)
@@ -330,7 +330,7 @@ static void pmap_update_pde_invalidate(v
 
 static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags);
 
-static vm_page_t _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags);
+static vm_page_t _pmap_allocpte(pmap_t pmap, u_int ptepindex, int flags);
 static int _pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m, vm_page_t *free);
 static pt_entry_t *pmap_pte_quick(pmap_t pmap, vm_offset_t va);
 static void pmap_pte_release(pt_entry_t *pte);
@@ -340,6 +340,8 @@ static void *pmap_pdpt_allocf(uma_zone_t
 #endif
 static void pmap_set_pg(void);
 
+static __inline void pagezero(void *page);
+
 CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t));
 CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t));
 
@@ -1216,7 +1218,7 @@ pmap_is_current(pmap_t pmap)
 {
 
return (pmap == kernel_pmap ||
-   (pmap == vmspace_pmap(curthread->td_proc->p_vmspace) &&
+  

Re: svn commit: r229800 - head/sys/conf

2012-01-21 Thread Pawel Jakub Dawidek
On Sun, Jan 08, 2012 at 02:58:56PM -0800, Adrian Chadd wrote:
> On 8 January 2012 02:43, Pawel Jakub Dawidek  wrote:
> > If someone is actually using GENERIC kernel. This change will break all
> > my system next time I upgrade. Adding UFS_ACL option to the kernel
> > config to make ZFS kernel module to work doesn't sound very intuitive.
> >
> > I understand what you are trying to accomplish, but we really need to
> > find better way to do this. Until then, could you back it out?
> 
> I'd rather find a cleaner solution - it's pulling in code which just
> isn't being used if you aren't using UFS_ACL or ZFS.
> 
> How about wrapping those two up in a module which zfs can register a
> dependency on?

Adrian, I see no progress was made on this and I just was beaten by this
change. I upgrade a box, but forget about this and I couldn't load zfs
module. Until better idea is found and implemented, once again, please
back this one out.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl


pgpEEXN0q2Dba.pgp
Description: PGP signature


svn commit: r230436 - head/sbin/hastd

2012-01-21 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Jan 21 20:13:37 2012
New Revision: 230436
URL: http://svn.freebsd.org/changeset/base/230436

Log:
  Fix minor memory leak.
  
  MFC after:3 days

Modified:
  head/sbin/hastd/parse.y

Modified: head/sbin/hastd/parse.y
==
--- head/sbin/hastd/parse.y Sat Jan 21 19:21:42 2012(r230435)
+++ head/sbin/hastd/parse.y Sat Jan 21 20:13:37 2012(r230436)
@@ -812,6 +812,7 @@ resource_start: STR
sizeof(curres->hr_name)) >=
sizeof(curres->hr_name)) {
pjdlog_error("Resource name is too long.");
+   free(curres);
free($1);
return (1);
}
___
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: r230437 - head/bin/sh/funcs

2012-01-21 Thread Jilles Tjoelker
Author: jilles
Date: Sat Jan 21 20:39:17 2012
New Revision: 230437
URL: http://svn.freebsd.org/changeset/base/230437

Log:
  sh: Remove "kill" example function, which is superseded by the kill builtin
  
  MFC after:1 week

Deleted:
  head/bin/sh/funcs/kill
___
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: r230438 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/...

2012-01-21 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Jan 21 21:12:53 2012
New Revision: 230438
URL: http://svn.freebsd.org/changeset/base/230438

Log:
  Dramatically optimize listing snapshots when user requests only snapshot
  names and wants to sort them by name, ie. when executes:
  
# zfs list -t snapshot -o name -s name
  
  Because only name is needed we don't have to read all snapshot properties.
  
  Below you can find how long does it take to list 34509 snapshots from a single
  disk pool before and after this change with cold and warm cache:
  
  before:
  
# time zfs list -t snapshot -o name -s name > /dev/null
cold cache: 525s
warm cache: 218s
  
  after:
  
# time zfs list -t snapshot -o name -s name > /dev/null
cold cache: 1.7s
warm cache: 1.1s
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.cSat Jan 21 20:39:17 
2012(r230437)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.cSat Jan 21 21:12:53 
2012(r230438)
@@ -20,6 +20,8 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 Pawel Jakub Dawidek .
+ * All rights reserved.
  */
 
 #include 
@@ -129,8 +131,11 @@ zfs_callback(zfs_handle_t *zhp, void *da
cb->cb_depth++;
if (zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM)
(void) zfs_iter_filesystems(zhp, zfs_callback, data);
-   if ((zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) && include_snaps)
-   (void) zfs_iter_snapshots(zhp, zfs_callback, data);
+   if ((zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) && include_snaps) {
+   (void) zfs_iter_snapshots(zhp,
+   (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback,
+   data);
+   }
cb->cb_depth--;
}
 
@@ -184,6 +189,14 @@ zfs_free_sort_columns(zfs_sort_column_t 
}
 }
 
+boolean_t
+zfs_sort_only_by_name(const zfs_sort_column_t *sc)
+{
+
+   return (sc != NULL && sc->sc_next == NULL &&
+   sc->sc_prop == ZFS_PROP_NAME);
+}
+
 /* ARGSUSED */
 static int
 zfs_compare(const void *larg, const void *rarg, void *unused)
@@ -224,7 +237,13 @@ zfs_compare(const void *larg, const void
lcreate = zfs_prop_get_int(l, ZFS_PROP_CREATETXG);
rcreate = zfs_prop_get_int(r, ZFS_PROP_CREATETXG);
 
-   if (lcreate < rcreate)
+   /*
+* Both lcreate and rcreate being 0 means we don't have
+* properties and we should compare full name.
+*/
+   if (lcreate == 0 && rcreate == 0)
+   ret = strcmp(lat + 1, rat + 1);
+   else if (lcreate < rcreate)
ret = -1;
else if (lcreate > rcreate)
ret = 1;
@@ -290,7 +309,14 @@ zfs_sort(const void *larg, const void *r
if (rvalid)
verify(nvlist_lookup_string(rval,
ZPROP_VALUE, &rstr) == 0);
+   } else if (psc->sc_prop == ZFS_PROP_NAME) {
+   lvalid = rvalid = B_TRUE;
+
+   (void) strlcpy(lbuf, zfs_get_name(l), sizeof(lbuf));
+   (void) strlcpy(rbuf, zfs_get_name(r), sizeof(rbuf));
 
+   lstr = lbuf;
+   rstr = rbuf;
} else if (zfs_prop_is_string(psc->sc_prop)) {
lvalid = (zfs_prop_get(l, psc->sc_prop, lbuf,
sizeof (lbuf), NULL, NULL, 0, B_TRUE) == 0);

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.hSat Jan 21 20:39:17 
2012(r230437)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.hSat Jan 21 21:12:53 
2012(r230438)
@@ -43,11 +43,13 @@ typedef struct zfs_sort_column {
 #defineZFS_ITER_PROP_LISTSNAPS

svn commit: r230439 - stable/9/bin/sh

2012-01-21 Thread Jilles Tjoelker
Author: jilles
Date: Sat Jan 21 21:54:31 2012
New Revision: 230439
URL: http://svn.freebsd.org/changeset/base/230439

Log:
  MFC r230117: sh: Fix out of bounds array access when trap is used with an
  invalid signal.

Modified:
  stable/9/bin/sh/trap.c
Directory Properties:
  stable/9/bin/sh/   (props changed)

Modified: stable/9/bin/sh/trap.c
==
--- stable/9/bin/sh/trap.c  Sat Jan 21 21:12:53 2012(r230438)
+++ stable/9/bin/sh/trap.c  Sat Jan 21 21:54:31 2012(r230439)
@@ -191,10 +191,11 @@ trapcmd(int argc, char **argv)
argv++;
}
}
-   while (*argv) {
+   for (; *argv; argv++) {
if ((signo = sigstring_to_signum(*argv)) == -1) {
warning("bad signal %s", *argv);
errors = 1;
+   continue;
}
INTOFF;
if (action)
@@ -205,7 +206,6 @@ trapcmd(int argc, char **argv)
if (signo != 0)
setsignal(signo);
INTON;
-   argv++;
}
return errors;
 }
___
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: r230441 - head/sys/kern

2012-01-21 Thread Konstantin Belousov
Author: kib
Date: Sun Jan 22 01:11:06 2012
New Revision: 230441
URL: http://svn.freebsd.org/changeset/base/230441

Log:
  Remove the nc_time and nc_ticks elements from struct namecache, and
  provide struct namecache_ts which is the old struct namecache. Only
  allocate struct namecache_ts if non-null struct timespec *tsp was
  passed to cache_enter_time, otherwise use struct namecache.
  
  Change struct namecache allocation and deallocation macros into static
  functions, since logic becomes somewhat twisty.  Provide accessor for
  the nc_name member of struct namecache to hide difference between
  struct namecache and namecache_ts.
  
  The aim of the change is to not waste 20 bytes per small namecache
  entry.
  
  Reviewed by:   jhb
  MFC after: 2 weeks
  X-MFC-note:  after r230394

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Sat Jan 21 22:18:33 2012(r230440)
+++ head/sys/kern/vfs_cache.c   Sun Jan 22 01:11:06 2012(r230441)
@@ -97,14 +97,36 @@ struct  namecache {
TAILQ_ENTRY(namecache) nc_dst;  /* destination vnode list */
struct  vnode *nc_dvp;  /* vnode of parent of name */
struct  vnode *nc_vp;   /* vnode the name refers to */
-   struct  timespec nc_time;   /* timespec provided by fs */
-   int nc_ticks;   /* ticks value when entry was added */
u_char  nc_flag;/* flag bits */
u_char  nc_nlen;/* length of name */
charnc_name[0]; /* segment name + nul */
 };
 
 /*
+ * struct namecache_ts repeats struct namecache layout up to the
+ * nc_nlen member.
+ */
+struct namecache_ts {
+   LIST_ENTRY(namecache) nc_hash;  /* hash chain */
+   LIST_ENTRY(namecache) nc_src;   /* source vnode list */
+   TAILQ_ENTRY(namecache) nc_dst;  /* destination vnode list */
+   struct  vnode *nc_dvp;  /* vnode of parent of name */
+   struct  vnode *nc_vp;   /* vnode the name refers to */
+   u_char  nc_flag;/* flag bits */
+   u_char  nc_nlen;/* length of name */
+   struct  timespec nc_time;   /* timespec provided by fs */
+   int nc_ticks;   /* ticks value when entry was added */
+   charnc_name[0]; /* segment name + nul */
+};
+
+/*
+ * Flags in namecache.nc_flag
+ */
+#define NCF_WHITE  0x01
+#define NCF_ISDOTDOT   0x02
+#defineNCF_TS  0x04
+
+/*
  * Name caching works as follows:
  *
  * Names found by directory scans are retained in a cache
@@ -166,20 +188,50 @@ RW_SYSINIT(vfscache, &cache_lock, "Name 
  * fit in the small cache.
  */
 static uma_zone_t cache_zone_small;
+static uma_zone_t cache_zone_small_ts;
 static uma_zone_t cache_zone_large;
 
 #defineCACHE_PATH_CUTOFF   35
-#defineCACHE_ZONE_SMALL(sizeof(struct namecache) + 
CACHE_PATH_CUTOFF \
-   + 1)
-#defineCACHE_ZONE_LARGE(sizeof(struct namecache) + NAME_MAX + 
1)
-
-#define cache_alloc(len)   uma_zalloc(((len) <= CACHE_PATH_CUTOFF) ? \
-   cache_zone_small : cache_zone_large, M_WAITOK)
-#define cache_free(ncp)do { \
-   if (ncp != NULL) \
-   uma_zfree(((ncp)->nc_nlen <= CACHE_PATH_CUTOFF) ? \
-   cache_zone_small : cache_zone_large, (ncp)); \
-} while (0)
+
+static struct namecache *
+cache_alloc(int len, int ts)
+{
+
+   if (len > CACHE_PATH_CUTOFF)
+   return (uma_zalloc(cache_zone_large, M_WAITOK));
+   if (ts)
+   return (uma_zalloc(cache_zone_small_ts, M_WAITOK));
+   else
+   return (uma_zalloc(cache_zone_small, M_WAITOK));
+}
+
+static void
+cache_free(struct namecache *ncp)
+{
+   int ts;
+
+   if (ncp == NULL)
+   return;
+   ts = ncp->nc_flag & NCF_TS;
+   if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) {
+   if (ts)
+   uma_zfree(cache_zone_small_ts, ncp);
+   else
+   uma_zfree(cache_zone_small, ncp);
+   } else
+   uma_zfree(cache_zone_large, ncp);
+}
+
+static char *
+nc_get_name(struct namecache *ncp)
+{
+   struct namecache_ts *ncp_ts;
+
+   if ((ncp->nc_flag & NCF_TS) == 0)
+   return (ncp->nc_name);
+   ncp_ts = (struct namecache_ts *)ncp;
+   return (ncp_ts->nc_name);
+}
 
 static int doingcache = 1; /* 1 => enable the cache */
 SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0,
@@ -235,12 +287,6 @@ static int vn_fullpath1(struct thread *t
 
 static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries");
 
-/*
- * Flags in namecache.nc_flag
- */
-#define NCF_WHITE  0x01
-#define NCF_ISDOTDOT   0x02
-
 #ifdef DIAGNOSTIC
 /*
  * Grab an atomic snapshot of th

svn commit: r230442 - in head/sys: netinet netinet6 netipsec

2012-01-21 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jan 22 02:13:19 2012
New Revision: 230442
URL: http://svn.freebsd.org/changeset/base/230442

Log:
  Clean up some #endif comments removing from short sections.  Add #endif
  comments to longer, also refining strange ones.
  
  Properly use #ifdef rather than #if defined() where possible.  Four
  #if defined(PCBGROUP) occurances (netinet and netinet6) were ignored to
  avoid conflicts with eventually upcoming changes for RSS.
  
  Reported by:  bde (most)
  Reviewed by:  bde
  MFC after:3 days

Modified:
  head/sys/netinet/if_ether.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/ip_ipsec.c
  head/sys/netinet6/ip6_ipsec.c
  head/sys/netipsec/xform_ipip.c

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Sun Jan 22 01:11:06 2012(r230441)
+++ head/sys/netinet/if_ether.c Sun Jan 22 02:13:19 2012(r230442)
@@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#if defined(INET)
+#ifdef INET
 #include 
 #endif
 

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Sun Jan 22 01:11:06 2012(r230441)
+++ head/sys/netinet/in_pcb.c   Sun Jan 22 02:13:19 2012(r230442)
@@ -196,7 +196,7 @@ SYSCTL_VNET_INT(_net_inet_ip_portrange, 
&VNET_NAME(ipport_randomtime), 0,
"Minimum time to keep sequental port "
"allocation before switching to a random one");
-#endif
+#endif /* INET */
 
 /*
  * in_pcb.c: manage the Protocol Control Blocks.
@@ -1038,7 +1038,7 @@ in_pcbdisconnect(struct inpcb *inp)
inp->inp_fport = 0;
in_pcbrehash(inp);
 }
-#endif
+#endif /* INET */
 
 /*
  * in_pcbdetach() is responsibe for disassociating a socket from an inpcb.
@@ -1169,7 +1169,7 @@ in_pcbfree(struct inpcb *inp)
 #ifdef IPSEC
if (inp->inp_sp != NULL)
ipsec_delete_pcbpolicy(inp);
-#endif /* IPSEC */
+#endif
inp->inp_gencnt = ++pcbinfo->ipi_gencnt;
in_pcbremlists(inp);
 #ifdef INET6
@@ -1586,7 +1586,7 @@ in_pcblookup_group(struct inpcbinfo *pcb
if (inp->inp_vflag & INP_IPV6PROTO)
local_wild_mapped = inp;
else
-#endif /* INET6 */
+#endif
if (injail)
jail_wild = inp;
else
@@ -1601,7 +1601,7 @@ in_pcblookup_group(struct inpcbinfo *pcb
 #ifdef INET6
if (inp == NULL)
inp = local_wild_mapped;
-#endif /* defined(INET6) */
+#endif
if (inp != NULL)
goto found;
} /* if (lookupflags & INPLOOKUP_WILDCARD) */
@@ -1731,7 +1731,7 @@ in_pcblookup_hash_locked(struct inpcbinf
if (inp->inp_vflag & INP_IPV6PROTO)
local_wild_mapped = inp;
else
-#endif /* INET6 */
+#endif
if (injail)
jail_wild = inp;
else
@@ -1747,7 +1747,7 @@ in_pcblookup_hash_locked(struct inpcbinf
 #ifdef INET6
if (local_wild_mapped != NULL)
return (local_wild_mapped);
-#endif /* defined(INET6) */
+#endif
} /* if ((lookupflags & INPLOOKUP_WILDCARD) != 0) */
 
return (NULL);
@@ -1871,7 +1871,7 @@ in_pcbinshash_internal(struct inpcb *inp
if (inp->inp_vflag & INP_IPV6)
hashkey_faddr = inp->in6p_faddr.s6_addr32[3] /* XXX */;
else
-#endif /* INET6 */
+#endif
hashkey_faddr = inp->inp_faddr.s_addr;
 
pcbhash = &pcbinfo->ipi_hashbase[INP_PCBHASH(hashkey_faddr,
@@ -1958,7 +1958,7 @@ in_pcbrehash_mbuf(struct inpcb *inp, str
if (inp->inp_vflag & INP_IPV6)
hashkey_faddr = inp->in6p_faddr.s6_addr32[3] /* XXX */;
else
-#endif /* INET6 */
+#endif
hashkey_faddr = inp->inp_faddr.s_addr;
 
head = &pcbinfo->ipi_hashbase[INP_PCBHASH(hashkey_faddr,
@@ -2226,14 +2226,13 @@ db_print_inconninfo(struct in_conninfo *
/* IPv6. */
ip6_sprintf(laddr_str, &inc->inc6_laddr);
ip6_sprintf(faddr_str, &inc->inc6_faddr);
-   } else {
+   } else
 #endif
+   {
/* IPv4. */
inet_ntoa_r(inc->inc_laddr, laddr_str);
inet_ntoa_r(inc->inc_faddr, faddr_str);
-#ifdef INET6
}
-#endif
db_print_indent(indent);
db_printf("inc_laddr %s   inc_lport %u\n", laddr_str,
ntohs(inc->inc_lport));
@@ -2446,4 +2445,4 @@ DB_SHOW_COMMAND(inpcb, db_show_inpcb)
 
db_print_inpcb(inp, "inpcb", 0);
 }
-#endif
+#endif /* DDB */

Modified: head/sys/netinet/ip_ipsec.c
===

svn commit: r230443 - in head/sys: modules modules/ipdivert netinet

2012-01-21 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jan 22 02:16:31 2012
New Revision: 230443
URL: http://svn.freebsd.org/changeset/base/230443

Log:
  Fix ip_divert handling of inet and inet6 and module building some more.
  
  Properly sort the "carp" case in modules/Makefile after it was renamed.
  
  Reported by:  bde (most)
  Reviewed by:  bde
  MFC after:3 days

Modified:
  head/sys/modules/Makefile
  head/sys/modules/ipdivert/Makefile
  head/sys/netinet/ip_divert.c

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Sun Jan 22 02:13:19 2012(r230442)
+++ head/sys/modules/Makefile   Sun Jan 22 02:16:31 2012(r230443)
@@ -136,7 +136,7 @@ SUBDIR= ${_3dfx} \
${_igb} \
${_iir} \
${_io} \
-   ipdivert \
+   ${_ipdivert} \
${_ipfilter} \
${_ipfw} \
ipfw_nat \
@@ -370,20 +370,21 @@ _random=  random
 .endif
 .endif
 
-.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
-_if_gre=   if_gre
-.endif
-
 .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
defined(ALL_MODULES)
 _carp= carp
 .endif
 
+.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
+_if_gre=   if_gre
+.endif
+
 .if ${MK_IPFILTER} != "no" || defined(ALL_MODULES)
 _ipfilter= ipfilter
 .endif
 
 .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
+_ipdivert= ipdivert
 _ipfw= ipfw
 .endif
 

Modified: head/sys/modules/ipdivert/Makefile
==
--- head/sys/modules/ipdivert/Makefile  Sun Jan 22 02:13:19 2012
(r230442)
+++ head/sys/modules/ipdivert/Makefile  Sun Jan 22 02:16:31 2012
(r230443)
@@ -1,13 +1,21 @@
 # $FreeBSD$
 
+.include 
+
 .PATH: ${.CURDIR}/../../netinet
 
 KMOD=   ipdivert
-SRCS=   ip_divert.c opt_inet6.h
+SRCS=   ip_divert.c opt_inet.h opt_inet6.h
 
 .if !defined(KERNBUILDDIR)
+.if ${MK_INET_SUPPORT} != "no"
+opt_inet.h:
+   echo "#define INET 1" > ${.TARGET}
+.endif
+.if ${MK_INET6_SUPPORT} != "no"
 opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
 .endif
+.endif
 
 .include 

Modified: head/sys/netinet/ip_divert.c
==
--- head/sys/netinet/ip_divert.cSun Jan 22 02:13:19 2012
(r230442)
+++ head/sys/netinet/ip_divert.cSun Jan 22 02:16:31 2012
(r230443)
@@ -30,14 +30,12 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#if !defined(KLD_MODULE)
 #include "opt_inet.h"
+#include "opt_inet6.h"
 #include "opt_sctp.h"
 #ifndef INET
 #error "IPDIVERT requires INET."
 #endif
-#endif
-#include "opt_inet6.h"
 
 #include 
 #include 
___
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: r229800 - head/sys/conf

2012-01-21 Thread Adrian Chadd
Hi,

I'm sorry I got distracted by other things. I'll see about creating a kld
with all of this code in it and set the depedencies appropriately.


adrian
___
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: r230408 - head/sys/net80211

2012-01-21 Thread Adrian Chadd
On 20 January 2012 18:41, Rui Paulo  wrote:


> This commit doesn't help much and keeps us more toolchain dependent like
> Alexander pointed out in IRC. Since ether_sprintf() wasn't causing any
> trouble, please consider backing this out.
>
> This commit also introduces unnecessary changes which make reviewing
> harder.
>

Hi,

I'd like to eventually move away from doing it this way. The trouble is
using ether_sprintf() multiple times (and even from multiple threads?) in
the same debug statement results in non-useful behaviour.

What I'm likely going to do is introduce an ether_ssprintf() which takes a
char/len buffer to write into. That way the debug statements can just use
that (with appropriate wrappers around them to only call ether_ssprintf()
if the debug condition is met, otherwise unused sprintf()s will occur.

I'm open to other suggestions though!

Adrian
___
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: r230409 - head/sys/net80211

2012-01-21 Thread Adrian Chadd
On 20 January 2012 18:42, Rui Paulo  wrote:


> I tested this exact topology when I implemented HWMP, so I don't know what
> went wrong. The commit log doesn't say much about what was wrong and the
> code changes are, again, mixed with style changes so I haven't had time to
> fully appreciate these changes.
>

Right. I'm not sure about that either and I'm not yet on top of the
mesh/hwmp code. I plan on getting more familiar with it now that the
simulator is in the tree. I'm trusting monthadar here.



Adrian
___
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: r230444 - stable/9/sys/boot/pc98/libpc98

2012-01-21 Thread Takahashi Yoshihiro
Author: nyan
Date: Sun Jan 22 04:19:03 2012
New Revision: 230444
URL: http://svn.freebsd.org/changeset/base/230444

Log:
  MFC: revision 229463
  
MFi386: revision 229435
  
  Add special loader environment variables 'comconsole_port' and
  'comconsole_pcidev'.

Modified:
  stable/9/sys/boot/pc98/libpc98/comconsole.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/pc98/libpc98/comconsole.c
==
--- stable/9/sys/boot/pc98/libpc98/comconsole.c Sun Jan 22 02:16:31 2012
(r230443)
+++ stable/9/sys/boot/pc98/libpc98/comconsole.c Sun Jan 22 04:19:03 2012
(r230444)
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include "libi386.h"
 
 #define COMC_FMT   0x3 /* 8N1 */
@@ -49,14 +50,23 @@ static int  comc_init(int arg);
 static voidcomc_putchar(int c);
 static int comc_getchar(void);
 static int comc_getspeed(void);
+static voidset_hw_console_hint(void);
 static int comc_ischar(void);
-static int comc_parsespeed(const char *string);
-static voidcomc_setup(int speed);
+static int comc_parseint(const char *string);
+static uint32_t comc_parse_pcidev(const char *string);
+static int comc_pcidev_set(struct env_var *ev, int flags,
+   const void *value);
+static int comc_pcidev_handle(uint32_t locator);
+static int comc_port_set(struct env_var *ev, int flags,
+   const void *value);
+static voidcomc_setup(int speed, int port);
 static int comc_speed_set(struct env_var *ev, int flags,
const void *value);
 
 static int comc_started;
 static int comc_curspeed;
+static int comc_port = COMPORT;
+static uint32_tcomc_locator;
 
 struct console comconsole = {
 "comconsole",
@@ -72,9 +82,10 @@ struct console comconsole = {
 static void
 comc_probe(struct console *cp)
 {
-char speedbuf[16];
-char *cons, *speedenv;
-int speed;
+char intbuf[16];
+char *cons, *env;
+int speed, port;
+uint32_t locator;
 
 /* XXX check the BIOS equipment list? */
 cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
@@ -90,16 +101,40 @@ comc_probe(struct console *cp)
getenv("boot_multicons") != NULL) {
comc_curspeed = comc_getspeed();
}
-   speedenv = getenv("comconsole_speed");
-   if (speedenv != NULL) {
-   speed = comc_parsespeed(speedenv);
+
+   env = getenv("comconsole_speed");
+   if (env != NULL) {
+   speed = comc_parseint(env);
if (speed > 0)
comc_curspeed = speed;
}
 
-   sprintf(speedbuf, "%d", comc_curspeed);
+   sprintf(intbuf, "%d", comc_curspeed);
unsetenv("comconsole_speed");
-   env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set,
+   env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set,
+   env_nounset);
+
+   env = getenv("comconsole_port");
+   if (env != NULL) {
+   port = comc_parseint(env);
+   if (port > 0)
+   comc_port = port;
+   }
+
+   sprintf(intbuf, "%d", comc_port);
+   unsetenv("comconsole_port");
+   env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set,
+   env_nounset);
+
+   env = getenv("comconsole_pcidev");
+   if (env != NULL) {
+   locator = comc_parse_pcidev(env);
+   if (locator != 0)
+   comc_pcidev_handle(locator);
+   }
+
+   unsetenv("comconsole_pcidev");
+   env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set,
env_nounset);
 }
 }
@@ -111,7 +146,7 @@ comc_init(int arg)
return 0;
 comc_started = 1;
 
-comc_setup(comc_curspeed);
+comc_setup(comc_curspeed, comc_port);
 
 return(0);
 }
@@ -122,8 +157,8 @@ comc_putchar(int c)
 int wait;
 
 for (wait = COMC_TXWAIT; wait > 0; wait--)
-if (inb(COMPORT + com_lsr) & LSR_TXRDY) {
-   outb(COMPORT + com_data, (u_char)c);
+if (inb(comc_port + com_lsr) & LSR_TXRDY) {
+   outb(comc_port + com_data, (u_char)c);
break;
}
 }
@@ -131,13 +166,13 @@ comc_putchar(int c)
 static int
 comc_getchar(void)
 {
-return(comc_ischar() ? inb(COMPORT + com_data) : -1);
+return(comc_ischar() ? inb(comc_port + com_data) : -1);
 }
 
 static int
 comc_ischar(void)
 {
-return(inb(COMPORT + com_lsr) & LSR_RXRDY);
+return(inb(comc_port + com_lsr) & LSR_RXRDY);
 }
 
 static int
@@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int f
 {
 int speed;
 
-if (value == NULL || (speed = comc_parsespeed(value)) <= 0) {
+if (value == NULL || (speed = comc_parseint(value)) <= 0) {
printf("Invalid speed\n");
return (CMD_ERROR);
 }
 
 if (comc_started && comc_curspeed != 

svn commit: r230445 - in head/tools/tools/wtap: . vis_map

2012-01-21 Thread Adrian Chadd
Author: adrian
Date: Sun Jan 22 04:51:00 2012
New Revision: 230445
URL: http://svn.freebsd.org/changeset/base/230445

Log:
  Bring over the visibility control tool for Monthadar's wtap project.
  
  This allows basic control over which wtap nodes can see which other
  wtap nodes.

Added:
  head/tools/tools/wtap/Makefile   (contents, props changed)
  head/tools/tools/wtap/vis_map/
  head/tools/tools/wtap/vis_map/Makefile   (contents, props changed)
  head/tools/tools/wtap/vis_map/vis_map.c   (contents, props changed)

Added: head/tools/tools/wtap/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/wtap/Makefile  Sun Jan 22 04:51:00 2012
(r230445)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SUBDIR=wtap vis_map
+
+.include 

Added: head/tools/tools/wtap/vis_map/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/wtap/vis_map/Makefile  Sun Jan 22 04:51:00 2012
(r230445)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+PROG=  vis_map
+SRC=   vis_map.c
+NO_MAN=1
+
+CFLAGS+=   -I${.CURDIR}/../../../../sys/dev/wtap/
+
+.include 

Added: head/tools/tools/wtap/vis_map/vis_map.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/wtap/vis_map/vis_map.c Sun Jan 22 04:51:00 2012
(r230445)
@@ -0,0 +1,117 @@
+/*-
+ * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * From the driver itself
+ */
+#include 
+
+static int dev = -1;
+
+static void
+toggle_medium(int op)
+{
+   if (ioctl(dev, VISIOCTLOPEN, &op) < 0) {
+   printf("error opening/closing medium\n");
+   }
+}
+
+static void
+link_op(struct link *l)
+{
+   if (ioctl(dev, VISIOCTLLINK, l) < 0) {
+   printf("error making a link operation\n");
+   }
+}
+
+static void
+usage(const char *argv[])
+{
+   printf("usage: %s [o | c | [ [a|d]  wtap_id1  wtap_id2]]\n",
+   argv[0]);
+}
+
+int
+main(int argc, const char* argv[])
+{
+   struct link l;
+   char cmd;
+
+   if (argc < 2) {
+   usage(argv);
+   exit(1);
+   }
+
+   dev = open("/dev/visctl", O_RDONLY);
+   if (dev < 0) {
+   printf("error opening visctl cdev\n");
+   exit(1);
+   }
+
+   cmd = (char)*argv[1];
+
+   switch (cmd) {
+   case 'o':
+   toggle_medium(1);
+   break;
+   case 'c':
+   toggle_medium(0);
+   break;
+   case 'a':
+   if (argc < 4) {
+   usage(argv);
+   exit(1);
+   }
+   l.op = 1;
+   l.id1 = atoi(argv[2]);
+   l.id2 = atoi(argv[3]);
+   link_op(&l);
+   break;
+   case 'd':
+   if (argc < 4) {
+   usage(argv);
+   exit(1);
+   }
+   l.op = 0;
+   l.id1 = atoi(argv[2]);
+   l.id2 = atoi(argv[3]);
+   link_op(&l);
+   break;
+   default:
+   printf("wtap ioctl: unkown command '%c'\n", *argv[1]);
+   exit

svn commit: r230446 - in stable/9/sys/fs: nfs nfsclient

2012-01-21 Thread Rick Macklem
Author: rmacklem
Date: Sun Jan 22 05:16:31 2012
New Revision: 230446
URL: http://svn.freebsd.org/changeset/base/230446

Log:
  MFC: r229802
  opt_inet6.h was missing from some files in the new NFS subsystem.
  The effect of this was, for clients mounted via inet6 addresses,
  that the DRC cache would never have a hit in the server. It also
  broke NFSv4 callbacks when an inet6 address was the only one available
  in the client. This patch fixes the above, plus deletes opt_inet6.h
  from a couple of files it is not needed for.

Modified:
  stable/9/sys/fs/nfs/nfs_commonkrpc.c
  stable/9/sys/fs/nfs/nfs_commonsubs.c
  stable/9/sys/fs/nfsclient/nfs_clkrpc.c
  stable/9/sys/fs/nfsclient/nfs_clport.c
  stable/9/sys/fs/nfsclient/nfs_clrpcops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c
==
--- stable/9/sys/fs/nfs/nfs_commonkrpc.cSun Jan 22 04:51:00 2012
(r230445)
+++ stable/9/sys/fs/nfs/nfs_commonkrpc.cSun Jan 22 05:16:31 2012
(r230446)
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
  * Socket operations for use by nfs
  */
 
-#include "opt_inet6.h"
 #include "opt_kdtrace.h"
 #include "opt_kgssapi.h"
 #include "opt_nfs.h"

Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/9/sys/fs/nfs/nfs_commonsubs.cSun Jan 22 04:51:00 2012
(r230445)
+++ stable/9/sys/fs/nfs/nfs_commonsubs.cSun Jan 22 05:16:31 2012
(r230446)
@@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$");
  * copy data between mbuf chains and uio lists.
  */
 #ifndef APPLEKEXT
+#include "opt_inet6.h"
+
 #include 
 
 /*

Modified: stable/9/sys/fs/nfsclient/nfs_clkrpc.c
==
--- stable/9/sys/fs/nfsclient/nfs_clkrpc.c  Sun Jan 22 04:51:00 2012
(r230445)
+++ stable/9/sys/fs/nfsclient/nfs_clkrpc.c  Sun Jan 22 05:16:31 2012
(r230446)
@@ -34,7 +34,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "opt_inet6.h"
 #include "opt_kgssapi.h"
 
 #include 

Modified: stable/9/sys/fs/nfsclient/nfs_clport.c
==
--- stable/9/sys/fs/nfsclient/nfs_clport.c  Sun Jan 22 04:51:00 2012
(r230445)
+++ stable/9/sys/fs/nfsclient/nfs_clport.c  Sun Jan 22 05:16:31 2012
(r230446)
@@ -34,6 +34,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet6.h"
 #include "opt_kdtrace.h"
 
 #include 

Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c
==
--- stable/9/sys/fs/nfsclient/nfs_clrpcops.cSun Jan 22 04:51:00 2012
(r230445)
+++ stable/9/sys/fs/nfsclient/nfs_clrpcops.cSun Jan 22 05:16:31 2012
(r230446)
@@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$");
  */
 
 #ifndef APPLEKEXT
+#include "opt_inet6.h"
+
 #include 
 
 /*
___
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: r230447 - head/sys/net80211

2012-01-21 Thread Adrian Chadd
Author: adrian
Date: Sun Jan 22 05:30:29 2012
New Revision: 230447
URL: http://svn.freebsd.org/changeset/base/230447

Log:
  Mark the taskqueue as the _net80211_ taskqueue.
  
  This makes it much easier to determine whether an event occurs in the
  net80211 taskqueue (which was called "ath0 taskq") or the ath driver
  taskqueue (which is also called "ath0 taskq".)

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Sun Jan 22 05:16:31 2012
(r230446)
+++ head/sys/net80211/ieee80211.c   Sun Jan 22 05:30:29 2012
(r230447)
@@ -276,7 +276,7 @@ ieee80211_ifattach(struct ieee80211com *
/* Create a taskqueue for all state changes */
ic->ic_tq = taskqueue_create("ic_taskq", M_WAITOK | M_ZERO,
taskqueue_thread_enqueue, &ic->ic_tq);
-   taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s taskq",
+   taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s net80211 taskq",
ifp->if_xname);
/*
 * Fill in 802.11 available channel set, mark all
___
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: r230448 - in stable/8/sys/fs: nfs nfsclient

2012-01-21 Thread Rick Macklem
Author: rmacklem
Date: Sun Jan 22 06:00:50 2012
New Revision: 230448
URL: http://svn.freebsd.org/changeset/base/230448

Log:
  MFC: r229802
  opt_inet6.h was missing from some files in the new NFS subsystem.
  The effect of this was, for clients mounted via inet6 addresses,
  that the DRC cache would never have a hit in the server. It also
  broke NFSv4 callbacks when an inet6 address was the only one available
  in the client. This patch fixes the above, plus deletes opt_inet6.h
  from a couple of files it is not needed for.

Modified:
  stable/8/sys/fs/nfs/nfs_commonkrpc.c
  stable/8/sys/fs/nfs/nfs_commonsubs.c
  stable/8/sys/fs/nfsclient/nfs_clkrpc.c
  stable/8/sys/fs/nfsclient/nfs_clport.c
  stable/8/sys/fs/nfsclient/nfs_clrpcops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c
==
--- stable/8/sys/fs/nfs/nfs_commonkrpc.cSun Jan 22 05:30:29 2012
(r230447)
+++ stable/8/sys/fs/nfs/nfs_commonkrpc.cSun Jan 22 06:00:50 2012
(r230448)
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
  * Socket operations for use by nfs
  */
 
-#include "opt_inet6.h"
 #include "opt_kgssapi.h"
 #include "opt_nfs.h"
 

Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/8/sys/fs/nfs/nfs_commonsubs.cSun Jan 22 05:30:29 2012
(r230447)
+++ stable/8/sys/fs/nfs/nfs_commonsubs.cSun Jan 22 06:00:50 2012
(r230448)
@@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$");
  * copy data between mbuf chains and uio lists.
  */
 #ifndef APPLEKEXT
+#include "opt_inet6.h"
+
 #include 
 
 /*

Modified: stable/8/sys/fs/nfsclient/nfs_clkrpc.c
==
--- stable/8/sys/fs/nfsclient/nfs_clkrpc.c  Sun Jan 22 05:30:29 2012
(r230447)
+++ stable/8/sys/fs/nfsclient/nfs_clkrpc.c  Sun Jan 22 06:00:50 2012
(r230448)
@@ -34,7 +34,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "opt_inet6.h"
 #include "opt_kgssapi.h"
 
 #include 

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==
--- stable/8/sys/fs/nfsclient/nfs_clport.c  Sun Jan 22 05:30:29 2012
(r230447)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c  Sun Jan 22 06:00:50 2012
(r230448)
@@ -34,6 +34,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet6.h"
+
 /*
  * generally, I don't like #includes inside .h files, but it seems to
  * be the easiest way to handle the port.

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.cSun Jan 22 05:30:29 2012
(r230447)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.cSun Jan 22 06:00:50 2012
(r230448)
@@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$");
  */
 
 #ifndef APPLEKEXT
+#include "opt_inet6.h"
+
 #include 
 
 /*
___
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"