Re: svn commit: r238755 - head/sys/x86/x86

2012-07-26 Thread Bruce Evans

On Wed, 25 Jul 2012, Jung-uk Kim wrote:


On 2012-07-25 14:05:37 -0400, Konstantin Belousov wrote:

Since we have gettimeofday() in userland, the above Linux thread
is more relevant now, I guess.


Indeed.  syscalls put squillions of instructions between.  Maybe even
a serialization instruction.


For some unrelated reasons, we do have lfence;rdtsc sequence in
the userland already. Well, it is not exactly such sequence, there
are some instructions between, but the main fact is that two
consequtive invocations of gettimeofday(2) (*) or clock_gettime(2)
are interleaved with lfence on Intels, guaranteeing that backstep
of the counter is impossible.


In fact, there is always a full documented serialization instruction
for syscalls, except maybe in FreeBSD-1 compat code on i386, at
least on Athlon64.  i386 syscalls use int 0x80 (except in FreeBSD-1
compat code they use lcalls, and the iret necessary to return from
this is serializing on at least Athlon64.  amd64 syscalls use
sysenter/sysret.  sysret isn't serializing (like far returns), at least
on Athlon64, but at least in FreeBSD, the syscall implementation uses
at least 2 swapgs's (one on entry and one just before the sysret), and
swapgs is serializing, at least on Athlon64.


* - it is not a syscall anymore.

As I said, using recommended mfence;rdtsc sequence for AMDs would
require some work, but lets handle the kernel and userspace issues
separately.


Benchmarks for various methods on AthlonXP: I started with a program
that loops making a fe million clock_gettime() calls:

unchanged program: 1.15 seconds
add lfence:1.16 seconds
add mfence:1.15 seconds (yes, faster than mfence)
add atomic_cmpset: 1.20 seconds
add cpuid: 1.25 seconds


And, I really failed to find what the patch from the thread you
referenced tried to fix.


The patch was supposed to reduce a barrier, i.e., vsyscall
optimization.  Please note I brought it up at the time, not because it
fixed any problem but because we completely lack necessary serialization.


Was it really committed into Linux ?


Yes, it was committed in a simpler form:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=057e6a8c660e95c3f4e7162e00e2fee1fc90c50d

This function was moved around from time to time and now it sits here:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=arch/x86/vdso/vclock_gettime.c

It still carries one barrier before rdtsc.  Please see the comments.


For safety, you probably need to use the slowest (cpuid) method.  Linux
seems to be just using fences that are observed to work.

Original Athlon64 manuals say this about rdtsc: "... not serializing...
even when bound by serializing instructions, the system environment at
the time the instruction is executed can cause additional cycles
[before it reaches EDX:EAX]".

With multiple CPUs, the hardware would have to be smarter and might need
more or different serialization instructions so that these additional
cycles don't break monotonicity across all CPUs.


I see actual problem of us allowing timecounters going back, and a
solution that exactly follows words of both Intel and AMD
documentation. This is good one step forward IMHO.


I agree with you here.  Correctness outweighs performance, IMHO.


Use an i8254 then :-).

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


svn commit: r238788 - head/sys/arm/at91

2012-07-26 Thread Andrew Turner
Author: andrew
Date: Thu Jul 26 08:01:25 2012
New Revision: 238788
URL: http://svn.freebsd.org/changeset/base/238788

Log:
  Add support for the Atmel AT91SAM9G45 CPU.
  
  Reviewed by:  imp

Added:
  head/sys/arm/at91/at91_pio_sam9g45.h   (contents, props changed)
  head/sys/arm/at91/at91sam9g45.c   (contents, props changed)
  head/sys/arm/at91/at91sam9g45reg.h   (contents, props changed)
  head/sys/arm/at91/std.at91sam9g45   (contents, props changed)
Modified:
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/at91/at91_pmc.c
  head/sys/arm/at91/at91_pmcreg.h
  head/sys/arm/at91/files.at91

Modified: head/sys/arm/at91/at91_machdep.c
==
--- head/sys/arm/at91/at91_machdep.cThu Jul 26 05:46:56 2012
(r238787)
+++ head/sys/arm/at91/at91_machdep.cThu Jul 26 08:01:25 2012
(r238788)
@@ -94,6 +94,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 /* Page table for mapping proc0 zero page */
 #define KERNEL_PT_SYS  0
@@ -201,6 +202,17 @@ const struct pmap_devmap at91_devmap[] =
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
+   /*
+* The next should be good for the 9G45.
+*/
+   {
+   /* Internal Memory 1MB  */
+   AT91SAM9G45_OHCI_BASE,
+   AT91SAM9G45_OHCI_PA_BASE,
+   0x0010,
+   VM_PROT_READ|VM_PROT_WRITE,
+   PTE_NOCACHE,
+   },
{ 0, 0, 0, 0, 0, }
 };
 
@@ -213,7 +225,7 @@ extern int memsize[];
 long
 at91_ramsize(void)
 {
-   uint32_t cr, mr, *SDRAMC;
+   uint32_t cr, mdr, mr, *SDRAMC;
int banks, rows, cols, bw;
 #ifdef LINUX_BOOT_ABI
/*
@@ -231,6 +243,24 @@ at91_ramsize(void)
rows = ((cr & AT91RM92_SDRAMC_CR_NR_MASK) >> 2) + 11;
cols = (cr & AT91RM92_SDRAMC_CR_NC_MASK) + 8;
bw = (mr & AT91RM92_SDRAMC_MR_DBW_16) ? 1 : 2;
+   } else if (at91_cpu_is(AT91_T_SAM9G45)) {
+   SDRAMC = (uint32_t *)(AT91_BASE + AT91SAM9G45_DDRSDRC0_BASE);
+   cr = SDRAMC[AT91SAM9G45_DDRSDRC_CR / 4];
+   mdr = SDRAMC[AT91SAM9G45_DDRSDRC_MDR / 4];
+   banks = 0;
+   rows = ((cr & AT91SAM9G45_DDRSDRC_CR_NR_MASK) >> 2) + 11;
+   cols = (cr & AT91SAM9G45_DDRSDRC_CR_NC_MASK) + 8;
+   bw = (mdr & AT91SAM9G45_DDRSDRC_MDR_DBW_16) ? 1 : 2;
+
+   /* Fix the calculation for DDR memory */
+   mdr &= AT91SAM9G45_DDRSDRC_MDR_MASK;
+   if (mdr & AT91SAM9G45_DDRSDRC_MDR_LPDDR1 ||
+   mdr & AT91SAM9G45_DDRSDRC_MDR_DDR2) {
+   /* The cols value is 1 higher for DDR */
+   cols += 1;
+   /* DDR has 4 internal banks. */
+   banks = 2;
+   }
} else {
/*
 * This should be good for the 9260, 9261, 9G20, 9G35 and 9X25

Added: head/sys/arm/at91/at91_pio_sam9g45.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/at91/at91_pio_sam9g45.hThu Jul 26 08:01:25 2012
(r238788)
@@ -0,0 +1,272 @@
+/*-
+ *  

+ *  ATMEL Microcontroller Software Support  -  ROUSSET  -
+ *  

+ *  Copyright (c) 2009, Atmel Corporation
+ * 
+ *  All rights reserved.
+ * 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ * 
+ *  - Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the disclaimer below.
+ * 
+ *  Atmel's name may not be used to endorse or promote products derived from
+ *  this software without specific prior written permission. 
+ *  
+ *  DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
OF
+ *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ *  DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ *  

+ *
+ * From AT91LIB version 1.9 boards/at91s

Re: svn commit: r238755 - head/sys/x86/x86

2012-07-26 Thread Bruce Evans

On Wed, 25 Jul 2012, Konstantin Belousov wrote:


On Thu, Jul 26, 2012 at 12:15:54AM +1000, Bruce Evans wrote:

On Wed, 25 Jul 2012, Konstantin Belousov wrote:
...
Most uses in FreeBSD are for timecounters.  Timecounters deliver the
current time.  This is unrelated to whatever instructions haven't
completed when the TSC is read.  Except possibly when the time needs
to be synchronized across CPUs, and when the uncompleted instruction
is a TSC read.


For tsc test, this means that after the change RDTSC executions are not
reordered on the single core among themself. As I understand, CPU has
no dependency noted between two reads of tsc by RDTSC, which allows
later read to give lower value of counter.


Gak.  Even when they are in the same instruction sequence?  Even though
the TSC reads fixed registers and some other instructions in the sequence
between the TSC use these registers?  The CPU would have to do significant
register renaming to break this.

As I could only speculate, I believe that any modern CPU executes RDTSC
as at least two separate steps, one is read from internal counter, and
second is the registers update. It seems that the first kind of action
is not serialized. I have no other explanation for the Jim findings.


In a reply to your later mail (made earlier), I quoted the Athlon64
manual documenting this problem (everything except exactly where the
serialization is applied).  The delay is similar to what happens in
software if the thread is preempted between reading the hardware time
and using the result.  It doesn't help to serializing the read and
the use without serializing everything between, which costs more.
Most uses don't care about the delay (else they need more than
serialization to limit it).  But if we care then we might have to
use a slow new instruction like rdtscp to tell the hardware to care,
or add slow locking to uses of the result in software (needs more
than critical_enter() to stop fast interrupt handlers.  BTW,
binuptime() is supposed to work in fast interrupt handlers.  This
is fragile but useful).


{

+   rmb();
return (rdtsc32());
}


Please don't pessimize this further.  The time for rdtsc went from 6.5
cycles on AthlonXP to 65 cycles on core2 (mainly for for
P-state-invariance hardware synchronization I think).  Pretty soon it
will be as slow as an HPET and heading towards an i8254.  Adding rmb()
only makes it 12 cycles slower on core2, but 16 cycles (almost 3 times)
slower on AthlonXP.

AthlonXP does not look as interesting target for optimizations. Fom what I
can find this is PIII-era CPU.


Since CPUs hit the frequency wall just after AthlonXP, it is almost
as fast as a single modern CPU.  Much faster than a modern CPU for rdtsc,
and already optimized.  Probably much faster than a PIII for systemy
things like rdtsc.

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


svn commit: r238789 - in head/sys/arm: at91 conf

2012-07-26 Thread Andrew Turner
Author: andrew
Date: Thu Jul 26 08:05:28 2012
New Revision: 238789
URL: http://svn.freebsd.org/changeset/base/238789

Log:
  Add support for the DesignA Electronics Snapper9g45 System on Module.
  
  Reviewed by:  imp

Added:
  head/sys/arm/at91/board_sn9g45.c   (contents, props changed)
  head/sys/arm/at91/std.sn9g45   (contents, props changed)
  head/sys/arm/conf/SN9G45   (contents, props changed)
Modified:
  head/sys/arm/at91/files.at91

Added: head/sys/arm/at91/board_sn9g45.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/at91/board_sn9g45.cThu Jul 26 08:05:28 2012
(r238789)
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 2009 Greg Ansley.  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 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 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.
+ */
+
+/*
+ * DesignA Electronics Snapper9g45
+ * http://www.designa-electronics.com/
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+long
+board_init(void)
+{
+
+   /* PIOB's A periph: Turn the debug USART's TX/RX pins */
+   at91_pio_use_periph_a(AT91SAM9G45_PIOB_BASE, AT91C_PB12_DRXD, 0);
+   at91_pio_use_periph_a(AT91SAM9G45_PIOB_BASE, AT91C_PB13_DTXD, 1);
+
+   return (at91_ramsize());
+}
+
+ARM_BOARD(SNAPPER9G45, "DesignA Electronics Snapper9G45");

Modified: head/sys/arm/at91/files.at91
==
--- head/sys/arm/at91/files.at91Thu Jul 26 08:01:25 2012
(r238788)
+++ head/sys/arm/at91/files.at91Thu Jul 26 08:05:28 2012
(r238789)
@@ -46,4 +46,5 @@ arm/at91/board_qila9g20.c optionalat91_
 arm/at91/board_sam9260ek.c optionalat91_board_sam9260ek
 arm/at91/board_sam9g20ek.c optionalat91_board_sam9g20ek
 arm/at91/board_sam9x25ek.c optionalat91_board_sam9x25ek
+arm/at91/board_sn9g45.coptionalat91_board_sn9g45
 arm/at91/board_tsc4370.c   optionalat91_board_tsc4370

Added: head/sys/arm/at91/std.sn9g45
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/at91/std.sn9g45Thu Jul 26 08:05:28 2012
(r238789)
@@ -0,0 +1,12 @@
+#$FreeBSD$
+include "../at91/std.at91sam9g45"
+
+optionsSTARTUP_PAGETABLE_ADDR=0x7080
+makeoptionsKERNPHYSADDR=0x70008000
+optionsKERNPHYSADDR=0x70008000 
+makeoptionsKERNVIRTADDR=0xc0008000
+optionsKERNVIRTADDR=0xc0008000
+
+device at91sam9g45
+device at91_board_sn9g45
+

Added: head/sys/arm/conf/SN9G45
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/conf/SN9G45Thu Jul 26 08:05:28 2012(r238789)
@@ -0,0 +1,130 @@
+# Kernel configuration for DesignA Electronics Snapper9G45 System on Module
+#
+# For more information on this file, please read the handbook section on
+# Kernel Configuration Files:
+#
+#
http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, chec

svn commit: r238790 - head/sys/netinet

2012-07-26 Thread Michael Tuexen
Author: tuexen
Date: Thu Jul 26 08:10:29 2012
New Revision: 238790
URL: http://svn.freebsd.org/changeset/base/238790

Log:
  Fix the sctp_sockstore union such that userland programs don't depend
  on INET and/or INET6 to be defined and in-tune with how the kernel
  was compiled.
  
  MFC after:3 days
  Discussed with:   rrs

Modified:
  head/sys/netinet/sctp_uio.h

Modified: head/sys/netinet/sctp_uio.h
==
--- head/sys/netinet/sctp_uio.h Thu Jul 26 08:05:28 2012(r238789)
+++ head/sys/netinet/sctp_uio.h Thu Jul 26 08:10:29 2012(r238790)
@@ -1124,12 +1124,8 @@ struct sctpstat {
 #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
 
 union sctp_sockstore {
-#if defined(INET)
struct sockaddr_in sin;
-#endif
-#if defined(INET6)
struct sockaddr_in6 sin6;
-#endif
struct sockaddr sa;
 };
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238563 - head/gnu/usr.bin/groff/tmac

2012-07-26 Thread Ruslan Ermilov
On Wed, Jul 18, 2012 at 05:57:43AM +, David E. O'Brien wrote:
> Author: obrien
> Date: Wed Jul 18 05:57:42 2012
> New Revision: 238563
> URL: http://svn.freebsd.org/changeset/base/238563
> 
> Log:
>   a ";" tells make we want the shell to be used
>   
>   Submitted by:   Simon Gerraty 
> 
> Modified:
>   head/gnu/usr.bin/groff/tmac/Makefile

I don't quite understand what this change does, could you elaborate?

Without -jN (in backwards compatibility mode), the "cd" is a no-op
(whether it's terminated by `;' or not) because make will execute a
single shell per command, with cwd set to ${.OBJDIR}.

With -jN, "cd" becomes necessary because all commands are executed as
a script by one shell (the reason it was added in the first place),
but adding `;' is a no-op because commands are on separate lines.

> Modified: head/gnu/usr.bin/groff/tmac/Makefile
> ==
> --- head/gnu/usr.bin/groff/tmac/Makefile  Wed Jul 18 05:50:40 2012
> (r238562)
> +++ head/gnu/usr.bin/groff/tmac/Makefile  Wed Jul 18 05:57:42 2012
> (r238563)
> @@ -68,7 +68,7 @@ beforeinstall:
>   cd ${.CURDIR}; \
>   ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
>   koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR}
> - cd ${.OBJDIR}
> + cd ${.OBJDIR};
>  .for f in ${STRIPFILES} ${SPECIALFILES}
>   ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
>   $f-s ${DESTDIR}${TMACDIR}/$f
> 

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


svn commit: r238791 - head/sys/vm

2012-07-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 26 09:06:48 2012
New Revision: 238791
URL: http://svn.freebsd.org/changeset/base/238791

Log:
  Do not requeue held page or page for which locking failed, just leave
  them alone.
  
  Process the act_count updates for the held pages in the vm_pageout
  loop over the inactive queue, instead of refusing to do anything with
  such page.
  
  Clarify the intent of the addl_page_shortage counter and change its
  use for pages which are not processed in the loop according to the
  description.
  
  Reviewed by:  alc
  MFC after:2 weeks

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cThu Jul 26 08:10:29 2012(r238790)
+++ head/sys/vm/vm_pageout.cThu Jul 26 09:06:48 2012(r238791)
@@ -889,6 +889,12 @@ vm_pageout_scan(int pass)
 */
uma_reclaim();
 
+   /*
+* The addl_page_shortage is the the number of temporarily
+* stuck pages in the inactive queue.  In other words, the
+* number of pages from cnt.v_inactive_count that should be
+* discounted in setting the target for the active queue scan.
+*/
addl_page_shortage = atomic_readandclear_int(&vm_pageout_deficit);
 
/*
@@ -945,38 +951,31 @@ vm_pageout_scan(int pass)
("Unmanaged page %p cannot be in inactive queue", m));
 
/*
-* Lock the page.
+* The page or object lock acquisitions fail if the
+* page was removed from the queue or moved to a
+* different position within the queue.  In either
+* case, addl_page_shortage should not be incremented.
 */
if (!vm_pageout_page_lock(m, &next)) {
vm_page_unlock(m);
-   addl_page_shortage++;
continue;
}
-
-   /*
-* A held page may be undergoing I/O, so skip it.
-*/
-   if (m->hold_count) {
+   object = m->object;
+   if (!VM_OBJECT_TRYLOCK(object) &&
+   !vm_pageout_fallback_object_lock(m, &next)) {
vm_page_unlock(m);
-   vm_page_requeue(m);
-   addl_page_shortage++;
+   VM_OBJECT_UNLOCK(object);
continue;
}
 
/*
-* Don't mess with busy pages, keep in the front of the
-* queue, most likely are being paged out.
+* Don't mess with busy pages, keep them at at the
+* front of the queue, most likely they are being
+* paged out.  Increment addl_page_shortage for busy
+* pages, because they may leave the inactive queue
+* shortly after page scan is finished.
 */
-   object = m->object;
-   if (!VM_OBJECT_TRYLOCK(object) &&
-   (!vm_pageout_fallback_object_lock(m, &next) ||
-   m->hold_count != 0)) {
-   VM_OBJECT_UNLOCK(object);
-   vm_page_unlock(m);
-   addl_page_shortage++;
-   continue;
-   }
-   if (m->busy || (m->oflags & VPO_BUSY)) {
+   if (m->busy != 0 || (m->oflags & VPO_BUSY) != 0) {
vm_page_unlock(m);
VM_OBJECT_UNLOCK(object);
addl_page_shortage++;
@@ -1036,6 +1035,21 @@ vm_pageout_scan(int pass)
goto relock_queues;
}
 
+   if (m->hold_count != 0) {
+   vm_page_unlock(m);
+   VM_OBJECT_UNLOCK(object);
+
+   /*
+* Held pages are essentially stuck in the
+* queue.  So, they ought to be discounted
+* from cnt.v_inactive_count.  See the
+* calculation of the page_shortage for the
+* loop over the active queue below.
+*/
+   addl_page_shortage++;
+   goto relock_queues;
+   }
+
/*
 * If the upper level VM system does not believe that the page
 * is fully dirty, but it is mapped for write access, then we
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238792 - in head/sys/i386: i386 include isa

2012-07-26 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 26 09:11:37 2012
New Revision: 238792
URL: http://svn.freebsd.org/changeset/base/238792

Log:
  MFamd64 r238623:
  Introduce curpcb magic variable.
  
  Requested and reviewed by:bde
  MFC after:3 weeks

Modified:
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/i386/trap.c
  head/sys/i386/i386/vm86.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/include/pcpu.h
  head/sys/i386/isa/npx.c

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cThu Jul 26 09:06:48 2012
(r238791)
+++ head/sys/i386/i386/machdep.cThu Jul 26 09:11:37 2012
(r238792)
@@ -1606,7 +1606,7 @@ exec_setregs(struct thread *td, struct i
 pcb->pcb_dr3 = 0;
 pcb->pcb_dr6 = 0;
 pcb->pcb_dr7 = 0;
-if (pcb == PCPU_GET(curpcb)) {
+if (pcb == curpcb) {
/*
 * Clear the debug registers on the running
 * CPU, otherwise they will end up affecting

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu Jul 26 09:06:48 2012(r238791)
+++ head/sys/i386/i386/pmap.c   Thu Jul 26 09:11:37 2012(r238792)
@@ -1962,7 +1962,7 @@ pmap_lazyfix_action(void)
(*ipi_lazypmap_counts[PCPU_GET(cpuid)])++;
 #endif
if (rcr3() == lazyptd)
-   load_cr3(PCPU_GET(curpcb)->pcb_cr3);
+   load_cr3(curpcb->pcb_cr3);
CPU_CLR_ATOMIC(PCPU_GET(cpuid), lazymask);
atomic_store_rel_int(&lazywait, 1);
 }
@@ -1972,7 +1972,7 @@ pmap_lazyfix_self(u_int cpuid)
 {
 
if (rcr3() == lazyptd)
-   load_cr3(PCPU_GET(curpcb)->pcb_cr3);
+   load_cr3(curpcb->pcb_cr3);
CPU_CLR_ATOMIC(cpuid, lazymask);
 }
 
@@ -2039,7 +2039,7 @@ pmap_lazyfix(pmap_t pmap)
 
cr3 = vtophys(pmap->pm_pdir);
if (cr3 == rcr3()) {
-   load_cr3(PCPU_GET(curpcb)->pcb_cr3);
+   load_cr3(curpcb->pcb_cr3);
CPU_CLR(PCPU_GET(cpuid), &pmap->pm_active);
}
 }

Modified: head/sys/i386/i386/trap.c
==
--- head/sys/i386/i386/trap.c   Thu Jul 26 09:06:48 2012(r238791)
+++ head/sys/i386/i386/trap.c   Thu Jul 26 09:11:37 2012(r238792)
@@ -344,7 +344,7 @@ trap(struct trapframe *frame)
 
 if ((ISPL(frame->tf_cs) == SEL_UPL) ||
((frame->tf_eflags & PSL_VM) && 
-   !(PCPU_GET(curpcb)->pcb_flags & PCB_VM86CALL))) {
+   !(curpcb->pcb_flags & PCB_VM86CALL))) {
/* user trap */
 
td->td_pticks = 0;
@@ -593,7 +593,7 @@ trap(struct trapframe *frame)
/* FALL THROUGH */
 
case T_SEGNPFLT:/* segment not present fault */
-   if (PCPU_GET(curpcb)->pcb_flags & PCB_VM86CALL)
+   if (curpcb->pcb_flags & PCB_VM86CALL)
break;
 
/*
@@ -606,7 +606,7 @@ trap(struct trapframe *frame)
 * a signal.
 */
if (frame->tf_eip == (int)cpu_switch_load_gs) {
-   PCPU_GET(curpcb)->pcb_gs = 0;
+   curpcb->pcb_gs = 0;
 #if 0  
PROC_LOCK(p);
kern_psignal(p, SIGBUS);
@@ -644,9 +644,9 @@ trap(struct trapframe *frame)
frame->tf_eip = (int)doreti_popl_fs_fault;
goto out;
}
-   if (PCPU_GET(curpcb)->pcb_onfault != NULL) {
+   if (curpcb->pcb_onfault != NULL) {
frame->tf_eip =
-   (int)PCPU_GET(curpcb)->pcb_onfault;
+   (int)curpcb->pcb_onfault;
goto out;
}
break;
@@ -696,7 +696,7 @@ trap(struct trapframe *frame)
 * debugging the kernel.
 */
if (user_dbreg_trap() && 
-  !(PCPU_GET(curpcb)->pcb_flags & PCB_VM86CALL)) {
+  !(curpcb->pcb_flags & PCB_VM86CALL)) {
/*
 * Reset breakpoint bits because the
 * processor doesn't
@@ -877,7 +877,7 @@ trap_pfault(frame, usermode, eva)
 * it normally, and panic immediately.
 */
if (!usermode && (td->td_intr_nesting_level != 0 ||
-   PCPU_GET(curpcb)->pcb_onfaul

svn commit: r238795 - in head/sys/boot: ficl zfs

2012-07-26 Thread Andrey A. Chernov
Author: ache
Date: Thu Jul 26 10:10:54 2012
New Revision: 238795
URL: http://svn.freebsd.org/changeset/base/238795

Log:
  Try to avoid all files dependence on the modification time of the large and
  often modified directory created symbolic links points to - it cause
  unnecessary full rebuilds each time make runs when directory is changed.
  So do it only if symbolic link does not exists, which usually means that
  objdir is clean anyway.
  
  MFC after:  1 week

Modified:
  head/sys/boot/ficl/Makefile
  head/sys/boot/zfs/Makefile

Modified: head/sys/boot/ficl/Makefile
==
--- head/sys/boot/ficl/Makefile Thu Jul 26 09:27:00 2012(r238794)
+++ head/sys/boot/ficl/Makefile Thu Jul 26 10:10:54 2012(r238795)
@@ -54,9 +54,11 @@ softcore.c: ${SOFTWORDS} softcore.awk
| awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET}
 
 .if ${MACHINE_CPUARCH} == "amd64"
+.if !exists(machine)
 ${SRCS:M*.c:R:S/$/.o/g}: machine
 
 beforedepend ${OBJS}: machine
+.endif
 
 machine:
ln -sf ${.CURDIR}/../../i386/include machine

Modified: head/sys/boot/zfs/Makefile
==
--- head/sys/boot/zfs/Makefile  Thu Jul 26 09:27:00 2012(r238794)
+++ head/sys/boot/zfs/Makefile  Thu Jul 26 10:10:54 2012(r238795)
@@ -33,5 +33,7 @@ machine:
 .include 
 
 .if ${MACHINE_CPUARCH} == "amd64"
+.if !exists(machine)
 beforedepend ${OBJS}: machine
 .endif
+.endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238741 - head/lib/libelf

2012-07-26 Thread Andrey Chernov
On Wed, Jul 25, 2012 at 04:26:29PM -0700, Garrett Cooper wrote:
> 
> A bunch of the sys/boot directories probably need this too..

Two of them (ficl and zfs) just fixed in r238795. If I miss some others, 
point me to.

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


Re: svn commit: r238755 - head/sys/x86/x86

2012-07-26 Thread Konstantin Belousov
On Thu, Jul 26, 2012 at 05:35:23PM +1000, Bruce Evans wrote:
> On Wed, 25 Jul 2012, Jung-uk Kim wrote:
> >>For some unrelated reasons, we do have lfence;rdtsc sequence in
> >>the userland already. Well, it is not exactly such sequence, there
> >>are some instructions between, but the main fact is that two
> >>consequtive invocations of gettimeofday(2) (*) or clock_gettime(2)
> >>are interleaved with lfence on Intels, guaranteeing that backstep
> >>of the counter is impossible.
> 
> In fact, there is always a full documented serialization instruction
> for syscalls, except maybe in FreeBSD-1 compat code on i386, at
> least on Athlon64.  i386 syscalls use int 0x80 (except in FreeBSD-1
> compat code they use lcalls, and the iret necessary to return from
> this is serializing on at least Athlon64.  amd64 syscalls use
> sysenter/sysret.  sysret isn't serializing (like far returns), at least
> on Athlon64, but at least in FreeBSD, the syscall implementation uses
> at least 2 swapgs's (one on entry and one just before the sysret), and
> swapgs is serializing, at least on Athlon64.
Yes, SWAPGS is not documented as serializing on Intels. I reviewed
the whole syscall sequence for e.g. gettimeofday(2), and there is no
serialization point for fast path. E.g. ast would add locking and thus
serialization, as well as return by IRET, but fast path on amd64 has
no such things.

> 
> >>* - it is not a syscall anymore.
> >>
> >>As I said, using recommended mfence;rdtsc sequence for AMDs would
> >>require some work, but lets handle the kernel and userspace issues
> >>separately.
> 
> Benchmarks for various methods on AthlonXP: I started with a program
> that loops making a fe million clock_gettime() calls:
> 
> unchanged program: 1.15 seconds
> add lfence:1.16 seconds
> add mfence:1.15 seconds (yes, faster than mfence)
> add atomic_cmpset: 1.20 seconds
> add cpuid: 1.25 seconds
> 
> >>And, I really failed to find what the patch from the thread you
> >>referenced tried to fix.
> >
> >The patch was supposed to reduce a barrier, i.e., vsyscall
> >optimization.  Please note I brought it up at the time, not because it
> >fixed any problem but because we completely lack necessary serialization.
> >
> >>Was it really committed into Linux ?
> >
> >Yes, it was committed in a simpler form:
> >
> >http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=057e6a8c660e95c3f4e7162e00e2fee1fc90c50d
> >
> >This function was moved around from time to time and now it sits here:
> >
> >http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=arch/x86/vdso/vclock_gettime.c
> >
> >It still carries one barrier before rdtsc.  Please see the comments.
> 
> For safety, you probably need to use the slowest (cpuid) method.  Linux
> seems to be just using fences that are observed to work.
No, there is explicit mention of the recommended barriers in the vendor
documentation, which is LFENCE for Intels, and MFENCE for AMDs. My patch
just follows what is suggested in documentation.

> 
> Original Athlon64 manuals say this about rdtsc: "... not serializing...
> even when bound by serializing instructions, the system environment at
> the time the instruction is executed can cause additional cycles
> [before it reaches EDX:EAX]".
Both Intel and AMD current manuals state that RDTSC is not serializing.
RDTSCP is documented by AMD as "forces all older instructions to retire
before reading the time-stamp counter." Intel says essentially the same.

[Replying to other mail in-place, the thread goes wild]

On Thu, Jul 26, 2012 at 04:25:01PM +1000, Bruce Evans wrote:
> On Wed, 25 Jul 2012, Konstantin Belousov wrote:
> 
> >On Wed, Jul 25, 2012 at 11:00:41AM -0700, Jim Harris wrote:
> >>I wonder if instead of timecounter going backward, that TSC test
> >>fails because CPU speculatively performs rdtsc instruction in relation
> >>to waiter checks in smp_rendezvous_action.  Or maybe we are saying
> >>the same thing.
> >
> >Ok, the definition of the 'timecounter goes back', as I understand it:
> >
> >you have two events A and B in two threads, provable ordered, say, A is
> >a lock release and B is the same lock acquisition. Assume that you take
> >rdtsc values tA and tB under the scope of the lock right before A and
> >right after B. Then it should be impossible to have tA > tB.
> 
> For the threaded case, there has to something for the accesses to be
> provably ordered.  It is hard to see how the something can be strong
> enough unless it serializes all thread state in A and B.  The rdtsc
> state is not part of the thread state as know to APIs, but it is hard
> to see how threads can serialize themselves without also serializing
> the TSC.
TSC timer read is not synchronized, and I found the Linux test for the
thing I described above. Adopted version is available at
http://people.freebsd.org/~kib/misc/time-warp-test.c.
It shall be compiled in 32bit mode only.

The code does full lock/unlock ar

svn commit: r238798 - in head: contrib/groff/tmac gnu/usr.bin/groff/tmac

2012-07-26 Thread Ruslan Ermilov
Author: ru
Date: Thu Jul 26 10:58:30 2012
New Revision: 238798
URL: http://svn.freebsd.org/changeset/base/238798

Log:
  Backed out r236255, and added FreeBSD 9.1 support to mdoc(7) to where
  it belongs.

Modified:
  head/contrib/groff/tmac/doc-common
  head/gnu/usr.bin/groff/tmac/mdoc.local

Modified: head/contrib/groff/tmac/doc-common
==
--- head/contrib/groff/tmac/doc-common  Thu Jul 26 10:47:26 2012
(r238797)
+++ head/contrib/groff/tmac/doc-common  Thu Jul 26 10:58:30 2012
(r238798)
@@ -574,10 +574,7 @@
 .ds doc-operating-system-FreeBSD-8.0 8.0
 .ds doc-operating-system-FreeBSD-8.1 8.1
 .ds doc-operating-system-FreeBSD-8.2 8.2
-.ds doc-operating-system-FreeBSD-8.3 8.3
 .ds doc-operating-system-FreeBSD-9.0 9.0
-.ds doc-operating-system-FreeBSD-9.1 9.1
-.ds doc-operating-system-FreeBSD-10.010.0
 .
 .ds doc-operating-system-Darwin-8.0.0  8.0.0
 .ds doc-operating-system-Darwin-8.1.0  8.1.0

Modified: head/gnu/usr.bin/groff/tmac/mdoc.local
==
--- head/gnu/usr.bin/groff/tmac/mdoc.local  Thu Jul 26 10:47:26 2012
(r238797)
+++ head/gnu/usr.bin/groff/tmac/mdoc.local  Thu Jul 26 10:58:30 2012
(r238798)
@@ -49,6 +49,7 @@
 .\" FreeBSD releases not found in doc-common
 .ds doc-operating-system-FreeBSD-7.47.4
 .ds doc-operating-system-FreeBSD-8.38.3
+.ds doc-operating-system-FreeBSD-9.19.1
 .ds doc-operating-system-FreeBSD-10.0   10.0
 .
 .\" Definitions not (yet) in doc-syms
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r236255 - head/contrib/groff/tmac

2012-07-26 Thread Ruslan Ermilov
On Wed, May 30, 2012 at 08:07:38PM -0700, David O'Brien wrote:
> On Wed, May 30, 2012 at 07:34:33AM +0400, Sergey Kandaurov wrote:
> > On 29 May 2012 23:49, David E. O'Brien  wrote:
> ...
> > > Modified: head/contrib/groff/tmac/doc-common
> ...
> > > +.ds doc-operating-system-FreeBSD-8.3 � � 8.3
> > > +.ds doc-operating-system-FreeBSD-9.1 � � 9.1
> > > +.ds doc-operating-system-FreeBSD-10.0 � �10.0
> > This should be imported from savannah.gnu.org repository,
> > and not changed directly.
> 
> Unfortunately we cannot do that per r217595:
> 
>   This is a direct commit to contrib/ as we will no longer import
>   any newer groff snapshots, due to licensing issues.
> 
> > For local changes not found in the (latest) contrib doc-common
> > you should use gnu/usr.bin/groff/tmac/mdoc.local
> 
> I followed r217595, was that commit the wrong approach?

Wrong.  mdoc is still distributed under the BSD license, and changes
to it should be cherry picked and merged via vendor/groff/dist/.

"8.3" and "10.0" that you added were already present in mdoc.local.

I've cleaned up this mess now while I was pulling up latest changes
to mdoc.

And BTW, I still recommend a pre-commit review for groff, as hinted
in src/MAINTAINERS.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238799 - in head: contrib/groff/tmac gnu/usr.bin/groff/tmac

2012-07-26 Thread Ruslan Ermilov
Author: ru
Date: Thu Jul 26 11:10:25 2012
New Revision: 238799
URL: http://svn.freebsd.org/changeset/base/238799

Log:
  Backed out r228904, and added libstdthreads support to mdoc(7) to where
  it belongs.

Modified:
  head/contrib/groff/tmac/doc-syms
  head/contrib/groff/tmac/groff_mdoc.man
  head/gnu/usr.bin/groff/tmac/mdoc.local

Modified: head/contrib/groff/tmac/doc-syms
==
--- head/contrib/groff/tmac/doc-symsThu Jul 26 10:58:30 2012
(r238798)
+++ head/contrib/groff/tmac/doc-symsThu Jul 26 11:10:25 2012
(r238799)
@@ -814,7 +814,6 @@
 .ds doc-str-Lb-librt   \*[Px] \*[doc-str-Lb]Real-time Library (librt, 
\-lrt)
 .ds doc-str-Lb-libsdp  Bluetooth Service Discovery Protocol User Library 
(libsdp, \-lsdp)
 .ds doc-str-Lb-libssp  Buffer Overflow Protection Library (libssp, \-lssp)
-.ds doc-str-Lb-libstdthreads C11 Threads Library (libstdthreads, \-lstdthreads)
 .ds doc-str-Lb-libSystem   System Library (libSystem, \-lSystem)
 .ds doc-str-Lb-libtermcap  Termcap Access Library (libtermcap, \-ltermcap)
 .ds doc-str-Lb-libterminfo Terminal Information Library (libterminfo, 
\-lterminfo)

Modified: head/contrib/groff/tmac/groff_mdoc.man
==
--- head/contrib/groff/tmac/groff_mdoc.man  Thu Jul 26 10:58:30 2012
(r238798)
+++ head/contrib/groff/tmac/groff_mdoc.man  Thu Jul 26 11:10:25 2012
(r238799)
@@ -1797,8 +1797,6 @@ and their results are:
 .Lb libsdp
 .It Li libssp
 .Lb libssp
-.It Li libstdthreads
-.Lb libstdthreads
 .It Li libSystem
 .Lb libSystem
 .It Li libtermcap

Modified: head/gnu/usr.bin/groff/tmac/mdoc.local
==
--- head/gnu/usr.bin/groff/tmac/mdoc.local  Thu Jul 26 10:58:30 2012
(r238798)
+++ head/gnu/usr.bin/groff/tmac/mdoc.local  Thu Jul 26 11:10:25 2012
(r238799)
@@ -42,6 +42,7 @@
 .ds doc-str-Lb-libproc Processor Monitoring and Analysis Library (libproc, 
\-lproc)
 .ds doc-str-Lb-libprocstat Process and Files Information Retrieval 
(libprocstat, \-lprocstat)
 .ds doc-str-Lb-librtld_db  Run-time Linker Debugging Library (librtld_db, 
\-lrtld_db)
+.ds doc-str-Lb-libstdthreads C11 Threads Library (libstdthreads, \-lstdthreads)
 .
 .\" Default .Os value
 .ds doc-default-operating-system FreeBSD\~10.0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238800 - head/contrib/groff/tmac

2012-07-26 Thread Ruslan Ermilov
Author: ru
Date: Thu Jul 26 11:12:38 2012
New Revision: 238800
URL: http://svn.freebsd.org/changeset/base/238800

Log:
  Pull up vendor changes to mdoc(7).

Modified:
  head/contrib/groff/tmac/doc-syms
  head/contrib/groff/tmac/doc.tmac
Directory Properties:
  head/contrib/groff/   (props changed)

Modified: head/contrib/groff/tmac/doc-syms
==
--- head/contrib/groff/tmac/doc-symsThu Jul 26 11:10:25 2012
(r238799)
+++ head/contrib/groff/tmac/doc-symsThu Jul 26 11:12:38 2012
(r238800)
@@ -661,7 +661,7 @@
 .as doc-str-St--susv3  " 
(\*[Lq]\*[doc-Tn-font-size]SUSv3\*[doc-str-St]\*[Rq])
 .ds doc-str-St--svid4  System\~V Interface Definition, Fourth Edition
 .as doc-str-St--svid4  " 
(\*[Lq]\*[doc-Tn-font-size]SVID\*[doc-str-St]\^4\*[Rq])
-.ds doc-str-St--xbd5   \*[doc-Tn-font-size]X/Open\*[doc-str-St] System 
Interface Definitions Issue\~5
+.ds doc-str-St--xbd5   \*[doc-Tn-font-size]X/Open\*[doc-str-St] Base 
Definitions Issue\~5
 .as doc-str-St--xbd5   " 
(\*[Lq]\*[doc-Tn-font-size]XBD\*[doc-str-St]\^5\*[Rq])
 .ds doc-str-St--xcu5   \*[doc-Tn-font-size]X/Open\*[doc-str-St] 
Commands and Utilities Issue\~5
 .as doc-str-St--xcu5   " 
(\*[Lq]\*[doc-Tn-font-size]XCU\*[doc-str-St]\^5\*[Rq])

Modified: head/contrib/groff/tmac/doc.tmac
==
--- head/contrib/groff/tmac/doc.tmacThu Jul 26 11:10:25 2012
(r238799)
+++ head/contrib/groff/tmac/doc.tmacThu Jul 26 11:12:38 2012
(r238800)
@@ -438,7 +438,7 @@
 .  \" last argument
 .  if (\n[doc-reg-dfr1] == 4) \
 .nop \|\-\c
-.  nop \f[]\s[0]\c
+.  nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
 .  doc-print-and-reset
 .\}
 .el \{\
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: contrib/groff/tmac

2012-07-26 Thread Ruslan Ermilov
On Mon, Dec 26, 2011 at 09:51:53PM +, Ed Schouten wrote:
> Author: ed
> Date: Mon Dec 26 21:51:53 2011
> New Revision: 228904
> URL: http://svn.freebsd.org/changeset/base/228904
> 
> Log:
>   Add libstdthreads.
[...]
> Modified:
>   head/contrib/groff/tmac/doc-syms
>   head/contrib/groff/tmac/groff_mdoc.man

On Thu, Jan 05, 2012 at 09:36:12PM +, Ulrich Spoerlein wrote:
> Author: uqs
> Date: Thu Jan  5 21:36:12 2012
> New Revision: 229651
> URL: http://svn.freebsd.org/changeset/base/229651
> 
> Log:
>   Pull up vendor changes to mdoc(7)
>   
>   This switches us to using -isoC-2011 as the symbol name which is used by
>   groff and mdocml. It follows the change to 4 digit years as done with
>   IEEE Std 1003 post-1999.
>   
>   MFC after:  2 weeks (groff changes only)
> 
> Modified:
>   head/contrib/groff/tmac/doc-syms
>   head/contrib/groff/tmac/groff_mdoc.man
>   head/lib/libstdthreads/thrd_create.3
[...]

Please don't directly commit to "mdoc" in contrib/groff/.  mdoc is still
distributed under the BSD license, here's the quote from groff/LICENSES:

:   . The -mdoc macro set, using the BSD license.
: 
:   tmac/doc.tmac
:   tmac/doc-old.tmac
:   tmac/doc-common
:   tmac/doc-ditroff
:   tmac/doc-nroff
:   tmac/doc-syms
:   tmac/groff_mdoc.man

Vendor changes to mdoc should first be committed to vendor/groff/dist/
and then merged from there.

Local changes should be made to gnu/usr.bin/groff/tmac/mdoc.local and may
also be submitted upstream at your discretion.


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


svn commit: r238801 - head/share/misc

2012-07-26 Thread Sergey Kandaurov
Author: pluknet
Date: Thu Jul 26 11:51:29 2012
New Revision: 238801
URL: http://svn.freebsd.org/changeset/base/238801

Log:
  Add OS X 10.8.
  Although they dropped the 'Mac' in this version,
  prefer to stick with it for consistency.
  
  Reviewed by:  maxim

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Thu Jul 26 11:12:38 2012
(r238800)
+++ head/share/misc/bsd-family-tree Thu Jul 26 11:51:29 2012
(r238801)
@@ -254,7 +254,8 @@ FreeBSD 5.2   |  |  
  |9.0  |  |  | |   DragonFly 3.0.1
  | vFreeBSD   |  | |   |
  |8.3 |  | OpenBSD 5.1 |
- ||  | |   |
+ | Mac OS X  | |   |
+ |   10.8| |   |
 FreeBSD 10 -current   |  NetBSD -current  OpenBSD -current |
  ||  | |   |
  vv  v v   v
@@ -547,6 +548,7 @@ FreeBSD 9.0 2012-01-12 [FBD]
 DragonFly 3.0.12012-02-21 [DFB]
 FreeBSD 8.32012-04-18 [FBD]
 OpenBSD 5.12012-05-01 [OBD]
+Mac OS X 10.8  2012-07-25 [APL]
 
 Bibliography
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238802 - head/lib/libc/stdlib

2012-07-26 Thread Sergey Kandaurov
Author: pluknet
Date: Thu Jul 26 12:04:11 2012
New Revision: 238802
URL: http://svn.freebsd.org/changeset/base/238802

Log:
  Update the 'C1x draft' reference to '.St -isoC-2011' mdoc macro.
  
  Reviewed by:  theraven
  MFC after:1 week

Modified:
  head/lib/libc/stdlib/at_quick_exit.3
  head/lib/libc/stdlib/quick_exit.3

Modified: head/lib/libc/stdlib/at_quick_exit.3
==
--- head/lib/libc/stdlib/at_quick_exit.3Thu Jul 26 11:51:29 2012
(r238801)
+++ head/lib/libc/stdlib/at_quick_exit.3Thu Jul 26 12:04:11 2012
(r238802)
@@ -58,4 +58,5 @@ function returns the value 0 if successf
 .Sh STANDARDS
 The
 .Fn at_quick_exit
-function conforms to the C1x draft specification.
+function conforms to
+.St -isoC-2011 .

Modified: head/lib/libc/stdlib/quick_exit.3
==
--- head/lib/libc/stdlib/quick_exit.3   Thu Jul 26 11:51:29 2012
(r238801)
+++ head/lib/libc/stdlib/quick_exit.3   Thu Jul 26 12:04:11 2012
(r238802)
@@ -54,4 +54,5 @@ function does not return.
 .Sh STANDARDS
 The
 .Fn quick_exit
-function conforms to the C1x draft specification.
+function conforms to
+.St -isoC-2011 .
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238803 - in head: share/man/man4 sys/dev/usb sys/dev/usb/serial

2012-07-26 Thread Gavin Atkinson
Author: gavin
Date: Thu Jul 26 12:10:19 2012
New Revision: 238803
URL: http://svn.freebsd.org/changeset/base/238803

Log:
  Add support for more devices to uslcom(4).  This commit syncronises the
  list of supported devices with the union of:
  
  NetBSD  src/sys/dev/usb/uslsa.c 1.18
  OpenBSD src/sys/dev/usb/uslcom.c 1.24
  Linux   source/drivers/usb/serial/cp210x.c HEAD
  
  Remove duplicate JABLOTRON PC60B entry.
  
  Note that some of the devices added here are multi-port devices.  The
  uslcom(4) driver currently only supports the first port on such devices.
  
  Update the man page to reflect the full list of supported devices.
  Remove two caveats from the CAVEATS section, as both listed caveats no
  longer apply.  Add a caveat about multi-port devices.
  
  MFC after:2 weeks

Modified:
  head/share/man/man4/uslcom.4
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/usbdevs

Modified: head/share/man/man4/uslcom.4
==
--- head/share/man/man4/uslcom.4Thu Jul 26 12:04:11 2012
(r238802)
+++ head/share/man/man4/uslcom.4Thu Jul 26 12:10:19 2012
(r238803)
@@ -16,12 +16,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 20, 2011
+.Dd July 26, 2012
 .Dt USLCOM 4
 .Os
 .Sh NAME
 .Nm uslcom
-.Nd Silicon Laboratories CP2101/CP2102 based USB serial adapter
+.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104 based USB serial adapter
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -41,7 +41,8 @@ uslcom_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
-driver supports Silicon Laboratories CP2101/CP2102 based USB serial adapters.
+driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104
+based USB serial adapters.
 .Sh HARDWARE
 The following devices should work with the
 .Nm
@@ -49,29 +50,147 @@ driver:
 .Pp
 .Bl -bullet -compact
 .It
+AC-Services CAN, CIS-IBUS, IBUS and OBD interfaces
+.It
+Aerocomm Radio
+.It
+AKTACOM ACE-1001 cable
+.It
+AMBER Wireless AMB2560
+.It
+Arkham DS-101 Adapter
+.It
 Argussoft ISP
 .It
+Arygon Technologies Mifare RFID Reader
+.It
+AVIT Research USB-TTL interface
+.It
+B&G H3000 Data Cable
+.It
+Balluff RFID reader
+.It
 Baltech card reader
 .It
+BEI USB VCP Sensor
+.It
 Burnside Telecom Desktop Mobile
 .It
 chip45.com Crumb128 module
 .It
+Clipsal 5000CT2, 5500PACA, 5500PCU, 560884, 5800PC, C5000CT2
+and L51xx C-Bus Home Automation products
+.It
+Commander 2 EDGE(GSM) Modem
+.It
+Cygnal Fasttrax GPS and Debug adapter
+.It
+DataApex MultiCOM USB to RS232 converter
+.It
+Degree Controls USB adapter
+.It
+DekTec DTA Plus VHF/UHF Booster
+.It
+Dell DW700 GPS Receiver
+.It
+Digianswer ZigBee/802.15.4 MAC
+.It
+Dynastream ANT Development kits
+.It
+Elan USBcount50, USBscope50, USBpulse100 and USBwave12
+.It
+ELV USB-I2C interface
+.It
+EMS C1007 HF RFID controller
+.It
+Festo CPX-USB and CMSP interfaces
+.It
+Gemalto Prox-PU/CU contactless card reader
+.It
+Helicomm IP-Link 1220-DVM
+.It
+IMS USB-RS422 adapter
+.It
+Infinity GPS-MIC-1 Radio Monophone
+.It
+INSYS Modem
+.It
+IRZ SG-10 and MC35pu GSM/GPRS Modems
+.It
 Jablotron PC-60B
 .It
-Lipowsky Baby-JTAG
+Kamstrup M-Bus Master MultiPort 250D
+and Optical Eye/3 wire utility meter interfaces
 .It
-Lipowsky Baby-LIN
+Kyocera GPS
 .It
-Lipowsky HARP-1
+Link Instruments MS-019 and MS-028
+Oscilloscope/Logic Analyzer/Pattern Generators
+.It
+Lipowsky Baby-JTAG, Baby-LIN and HARP-1
+.It
+MEI CashFlow SC and Series 2000 cash acceptors
+.It
+MJS USB-TOSLINK Adapter
+.It
+MobiData GPRS USB Modems
+.It
+MSD DashHawk
+.It
+Multiplex RC adapter
+.It
+Optris MSpro LT Thermometer
+.It
+Owen AC4 USB-RS485 converter
+.It
+Pirelli DP-L10 SIP phone
+.It
+PLX CA-42 Phone cable
 .It
 Pololu USB to Serial
 .It
-Silicon Laboratories CP2101
+Procyon AVS Mind Machine
+.It
+Renesas RX-Stick for RX610
+.It
+Siemens MC60 Cable
+.It
+Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104 chips
+.It
+Software Bisque Paramount ME
+.It
+SPORTident BSM7-D USB
 .It
-Silicon Laboratories CP2102
+Suunto Sports Instrument
+.It
+Syntech CipherLab USB Barcode Scanner
+.It
+T-Com TC 300 SIP phone
+.It
+Tams Master Easy Control
+.It
+Telegesis ETRX2USB
+.It
+Timewave HamLinkUSB
+.It
+Tracient RFID Reader
 .It
 Track Systems Traqmate
+.It
+Vaisala USB Instrument cable
+.It
+VStabi Controller
+.It
+WAGO 750-923 USB Service Cable
+.It
+WaveSense Jazz Blood Glucose Meter
+.It
+WIENER Plein & Baus CML Data Logger, RCM Remote,
+and PL512 and MPOD PSUs
+.It
+WMR RIGblaster Plug&Play and RIGtalk RT1
+.It
+Zephyr Bioharness
 .El
 .Sh SEE ALSO
 .Xr tty 4 ,
@@ -92,7 +211,5 @@ The
 driver was written by
 .An Jonathan Gray Aq j...@openbsd.org .
 .Sh CAVEATS
-Setting hardware flow control is not currently supported.
-.Pp
-Silicon Laboratories do not release any programming information
-on their products.
+On devices with multiple ports attached to a single chip,
+only the first port is currently supported.

Modified: head/sys/dev/usb/serial

svn commit: r238804 - in head/sys/dev/usb: . serial

2012-07-26 Thread Gavin Atkinson
Author: gavin
Date: Thu Jul 26 12:18:23 2012
New Revision: 238804
URL: http://svn.freebsd.org/changeset/base/238804

Log:
  Improve descriptions for several devices supported by uslcom(4).
  Correct the spelling of the company Telegesis.
  Move MpMan to the correct location alphabetically.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/uslcom.c
==
--- head/sys/dev/usb/serial/uslcom.cThu Jul 26 12:10:19 2012
(r238803)
+++ head/sys/dev/usb/serial/uslcom.cThu Jul 26 12:18:23 2012
(r238804)
@@ -293,7 +293,7 @@ static const STRUCT_USB_HOST_ID uslcom_d
 USLCOM_DEV(SILABS, SB_PARAMOUNT_ME),
 USLCOM_DEV(SILABS, SUUNTO),
 USLCOM_DEV(SILABS, TAMSMASTER),
-USLCOM_DEV(SILABS, TELEGESYS_ETRX2),
+USLCOM_DEV(SILABS, TELEGESIS_ETRX2),
 USLCOM_DEV(SILABS, TRACIENT),
 USLCOM_DEV(SILABS, TRAQMATE),
 USLCOM_DEV(SILABS, USBCOUNT50),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Jul 26 12:10:19 2012(r238803)
+++ head/sys/dev/usb/usbdevsThu Jul 26 12:18:23 2012(r238804)
@@ -1252,7 +1252,7 @@ product CISCOLINKSYS3 RT3070  0x0101  RT30
 product CLIPSAL 560884 0x0101  560884 C-Bus Audio Matrix Switch
 product CLIPSAL 5500PACA   0x0201  5500PACA C-Bus Pascal Automation 
Controller
 product CLIPSAL 5800PC 0x0301  5800PC C-Bus Wireless Interface
-product CLIPSAL 5500PCU0x0303  5500PCU C-Bus
+product CLIPSAL 5500PCU0x0303  5500PCU C-Bus Interface
 product CLIPSAL 5000CT20x0304  5000CT2 C-Bus Touch Screen
 product CLIPSAL C5000CT2   0x0305  C5000CT2 C-Bus Touch Screen
 product CLIPSAL L51xx  0x0401  L51xx C-Bus Dimmer
@@ -1672,7 +1672,7 @@ product FUJITSUSIEMENS SCR0x0009  Fujits
 product GARMIN IQUE_3600   0x0004  iQue 3600
 
 /* Gemalto products */
-product GEMALTO PROXPU 0x5501  Prox-PU/CU
+product GEMALTO PROXPU 0x5501  Prox-PU/CU RFID Card Reader
 
 /* General Instruments (Motorola) products */
 product GENERALINSTMNTS SB5100 0x5100  SURFboard SB5100 Cable modem
@@ -2251,7 +2251,7 @@ product MGE UPS2  0x  MGE UPS SYSTEMS
 
 /* MEI products */
 product MEI CASHFLOW_SC0x1100  Cashflow-SC Cash Acceptor
-product MEI S2000  0x1101  Seies 2000 Combo Acceptor
+product MEI S2000  0x1101  Series 2000 Combo Acceptor
 
 /* Micro Star International products */
 product MSI BT_DONGLE  0x1967  Bluetooth USB dongle
@@ -2364,6 +2364,10 @@ product MOTOROLA2 USBLAN20x6027  USBLAN
 product MOTOROLA4 RT2770   0x9031  RT2770
 product MOTOROLA4 RT3070   0x9032  RT3070
 
+/* MpMan products */
+product MPMAN MPF400_2 0x25a8  MPF400 Music Player 2Go
+product MPMAN MPF400_1 0x36d0  MPF400 Music Player 1Go
+
 /* MultiTech products */
 product MULTITECH ATLAS0xf101  MT5634ZBA-USB modem
 
@@ -3079,10 +3083,10 @@ product SILICOM U2E 0x0001  U2E
 product SILICOM GPE0x0002  Psion Gold Port Ethernet
 
 /* SI Labs */
-product SILABS VSTABI  0x0f91  Vstabi
+product SILABS VSTABI  0x0f91  VStabi Controller
 product SILABS ARKHAM_DS101_M  0x1101  Arkham DS101 Monitor
 product SILABS ARKHAM_DS101_A  0x1601  Arkham DS101 Adapter
-product SILABS BSM7DUSB0x800a  BSM7-D-USB
+product SILABS BSM7DUSB0x800a  SPORTident BSM7-D USB
 product SILABS POLOLU  0x803b  Pololu Serial
 product SILABS CYGNAL_DEBUG0x8044  Cygnal Debug Adapter
 product SILABS SB_PARAMOUNT_ME 0x8043  Software Bisque Paramount ME
@@ -3106,7 +3110,7 @@ product SILABSB_G_H3000   0x8156  B&G H300
 product SILABS HELICOM 0x815e  Helicomm IP-Link 1220-DVM
 product SILABS HAMLINKUSB  0x815f  Timewave HamLinkUSB
 product SILABS AVIT_USB_TTL0x818b  AVIT Research USB-TTL
-product SILABS MJS_TOSLINK 0x819f  MJS USB-TOSLINk
+product SILABS MJS_TOSLINK 0x819f  MJS USB-TOSLINK
 product SILABS WAVIT   0x81a6  ThinkOptics WavIt
 product SILABS MULTIPLEX_RC0x81a9  Multiplex RC adapter
 product SILABS MSD_DASHHAWK0x81ac  MSD DashHawk
@@ -3119,7 +3123,7 @@ product SILABSEMS_C1007   0x81f2  EMS C100
 product SILABS LIPOWSKY_HARP   0x8218  Lipowsky HARP-1
 product SILABS C2_EDGE_MODEM   0x822b  Commander 2 EDGE(GSM) Modem
 product SILABS CYGNAL_GPS  0x826b  Cygnal Fasttrax GPS
-product SILABS TELEGESYS_ETRX2 0x8293  Telegesys ETRX2USB
+product SILABS TELEGESIS_ETRX2 0x8293  Telegesis ETRX2USB
 product SILABS PROCYON_AVS 0x82f9  Procyon AVS
 product SILABS MC35PU  0x8341  MC35pu
 product SILABS CYGNAL  0x8382  Cygnal
@@ -3276,10 +3280,6 @@ product STELERA E10100x1010  3G modem
 product STELERA E1011  0x1011  

Re: svn commit: r238755 - head/sys/x86/x86

2012-07-26 Thread Bruce Evans

On Thu, 26 Jul 2012, Konstantin Belousov wrote:


On Thu, Jul 26, 2012 at 05:35:23PM +1000, Bruce Evans wrote:

In fact, there is always a full documented serialization instruction
for syscalls, except maybe in FreeBSD-1 compat code on i386, at
least on Athlon64.  i386 syscalls use int 0x80 (except in FreeBSD-1
compat code they use lcalls, and the iret necessary to return from
this is serializing on at least Athlon64.  amd64 syscalls use
sysenter/sysret.  sysret isn't serializing (like far returns), at least
on Athlon64, but at least in FreeBSD, the syscall implementation uses
at least 2 swapgs's (one on entry and one just before the sysret), and
swapgs is serializing, at least on Athlon64.

Yes, SWAPGS is not documented as serializing on Intels. I reviewed


Isn't that too incompatible?


the whole syscall sequence for e.g. gettimeofday(2), and there is no
serialization point for fast path. E.g. ast would add locking and thus
serialization, as well as return by IRET, but fast path on amd64 has
no such things.



This function was moved around from time to time and now it sits here:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=arch/x86/vdso/vclock_gettime.c

It still carries one barrier before rdtsc.  Please see the comments.


For safety, you probably need to use the slowest (cpuid) method.  Linux
seems to be just using fences that are observed to work.

No, there is explicit mention of the recommended barriers in the vendor
documentation, which is LFENCE for Intels, and MFENCE for AMDs. My patch
just follows what is suggested in documentation.


But you say later theat CPUID is needed (instead of just lock?).  The
original Athlon64 manual doesn't seem to mention MFENCE for RTDSC.
Maybe later manuals clarify that MFENCE works on old CPUs too.


[Replying to other mail in-place, the thread goes wild]


Too much quoting :-).


On Thu, Jul 26, 2012 at 04:25:01PM +1000, Bruce Evans wrote:

...
For the threaded case, there has to something for the accesses to be
provably ordered.  It is hard to see how the something can be strong
enough unless it serializes all thread state in A and B.  The rdtsc
state is not part of the thread state as know to APIs, but it is hard
to see how threads can serialize themselves without also serializing
the TSC.

TSC timer read is not synchronized, and I found the Linux test for the
thing I described above. Adopted version is available at
http://people.freebsd.org/~kib/misc/time-warp-test.c.
It shall be compiled in 32bit mode only.


My point is that it will normally be synchronized by whatever the threads
do to provide synchronization for themself.  Only the case of a single
thread doing sequential timer reads should expect the reads to be
monotonic without any explicit synchronization.  I hope this case doesn't
require stalling everything in low-level code.


On my Nehalem workstation, I get enormous amount of wraps reported for
RDTSC without CPUID. Adding CPUID back fixes the issue. So at least on
Nehalems (and probably Westmere, I will test later today) RDTSC can even
pass LOCKed instructions.


Oh, you mean with the test program, that it needs CPUID because it only
has locks and no fences and its CPUID is commented out.


Curiously enough, SandyBridge is sane and reports zero wraps, it seems
Intel fixed the bug.


The original Athlon64 manual doesn't seem to mention locks being sufficient
any more than it mentions fences.


I care about timestamps being ordered more than most people, and tried
to kill the get*time() APIs because they are weakly ordered relative
to the non-get variants (they return times in the past, and there is
no way to round down to get consistent times).  I tried to fix them
by adding locking and updating them to the latest time whenever a
non-get variant gives a later time (by being used).  This was too slow,
and breaks the design criteria that timecounter calls should not use
any explicit locking.  However, if you want slowness, then you can get
it similarly by fixing the monotonicity of rdtsc in software.  I think
I just figured out how to do this with the same slowness as serialization,
if a locked instruction serialzes; maybe less otherwise:

spin:
ptsc = prev_tsc;/* memory -> local (intentionally !atomic) */
tsc = rdtsc();  /* only 32 bits for timecounters */
if (tsc <= ptsc) {   /* I forgot about wrap at first -- see below
*/
/*
 * It went backwards, or stopped.  Could handle more
 * completely, starting with panic() to see if this
 * happens at all.
 */
return (ptsc);  /* stopped is better than backwards */
}
/* Usual case; update (32 bits). */
if (atomic_cmpset_int(&prev_tsc, ptsc, tsc))
return (tsc);
goto spin;

I do not understand this. Algorithm is clear, but what you propose is
very heavy-weight comparing with adding just

svn commit: r238805 - in head: share/man/man4 sys/conf sys/dev/ahci sys/modules/ahci

2012-07-26 Thread Alexander Motin
Author: mav
Date: Thu Jul 26 13:44:48 2012
New Revision: 238805
URL: http://svn.freebsd.org/changeset/base/238805

Log:
  Refactor enclosure manegement support in ahci(4). Move it out into separate
  subdevice ahciem. Emulate SEMB SES device from AHCI LED interface to expose
  it to users in form of ses(4) CAM device. If we ever see AHCI controllers
  supporting SES of SAF-TE over I2C as described by specification, they should
  fit well into this new picture.
  
  Sponsored by: iXsystems, Inc.

Added:
  head/sys/dev/ahci/ahciem.c   (contents, props changed)
Modified:
  head/share/man/man4/ahci.4
  head/sys/conf/files
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahci.h
  head/sys/modules/ahci/Makefile

Modified: head/share/man/man4/ahci.4
==
--- head/share/man/man4/ahci.4  Thu Jul 26 12:18:23 2012(r238804)
+++ head/share/man/man4/ahci.4  Thu Jul 26 13:44:48 2012(r238805)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009 Alexander Motin 
+.\" Copyright (c) 2009-2012 Alexander Motin 
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 18, 2012
+.Dd July 25, 2012
 .Dt AHCI 4
 .Os
 .Sh NAME
@@ -132,7 +132,9 @@ Driver supports "LED" enclosure manageme
 When supported by hardware, it allows to control per-port activity, locate
 and fault LEDs via the
 .Xr led 4
-API for localization and status reporting purposes.
+API or emulated
+.Xr ses 4
+device for localization and status reporting purposes.
 Supporting AHCI controllers may transmit that information to the backplane
 controllers via SGPIO interface. Backplane controllers interpret received
 statuses in some way (IBPI standard) to report them using present indicators.
@@ -153,11 +155,11 @@ it supports AHCI part of legacy-PATA + A
 such as JMicron JMB36x and Marvell 88SE61xx.
 .Sh FILES
 .Bl -tag -width /dev/led/ahcich*.locate
-.It Pa /dev/led/ahcich*.act
+.It Pa /dev/led/ahci*.*.act
 activity LED device nodes
-.It Pa /dev/led/ahcich*.fault
+.It Pa /dev/led/ahci*.*.fault
 fault LED device nodes
-.It Pa /dev/led/ahcich*.locate
+.It Pa /dev/led/ahci*.*.locate
 locate LED device nodes
 .El
 .Sh SEE ALSO
@@ -166,7 +168,8 @@ locate LED device nodes
 .Xr cam 4 ,
 .Xr cd 4 ,
 .Xr da 4 ,
-.Xr sa 4
+.Xr sa 4 ,
+.Xr ses 4
 .Sh HISTORY
 The
 .Nm

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jul 26 12:18:23 2012(r238804)
+++ head/sys/conf/files Thu Jul 26 13:44:48 2012(r238805)
@@ -639,6 +639,7 @@ dev/aha/aha_isa.c   optional aha isa
 dev/aha/aha_mca.c  optional aha mca
 dev/ahb/ahb.c  optional ahb eisa
 dev/ahci/ahci.coptional ahci pci
+dev/ahci/ahciem.c  optional ahci pci
 dev/aic/aic.c  optional aic
 dev/aic/aic_pccard.c   optional aic pccard
 dev/aic7xxx/ahc_eisa.c optional ahc eisa

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cThu Jul 26 12:18:23 2012(r238804)
+++ head/sys/dev/ahci/ahci.cThu Jul 26 13:44:48 2012(r238805)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009 Alexander Motin 
+ * Copyright (c) 2009-2012 Alexander Motin 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,21 +31,16 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "ahci.h"
@@ -69,7 +64,6 @@ static int ahci_ch_resume(device_t dev);
 static void ahci_ch_pm(void *arg);
 static void ahci_ch_intr_locked(void *data);
 static void ahci_ch_intr(void *data);
-static void ahci_ch_led(void *priv, int onoff);
 static int ahci_ctlr_reset(device_t dev);
 static int ahci_ctlr_setup(device_t dev);
 static void ahci_begin_transaction(device_t dev, union ccb *ccb);
@@ -441,7 +435,6 @@ ahci_attach(device_t dev)
ctlr->caps &= ~AHCI_CAP_SNCQ;
if ((ctlr->caps & AHCI_CAP_CCCS) == 0)
ctlr->ccc = 0;
-   mtx_init(&ctlr->em_mtx, "AHCI EM lock", NULL, MTX_DEF);
ctlr->emloc = ATA_INL(ctlr->r_mem, AHCI_EM_LOC);
ahci_ctlr_setup(dev);
/* Setup interrupts. */
@@ -494,17 +487,6 @@ ahci_attach(device_t dev)
(ctlr->caps2 & AHCI_CAP2_NVMP) ? " NVMP":"",
(ctlr->caps2 & AHCI_CAP2_BOH) ? " BOH":"");
}
-   if (bootverbose && (ctlr->caps & AHCI_CAP_EMS)) {
-   device_printf(dev, "EM Caps:%s%s%s%s%s%s%s%s\n",
-   (ctlr->capsem & AHCI_EM_PM) ? " PM":"",
-   (ctlr->capsem & AHCI_EM_ALHD) ? " ALHD":"",
-  

svn commit: r238808 - head/lib/libc/locale

2012-07-26 Thread Joel Dahl
Author: joel (doc committer)
Date: Thu Jul 26 14:46:19 2012
New Revision: 238808
URL: http://svn.freebsd.org/changeset/base/238808

Log:
  Start manpage with Dd macro and also remove a trailing whitespace
  while here.

Modified:
  head/lib/libc/locale/iswalnum_l.3

Modified: head/lib/libc/locale/iswalnum_l.3
==
--- head/lib/libc/locale/iswalnum_l.3   Thu Jul 26 14:03:29 2012
(r238807)
+++ head/lib/libc/locale/iswalnum_l.3   Thu Jul 26 14:46:19 2012
(r238808)
@@ -24,8 +24,8 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dt ISWALNUM_L 3
 .Dd July 25, 2012
+.Dt ISWALNUM_L 3
 .Os
 .Sh NAME
 .Nm iswalnum_l ,
@@ -161,7 +161,7 @@ except for
 .Fn iswphonogram_l ,
 .Fn iswrune_l ,
 .Fn iswspecial_l
-and 
+and
 .Fn nextwctype_l
 which are
 .Fx
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238741 - head/lib/libelf

2012-07-26 Thread Garrett Cooper
On Thu, Jul 26, 2012 at 3:13 AM, Andrey Chernov  wrote:
> On Wed, Jul 25, 2012 at 04:26:29PM -0700, Garrett Cooper wrote:
>>
>> A bunch of the sys/boot directories probably need this too..
>
> Two of them (ficl and zfs) just fixed in r238795. If I miss some others,
> point me to.

Pretty sure ficl was the big one, but I'll keep my eyes peeled for the others.

Basically, if you update your source tree and something gets touched
under /sys/boot and you run make buildworld -DNO_CLEAN, 9 times out of
10 you have to cd into the directories and run `make obj depend all`
because the loader files are `missing`.

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


svn commit: r238810 - head/lib/libedit

2012-07-26 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul 26 15:48:07 2012
New Revision: 238810
URL: http://svn.freebsd.org/changeset/base/238810

Log:
  Drop non-portable libedit's el_data_set() and el_data_get() for
  private data.
  
  We can set/get private data with the documented el_get() and
  el_set() so there's no need for our local extensions, which
  never received much use anyway.
  
  While here, also re-arrange the call to term_init_arrow. This
  was left over from r89735 but is not required anymore.
  
  This changes reduce differences against NetBSD's libedit.
  
  MFC after:2 months

Modified:
  head/lib/libedit/el.c
  head/lib/libedit/histedit.h
  head/lib/libedit/term.c

Modified: head/lib/libedit/el.c
==
--- head/lib/libedit/el.c   Thu Jul 26 15:29:08 2012(r238809)
+++ head/lib/libedit/el.c   Thu Jul 26 15:48:07 2012(r238810)
@@ -473,30 +473,6 @@ el_get(EditLine *el, int op, ...)
return (rv);
 }
 
-/* el_data_get():
- * Set user private data.
- */
-public void
-el_data_set (el, data)
-EditLine *el;
-void *data;
-{
-el->el_data = data;
-
-return;
-}
-
-/* el_data_get():
- * Return user private data.
- */
-public void *
-el_data_get (el)
-EditLine *el;
-{
-if (el->el_data)
-   return (el->el_data);
-return (NULL);
-}
 
 /* el_line():
  * Return editing info

Modified: head/lib/libedit/histedit.h
==
--- head/lib/libedit/histedit.h Thu Jul 26 15:29:08 2012(r238809)
+++ head/lib/libedit/histedit.h Thu Jul 26 15:48:07 2012(r238810)
@@ -154,13 +154,6 @@ intel_source(EditLine *, const char *)
  */
 voidel_resize(EditLine *);
 
-
-/*
- * Set user private data.
- */
-voidel_data_set(EditLine *, void *);
-void *  el_data_get(EditLine *);
-
 /*
  * User-defined function interface.
  */

Modified: head/lib/libedit/term.c
==
--- head/lib/libedit/term.c Thu Jul 26 15:29:08 2012(r238809)
+++ head/lib/libedit/term.c Thu Jul 26 15:48:07 2012(r238810)
@@ -340,8 +340,8 @@ term_init(EditLine *el)
if (el->el_term.t_val == NULL)
return (-1);
(void) memset(el->el_term.t_val, 0, T_val * sizeof(int));
-   term_init_arrow(el);
(void) term_set(el, NULL);
+   term_init_arrow(el);
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238811 - head/sys/arm/conf

2012-07-26 Thread Warner Losh
Author: imp
Date: Thu Jul 26 16:34:21 2012
New Revision: 238811
URL: http://svn.freebsd.org/changeset/base/238811

Log:
  Trim read/write sizes to 128 bytes.  Pages are only 128 bytes in size.
  Writes larger than this will wrap to the same page.  Reads larger than
  this are permitted, but why take chances.

Modified:
  head/sys/arm/conf/SAM9260EK.hints

Modified: head/sys/arm/conf/SAM9260EK.hints
==
--- head/sys/arm/conf/SAM9260EK.hints   Thu Jul 26 15:48:07 2012
(r238810)
+++ head/sys/arm/conf/SAM9260EK.hints   Thu Jul 26 16:34:21 2012
(r238811)
@@ -39,11 +39,10 @@ hint.map.4.end=0x0083
 hint.map.4.name="fs"
 #hint.map.4.readonly=1
 
-# EEPROM
+# EEPROM at24c512 - 512kbit 65,536x8 memory
 hint.icee.0.at="iicbus0"
 hint.icee.0.addr=0xa0
 hint.icee.0.type=16
 hint.icee.0.size=65536
-hint.icee.0.rd_sz=256
-hint.icee.0.wr_sz=256
-
+hint.icee.0.rd_sz=128
+hint.icee.0.wr_sz=128
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-07-26 Thread Luigi Rizzo
Author: luigi
Date: Thu Jul 26 16:45:28 2012
New Revision: 238812
URL: http://svn.freebsd.org/changeset/base/238812

Log:
  Add support for VALE bridges to the netmap core, see
  
  http://info.iet.unipi.it/~luigi/vale/
  
  VALE lets you dynamically instantiate multiple software bridges
  that talk the netmap API (and are *extremely* fast), so you can test
  netmap applications without the need for high end hardware.
  
  This is particularly useful as I am completing a netmap-aware
  version of ipfw, and VALE provides an excellent testing platform.
  
  Also, I also have netmap backends for qemu mostly ready for commit
  to the port, and this too will let you interconnect virtual machines
  at high speed without fiddling with bridges, tap or other slow solutions.
  
  The API for applications is unchanged, so you can use the code
  in tools/tools/netmap (which i will update soon) on the VALE ports.
  
  This commit also syncs the code with the one in my internal repository,
  so you will see some conditional code for other platforms.
  The code should run mostly unmodified on stable/9 so people interested
  in trying it can just copy sys/dev/netmap/ and sys/net/netmap*.h
  from HEAD
  
  VALE is joint work with my colleague Giuseppe Lettieri, and
  is partly supported by the EU Projects CHANGE and OPENLAB

Modified:
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_kern.h
  head/sys/dev/netmap/netmap_mem2.c

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cThu Jul 26 16:34:21 2012
(r238811)
+++ head/sys/dev/netmap/netmap.cThu Jul 26 16:45:28 2012
(r238812)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Matteo Landi, Luigi Rizzo. All rights reserved.
+ * Copyright (C) 2011-2012 Matteo Landi, Luigi Rizzo. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,6 +23,8 @@
  * SUCH DAMAGE.
  */
 
+#define NM_BRIDGE
+
 /*
  * This module supports memory mapped access to network devices,
  * see netmap(4).
@@ -52,6 +54,14 @@
  *transmit or receive queues (or all queues for a given interface).
  */
 
+#ifdef linux
+#include "bsd_glue.h"
+static netdev_tx_t netmap_start_linux(struct sk_buff *skb, struct net_device 
*dev);
+#endif /* linux */
+#ifdef __APPLE__
+#include "osx_glue.h"
+#endif
+#ifdef __FreeBSD__
 #include  /* prerequisite */
 __FBSDID("$FreeBSD$");
 
@@ -83,6 +93,7 @@ __FBSDID("$FreeBSD$");
 #include/* bus_dmamap_* */
 
 MALLOC_DEFINE(M_NETMAP, "netmap", "Network memory map");
+#endif /* __FreeBSD__ */
 
 /*
  * lock and unlock for the netmap memory allocator
@@ -115,6 +126,173 @@ int netmap_no_pendintr = 1;
 SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr,
 CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received 
packets.");
 
+int netmap_drop = 0;   /* debugging */
+int netmap_flags = 0;  /* debug flags */
+int netmap_copy = 0;   /* debugging, copy content */
+
+SYSCTL_INT(_dev_netmap, OID_AUTO, drop, CTLFLAG_RW, &netmap_drop, 0 , "");
+SYSCTL_INT(_dev_netmap, OID_AUTO, flags, CTLFLAG_RW, &netmap_flags, 0 , "");
+SYSCTL_INT(_dev_netmap, OID_AUTO, copy, CTLFLAG_RW, &netmap_copy, 0 , "");
+
+#ifdef NM_BRIDGE /* support for netmap bridge */
+
+/*
+ * system parameters.
+ *
+ * All switched ports have prefix NM_NAME.
+ * The switch has a max of NM_BDG_MAXPORTS ports (often stored in a bitmap,
+ * so a practical upper bound is 64).
+ * Each tx ring is read-write, whereas rx rings are readonly (XXX not done 
yet).
+ * The virtual interfaces use per-queue lock instead of core lock.
+ * In the tx loop, we aggregate traffic in batches to make all operations
+ * faster. The batch size is NM_BDG_BATCH
+ */
+#defineNM_NAME "vale"  /* prefix for the interface */
+#define NM_BDG_MAXPORTS16  /* up to 64 ? */
+#define NM_BRIDGE_RINGSIZE 1024/* in the device */
+#define NM_BDG_HASH1024/* forwarding table entries */
+#define NM_BDG_BATCH   1024/* entries in the forwarding buffer */
+#defineNM_BRIDGES  4   /* number of bridges */
+int netmap_bridge = NM_BDG_BATCH; /* bridge batch size */
+SYSCTL_INT(_dev_netmap, OID_AUTO, bridge, CTLFLAG_RW, &netmap_bridge, 0 , "");
+#ifdef linux
+#defineADD_BDG_REF(ifp)(NA(ifp)->if_refcount++)
+#defineDROP_BDG_REF(ifp)   (NA(ifp)->if_refcount-- <= 1)
+#else /* !linux */
+#defineADD_BDG_REF(ifp)(ifp)->if_refcount++
+#defineDROP_BDG_REF(ifp)   refcount_release(&(ifp)->if_refcount)
+#ifdef __FreeBSD__
+#include 
+#include 
+#endif /* __FreeBSD__ */
+#endif /* !linux */
+
+static void bdg_netmap_attach(struct ifnet *ifp);
+static int bdg_netmap_reg(struct ifnet *ifp, int onoff);
+/* per-tx-queue entry */
+struct nm_bdg_fwd {/* forwarding entry 

svn commit: r238813 - head/sbin/geom/class/sched

2012-07-26 Thread Isabell Long
Author: issyl0 (doc committer)
Date: Thu Jul 26 17:30:34 2012
New Revision: 238813
URL: http://svn.freebsd.org/changeset/base/238813

Log:
  The ad(4) driver no longer exists in FreeBSD CURRENT or 9, so change the
  references to it in gsched(8) to the existing ada(4) driver.
  
  PR:   docs/170085
  Submitted by: olgeni
  Approved by:  gavin
  MFC after:5 days

Modified:
  head/sbin/geom/class/sched/gsched.8

Modified: head/sbin/geom/class/sched/gsched.8
==
--- head/sbin/geom/class/sched/gsched.8 Thu Jul 26 16:45:28 2012
(r238812)
+++ head/sbin/geom/class/sched/gsched.8 Thu Jul 26 17:30:34 2012
(r238813)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 29, 2010
+.Dd July 26, 2012 
 .Dt GSCHED 8
 .Os
 .Sh NAME
@@ -135,19 +135,19 @@ maximum amount of debug information is p
 Exit status is 0 on success, and 1 if the command fails.
 .Sh EXAMPLES
 The following example shows how to create a scheduling provider for disk
-.Pa /dev/ad0 ,
+.Pa /dev/ada0 ,
 and how to destroy it.
 .Bd -literal -offset indent
 # Load the geom_sched module:
 kldload geom_sched
 # Load some scheduler classes used by geom_sched:
 kldload gsched_rr
-# Configure device ad0 to use scheduler "rr":
-geom sched insert -a rr ad0
-# Now provider ad0 uses the "rr" algorithm;
-# the new geom is ad0.sched.
+# Configure device ada0 to use scheduler "rr":
+geom sched insert -a rr ada0
+# Now provider ada0 uses the "rr" algorithm;
+# the new geom is ada0.sched.
 # Remove the scheduler on the device:
-geom sched destroy -v ad0.sched.
+geom sched destroy -v ada0.sched.
 .Ed
 .Sh SEE ALSO
 .Xr geom 4 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238755 - head/sys/x86/x86

2012-07-26 Thread Konstantin Belousov
On Thu, Jul 26, 2012 at 10:30:51PM +1000, Bruce Evans wrote:
> On Thu, 26 Jul 2012, Konstantin Belousov wrote:
> 
> >On Thu, Jul 26, 2012 at 05:35:23PM +1000, Bruce Evans wrote:
> >>In fact, there is always a full documented serialization instruction
> >>for syscalls, except maybe in FreeBSD-1 compat code on i386, at
> >>least on Athlon64.  i386 syscalls use int 0x80 (except in FreeBSD-1
> >>compat code they use lcalls, and the iret necessary to return from
> >>this is serializing on at least Athlon64.  amd64 syscalls use
> >>sysenter/sysret.  sysret isn't serializing (like far returns), at least
> >>on Athlon64, but at least in FreeBSD, the syscall implementation uses
> >>at least 2 swapgs's (one on entry and one just before the sysret), and
> >>swapgs is serializing, at least on Athlon64.
> >Yes, SWAPGS is not documented as serializing on Intels. I reviewed
> 
> Isn't that too incompatible?
After the SYSRETQ story, we should not be surprised.

I believe I saw the difference between SWAPGS specifications earlier.

> 
> >the whole syscall sequence for e.g. gettimeofday(2), and there is no
> >serialization point for fast path. E.g. ast would add locking and thus
> >serialization, as well as return by IRET, but fast path on amd64 has
> >no such things.
> 
> >>>This function was moved around from time to time and now it sits here:
> >>>
> >>>http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=arch/x86/vdso/vclock_gettime.c
> >>>
> >>>It still carries one barrier before rdtsc.  Please see the comments.
> >>
> >>For safety, you probably need to use the slowest (cpuid) method.  Linux
> >>seems to be just using fences that are observed to work.
> >No, there is explicit mention of the recommended barriers in the vendor
> >documentation, which is LFENCE for Intels, and MFENCE for AMDs. My patch
> >just follows what is suggested in documentation.
> 
> But you say later theat CPUID is needed (instead of just lock?).  The
> original Athlon64 manual doesn't seem to mention MFENCE for RTDSC.
> Maybe later manuals clarify that MFENCE works on old CPUs too.
> 
> >[Replying to other mail in-place, the thread goes wild]
> 
> Too much quoting :-).
> 
> >On Thu, Jul 26, 2012 at 04:25:01PM +1000, Bruce Evans wrote:
> >>...
> >>For the threaded case, there has to something for the accesses to be
> >>provably ordered.  It is hard to see how the something can be strong
> >>enough unless it serializes all thread state in A and B.  The rdtsc
> >>state is not part of the thread state as know to APIs, but it is hard
> >>to see how threads can serialize themselves without also serializing
> >>the TSC.
> >TSC timer read is not synchronized, and I found the Linux test for the
> >thing I described above. Adopted version is available at
> >http://people.freebsd.org/~kib/misc/time-warp-test.c.
> >It shall be compiled in 32bit mode only.
> 
> My point is that it will normally be synchronized by whatever the threads
> do to provide synchronization for themself.  Only the case of a single
> thread doing sequential timer reads should expect the reads to be
> monotonic without any explicit synchronization.  I hope this case doesn't
> require stalling everything in low-level code.
> 
> >On my Nehalem workstation, I get enormous amount of wraps reported for
> >RDTSC without CPUID. Adding CPUID back fixes the issue. So at least on
> >Nehalems (and probably Westmere, I will test later today) RDTSC can even
> >pass LOCKed instructions.
> 
> Oh, you mean with the test program, that it needs CPUID because it only
> has locks and no fences and its CPUID is commented out.
Yes, CPUID or LFENCE is enough to fix the failure.

> 
> >Curiously enough, SandyBridge is sane and reports zero wraps, it seems
> >Intel fixed the bug.
> 
> The original Athlon64 manual doesn't seem to mention locks being sufficient
> any more than it mentions fences.
> 
> >>I care about timestamps being ordered more than most people, and tried
> >>to kill the get*time() APIs because they are weakly ordered relative
> >>to the non-get variants (they return times in the past, and there is
> >>no way to round down to get consistent times).  I tried to fix them
> >>by adding locking and updating them to the latest time whenever a
> >>non-get variant gives a later time (by being used).  This was too slow,
> >>and breaks the design criteria that timecounter calls should not use
> >>any explicit locking.  However, if you want slowness, then you can get
> >>it similarly by fixing the monotonicity of rdtsc in software.  I think
> >>I just figured out how to do this with the same slowness as serialization,
> >>if a locked instruction serialzes; maybe less otherwise:
> >>
> >>spin:
> >>ptsc = prev_tsc;/* memory -> local (intentionally !atomic) */
> >>tsc = rdtsc();  /* only 32 bits for timecounters */
> >>if (tsc <= ptsc) {  /* I forgot about wrap at first -- see below
> >>*/
> >>/*
> >> * It went backwards, or 

Re: svn commit: r238755 - head/sys/x86/x86

2012-07-26 Thread Peter Grehan

Yes, CPUID or LFENCE is enough to fix the failure.


 CPUID causes an unconditional exit in VT-x/SVM so it would be best to 
avoid that if possible.


later,

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


svn commit: r238817 - head/usr.bin/du

2012-07-26 Thread Sergey Kandaurov
Author: pluknet
Date: Thu Jul 26 20:41:36 2012
New Revision: 238817
URL: http://svn.freebsd.org/changeset/base/238817

Log:
  Document -g option in the usage string.

Modified:
  head/usr.bin/du/du.c

Modified: head/usr.bin/du/du.c
==
--- head/usr.bin/du/du.cThu Jul 26 19:18:26 2012(r238816)
+++ head/usr.bin/du/du.cThu Jul 26 20:41:36 2012(r238817)
@@ -493,7 +493,7 @@ static void
 usage(void)
 {
(void)fprintf(stderr,
-   "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] "
+   "usage: du [-Aclnx] [-H | -L | -P] [-g | -h | -k | -m] "
"[-a | -s | -d depth] [-B blocksize] [-I mask] "
"[-t threshold] [file ...]\n");
exit(EX_USAGE);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-07-26 Thread Luigi Rizzo
Author: luigi
Date: Thu Jul 26 21:37:58 2012
New Revision: 238818
URL: http://svn.freebsd.org/changeset/base/238818

Log:
  define prefetch as a noop on !x86

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

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cThu Jul 26 20:41:36 2012
(r238817)
+++ head/sys/dev/netmap/netmap.cThu Jul 26 21:37:58 2012
(r238818)
@@ -220,7 +220,11 @@ struct nm_bridge nm_bridges[NM_BRIDGES];
 #ifndef linux
 static inline void prefetch (const void *x)
 {
+#if defined(__i386__) || defined(__amd64__)
 __asm volatile("prefetcht0 %0" :: "m" (*(const unsigned long *)x));
+#else
+   (void)x;
+#endif
 }
 #endif /* !linux */
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238818 - head/sys/dev/netmap

2012-07-26 Thread Roman Divacky
Why dont you use __builtin_prefetch() ?

On Thu, Jul 26, 2012 at 09:37:58PM +, Luigi Rizzo wrote:
> Author: luigi
> Date: Thu Jul 26 21:37:58 2012
> New Revision: 238818
> URL: http://svn.freebsd.org/changeset/base/238818
> 
> Log:
>   define prefetch as a noop on !x86
> 
> Modified:
>   head/sys/dev/netmap/netmap.c
> 
> Modified: head/sys/dev/netmap/netmap.c
> ==
> --- head/sys/dev/netmap/netmap.c  Thu Jul 26 20:41:36 2012
> (r238817)
> +++ head/sys/dev/netmap/netmap.c  Thu Jul 26 21:37:58 2012
> (r238818)
> @@ -220,7 +220,11 @@ struct nm_bridge nm_bridges[NM_BRIDGES];
>  #ifndef linux
>  static inline void prefetch (const void *x)
>  {
> +#if defined(__i386__) || defined(__amd64__)
>  __asm volatile("prefetcht0 %0" :: "m" (*(const unsigned long *)x));
> +#else
> + (void)x;
> +#endif
>  }
>  #endif /* !linux */
>  
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238819 - head/sys/dev/usb/controller

2012-07-26 Thread Warner Losh
Author: imp
Date: Fri Jul 27 05:24:09 2012
New Revision: 238819
URL: http://svn.freebsd.org/changeset/base/238819

Log:
  Minor style(9) nit.

Modified:
  head/sys/dev/usb/controller/ohci_atmelarm.c

Modified: head/sys/dev/usb/controller/ohci_atmelarm.c
==
--- head/sys/dev/usb/controller/ohci_atmelarm.c Thu Jul 26 21:37:58 2012
(r238818)
+++ head/sys/dev/usb/controller/ohci_atmelarm.c Fri Jul 27 05:24:09 2012
(r238819)
@@ -76,6 +76,7 @@ struct at91_ohci_softc {
 static int
 ohci_atmelarm_probe(device_t dev)
 {
+
device_set_desc(dev, "AT91 integrated OHCI controller");
return (BUS_PROBE_DEFAULT);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238820 - head/sys/arm/at91

2012-07-26 Thread Warner Losh
Author: imp
Date: Fri Jul 27 05:28:02 2012
New Revision: 238820
URL: http://svn.freebsd.org/changeset/base/238820

Log:
  Add (back?) ohci atmel attachment.

Modified:
  head/sys/arm/at91/files.at91

Modified: head/sys/arm/at91/files.at91
==
--- head/sys/arm/at91/files.at91Fri Jul 27 05:24:09 2012
(r238819)
+++ head/sys/arm/at91/files.at91Fri Jul 27 05:28:02 2012
(r238820)
@@ -48,3 +48,7 @@ arm/at91/board_sam9g20ek.coptionalat91
 arm/at91/board_sam9x25ek.c optionalat91_board_sam9x25ek
 arm/at91/board_sn9g45.coptionalat91_board_sn9g45
 arm/at91/board_tsc4370.c   optionalat91_board_tsc4370
+#
+# usb
+#
+dev/usb/controller/ohci_atmelarm.c optional ohci
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238821 - head/sys/arm/at91

2012-07-26 Thread Warner Losh
Author: imp
Date: Fri Jul 27 05:33:55 2012
New Revision: 238821
URL: http://svn.freebsd.org/changeset/base/238821

Log:
  Turns out the ETHERNUT5 isn't anything like the SAM9260-EK.  Make this
  board init match better: UART1 instead of UART2, No RMMI, no SPI0, SPI1
  comments.

Modified:
  head/sys/arm/at91/board_sam9260ek.c

Modified: head/sys/arm/at91/board_sam9260ek.c
==
--- head/sys/arm/at91/board_sam9260ek.c Fri Jul 27 05:28:02 2012
(r238820)
+++ head/sys/arm/at91/board_sam9260ek.c Fri Jul 27 05:33:55 2012
(r238821)
@@ -74,37 +74,55 @@ board_init(void)
at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA20, 0);
/* EMDIO */
at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA21, 0);
+   /* Not RMII */
+   /* ETX2 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA10, 0);
+   /* ETX3 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA11, 0);
+   /* ETXER */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA22, 0);
+   /* ERX2 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA25, 0);
+   /* ERX3 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA26, 0);
+   /* ERXCK */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA27, 0);
+   /* ECRS */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA28, 0);
+   /* ECOL */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA29, 0);
+
 
/*
-* MMC
+* MMC, wired to socket B.
 */
-   /* MCDA0 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA6, 1);
-   /* MCCDA */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA7, 1);
+   /* MCDB0 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA0, 1);
+   /* MCCDB */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA1, 1);
+   /* MCDB3 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA3, 1);
+   /* MCDB2 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA4, 1);
+   /* MCDB1 */
+   at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA5, 1);
/* MCCK */
at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA8, 1);
-   /* MCDA1 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA9, 1);
-   /* MCDA2 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA10, 1);
-   /* MCDA3 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA11, 1);
-
-   /*
-* SPI0
-*/
-   /* MISO */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA0, 0);
-   /* MOSI */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA1, 0);
-   /* SPCK */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA2, 0);
-   /* NPCS0 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA3, 0);
 
/*
-* TWI
+* SPI0 and MMC are wired together, since we don't support sharing
+* don't support the dataflash.  But if you did, you'd have to
+* use CS0 and CS1.
+*/
+
+   /*
+* SPI1 is wired to a audio CODEC that we don't support, so
+* give it a pass.
+*/
+
+   /*
+* TWI.  Only one child on the iic bus, which we take care of
+* via hints.
 */
/* TWD */
at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA23, 1);
@@ -132,16 +150,18 @@ board_init(void)
at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB27, 0);
 
/*
-* USART2
+* USART1
 */
-   /* RTS2 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA4, 1);
-   /* CTS2 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA5, 0);
-   /* TXD2 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB8, 1);
-   /* RXD2 */
-   at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB9, 0);
+   /* RTS1 */
+   at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB28, 1);
+   /* CTS1 */
+   at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB29, 0);
+   /* TXD1 */
+   at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB6, 1);
+   /* RXD1 */
+   at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB7, 0);
+
+   /* USART2 - USART5 aren't wired up, except via PIO pins, ignore them. */
 
return (at91_ramsize());
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-07-26 Thread Adrian Chadd
Author: adrian
Date: Fri Jul 27 05:34:45 2012
New Revision: 238822
URL: http://svn.freebsd.org/changeset/base/238822

Log:
  Refactor out the descriptor allocation code from the buffer allocation
  code.
  
  The TX EDMA completion path is going to need descriptors allocated but
  not any buffers.  This code will form the basis for that.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Fri Jul 27 05:33:55 2012(r238821)
+++ head/sys/dev/ath/if_ath.c   Fri Jul 27 05:34:45 2012(r238822)
@@ -2764,8 +2764,14 @@ ath_load_cb(void *arg, bus_dma_segment_t
*paddr = segs->ds_addr;
 }
 
+/*
+ * Allocate the descriptors and appropriate DMA tag/setup.
+ *
+ * For some situations (eg EDMA TX completion), there isn't a requirement
+ * for the ath_buf entries to be allocated.
+ */
 int
-ath_descdma_setup(struct ath_softc *sc,
+ath_descdma_alloc_desc(struct ath_softc *sc,
struct ath_descdma *dd, ath_bufhead *head,
const char *name, int ds_size, int nbuf, int ndesc)
 {
@@ -2774,9 +2780,7 @@ ath_descdma_setup(struct ath_softc *sc,
 #defineATH_DESC_4KB_BOUND_CHECK(_daddr, _len) \
u_int32_t)(_daddr) & 0xFFF) > (0x1000 - (_len))) ? 1 : 0)
struct ifnet *ifp = sc->sc_ifp;
-   uint8_t *ds;
-   struct ath_buf *bf;
-   int i, bsize, error;
+   int error;
 
dd->dd_descsize = ds_size;
 
@@ -2844,10 +2848,49 @@ ath_descdma_setup(struct ath_softc *sc,
goto fail2;
}
 
-   ds = (uint8_t *) dd->dd_desc;
DPRINTF(sc, ATH_DEBUG_RESET, "%s: %s DMA map: %p (%lu) -> %p (%lu)\n",
-   __func__, dd->dd_name, ds, (u_long) dd->dd_desc_len,
-   (caddr_t) dd->dd_desc_paddr, /*XXX*/ (u_long) dd->dd_desc_len);
+   __func__, dd->dd_name, (uint8_t *) dd->dd_desc,
+   (u_long) dd->dd_desc_len, (caddr_t) dd->dd_desc_paddr,
+   /*XXX*/ (u_long) dd->dd_desc_len);
+
+   return (0);
+
+fail2:
+   bus_dmamem_free(dd->dd_dmat, dd->dd_desc, dd->dd_dmamap);
+fail1:
+   bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap);
+fail0:
+   bus_dma_tag_destroy(dd->dd_dmat);
+   memset(dd, 0, sizeof(*dd));
+   return error;
+#undef DS2PHYS
+#undef ATH_DESC_4KB_BOUND_CHECK
+}
+
+int
+ath_descdma_setup(struct ath_softc *sc,
+   struct ath_descdma *dd, ath_bufhead *head,
+   const char *name, int ds_size, int nbuf, int ndesc)
+{
+#defineDS2PHYS(_dd, _ds) \
+   ((_dd)->dd_desc_paddr + ((caddr_t)(_ds) - (caddr_t)(_dd)->dd_desc))
+#defineATH_DESC_4KB_BOUND_CHECK(_daddr, _len) \
+   u_int32_t)(_daddr) & 0xFFF) > (0x1000 - (_len))) ? 1 : 0)
+   struct ifnet *ifp = sc->sc_ifp;
+   uint8_t *ds;
+   struct ath_buf *bf;
+   int i, bsize, error;
+
+   /* Allocate descriptors */
+   error = ath_descdma_alloc_desc(sc, dd, head, name, ds_size,
+   nbuf, ndesc);
+
+   /* Assume any errors during allocation were dealt with */
+   if (error != 0) {
+   return (error);
+   }
+
+   ds = (uint8_t *) dd->dd_desc;
 
/* allocate rx buffers */
bsize = sizeof(struct ath_buf) * nbuf;
@@ -2889,13 +2932,11 @@ ath_descdma_setup(struct ath_softc *sc,
TAILQ_INSERT_TAIL(head, bf, bf_list);
}
return 0;
+   /* XXX this should likely just call ath_descdma_cleanup() */
 fail3:
bus_dmamap_unload(dd->dd_dmat, dd->dd_dmamap);
-fail2:
bus_dmamem_free(dd->dd_dmat, dd->dd_desc, dd->dd_dmamap);
-fail1:
bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap);
-fail0:
bus_dma_tag_destroy(dd->dd_dmat);
memset(dd, 0, sizeof(*dd));
return error;

Modified: head/sys/dev/ath/if_ath_misc.h
==
--- head/sys/dev/ath/if_ath_misc.h  Fri Jul 27 05:33:55 2012
(r238821)
+++ head/sys/dev/ath/if_ath_misc.h  Fri Jul 27 05:34:45 2012
(r238822)
@@ -84,6 +84,9 @@ extern void ath_setdefantenna(struct ath
 
 extern void ath_setslottime(struct ath_softc *sc);
 
+extern int ath_descdma_alloc_desc(struct ath_softc *sc,
+   struct ath_descdma *dd, ath_bufhead *head, const char *name,
+   int ds_size, int nbuf, int ndesc);
 extern int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
ath_bufhead *head, const char *name, int ds_size, int nbuf,
int ndesc);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238823 - head/sys/arm/conf

2012-07-26 Thread Warner Losh
Author: imp
Date: Fri Jul 27 05:37:01 2012
New Revision: 238823
URL: http://svn.freebsd.org/changeset/base/238823

Log:
  Document the dataflash/mmc-sd issue.  Add umass driver and usb.  Boot
  off da0s1a instead of ate0.  Note that MMC/SD is slot B.  Until I
  switch over to NAND boot, dataflash booting will preclude having SD
  cards inserted at boot, so this last bit is untested.
  
  My SAM9260-EK not boots to multi-user prompt.

Modified:
  head/sys/arm/conf/SAM9260EK

Modified: head/sys/arm/conf/SAM9260EK
==
--- head/sys/arm/conf/SAM9260EK Fri Jul 27 05:34:45 2012(r238822)
+++ head/sys/arm/conf/SAM9260EK Fri Jul 27 05:37:01 2012(r238823)
@@ -66,14 +66,17 @@ options PRINTF_BUFR_SIZE=128# Prevent 
 #options   INCLUDE_CONFIG_FILE # Include this file in kernel
 
 # required for netbooting
-optionsBOOTP
-optionsBOOTP_COMPAT
-optionsBOOTP_NFSROOT
-optionsBOOTP_NFSV3
-optionsBOOTP_WIRED_TO=ate0
+#options   BOOTP
+#options   BOOTP_COMPAT
+#options   BOOTP_NFSROOT
+#options   BOOTP_NFSV3
+#options   BOOTP_WIRED_TO=ate0
 
 # alternatively, boot from a MMC/SD memory card
-#options   ROOTDEVNAME=\"ufs:/dev/mmcsd0a\"
+#options   ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\"
+
+# Alternatively, boot from a USB card.
+optionsROOTDEVNAME=\"ufs:/dev/da0s1a\"
 
 # kernel/memory size reduction
 optionsMUTEX_NOINLINE
@@ -112,16 +115,21 @@ deviceiicbus  # I2C bus system
 device icee# I2C eeprom
 
 # MMC/SD
+# See comment for DataFlash below
 device at91_mci# Atmel AT91 Multimedia Card Interface
-optionsAT91_MCI_HAS_4WIRE
+optionsAT91_MCI_HAS_4WIRE  # 4 wires
+optionsAT91_MCI_SLOT_B # Wired to slot B
 device mmc # MMC/SD bus
 device mmcsd   # MMC/SD memory card
 
 # DataFlash
-device at91_spi# Atmel AT91 Serial Peripheral Interface
-device spibus  # SPI bus
-device at45d   # Atmel AT45D
-device geom_map# GEOM partition mapping
+# The DataFlash and MMC card are wired together, so we must pick one or the
+# other.  This is due to pin mux, and also due to the design of the
+# SAM9260EK board.  SLOT A wouldn't have this issue.
+#deviceat91_spi# Atmel AT91 Serial Peripheral Interface
+#devicespibus  # SPI bus
+#deviceat45d   # Atmel AT45D
+#devicegeom_map# GEOM partition mapping
 
 # Pseudo devices.
 device loop# Network loopback
@@ -135,13 +143,13 @@ deviceether   # Ethernet support
 #devicefirmware# firmware assist module
 
 # SCSI peripherals
-#devicescbus   # SCSI bus (required for ATA/SCSI)
+device scbus   # SCSI bus (required for ATA/SCSI)
 #devicech  # SCSI media changers
-#deviceda  # Direct Access (disks)
+device da  # Direct Access (disks)
 #devicesa  # Sequential Access (tape etc)
-#devicecd  # CD
-#devicepass# Passthrough device (direct ATA/SCSI 
access)
-#deviceses # Enclosure Services (SES and SAF-TE)
+device cd  # CD/DVD
+device pass# Passthrough device (direct ATA/SCSI access)
+device ses # Enclosure Services (SES and SAF-TE)
 #devicectl # CAM Target Layer
 
 # Serial (COM) ports
@@ -150,9 +158,9 @@ options ALT_BREAK_TO_DEBUGGER
 
 # USB support
 #options   USB_DEBUG   # enable debug msgs
-device ohci# OHCI PCI->USB interface
+device ohci# OHCI USB interface
 device usb # USB Bus (required)
-#deviceumass   # Disks/Mass storage - Requires scbus 
and da
+device umass   # Disks/Mass storage - Requires scbus and da
 
 # watchdog
 device at91_wdt# Atmel AT91 Watchdog Timer
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-07-26 Thread Adrian Chadd
Author: adrian
Date: Fri Jul 27 05:48:42 2012
New Revision: 238824
URL: http://svn.freebsd.org/changeset/base/238824

Log:
  Migrate the descriptor allocation function to not care about the number
  of buffers, only the number of descriptors.
  
  This involves:
  
  * Change the allocation function to not use nbuf at all;
  * When calling it, pass in "nbuf * ndesc" to correctly update how many
descriptors are being allocated.
  
  Whilst here, fix the descriptor allocation code to correctly allocate
  a larger buffer size if the Merlin 4KB WAR is required.  It overallocates
  descriptors when allocating a block that doesn't ever have a 4KB boundary
  being crossed, but that can be fixed at a later stage.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Fri Jul 27 05:37:01 2012(r238823)
+++ head/sys/dev/ath/if_ath.c   Fri Jul 27 05:48:42 2012(r238824)
@@ -2773,7 +2773,7 @@ ath_load_cb(void *arg, bus_dma_segment_t
 int
 ath_descdma_alloc_desc(struct ath_softc *sc,
struct ath_descdma *dd, ath_bufhead *head,
-   const char *name, int ds_size, int nbuf, int ndesc)
+   const char *name, int ds_size, int ndesc)
 {
 #defineDS2PHYS(_dd, _ds) \
((_dd)->dd_desc_paddr + ((caddr_t)(_ds) - (caddr_t)(_dd)->dd_desc))
@@ -2785,11 +2785,11 @@ ath_descdma_alloc_desc(struct ath_softc 
dd->dd_descsize = ds_size;
 
DPRINTF(sc, ATH_DEBUG_RESET,
-   "%s: %s DMA: %u buffers %u desc/buf, %d bytes per descriptor\n",
-   __func__, name, nbuf, ndesc, dd->dd_descsize);
+   "%s: %s DMA: %u desc, %d bytes per descriptor\n",
+   __func__, name, ndesc, dd->dd_descsize);
 
dd->dd_name = name;
-   dd->dd_desc_len = dd->dd_descsize * nbuf * ndesc;
+   dd->dd_desc_len = dd->dd_descsize * ndesc;
 
/*
 * Merlin work-around:
@@ -2797,8 +2797,8 @@ ath_descdma_alloc_desc(struct ath_softc 
 * Assume one skipped descriptor per 4KB page.
 */
if (! ath_hal_split4ktrans(sc->sc_ah)) {
-   int numdescpage = 4096 / (dd->dd_descsize * ndesc);
-   dd->dd_desc_len = (nbuf / numdescpage + 1) * 4096;
+   int numpages = dd->dd_desc_len / 4096;
+   dd->dd_desc_len += ds_size * numpages;
}
 
/*
@@ -2834,7 +2834,7 @@ ath_descdma_alloc_desc(struct ath_softc 
 &dd->dd_dmamap);
if (error != 0) {
if_printf(ifp, "unable to alloc memory for %u %s descriptors, "
-   "error %u\n", nbuf * ndesc, dd->dd_name, error);
+   "error %u\n", ndesc, dd->dd_name, error);
goto fail1;
}
 
@@ -2883,7 +2883,7 @@ ath_descdma_setup(struct ath_softc *sc,
 
/* Allocate descriptors */
error = ath_descdma_alloc_desc(sc, dd, head, name, ds_size,
-   nbuf, ndesc);
+   nbuf * ndesc);
 
/* Assume any errors during allocation were dealt with */
if (error != 0) {

Modified: head/sys/dev/ath/if_ath_misc.h
==
--- head/sys/dev/ath/if_ath_misc.h  Fri Jul 27 05:37:01 2012
(r238823)
+++ head/sys/dev/ath/if_ath_misc.h  Fri Jul 27 05:48:42 2012
(r238824)
@@ -86,7 +86,7 @@ extern void ath_setslottime(struct ath_s
 
 extern int ath_descdma_alloc_desc(struct ath_softc *sc,
struct ath_descdma *dd, ath_bufhead *head, const char *name,
-   int ds_size, int nbuf, int ndesc);
+   int ds_size, int ndesc);
 extern int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
ath_bufhead *head, const char *name, int ds_size, int nbuf,
int ndesc);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238818 - head/sys/dev/netmap

2012-07-26 Thread Luigi Rizzo
On Thu, Jul 26, 2012 at 11:39:59PM +0200, Roman Divacky wrote:
> Why dont you use __builtin_prefetch() ?

ignorance :)

thanks for the pointer, i'll look at it.
i suppose it works for clang too ?

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