svn commit: r260160 - head/sys/dev/vt

2014-01-01 Thread Ed Maste
Author: emaste
Date: Wed Jan  1 19:38:15 2014
New Revision: 260160
URL: http://svnweb.freebsd.org/changeset/base/260160

Log:
  Increase vt(9) max glyph data to 1MB for CJK fonts with many glyphs
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_font.c

Modified: head/sys/dev/vt/vt_font.c
==
--- head/sys/dev/vt/vt_font.c   Wed Jan  1 02:49:45 2014(r260159)
+++ head/sys/dev/vt/vt_font.c   Wed Jan  1 19:38:15 2014(r260160)
@@ -42,7 +42,7 @@ static MALLOC_DEFINE(M_VTFONT, "vtfont",
 
 /* Some limits to prevent abnormal fonts from being loaded. */
 #defineVTFONT_MAXMAPPINGS  8192
-#defineVTFONT_MAXGLYPHSIZE 262144
+#defineVTFONT_MAXGLYPHSIZE 1048576
 #defineVTFONT_MAXDIMENSION 128
 
 static uint16_t
___
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: r260161 - in head/sys/arm: arm include

2014-01-01 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jan  1 20:03:48 2014
New Revision: 260161
URL: http://svnweb.freebsd.org/changeset/base/260161

Log:
  Add polarity and level support to ARM GIC
  
  Add suport for setting triggering level and polarity in GIC.
  New function pointer was added to nexus which corresponds
  to the function which sets level/sense in the hardware (GIC).
  
  Submitted by: Wojciech Macek 
  Obtained from:Semihalf

Modified:
  head/sys/arm/arm/gic.c
  head/sys/arm/arm/intr.c
  head/sys/arm/arm/nexus.c
  head/sys/arm/include/intr.h

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Wed Jan  1 19:38:15 2014(r260160)
+++ head/sys/arm/arm/gic.c  Wed Jan  1 20:03:48 2014(r260161)
@@ -83,6 +83,15 @@ __FBSDID("$FreeBSD$");
 #define GICC_ABPR  0x001C  /* v1 ICCABPR */
 #define GICC_IIDR  0x00FC  /* v1 ICCIIDR*/
 
+/* First bit is a polarity bit (0 - low, 1 - high) */
+#define GICD_ICFGR_POL_LOW (0 << 0)
+#define GICD_ICFGR_POL_HIGH(1 << 0)
+#define GICD_ICFGR_POL_MASK0x1
+/* Second bit is a trigger bit (0 - level, 1 - edge) */
+#define GICD_ICFGR_TRIG_LVL(0 << 1)
+#define GICD_ICFGR_TRIG_EDGE   (1 << 1)
+#define GICD_ICFGR_TRIG_MASK   0x2
+
 struct arm_gic_softc {
struct resource *   gic_res[3];
bus_space_tag_t gic_c_bst;
@@ -90,6 +99,9 @@ struct arm_gic_softc {
bus_space_handle_t  gic_c_bsh;
bus_space_handle_t  gic_d_bsh;
uint8_t ver;
+   device_tdev;
+   struct mtx  mutex;
+   uint32_tnirqs;
 };
 
 static struct resource_spec arm_gic_spec[] = {
@@ -109,6 +121,8 @@ static struct arm_gic_softc *arm_gic_sc 
 #definegic_d_write_4(reg, val) \
 bus_space_write_4(arm_gic_sc->gic_d_bst, arm_gic_sc->gic_d_bsh, reg, val)
 
+static int gic_config_irq(int irq, enum intr_trigger trig,
+enum intr_polarity pol);
 static void gic_post_filter(void *);
 
 static int
@@ -157,19 +171,20 @@ arm_gic_attach(device_t dev)
struct  arm_gic_softc *sc;
int i;
uint32_ticciidr;
-   uint32_tnirqs;
 
if (arm_gic_sc)
return (ENXIO);
 
sc = device_get_softc(dev);
+   sc->dev = dev;
 
if (bus_alloc_resources(dev, arm_gic_spec, sc->gic_res)) {
device_printf(dev, "could not allocate resources\n");
return (ENXIO);
}
 
-   arm_post_filter = gic_post_filter;
+   /* Initialize mutex */
+   mtx_init(&sc->mutex, "GIC lock", "", MTX_SPIN);
 
/* Distributor Interface */
sc->gic_d_bst = rman_get_bustag(sc->gic_res[0]);
@@ -185,31 +200,35 @@ arm_gic_attach(device_t dev)
gic_d_write_4(GICD_CTLR, 0x00);
 
/* Get the number of interrupts */
-   nirqs = gic_d_read_4(GICD_TYPER);
-   nirqs = 32 * ((nirqs & 0x1f) + 1);
+   sc->nirqs = gic_d_read_4(GICD_TYPER);
+   sc->nirqs = 32 * ((sc->nirqs & 0x1f) + 1);
+
+   /* Set up function pointers */
+   arm_post_filter = gic_post_filter;
+   arm_config_irq = gic_config_irq;
 
icciidr = gic_c_read_4(GICC_IIDR);
-   device_printf(dev,"pn 0x%x, arch 0x%x, rev 0x%x, implementer 0x%x nirqs 
%u\n",
+   device_printf(dev,"pn 0x%x, arch 0x%x, rev 0x%x, implementer 0x%x 
sc->nirqs %u\n",
icciidr>>20, (icciidr>>16) & 0xF, (icciidr>>12) & 0xf,
-   (icciidr & 0xfff), nirqs);
+   (icciidr & 0xfff), sc->nirqs);
 
/* Set all global interrupts to be level triggered, active low. */
-   for (i = 32; i < nirqs; i += 32) {
-   gic_d_write_4(GICD_ICFGR(i >> 5), 0x);
+   for (i = 32; i < sc->nirqs; i += 16) {
+   gic_d_write_4(GICD_ICFGR(i >> 4), 0x);
}
 
/* Disable all interrupts. */
-   for (i = 32; i < nirqs; i += 32) {
+   for (i = 32; i < sc->nirqs; i += 32) {
gic_d_write_4(GICD_ICENABLER(i >> 5), 0x);
}
 
-   for (i = 0; i < nirqs; i += 4) {
+   for (i = 0; i < sc->nirqs; i += 4) {
gic_d_write_4(GICD_IPRIORITYR(i >> 2), 0);
gic_d_write_4(GICD_ITARGETSR(i >> 2), 1 << 0 | 1 << 8 | 1 << 16 
| 1 << 24);
}
 
/* Set all the interrupts to be in Group 0 (secure) */
-   for (i = 0; i < nirqs; i += 32) {
+   for (i = 0; i < sc->nirqs; i += 32) {
gic_d_write_4(GICD_IGROUPR(i >> 5), 0);
}
 
@@ -290,6 +309,58 @@ arm_unmask_irq(uintptr_t nb)
gic_d_write_4(GICD_ISENABLER(nb >> 5), (1UL << (nb & 0x1F)));
 }
 
+static int
+gic_config_irq(int irq, enum intr_trigger trig,
+enum intr_polarity pol)
+{
+   uint32_t reg;
+   uint32_t mask;
+
+   /* Function is public-accessible, so validate input argume

svn commit: r260162 - head/sys/powerpc/powerpc

2014-01-01 Thread Ed Maste
Author: emaste
Date: Wed Jan  1 20:04:43 2014
New Revision: 260162
URL: http://svnweb.freebsd.org/changeset/base/260162

Log:
  Remove TNF license clauses 3 and 4, matching upstream
  
  Approved by raj@ (Semihalf has a copyright statement in the license block
  as well).

Modified:
  head/sys/powerpc/powerpc/bus_machdep.c

Modified: head/sys/powerpc/powerpc/bus_machdep.c
==
--- head/sys/powerpc/powerpc/bus_machdep.c  Wed Jan  1 20:03:48 2014
(r260161)
+++ head/sys/powerpc/powerpc/bus_machdep.c  Wed Jan  1 20:04:43 2014
(r260162)
@@ -15,13 +15,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
___
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: r260163 - head/sys/dev/ahci

2014-01-01 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jan  1 20:18:03 2014
New Revision: 260163
URL: http://svnweb.freebsd.org/changeset/base/260163

Log:
  Do not attach to PCI bridges in AHCI driver
  
  Some vendors use the same VID:PID combination in AHCI and PCI bridge cards
  
  Submitted by: Wojciech Macek 
  Obtained from:Semihalf

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

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cWed Jan  1 20:04:43 2014(r260162)
+++ head/sys/dev/ahci/ahci.cWed Jan  1 20:18:03 2014(r260163)
@@ -375,6 +375,13 @@ ahci_probe(device_t dev)
uint32_t devid = pci_get_devid(dev);
uint8_t revid = pci_get_revid(dev);
 
+   /*
+* Ensure it is not a PCI bridge (some vendors use
+* the same PID and VID in PCI bridge and AHCI cards).
+*/
+   if (pci_get_class(dev) == PCIC_BRIDGE)
+   return (ENXIO);
+
/* Is this a possible AHCI candidate? */
if (pci_get_class(dev) == PCIC_STORAGE &&
pci_get_subclass(dev) == PCIS_STORAGE_SATA &&
___
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: r260165 - head/sys/dev/ahci

2014-01-01 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jan  1 20:26:08 2014
New Revision: 260165
URL: http://svnweb.freebsd.org/changeset/base/260165

Log:
  Use only mapped BIOs on ARM
  
  Using unmapped BIOs causes failure inside bus_dmamap_sync, since
  this function requires valid MVA address, which is not present
  if mapping is not set up.
  
  Submitted by: Wojciech Macek 
  Obtained from:Semihalf

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

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cWed Jan  1 20:22:29 2014(r260164)
+++ head/sys/dev/ahci/ahci.cWed Jan  1 20:26:08 2014(r260165)
@@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc
if (ch->caps & AHCI_CAP_SPM)
cpi->hba_inquiry |= PI_SATAPM;
cpi->target_sprt = 0;
+#ifdef __arm__
+   /*
+* Do not use unmapped buffers on ARM. Doing so will cause
+* failure inside bus_dmamap_sync due to lack of VA.
+*/
+   cpi->hba_misc = PIM_SEQSCAN;
+#else
cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
+#endif
cpi->hba_eng_cnt = 0;
if (ch->caps & AHCI_CAP_SPM)
cpi->max_target = 15;
___
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: r260165 - head/sys/dev/ahci

2014-01-01 Thread Konstantin Belousov
On Wed, Jan 01, 2014 at 08:26:08PM +, Zbigniew Bodek wrote:
> Author: zbb
> Date: Wed Jan  1 20:26:08 2014
> New Revision: 260165
> URL: http://svnweb.freebsd.org/changeset/base/260165
> 
> Log:
>   Use only mapped BIOs on ARM
>   
>   Using unmapped BIOs causes failure inside bus_dmamap_sync, since
>   this function requires valid MVA address, which is not present
>   if mapping is not set up.
>   
>   Submitted by:   Wojciech Macek 
>   Obtained from:  Semihalf
> 
> Modified:
>   head/sys/dev/ahci/ahci.c
> 
> Modified: head/sys/dev/ahci/ahci.c
> ==
> --- head/sys/dev/ahci/ahci.c  Wed Jan  1 20:22:29 2014(r260164)
> +++ head/sys/dev/ahci/ahci.c  Wed Jan  1 20:26:08 2014(r260165)
> @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc
>   if (ch->caps & AHCI_CAP_SPM)
>   cpi->hba_inquiry |= PI_SATAPM;
>   cpi->target_sprt = 0;
> +#ifdef __arm__
> + /*
> +  * Do not use unmapped buffers on ARM. Doing so will cause
> +  * failure inside bus_dmamap_sync due to lack of VA.
> +  */
> + cpi->hba_misc = PIM_SEQSCAN;
> +#else
>   cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
> +#endif
>   cpi->hba_eng_cnt = 0;
>   if (ch->caps & AHCI_CAP_SPM)
>   cpi->max_target = 15;

I think this is wrong. If bus_dmamap_sync(9) is not functional on arm,
then unmapped io should be disabled on arm unconditionally, using
unmapped_buf_allowed.  Why ahci(4) is special in this regard, leaving
other controllers broken for arm ?


pgpFj6y8YpDwm.pgp
Description: PGP signature


svn commit: r260166 - head/sys/arm/versatile

2014-01-01 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jan  1 20:35:38 2014
New Revision: 260166
URL: http://svnweb.freebsd.org/changeset/base/260166

Log:
  Fix race condition in DELAY for SP804 timer.
  
  Fix race condition in DELAY function: sc->tc was not initialized yet when
  time_counter pointer was set, what resulted in NULL pointer dereference.
  
  Export sysfreq to dts.
  
  Submitted by: Wojciech Macek 
  Obtained from:Semihalf

Modified:
  head/sys/arm/versatile/sp804.c

Modified: head/sys/arm/versatile/sp804.c
==
--- head/sys/arm/versatile/sp804.c  Wed Jan  1 20:26:08 2014
(r260165)
+++ head/sys/arm/versatile/sp804.c  Wed Jan  1 20:35:38 2014
(r260166)
@@ -100,6 +100,7 @@ struct sp804_timer_softc {
struct timecounter  tc;
boolet_enabled;
struct eventtimer   et;
+   int timer_initialized;
 };
 
 /* Read/Write macros for Timer used as timecounter */
@@ -198,6 +199,8 @@ sp804_timer_attach(device_t dev)
int rid = 0;
int i;
uint32_t id, reg;
+   phandle_t node;
+   pcell_t clock;
 
sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 
RF_ACTIVE);
if (sc->mem_res == NULL) {
@@ -215,8 +218,12 @@ sp804_timer_attach(device_t dev)
return (ENXIO);
}
 
-   /* TODO: get frequency from FDT */
sc->sysclk_freq = DEFAULT_FREQUENCY;
+   /* Get the base clock frequency */
+   node = ofw_bus_get_node(dev);
+   if ((OF_getprop(node, "clock-frequency", &clock, sizeof(clock))) > 0) {
+   sc->sysclk_freq = fdt32_to_cpu(clock);
+   }
 
/* Setup and enable the timer */
if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_CLK,
@@ -234,8 +241,8 @@ sp804_timer_attach(device_t dev)
/*
 * Timer 1, timecounter
 */
-   sc->tc.tc_frequency = DEFAULT_FREQUENCY;
-   sc->tc.tc_name = "SP804 Timecouter";
+   sc->tc.tc_frequency = sc->sysclk_freq;
+   sc->tc.tc_name = "SP804 Time Counter";
sc->tc.tc_get_timecount = sp804_timer_tc_get_timecount;
sc->tc.tc_poll_pps = NULL;
sc->tc.tc_counter_mask = ~0u;
@@ -283,6 +290,8 @@ sp804_timer_attach(device_t dev)
 
device_printf(dev, "PrimeCell ID: %08x\n", id);
 
+   sc->timer_initialized = 1;
+
return (0);
 }
 
@@ -309,10 +318,18 @@ DELAY(int usec)
uint32_t first, last;
device_t timer_dev;
struct sp804_timer_softc *sc;
+   int timer_initialized = 0;
 
timer_dev = devclass_get_device(sp804_timer_devclass, 0);
 
-   if (timer_dev == NULL) {
+   if (timer_dev) {
+   sc = device_get_softc(timer_dev);
+
+   if (sc)
+   timer_initialized = sc->timer_initialized;
+   }
+
+   if (!timer_initialized) {
/*
 * Timer is not initialized yet
 */
@@ -323,8 +340,6 @@ DELAY(int usec)
return;
}
 
-   sc = device_get_softc(timer_dev);
-
/* Get the number of times to count */
counts = usec * ((sc->tc.tc_frequency / 100) + 1);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r260167 - in head: sys/amd64/include sys/amd64/vmm/intel usr.sbin/bhyve usr.sbin/bhyvectl

2014-01-01 Thread Neel Natu
Author: neel
Date: Wed Jan  1 21:17:08 2014
New Revision: 260167
URL: http://svnweb.freebsd.org/changeset/base/260167

Log:
  Restructure the VMX code to enter and exit the guest. In large part this 
change
  hides the setjmp/longjmp semantics of VM enter/exit. vmx_enter_guest() is used
  to enter guest context and vmx_exit_guest() is used to transition back into
  host context.
  
  Fix a longstanding race where a vcpu interrupt notification might be ignored
  if it happens after vmx_inject_interrupts() but before host interrupts are
  disabled in vmx_resume/vmx_launch. We now called vmx_inject_interrupts() with
  host interrupts disabled to prevent this.
  
  Suggested by: grehan@

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/intel/vmx.h
  head/sys/amd64/vmm/intel/vmx_genassym.c
  head/sys/amd64/vmm/intel/vmx_support.S
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/bhyvectl/bhyvectl.c

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hWed Jan  1 20:35:38 2014
(r260166)
+++ head/sys/amd64/include/vmm.hWed Jan  1 21:17:08 2014
(r260167)
@@ -303,9 +303,19 @@ struct vm_exit {
 * exitcode to represent the VM-exit.
 */
struct {
-   int error;  /* vmx inst error */
+   int status; /* vmx inst status */
+   /*
+* 'exit_reason' and 'exit_qualification' are valid
+* only if 'status' is zero.
+*/
uint32_texit_reason;
uint64_texit_qualification;
+   /*
+* 'inst_error' and 'inst_type' are valid
+* only if 'status' is non-zero.
+*/
+   int inst_type;
+   int inst_error;
} vmx;
struct {
uint32_tcode;   /* ecx value */

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Wed Jan  1 20:35:38 2014
(r260166)
+++ head/sys/amd64/vmm/intel/vmx.c  Wed Jan  1 21:17:08 2014
(r260167)
@@ -288,82 +288,6 @@ exit_reason_to_str(int reason)
return (reasonbuf);
}
 }
-
-#ifdef SETJMP_TRACE
-static const char *
-vmx_setjmp_rc2str(int rc)
-{
-   switch (rc) {
-   case VMX_RETURN_DIRECT:
-   return "direct";
-   case VMX_RETURN_LONGJMP:
-   return "longjmp";
-   case VMX_RETURN_VMRESUME:
-   return "vmresume";
-   case VMX_RETURN_VMLAUNCH:
-   return "vmlaunch";
-   case VMX_RETURN_AST:
-   return "ast";
-   default:
-   return "unknown";
-   }
-}
-
-#defineSETJMP_TRACE(vmx, vcpu, vmxctx, regname)
\
-   VCPU_CTR1((vmx)->vm, (vcpu), "setjmp trace " #regname " 0x%016lx",  \
-(vmxctx)->regname)
-
-static void
-vmx_setjmp_trace(struct vmx *vmx, int vcpu, struct vmxctx *vmxctx, int rc)
-{
-   uint64_t host_rip, host_rsp;
-
-   if (vmxctx != &vmx->ctx[vcpu])
-   panic("vmx_setjmp_trace: invalid vmxctx %p; should be %p",
-   vmxctx, &vmx->ctx[vcpu]);
-
-   VCPU_CTR1((vmx)->vm, (vcpu), "vmxctx = %p", vmxctx);
-   VCPU_CTR2((vmx)->vm, (vcpu), "setjmp return code %s(%d)",
-vmx_setjmp_rc2str(rc), rc);
-
-   host_rip = vmcs_read(VMCS_HOST_RIP);
-   host_rsp = vmcs_read(VMCS_HOST_RSP);
-   VCPU_CTR2((vmx)->vm, (vcpu), "vmcs host_rip 0x%016lx, host_rsp %#lx",
-host_rip, host_rsp);
-
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_r15);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_r14);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_r13);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_r12);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_rbp);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_rsp);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_rbx);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, host_rip);
-
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rdi);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rsi);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rdx);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rcx);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r8);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r9);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rax);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rbx);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rbp);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r10);
-   SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r11);
-   SETJMP_TRACE(vmx, vcpu,

svn commit: r260169 - head/sys/netgraph/netflow

2014-01-01 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan  1 21:48:04 2014
New Revision: 260169
URL: http://svnweb.freebsd.org/changeset/base/260169

Log:
  - Use counter(9) for node stats updated at a high rate.
  - Use simple ++ for rare events.
  - Use uma_zone_get_cur() to get knowledge about space left in cache.
  - Convert many fields of struct ng_netflow_info to 64 bit.
  
  Tested by:Viktor Velichkin 
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netgraph/netflow/netflow.c
  head/sys/netgraph/netflow/netflow_v9.c
  head/sys/netgraph/netflow/ng_netflow.c
  head/sys/netgraph/netflow/ng_netflow.h

Modified: head/sys/netgraph/netflow/netflow.c
==
--- head/sys/netgraph/netflow/netflow.c Wed Jan  1 21:25:13 2014
(r260168)
+++ head/sys/netgraph/netflow/netflow.c Wed Jan  1 21:48:04 2014
(r260169)
@@ -34,16 +34,13 @@ __FBSDID("$FreeBSD$");
 #include "opt_inet6.h"
 #include "opt_route.h"
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-
-#include 
-#include 
 
 #include 
 #include 
@@ -80,8 +77,8 @@ __FBSDID("$FreeBSD$");
 
 /* Macros to shorten logical constructions */
 /* XXX: priv must exist in namespace */
-#defineINACTIVE(fle)   (time_uptime - fle->f.last > 
priv->info.nfinfo_inact_t)
-#defineAGED(fle)   (time_uptime - fle->f.first > 
priv->info.nfinfo_act_t)
+#defineINACTIVE(fle)   (time_uptime - fle->f.last > 
priv->nfinfo_inact_t)
+#defineAGED(fle)   (time_uptime - fle->f.first > 
priv->nfinfo_act_t)
 #defineISFREE(fle) (fle->f.packets == 0)
 
 /*
@@ -149,54 +146,6 @@ ip6_hash(struct flow6_rec *r)
 }
 #endif
 
-/* This is callback from uma(9), called on alloc. */
-static int
-uma_ctor_flow(void *mem, int size, void *arg, int how)
-{
-   priv_p priv = (priv_p )arg;
-
-   if (atomic_load_acq_32(&priv->info.nfinfo_used) >= CACHESIZE)
-   return (ENOMEM);
-
-   atomic_add_32(&priv->info.nfinfo_used, 1);
-
-   return (0);
-}
-
-/* This is callback from uma(9), called on free. */
-static void
-uma_dtor_flow(void *mem, int size, void *arg)
-{
-   priv_p priv = (priv_p )arg;
-
-   atomic_subtract_32(&priv->info.nfinfo_used, 1);
-}
-
-#ifdef INET6
-/* This is callback from uma(9), called on alloc. */
-static int
-uma_ctor_flow6(void *mem, int size, void *arg, int how)
-{
-   priv_p priv = (priv_p )arg;
-
-   if (atomic_load_acq_32(&priv->info.nfinfo_used6) >= CACHESIZE)
-   return (ENOMEM);
-
-   atomic_add_32(&priv->info.nfinfo_used6, 1);
-
-   return (0);
-}
-
-/* This is callback from uma(9), called on free. */
-static void
-uma_dtor_flow6(void *mem, int size, void *arg)
-{
-   priv_p priv = (priv_p )arg;
-
-   atomic_subtract_32(&priv->info.nfinfo_used6, 1);
-}
-#endif
-
 /*
  * Detach export datagram from priv, if there is any.
  * If there is no, allocate a new one.
@@ -267,9 +216,9 @@ expire_flow(priv_p priv, fib_export_p fe
if ((priv->export != NULL) && (version == IPVERSION)) {
exp.item = get_export_dgram(priv, fe);
if (exp.item == NULL) {
-   atomic_add_32(&priv->info.nfinfo_export_failed, 1);
+   priv->nfinfo_export_failed++;
if (priv->export9 != NULL)
-   
atomic_add_32(&priv->info.nfinfo_export9_failed, 1);
+   priv->nfinfo_export9_failed++;
/* fle definitely contains IPv4 flow. */
uma_zfree_arg(priv->zone, fle, priv);
return;
@@ -284,7 +233,7 @@ expire_flow(priv_p priv, fib_export_p fe
if (priv->export9 != NULL) {
exp.item9 = get_export9_dgram(priv, fe, &exp.item9_opt);
if (exp.item9 == NULL) {
-   atomic_add_32(&priv->info.nfinfo_export9_failed, 1);
+   priv->nfinfo_export9_failed++;
if (version == IPVERSION)
uma_zfree_arg(priv->zone, fle, priv);
 #ifdef INET6
@@ -317,8 +266,27 @@ void
 ng_netflow_copyinfo(priv_p priv, struct ng_netflow_info *i)
 {
 
-   /* XXX: atomic */
-   memcpy((void *)i, (void *)&priv->info, sizeof(priv->info));
+   i->nfinfo_bytes = counter_u64_fetch(priv->nfinfo_bytes);
+   i->nfinfo_packets = counter_u64_fetch(priv->nfinfo_packets);
+   i->nfinfo_bytes6 = counter_u64_fetch(priv->nfinfo_bytes6);
+   i->nfinfo_packets6 = counter_u64_fetch(priv->nfinfo_packets6);
+   i->nfinfo_sbytes = counter_u64_fetch(priv->nfinfo_sbytes);
+   i->nfinfo_spackets = counter_u64_fetch(priv->nfinfo_spackets);
+   i->nfinfo_sbytes6 = counter_u64_fetch(priv->nfinfo_sbytes6);
+   i->nfinfo_spackets6 = counter_u64_fetch(priv->nfinfo_spackets6);
+   i->nfinfo_act_exp = counter_u64_fetch(priv->nfinfo_act_exp);
+   i->nfinfo_inact_exp 

svn commit: r260175 - head/sys/ia64/include

2014-01-01 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jan  1 22:51:19 2014
New Revision: 260175
URL: http://svnweb.freebsd.org/changeset/base/260175

Log:
  Implement atomic_swap_.
  The operation was documented and implemented partially (both from a
  type and architecture perspective) on 2013-08-21 and got used in
  ZFS with revision 260150 (zfeature.c) and since ZFS is supported on
  ia64, the lack of having atomic_swap became problem.

Modified:
  head/sys/ia64/include/atomic.h

Modified: head/sys/ia64/include/atomic.h
==
--- head/sys/ia64/include/atomic.h  Wed Jan  1 22:49:37 2014
(r260174)
+++ head/sys/ia64/include/atomic.h  Wed Jan  1 22:51:19 2014
(r260175)
@@ -386,4 +386,32 @@ atomic_fetchadd_long(volatile u_long *p,
return (value);
 }
 
+/*
+ *  atomic_swap_(volatile  *p,  v);
+ */
+
+static __inline uint32_t
+atomic_swap_32(volatile uint32_t *p, uint32_t v)
+{
+   uint32_t r;
+
+   __asm __volatile ("xchg4 %0 = %3, %2;;" : "=r"(r), "=m"(*p) :
+   "r"(v), "m"(*p) : "memory");
+   return (r);
+}
+
+static __inline uint64_t
+atomic_swap_64(volatile uint64_t *p, uint64_t v)
+{
+   uint64_t r;
+
+   __asm __volatile ("xchg8 %0 = %3, %2;;" : "=r"(r), "=m"(*p) :
+   "r"(v), "m"(*p) : "memory");
+   return (r);
+}
+
+#defineatomic_swap_int atomic_swap_32
+#defineatomic_swap_longatomic_swap_64
+#defineatomic_swap_ptr atomic_swap_64
+
 #endif /* ! _MACHINE_ATOMIC_H_ */
___
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: r260151 - head/sys/netinet6

2014-01-01 Thread Andrey V. Elsukov
On 01.01.2014 04:56, Adrian Chadd wrote:
> Author: adrian
> Date: Wed Jan  1 00:56:26 2014
> New Revision: 260151
> URL: http://svnweb.freebsd.org/changeset/base/260151
> 
> Log:
>   Use an RLOCK here instead of an RWLOCK - matching all the other calls
>   to lla_lookup().
>   
>   This drastically reduces the very high lock contention when doing parallel
>   TCP throughput tests (> 1024 sockets) with IPv6.

This is very hackish and not correct.

-- 
WBR, Andrey V. Elsukov
___
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: r260180 - head/sys/dev/nand

2014-01-01 Thread Warner Losh
Author: imp
Date: Thu Jan  2 02:20:10 2014
New Revision: 260180
URL: http://svnweb.freebsd.org/changeset/base/260180

Log:
  Make the comment match the code. Not sure why we calculate it this
  weird way, but didn't change that...

Modified:
  head/sys/dev/nand/nandbus.c

Modified: head/sys/dev/nand/nandbus.c
==
--- head/sys/dev/nand/nandbus.c Thu Jan  2 01:51:54 2014(r260179)
+++ head/sys/dev/nand/nandbus.c Thu Jan  2 02:20:10 2014(r260180)
@@ -503,7 +503,7 @@ nandbus_wait_ready(device_t dev, uint8_t
struct timeval tv, tv2;
 
tv2.tv_sec = 0;
-   tv2.tv_usec = 50 * 5000; /* 10ms */
+   tv2.tv_usec = 50 * 5000; /* 250ms */
 
getmicrotime(&tv);
timevaladd(&tv, &tv2);
___
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: r260151 - head/sys/netinet6

2014-01-01 Thread Adrian Chadd
Why not?

Adrian
On Jan 1, 2014 6:13 PM, "Andrey V. Elsukov"  wrote:

> On 01.01.2014 04:56, Adrian Chadd wrote:
> > Author: adrian
> > Date: Wed Jan  1 00:56:26 2014
> > New Revision: 260151
> > URL: http://svnweb.freebsd.org/changeset/base/260151
> >
> > Log:
> >   Use an RLOCK here instead of an RWLOCK - matching all the other calls
> >   to lla_lookup().
> >
> >   This drastically reduces the very high lock contention when doing
> parallel
> >   TCP throughput tests (> 1024 sockets) with IPv6.
>
> This is very hackish and not correct.
>
> --
> WBR, Andrey V. Elsukov
>
___
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: r260181 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-01-01 Thread Xin LI
Author: delphij
Date: Thu Jan  2 03:24:44 2014
New Revision: 260181
URL: http://svnweb.freebsd.org/changeset/base/260181

Log:
  Fix build on platforms where atomic_swap_64 is not available.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c  Thu Jan 
 2 02:20:10 2014(r260180)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c  Thu Jan 
 2 03:24:44 2014(r260181)
@@ -312,8 +312,12 @@ feature_sync(spa_t *spa, zfeature_info_t
if (feature->fi_feature != SPA_FEATURE_NONE) {
uint64_t *refcount_cache =
&spa->spa_feat_refcount_cache[feature->fi_feature];
+#ifdef atomic_swap_64
VERIFY3U(*refcount_cache, ==,
atomic_swap_64(refcount_cache, refcount));
+#else
+   *refcount_cache = refcount;
+#endif
}
 
if (refcount == 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"


Re: svn commit: r260151 - head/sys/netinet6

2014-01-01 Thread Andrey V. Elsukov
On 02.01.2014 06:51, Adrian Chadd wrote:
> Why not?

Hi, Adrian,

now, after a deeper look I think it is ok. Sorry.
Also there are several places where wlock can be changed to rlock.

-- 
WBR, Andrey V. Elsukov
___
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: r260151 - head/sys/netinet6

2014-01-01 Thread Adrian Chadd
On 1 January 2014 21:53, Andrey V. Elsukov  wrote:
> On 02.01.2014 06:51, Adrian Chadd wrote:
>> Why not?
>
> Hi, Adrian,
>
> now, after a deeper look I think it is ok. Sorry.
> Also there are several places where wlock can be changed to rlock.

Cool commit away!

Thanks!



-a
___
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: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensol

2014-01-01 Thread Stanislav Sedov

On Sep 4, 2013, at 5:09 PM, Pawel Jakub Dawidek  wrote:

>  This commit also breaks compatibility with some existing Capsicum system 
> calls,
>  but I see no other way to do that. This should be fine as Capsicum is still
>  experimental and this change is not going to 9.x.

Hi!

This change also increases the size of kinfo_file structure, which won’t allow
programs not compiled against HEAD and working with kern.info.filedesc sysctl
to run properly on HEAD (e.g. 8.x, 9.x and 10.x jails won’t run properly on 
HEAD,
and it also broke valgrind).  Is there absolutely no way to avoid extending the 
size
of this struct?

Thanks!

>  #if defined(__amd64__) || defined(__i386__)
> -#defineKINFO_FILE_SIZE 1392
> +#defineKINFO_FILE_SIZE 1424
>  #endif
>  
>  struct kinfo_file {
> @@ -389,6 +390,7 @@
> uint16_tkf_pad1;/* Round to 32 bit alignment. 
> */
> int _kf_ispare0;/* Space for more stuff. */
> cap_rights_tkf_cap_rights;  /* Capability rights. */
> +   uint64_t_kf_cap_spare[3];   /* Space for future 
> cap_rights_t. */
> int _kf_ispare[4];  /* Space for more stuff. */
> /* Truncated before copyout in sysctl */
> charkf_path[PATH_MAX];  /* Path to file, if any. */

--
ST4096-RIPE



___
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: r260183 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common cddl/co...

2014-01-01 Thread Xin LI
Author: delphij
Date: Thu Jan  2 07:34:36 2014
New Revision: 260183
URL: http://svnweb.freebsd.org/changeset/base/260183

Log:
  MFV r260154 + 260182:
  
  4369 implement zfs bookmarks
  4368 zfs send filesystems from readonly pools
  
  Illumos/illumos-gate@78f171005391b928aaf1642b3206c534ed644332
  
  MFC after:2 weeks

Added:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
 - copied unchanged from r260154, 
vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h
 - copied unchanged from r260154, 
vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_bookmark.h
Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
  head/cddl/contrib/opensolaris/lib/pyzfs/common/allow.py
  head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
  head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
  head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
  head/sys/conf/files
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan  2 04:55:23 2014
(r260182)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan  2 07:34:36 2014
(r260183)
@@ -18,7 +18,7 @@
 .\" information: Portions Copyright [] [name of copyright owner]
 .\"
 .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright (c) 2012 by Delphix. All rights reserved.
+.\" Copyright (c) 2013 by Delphix. All rights reserved.
 .\" Copyright (c) 2011, Pawel Jakub Dawidek 
 .\" Copyright (c) 2012, Glen Barber 
 .\" Copyright (c) 2012, Bryan Drewery 
@@ -26,10 +26,11 @@
 .\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved.
 .\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
 .\" Copyright (c) 2013, Steven Hartland 
+.\" Copyright (c) 2014, Xin LI 
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 24, 2013
+.Dd January 2, 2014
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -57,11 +58,16 @@
 .Cm destroy
 .Op Fl dnpRrv
 .Sm off
-.Ar snapshot
-.Op % Ns Ar snapname
+.Ar filesystem Ns | Ns volume
+.Ns @snap
+.Op % Ns Ar snap
+.Op , Ns Ar snap Op % Ns Ar snap
 .Op , Ns ...
 .Sm on
 .Nm
+.Cm destroy
+.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
+.Nm
 .Cm snapshot Ns | Ns Cm snap
 .Op Fl r
 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
@@ -168,11 +174,19 @@
 .Cm unshare
 .Fl a | Ar filesystem Ns | Ns Ar mountpoint
 .Nm
+.Cm bookmark
+.Ar snapshot
+.Ar bookmark
+.Nm
 .Cm send
 .Op Fl DnPpRv
 .Op Fl i Ar snapshot | Fl I Ar snapshot
 .Ar snapshot
 .Nm
+.Cm send
+.Op Fl i Ar snapshot Ns | Ns bookmark
+.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
+.Nm
 .Cm receive Ns | Ns Cm recv
 .Op Fl vnFu
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
@@ -1654,6 +1668,13 @@ options, as they can destroy large porti
 behavior for mounted file systems in use.
 .It Xo
 .Nm
+.Cm destroy
+.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
+.Xc
+.Pp
+The given bookmark is destroyed.
+.It Xo
+.Nm
 .Cm snapshot Ns | Ns