Re: svn commit: r295465 - head/usr.sbin/services_mkdb

2016-02-11 Thread David Malone
On Wed, Feb 10, 2016 at 09:40:45AM +, Stefan Esser wrote:
> Author: se
> Date: Wed Feb 10 09:40:45 2016
> New Revision: 295465
> URL: https://svnweb.freebsd.org/changeset/base/295465
> 
> Log:
>   Remove O_SYNC from the options passed to dbmopen().
>   
>   The services db is created as a temporary file that is moved over the
>   existing file after completion. Thus there is no need to immediately
>   flush all created db records to the temporary file.

This was changed to fix a problem with fsync not being called, which
can leave the db files empty after a sudden reboot. O_SYNC is not
the right fix, but I think I've found the real problem and there
is an open phabricator report on this, which fixes the problem in
a better way:

https://reviews.freebsd.org/D5186

Reviews appreciated.

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


svn commit: r295558 - head/sys/dev/hwpmc

2016-02-11 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 12 07:19:59 2016
New Revision: 295558
URL: https://svnweb.freebsd.org/changeset/base/295558

Log:
  Remove tautological cast.
  
  PR:   207068
  Submitted by: joss.up...@yahoo.com
  MFC after:2 weeks

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==
--- head/sys/dev/hwpmc/hwpmc_mod.c  Fri Feb 12 05:14:58 2016
(r295557)
+++ head/sys/dev/hwpmc/hwpmc_mod.c  Fri Feb 12 07:19:59 2016
(r295558)
@@ -1483,7 +1483,7 @@ pmc_process_csw_out(struct thread *td)
 * increasing monotonically, modulo a 64
 * bit wraparound.
 */
-   KASSERT((int64_t) tmp >= 0,
+   KASSERT(tmp >= 0,
("[pmc,%d] negative increment cpu=%d "
 "ri=%d newvalue=%jx saved=%jx "
 "incr=%jx", __LINE__, cpu, ri,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295559 - head/sys/sys

2016-02-11 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 12 07:20:27 2016
New Revision: 295559
URL: https://svnweb.freebsd.org/changeset/base/295559

Log:
  Adjust the size of PMC_DEFAULT_DEBUG_FLAGS to match the size of the
  structure.
  
  PR:   207068
  Submitted by: joss.up...@yahoo.com
  MFC after:2 weeks

Modified:
  head/sys/sys/pmc.h

Modified: head/sys/sys/pmc.h
==
--- head/sys/sys/pmc.h  Fri Feb 12 07:19:59 2016(r295558)
+++ head/sys/sys/pmc.h  Fri Feb 12 07:20:27 2016(r295559)
@@ -1033,7 +1033,7 @@ extern struct pmc_debugflags pmc_debugfl
 #defineKTR_PMC KTR_SUBSYS
 
 #definePMC_DEBUG_STRSIZE   128
-#definePMC_DEBUG_DEFAULT_FLAGS { 0, 0, 0, 0, 0, 0, 0, 0 }
+#definePMC_DEBUG_DEFAULT_FLAGS { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
 
 #definePMCDBG0(M, N, L, F) do {
\
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N))  \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295560 - head/sys/dev/hwpmc

2016-02-11 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 12 07:27:24 2016
New Revision: 295560
URL: https://svnweb.freebsd.org/changeset/base/295560

Log:
  If full width writes to the performance monitoring counters are
  supported, use full-width aliases MSRs for writes.  This fixes the
  "[pmc,X] negative increment" assertion on the context switch when
  clipped counter value is sign-extended.
  
  Add definitions for the MSR IA32_PERF_CAPABILITIES needed to detect
  the feature.
  
  PR:   207068
  Submitted by: joss.up...@yahoo.com
  MFC after:2 weeks

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_core.h

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==
--- head/sys/dev/hwpmc/hwpmc_core.c Fri Feb 12 07:20:27 2016
(r295559)
+++ head/sys/dev/hwpmc/hwpmc_core.c Fri Feb 12 07:27:24 2016
(r295560)
@@ -103,6 +103,7 @@ static int core_iaf_npmc;
 
 static int core_iap_width;
 static int core_iap_npmc;
+static int core_iap_wroffset;
 
 static int
 core_pcpu_noop(struct pmc_mdep *md, int cpu)
@@ -2473,7 +2474,7 @@ iap_read_pmc(int cpu, int ri, pmc_value_
*v = tmp & ((1ULL << core_iap_width) - 1);
 
PMCDBG4(MDP,REA,1, "iap-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
-   ri, *v);
+   IAP_PMC0 + ri, *v);
 
return (0);
 }
@@ -2605,19 +2606,20 @@ iap_write_pmc(int cpu, int ri, pmc_value
("[core,%d] cpu%d ri%d no configured PMC to stop", __LINE__,
cpu, ri));
 
-   PMCDBG4(MDP,WRI,1, "iap-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
-   IAP_PMC0 + ri, v);
-
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
v = iap_reload_count_to_perfctr_value(v);
 
-   /*
-* Write the new value to the counter.  The counter will be in
-* a stopped state when the pcd_write() entry point is called.
-*/
+   v &= (1ULL << core_iap_width) - 1;
 
-   wrmsr(IAP_PMC0 + ri, v & ((1ULL << core_iap_width) - 1));
+   PMCDBG4(MDP,WRI,1, "iap-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
+   IAP_PMC0 + ri, v);
 
+   /*
+* Write the new value to the counter (or it's alias).  The
+* counter will be in a stopped state when the pcd_write()
+* entry point is called.
+*/
+   wrmsr(core_iap_wroffset + IAP_PMC0 + ri, v);
return (0);
 }
 
@@ -2700,7 +2702,7 @@ core_intr(int cpu, struct trapframe *tf)
 */
msr = rdmsr(IAP_EVSEL0 + ri) & ~IAP_EVSEL_MASK;
wrmsr(IAP_EVSEL0 + ri, msr);
-   wrmsr(IAP_PMC0 + ri, v);
+   wrmsr(core_iap_wroffset + IAP_PMC0 + ri, v);
 
if (error)
continue;
@@ -2814,7 +2816,7 @@ core2_intr(int cpu, struct trapframe *tf
(uintmax_t) v);
 
/* Reload sampling count. */
-   wrmsr(IAP_PMC0 + n, v);
+   wrmsr(core_iap_wroffset + IAP_PMC0 + n, v);
}
 
/*
@@ -2865,6 +2867,18 @@ pmc_core_initialize(struct pmc_mdep *md,
return (EPROGMISMATCH);
}
 
+   core_iap_wroffset = 0;
+   if (cpu_feature2 & CPUID2_PDCM) {
+   if (rdmsr(IA32_PERF_CAPABILITIES) & PERFCAP_FW_WRITE) {
+   PMCDBG0(MDP, INI, 1,
+   "core-init full-width write supported");
+   core_iap_wroffset = IAP_A_PMC0 - IAP_PMC0;
+   } else
+   PMCDBG0(MDP, INI, 1,
+   "core-init full-width write NOT supported");
+   } else
+   PMCDBG0(MDP, INI, 1, "core-init pdcm not supported");
+
core_pmcmask = 0;
 
/*

Modified: head/sys/dev/hwpmc/hwpmc_core.h
==
--- head/sys/dev/hwpmc/hwpmc_core.h Fri Feb 12 07:20:27 2016
(r295559)
+++ head/sys/dev/hwpmc/hwpmc_core.h Fri Feb 12 07:27:24 2016
(r295560)
@@ -29,6 +29,14 @@
 #ifndef _DEV_HWPMC_CORE_H_
 #define_DEV_HWPMC_CORE_H_ 1
 
+#defineIA32_PERF_CAPABILITIES  0x345
+#definePERFCAP_LBR_FORMAT  0x003f
+#definePERFCAP_PEBS_TRAP   0x0040
+#definePERFCAP_PEBS_SAVEARCH   0x0080
+#definePERFCAP_PEBS_RECFORMAT  0x0f00
+#definePERFCAP_SMM_FREEZE  0x1000
+#definePERFCAP_FW_WRITE0x2000  /* full width write 
aliases */
+
 /*
  * Fixed-function PMCs.
  */
@@ -101,6 +109,7 @@ struct pmc_md_iap_op_pmcallocate {
  */
 
 #defineIAP_PMC00x0C1
+#defineIAP_A_PMC0  0x4C1
 
 /*
  * IAP_EVSEL(n) is laid out in the following way.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail 

svn commit: r295561 - in head: include sys/mips/include sys/powerpc/include sys/sparc64/include sys/sys sys/x86/include

2016-02-11 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 12 07:38:19 2016
New Revision: 295561
URL: https://svnweb.freebsd.org/changeset/base/295561

Log:
  POSIX states that #include  shall make both mcontext_t and
  ucontext_t available.  Our code even has XXX comment about this.
  
  Add a bit of compliance by moving struct __ucontext definition into
  sys/_ucontext.h and including it into signal.h and sys/ucontext.h.
  
  Several machine/ucontext.h headers were changed to use namespace-safe
  types (like uint64_t->__uint64_t) to not depend on sys/types.h.
  struct __stack_t from sys/signal.h is made always visible in private
  namespace to satisfy sys/_ucontext.h requirements.
  
  Apparently mips _types.h pollutes global namespace with f_register_t
  type definition.  This commit does not try to fix the issue.
  
  PR:   207079
  Reported and tested by:   Ting-Wei Lan 
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Added:
  head/sys/sys/_ucontext.h
 - copied, changed from r295560, head/sys/sys/ucontext.h
Modified:
  head/include/signal.h
  head/sys/mips/include/ucontext.h
  head/sys/powerpc/include/ucontext.h
  head/sys/sparc64/include/ucontext.h
  head/sys/sys/signal.h
  head/sys/sys/ucontext.h
  head/sys/x86/include/ucontext.h

Modified: head/include/signal.h
==
--- head/include/signal.h   Fri Feb 12 07:27:24 2016(r295560)
+++ head/include/signal.h   Fri Feb 12 07:38:19 2016(r295561)
@@ -36,6 +36,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #if __BSD_VISIBLE
 /*
@@ -114,7 +116,6 @@ voidpsignal(unsigned int, const char *)
 
 #if __BSD_VISIBLE
 intsigblock(int);
-struct __ucontext; /* XXX spec requires a complete declaration. */
 intsigreturn(const struct __ucontext *);
 intsigsetmask(int);
 intsigstack(const struct sigstack *, struct sigstack *);

Modified: head/sys/mips/include/ucontext.h
==
--- head/sys/mips/include/ucontext.hFri Feb 12 07:27:24 2016
(r295560)
+++ head/sys/mips/include/ucontext.hFri Feb 12 07:38:19 2016
(r295561)
@@ -50,13 +50,13 @@ typedef struct  __mcontext {
 * struct sigcontext and ucontext_t at the same time.
 */
int mc_onstack; /* sigstack state to restore */
-   register_t  mc_pc;  /* pc at time of signal */
-   register_t  mc_regs[32];/* processor regs 0 to 31 */
-   register_t  sr; /* status register */
-   register_t  mullo, mulhi;   /* mullo and mulhi registers... */
+   __register_tmc_pc;  /* pc at time of signal */
+   __register_tmc_regs[32];/* processor regs 0 to 31 */
+   __register_tsr; /* status register */
+   __register_tmullo, mulhi;   /* mullo and mulhi registers... */
int mc_fpused;  /* fp has been used */
f_register_tmc_fpregs[33];  /* fp regs 0 to 31 and csr */
-   register_t  mc_fpc_eir; /* fp exception instruction reg */
+   __register_tmc_fpc_eir; /* fp exception instruction reg */
void*mc_tls;/* pointer to TLS area */
int __spare__[8];   /* XXX reserved */ 
 } mcontext_t;

Modified: head/sys/powerpc/include/ucontext.h
==
--- head/sys/powerpc/include/ucontext.h Fri Feb 12 07:27:24 2016
(r295560)
+++ head/sys/powerpc/include/ucontext.h Fri Feb 12 07:38:19 2016
(r295561)
@@ -42,11 +42,11 @@ typedef struct __mcontext {
 #define _MC_AV_VALID   0x02
int mc_onstack; /* saved onstack flag */
int mc_len; /* sizeof(__mcontext) */
-   uint64_tmc_avec[32*2];  /* vector register file */
-   uint32_tmc_av[2];
-   register_t  mc_frame[42];
-   uint64_tmc_fpreg[33];
-   uint64_tmc_vsxfpreg[32];/* low-order half of VSR0-31 */
+   __uint64_t  mc_avec[32*2];  /* vector register file */
+   __uint32_t  mc_av[2];
+   __register_tmc_frame[42];
+   __uint64_t  mc_fpreg[33];
+   __uint64_t  mc_vsxfpreg[32];/* low-order half of VSR0-31 */
 } mcontext_t __aligned(16);
 
 #if defined(_KERNEL) && defined(__powerpc64__)

Modified: head/sys/sparc64/include/ucontext.h
==
--- head/sys/sparc64/include/ucontext.h Fri Feb 12 07:27:24 2016
(r295560)
+++ head/sys/sparc64/include/ucontext.h Fri Feb 12 07:38:19 2016
(r295561)
@@ -33,11 +33,11 @@
 #define_MACHINE_UCONTEXT_H_
 
 struct __mcontext {
-   uint64_t mc_global[8];
-   uint64_t mc_out[8];
-   uint64_t mc_local[8];
- 

svn commit: r295557 - head/sys/dev/uart

2016-02-11 Thread Michal Meloun
Author: mmel
Date: Fri Feb 12 05:14:58 2016
New Revision: 295557
URL: https://svnweb.freebsd.org/changeset/base/295557

Log:
  UART: Fix spurious interrupts generated by ns8250 and lpc drivers:
   - don't enable transmitter empty interrupt before filling TX FIFO.
   - add missing uart_barrier() call in interrupt service routine

Modified:
  head/sys/dev/uart/uart_dev_lpc.c
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_lpc.c
==
--- head/sys/dev/uart/uart_dev_lpc.cFri Feb 12 02:53:44 2016
(r295556)
+++ head/sys/dev/uart/uart_dev_lpc.cFri Feb 12 05:14:58 2016
(r295557)
@@ -659,6 +659,7 @@ lpc_ns8250_bus_ipend(struct uart_softc *
if (iir & IIR_TXRDY) {
ipend |= SER_INT_TXIDLE;
uart_setreg(bas, REG_IER, lpc_ns8250->ier);
+   uart_barrier(bas);
} else
ipend |= SER_INT_SIGCHG;
}
@@ -892,12 +893,12 @@ lpc_ns8250_bus_transmit(struct uart_soft
uart_lock(sc->sc_hwmtx);
while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
;
-   uart_setreg(bas, REG_IER, lpc_ns8250->ier | IER_ETXRDY);
-   uart_barrier(bas);
for (i = 0; i < sc->sc_txdatasz; i++) {
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);
}
+   uart_setreg(bas, REG_IER, lpc_ns8250->ier | IER_ETXRDY);
+   uart_barrier(bas);
sc->sc_txbusy = 1;
uart_unlock(sc->sc_hwmtx);
return (0);

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Fri Feb 12 02:53:44 2016
(r295556)
+++ head/sys/dev/uart/uart_dev_ns8250.c Fri Feb 12 05:14:58 2016
(r295557)
@@ -708,6 +708,7 @@ ns8250_bus_ipend(struct uart_softc *sc)
if (iir & IIR_TXRDY) {
ipend |= SER_INT_TXIDLE;
uart_setreg(bas, REG_IER, ns8250->ier);
+   uart_barrier(bas);
} else
ipend |= SER_INT_SIGCHG;
}
@@ -979,12 +980,12 @@ ns8250_bus_transmit(struct uart_softc *s
uart_lock(sc->sc_hwmtx);
while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
;
-   uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY);
-   uart_barrier(bas);
for (i = 0; i < sc->sc_txdatasz; i++) {
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);
}
+   uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY);
+   uart_barrier(bas);
if (broken_txfifo)
ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295511 - head/sys/dev/xen/netfront

2016-02-11 Thread Roger Pau Monné
Author: royger
Date: Thu Feb 11 11:53:32 2016
New Revision: 295511
URL: https://svnweb.freebsd.org/changeset/base/295511

Log:
  xen-netfront: rearrange error paths in setup_txqs
  
  Coverity spotted double free errors in error path. Fix that by
  removing the extraneous calls.
  
  Coverity ID:  1349798
  Submitted by: Wei Liu 
  Reviewed by:  royger
  Sponsored by: Citrix Systems R
  Differential revision:https://reviews.freebsd.org/D5251

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Feb 11 11:50:31 2016
(r295510)
+++ head/sys/dev/xen/netfront/netfront.cThu Feb 11 11:53:32 2016
(r295511)
@@ -906,11 +906,9 @@ setup_txqs(device_t dev, struct netfront
 fail_bind_port:
taskqueue_drain_all(txq->tq);
 fail_start_thread:
-   gnttab_free_grant_references(txq->gref_head);
-   free(txq->ring.sring, M_DEVBUF);
-   gnttab_end_foreign_access_ref(txq->ring_ref);
buf_ring_free(txq->br, M_DEVBUF);
taskqueue_free(txq->tq);
+   gnttab_end_foreign_access_ref(txq->ring_ref);
 fail_grant_ring:
gnttab_free_grant_references(txq->gref_head);
free(txq->ring.sring, M_DEVBUF);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295522 - head/share/man/man8

2016-02-11 Thread Ed Maste
Author: emaste
Date: Thu Feb 11 14:45:18 2016
New Revision: 295522
URL: https://svnweb.freebsd.org/changeset/base/295522

Log:
  Explain that boot1.efi prefers ZFS over UFS
  
  Reported by:  smh

Modified:
  head/share/man/man8/uefi.8

Modified: head/share/man/man8/uefi.8
==
--- head/share/man/man8/uefi.8  Thu Feb 11 13:28:52 2016(r295521)
+++ head/share/man/man8/uefi.8  Thu Feb 11 14:45:18 2016(r295522)
@@ -92,6 +92,13 @@ for
 The search begins with partitions on the device from which
 .Pa boot1.efi
 was loaded, and continues with other available partitions.
+If both
+.Li freebsd-ufs
+and
+.Li freebsd-zfs
+partitions exist on the same device the
+.Li freebsd-zfs
+partition is preferred.
 .Pa boot1.efi
 then loads and executes
 .Pa loader.efi .
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r295523 - head/sys/fs/ext2fs

2016-02-11 Thread Pedro Giffuni



On 02/11/16 11:54, Bruce Evans wrote:

On Thu, 11 Feb 2016, Pedro F. Giffuni wrote:


Log:
 Ext4: Use boolean type instead of '0' and '1'

 There are precedents of uses of bool in the kernel and
 it is incorrect style to use integers as replacement for
 a boolean type.


This is all backwards.

It is correct style to use integers to represent booleans.



We had this same discussion for ddb.
You didn't agree there either though.



There are precedents for breaking this style by using the
bool type, but not many in fs code:



This line of code (from ext2_bmap.c):

 if (path.ep_is_sparse)

is correct only of ep_is_sparse is boolean. If it is an int
it has to be rewritten as:

 if (path.ep_is_sparse != 0)

I chose to keep it boolean.


In all of /sys/fs/*, there were just 12 lines of declarations
that use 'bool'.  All of these were in autofs.  Now there are
13 such lines (1 more in ext2fs).  1 use is especially useless
and especially unlikely to be all uses of booleans.



The age of the code matters. Ext2 has a lot of code copy/pasted
from UFS and it is useful to keep it similar.
The ext4 code is new, I don't expect to maintain the exact style
unless it's documented as part of style(9).

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


Re: svn commit: r294327 - in head/sys: dev/cxgb dev/cxgbe dev/e1000 dev/hyperv/netvsc dev/ixgbe dev/mxge netinet sys

2016-02-11 Thread Pedro Giffuni



On 02/11/16 11:47, Warner Losh wrote:



On Wed, Feb 10, 2016 at 8:08 AM, Pedro Giffuni 

svn commit: r295510 - head/sys/dev/xen/netfront

2016-02-11 Thread Roger Pau Monné
Author: royger
Date: Thu Feb 11 11:50:31 2016
New Revision: 295510
URL: https://svnweb.freebsd.org/changeset/base/295510

Log:
  xen-netfront: remove pointless assignment in xn_ioctl
  
  The variable error is assigned to 0 before entering the switch.
  Assigning error to 0 before break pointless rewrites the real error
  value that should be returned.
  
  Coverity ID:  1304974
  Submitted by: Wei Liu 
  Reviewed by:  royger
  Sponsored by: Citrix Systems R
  Differential revision:https://reviews.freebsd.org/D5250

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Feb 11 11:49:27 2016
(r295509)
+++ head/sys/dev/xen/netfront/netfront.cThu Feb 11 11:50:31 2016
(r295510)
@@ -1863,7 +1863,6 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, 
}
sc->xn_if_flags = ifp->if_flags;
XN_UNLOCK(sc);
-   error = 0;
break;
case SIOCSIFCAP:
mask = ifr->ifr_reqcap ^ ifp->if_capenable;
@@ -1898,7 +1897,6 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, 
ifp->if_capenable ^= IFCAP_LRO;
 
}
-   error = 0;
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295517 - head/sys/arm64/arm64

2016-02-11 Thread Zbigniew Bodek
Author: zbb
Date: Thu Feb 11 12:01:33 2016
New Revision: 295517
URL: https://svnweb.freebsd.org/changeset/base/295517

Log:
  Initially bind all interrupts to the boot CPU when using GICv3
  
  This should be done by routing all interrupts to CPU0,
  different assignment will be induced by either interrupts
  shuffling or bus_bind_intr().
  
  Reviewed by:   wma
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Differential Revision: https://reviews.freebsd.org/D5229

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_its.c

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Thu Feb 11 11:59:32 2016
(r295516)
+++ head/sys/arm64/arm64/gic_v3.c   Thu Feb 11 12:01:33 2016
(r295517)
@@ -565,7 +565,7 @@ gic_v3_dist_init(struct gic_v3_softc *sc
/*
 * 4. Route all interrupts to boot CPU.
 */
-   aff = CPU_AFFINITY(PCPU_GET(cpuid));
+   aff = CPU_AFFINITY(0);
for (i = GIC_FIRST_SPI; i < sc->gic_nirqs; i++)
gic_d_write(sc, 4, GICD_IROUTER(i), aff);
 

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Thu Feb 11 11:59:32 2016
(r295516)
+++ head/sys/arm64/arm64/gic_v3_its.c   Thu Feb 11 12:01:33 2016
(r295517)
@@ -1430,10 +1430,10 @@ its_device_alloc_locked(struct gic_v3_it
}
 
/*
-* XXX ARM64TODO: Currently all interrupts are going
-* to be bound to the CPU that performs the configuration.
+* Initially all interrupts go to CPU0 but can be moved
+* to another CPU by bus_bind_intr() or interrupts shuffling.
 */
-   cpuid = PCPU_GET(cpuid);
+   cpuid = 0;
newdev->col = sc->its_cols[cpuid];
 
TAILQ_INSERT_TAIL(>its_dev_list, newdev, entry);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295512 - in head/sys/arm64: arm64 include

2016-02-11 Thread Zbigniew Bodek
Author: zbb
Date: Thu Feb 11 11:55:37 2016
New Revision: 295512
URL: https://svnweb.freebsd.org/changeset/base/295512

Log:
  Minor clean-ups for ARM64 GICv3 and GIC drivers
  
  GICv3:
  - move ICC_SGI1R_EL1 definitions to armreg.h and use proper system
register's names
  GIC:
  - remove unused functions
  
  Reviewed by:   andrew
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Differential Revision: https://reviews.freebsd.org/D5119

Modified:
  head/sys/arm64/arm64/gic.c
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_reg.h
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/arm64/gic.c
==
--- head/sys/arm64/arm64/gic.c  Thu Feb 11 11:53:32 2016(r295511)
+++ head/sys/arm64/arm64/gic.c  Thu Feb 11 11:55:37 2016(r295512)
@@ -303,29 +303,6 @@ gic_ipi_send(device_t dev, cpuset_t cpus
 
gic_d_write_4(sc, GICD_SGIR(0), val | ipi);
 }
-
-static int
-arm_gic_ipi_read(device_t dev, int i)
-{
-
-   if (i != -1) {
-   /*
-* The intr code will automagically give the frame pointer
-* if the interrupt argument is 0.
-*/
-   if ((unsigned int)i > 16)
-   return (0);
-   return (i);
-   }
-
-   return (0x3ff);
-}
-
-static void
-arm_gic_ipi_clear(device_t dev, int ipi)
-{
-   /* no-op */
-}
 #endif
 
 static device_method_t arm_gic_methods[] = {

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Thu Feb 11 11:53:32 2016
(r295511)
+++ head/sys/arm64/arm64/gic_v3.c   Thu Feb 11 11:55:37 2016
(r295512)
@@ -412,14 +412,15 @@ gic_v3_ipi_send(device_t dev, cpuset_t c
}
}
if (tlist) {
-   KASSERT((tlist & ~GICI_SGI_TLIST_MASK) == 0,
+   KASSERT((tlist & ~ICC_SGI1R_EL1_TL_MASK) == 0,
("Target list too long for GICv3 IPI"));
/* Send SGI to CPUs in target list */
val = tlist;
-   val |= (uint64_t)CPU_AFF3(aff) << GICI_SGI_AFF3_SHIFT;
-   val |= (uint64_t)CPU_AFF2(aff) << GICI_SGI_AFF2_SHIFT;
-   val |= (uint64_t)CPU_AFF1(aff) << GICI_SGI_AFF1_SHIFT;
-   val |= (uint64_t)(ipi & GICI_SGI_IPI_MASK) << 
GICI_SGI_IPI_SHIFT;
+   val |= (uint64_t)CPU_AFF3(aff) << 
ICC_SGI1R_EL1_AFF3_SHIFT;
+   val |= (uint64_t)CPU_AFF2(aff) << 
ICC_SGI1R_EL1_AFF2_SHIFT;
+   val |= (uint64_t)CPU_AFF1(aff) << 
ICC_SGI1R_EL1_AFF1_SHIFT;
+   val |= (uint64_t)(ipi & ICC_SGI1R_EL1_SGIID_MASK) <<
+   ICC_SGI1R_EL1_SGIID_SHIFT;
gic_icc_write(SGI1R, val);
}
}

Modified: head/sys/arm64/arm64/gic_v3_reg.h
==
--- head/sys/arm64/arm64/gic_v3_reg.h   Thu Feb 11 11:53:32 2016
(r295511)
+++ head/sys/arm64/arm64/gic_v3_reg.h   Thu Feb 11 11:55:37 2016
(r295512)
@@ -356,12 +356,6 @@
 /*
  * CPU interface
  */
-#defineGICI_SGI_TLIST_MASK (0xUL)
-#defineGICI_SGI_AFF1_SHIFT (16UL)
-#defineGICI_SGI_AFF2_SHIFT (32UL)
-#defineGICI_SGI_AFF3_SHIFT (48UL)
-#defineGICI_SGI_IPI_MASK   (0xfUL)
-#defineGICI_SGI_IPI_SHIFT  (24UL)
 
 /*
  * Registers list (ICC_xyz_EL1):

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Thu Feb 11 11:53:32 2016
(r295511)
+++ head/sys/arm64/include/armreg.h Thu Feb 11 11:55:37 2016
(r295512)
@@ -118,6 +118,15 @@
 /* ICC_PMR_EL1 */
 #defineICC_PMR_EL1_PRIO_MASK   (0xFFUL)
 
+/* ICC_SGI1R_EL1 */
+#defineICC_SGI1R_EL1_TL_MASK   0xUL
+#defineICC_SGI1R_EL1_AFF1_SHIFT16
+#defineICC_SGI1R_EL1_SGIID_SHIFT   24
+#defineICC_SGI1R_EL1_AFF2_SHIFT32
+#defineICC_SGI1R_EL1_AFF3_SHIFT48
+#defineICC_SGI1R_EL1_SGIID_MASK0xfUL
+#defineICC_SGI1R_EL1_IRM   (0x1UL << 40)
+
 /* ICC_SRE_EL1 */
 #defineICC_SRE_EL1_SRE (1U << 0)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295518 - head/sys/arm64/arm64

2016-02-11 Thread Zbigniew Bodek
Author: zbb
Date: Thu Feb 11 12:03:11 2016
New Revision: 295518
URL: https://svnweb.freebsd.org/changeset/base/295518

Log:
  Implement finer locking in ITS
  
  - Change locks' names to be more suitable
  - Don't use blocking mutex. Lock only basic operations such
as lists or bitmaps modifications.
  
  Reviewed by:   wma
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Differential Revision: https://reviews.freebsd.org/D5230

Modified:
  head/sys/arm64/arm64/gic_v3_its.c
  head/sys/arm64/arm64/gic_v3_var.h

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Thu Feb 11 12:01:33 2016
(r295517)
+++ head/sys/arm64/arm64/gic_v3_its.c   Thu Feb 11 12:03:11 2016
(r295518)
@@ -197,9 +197,9 @@ gic_v3_its_attach(device_t dev)
 * Initialize sleep & spin mutex for ITS
 */
/* Protects ITS device list and assigned LPIs bitmaps. */
-   mtx_init(>its_mtx, "ITS sleep lock", NULL, MTX_DEF);
+   mtx_init(>its_dev_lock, "ITS dev lock", NULL, MTX_SPIN);
/* Protects access to ITS command circular buffer. */
-   mtx_init(>its_spin_mtx, "ITS spin lock", NULL, MTX_SPIN);
+   mtx_init(>its_cmd_lock, "ITS cmd lock", NULL, MTX_SPIN);
 
rid = 0;
sc->its_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, ,
@@ -1181,7 +1181,7 @@ its_cmd_alloc_locked(struct gic_v3_its_s
 */
us_left = 100;
 
-   mtx_assert(>its_spin_mtx, MA_OWNED);
+   mtx_assert(>its_cmd_lock, MA_OWNED);
while (its_cmd_queue_full(sc)) {
if (us_left-- == 0) {
/* Timeout while waiting for free command */
@@ -1334,11 +1334,11 @@ its_cmd_send(struct gic_v3_its_softc *sc
struct its_cmd_desc desc_sync;
uint64_t target, cwriter;
 
-   mtx_lock_spin(>its_spin_mtx);
+   mtx_lock_spin(>its_cmd_lock);
cmd = its_cmd_alloc_locked(sc);
if (cmd == NULL) {
device_printf(sc->dev, "could not allocate ITS command\n");
-   mtx_unlock_spin(>its_spin_mtx);
+   mtx_unlock_spin(>its_cmd_lock);
return (EBUSY);
}
 
@@ -1360,7 +1360,7 @@ end:
cwriter = its_cmd_cwriter_offset(sc, sc->its_cmdq_write);
gic_its_write(sc, 8, GITS_CWRITER, cwriter);
cmd_write = sc->its_cmdq_write;
-   mtx_unlock_spin(>its_spin_mtx);
+   mtx_unlock_spin(>its_cmd_lock);
 
its_cmd_wait_completion(sc, cmd, cmd_write);
 
@@ -1372,7 +1372,7 @@ its_device_find_locked(struct gic_v3_its
 {
struct its_dev *its_dev;
 
-   mtx_assert(>its_mtx, MA_OWNED);
+   mtx_assert(>its_dev_lock, MA_OWNED);
/* Find existing device if any */
TAILQ_FOREACH(its_dev, >its_dev_list, entry) {
if (its_dev->pci_dev == pci_dev)
@@ -1383,7 +1383,7 @@ its_device_find_locked(struct gic_v3_its
 }
 
 static struct its_dev *
-its_device_alloc_locked(struct gic_v3_its_softc *sc, device_t pci_dev,
+its_device_alloc(struct gic_v3_its_softc *sc, device_t pci_dev,
 u_int nvecs)
 {
struct its_dev *newdev;
@@ -1391,10 +1391,12 @@ its_device_alloc_locked(struct gic_v3_it
uint32_t devid;
u_int cpuid;
size_t esize;
+   int err;
 
-   mtx_assert(>its_mtx, MA_OWNED);
+   mtx_lock_spin(>its_dev_lock);
/* Find existing device if any */
newdev = its_device_find_locked(sc, pci_dev);
+   mtx_unlock_spin(>its_dev_lock);
if (newdev != NULL)
return (newdev);
 
@@ -1408,7 +1410,10 @@ its_device_alloc_locked(struct gic_v3_it
newdev->pci_dev = pci_dev;
newdev->devid = devid;
 
-   if (lpi_alloc_chunk(sc, >lpis, nvecs) != 0) {
+   mtx_lock_spin(>its_dev_lock);
+   err = lpi_alloc_chunk(sc, >lpis, nvecs);
+   mtx_unlock_spin(>its_dev_lock);
+   if (err != 0) {
free(newdev, M_GIC_V3_ITS);
return (NULL);
}
@@ -1424,7 +1429,9 @@ its_device_alloc_locked(struct gic_v3_it
roundup2(roundup2(nvecs, 2) * esize, 0x100), M_GIC_V3_ITS,
(M_NOWAIT | M_ZERO), 0, ~0UL, 0x100, 0);
if (newdev->itt == 0) {
+   mtx_lock_spin(>its_dev_lock);
lpi_free_chunk(sc, >lpis);
+   mtx_unlock_spin(>its_dev_lock);
free(newdev, M_GIC_V3_ITS);
return (NULL);
}
@@ -1436,7 +1443,9 @@ its_device_alloc_locked(struct gic_v3_it
cpuid = 0;
newdev->col = sc->its_cols[cpuid];
 
+   mtx_lock_spin(>its_dev_lock);
TAILQ_INSERT_TAIL(>its_dev_list, newdev, entry);
+   mtx_unlock_spin(>its_dev_lock);
 
/* Map device to its ITT */
its_cmd_mapd(sc, newdev, 1);
@@ -1449,7 +1458,7 @@ its_device_asign_lpi_locked(struct gic_v
 struct its_dev *its_dev, u_int *irq)
 {
 
-   mtx_assert(>its_mtx, MA_OWNED);
+   mtx_assert(>its_dev_lock, MA_OWNED);
 

svn commit: r295508 - head/sys/riscv/htif

2016-02-11 Thread Ruslan Bukin
Author: br
Date: Thu Feb 11 11:21:45 2016
New Revision: 295508
URL: https://svnweb.freebsd.org/changeset/base/295508

Log:
  Stop device enumeration when we see first empty slot.
  This fixes operation in QEMU and saves some booting time as well.
  
  Pointed out by:   Sagar Karandikar 
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Modified:
  head/sys/riscv/htif/htif.c

Modified: head/sys/riscv/htif/htif.c
==
--- head/sys/riscv/htif/htif.c  Thu Feb 11 10:48:15 2016(r295507)
+++ head/sys/riscv/htif/htif.c  Thu Feb 11 11:21:45 2016(r295508)
@@ -183,9 +183,8 @@ htif_enumerate(struct htif_softc *sc)
}
 
len = strnlen(id, sizeof(id));
-   if (len <= 0) {
-   continue;
-   }
+   if (len <= 0)
+   break;
 
if (bootverbose)
printf(" %d %s\n", i, id);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295509 - in head/sys/arm: altera/socfpga amlogic/aml8726 annapurna/alpine at91 broadcom/bcm2835 freescale/imx freescale/vybrid lpc mv rockchip samsung/exynos versatile xilinx

2016-02-11 Thread Andrew Turner
Author: andrew
Date: Thu Feb 11 11:49:27 2016
New Revision: 295509
URL: https://svnweb.freebsd.org/changeset/base/295509

Log:
  Stop defining fdt_pic_table when building for ARM_INTRNG.

Modified:
  head/sys/arm/altera/socfpga/socfpga_common.c
  head/sys/arm/amlogic/aml8726/aml8726_machdep.c
  head/sys/arm/annapurna/alpine/common.c
  head/sys/arm/at91/at91_common.c
  head/sys/arm/broadcom/bcm2835/bcm2835_common.c
  head/sys/arm/freescale/imx/imx_common.c
  head/sys/arm/freescale/vybrid/vf_common.c
  head/sys/arm/lpc/lpc_intc.c
  head/sys/arm/mv/mv_common.c
  head/sys/arm/rockchip/rk30xx_common.c
  head/sys/arm/samsung/exynos/exynos5_common.c
  head/sys/arm/versatile/versatile_common.c
  head/sys/arm/xilinx/zy7_machdep.c

Modified: head/sys/arm/altera/socfpga/socfpga_common.c
==
--- head/sys/arm/altera/socfpga/socfpga_common.cThu Feb 11 11:21:45 
2016(r295508)
+++ head/sys/arm/altera/socfpga/socfpga_common.cThu Feb 11 11:49:27 
2016(r295509)
@@ -74,6 +74,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
+#ifndef ARM_INTRNG
 static int
 fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
 int *pol)
@@ -92,3 +93,4 @@ fdt_pic_decode_t fdt_pic_table[] = {
_pic_decode_ic,
NULL
 };
+#endif

Modified: head/sys/arm/amlogic/aml8726/aml8726_machdep.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Thu Feb 11 11:21:45 
2016(r295508)
+++ head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Thu Feb 11 11:49:27 
2016(r295509)
@@ -184,6 +184,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
+#ifndef ARM_INTRNG
 #ifndef DEV_GIC
 static int
 fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
@@ -212,3 +213,4 @@ fdt_pic_decode_t fdt_pic_table[] = {
 #endif
NULL
 };
+#endif /* ARM_INTRNG */

Modified: head/sys/arm/annapurna/alpine/common.c
==
--- head/sys/arm/annapurna/alpine/common.c  Thu Feb 11 11:21:45 2016
(r295508)
+++ head/sys/arm/annapurna/alpine/common.c  Thu Feb 11 11:49:27 2016
(r295509)
@@ -136,6 +136,7 @@ infinite:
while (1) {}
 }
 
+#ifndef ARM_INTRNG
 static int
 alpine_pic_decode_fdt(uint32_t iparent, uint32_t *intr, int *interrupt,
 int *trig, int *pol)
@@ -158,3 +159,4 @@ fdt_pic_decode_t fdt_pic_table[] = {
_pic_decode_fdt,
NULL
 };
+#endif

Modified: head/sys/arm/at91/at91_common.c
==
--- head/sys/arm/at91/at91_common.c Thu Feb 11 11:21:45 2016
(r295508)
+++ head/sys/arm/at91/at91_common.c Thu Feb 11 11:49:27 2016
(r295509)
@@ -53,6 +53,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
+#ifndef ARM_INTRNG
 static int
 fdt_aic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
 int *pol)
@@ -75,6 +76,7 @@ fdt_pic_decode_t fdt_pic_table[] = {
_aic_decode_ic,
NULL
 };
+#endif
 
 static void
 at91_eoi(void *unused)

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_common.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Thu Feb 11 11:21:45 
2016(r295508)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Thu Feb 11 11:49:27 
2016(r295509)
@@ -50,6 +50,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
+#ifndef ARM_INTRNG
 static int
 fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
 int *pol)
@@ -70,3 +71,4 @@ fdt_pic_decode_t fdt_pic_table[] = {
_intc_decode_ic,
NULL
 };
+#endif /* ARM_INTRNG */

Modified: head/sys/arm/freescale/imx/imx_common.c
==
--- head/sys/arm/freescale/imx/imx_common.c Thu Feb 11 11:21:45 2016
(r295508)
+++ head/sys/arm/freescale/imx/imx_common.c Thu Feb 11 11:49:27 2016
(r295509)
@@ -54,6 +54,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }
 };
 
+#ifndef ARM_INTRNG
 static int
 fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
 int *pol)
@@ -70,3 +71,4 @@ fdt_pic_decode_t fdt_pic_table[] = {
_intc_decode_ic,
NULL
 };
+#endif /* ARM_INTRNG */

Modified: head/sys/arm/freescale/vybrid/vf_common.c
==
--- head/sys/arm/freescale/vybrid/vf_common.c   Thu Feb 11 11:21:45 2016
(r295508)
+++ head/sys/arm/freescale/vybrid/vf_common.c   Thu Feb 11 11:49:27 2016
(r295509)
@@ -66,6 +66,7 @@ struct fdt_fixup_entry fdt_fixup_table[]
{ NULL, NULL }

svn commit: r295514 - head/sys/arm64/arm64

2016-02-11 Thread Zbigniew Bodek
Author: zbb
Date: Thu Feb 11 11:57:13 2016
New Revision: 295514
URL: https://svnweb.freebsd.org/changeset/base/295514

Log:
  Fix bugs in interrupts allocation on ARM64
  
  Separate interrupt descriptors lookup from allocation. It was possible
  to perform config on non-existing interrupt simply by allocating spurious
  descriptor.
  Must lock the interrupt descriptors table lookup to avoid mismatches.
  This ought to prevent trouble while setting up new interrupt
  and dispatching existing one.
  Use spin mutex rather than sleep mutex. This is mainly due to lock in
  arm_dispatch_intr.
  This should be eventually changed to a lock-less solution without
  walking through a linked list on each interrupt.
  
  Reviewed by:   andrew, wma
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Differential Revision: https://reviews.freebsd.org/D5121

Modified:
  head/sys/arm64/arm64/intr_machdep.c

Modified: head/sys/arm64/arm64/intr_machdep.c
==
--- head/sys/arm64/arm64/intr_machdep.c Thu Feb 11 11:57:12 2016
(r295513)
+++ head/sys/arm64/arm64/intr_machdep.c Thu Feb 11 11:57:13 2016
(r295514)
@@ -105,7 +105,7 @@ static void
 intr_init(void *dummy __unused)
 {
 
-   mtx_init(_list_lock, "intr sources lock", NULL, MTX_DEF);
+   mtx_init(_list_lock, "intr sources lock", NULL, MTX_SPIN);
 }
 SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL);
 
@@ -123,33 +123,44 @@ intrcnt_setname(const char *name, u_int 
 }
 
 /*
+ * Find the interrupt descriptor in the list
+ * based on the hardware IRQ number.
+ */
+static __inline struct arm64_intr_entry *
+intr_lookup_locked(u_int hw_irq)
+{
+   struct arm64_intr_entry *intr;
+
+   mtx_assert(_list_lock, MA_OWNED);
+   SLIST_FOREACH(intr, _slist_head, entries) {
+   if (intr->i_hw_irq == hw_irq)
+   return (intr);
+   }
+   return (NULL);
+}
+/*
  * Get intr structure for the given interrupt number.
  * Allocate one if this is the first time.
- * (Similar to ppc's intr_lookup() but without actual
- * lookup since irq number is an index in arm64_intrs[]).
  */
 static struct arm64_intr_entry *
-intr_acquire(u_int hw_irq)
+intr_allocate(u_int hw_irq)
 {
struct arm64_intr_entry *intr;
 
-   mtx_lock(_list_lock);
-
-   SLIST_FOREACH(intr, _slist_head, entries) {
-   if (intr->i_hw_irq == hw_irq) {
-   break;
-   }
-   }
+   /* Check if already allocated */
+   mtx_lock_spin(_list_lock);
+   intr = intr_lookup_locked(hw_irq);
+   mtx_unlock_spin(_list_lock);
if (intr != NULL)
-   goto out;
+   return (intr);
 
/* Do not alloc another intr when max number of IRQs has been reached */
if (intrcntidx >= NIRQS)
-   goto out;
+   return (NULL);
 
intr = malloc(sizeof(*intr), M_INTR, M_NOWAIT);
if (intr == NULL)
-   goto out;
+   return (NULL);
 
intr->i_event = NULL;
intr->i_handlers = 0;
@@ -158,9 +169,10 @@ intr_acquire(u_int hw_irq)
intr->i_cntidx = atomic_fetchadd_int(, 1);
intr->i_cntp = [intr->i_cntidx];
intr->i_hw_irq = hw_irq;
+   mtx_lock_spin(_list_lock);
SLIST_INSERT_HEAD(_slist_head, intr, entries);
-out:
-   mtx_unlock(_list_lock);
+   mtx_unlock_spin(_list_lock);
+
return intr;
 }
 
@@ -312,7 +324,7 @@ arm_setup_intr(const char *name, driver_
struct arm64_intr_entry *intr;
int error;
 
-   intr = intr_acquire(hw_irq);
+   intr = intr_allocate(hw_irq);
if (intr == NULL)
return (ENOMEM);
 
@@ -336,7 +348,6 @@ arm_setup_intr(const char *name, driver_
intr_priority(flags), flags, cookiep);
 
if (!error) {
-   mtx_lock(_list_lock);
intrcnt_setname(intr->i_event->ie_fullname, intr->i_cntidx);
intr->i_handlers++;
 
@@ -349,7 +360,6 @@ arm_setup_intr(const char *name, driver_
 
PIC_UNMASK(root_pic, intr->i_hw_irq);
}
-   mtx_unlock(_list_lock);
}
 
return (error);
@@ -364,12 +374,10 @@ arm_teardown_intr(void *cookie)
intr = intr_handler_source(cookie);
error = intr_event_remove_handler(cookie);
if (!error) {
-   mtx_lock(_list_lock);
intr->i_handlers--;
if (intr->i_handlers == 0)
PIC_MASK(root_pic, intr->i_hw_irq);
intrcnt_setname(intr->i_event->ie_fullname, intr->i_cntidx);
-   mtx_unlock(_list_lock);
}
 
return (error);
@@ -380,9 +388,11 @@ arm_config_intr(u_int hw_irq, enum intr_
 {
struct arm64_intr_entry *intr;
 
-   intr = intr_acquire(hw_irq);
+   mtx_lock_spin(_list_lock);
+   intr = intr_lookup_locked(hw_irq);
+   

svn commit: r295513 - head/sys/dev/xen/netfront

2016-02-11 Thread Roger Pau Monné
Author: royger
Date: Thu Feb 11 11:57:12 2016
New Revision: 295513
URL: https://svnweb.freebsd.org/changeset/base/295513

Log:
  xen-netfront: remove useless NULL check in netif_free
  
  xn_ifp is allocated in create_netdev with if_alloc(IFT_ETHER).
  According to the current arrangement it can't be NULL.
  
  Coverity ID:  1349805
  Submitted by: Wei Liu 
  Reviewed by:  royger
  Sponsored by: Citrix Systems R
  Differential revision:https://reviews.freebsd.org/D5252

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Feb 11 11:55:37 2016
(r295512)
+++ head/sys/dev/xen/netfront/netfront.cThu Feb 11 11:57:12 2016
(r295513)
@@ -2280,11 +2280,9 @@ netif_free(struct netfront_info *np)
netif_disconnect_backend(np);
free(np->rxq, M_DEVBUF);
free(np->txq, M_DEVBUF);
-   if (np->xn_ifp != NULL) {
-   ether_ifdetach(np->xn_ifp);
-   if_free(np->xn_ifp);
-   np->xn_ifp = NULL;
-   }
+   ether_ifdetach(np->xn_ifp);
+   if_free(np->xn_ifp);
+   np->xn_ifp = NULL;
ifmedia_removeall(>sc_media);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295519 - head/sys/arm64/arm64

2016-02-11 Thread Zbigniew Bodek
Author: zbb
Date: Thu Feb 11 12:04:58 2016
New Revision: 295519
URL: https://svnweb.freebsd.org/changeset/base/295519

Log:
  Support interrupts binding in GICv3 and ITS
  
  - Add MOVI command and routine for the LPI migration
  - Allow to search for the ITS device descriptor using
not only devID but also LPI number.
  - Bind SPIs in the Distributor
  - Don't bind its_dev to collection. Keep track of the collection
IDs for each LPI.
  
  Reviewed by:   wma
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Differential Revision: https://reviews.freebsd.org/D5231

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_its.c
  head/sys/arm64/arm64/gic_v3_var.h

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Thu Feb 11 12:03:11 2016
(r295518)
+++ head/sys/arm64/arm64/gic_v3.c   Thu Feb 11 12:04:58 2016
(r295519)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include "gic_v3_var.h"
 
 /* Device and PIC methods */
+static int gic_v3_bind(device_t, u_int, u_int);
 static void gic_v3_dispatch(device_t, struct trapframe *);
 static void gic_v3_eoi(device_t, u_int);
 static void gic_v3_mask_irq(device_t, u_int);
@@ -72,6 +73,7 @@ static device_method_t gic_v3_methods[] 
DEVMETHOD(device_detach,gic_v3_detach),
 
/* PIC interface */
+   DEVMETHOD(pic_bind, gic_v3_bind),
DEVMETHOD(pic_dispatch, gic_v3_dispatch),
DEVMETHOD(pic_eoi,  gic_v3_eoi),
DEVMETHOD(pic_mask, gic_v3_mask_irq),
@@ -244,6 +246,28 @@ gic_v3_detach(device_t dev)
 /*
  * PIC interface.
  */
+
+static int
+gic_v3_bind(device_t dev, u_int irq, u_int cpuid)
+{
+   uint64_t aff;
+   struct gic_v3_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   if (irq <= GIC_LAST_PPI) {
+   /* Can't bind PPI to another CPU but it's not an error */
+   return (0);
+   } else if (irq >= GIC_FIRST_SPI && irq <= GIC_LAST_SPI) {
+   aff = CPU_AFFINITY(cpuid);
+   gic_d_write(sc, 4, GICD_IROUTER(irq), aff);
+   return (0);
+   } else if (irq >= GIC_FIRST_LPI)
+   return (lpi_migrate(dev, irq, cpuid));
+
+   return (EINVAL);
+}
+
 static void
 gic_v3_dispatch(device_t dev, struct trapframe *frame)
 {

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Thu Feb 11 12:03:11 2016
(r295518)
+++ head/sys/arm64/arm64/gic_v3_its.c   Thu Feb 11 12:04:58 2016
(r295519)
@@ -92,9 +92,13 @@ static void its_free_tables(struct gic_v
 static void its_init_commandq(struct gic_v3_its_softc *);
 static void its_init_cpu_collection(struct gic_v3_its_softc *);
 static uint32_t its_get_devid(device_t);
+static struct its_dev * its_device_find_locked(struct gic_v3_its_softc *,
+device_t, uint32_t);
 
 static int its_cmd_send(struct gic_v3_its_softc *, struct its_cmd_desc *);
 
+static void its_cmd_movi(struct gic_v3_its_softc *, struct its_dev *,
+struct its_col *, uint32_t);
 static void its_cmd_mapc(struct gic_v3_its_softc *, struct its_col *, uint8_t);
 static void its_cmd_mapvi(struct gic_v3_its_softc *, struct its_dev *, 
uint32_t,
 uint32_t);
@@ -846,18 +850,28 @@ static int
 lpi_alloc_chunk(struct gic_v3_its_softc *sc, struct lpi_chunk *lpic,
 u_int nvecs)
 {
+   u_int *col_ids;
int fclr; /* First cleared bit */
uint8_t *bitmap;
size_t nb, i;
 
+   col_ids = malloc(sizeof(*col_ids) * nvecs, M_GIC_V3_ITS,
+   (M_NOWAIT | M_ZERO));
+   if (col_ids == NULL)
+   return (ENOMEM);
+
+   mtx_lock_spin(>its_dev_lock);
bitmap = (uint8_t *)sc->its_lpi_bitmap;
 
fclr = 0;
 retry:
/* Check other bits - slw */
for (i = 0, nb = fclr; i < nvecs; i++, nb++) {
-   if (nb > sc->its_lpi_maxid)
+   if (nb > sc->its_lpi_maxid) {
+   mtx_unlock_spin(>its_dev_lock);
+   free(col_ids, M_GIC_V3_ITS);
return (EINVAL);
+   }
 
if (isset(bitmap, nb)) {
/* To little free bits in this area. Move on. */
@@ -870,6 +884,15 @@ retry:
lpic->lpi_base = fclr + GIC_FIRST_LPI;
lpic->lpi_num = nvecs;
lpic->lpi_free = lpic->lpi_num;
+   lpic->lpi_col_ids = col_ids;
+   for (i = 0; i < lpic->lpi_num; i++) {
+   /*
+* Initially all interrupts go to CPU0 but can be moved
+* to another CPU by bus_bind_intr() or interrupts shuffling.
+*/
+   lpic->lpi_col_ids[i] = 0;
+   }
+   mtx_unlock_spin(>its_dev_lock);
 
return (0);
 }
@@ -885,6 +908,7 @@ lpi_free_chunk(struct gic_v3_its_softc *

svn commit: r295507 - in head/sys/arm: conf xilinx/zedboard

2016-02-11 Thread Andrew Turner
Author: andrew
Date: Thu Feb 11 10:48:15 2016
New Revision: 295507
URL: https://svnweb.freebsd.org/changeset/base/295507

Log:
  Remove unused Zedboard config files. files.zedboard was empty other than
  comments, and std.zedboard just pointed to files.zedboard and std.xilinx.

Deleted:
  head/sys/arm/xilinx/zedboard/
Modified:
  head/sys/arm/conf/ZEDBOARD

Modified: head/sys/arm/conf/ZEDBOARD
==
--- head/sys/arm/conf/ZEDBOARD  Thu Feb 11 10:03:50 2016(r295506)
+++ head/sys/arm/conf/ZEDBOARD  Thu Feb 11 10:48:15 2016(r295507)
@@ -22,7 +22,7 @@
 ident  ZEDBOARD
 
 include"std.armv6"
-include"../xilinx/zedboard/std.zedboard"
+include"../xilinx/std.zynq7"
 
 optionsSCHED_ULE   # ULE scheduler
 #options   NFSSD   # Network Filesystem Server
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295506 - head/sys/netinet

2016-02-11 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Feb 11 10:03:50 2016
New Revision: 295506
URL: https://svnweb.freebsd.org/changeset/base/295506

Log:
  Use a pair of ifs when comparing the 32-bit flowid integers so that
  the sign bit doesn't cause an overflow. The overflow manifests itself
  as a sorting index wrap around in the middle of the sorted array,
  which is not a problem for the LRO code, but might be a problem for
  the logic inside qsort().
  
  Reviewed by:  gnn @
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D5239

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Thu Feb 11 06:50:11 2016(r295505)
+++ head/sys/netinet/tcp_lro.c  Thu Feb 11 10:03:50 2016(r295506)
@@ -347,9 +347,10 @@ tcp_lro_mbuf_compare_header(const void *
if (ret != 0)
goto done;
 
-   ret = ma->m_pkthdr.flowid - mb->m_pkthdr.flowid;
-   if (ret != 0)
-   goto done;
+   if (ma->m_pkthdr.flowid > mb->m_pkthdr.flowid)
+   return (1);
+   else if (ma->m_pkthdr.flowid < mb->m_pkthdr.flowid)
+   return (-1);
 
ret = TCP_LRO_SEQUENCE(ma) - TCP_LRO_SEQUENCE(mb);
 done:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295515 - in head/sys/arm64: arm64 include

2016-02-11 Thread Zbigniew Bodek
Author: zbb
Date: Thu Feb 11 11:58:27 2016
New Revision: 295515
URL: https://svnweb.freebsd.org/changeset/base/295515

Log:
  Introduce bus_bind_intr method for ARM64
  
  It can be used to bind specific interrupt to a particular CPU.
  Requires PIC support for interrupts binding.
  
  Reviewed by:   wma
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Differential Revision: https://reviews.freebsd.org/D5122

Modified:
  head/sys/arm64/arm64/intr_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/arm64/pic_if.m
  head/sys/arm64/include/intr.h

Modified: head/sys/arm64/arm64/intr_machdep.c
==
--- head/sys/arm64/arm64/intr_machdep.c Thu Feb 11 11:57:13 2016
(r295514)
+++ head/sys/arm64/arm64/intr_machdep.c Thu Feb 11 11:58:27 2016
(r295515)
@@ -38,6 +38,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -84,6 +85,7 @@ struct arm64_intr_entry {
u_int   i_hw_irq;   /* Physical interrupt number */
u_int   i_cntidx;   /* Index in intrcnt table */
u_int   i_handlers; /* Allocated handlers */
+   u_int   i_cpu;  /* Assigned CPU */
u_long  *i_cntp;/* Interrupt hit counter */
 };
 
@@ -162,6 +164,8 @@ intr_allocate(u_int hw_irq)
if (intr == NULL)
return (NULL);
 
+   /* The default CPU is 0 but can be changed later by bind or shuffle */
+   intr->i_cpu = 0;
intr->i_event = NULL;
intr->i_handlers = 0;
intr->i_trig = INTR_TRIGGER_CONFORM;
@@ -176,6 +180,44 @@ intr_allocate(u_int hw_irq)
return intr;
 }
 
+static int
+intr_assign_cpu(void *arg, int cpu)
+{
+#ifdef SMP
+   struct arm64_intr_entry *intr;
+   int error;
+
+   if (root_pic == NULL)
+   panic("Cannot assing interrupt to CPU. No PIC configured");
+   /*
+* Set the interrupt to CPU affinity.
+* Do not configure this in hardware during early boot.
+* We will pick up the assignment once the APs are started.
+*/
+   if (cpu != NOCPU) {
+   intr = arg;
+   if (!cold && smp_started) {
+   /*
+* Bind the interrupt immediately
+* if SMP is up and running.
+*/
+   error = PIC_BIND(root_pic, intr->i_hw_irq, cpu);
+   if (error == 0)
+   intr->i_cpu = cpu;
+   } else {
+   /* Postpone binding until SMP is operational */
+   intr->i_cpu = cpu;
+   error = 0;
+   }
+   } else
+   error = 0;
+
+   return (error);
+#else
+   return (EOPNOTSUPP);
+#endif
+}
+
 static void
 intr_pre_ithread(void *arg)
 {
@@ -339,7 +381,7 @@ arm_setup_intr(const char *name, driver_
if (intr->i_event == NULL) {
error = intr_event_create(>i_event, (void *)intr, 0,
hw_irq, intr_pre_ithread, intr_post_ithread,
-   intr_post_filter, NULL, "irq%u", hw_irq);
+   intr_post_filter, intr_assign_cpu, "irq%u", hw_irq);
if (error)
return (error);
}
@@ -447,6 +489,42 @@ arm_cpu_intr(struct trapframe *tf)
 }
 
 #ifdef SMP
+static void
+arm_intr_smp_init(void *dummy __unused)
+{
+   struct arm64_intr_entry *intr;
+   int error;
+
+   if (root_pic == NULL)
+   panic("Cannot assing interrupts to CPUs. No PIC configured");
+
+   mtx_lock_spin(_list_lock);
+   SLIST_FOREACH(intr, _slist_head, entries) {
+   mtx_unlock_spin(_list_lock);
+   error = PIC_BIND(root_pic, intr->i_hw_irq, intr->i_cpu);
+   if (error != 0)
+   intr->i_cpu = 0;
+   mtx_lock_spin(_list_lock);
+   }
+   mtx_unlock_spin(_list_lock);
+}
+SYSINIT(arm_intr_smp_init, SI_SUB_SMP, SI_ORDER_ANY, arm_intr_smp_init, NULL);
+
+/* Attempt to bind the specified IRQ to the specified CPU. */
+int
+arm_intr_bind(u_int hw_irq, int cpu)
+{
+   struct arm64_intr_entry *intr;
+
+   mtx_lock_spin(_list_lock);
+   intr = intr_lookup_locked(hw_irq);
+   mtx_unlock_spin(_list_lock);
+   if (intr == NULL)
+   return (EINVAL);
+
+   return (intr_event_bind(intr->i_event, cpu));
+}
+
 void
 arm_setup_ipihandler(driver_filter_t *filt, u_int ipi)
 {

Modified: head/sys/arm64/arm64/nexus.c
==
--- head/sys/arm64/arm64/nexus.cThu Feb 11 11:57:13 2016
(r295514)
+++ head/sys/arm64/arm64/nexus.cThu Feb 11 11:58:27 2016
(r295515)
@@ -113,6 +113,9 @@ static  int nexus_deactivate_resource(dev
 static int 

svn commit: r295521 - in head/sys: boot/fdt/dts/riscv riscv/conf

2016-02-11 Thread Ruslan Bukin
Author: br
Date: Thu Feb 11 13:28:52 2016
New Revision: 295521
URL: https://svnweb.freebsd.org/changeset/base/295521

Log:
  o Move non-generic kernel configuration out from GENERIC.
  o Add kernel configuration for QEMU.
  
  Both SPIKE and QEMU kernel configs are temporary (until
  we will be able to obtain DTB from loader).
  
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Added:
  head/sys/boot/fdt/dts/riscv/qemu.dts   (contents, props changed)
  head/sys/riscv/conf/QEMU   (contents, props changed)
  head/sys/riscv/conf/SPIKE   (contents, props changed)
Modified:
  head/sys/riscv/conf/GENERIC

Added: head/sys/boot/fdt/dts/riscv/qemu.dts
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/riscv/qemu.dtsThu Feb 11 13:28:52 2016
(r295521)
@@ -0,0 +1,92 @@
+/*-
+ * Copyright (c) 2016 Ruslan Bukin 
+ * All rights reserved.
+ *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Portions of this software were developed by the University of Cambridge
+ * Computer Laboratory as part of the CTSRD Project, with support from the
+ * UK Higher Education Innovation Fund (HEIF).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/dts-v1/;
+
+/ {
+   model = "QEMU RV64I";
+   compatible = "riscv,rv64i";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   #interrupt-cells = <1>;
+
+   aliases {
+   console0 = 
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x0 0x800>; /* 128MB at 0x0 */
+   };
+
+   soc {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   #interrupt-cells = <1>;
+
+   compatible = "simple-bus";
+   ranges;
+
+   pic0: pic@0 {
+   compatible = "riscv,pic";
+   interrupt-controller;
+   };
+
+   timer0: timer@0 {
+   compatible = "riscv,timer";
+   interrupts = < 1 >;
+   interrupt-parent = <  >;
+   clock-frequency = < 4 >;
+   };
+
+   htif0: htif@0 {
+   compatible = "riscv,htif";
+   interrupts = < 0 >;
+   interrupt-parent = <  >;
+
+   console0: console@0 {
+   compatible = "htif,console";
+   status = "okay";
+   };
+   };
+   };
+
+   chosen {
+   bootargs = "-v";
+   stdin = "console0";
+   stdout = "console0";
+   };
+};

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Thu Feb 11 13:15:37 2016(r295520)
+++ head/sys/riscv/conf/GENERIC Thu Feb 11 13:28:52 2016(r295521)
@@ -98,7 +98,4 @@ devicemd  # Memory "disks"
 device gif # IPv6 and IPv4 tunneling
 device firmware# firmware assist module
 
-# RISCVTODO: This needs to be done via loader (when it's available).
 optionsFDT
-optionsFDT_DTB_STATIC
-makeoptionsFDT_DTS_FILE=spike.dts

Added: head/sys/riscv/conf/QEMU
==
--- /dev/null  

svn commit: r295520 - in head/sys/powerpc: booke include powerpc

2016-02-11 Thread Justin Hibbits
Author: jhibbits
Date: Thu Feb 11 13:15:37 2016
New Revision: 295520
URL: https://svnweb.freebsd.org/changeset/base/295520

Log:
  Migrate the PTE format for book-e to standardize on the 'indirect PTE' format
  
  Summary:
  The revised Book-E spec, adding the specification for the MMUv2 and e6500,
  includes a hardware PTE layout for indirect page tables.  In order to support
  this in the future, migrate the PTE format to match the MMUv2 hardware PTE
  format.
  
  Test Plan: Boot tested on a P5020 board.  Booted to multiuser mode.
  
  Differential Revision: https://reviews.freebsd.org/D5224

Modified:
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/booke/trap_subr.S
  head/sys/powerpc/include/pte.h
  head/sys/powerpc/powerpc/genassym.c

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Thu Feb 11 12:04:58 2016
(r295519)
+++ head/sys/powerpc/booke/pmap.c   Thu Feb 11 13:15:37 2016
(r295520)
@@ -412,13 +412,13 @@ tlb_calc_wimg(vm_paddr_t pa, vm_memattr_
if (ma != VM_MEMATTR_DEFAULT) {
switch (ma) {
case VM_MEMATTR_UNCACHEABLE:
-   return (PTE_I | PTE_G);
+   return (MAS2_I | MAS2_G);
case VM_MEMATTR_WRITE_COMBINING:
case VM_MEMATTR_WRITE_BACK:
case VM_MEMATTR_PREFETCHABLE:
-   return (PTE_I);
+   return (MAS2_I);
case VM_MEMATTR_WRITE_THROUGH:
-   return (PTE_W | PTE_M);
+   return (MAS2_W | MAS2_M);
}
}
 
@@ -900,8 +900,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_of
tlb_miss_lock();
 
tlb0_flush_entry(va);
-   pte->flags = 0;
-   pte->rpn = 0;
+   *pte = 0;
 
tlb_miss_unlock();
mtx_unlock_spin(_mutex);
@@ -984,8 +983,8 @@ pte_enter(mmu_t mmu, pmap_t pmap, vm_pag
pmap->pm_pdir[pdir_idx] = ptbl;
}
pte = &(pmap->pm_pdir[pdir_idx][ptbl_idx]);
-   pte->rpn = PTE_RPN_FROM_PA(VM_PAGE_TO_PHYS(m));
-   pte->flags |= (PTE_VALID | flags);
+   *pte = PTE_RPN_FROM_PA(VM_PAGE_TO_PHYS(m));
+   *pte |= (PTE_VALID | flags | PTE_PS_4KB); /* 4KB pages only */
 
tlb_miss_unlock();
mtx_unlock_spin(_mutex);
@@ -1041,9 +1040,9 @@ kernel_pte_alloc(vm_offset_t data_end, v
 */
for (va = addr; va < data_end; va += PAGE_SIZE) {
pte = &(kernel_pmap->pm_pdir[PDIR_IDX(va)][PTBL_IDX(va)]);
-   pte->rpn = kernload + (va - kernstart);
-   pte->flags = PTE_M | PTE_SR | PTE_SW | PTE_SX | PTE_WIRED |
-   PTE_VALID;
+   *pte = PTE_RPN_FROM_PA(kernload + (va - kernstart));
+   *pte |= PTE_M | PTE_SR | PTE_SW | PTE_SX | PTE_WIRED |
+   PTE_VALID | PTE_PS_4KB;
}
 }
 
@@ -1525,7 +1524,8 @@ mmu_booke_kenter_attr(mmu_t mmu, vm_offs
(va <= VM_MAX_KERNEL_ADDRESS)), ("mmu_booke_kenter: invalid va"));
 
flags = PTE_SR | PTE_SW | PTE_SX | PTE_WIRED | PTE_VALID;
-   flags |= tlb_calc_wimg(pa, ma);
+   flags |= tlb_calc_wimg(pa, ma) << PTE_MAS2_SHIFT;
+   flags |= PTE_PS_4KB;
 
pte = pte_find(mmu, kernel_pmap, va);
 
@@ -1540,17 +1540,15 @@ mmu_booke_kenter_attr(mmu_t mmu, vm_offs
tlb0_flush_entry(va);
}
 
-   pte->rpn = PTE_RPN_FROM_PA(pa);
-   pte->flags = flags;
+   *pte = PTE_RPN_FROM_PA(pa) | flags;
 
//debugf("mmu_booke_kenter: pdir_idx = %d ptbl_idx = %d va=0x%08x "
//  "pa=0x%08x rpn=0x%08x flags=0x%08x\n",
//  pdir_idx, ptbl_idx, va, pa, pte->rpn, pte->flags);
 
/* Flush the real memory from the instruction cache. */
-   if ((flags & (PTE_I | PTE_G)) == 0) {
+   if ((flags & (PTE_I | PTE_G)) == 0)
__syncicache((void *)va, PAGE_SIZE);
-   }
 
tlb_miss_unlock();
mtx_unlock_spin(_mutex);
@@ -1584,8 +1582,7 @@ mmu_booke_kremove(mmu_t mmu, vm_offset_t
 
/* Invalidate entry in TLB0, update PTE. */
tlb0_flush_entry(va);
-   pte->flags = 0;
-   pte->rpn = 0;
+   *pte = 0;
 
tlb_miss_unlock();
mtx_unlock_spin(_mutex);
@@ -1700,7 +1697,7 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t
 * Before actually updating pte->flags we calculate and
 * prepare its new value in a helper var.
 */
-   flags = pte->flags;
+   flags = *pte;
flags &= ~(PTE_UW | PTE_UX | PTE_SW | PTE_SX | PTE_MODIFIED);
 
/* Wiring change, just update stats. */
@@ -1748,7 +1745,7 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t
 * are turning execute permissions on, icache should
 * be flushed.
 */
- 

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

2016-02-11 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Feb 11 15:27:14 2016
New Revision: 295523
URL: https://svnweb.freebsd.org/changeset/base/295523

Log:
  Ext4: Use boolean type instead of '0' and '1'
  
  There are precedents of uses of bool in the kernel and
  it is incorrect style to use integers as replacement for
  a boolean type.

Modified:
  head/sys/fs/ext2fs/ext2_extents.c
  head/sys/fs/ext2fs/ext2_extents.h

Modified: head/sys/fs/ext2fs/ext2_extents.c
==
--- head/sys/fs/ext2fs/ext2_extents.c   Thu Feb 11 14:45:18 2016
(r295522)
+++ head/sys/fs/ext2fs/ext2_extents.c   Thu Feb 11 15:27:14 2016
(r295523)
@@ -43,7 +43,7 @@
 #include 
 #include 
 
-static int
+static bool
 ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path *path,
daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn)
 {
@@ -67,14 +67,14 @@ ext4_ext_binsearch_index(struct inode *i
path->ep_sparse_ext.e_len = first->ei_blk - *first_lbn;
path->ep_sparse_ext.e_start_hi = 0;
path->ep_sparse_ext.e_start_lo = 0;
-   path->ep_is_sparse = 1;
-   return (1);
+   path->ep_is_sparse = true;
+   return (true);
}
path->ep_index = l - 1;
*first_lbn = path->ep_index->ei_blk;
if (path->ep_index < last)
*last_lbn = l->ei_blk - 1;
-   return (0);
+   return (false);
 }
 
 static void
@@ -103,7 +103,7 @@ ext4_ext_binsearch(struct inode *ip, str
path->ep_sparse_ext.e_len = first->e_blk - first_lbn;
path->ep_sparse_ext.e_start_hi = 0;
path->ep_sparse_ext.e_start_lo = 0;
-   path->ep_is_sparse = 1;
+   path->ep_is_sparse = true;
return;
}
path->ep_ext = l - 1;
@@ -118,7 +118,7 @@ ext4_ext_binsearch(struct inode *ip, str
path->ep_sparse_ext.e_blk + 1;
path->ep_sparse_ext.e_start_hi = 0;
path->ep_sparse_ext.e_start_lo = 0;
-   path->ep_is_sparse = 1;
+   path->ep_is_sparse = true;
}
 }
 
@@ -213,7 +213,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs
path->ep_depth = i;
path->ep_ext = NULL;
path->ep_index = NULL;
-   path->ep_is_sparse = 0;
+   path->ep_is_sparse = false;
 
ext4_ext_binsearch(ip, path, lbn, first_lbn, last_lbn);
return (path);

Modified: head/sys/fs/ext2fs/ext2_extents.h
==
--- head/sys/fs/ext2fs/ext2_extents.h   Thu Feb 11 14:45:18 2016
(r295522)
+++ head/sys/fs/ext2fs/ext2_extents.h   Thu Feb 11 15:27:14 2016
(r295523)
@@ -84,7 +84,7 @@ struct ext4_extent_cache {
 struct ext4_extent_path {
uint16_t ep_depth;
struct buf *ep_bp;
-   int ep_is_sparse;
+   bool ep_is_sparse;
union {
struct ext4_extent ep_sparse_ext;
struct ext4_extent *ep_ext;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295553 - head/share/examples/jails

2016-02-11 Thread Devin Teske
Author: dteske
Date: Fri Feb 12 01:12:44 2016
New Revision: 295553
URL: https://svnweb.freebsd.org/changeset/base/295553

Log:
  Refactor conversion to hex

Modified:
  head/share/examples/jails/jib
  head/share/examples/jails/jng

Modified: head/share/examples/jails/jib
==
--- head/share/examples/jails/jib   Fri Feb 12 00:03:39 2016
(r295552)
+++ head/share/examples/jails/jib   Fri Feb 12 01:12:44 2016
(r295553)
@@ -214,25 +214,19 @@ derive_mac()
# unique value preventing conflict.
#
__iface_devid=$( ifconfig $__iface ether | awk '/ether/,$0=$2' )
-   __new_devid=${__iface_devid#??:??:??}
-   # :II:II:II => S:II:II:II
+   # ??:??:??:II:II:II
+   __new_devid=${__iface_devid#??:??:??} # => :II:II:II
+   # => :SS:SS:II:II:II
__num=$( set -- `echo -n "$__name" | sum` && echo $1 )
-   __new_devid=$( printf %x $(( $__num & 15 )) )$__new_devid
-   # S:II:II:II => :SS:II:II:II
-   __num=$(( $__num >> 4 ))
-   __new_devid=:$( printf %x $(( $__num & 15 )) )$__new_devid
-   # :SS:II:II:II => S:SS:II:II:II
-   __num=$(( $__num >> 4 ))
-   __new_devid=$( printf %x $(( $__num & 15 )) )$__new_devid
-   # S:SS:II:II:II => :SS:SS:II:II:II
-   __new_devid=:$( printf %x $(( $__num & 15 )) )$__new_devid
-   # :SS:SS:II:II:II => P:SS:SS:II:II:II
+   __new_devid=$( printf :%02x:%02x \
+   $(( $__num >> 8 & 255 )) $(( $__num & 255 )) )$__new_devid
+   # => P:SS:SS:II:II:II
case "$__iface_devid" in
   ?2:*) __new_devid=a$__new_devid __new_devid_b=e$__new_devid ;;
?[Ee]:*) __new_devid=2$__new_devid __new_devid_b=6$__new_devid ;;
  *) __new_devid=2$__new_devid __new_devid_b=e$__new_devid
esac
-   # P:SS:SS:II:II:II => NP:SS:SS:II:II:II
+   # => NP:SS:SS:II:II:II
__new_devid=$( printf %x $(( $__mac_num & 15 )) )$__new_devid
__new_devid_b=$( printf %x $(( $__mac_num & 15 )) )$__new_devid_b
 

Modified: head/share/examples/jails/jng
==
--- head/share/examples/jails/jng   Fri Feb 12 00:03:39 2016
(r295552)
+++ head/share/examples/jails/jng   Fri Feb 12 01:12:44 2016
(r295553)
@@ -216,25 +216,19 @@ derive_mac()
# unique value preventing conflict.
#
__iface_devid=$( ifconfig $__iface ether | awk '/ether/,$0=$2' )
-   __new_devid=${__iface_devid#??:??:??}
-   # :II:II:II => S:II:II:II
+   # ??:??:??:II:II:II
+   __new_devid=${__iface_devid#??:??:??} # => :II:II:II
+   # => :SS:SS:II:II:II
__num=$( set -- `echo -n "$__name" | sum` && echo $1 )
-   __new_devid=$( printf %x $(( $__num & 15 )) )$__new_devid
-   # S:II:II:II => :SS:II:II:II
-   __num=$(( $__num >> 4 ))
-   __new_devid=:$( printf %x $(( $__num & 15 )) )$__new_devid
-   # :SS:II:II:II => S:SS:II:II:II
-   __num=$(( $__num >> 4 ))
-   __new_devid=$( printf %x $(( $__num & 15 )) )$__new_devid
-   # S:SS:II:II:II => :SS:SS:II:II:II
-   __new_devid=:$( printf %x $(( $__num & 15 )) )$__new_devid
-   # :SS:SS:II:II:II => P:SS:SS:II:II:II
+   __new_devid=$( printf :%02x:%02x \
+   $(( $__num >> 8 & 255 )) $(( $__num & 255 )) )$__new_devid
+   # => P:SS:SS:II:II:II
case "$__iface_devid" in
   ?2:*) __new_devid=a$__new_devid __new_devid_b=e$__new_devid ;;
?[Ee]:*) __new_devid=2$__new_devid __new_devid_b=6$__new_devid ;;
  *) __new_devid=2$__new_devid __new_devid_b=e$__new_devid
esac
-   # P:SS:SS:II:II:II => NP:SS:SS:II:II:II
+   # => NP:SS:SS:II:II:II
__new_devid=$( printf %x $(( $__mac_num & 15 )) )$__new_devid
__new_devid_b=$( printf %x $(( $__mac_num & 15 )) )$__new_devid_b
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295546 - head/share/examples/jails

2016-02-11 Thread Devin Teske
Author: dteske
Date: Thu Feb 11 21:28:34 2016
New Revision: 295546
URL: https://svnweb.freebsd.org/changeset/base/295546

Log:
  Centralize MAC derivation formula

Modified:
  head/share/examples/jails/jib
  head/share/examples/jails/jng

Modified: head/share/examples/jails/jib
==
--- head/share/examples/jails/jib   Thu Feb 11 20:16:11 2016
(r295545)
+++ head/share/examples/jails/jib   Thu Feb 11 21:28:34 2016
(r295546)
@@ -170,6 +170,91 @@ action_usage()
exit $FAILURE
 }
 
+derive_mac()
+{
+   local OPTIND=1 OPTARG __flag
+   local __mac_num= __make_pair=
+   while getopts 2n: __flag; do
+   case "$__flag" in
+   2) __make_pair=1 ;;
+   n) __mac_num=${OPTARG%%[^0-9]*} ;;
+   esac
+   done
+   shift $(( $OPTIND - 1 ))
+
+   if [ ! "$__mac_num" ]; then
+   eval __mac_num=\${_${iface}_num:--1}
+   __mac_num=$(( $__mac_num + 1 ))
+   eval _${iface}_num=\$__mac_num
+   fi
+
+   local __iface="$1" __name="$2" __var_to_set="$3" __var_to_set_b="$4"
+   local __iface_devid __new_devid __num __new_devid_b
+   #
+   # Calculate MAC address derived from given iface.
+   #
+   # The formula I'm using is ``NP:SS:SS:II:II:II'' where:
+   # + N denotes 4 bits used as a counter to support branching
+   #   each parent interface up to 15 times under the same jail
+   #   name (see S below).
+   # + P denotes the special nibble whose value, if one of
+   #   2, 6, A, or E (but usually 2) denotes a privately
+   #   administered MAC address (while remaining routable).
+   # + S denotes 16 bits, the sum(1) value of the jail name.
+   # + I denotes bits that are inherited from parent interface.
+   #
+   # The S bits are a CRC-16 checksum of NAME, allowing the jail
+   # to change link numbers in ng_bridge(4) without affecting the
+   # MAC address. Meanwhile, if...
+   #   + the jail NAME changes (e.g., it was duplicated and given
+   # a new name with no other changes)
+   #   + the underlying network interface changes
+   #   + the jail is moved to another host
+   # the MAC address will be recalculated to a new, similarly
+   # unique value preventing conflict.
+   #
+   __iface_devid=$( ifconfig $__iface ether | awk '/ether/,$0=$2' )
+   __new_devid=${__iface_devid#??:??:??}
+   # :II:II:II => S:II:II:II
+   __num=$( set -- `echo -n "$__name" | sum` && echo $1 )
+   __new_devid=$( printf %x $(( $__num & 15 )) )$__new_devid
+   # S:II:II:II => :SS:II:II:II
+   __num=$(( $__num >> 4 ))
+   __new_devid=:$( printf %x $(( $__num & 15 )) )$__new_devid
+   # :SS:II:II:II => S:SS:II:II:II
+   __num=$(( $__num >> 4 ))
+   __new_devid=$( printf %x $(( $__num & 15 )) )$__new_devid
+   # S:SS:II:II:II => :SS:SS:II:II:II
+   __new_devid=:$( printf %x $(( $__num & 15 )) )$__new_devid
+   # :SS:SS:II:II:II => P:SS:SS:II:II:II
+   case "$__iface_devid" in
+  ?2:*) __new_devid=a$__new_devid __new_devid_b=e$__new_devid ;;
+   ?[Ee]:*) __new_devid=2$__new_devid __new_devid_b=6$__new_devid ;;
+ *) __new_devid=2$__new_devid __new_devid_b=e$__new_devid
+   esac
+   # P:SS:SS:II:II:II => NP:SS:SS:II:II:II
+   __new_devid=$( printf %x $(( $__mac_num & 15 )) )$__new_devid
+   __new_devid_b=$( printf %x $(( $__mac_num & 15 )) )$__new_devid_b
+
+   #
+   # Return derivative MAC address(es)
+   #
+   if [ "$__make_pair" ]; then
+   if [ "$__var_to_set" -a "$__var_to_set_b" ]; then
+   eval $__var_to_set=\$__new_devid
+   eval $__var_to_set_b=\$__new_devid_b
+   else
+   echo $__new_devid $__new_devid_b
+   fi
+   else
+   if [ "$__var_to_set" ]; then
+   eval $__var_to_set=\$__new_devid
+   else
+   echo $__new_devid
+   fi
+   fi
+}
+
 mustberoot_to_continue()
 {
if [ "$( id -u )" -ne 0 ]; then
@@ -198,8 +283,7 @@ jib_addm()
 
mustberoot_to_continue
 
-   local iface iface_devid eiface_devid
-   local eiface_devid_a eiface_devid_b
+   local iface eiface_devid_a eiface_devid_b
local new num quad i=0
for iface in $*; do
 
@@ -231,79 +315,7 @@ jib_addm()
# 6. Set the MAC address of the new interface using a sensible
# algorithm to prevent conflicts on the network.
#
-   # The formula I'm using is ``NP:SS:SS:II:II:II'' where:
-   # + N denotes 4 bits used as a counter to support branching
-   #   each parent interface up to 15 times under the same jail
-   #   name (see S below).
-   # + P 

svn commit: r295547 - in head/sys: kern sys

2016-02-11 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 11 21:32:23 2016
New Revision: 295547
URL: https://svnweb.freebsd.org/changeset/base/295547

Log:
  o Gather all mbuf(9) allocation functions into kern_mbuf.c, and all
mbuf(9) manipulation functions into uipc_mbuf.c.  This looks like
the initial intent, but had diffused in the last decade.
  
  o Gather all declarations in mbuf.h in one place and sort them.
  
  o Uninline m_clget() and m_cljget().
  
  There are no functional changes in this patch.
  
  The patch comes from a larger version, where all mbuf(9) allocation was
  uninlined, which allowed to make mbuf(9) UMA zones private to kern_mbuf.c.
  The performance impact of the total uninlining is still unclear, so we
  are holding on now with larger version.
  
  Together with:melifaro, olivier

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Thu Feb 11 21:28:34 2016(r295546)
+++ head/sys/kern/kern_mbuf.c   Thu Feb 11 21:32:23 2016(r295547)
@@ -44,8 +44,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
@@ -284,7 +282,6 @@ static void mb_dtor_clust(void *, int, v
 static voidmb_dtor_pack(void *, int, void *);
 static int mb_zinit_pack(void *, int, int);
 static voidmb_zfini_pack(void *, int);
-
 static voidmb_reclaim(uma_zone_t, int);
 static void*mbuf_jumbo_alloc(uma_zone_t, vm_size_t, uint8_t *, int);
 
@@ -644,24 +641,6 @@ mb_ctor_pack(void *mem, int size, void *
return (error);
 }
 
-int
-m_pkthdr_init(struct mbuf *m, int how)
-{
-#ifdef MAC
-   int error;
-#endif
-   m->m_data = m->m_pktdat;
-   bzero(>m_pkthdr, sizeof(m->m_pkthdr));
-#ifdef MAC
-   /* If the label init fails, fail the alloc */
-   error = mac_mbuf_init(m, how);
-   if (error)
-   return (error);
-#endif
-
-   return (0);
-}
-
 /*
  * This is the protocol drain routine.  Called by UMA whenever any of the
  * mbuf zones is closed to its limit.
@@ -683,3 +662,323 @@ mb_reclaim(uma_zone_t zone __unused, int
if (pr->pr_drain != NULL)
(*pr->pr_drain)();
 }
+
+/*
+ * Clean up after mbufs with M_EXT storage attached to them if the
+ * reference count hits 1.
+ */
+void
+mb_free_ext(struct mbuf *m)
+{
+   int freembuf;
+
+   KASSERT(m->m_flags & M_EXT, ("%s: M_EXT not set on %p", __func__, m));
+
+   /*
+* Check if the header is embedded in the cluster.
+*/
+   freembuf = (m->m_flags & M_NOFREE) ? 0 : 1;
+
+   switch (m->m_ext.ext_type) {
+   case EXT_SFBUF:
+   sf_ext_free(m->m_ext.ext_arg1, m->m_ext.ext_arg2);
+   break;
+   case EXT_SFBUF_NOCACHE:
+   sf_ext_free_nocache(m->m_ext.ext_arg1, m->m_ext.ext_arg2);
+   break;
+   default:
+   KASSERT(m->m_ext.ext_cnt != NULL,
+   ("%s: no refcounting pointer on %p", __func__, m));
+   /* 
+* Free attached storage if this mbuf is the only
+* reference to it.
+*/
+   if (*(m->m_ext.ext_cnt) != 1) {
+   if (atomic_fetchadd_int(m->m_ext.ext_cnt, -1) != 1)
+   break;
+   }
+
+   switch (m->m_ext.ext_type) {
+   case EXT_PACKET:/* The packet zone is special. */
+   if (*(m->m_ext.ext_cnt) == 0)
+   *(m->m_ext.ext_cnt) = 1;
+   uma_zfree(zone_pack, m);
+   return; /* Job done. */
+   case EXT_CLUSTER:
+   uma_zfree(zone_clust, m->m_ext.ext_buf);
+   break;
+   case EXT_JUMBOP:
+   uma_zfree(zone_jumbop, m->m_ext.ext_buf);
+   break;
+   case EXT_JUMBO9:
+   uma_zfree(zone_jumbo9, m->m_ext.ext_buf);
+   break;
+   case EXT_JUMBO16:
+   uma_zfree(zone_jumbo16, m->m_ext.ext_buf);
+   break;
+   case EXT_NET_DRV:
+   case EXT_MOD_TYPE:
+   case EXT_DISPOSABLE:
+   *(m->m_ext.ext_cnt) = 0;
+   uma_zfree(zone_ext_refcnt, __DEVOLATILE(u_int *,
+   m->m_ext.ext_cnt));
+   /* FALLTHROUGH */
+   case EXT_EXTREF:
+   KASSERT(m->m_ext.ext_free != NULL,
+   ("%s: ext_free not set", __func__));
+   (*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1,
+   m->m_ext.ext_arg2);
+   break;
+   default:
+  

svn commit: r295548 - head/share/examples/jails

2016-02-11 Thread Devin Teske
Author: dteske
Date: Thu Feb 11 22:10:54 2016
New Revision: 295548
URL: https://svnweb.freebsd.org/changeset/base/295548

Log:
  Add support for bridging iwn(4) based wlan(4)
  
  Documented in iwn(4), "Only one virtual interface may be configured at any
  time." However, netgraph with a cloned MAC address is able to communicate
  over an ng_eiface attached to an ng_bridge linked to the wlan(4) interface.
  While here, introduce syntax to specify the MAC address is to be cloned if
  the named interface begins with equals [=].

Modified:
  head/share/examples/jails/jng

Modified: head/share/examples/jails/jng
==
--- head/share/examples/jails/jng   Thu Feb 11 21:32:23 2016
(r295547)
+++ head/share/examples/jails/jng   Thu Feb 11 22:10:54 2016
(r295548)
@@ -265,7 +265,7 @@ mustberoot_to_continue()
fi
 }
 
-jng_bridge_usage="bridge [-b BRIDGE_NAME] NAME interface0 [interface1 ...]"
+jng_bridge_usage="bridge [-b BRIDGE_NAME] NAME [=]iface0 [[=]iface1 ...]"
 jng_bridge_descr="Create ng0_NAME [ng1_NAME ...]"
 jng_bridge()
 {
@@ -286,10 +286,15 @@ jng_bridge()
 
mustberoot_to_continue
 
-   local iface eiface eiface_devid
-   local new num quad i=0
+   local iface parent eiface eiface_devid
+   local new clone_mac num quad i=0
for iface in $*; do
 
+   clone_mac=
+   case "$iface" in
+   =*) iface=${iface#=} clone_mac=1 ;;
+   esac
+
# 0. Make sure the interface doesn't exist already
eiface=ng${i}_$name
ngctl msg "$eiface:" getifname > /dev/null 2>&1 && continue
@@ -347,7 +352,23 @@ jng_bridge()
# 6. Set the MAC address of the new interface using a sensible
# algorithm to prevent conflicts on the network.
#
-   derive_mac $iface "$name" eiface_devid
+   case "$iface" in
+   wlan[0-9]*)
+   parent=$( sysctl -n net.wlan.${iface#wlan}.%parent )
+   case "$parent" in
+   iwn[0-9]*)
+   # iwn(4) supports only 1 virtual net at a time
+   # NB: Cloning MAC allows new interface to work
+   clone_mac=1 ;;
+   esac
+   esac
+   if [ "$clone_mac" ]; then
+   eiface_devid=$(
+   ifconfig $iface ether | awk '/ether/,$0=$2'
+   )
+   else
+   derive_mac $iface "$name" eiface_devid
+   fi
ifconfig $eiface ether $eiface_devid
 
i=$(( $i + 1 )) # on to next ng{i}_name
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295549 - head/sys/netinet

2016-02-11 Thread Michael Tuexen
Author: tuexen
Date: Thu Feb 11 22:29:39 2016
New Revision: 295549
URL: https://svnweb.freebsd.org/changeset/base/295549

Log:
  Loopback addresses are 127.0.0.0/8, not 127.0.0.1/32.
  
  MFC after: 1 week

Modified:
  head/sys/netinet/sctp_constants.h

Modified: head/sys/netinet/sctp_constants.h
==
--- head/sys/netinet/sctp_constants.h   Thu Feb 11 22:10:54 2016
(r295548)
+++ head/sys/netinet/sctp_constants.h   Thu Feb 11 22:29:39 2016
(r295549)
@@ -978,10 +978,7 @@ __FBSDID("$FreeBSD$");
  (((uint8_t *)&(a)->s_addr)[1] == 168)))
 
 #define IN4_ISLOOPBACK_ADDRESS(a) \
-uint8_t *)&(a)->s_addr)[0] == 127) && \
- (((uint8_t *)&(a)->s_addr)[1] == 0) && \
- (((uint8_t *)&(a)->s_addr)[2] == 0) && \
- (((uint8_t *)&(a)->s_addr)[3] == 1))
+(((uint8_t *)&(a)->s_addr)[0] == 127)
 
 #define IN4_ISLINKLOCAL_ADDRESS(a) \
 uint8_t *)&(a)->s_addr)[0] == 169) && \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295554 - head/share/examples/jails

2016-02-11 Thread Devin Teske
Author: dteske
Date: Fri Feb 12 01:41:40 2016
New Revision: 295554
URL: https://svnweb.freebsd.org/changeset/base/295554

Log:
  Add syntax to disable MAC allocation
  
  Adding `!' before an interface name will disable MAC allocation, falling
  back to driver mechanics. Alternatively adding `=' before an interface name
  causes the MAC address to be cloned (for ng_bridge(4) back-end only). While
  here, disable the auto-detection of wlan* since this knocks the host off;
  requiring the host that defines the jail to explicitly enable this feature
  by preceding the interface with `='.

Modified:
  head/share/examples/jails/jib
  head/share/examples/jails/jng

Modified: head/share/examples/jails/jib
==
--- head/share/examples/jails/jib   Fri Feb 12 01:12:44 2016
(r295553)
+++ head/share/examples/jails/jib   Fri Feb 12 01:41:40 2016
(r295554)
@@ -257,7 +257,7 @@ mustberoot_to_continue()
fi
 }
 
-jib_addm_usage="addm [-b BRIDGE_NAME] NAME interface0 [interface1 ...]"
+jib_addm_usage="addm [-b BRIDGE_NAME] NAME [!]iface0 [[!]iface1 ...]"
 jib_addm_descr="Creates e0b_NAME [e1b_NAME ...]"
 jib_addm()
 {
@@ -278,9 +278,14 @@ jib_addm()
mustberoot_to_continue
 
local iface eiface_devid_a eiface_devid_b
-   local new num quad i=0
+   local new no_derive num quad i=0
for iface in $*; do
 
+   no_derive=
+   case "$iface" in
+   !*) iface=${iface#!} no_derive=1 ;;
+   esac
+
# 1. Make sure the interface doesn't exist already
ifconfig "e${i}a_$name" > /dev/null 2>&1 && continue
 
@@ -309,9 +314,13 @@ jib_addm()
# 6. Set the MAC address of the new interface using a sensible
# algorithm to prevent conflicts on the network.
#
-   derive_mac -2 $iface "$name" eiface_devid_a eiface_devid_b
-   ifconfig "e${i}a_$name" ether $eiface_devid_a > /dev/null 2>&1
-   ifconfig "e${i}b_$name" ether $eiface_devid_b > /dev/null 2>&1
+   eiface_devid_a= eiface_devid_b=
+   [ "$no_derive" ] || derive_mac -2 $iface "$name" \
+   eiface_devid_a eiface_devid_b
+   if [ "$eiface_devid_a" -a "$eiface_devid_b" ]; then
+   ifconfig "e${i}a_$name" ether $eiface_devid_a
+   ifconfig "e${i}b_$name" ether $eiface_devid_b
+   fi > /dev/null 2>&1
 
i=$(( $i + 1 )) # on to next e{i}b_name
done # for iface

Modified: head/share/examples/jails/jng
==
--- head/share/examples/jails/jng   Fri Feb 12 01:12:44 2016
(r295553)
+++ head/share/examples/jails/jng   Fri Feb 12 01:41:40 2016
(r295554)
@@ -259,7 +259,7 @@ mustberoot_to_continue()
fi
 }
 
-jng_bridge_usage="bridge [-b BRIDGE_NAME] NAME [=]iface0 [[=]iface1 ...]"
+jng_bridge_usage="bridge [-b BRIDGE_NAME] NAME [!|=]iface0 [[!|=]iface1 ...]"
 jng_bridge_descr="Create ng0_NAME [ng1_NAME ...]"
 jng_bridge()
 {
@@ -281,12 +281,14 @@ jng_bridge()
mustberoot_to_continue
 
local iface parent eiface eiface_devid
-   local new clone_mac num quad i=0
+   local new clone_mac no_derive num quad i=0
for iface in $*; do
 
clone_mac=
+   no_derive=
case "$iface" in
=*) iface=${iface#=} clone_mac=1 ;;
+   !*) iface=${iface#!} no_derive=1 ;;
esac
 
# 0. Make sure the interface doesn't exist already
@@ -346,24 +348,15 @@ jng_bridge()
# 6. Set the MAC address of the new interface using a sensible
# algorithm to prevent conflicts on the network.
#
-   case "$iface" in
-   wlan[0-9]*)
-   parent=$( sysctl -n net.wlan.${iface#wlan}.%parent )
-   case "$parent" in
-   iwn[0-9]*)
-   # iwn(4) supports only 1 virtual net at a time
-   # NB: Cloning MAC allows new interface to work
-   clone_mac=1 ;;
-   esac
-   esac
+   eiface_devid=
if [ "$clone_mac" ]; then
-   eiface_devid=$(
-   ifconfig $iface ether | awk '/ether/,$0=$2'
-   )
-   else
+   eiface_devid=$( ifconfig $iface ether |
+   awk '/ether/,$0=$2' )
+   elif [ ! "$no_derive" ]; then
derive_mac $iface "$name" eiface_devid
fi
-   ifconfig $eiface ether $eiface_devid
+   [ "$eiface_devid" ] &&
+   ifconfig 

svn commit: r295556 - head/share/examples/jails

2016-02-11 Thread Devin Teske
Author: dteske
Date: Fri Feb 12 02:53:44 2016
New Revision: 295556
URL: https://svnweb.freebsd.org/changeset/base/295556

Log:
  Comments and fix small bug
  
  Reduce differences between jib/jng and fix a bug that would prevent
  additional interfaces from being created if the first of many already
  existed (counter wasn't incremented before calling only continue).

Modified:
  head/share/examples/jails/jib
  head/share/examples/jails/jng

Modified: head/share/examples/jails/jib
==
--- head/share/examples/jails/jib   Fri Feb 12 02:50:36 2016
(r29)
+++ head/share/examples/jails/jib   Fri Feb 12 02:53:44 2016
(r295556)
@@ -286,13 +286,16 @@ jib_addm()
!*) iface=${iface#!} no_derive=1 ;;
esac
 
-   # 1. Make sure the interface doesn't exist already
-   ifconfig "e${i}a_$name" > /dev/null 2>&1 && continue
+   # Make sure the interface doesn't exist already
+   if ifconfig "e${i}a_$name" > /dev/null 2>&1; then
+   i=$(( $i + 1 ))
+   continue
+   fi
 
-   # 2. Bring the interface up
+   # Bring the interface up
ifconfig $iface up || return
 
-   # 3. Make sure the interface has been bridged
+   # Make sure the interface has been bridged
if ! ifconfig "$iface$bridge" > /dev/null 2>&1; then
new=$( ifconfig bridge create ) || return
ifconfig $new addm $iface || return
@@ -300,18 +303,18 @@ jib_addm()
ifconfig "$iface$bridge" up || return
fi
 
-   # 4. Create a new interface to the bridge
+   # Create a new interface to the bridge
new=$( ifconfig epair create ) || return
ifconfig "$iface$bridge" addm $new || return
 
-   # 5. Rename the new interface
+   # Rename the new interface
ifconfig $new name "e${i}a_$name" || return
ifconfig ${new%a}b name "e${i}b_$name" || return
ifconfig "e${i}a_$name" up || return
ifconfig "e${i}b_$name" up || return
 
#
-   # 6. Set the MAC address of the new interface using a sensible
+   # Set the MAC address of the new interface using a sensible
# algorithm to prevent conflicts on the network.
#
eiface_devid_a= eiface_devid_b=
@@ -322,7 +325,7 @@ jib_addm()
ifconfig "e${i}b_$name" ether $eiface_devid_b
fi > /dev/null 2>&1
 
-   i=$(( $i + 1 )) # on to next e{i}b_name
+   i=$(( $i + 1 ))
done # for iface
 }
 

Modified: head/share/examples/jails/jng
==
--- head/share/examples/jails/jng   Fri Feb 12 02:50:36 2016
(r29)
+++ head/share/examples/jails/jng   Fri Feb 12 02:53:44 2016
(r295556)
@@ -291,18 +291,21 @@ jng_bridge()
!*) iface=${iface#!} no_derive=1 ;;
esac
 
-   # 0. Make sure the interface doesn't exist already
+   # Make sure the interface doesn't exist already
eiface=ng${i}_$name
-   ngctl msg "$eiface:" getifname > /dev/null 2>&1 && continue
+   if ngctl msg "$eiface:" getifname > /dev/null 2>&1; then
+   i=$(( $i + 1 ))
+   continue
+   fi
 
-   # 1. Bring the interface up
+   # Bring the interface up
ifconfig $iface up || return
 
-   # 2. Set promiscuous mode and don't overwrite src addr
+   # Set promiscuous mode and don't overwrite src addr
ngctl msg $iface: setpromisc 1 || return
ngctl msg $iface: setautosrc 0 || return
 
-   # 3. Make sure the interface has been bridged
+   # Make sure the interface has been bridged
if ! ngctl info ${iface}bridge: > /dev/null 2>&1; then
ngctl mkpeer $iface: bridge lower link0 || return
ngctl connect $iface: $iface:lower upper link1 ||
@@ -310,7 +313,7 @@ jng_bridge()
ngctl name $iface:lower ${iface}bridge || return
fi
 
-   # 3.5. Optionally create a secondary bridge
+   # Optionally create a secondary bridge
if [ "$bridge" != "bridge" ] &&
   ! ngctl info "$iface$bridge:" > /dev/null 2>&1
then
@@ -326,7 +329,7 @@ jng_bridge()
return
fi
 
-   # 4. Create a new interface to the bridge
+   # Create a new interface to the bridge

Re: svn commit: r295529 - in head/sys: net netinet netinet6

2016-02-11 Thread Kubilay Kocak
On 12/02/2016 4:07 AM, Devin Teske wrote:
> Author: dteske
> Date: Thu Feb 11 17:07:19 2016
> New Revision: 295529
> URL: https://svnweb.freebsd.org/changeset/base/295529
> 
> Log:
>   Merge SVN r295220 (bz) from projects/vnet/
>   
>   Fix a panic that occurs when a vnet interface is unavailable at the time the
>   vnet jail referencing said interface is stopped.
>   
>   Sponsored by:   FIS Global, Inc.


Was/is there a bugzilla issue for this?

Also, MFC and/or re (10.3-R) candidate?

> Modified:
>   head/sys/net/route.c
>   head/sys/netinet/in_rmx.c
>   head/sys/netinet6/in6_rmx.c
> Directory Properties:
>   head/   (props changed)
>   head/sys/   (props changed)
> 
> Modified: head/sys/net/route.c
> ==
> --- head/sys/net/route.c  Thu Feb 11 16:54:23 2016(r295528)
> +++ head/sys/net/route.c  Thu Feb 11 17:07:19 2016(r295529)
> @@ -353,10 +353,24 @@ rt_table_init(int offset)
>   return (rh);
>  }
>  
> +static int
> +rt_freeentry(struct radix_node *rn, void *arg)
> +{
> + struct radix_head * const rnh = arg;
> + struct radix_node *x;
> +
> + x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh);
> + if (x != NULL)
> + R_Free(x);
> + return (0);
> +}
> +
>  void
>  rt_table_destroy(struct rib_head *rh)
>  {
>  
> + rn_walktree(>rmhead.head, rt_freeentry, >rmhead.head);
> +
>   /* Assume table is already empty */
>   rw_destroy(>rib_lock);
>   free(rh, M_RTABLE);
> 
> Modified: head/sys/netinet/in_rmx.c
> ==
> --- head/sys/netinet/in_rmx.c Thu Feb 11 16:54:23 2016(r295528)
> +++ head/sys/netinet/in_rmx.c Thu Feb 11 17:07:19 2016(r295529)
> @@ -133,7 +133,8 @@ int
>  in_detachhead(void **head, int off)
>  {
>  
> - return (rn_detachhead(head));
> + rt_table_destroy((struct rib_head *)(*head));
> + return (1);
>  }
>  #endif
>  
> 
> Modified: head/sys/netinet6/in6_rmx.c
> ==
> --- head/sys/netinet6/in6_rmx.c   Thu Feb 11 16:54:23 2016
> (r295528)
> +++ head/sys/netinet6/in6_rmx.c   Thu Feb 11 17:07:19 2016
> (r295529)
> @@ -237,7 +237,9 @@ in6_detachhead(void **head, int off)
>  {
>  
>   callout_drain(_rtq_mtutimer);
> - return (rn_detachhead(head));
> + rt_table_destroy((struct rib_head *)(*head));
> +
> + return (1);
>  }
>  #endif
>  
> ___
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
> 

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


svn commit: r295555 - head/etc/rc.d

2016-02-11 Thread Devin Teske
Author: dteske
Date: Fri Feb 12 02:50:36 2016
New Revision: 29
URL: https://svnweb.freebsd.org/changeset/base/29

Log:
  Interpret vnet_interface/vnet.interface as array

Modified:
  head/etc/rc.d/jail

Modified: head/etc/rc.d/jail
==
--- head/etc/rc.d/jail  Fri Feb 12 01:41:40 2016(r295554)
+++ head/etc/rc.d/jail  Fri Feb 12 02:50:36 2016(r29)
@@ -33,7 +33,8 @@ need_dad_wait=
 #  set it to $param.  If not defined, $defval is used.
 #  When $num is [0-9]*, ${jail_$jv_$name$num} are looked up and
 #  $param is set by using +=.  $num=0 is optional (params may start at 1).
-#  When $num is YN or NY, the value is interpret as boolean.
+#  When $num is YN or NY, the value is interpreted as boolean.
+#  When $num is @, the value is interpreted as an array separted by IFS.
 extract_var()
 {
local i _jv _name _param _num _def _name1 _name2
@@ -78,6 +79,20 @@ extract_var()
i=$(($i + 1))
done
;;
+   @)
+   _name1=jail_${_jv}_${_name}
+   _name2=jail_${_name}
+   eval _tmpargs=\"\${$_name1:-\${$_name2:-$_def}}\"
+   set -- $_tmpargs
+   if [ $# -gt 0 ]; then
+   echo -n "   $_param = "
+   while [ $# -gt 1 ]; do
+   echo -n "\"$1\", "
+   shift
+   done
+   echo "\"$1\";"
+   fi
+   ;;
*)
_name1=jail_${_jv}_${_name}
_name2=jail_${_name}
@@ -190,7 +205,7 @@ parse_options()
allow.raw_sockets NY YES
else
echo "  vnet;"
-   extract_var $_jv vnet_interface vnet.interface - ""
+   extract_var $_jv vnet_interface vnet.interface @ ""
fi
 
echo "  exec.clean;"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295527 - head/sys/mips/mips

2016-02-11 Thread Andrew Turner
Author: andrew
Date: Thu Feb 11 16:43:23 2016
New Revision: 295527
URL: https://svnweb.freebsd.org/changeset/base/295527

Log:
  Include the correct header to get a phandle_t needed by ofw_bus_if.h. While
  here only include opt_platform.h once.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/mips/mips/nexus.c

Modified: head/sys/mips/mips/nexus.c
==
--- head/sys/mips/mips/nexus.c  Thu Feb 11 16:39:30 2016(r295526)
+++ head/sys/mips/mips/nexus.c  Thu Feb 11 16:43:23 2016(r295527)
@@ -64,10 +64,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#include "opt_platform.h"
-
 #ifdef FDT
-#include 
+#include 
 #include "ofw_bus_if.h"
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295529 - in head/sys: net netinet netinet6

2016-02-11 Thread Devin Teske
Author: dteske
Date: Thu Feb 11 17:07:19 2016
New Revision: 295529
URL: https://svnweb.freebsd.org/changeset/base/295529

Log:
  Merge SVN r295220 (bz) from projects/vnet/
  
  Fix a panic that occurs when a vnet interface is unavailable at the time the
  vnet jail referencing said interface is stopped.
  
  Sponsored by: FIS Global, Inc.

Modified:
  head/sys/net/route.c
  head/sys/netinet/in_rmx.c
  head/sys/netinet6/in6_rmx.c
Directory Properties:
  head/   (props changed)
  head/sys/   (props changed)

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cThu Feb 11 16:54:23 2016(r295528)
+++ head/sys/net/route.cThu Feb 11 17:07:19 2016(r295529)
@@ -353,10 +353,24 @@ rt_table_init(int offset)
return (rh);
 }
 
+static int
+rt_freeentry(struct radix_node *rn, void *arg)
+{
+   struct radix_head * const rnh = arg;
+   struct radix_node *x;
+
+   x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh);
+   if (x != NULL)
+   R_Free(x);
+   return (0);
+}
+
 void
 rt_table_destroy(struct rib_head *rh)
 {
 
+   rn_walktree(>rmhead.head, rt_freeentry, >rmhead.head);
+
/* Assume table is already empty */
rw_destroy(>rib_lock);
free(rh, M_RTABLE);

Modified: head/sys/netinet/in_rmx.c
==
--- head/sys/netinet/in_rmx.c   Thu Feb 11 16:54:23 2016(r295528)
+++ head/sys/netinet/in_rmx.c   Thu Feb 11 17:07:19 2016(r295529)
@@ -133,7 +133,8 @@ int
 in_detachhead(void **head, int off)
 {
 
-   return (rn_detachhead(head));
+   rt_table_destroy((struct rib_head *)(*head));
+   return (1);
 }
 #endif
 

Modified: head/sys/netinet6/in6_rmx.c
==
--- head/sys/netinet6/in6_rmx.c Thu Feb 11 16:54:23 2016(r295528)
+++ head/sys/netinet6/in6_rmx.c Thu Feb 11 17:07:19 2016(r295529)
@@ -237,7 +237,9 @@ in6_detachhead(void **head, int off)
 {
 
callout_drain(_rtq_mtutimer);
-   return (rn_detachhead(head));
+   rt_table_destroy((struct rib_head *)(*head));
+
+   return (1);
 }
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r295523 - head/sys/fs/ext2fs

2016-02-11 Thread Bruce Evans

On Thu, 11 Feb 2016, Pedro F. Giffuni wrote:


Log:
 Ext4: Use boolean type instead of '0' and '1'

 There are precedents of uses of bool in the kernel and
 it is incorrect style to use integers as replacement for
 a boolean type.


This is all backwards.

It is correct style to use integers to represent booleans.

There are precedents for breaking this style by using the
bool type, but not many in fs code:

In all of /sys/fs/*, there were just 12 lines of declarations
that use 'bool'.  All of these were in autofs.  Now there are
13 such lines (1 more in ext2fs).  1 use is especially useless
and especially unlikely to be all uses of booleans.

/sys/fs/nfsclient uses boolean_t in 1 whole line.  boolean_t is
an old spelling of 'bool'.  It is a Mach type for representing
booleans in /sys/vm.  I used to like such typedefs 20-30 years ago
(mine was spelled bool_t) and made the mistake of using the Mach
type elsewhere in the kernel.  The use in nfsclient is actually
correct.  It is used to hold the result of a vm function which
returns boolean_t.

/sys/fs/nfsserver uses bool_t in 1 whole line.  bool_t is is
like boolean_t except in is Sun(?) type for reprenting booleans
in rpc.  It use is again correct -- it is used to hold the
result of an rpc function that returns bool_t.

/sys/fs/tmpfs the Mach spelling on 5 lines.  These uses are to
sks for small pessimizations, but inlining and -O usually gives
the same object code as using integers.  The values start as
flags which are naturally represented as integers and are tested
by expressions of the form (de->td_cookie & FLAG).  These simple
flags tests are obfuscated using function calls.  The functions
return boolean_t, so must convert to a logical expression.  They
do this correctly.  Then the compiler should optimize away all
the obfuscations and pessimizations to give the same object code
as if you wrote the tests directly.

ffs and zfs provided perhaps better examples.  /sys/cddl uses
boolean_t on 102 lines.  It isn't clear what this type is.
compat/opensolaris/sys/types.h seems to use the FreeBSD kernel
boolean_t in the kernel, but in userland it uses 2 different
enum types depending on options.  These types are incompatible
so this depends on magic to work.  /sys/cddl also uses bool_t
twice, once each for rpc and nvpair.  /sys/cddl never uses
C99 bool.

ffs used to use a very pure KNF style with integers and no
typedefs, but it now uses C99 bool on 4 lines.  These uses are
correct.

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


Re: svn commit: r294327 - in head/sys: dev/cxgb dev/cxgbe dev/e1000 dev/hyperv/netvsc dev/ixgbe dev/mxge netinet sys

2016-02-11 Thread Warner Losh
On Wed, Feb 10, 2016 at 8:08 AM, Pedro Giffuni  wrote:

> Hello;
>
> El 10/02/2016 a las 02:20, Hans Petter Selasky escribió:
>
>> On 01/19/16 17:09, Ryan Stone wrote:
>>
>>> On Tue, Jan 19, 2016 at 10:33 AM, Hans Petter Selasky <
>>> hsela...@freebsd.org>
>>> wrote:
>>>
>>>
 +   qsort(lc->lro_mbuf_data, lc->lro_mbuf_count, sizeof(struct mbuf
 *),
 +   _lro_mbuf_compare_header);


>>> In the worst case, qsort() can take O(n**2) time and consume O(n) stack
>>> space.  Is there a DOS concern here?
>>>
>>>
>> Hi,
>>
>> Our FreeBSD qsort() routine has been specifically modified to not exhibit
>> the so-called QuickSort worst case behaviour of O(N**2) sorting time. This
>> is not documented in our source code, but here:
>>
>> http://cs.fit.edu/~pkc/classes/writing/samples/bentley93engineering.pdf
>>
>> So I think DOS w.r.t O(N**2) is not a valid consern.
>>
>> Thank you for your input Ryan.
>>
>> BTW:
>>
>> Drew Gallatin has tested our qsort() v.s. my mergesort() and found that:
>>
>> "It looks like mergesort is nearly 2x as expensive. (4.7% vs 2.5%)"
>>
>>
> FWIW, our libc qsort() has an additional enhancement:
>
> http://svnweb.freebsd.org/base?view=revision=279663
>
> In my measurements qsort(3) was now always faster than mergesort(3).


If it is faster, is there any good reason to maintain both qsort and
mergesort
in the kernel then?

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

Re: svn commit: r295459 - in head/sys: arm/include sys

2016-02-11 Thread Warner Losh
On Wed, Feb 10, 2016 at 3:43 AM, Andrew Turner  wrote:

> On Wed, 10 Feb 2016 04:43:08 + (UTC)
> Adrian Chadd  wrote:
>
> > Author: adrian
> > Date: Wed Feb 10 04:43:08 2016
> > New Revision: 295459
> > URL: https://svnweb.freebsd.org/changeset/base/295459
> >
> > Log:
> >   Break out the shared bits of the arm intrng definitions into
> > sys/intr.h; leave the machine dependent bits in sys/arm/.
> >
> >   This is in preparation for MIPS INTRNG work.
> >
> >   Submitted by:   Stanislav Galabov 
> ...
> > Added: head/sys/sys/intr.h
> >
> ==
> > --- /dev/null 00:00:00 1970   (empty, because file is
> > newly added) +++ head/sys/sys/intr.h  Wed Feb 10 04:43:08
> > 2016  (r295459) @@ -0,0 +1,130 @@
> > +/*   $NetBSD: intr.h,v 1.7 2003/06/16 20:01:00 thorpej Exp
> > $ */ +
> > +/*-
> > + * Copyright (c) 1997 Mark Brinicombe.
> > + * All rights reserved.
>
> Is this still the case? It seems all the code in this file was written
> for intrng and not by Mark Brinicombe.
>

More generally, we should look to see if any of the original Brinicombe code
survives or not in each of the files that we've taken, copied and modified.
While
I like Mark (used to work with him), if there's none of his original code
left, it will
help with license regulariszation if we can remove  him where he's not
relevant.
The same applies to many other folks as well, btw.

But think kind of work is, at the best of times, thankless.

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


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

2016-02-11 Thread Andrew Turner
Author: andrew
Date: Thu Feb 11 18:01:10 2016
New Revision: 295540
URL: https://svnweb.freebsd.org/changeset/base/295540

Log:
  Enable ARM_INTRNG on all kernel configs where we use the Generic Interrupt
  Controller.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/conf/ALPINE
  head/sys/arm/conf/ARMADA38X
  head/sys/arm/conf/EXYNOS5.common
  head/sys/arm/conf/ODROIDC1
  head/sys/arm/conf/PANDABOARD
  head/sys/arm/conf/RK3188
  head/sys/arm/conf/SOCKIT.common
  head/sys/arm/conf/VIRT
  head/sys/arm/conf/VSATV102
  head/sys/arm/conf/VYBRID
  head/sys/arm/conf/ZEDBOARD

Modified: head/sys/arm/conf/ALPINE
==
--- head/sys/arm/conf/ALPINEThu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/ALPINEThu Feb 11 18:01:10 2016(r295540)
@@ -37,6 +37,7 @@ options   DDB #Enable the kernel 
debugg
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
 
 # Pseudo devices
 device loop

Modified: head/sys/arm/conf/ARMADA38X
==
--- head/sys/arm/conf/ARMADA38X Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/ARMADA38X Thu Feb 11 18:01:10 2016(r295540)
@@ -62,6 +62,7 @@ devicepci
 
 # Interrupt controllers
 device gic
+optionsARM_INTRNG
 
 # Timers
 device mpcore_timer

Modified: head/sys/arm/conf/EXYNOS5.common
==
--- head/sys/arm/conf/EXYNOS5.commonThu Feb 11 17:57:42 2016
(r295539)
+++ head/sys/arm/conf/EXYNOS5.commonThu Feb 11 18:01:10 2016
(r295540)
@@ -87,6 +87,8 @@ devicedwmmc
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM Generic Timer
 device generic_timer
 

Modified: head/sys/arm/conf/ODROIDC1
==
--- head/sys/arm/conf/ODROIDC1  Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/ODROIDC1  Thu Feb 11 18:01:10 2016(r295540)
@@ -26,6 +26,7 @@ options   SMP # Enable multiple cores
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
 
 optionsFDT_DTB_STATIC
 makeoptionsFDT_DTS_FILE=odroidc1.dts

Modified: head/sys/arm/conf/PANDABOARD
==
--- head/sys/arm/conf/PANDABOARDThu Feb 11 17:57:42 2016
(r295539)
+++ head/sys/arm/conf/PANDABOARDThu Feb 11 18:01:10 2016
(r295540)
@@ -30,8 +30,6 @@ hints "PANDABOARD.hints"
 include"std.armv6"
 include"../ti/omap4/pandaboard/std.pandaboard"
 
-optionsARM_INTRNG  # new interrupt framework
-
 optionsHZ=100
 optionsSCHED_ULE   # ULE scheduler
 optionsPLATFORM
@@ -62,6 +60,8 @@ options   DDB # Enable the kernel 
debug
 device fdt_pinctrl
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM MPCore timer
 device mpcore_timer
 

Modified: head/sys/arm/conf/RK3188
==
--- head/sys/arm/conf/RK3188Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/RK3188Thu Feb 11 18:01:10 2016(r295540)
@@ -47,6 +47,8 @@ options   ROOTDEVNAME=\"ufs:/dev/mmcsd0\"
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM MPCore timer
 device mpcore_timer
 

Modified: head/sys/arm/conf/SOCKIT.common
==
--- head/sys/arm/conf/SOCKIT.common Thu Feb 11 17:57:42 2016
(r295539)
+++ head/sys/arm/conf/SOCKIT.common Thu Feb 11 18:01:10 2016
(r295540)
@@ -53,6 +53,8 @@ options   INVARIANT_SUPPORT   # Extra sanit
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM MPCore timer
 device mpcore_timer
 

Modified: head/sys/arm/conf/VIRT
==
--- head/sys/arm/conf/VIRT  Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/VIRT  Thu Feb 11 18:01:10 2016(r295540)
@@ -46,6 +46,8 @@ options   INVARIANT_SUPPORT   # Extra sanit
 
 # Interrupt controller
 device gic
+optionsARM_INTRNG
+
 # ARM Generic Timer
 device generic_timer
 

Modified: head/sys/arm/conf/VSATV102
==
--- head/sys/arm/conf/VSATV102  Thu Feb 11 17:57:42 2016(r295539)
+++ head/sys/arm/conf/VSATV102  Thu Feb 11 18:01:10 2016(r295540)
@@ -26,6 +26,7 @@ options   SMP # Enable 

svn commit: r295516 - head/sys/arm64/arm64

2016-02-11 Thread Zbigniew Bodek
Author: zbb
Date: Thu Feb 11 11:59:32 2016
New Revision: 295516
URL: https://svnweb.freebsd.org/changeset/base/295516

Log:
  Call pmc_hook() correctly in the ARM64 interrupt handler
  
  pmc_hook() was called only in case of the stray interrupt but should
  rather be called on each interrupt. Move in to the arm_cpu_intr()
  handler, out of the critical section too.
  
  Reviewed by:   br
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Differential Revision: https://reviews.freebsd.org/D5161

Modified:
  head/sys/arm64/arm64/intr_machdep.c

Modified: head/sys/arm64/arm64/intr_machdep.c
==
--- head/sys/arm64/arm64/intr_machdep.c Thu Feb 11 11:58:27 2016
(r295515)
+++ head/sys/arm64/arm64/intr_machdep.c Thu Feb 11 11:59:32 2016
(r295516)
@@ -473,10 +473,6 @@ stray:
 
if (intr != NULL)
PIC_MASK(root_pic, intr->i_hw_irq);
-#ifdef HWPMC_HOOKS
-   if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
-   pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
-#endif
 }
 
 void
@@ -486,6 +482,10 @@ arm_cpu_intr(struct trapframe *tf)
critical_enter();
PIC_DISPATCH(root_pic, tf);
critical_exit();
+#ifdef HWPMC_HOOKS
+   if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+   pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
+#endif
 }
 
 #ifdef SMP
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295535 - in head: contrib/unbound contrib/unbound/doc contrib/unbound/services contrib/unbound/util contrib/unbound/validator lib/libunbound usr.sbin/unbound/local-setup

2016-02-11 Thread Dag-Erling Smørgrav
Author: des
Date: Thu Feb 11 17:37:02 2016
New Revision: 295535
URL: https://svnweb.freebsd.org/changeset/base/295535

Log:
  Use the new insecure-lan-zones option instead of listing each AS112 zone
  separately.
  
  MFC after:3 days

Added:
  head/contrib/unbound/util/as112.c
 - copied unchanged from r295530, vendor/unbound/dist/util/as112.c
  head/contrib/unbound/util/as112.h
 - copied unchanged from r295530, vendor/unbound/dist/util/as112.h
Modified:
  head/contrib/unbound/Makefile.in
  head/contrib/unbound/doc/example.conf
  head/contrib/unbound/doc/example.conf.in
  head/contrib/unbound/doc/unbound.conf.5
  head/contrib/unbound/doc/unbound.conf.5.in
  head/contrib/unbound/services/localzone.c
  head/contrib/unbound/util/config_file.c
  head/contrib/unbound/util/config_file.h
  head/contrib/unbound/util/configlexer.lex
  head/contrib/unbound/util/configparser.y
  head/contrib/unbound/validator/val_anchor.c
  head/lib/libunbound/Makefile
  head/usr.sbin/unbound/local-setup/local-unbound-setup.sh
Directory Properties:
  head/contrib/unbound/   (props changed)

Modified: head/contrib/unbound/Makefile.in
==
--- head/contrib/unbound/Makefile.inThu Feb 11 17:34:26 2016
(r295534)
+++ head/contrib/unbound/Makefile.inThu Feb 11 17:37:02 2016
(r295535)
@@ -95,7 +95,7 @@ PYUNBOUND_SRC=
 # libunbound_wrap.lo if python libunbound wrapper enabled.
 PYUNBOUND_OBJ=@PYUNBOUND_OBJ@
 COMMON_SRC=services/cache/dns.c services/cache/infra.c services/cache/rrset.c \
-util/data/dname.c util/data/msgencode.c util/data/msgparse.c \
+util/as112.c util/data/dname.c util/data/msgencode.c util/data/msgparse.c \
 util/data/msgreply.c util/data/packed_rrset.c iterator/iterator.c \
 iterator/iter_delegpt.c iterator/iter_donotq.c iterator/iter_fwd.c \
 iterator/iter_hints.c iterator/iter_priv.c iterator/iter_resptype.c \
@@ -113,7 +113,7 @@ validator/val_neg.c validator/val_nsec3.
 validator/val_secalgo.c validator/val_sigcrypt.c \
 validator/val_utils.c dns64/dns64.c $(CHECKLOCK_SRC) $(DNSTAP_SRC)
 COMMON_OBJ_WITHOUT_NETCALL=dns.lo infra.lo rrset.lo dname.lo msgencode.lo \
-msgparse.lo msgreply.lo packed_rrset.lo iterator.lo iter_delegpt.lo \
+as112.lo msgparse.lo msgreply.lo packed_rrset.lo iterator.lo iter_delegpt.lo \
 iter_donotq.lo iter_fwd.lo iter_hints.lo iter_priv.lo iter_resptype.lo \
 iter_scrub.lo iter_utils.lo localzone.lo mesh.lo modstack.lo \
 outbound_list.lo alloc.lo config_file.lo configlexer.lo configparser.lo \
@@ -595,6 +595,7 @@ depend:
rm -f $(DEPEND_TMP) $(DEPEND_TMP2)
 
 # Dependencies
+as112.lo as112.o: $(srcdir)/util/as112.c $(srcdir)/util/as112.h
 dns.lo dns.o: $(srcdir)/services/cache/dns.c config.h 
$(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \
  $(srcdir)/validator/val_nsec.h $(srcdir)/util/data/packed_rrset.h 
$(srcdir)/util/storage/lruhash.h \
  $(srcdir)/util/locks.h $(srcdir)/services/cache/dns.h 
$(srcdir)/util/data/msgreply.h \
@@ -702,7 +703,7 @@ localzone.lo localzone.o: $(srcdir)/serv
  $(srcdir)/sldns/sbuffer.h $(srcdir)/util/regional.h 
$(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h \
  $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/packed_rrset.h 
$(srcdir)/util/data/msgencode.h \
  $(srcdir)/util/net_help.h $(srcdir)/util/netevent.h 
$(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/util/as112.h
 mesh.lo mesh.o: $(srcdir)/services/mesh.c config.h $(srcdir)/services/mesh.h 
$(srcdir)/util/rbtree.h \
  $(srcdir)/util/netevent.h $(srcdir)/util/data/msgparse.h 
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
  $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h 
$(srcdir)/util/module.h \
@@ -821,7 +822,7 @@ val_anchor.lo val_anchor.o: $(srcdir)/va
  $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h 
$(srcdir)/validator/val_sigcrypt.h \
  $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h 
$(srcdir)/validator/autotrust.h \
  $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h 
$(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h \
- $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h $(srcdir)/util/as112.h
 validator.lo validator.o: $(srcdir)/validator/validator.c config.h 
$(srcdir)/validator/validator.h \
  $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h 
$(srcdir)/util/locks.h $(srcdir)/util/log.h \
  $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h 
$(srcdir)/util/data/msgparse.h \

Modified: head/contrib/unbound/doc/example.conf
==
--- head/contrib/unbound/doc/example.conf   Thu Feb 11 17:34:26 2016
(r295534)
+++ head/contrib/unbound/doc/example.conf   Thu Feb 11 17:37:02 2016
(r295535)
@@ -508,13 

svn commit: r295533 - in head: . tools/build/mk usr.sbin/unbound/control

2016-02-11 Thread Dag-Erling Smørgrav
Author: des
Date: Thu Feb 11 17:33:55 2016
New Revision: 295533
URL: https://svnweb.freebsd.org/changeset/base/295533

Log:
  Remove unbound-contrl-setup since we use a local control socket which
  does not require keys.
  
  MFC after:3 days
  Relnotes: yes

Modified:
  head/ObsoleteFiles.inc
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/unbound/control/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Thu Feb 11 17:32:41 2016(r295532)
+++ head/ObsoleteFiles.inc  Thu Feb 11 17:33:55 2016(r295533)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20160211: Remove obsolete unbound-control-setup
+OLD_FILES+=usr/sbin/unbound-control-setup
 # 20160116: Update mandoc to cvs snapshot 20160116
 OLD_FILES+=usr/share/mdocml/example.style.css
 OLD_FILES+=usr/share/mdocml/style.css

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Feb 11 17:32:41 
2016(r295532)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Feb 11 17:33:55 
2016(r295533)
@@ -7970,7 +7970,6 @@ OLD_FILES+=usr/sbin/unbound
 OLD_FILES+=usr/sbin/unbound-anchor
 OLD_FILES+=usr/sbin/unbound-checkconf
 OLD_FILES+=usr/sbin/unbound-control
-OLD_FILES+=usr/sbin/unbound-control-setup
 OLD_FILES+=usr/share/man/man5/unbound.conf.5.gz
 OLD_FILES+=usr/share/man/man8/unbound-anchor.8.gz
 OLD_FILES+=usr/share/man/man8/unbound-checkconf.8.gz

Modified: head/usr.sbin/unbound/control/Makefile
==
--- head/usr.sbin/unbound/control/Makefile  Thu Feb 11 17:32:41 2016
(r295532)
+++ head/usr.sbin/unbound/control/Makefile  Thu Feb 11 17:33:55 2016
(r295533)
@@ -7,7 +7,6 @@ UNBOUNDDIR= ${.CURDIR}/../../../contrib/
 .PATH: ${UNBOUNDDIR} ${UNBOUNDDIR}/smallapp ${UNBOUNDDIR}/doc
 
 PROG=  unbound-control
-SCRIPTS=   unbound-control-setup.sh
 SRCS=  unbound-control.c worker_cb.c
 CFLAGS=-I${UNBOUNDDIR} -I${LDNSDIR}
 LIBADD=unbound crypto ssl pthread
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-02-11 Thread Jim Harris
Author: jimharris
Date: Thu Feb 11 17:32:41 2016
New Revision: 295532
URL: https://svnweb.freebsd.org/changeset/base/295532

Log:
  nvme: avoid duplicate SET_NUM_QUEUES commands
  
  nvme(4) issues a SET_NUM_QUEUES command during device
  initialization to ensure enough I/O queues exists for each
  of the MSI-X vectors we have allocated.  The SET_NUM_QUEUES
  command is then issued again during nvme_ctrlr_start(), to
  ensure that is properly set after any controller reset.
  
  At least one NVMe drive exists which fails this second
  SET_NUM_QUEUES command during device initialization.  So
  change nvme_ctrlr_start() to only issue its SET_NUM_QUEUES
  command when it is coming out of a reset - avoiding the
  duplicate SET_NUM_QUEUES during device initialization.
  
  Reported by:  gallatin
  MFC after:3 days
  Sponsored by: Intel

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Thu Feb 11 17:31:17 2016
(r295531)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Thu Feb 11 17:32:41 2016
(r295532)
@@ -725,15 +725,17 @@ nvme_ctrlr_start(void *ctrlr_arg)
 *  explicit specify how many queues it will use.  This value should
 *  never change between resets, so panic if somehow that does happen.
 */
-   old_num_io_queues = ctrlr->num_io_queues;
-   if (nvme_ctrlr_set_num_qpairs(ctrlr) != 0) {
-   nvme_ctrlr_fail(ctrlr);
-   return;
-   }
+   if (ctrlr->is_resetting) {
+   old_num_io_queues = ctrlr->num_io_queues;
+   if (nvme_ctrlr_set_num_qpairs(ctrlr) != 0) {
+   nvme_ctrlr_fail(ctrlr);
+   return;
+   }
 
-   if (old_num_io_queues != ctrlr->num_io_queues) {
-   panic("num_io_queues changed from %u to %u", old_num_io_queues,
-   ctrlr->num_io_queues);
+   if (old_num_io_queues != ctrlr->num_io_queues) {
+   panic("num_io_queues changed from %u to %u",
+ old_num_io_queues, ctrlr->num_io_queues);
+   }
}
 
if (nvme_ctrlr_create_qpairs(ctrlr) != 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r294327 - in head/sys: dev/cxgb dev/cxgbe dev/e1000 dev/hyperv/netvsc dev/ixgbe dev/mxge netinet sys

2016-02-11 Thread Benjamin Kaduk
On Thu, Feb 11, 2016 at 10:47 AM, Warner Losh  wrote:

> On Wed, Feb 10, 2016 at 8:08 AM, Pedro Giffuni  wrote:
>
>
> If it is faster, is there any good reason to maintain both qsort and
> mergesort
> in the kernel then?
>

qsort is not stable; mergesort is.
(It's a shame that glibc didn't pick up mergesort.)

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


svn commit: r295536 - head/lib/libfetch

2016-02-11 Thread Dag-Erling Smørgrav
Author: des
Date: Thu Feb 11 17:48:15 2016
New Revision: 295536
URL: https://svnweb.freebsd.org/changeset/base/295536

Log:
  Fix double-free error: r289419 moved all error handling in http_connect()
  to the end of the function, but did not remove a fetch_close() call which
  was made redundant by the one in the shared error-handling code.
  
  PR:   206774
  Submitted by: Christian Heckendorf 
  MFC after:3 days

Modified:
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cThu Feb 11 17:37:02 2016(r295535)
+++ head/lib/libfetch/http.cThu Feb 11 17:48:15 2016(r295536)
@@ -1435,7 +1435,6 @@ http_connect(struct url *URL, struct url
}
if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 &&
fetch_ssl(conn, URL, verbose) == -1) {
-   fetch_close(conn);
/* grrr */
errno = EAUTH;
fetch_syserr();
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295541 - head/sys/netinet

2016-02-11 Thread Michael Tuexen
Author: tuexen
Date: Thu Feb 11 18:35:46 2016
New Revision: 295541
URL: https://svnweb.freebsd.org/changeset/base/295541

Log:
  Use 4 spaces instead of a tab.

Modified:
  head/sys/netinet/sctp_sysctl.c

Modified: head/sys/netinet/sctp_sysctl.c
==
--- head/sys/netinet/sctp_sysctl.c  Thu Feb 11 18:01:10 2016
(r295540)
+++ head/sys/netinet/sctp_sysctl.c  Thu Feb 11 18:35:46 2016
(r295541)
@@ -426,11 +426,11 @@ sctp_sysctl_handle_assoclist(SYSCTL_HAND
xinpcb.maxqlen = 0;
} else {
xinpcb.qlen = so->so_qlen;
-   xinpcb.qlen_old = so->so_qlen > USHRT_MAX ? 
-   USHRT_MAX : (uint16_t) so->so_qlen;
+   xinpcb.qlen_old = so->so_qlen > USHRT_MAX ?
+   USHRT_MAX : (uint16_t) so->so_qlen;
xinpcb.maxqlen = so->so_qlimit;
-   xinpcb.maxqlen_old = so->so_qlimit > USHRT_MAX ? 
-   USHRT_MAX : (uint16_t) so->so_qlimit;
+   xinpcb.maxqlen_old = so->so_qlimit > USHRT_MAX ?
+   USHRT_MAX : (uint16_t) so->so_qlimit;
}
SCTP_INP_INCR_REF(inp);
SCTP_INP_RUNLOCK(inp);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295542 - head/share/examples/jails

2016-02-11 Thread Devin Teske
Author: dteske
Date: Thu Feb 11 18:37:02 2016
New Revision: 295542
URL: https://svnweb.freebsd.org/changeset/base/295542

Log:
  Add example VIMAGE config required by vnet jails

Added:
  head/share/examples/jails/VIMAGE   (contents, props changed)
Modified:
  head/share/examples/jails/README

Modified: head/share/examples/jails/README
==
--- head/share/examples/jails/READMEThu Feb 11 18:35:46 2016
(r295541)
+++ head/share/examples/jails/READMEThu Feb 11 18:37:02 2016
(r295542)
@@ -1,5 +1,13 @@
 # $FreeBSD$
 
+The below 4 samples require a VIMAGE enabled kernel:
+
+   # (as root)
+   $ cp VIMAGE /usr/src/sys/amd64/conf/
+   $ cd /usr/src
+   $ make KERNCONF=VIMAGE kernel
+   $ reboot
+
 Sample 1: jail.conf(5)
 
$ cp jib jng /usr/sbin/

Added: head/share/examples/jails/VIMAGE
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/examples/jails/VIMAGEThu Feb 11 18:37:02 2016
(r295542)
@@ -0,0 +1,59 @@
+# $FreeBSD$
+
+
+# VIMAGE KERNEL CONFIGURATION 
##
+
+
+ Inheritance
+
+#
+# Inherit from, and override `GENERIC'
+#
+includeGENERIC # Base configuration file
+ident  VIMAGE  # Kernel name
+
+
+# ENABLE NON-INHERITED OPTIONS/DEVICES 
#
+
+
+ Non-GENERIC options
+
+#
+# Network Virtualization for Jails
+#
+optionsVIMAGE  # vnet paravirtualization
+
+#
+# Netgraph based bridging for vnet jails
+# NB: Not strictly necessary; will load automatically via KLD when needed
+#
+optionsNETGRAPH# netgraph(4) system
+optionsNETGRAPH_BRIDGE # ng_bridge(4)
+optionsNETGRAPH_EIFACE # ng_eiface(4)
+optionsNETGRAPH_ETHER  # ng_ether(4)
+optionsNETGRAPH_SOCKET # ng_socket(4)
+
+ Non-GENERIC devices
+
+#
+# if_bridge based bridging for vnet jails
+# NB: Not strictly necessary; will load automatically via KLD when needed
+#
+device epair   # epair(4)
+device if_bridge   # if_bridge(4)
+
+
+ DISABLE UNNECESSARY  INHERITED OPTIONS/DEVICES 

+
+
+ Disable select inherited options
+
+# none
+
+ Disable select inherited devices
+
+# none
+
+
+# END
+
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"