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

2012-06-12 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 13 06:57:55 2012
New Revision: 237000
URL: http://svn.freebsd.org/changeset/base/237000

Log:
  Implement a separate, smaller pool of ath_buf entries for use by management
  traffic.
  
  * Create sc_mgmt_txbuf and sc_mgmt_txdesc, initialise/free them appropriately.
  * Create an enum to represent buffer types in the API.
  * Extend ath_getbuf() and _ath_getbuf_locked() to take the above enum.
  * Right now anything sent via ic_raw_xmit() allocates via ATH_BUFTYPE_MGMT.
This may not be very useful.
  * Add ATH_BUF_MGMT flag (ath_buf.bf_flags) which indicates the current buffer
is a mgmt buffer and should go back onto the mgmt free list.
  * Extend 'txagg' to include debugging output for both normal and mgmt txbufs.
  * When checking/clearing ATH_BUF_BUSY, do it on both TX pools.
  
  Tested:
  
  * STA mode, with heavy UDP injection via iperf.  This filled the TX queue
however BARs were still going out successfully.
  
  TODO:
  
  * Initialise the mgmt buffers with ATH_BUF_MGMT and then ensure the right
type is being allocated and freed on the appropriate list.  That'd save
a write operation (to bf->bf_flags) on each buffer alloc/free.
  
  * Test on AP mode, ensure that BAR TX and probe responses go out nicely
when the main TX queue is filled (eg with paused traffic to a TID,
awaiting a BAR to complete.)
  
  PR:   kern/168170

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Jun 13 06:46:00 2012(r236999)
+++ head/sys/dev/ath/if_ath.c   Wed Jun 13 06:57:55 2012(r237000)
@@ -246,6 +246,10 @@ static int ath_txbuf = ATH_TXBUF;  /* # 
 SYSCTL_INT(_hw_ath, OID_AUTO, txbuf, CTLFLAG_RW, &ath_txbuf,
0, "tx buffers allocated");
 TUNABLE_INT("hw.ath.txbuf", &ath_txbuf);
+static int ath_txbuf_mgmt = ATH_MGMT_TXBUF;/* # mgmt tx buffers to 
allocate */
+SYSCTL_INT(_hw_ath, OID_AUTO, txbuf_mgmt, CTLFLAG_RW, &ath_txbuf_mgmt,
+   0, "tx (mgmt) buffers allocated");
+TUNABLE_INT("hw.ath.txbuf_mgmt", &ath_txbuf_mgmt);
 
 int ath_bstuck_threshold = 4;  /* max missed beacons */
 SYSCTL_INT(_hw_ath, OID_AUTO, bstuck, CTLFLAG_RW, &ath_bstuck_threshold,
@@ -2212,13 +2216,17 @@ ath_reset_vap(struct ieee80211vap *vap, 
 }
 
 struct ath_buf *
-_ath_getbuf_locked(struct ath_softc *sc)
+_ath_getbuf_locked(struct ath_softc *sc, ath_buf_type_t btype)
 {
struct ath_buf *bf;
 
ATH_TXBUF_LOCK_ASSERT(sc);
 
-   bf = TAILQ_FIRST(&sc->sc_txbuf);
+   if (btype == ATH_BUFTYPE_MGMT)
+   bf = TAILQ_FIRST(&sc->sc_txbuf_mgmt);
+   else
+   bf = TAILQ_FIRST(&sc->sc_txbuf);
+
if (bf == NULL) {
sc->sc_stats.ast_tx_getnobuf++;
} else {
@@ -2228,18 +2236,29 @@ _ath_getbuf_locked(struct ath_softc *sc)
}
}
 
-   if (bf != NULL && (bf->bf_flags & ATH_BUF_BUSY) == 0)
-   TAILQ_REMOVE(&sc->sc_txbuf, bf, bf_list);
-   else
+   if (bf != NULL && (bf->bf_flags & ATH_BUF_BUSY) == 0) {
+   if (btype == ATH_BUFTYPE_MGMT)
+   TAILQ_REMOVE(&sc->sc_txbuf_mgmt, bf, bf_list);
+   else
+   TAILQ_REMOVE(&sc->sc_txbuf, bf, bf_list);
+   } else
bf = NULL;
 
if (bf == NULL) {
+   /* XXX should check which list, mgmt or otherwise */
DPRINTF(sc, ATH_DEBUG_XMIT, "%s: %s\n", __func__,
TAILQ_FIRST(&sc->sc_txbuf) == NULL ?
"out of xmit buffers" : "xmit buffer busy");
return NULL;
}
 
+   /* XXX TODO: should do this at buffer list initialisation */
+   /* XXX (then, ensure the buffer has the right flag set) */
+   if (btype == ATH_BUFTYPE_MGMT)
+   bf->bf_flags |= ATH_BUF_MGMT;
+   else
+   bf->bf_flags &= (~ATH_BUF_MGMT);
+
/* Valid bf here; clear some basic fields */
bf->bf_next = NULL; /* XXX just to be sure */
bf->bf_last = NULL; /* XXX again, just to be sure */
@@ -2274,7 +2293,9 @@ ath_buf_clone(struct ath_softc *sc, cons
 {
struct ath_buf *tbf;
 
-   tbf = ath_getbuf(sc);
+   tbf = ath_getbuf(sc,
+   (bf->bf_flags & ATH_BUF_MGMT) ?
+ATH_BUFTYPE_MGMT : ATH_BUFTYPE_NORMAL);
if (tbf == NULL)
return NULL;/* XXX failure? Why? */
 
@@ -2302,12 +2323,18 @@ ath_buf_clone(struct ath_softc *sc, cons
 }
 
 struct ath_buf *
-ath_getbuf(struct ath_softc *sc)
+ath_getbuf(struct ath_softc *sc, ath_buf_type_t btype)
 {
struct ath_buf *bf;
 
ATH_TXBUF_LOCK(sc);
-   bf = _ath_getbuf_locked(sc);
+   bf = _ath_getbuf_locked(sc, 

svn commit: r236999 - head/share/examples/csh

2012-06-12 Thread Eitan Adler
Author: eadler
Date: Wed Jun 13 06:46:00 2012
New Revision: 236999
URL: http://svn.freebsd.org/changeset/base/236999

Log:
  Include a warning when using the example code as it may not
  work in unusual situations.
  Also slightly optimize the command.
  
  Submitted by: Jeremy Chadwick j...@koitsu.org
  Approved by:  cperciva (implicit)
  MFC after:1 week

Modified:
  head/share/examples/csh/dot.cshrc

Modified: head/share/examples/csh/dot.cshrc
==
--- head/share/examples/csh/dot.cshrc   Wed Jun 13 06:42:36 2012
(r236998)
+++ head/share/examples/csh/dot.cshrc   Wed Jun 13 06:46:00 2012
(r236999)
@@ -4,8 +4,12 @@
 #
 
 # Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running
+#
+# This has a couple caveats, the most notable being that if a user
+# has multiple ssh-agent(1) processes running, this will very likely
+# set SSH_AUTH_SOCK to point to the wrong file/domain socket.
 if (${?SSH_AUTH_SOCK} != "1") then
-   setenv SSH_AUTH_SOCK `sockstat | grep "^${USER} " | awk '/ssh-agent/ { 
print $6 }'`
+   setenv SSH_AUTH_SOCK `sockstat -u | awk '/^${USER}.+ ssh-agent/ { print 
$6 }'
 endif
 
 # Change only root's prompt
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236997 - in head/sys: arm/include dev/hwpmc

2012-06-12 Thread Fabien Thomas
Author: fabient
Date: Wed Jun 13 06:38:25 2012
New Revision: 236997
URL: http://svn.freebsd.org/changeset/base/236997

Log:
  Add ARM callchain support for hwpmc.
  
  Sponsored by: NETASQ
  MFC after:3 days

Modified:
  head/sys/arm/include/pmc_mdep.h
  head/sys/dev/hwpmc/hwpmc_arm.c

Modified: head/sys/arm/include/pmc_mdep.h
==
--- head/sys/arm/include/pmc_mdep.h Wed Jun 13 06:19:08 2012
(r236996)
+++ head/sys/arm/include/pmc_mdep.h Wed Jun 13 06:38:25 2012
(r236997)
@@ -50,9 +50,17 @@ union pmc_md_pmc {
struct pmc_md_xscale_pmcpm_xscale;
 };
 
-#definePMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_pc)
-#definePMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_usr_lr)
-#definePMC_TRAPFRAME_TO_SP(TF) ((TF)->tf_usr_sp)
+#definePMC_IN_KERNEL_STACK(S,START,END)\
+   ((S) >= (START) && (S) < (END))
+#definePMC_IN_KERNEL(va) (((va) >= USRSTACK) &&\
+   ((va) < VM_MAX_KERNEL_ADDRESS))
+
+#definePMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
+
+#definePMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_pc)
+#definePMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_r11)
+#definePMC_TRAPFRAME_TO_SVC_SP(TF) ((TF)->tf_svc_sp)
+#definePMC_TRAPFRAME_TO_USR_SP(TF) ((TF)->tf_usr_sp)
 
 /* Build a fake kernel trapframe from current instruction pointer. */
 #define PMC_FAKE_TRAPFRAME(TF) \

Modified: head/sys/dev/hwpmc/hwpmc_arm.c
==
--- head/sys/dev/hwpmc/hwpmc_arm.c  Wed Jun 13 06:19:08 2012
(r236996)
+++ head/sys/dev/hwpmc/hwpmc_arm.c  Wed Jun 13 06:38:25 2012
(r236997)
@@ -30,10 +30,16 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
-#include 
+#include 
 #include 
+#include 
+
+#include 
+#include 
+#include 
 
 struct pmc_mdep *
 pmc_md_initialize()
@@ -58,27 +64,101 @@ pmc_md_finalize(struct pmc_mdep *md)
 #endif
 }
 
-static int
-pmc_save_callchain(uintptr_t *cc, int maxsamples,
-struct trapframe *tf)
-{
-
-   *cc = PMC_TRAPFRAME_TO_PC(tf);
-   return (1);
-}
-
 int
 pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples,
 struct trapframe *tf)
 {
+   uintptr_t pc, r, stackstart, stackend, fp;
+   struct thread *td;
+   int count;
+
+   KASSERT(TRAPF_USERMODE(tf) == 0,("[arm,%d] not a kernel backtrace",
+   __LINE__));
+
+   pc = PMC_TRAPFRAME_TO_PC(tf);
+   *cc++ = pc;
+
+   if ((td = curthread) == NULL)
+   return (1);
+
+   if (maxsamples <= 1)
+   return (1);
+
+   stackstart = (uintptr_t) td->td_kstack;
+   stackend = (uintptr_t) td->td_kstack + td->td_kstack_pages * PAGE_SIZE;
+   fp = PMC_TRAPFRAME_TO_FP(tf);
+
+   if (!PMC_IN_KERNEL(pc) ||
+   !PMC_IN_KERNEL_STACK(fp, stackstart, stackend))
+   return (1);
+
+   for (count = 1; count < maxsamples; count++) {
+   /* Use saved lr as pc. */
+   r = fp - sizeof(uintptr_t);
+   if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend))
+   break;
+   pc = *(uintptr_t *)r;
+   if (!PMC_IN_KERNEL(pc))
+   break;
+
+   *cc++ = pc;
+
+   /* Switch to next frame up */
+   r = fp - 3 * sizeof(uintptr_t);
+   if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend))
+   break;
+   fp = *(uintptr_t *)r;
+   if (!PMC_IN_KERNEL_STACK(fp, stackstart, stackend))
+   break;
+   }
 
-   return pmc_save_callchain(cc, maxsamples, tf);
+   return (count);
 }
 
 int
 pmc_save_user_callchain(uintptr_t *cc, int maxsamples,
 struct trapframe *tf)
 {
+   uintptr_t pc, r, oldfp, fp;
+   struct thread *td;
+   int count;
+
+   KASSERT(TRAPF_USERMODE(tf), ("[x86,%d] Not a user trap frame tf=%p",
+   __LINE__, (void *) tf));
+
+   pc = PMC_TRAPFRAME_TO_PC(tf);
+   *cc++ = pc;
+
+   if ((td = curthread) == NULL)
+   return (1);
+
+   if (maxsamples <= 1)
+   return (1);
+
+   oldfp = fp = PMC_TRAPFRAME_TO_FP(tf);
+
+   if (!PMC_IN_USERSPACE(pc) ||
+   !PMC_IN_USERSPACE(fp))
+   return (1);
+
+   for (count = 1; count < maxsamples; count++) {
+   /* Use saved lr as pc. */
+   r = fp - sizeof(uintptr_t);
+   if (copyin((void *)r, &pc, sizeof(pc)) != 0)
+   break;
+   if (!PMC_IN_USERSPACE(pc))
+   break;
+
+   *cc++ = pc;
+
+   /* Switch to next frame up */
+   oldfp = fp;
+   r = fp - 3 * sizeof(uintptr_t);
+   if (copyin((void *)r, &fp, sizeof(fp)) != 0)
+

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

2012-06-12 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 13 05:47:24 2012
New Revision: 236995
URL: http://svn.freebsd.org/changeset/base/236995

Log:
  Remove a duplicate definition.

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

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==
--- head/sys/dev/ath/if_ath_tx_ht.c Wed Jun 13 05:41:00 2012
(r236994)
+++ head/sys/dev/ath/if_ath_tx_ht.c Wed Jun 13 05:47:24 2012
(r236995)
@@ -438,7 +438,6 @@ static void
 ath_rateseries_setup(struct ath_softc *sc, struct ieee80211_node *ni,
 struct ath_buf *bf, HAL_11N_RATE_SERIES *series)
 {
-#defineHT_RC_2_STREAMS(_rc)_rc) & 0x78) >> 3) + 1)
struct ieee80211com *ic = ni->ni_ic;
struct ath_hal *ah = sc->sc_ah;
HAL_BOOL shortPreamble = AH_FALSE;
@@ -528,7 +527,6 @@ ath_rateseries_setup(struct ath_softc *s
rt, pktlen, rc[i].rix, shortPreamble);
}
}
-#undef HT_RC_2_STREAMS
 }
 
 #if 0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-06-12 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 13 05:41:00 2012
New Revision: 236994
URL: http://svn.freebsd.org/changeset/base/236994

Log:
  Oops, return the newly allocated buffer to the queue, not the completed
  buffer.
  
  PR:   kern/168170

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

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cWed Jun 13 05:39:16 2012
(r236993)
+++ head/sys/dev/ath/if_ath_tx.cWed Jun 13 05:41:00 2012
(r236994)
@@ -3137,7 +3137,7 @@ ath_tx_retry_clone(struct ath_softc *sc,
 * the list.)
 */
ATH_TXBUF_LOCK(sc);
-   ath_returnbuf_head(sc, bf);
+   ath_returnbuf_head(sc, nbf);
ATH_TXBUF_UNLOCK(sc);
return NULL;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-06-12 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 13 05:39:16 2012
New Revision: 236993
URL: http://svn.freebsd.org/changeset/base/236993

Log:
  Replace the direct sc_txbuf manipulation with a pair of functions.
  
  This is preparation work for having a separate ath_buf queue for
  management traffic.
  
  PR:   kern/168170

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Jun 13 05:02:51 2012(r236992)
+++ head/sys/dev/ath/if_ath.c   Wed Jun 13 05:39:16 2012(r236993)
@@ -2358,7 +2358,7 @@ ath_start(struct ifnet *ifp)
IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == NULL) {
ATH_TXBUF_LOCK(sc);
-   TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list);
+   ath_returnbuf_head(sc, bf);
ATH_TXBUF_UNLOCK(sc);
break;
}
@@ -2401,7 +2401,7 @@ ath_start(struct ifnet *ifp)
bf->bf_m = NULL;
bf->bf_node = NULL;
ATH_TXBUF_LOCK(sc);
-   TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list);
+   ath_returnbuf_head(sc, bf);
ath_txfrag_cleanup(sc, &frags, ni);
ATH_TXBUF_UNLOCK(sc);
if (ni != NULL)
@@ -3631,6 +3631,24 @@ ath_txq_sched_tasklet(void *arg, int npe
ATH_PCU_UNLOCK(sc);
 }
 
+void
+ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf)
+{
+
+   ATH_TXBUF_LOCK_ASSERT(sc);
+
+   TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list);
+}
+
+void
+ath_returnbuf_head(struct ath_softc *sc, struct ath_buf *bf)
+{
+
+   ATH_TXBUF_LOCK_ASSERT(sc);
+
+   TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list);
+}
+
 /*
  * Return a buffer to the pool and update the 'busy' flag on the
  * previous 'tail' entry.
@@ -3653,7 +3671,7 @@ ath_freebuf(struct ath_softc *sc, struct
 
ATH_TXBUF_LOCK(sc);
ath_tx_update_busy(sc);
-   TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list);
+   ath_returnbuf_tail(sc, bf);
ATH_TXBUF_UNLOCK(sc);
 }
 

Modified: head/sys/dev/ath/if_ath_misc.h
==
--- head/sys/dev/ath/if_ath_misc.h  Wed Jun 13 05:02:51 2012
(r236992)
+++ head/sys/dev/ath/if_ath_misc.h  Wed Jun 13 05:39:16 2012
(r236993)
@@ -55,6 +55,8 @@ extern struct ath_buf * _ath_getbuf_lock
 extern struct ath_buf * ath_buf_clone(struct ath_softc *sc,
const struct ath_buf *bf);
 extern void ath_freebuf(struct ath_softc *sc, struct ath_buf *bf);
+extern void ath_returnbuf_head(struct ath_softc *sc, struct ath_buf *bf);
+extern void ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf);
 
 extern int ath_reset(struct ifnet *, ATH_RESET_TYPE);
 extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq);

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cWed Jun 13 05:02:51 2012
(r236992)
+++ head/sys/dev/ath/if_ath_tx.cWed Jun 13 05:39:16 2012
(r236993)
@@ -184,7 +184,7 @@ ath_txfrag_cleanup(struct ath_softc *sc,
TAILQ_FOREACH_SAFE(bf, frags, bf_list, next) {
/* NB: bf assumed clean */
TAILQ_REMOVE(frags, bf, bf_list);
-   TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list);
+   ath_returnbuf_head(sc, bf);
ieee80211_node_decref(ni);
}
 }
@@ -1916,7 +1916,7 @@ ath_raw_xmit(struct ieee80211_node *ni, 
return 0;
 bad2:
ATH_TXBUF_LOCK(sc);
-   TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list);
+   ath_returnbuf_head(sc, bf);
ATH_TXBUF_UNLOCK(sc);
 bad:
ATH_PCU_LOCK(sc);
@@ -3137,7 +3137,7 @@ ath_tx_retry_clone(struct ath_softc *sc,
 * the list.)
 */
ATH_TXBUF_LOCK(sc);
-   TAILQ_INSERT_HEAD(&sc->sc_txbuf, nbf, bf_list);
+   ath_returnbuf_head(sc, bf);
ATH_TXBUF_UNLOCK(sc);
return NULL;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236992 - head/sys/arm/include

2012-06-12 Thread Warner Losh
Author: imp
Date: Wed Jun 13 05:02:51 2012
New Revision: 236992
URL: http://svn.freebsd.org/changeset/base/236992

Log:
  trim trailing whitespace

Modified:
  head/sys/arm/include/armreg.h
  head/sys/arm/include/asmacros.h
  head/sys/arm/include/atomic.h
  head/sys/arm/include/blockio.h
  head/sys/arm/include/cpufunc.h
  head/sys/arm/include/elf.h
  head/sys/arm/include/endian.h
  head/sys/arm/include/fdt.h
  head/sys/arm/include/fp.h
  head/sys/arm/include/frame.h
  head/sys/arm/include/ieee.h
  head/sys/arm/include/in_cksum.h
  head/sys/arm/include/intr.h
  head/sys/arm/include/katelib.h
  head/sys/arm/include/param.h
  head/sys/arm/include/pmap.h
  head/sys/arm/include/profile.h
  head/sys/arm/include/pte.h
  head/sys/arm/include/resource.h
  head/sys/arm/include/stack.h
  head/sys/arm/include/vmparam.h

Modified: head/sys/arm/include/armreg.h
==
--- head/sys/arm/include/armreg.h   Wed Jun 13 04:59:55 2012
(r236991)
+++ head/sys/arm/include/armreg.h   Wed Jun 13 05:02:51 2012
(r236992)
@@ -327,7 +327,7 @@
 /*
  * ARM Instructions
  *
- *   3 3 2 2 2  
+ *   3 3 2 2 2
  *   1 0 9 8 7 0
  *  +---+---+
  *  | cond  |  instruction dependant|

Modified: head/sys/arm/include/asmacros.h
==
--- head/sys/arm/include/asmacros.h Wed Jun 13 04:59:55 2012
(r236991)
+++ head/sys/arm/include/asmacros.h Wed Jun 13 05:02:51 2012
(r236992)
@@ -92,7 +92,7 @@
  * This should only be used if the processor is not currently in SVC32
  * mode. The processor mode is switched to SVC mode and the trap frame is
  * stored. The SVC lr field is used to store the previous value of
- * lr in SVC mode.  
+ * lr in SVC mode.
  *
  * NOTE: r13 and r14 are stored separately as a work around for the
  * SA110 rev 2 STM^ bug

Modified: head/sys/arm/include/atomic.h
==
--- head/sys/arm/include/atomic.h   Wed Jun 13 04:59:55 2012
(r236991)
+++ head/sys/arm/include/atomic.h   Wed Jun 13 05:02:51 2012
(r236992)
@@ -285,7 +285,6 @@ atomic_fetchadd_32(volatile uint32_t *p,
return (start);
 }
 
-   
 #endif /* _KERNEL */
 
 static __inline int

Modified: head/sys/arm/include/blockio.h
==
--- head/sys/arm/include/blockio.h  Wed Jun 13 04:59:55 2012
(r236991)
+++ head/sys/arm/include/blockio.h  Wed Jun 13 05:02:51 2012
(r236992)
@@ -14,7 +14,7 @@
  *documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
  *derived from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

Modified: head/sys/arm/include/cpufunc.h
==
--- head/sys/arm/include/cpufunc.h  Wed Jun 13 04:59:55 2012
(r236991)
+++ head/sys/arm/include/cpufunc.h  Wed Jun 13 05:02:51 2012
(r236992)
@@ -315,7 +315,7 @@ voidsa11x0_drain_readbuf(void);
 
 void   sa11x0_context_switch   (void);
 void   sa11x0_cpu_sleep(int mode);
- 
+
 void   sa11x0_setup(char *string);
 #endif
 
@@ -471,7 +471,7 @@ extern unsigned armv5_dcache_index_inc;
   defined(CPU_FA526) || defined(CPU_FA626TE) ||
\
   defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) ||  \
   defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342)
-  
+
 void   armv4_tlb_flushID   (void);
 void   armv4_tlb_flushI(void);
 void   armv4_tlb_flushD(void);
@@ -526,7 +526,7 @@ voidxscale_cache_flushD_rng (vm_offset_
 void   xscale_context_switch   (void);
 
 void   xscale_setup(char *string);
-#endif /* CPU_XSCALE_80200 || CPU_XSCALE_80321 || CPU_XSCALE_PXA2X0 || 
CPU_XSCALE_IXP425 
+#endif /* CPU_XSCALE_80200 || CPU_XSCALE_80321 || CPU_XSCALE_PXA2X0 || 
CPU_XSCALE_IXP425
   CPU_XSCALE_80219 */
 
 #ifdef CPU_XSCALE_81342
@@ -628,7 +628,7 @@ extern int  arm_picache_ways;
 
 extern int arm_pdcache_size;   /* and unified */
 extern int arm_pdcache_line_size;
-extern int arm_pdcache_ways; 
+extern int arm_pdcache_ways;
 
 extern int arm_pcache_type;
 extern int arm_pcache_unified;

Modified: head/sys/arm/include/elf.h
==

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

2012-06-12 Thread Warner Losh
Author: imp
Date: Wed Jun 13 04:59:55 2012
New Revision: 236991
URL: http://svn.freebsd.org/changeset/base/236991

Log:
  Final whitespace trim.

Modified:
  head/sys/arm/arm/bcopyinout_xscale.S
  head/sys/arm/arm/bootconfig.c
  head/sys/arm/arm/busdma_machdep.c
  head/sys/arm/arm/cpufunc.c
  head/sys/arm/arm/cpufunc_asm.S
  head/sys/arm/arm/cpufunc_asm_arm10.S
  head/sys/arm/arm/cpufunc_asm_arm11.S
  head/sys/arm/arm/cpufunc_asm_arm7tdmi.S
  head/sys/arm/arm/cpufunc_asm_arm8.S
  head/sys/arm/arm/cpufunc_asm_arm9.S
  head/sys/arm/arm/cpufunc_asm_armv4.S
  head/sys/arm/arm/cpufunc_asm_armv5.S
  head/sys/arm/arm/cpufunc_asm_sa1.S
  head/sys/arm/arm/cpufunc_asm_xscale.S
  head/sys/arm/arm/cpufunc_asm_xscale_c3.S
  head/sys/arm/arm/db_disasm.c
  head/sys/arm/arm/db_interface.c
  head/sys/arm/arm/db_trace.c
  head/sys/arm/arm/disassem.c
  head/sys/arm/arm/dump_machdep.c
  head/sys/arm/arm/elf_trampoline.c
  head/sys/arm/arm/exception.S
  head/sys/arm/arm/gdb_machdep.c
  head/sys/arm/arm/in_cksum.c
  head/sys/arm/arm/intr.c
  head/sys/arm/arm/irq_dispatch.S
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/mem.c
  head/sys/arm/arm/nexus.c
  head/sys/arm/arm/pmap.c
  head/sys/arm/arm/support.S
  head/sys/arm/arm/swtch.S
  head/sys/arm/arm/sys_machdep.c
  head/sys/arm/arm/trap.c
  head/sys/arm/arm/undefined.c
  head/sys/arm/arm/vectors.S
  head/sys/arm/arm/vm_machdep.c

Modified: head/sys/arm/arm/bcopyinout_xscale.S
==
--- head/sys/arm/arm/bcopyinout_xscale.SWed Jun 13 04:59:00 2012
(r236990)
+++ head/sys/arm/arm/bcopyinout_xscale.SWed Jun 13 04:59:55 2012
(r236991)
@@ -333,10 +333,10 @@ ENTRY(copyin)
str r6, [r1], #0x04
str r7, [r1], #0x04
 .Lcopyin_bad1:
-   subsr2, r2, #0x10 
+   subsr2, r2, #0x10
bge .Lcopyin_bad1_loop16
 
-   addsr2, r2, #0x10 
+   addsr2, r2, #0x10
ldmeqfd sp!, {r4-r7}
RETeq   /* Return now if done */
subsr2, r2, #0x04
@@ -394,10 +394,10 @@ ENTRY(copyin)
str r6, [r1], #0x04
str r7, [r1], #0x04
 .Lcopyin_bad2:
-   subsr2, r2, #0x10 
+   subsr2, r2, #0x10
bge .Lcopyin_bad2_loop16
 
-   addsr2, r2, #0x10 
+   addsr2, r2, #0x10
ldmeqfd sp!, {r4-r7}
RETeq   /* Return now if done */
subsr2, r2, #0x04
@@ -455,10 +455,10 @@ ENTRY(copyin)
str r6, [r1], #0x04
str r7, [r1], #0x04
 .Lcopyin_bad3:
-   subsr2, r2, #0x10 
+   subsr2, r2, #0x10
bge .Lcopyin_bad3_loop16
 
-   addsr2, r2, #0x10 
+   addsr2, r2, #0x10
ldmeqfd sp!, {r4-r7}
RETeq   /* Return now if done */
subsr2, r2, #0x04
@@ -785,10 +785,10 @@ ENTRY(copyout)
strtr6, [r1], #0x04
strtr7, [r1], #0x04
 .Lcopyout_bad1:
-   subsr2, r2, #0x10 
+   subsr2, r2, #0x10
bge .Lcopyout_bad1_loop16
 
-   addsr2, r2, #0x10 
+   addsr2, r2, #0x10
ldmeqfd sp!, {r4-r7}
RETeq   /* Return now if done */
subsr2, r2, #0x04
@@ -846,10 +846,10 @@ ENTRY(copyout)
strtr6, [r1], #0x04
strtr7, [r1], #0x04
 .Lcopyout_bad2:
-   subsr2, r2, #0x10 
+   subsr2, r2, #0x10
bge .Lcopyout_bad2_loop16
 
-   addsr2, r2, #0x10 
+   addsr2, r2, #0x10
ldmeqfd sp!, {r4-r7}
RETeq   /* Return now if done */
subsr2, r2, #0x04
@@ -907,10 +907,10 @@ ENTRY(copyout)
strtr6, [r1], #0x04
strtr7, [r1], #0x04
 .Lcopyout_bad3:
-   subsr2, r2, #0x10 
+   subsr2, r2, #0x10
bge .Lcopyout_bad3_loop16
 
-   addsr2, r2, #0x10 
+   addsr2, r2, #0x10
ldmeqfd sp!, {r4-r7}
RETeq   /* Return now if done */
subsr2, r2, #0x04

Modified: head/sys/arm/arm/bootconfig.c
==
--- head/sys/arm/arm/bootconfig.c   Wed Jun 13 04:59:00 2012
(r236990)
+++ head/sys/arm/arm/bootconfig.c   Wed Jun 13 04:59:55 2012
(r236991)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 
-/* 
+/*
  * Function to identify and process different types of boot argument
  */
 

Modified: head/sys/arm/arm/busdma_machdep.c
==
--- head/sys/arm/arm/busdma_machdep.c   Wed Jun 13 04:59:00 2012
(r236990)
+++ head/sys/arm/arm/busdma_machdep.c   Wed Jun 13 04:59:55 2012
(r236991)
@@ -156,7 +156,7 @@ struct bus_dmamap {
 static STAILQ_HEAD(, bus_dmamap) bounc

svn commit: r236990 - in head/sys/arm: mv s3c2xx0 sa11x0

2012-06-12 Thread Warner Losh
Author: imp
Date: Wed Jun 13 04:59:00 2012
New Revision: 236990
URL: http://svn.freebsd.org/changeset/base/236990

Log:
  Trim trailing whitespace...

Modified:
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/mv/mvwin.h
  head/sys/arm/s3c2xx0/s3c2410reg.h
  head/sys/arm/s3c2xx0/s3c2440reg.h
  head/sys/arm/s3c2xx0/s3c24x0.c
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/s3c2xx0/s3c24x0reg.h
  head/sys/arm/sa11x0/assabet_machdep.c
  head/sys/arm/sa11x0/sa11x0.c
  head/sys/arm/sa11x0/sa11x0_gpioreg.h
  head/sys/arm/sa11x0/sa11x0_io_asm.S
  head/sys/arm/sa11x0/sa11x0_irq.S
  head/sys/arm/sa11x0/sa11x0_ost.c
  head/sys/arm/sa11x0/sa11x0_ostreg.h
  head/sys/arm/sa11x0/sa11x0_var.h
  head/sys/arm/sa11x0/uart_dev_sa1110.c

Modified: head/sys/arm/mv/mv_machdep.c
==
--- head/sys/arm/mv/mv_machdep.cWed Jun 13 04:52:19 2012
(r236989)
+++ head/sys/arm/mv/mv_machdep.cWed Jun 13 04:59:00 2012
(r236990)
@@ -285,7 +285,7 @@ physmap_init(void)
availmem_regions[i].mr_start + availmem_regions[i].mr_size,
availmem_regions[i].mr_size);
 
-   /* 
+   /*
 * We should not map the page at PA 0x000, the VM can't
 * handle it, as pmap_extract() == 0 means failure.
 */

Modified: head/sys/arm/mv/mvwin.h
==
--- head/sys/arm/mv/mvwin.h Wed Jun 13 04:52:19 2012(r236989)
+++ head/sys/arm/mv/mvwin.h Wed Jun 13 04:59:00 2012(r236990)
@@ -46,7 +46,7 @@
 #define MV_PCIE_IO_PHYS_BASE   (MV_PHYS_BASE + MV_SIZE)
 #define MV_PCIE_IO_BASEMV_PCIE_IO_PHYS_BASE
 #define MV_PCIE_IO_SIZE(1024 * 1024)
-#define MV_PCI_IO_PHYS_BASE(MV_PCIE_IO_PHYS_BASE + MV_PCIE_IO_SIZE) 
+#define MV_PCI_IO_PHYS_BASE(MV_PCIE_IO_PHYS_BASE + MV_PCIE_IO_SIZE)
 #define MV_PCI_IO_BASE MV_PCI_IO_PHYS_BASE
 #define MV_PCI_IO_SIZE (1024 * 1024)
 

Modified: head/sys/arm/s3c2xx0/s3c2410reg.h
==
--- head/sys/arm/s3c2xx0/s3c2410reg.h   Wed Jun 13 04:52:19 2012
(r236989)
+++ head/sys/arm/s3c2xx0/s3c2410reg.h   Wed Jun 13 04:59:00 2012
(r236990)
@@ -36,7 +36,7 @@
  * Samsung S3C2410X processor is ARM920T based integrated CPU
  *
  * Reference:
- *  S3C2410X User's Manual 
+ *  S3C2410X User's Manual
  */
 #ifndef _ARM_S3C2XX0_S3C2410REG_H_
 #define_ARM_S3C2XX0_S3C2410REG_H_

Modified: head/sys/arm/s3c2xx0/s3c2440reg.h
==
--- head/sys/arm/s3c2xx0/s3c2440reg.h   Wed Jun 13 04:52:19 2012
(r236989)
+++ head/sys/arm/s3c2xx0/s3c2440reg.h   Wed Jun 13 04:59:00 2012
(r236990)
@@ -30,7 +30,7 @@
  * Samsung S3C2440X processor is ARM920T based integrated CPU
  *
  * Reference:
- *  S3C2440A/S3C2442B User's Manual 
+ *  S3C2440A/S3C2442B User's Manual
  */
 #ifndef _ARM_S3C2XX0_S3C2440REG_H_
 #define_ARM_S3C2XX0_S3C2440REG_H_

Modified: head/sys/arm/s3c2xx0/s3c24x0.c
==
--- head/sys/arm/s3c2xx0/s3c24x0.c  Wed Jun 13 04:52:19 2012
(r236989)
+++ head/sys/arm/s3c2xx0/s3c24x0.c  Wed Jun 13 04:59:00 2012
(r236990)
@@ -283,7 +283,7 @@ s3c24x0_config_intr(device_t dev, int ir
s3c2xx0_softc->sc_gpio_ioh, reg, value);
 
return (0);
-} 
+}
 
 static struct resource *
 s3c24x0_alloc_resource(device_t bus, device_t child, int type, int *rid,
@@ -356,7 +356,7 @@ s3c24x0_alloc_resource(device_t bus, dev
rman_release_resource(res);
return (NULL);
}
-   } 
+   }
break;
}
 
@@ -751,19 +751,19 @@ arm_mask_irq(uintptr_t irq)
mask = bus_space_read_4(&s3c2xx0_bs_tag,
s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK);
mask |= (1 << irq);
-   bus_space_write_4(&s3c2xx0_bs_tag, 
+   bus_space_write_4(&s3c2xx0_bs_tag,
s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK, mask);
} else if (irq < S3C24X0_EXTIRQ_MIN) {
mask = bus_space_read_4(&s3c2xx0_bs_tag,
s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK);
mask |= (1 << (irq - S3C24X0_SUBIRQ_MIN));
-   bus_space_write_4(&s3c2xx0_bs_tag, 
+   bus_space_write_4(&s3c2xx0_bs_tag,
s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask);
} else {
mask = bus_space_read_4(&s3c2xx0_bs_tag,
s3c2xx0_softc->sc_gpio_ioh, GPIO_EINTMASK);
mask |= (1 << (irq - S3C24X0_EXTIRQ_MIN));
-   bus_space_write_4(&s3c2xx

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

2012-06-12 Thread Warner Losh
Author: imp
Date: Wed Jun 13 04:52:19 2012
New Revision: 236989
URL: http://svn.freebsd.org/changeset/base/236989

Log:
  Strip trailing whitespace before other changes.

Modified:
  head/sys/arm/at91/at91.c
  head/sys/arm/at91/at91_mci.c
  head/sys/arm/at91/at91_pio_rm9200.h
  head/sys/arm/at91/at91_pitreg.h
  head/sys/arm/at91/at91_pmcvar.h
  head/sys/arm/at91/at91_reset.S
  head/sys/arm/at91/at91_ssc.c
  head/sys/arm/at91/at91_wdtreg.h
  head/sys/arm/at91/at91rm9200.c
  head/sys/arm/at91/at91rm92reg.h
  head/sys/arm/at91/at91sam9260reg.h
  head/sys/arm/at91/at91sam9g20.c
  head/sys/arm/at91/at91sam9g20reg.h
  head/sys/arm/at91/board_qila9g20.c
  head/sys/arm/at91/board_sam9g20ek.c
  head/sys/arm/at91/if_macb.c
  head/sys/arm/at91/uart_cpu_at91rm9200usart.c

Modified: head/sys/arm/at91/at91.c
==
--- head/sys/arm/at91/at91.cWed Jun 13 04:40:29 2012(r236988)
+++ head/sys/arm/at91/at91.cWed Jun 13 04:52:19 2012(r236989)
@@ -72,7 +72,7 @@ at91_bs_map(void *t, bus_addr_t bpa, bus
endpa = round_page(bpa + size);
 
*bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa);
-  
+
return (0);
 }
 
@@ -98,7 +98,7 @@ at91_bs_subregion(void *t, bus_space_han
 }
 
 static void
-at91_barrier(void *t, bus_space_handle_t bsh, bus_size_t size, bus_size_t b, 
+at91_barrier(void *t, bus_space_handle_t bsh, bus_size_t size, bus_size_t b,
 int a)
 {
 }
@@ -272,7 +272,7 @@ at91_attach(device_t dev)
 
/* Our device list will be added automatically by the cpu device
 * e.g. at91rm9200.c when it is identified. To ensure that the
-* CPU and PMC are attached first any other "identified" devices 
+* CPU and PMC are attached first any other "identified" devices
 * call BUS_ADD_CHILD(9) with an "order" of at least 2. */
 
bus_generic_probe(dev);
@@ -357,8 +357,8 @@ at91_release_resource(device_t dev, devi
 
 static int
 at91_setup_intr(device_t dev, device_t child,
-struct resource *ires, int flags, driver_filter_t *filt, 
-driver_intr_t *intr, void *arg, void **cookiep)
+struct resource *ires, int flags, driver_filter_t *filt,
+driver_intr_t *intr, void *arg, void **cookiep)
 {
struct at91_softc *sc = device_get_softc(dev);
int error;
@@ -381,7 +381,7 @@ at91_teardown_intr(device_t dev, device_
 {
struct at91_softc *sc = device_get_softc(dev);
 
-   bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 
+   bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR,
1 << rman_get_start(res));
return (BUS_TEARDOWN_INTR(device_get_parent(dev), child, res, cookie));
 }
@@ -397,7 +397,7 @@ at91_activate_resource(device_t bus, dev
if (type == SYS_RES_MEMORY) {
error = bus_space_map(rman_get_bustag(r),
rman_get_bushandle(r), rman_get_size(r), 0, &p);
-   if (error) 
+   if (error)
return (error);
rman_set_bushandle(r, p);
}
@@ -432,7 +432,7 @@ void
 arm_mask_irq(uintptr_t nb)
 {

-   bus_space_write_4(at91_softc->sc_st, 
+   bus_space_write_4(at91_softc->sc_st,
at91_softc->sc_aic_sh, IC_IDCR, 1 << nb);
 }
 
@@ -458,7 +458,7 @@ void
 arm_unmask_irq(uintptr_t nb)
 {

-   bus_space_write_4(at91_softc->sc_st, 
+   bus_space_write_4(at91_softc->sc_st,
at91_softc->sc_aic_sh, IC_IECR, 1 << nb);
bus_space_write_4(at91_softc->sc_st, at91_softc->sc_aic_sh,
IC_EOICR, 0);

Modified: head/sys/arm/at91/at91_mci.c
==
--- head/sys/arm/at91/at91_mci.cWed Jun 13 04:40:29 2012
(r236988)
+++ head/sys/arm/at91/at91_mci.cWed Jun 13 04:52:19 2012
(r236989)
@@ -155,8 +155,8 @@ at91_mci_init(device_t dev)
 #ifndef  AT91_MCI_SLOT_B
WR4(sc, MCI_SDCR, 0);   /* SLOT A, 1 bit bus */
 #else
-   /* XXX Really should add second "unit" but nobody using using 
-* a two slot card that we know of. XXX */
+   /* XXX Really should add second "unit" but nobody using using
+* a two slot card that we know of. -- except they are... XXX */
WR4(sc, MCI_SDCR, 1);   /* SLOT B, 1 bit bus */
 #endif
 }

Modified: head/sys/arm/at91/at91_pio_rm9200.h
==
--- head/sys/arm/at91/at91_pio_rm9200.h Wed Jun 13 04:40:29 2012
(r236988)
+++ head/sys/arm/at91/at91_pio_rm9200.h Wed Jun 13 04:52:19 2012
(r236989)
@@ -161,13 +161,13 @@
 #defineAT91C_PD1_ETX1 (AT91C_PIO_PD1) //  Ethernet MAC Transmit 
Data 1
 #defineAT91C_PD10_PCK3 (AT91C_PIO_PD10) //  PMC Programmable Clock 
Output 3
 #defineAT91C_PD10_TPS1 (AT91C_PIO_PD10) //  ETM ARM9 pipeline 
status 1
-#define  

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

2012-06-12 Thread Warner Losh
Author: imp
Date: Wed Jun 13 04:40:29 2012
New Revision: 236988
URL: http://svn.freebsd.org/changeset/base/236988

Log:
  Strip trailing whitespace.

Modified:
  head/sys/arm/conf/AVILA
  head/sys/arm/conf/BWCT
  head/sys/arm/conf/CAMBRIA
  head/sys/arm/conf/CNS11XXNAS
  head/sys/arm/conf/CRB
  head/sys/arm/conf/EP80219
  head/sys/arm/conf/GUMSTIX
  head/sys/arm/conf/GUMSTIX-QEMU
  head/sys/arm/conf/HL200
  head/sys/arm/conf/HL201
  head/sys/arm/conf/IQ31244
  head/sys/arm/conf/KB920X
  head/sys/arm/conf/LN2410SBC
  head/sys/arm/conf/NSLU
  head/sys/arm/conf/QILA9G20
  head/sys/arm/conf/QILA9G20.hints
  head/sys/arm/conf/SAM9G20EK
  head/sys/arm/conf/SAM9G20EK.hints
  head/sys/arm/conf/SIMICS

Modified: head/sys/arm/conf/AVILA
==
--- head/sys/arm/conf/AVILA Wed Jun 13 04:38:09 2012(r236987)
+++ head/sys/arm/conf/AVILA Wed Jun 13 04:40:29 2012(r236988)
@@ -12,8 +12,8 @@
 # latest information.
 #
 # An exhaustive list of options and more detailed explanations of the
-# device lines is also present in the ../../conf/NOTES and NOTES files. 
-# If you are in doubt as to the purpose or necessity of a line, check first 
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
 # $FreeBSD$

Modified: head/sys/arm/conf/BWCT
==
--- head/sys/arm/conf/BWCT  Wed Jun 13 04:38:09 2012(r236987)
+++ head/sys/arm/conf/BWCT  Wed Jun 13 04:40:29 2012(r236988)
@@ -11,8 +11,8 @@
 # latest information.
 #
 # An exhaustive list of options and more detailed explanations of the
-# device lines is also present in the ../../conf/NOTES and NOTES files. 
-# If you are in doubt as to the purpose or necessity of a line, check first 
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
 # $FreeBSD$

Modified: head/sys/arm/conf/CAMBRIA
==
--- head/sys/arm/conf/CAMBRIA   Wed Jun 13 04:38:09 2012(r236987)
+++ head/sys/arm/conf/CAMBRIA   Wed Jun 13 04:40:29 2012(r236988)
@@ -12,8 +12,8 @@
 # latest information.
 #
 # An exhaustive list of options and more detailed explanations of the
-# device lines is also present in the ../../conf/NOTES and NOTES files. 
-# If you are in doubt as to the purpose or necessity of a line, check first 
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
 # $FreeBSD$

Modified: head/sys/arm/conf/CNS11XXNAS
==
--- head/sys/arm/conf/CNS11XXNASWed Jun 13 04:38:09 2012
(r236987)
+++ head/sys/arm/conf/CNS11XXNASWed Jun 13 04:40:29 2012
(r236988)
@@ -12,8 +12,8 @@
 # latest information.
 #
 # An exhaustive list of options and more detailed explanations of the
-# device lines is also present in the ../../conf/NOTES and NOTES files. 
-# If you are in doubt as to the purpose or necessity of a line, check first 
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
 # $FreeBSD$

Modified: head/sys/arm/conf/CRB
==
--- head/sys/arm/conf/CRB   Wed Jun 13 04:38:09 2012(r236987)
+++ head/sys/arm/conf/CRB   Wed Jun 13 04:40:29 2012(r236988)
@@ -11,8 +11,8 @@
 # latest information.
 #
 # An exhaustive list of options and more detailed explanations of the
-# device lines is also present in the ../../conf/NOTES and NOTES files. 
-# If you are in doubt as to the purpose or necessity of a line, check first 
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
 # $FreeBSD$

Modified: head/sys/arm/conf/EP80219
==
--- head/sys/arm/conf/EP80219   Wed Jun 13 04:38:09 2012(r236987)
+++ head/sys/arm/conf/EP80219   Wed Jun 13 04:40:29 2012(r236988)
@@ -11,8 +11,8 @@
 # latest information.
 #
 # An exhaustive list of options and more detailed explanations of the
-# device lines is also present in the ../../conf/NOTES and NOTES files. 
-# If you are in doubt as to the purpose or necessity of a line, check first 
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
 # $FreeBSD$

Modified: head/sys/arm/c

svn commit: r236987 - in head/sys/arm/xscale: i80321 i8134x ixp425 pxa

2012-06-12 Thread Warner Losh
Author: imp
Date: Wed Jun 13 04:38:09 2012
New Revision: 236987
URL: http://svn.freebsd.org/changeset/base/236987

Log:
  trim trailing spaces that have accumulated over the years (these files
  served as the basis for too many other platforms).

Modified:
  head/sys/arm/xscale/i80321/ep80219_machdep.c
  head/sys/arm/xscale/i80321/i80321.c
  head/sys/arm/xscale/i80321/i80321_aau.c
  head/sys/arm/xscale/i80321/i80321_dma.c
  head/sys/arm/xscale/i80321/i80321_intr.h
  head/sys/arm/xscale/i80321/i80321_pci.c
  head/sys/arm/xscale/i80321/i80321_space.c
  head/sys/arm/xscale/i80321/i80321_timer.c
  head/sys/arm/xscale/i80321/i80321reg.h
  head/sys/arm/xscale/i80321/iq31244_7seg.c
  head/sys/arm/xscale/i80321/iq31244_machdep.c
  head/sys/arm/xscale/i80321/iq80321.c
  head/sys/arm/xscale/i80321/obio.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/i8134x/i81342.c
  head/sys/arm/xscale/i8134x/i81342_mcu.c
  head/sys/arm/xscale/i8134x/i81342_pci.c
  head/sys/arm/xscale/i8134x/i81342_space.c
  head/sys/arm/xscale/i8134x/i81342reg.h
  head/sys/arm/xscale/i8134x/iq81342_7seg.c
  head/sys/arm/xscale/i8134x/obio.c
  head/sys/arm/xscale/i8134x/uart_cpu_i81342.c
  head/sys/arm/xscale/ixp425/avila_ata.c
  head/sys/arm/xscale/ixp425/avila_gpio.c
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/ixp425/cambria_exp_space.c
  head/sys/arm/xscale/ixp425/if_npe.c
  head/sys/arm/xscale/ixp425/if_npereg.h
  head/sys/arm/xscale/ixp425/ixp425.c
  head/sys/arm/xscale/ixp425/ixp425_iic.c
  head/sys/arm/xscale/ixp425/ixp425_npe.c
  head/sys/arm/xscale/ixp425/ixp425_npereg.h
  head/sys/arm/xscale/ixp425/ixp425_pci.c
  head/sys/arm/xscale/ixp425/ixp425_pci_space.c
  head/sys/arm/xscale/ixp425/ixp425_qmgr.c
  head/sys/arm/xscale/ixp425/ixp425_qmgr.h
  head/sys/arm/xscale/ixp425/ixp425reg.h
  head/sys/arm/xscale/pxa/if_smc_smi.c
  head/sys/arm/xscale/pxa/pxa_machdep.c
  head/sys/arm/xscale/pxa/pxareg.h

Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c
==
--- head/sys/arm/xscale/i80321/ep80219_machdep.cWed Jun 13 03:41:42 
2012(r236986)
+++ head/sys/arm/xscale/i80321/ep80219_machdep.cWed Jun 13 04:38:09 
2012(r236987)
@@ -40,7 +40,7 @@
  *
  * Machine dependant functions for kernel setup
  *
- * This file needs a lot of work. 
+ * This file needs a lot of work.
  *
  * Created  : 17/09/94
  */
@@ -142,7 +142,7 @@ struct pv_addr minidataclean;
 
 /* Static device mappings. */
 static const struct pmap_devmap ep80219_devmap[] = {
-   /* 
+   /*
 * Map the on-board devices VA == PA so that we can access them
 * with the MMU on or off.
 */
@@ -150,7 +150,7 @@ static const struct pmap_devmap ep80219_
IQ80321_OBIO_BASE,
IQ80321_OBIO_BASE,
IQ80321_OBIO_SIZE,
-   VM_PROT_READ|VM_PROT_WRITE, 
+   VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
@@ -159,7 +159,7 @@ static const struct pmap_devmap ep80219_
VERDE_OUT_XLATE_IO_WIN_SIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
-   },  
+   },  
{
IQ80321_80321_VBASE,
VERDE_PMMR_BASE,
@@ -192,8 +192,8 @@ initarm(struct arm_boot_params *abp)
vm_offset_t lastaddr;
uint32_t memsize, memstart;
 
+   lastaddr = parse_boot_param(abp);
set_cpufuncs();
-   lastaddr = fake_preload_metadata();
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(curthread, &thread0);
 
@@ -222,7 +222,7 @@ initarm(struct arm_boot_params *abp)
kernel_pt_table[loop].pv_pa = freemempos +
(loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) *
L2_TABLE_SIZE_REAL;
-   kernel_pt_table[loop].pv_va = 
+   kernel_pt_table[loop].pv_va =
kernel_pt_table[loop].pv_pa + 0x2000;
}
}
@@ -291,13 +291,13 @@ initarm(struct arm_boot_params *abp)
   (((uint32_t)(lastaddr) - KERNBASE - 
0x20) + L1_S_SIZE) & ~(L1_S_SIZE - 1),
   VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
freemem_after = ((int)lastaddr + PAGE_SIZE) & ~(PAGE_SIZE - 1);
-   afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & 
~(L1_S_SIZE 
+   afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE

   - 1));
for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) {
pmap_link_l2pt(l1pagetable, afterkern + i * 0x0010,
   &kernel_pt_table[KERNEL_PT_AFKERNEL 
+ i]);
}
-   pmap

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

2012-06-12 Thread Andrey Chernov
On Wed, Jun 13, 2012 at 12:37:50PM +1000, Bruce Evans wrote:
> >> On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote:
> >>> -KASSERT(fd >= 0 && fd < fdp->fd_nfiles,
> >>> +KASSERT((unsigned int)fd < fdp->fd_nfiles,
> >>> ("file descriptor %d out of range (0, %d)", fd, 
> >>> fdp->fd_nfiles));
> >>>   return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0);
> >>> }
> >>
> >> This is backwards.  Apart from using the worst possible (most verbose)
> >> spelling of `unsigned', it uses a type hack manually optimize away the
> >> test for fd being < 0.  The compiler will do this "optimization"
> >> automatically if it is any good (or undo it if it is not), so all the
> >> hack does is obfuscate the test.  With the verbose spelling of u_int,
> >> it even takes more space.
> >
> > Well, to be honest I presonally would prefer explicit check for fd being
> > less than 0, but my impression was that using cast is the most popular
> > way and I wanted this check to be consistent across our source tree.
> >
> > Feel free to change it.
> 
> I'm only free to ask you to back out it out.

I agree that this change should backed out for better. It gains nothing 
for modern compilers, but makes code reading harder. 

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


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

2012-06-12 Thread Bruce Evans

On Tue, 12 Jun 2012, Pawel Jakub Dawidek wrote:


On Tue, Jun 12, 2012 at 12:53:47PM +1000, Bruce Evans wrote:

On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote:

-KASSERT(fd >= 0 && fd < fdp->fd_nfiles,
+KASSERT((unsigned int)fd < fdp->fd_nfiles,
("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles));
return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0);
}


This is backwards.  Apart from using the worst possible (most verbose)
spelling of `unsigned', it uses a type hack manually optimize away the
test for fd being < 0.  The compiler will do this "optimization"
automatically if it is any good (or undo it if it is not), so all the
hack does is obfuscate the test.  With the verbose spelling of u_int,
it even takes more space.


Well, to be honest I presonally would prefer explicit check for fd being
less than 0, but my impression was that using cast is the most popular
way and I wanted this check to be consistent across our source tree.

Feel free to change it.


I'm only free to ask you to back out it out.


BTW. I really dislike using 'unsigned' with omitted 'int'. u_int is fine.


I really dislike 'unsigned int'.  The int in it is just noise, as in
'long int'.


From K&R 1: p34: "The declarations for the qualifiers look like [...]

unsigned int x;  The word int can be omitted in such situations, and
typically is."  p45: example that uses plain unsigned.  p183: "Unisgned
integers, declared unsigned, ...".  p193: [semi-formal grammar]:
"type-specifier: char, short, int, long, unsigned, float, double,
struct-or-union-specifier, typedef-name.  [short int, long int,
unsigned int, long float are also acceptable]".


From K&R 2: p36: same as above p34.  p49: similar to above p45 (now

missing in index; no longer "implicit int" for the function return
type; excessive use of unsigned fixed).  p196: similar to above p183
(now says "...declared using the unsigned keyword).  p211: similzr to
above p193 (add void, signed, enum-specifier; remove long float, and
tighten up the description of which combinations are allowed in other
ways).

Other interesting points from K&R:
- according to the grammar, both `unsigned' and 'signed' are full-fledged
  types, not qualifiers for integer types.  You can even write plain
  'signed' meaning 'signed int', but no one does that.
- K&R very rarely uses `unsigned'.  This shows that it should rarely be
  used.  I could only find the above examples in it (these are all that
  are in the index for K&R 1), plus 1 more a page later than the p45/49
  one (the index is broken in a different way for this -- in K&R 1 the
  one on p46 is not indexed, while in K&R 2 the one on p49 is not
  indexed).

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


Re: svn commit: r236976 - head/sbin/fsck_ffs

2012-06-12 Thread Bjoern A. Zeeb

On 12. Jun 2012, at 21:37 , Konstantin Belousov wrote:

> Author: kib
> Date: Tue Jun 12 21:37:27 2012
> New Revision: 236976
> URL: http://svn.freebsd.org/changeset/base/236976
> 
> Log:
>  For incompleted block allocations or frees, the inode block count usage
>  must be recalculated. The blk_check pass of suj checker explicitely marks
>  inodes which owned such blocks as needing block count adjustment. But
>  ino_adjblks() is only called by cg_trunc pass, which is performed before
>  blk_check. As result, the block use count for such inodes is left wrong.
>  This causes full fsck run after journaled run to still find inconsistencies
>  like 'INCORRECT BLOCK COUNT I=14557 (328 should be 0)' in phase 1.
> 
>  Fix this issue by running additional adj_blk pass after blk_check, which
>  updates the field.
> 
>  Reviewed by: jeff, mckusick

Thanks a lot!

/bz

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

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


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

2012-06-12 Thread David Xu

On 2012/6/13 3:18, Mateusz Guzik wrote:

On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote:

On Tue, Jun 12, 2012 at 03:49:50PM +0200, Mateusz Guzik wrote:

On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote:

On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote:

The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which
still may not be enough to have place for new fd with high number.

I was under impression that fd_first_free() can return at most
fdp->fd_nfiles, but indeed I missed this:

if (low>= size)
return (low);

So fd_first_free() can return number biffer than size...


This fixed the problem for me, although I'm not sure whether it's ok to
grow the table like this:
http://people.freebsd.org/~mjg/patches/fdalloc.patch

The patch looks good to me, could you please commit it, preferably after
David's trying it and also update fd_first_free() comment, so it is
clear that returned value can exceed 'size -1'?


Given that you partially reverted r236935 I created a combined patch:
http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch

Is this ok?

Most changes are obiously yours, so I see no problem if you prefer to
commit this yourself.

Otherwise I plan to commit it with the following:
Re-apply reverted parts of r236935 by pjd with some fixes.

If fdalloc decides to grow fdtable it does it once and at most doubles
the size. This still may be not enough for sufficiently large fd. Use fd
in calculations of new size in order to fix this.

Fix description of fd_first_free to note that it returns passed fd if it
exceeds fdtable's size.

==

Look good and you can just add 'In co-operation with: pjd'.
One minor thing is that fd_first_free() can return 'size' if there are
no free slots available. Could you include that in the comment as well?


http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch


fd_last_used has very same problem with comment as fd_first_free. This
function is static and the only caller always passes 0 as low. Given
that, how about the following:
http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch

Looks good too.


Updated in similar manner:
http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup2.patch


I have tested it, the machine does not panic.

Thanks,
David Xu

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


svn commit: r236977 - head/tools/regression/usr.bin/make/variables/modifier_t

2012-06-12 Thread David E. O'Brien
Author: obrien
Date: Tue Jun 12 23:16:00 2012
New Revision: 236977
URL: http://svn.freebsd.org/changeset/base/236977

Log:
  Add a test for the :tl & :tu modifiers.

Added:
  head/tools/regression/usr.bin/make/variables/modifier_t/
  head/tools/regression/usr.bin/make/variables/modifier_t/Makefile   (contents, 
props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.1   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.2   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.3   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.1   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.2   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.3   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.1   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.2   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.3   
(contents, props changed)
  head/tools/regression/usr.bin/make/variables/modifier_t/test.t   (contents, 
props changed)

Added: head/tools/regression/usr.bin/make/variables/modifier_t/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/make/variables/modifier_t/MakefileTue Jun 
12 23:16:00 2012(r236977)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+#
+# Test the t modifier.
+#
+# below is missing '
+ASCII= 
!"\#$$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+
+test1:
+   @echo '${ASCII}'
+
+test2:
+   @echo '${ASCII:tl}'
+
+test3:
+   @echo '${ASCII:tu}'

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.1   
Tue Jun 12 23:16:00 2012(r236977)
@@ -0,0 +1 @@
+0

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.2
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.2   
Tue Jun 12 23:16:00 2012(r236977)
@@ -0,0 +1 @@
+0

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.3   
Tue Jun 12 23:16:00 2012(r236977)
@@ -0,0 +1 @@
+0

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.1
==

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.2
==

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.3
==

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.1   
Tue Jun 12 23:16:00 2012(r236977)
@@ -0,0 +1 @@
+!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.2
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.2   
Tue Jun 12 23:16:00 2012(r236977)
@@ -0,0 +1 @@
+!"#$%&()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.3   
Tue Jun 12 23:16:00 2012(r236977)
@@ -0,0 +1 @@
+!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~

Added: head/tools/

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

2012-06-12 Thread Pawel Jakub Dawidek
On Tue, Jun 12, 2012 at 09:18:28PM +0200, Mateusz Guzik wrote:
> On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote:
> > Look good and you can just add 'In co-operation with: pjd'.
> > One minor thing is that fd_first_free() can return 'size' if there are
> > no free slots available. Could you include that in the comment as well?
> > 
> 
> http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch

Ok. Merge racct_set() call into one line, it now fits into 80 chars.
I have no more objections.

> > > fd_last_used has very same problem with comment as fd_first_free. This
> > > function is static and the only caller always passes 0 as low. Given
> > > that, how about the following:
> > > http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch
> > 
> > Looks good too.
> > 
> 
> Updated in similar manner:
> http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup2.patch

Ok.

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


pgp0ZCIBDexhe.pgp
Description: PGP signature


svn commit: r236976 - head/sbin/fsck_ffs

2012-06-12 Thread Konstantin Belousov
Author: kib
Date: Tue Jun 12 21:37:27 2012
New Revision: 236976
URL: http://svn.freebsd.org/changeset/base/236976

Log:
  For incompleted block allocations or frees, the inode block count usage
  must be recalculated. The blk_check pass of suj checker explicitely marks
  inodes which owned such blocks as needing block count adjustment. But
  ino_adjblks() is only called by cg_trunc pass, which is performed before
  blk_check. As result, the block use count for such inodes is left wrong.
  This causes full fsck run after journaled run to still find inconsistencies
  like 'INCORRECT BLOCK COUNT I=14557 (328 should be 0)' in phase 1.
  
  Fix this issue by running additional adj_blk pass after blk_check, which
  updates the field.
  
  Reviewed by:  jeff, mckusick
  MFC after:1 week

Modified:
  head/sbin/fsck_ffs/suj.c

Modified: head/sbin/fsck_ffs/suj.c
==
--- head/sbin/fsck_ffs/suj.cTue Jun 12 21:03:24 2012(r236975)
+++ head/sbin/fsck_ffs/suj.cTue Jun 12 21:37:27 2012(r236976)
@@ -1789,6 +1789,20 @@ cg_trunc(struct suj_cg *sc)
}
 }
 
+static void
+cg_adj_blk(struct suj_cg *sc)
+{
+   struct suj_ino *sino;
+   int i;
+
+   for (i = 0; i < SUJ_HASHSIZE; i++) {
+   LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) {
+   if (sino->si_blkadj)
+   ino_adjblks(sino);
+   }
+   }
+}
+
 /*
  * Free any partially allocated blocks and then resolve inode block
  * counts.
@@ -2720,6 +2734,7 @@ suj_check(const char *filesys)
printf("** Processing journal entries.\n");
cg_apply(cg_trunc);
cg_apply(cg_check_blk);
+   cg_apply(cg_adj_blk);
cg_apply(cg_check_ino);
}
if (preen == 0 && (jrecs > 0 || jbytes > 0) && reply("WRITE CHANGES") 
== 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236974 - head/share/misc

2012-06-12 Thread John Baldwin
Author: jhb
Date: Tue Jun 12 20:55:57 2012
New Revision: 236974
URL: http://svn.freebsd.org/changeset/base/236974

Log:
  Add pfg@ as one of my mentees.

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Tue Jun 12 20:54:55 2012
(r236973)
+++ head/share/misc/committers-src.dot  Tue Jun 12 20:55:57 2012
(r236974)
@@ -436,6 +436,7 @@ jhb -> avg
 jhb -> jeff
 jhb -> kbyanc
 jhb -> rnoland
+jhb -> pfg
 
 jkh -> imp
 jkh -> jlemon
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236972 - head/lib/libkiconv

2012-06-12 Thread Dimitry Andric
Author: dim
Date: Tue Jun 12 20:24:57 2012
New Revision: 236972
URL: http://svn.freebsd.org/changeset/base/236972

Log:
  Make sure libkiconv.so.4 is installed into /lib, not into /usr/lib,
  which was inadvertently caused by r236185: if SHLIBDIR is set using the
  ?= operator, it must be done *before* bsd.own.mk is included, otherwise
  the default value is still used.
  
  Note, bsd.lib.mk will take care of removing the copy in /usr/lib upon
  installation, so no addition to ObsoleteFiles.inc is needed.
  
  X-MFC-With:   r236185

Modified:
  head/lib/libkiconv/Makefile

Modified: head/lib/libkiconv/Makefile
==
--- head/lib/libkiconv/Makefile Tue Jun 12 20:05:22 2012(r236971)
+++ head/lib/libkiconv/Makefile Tue Jun 12 20:24:57 2012(r236972)
@@ -1,9 +1,10 @@
 # $FreeBSD$
 
+SHLIBDIR?= /lib
+
 .include 
 
 LIB=   kiconv
-SHLIBDIR?= /lib
 SRCS=  kiconv_sysctl.c xlat16_iconv.c xlat16_sysctl.c
 SRCS+= quirks.c
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-06-12 Thread Mateusz Guzik
On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote:
> On Tue, Jun 12, 2012 at 03:49:50PM +0200, Mateusz Guzik wrote:
> > On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote:
> > > On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote:
> > > > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which
> > > > still may not be enough to have place for new fd with high number.
> > > 
> > > I was under impression that fd_first_free() can return at most
> > > fdp->fd_nfiles, but indeed I missed this:
> > > 
> > >   if (low >= size)
> > >   return (low);
> > > 
> > > So fd_first_free() can return number biffer than size...
> > > 
> > > > This fixed the problem for me, although I'm not sure whether it's ok to
> > > > grow the table like this:
> > > > http://people.freebsd.org/~mjg/patches/fdalloc.patch
> > > 
> > > The patch looks good to me, could you please commit it, preferably after
> > > David's trying it and also update fd_first_free() comment, so it is
> > > clear that returned value can exceed 'size -1'?
> > > 
> > 
> > Given that you partially reverted r236935 I created a combined patch:
> > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch
> > 
> > Is this ok?
> > 
> > Most changes are obiously yours, so I see no problem if you prefer to
> > commit this yourself.
> > 
> > Otherwise I plan to commit it with the following:
> > Re-apply reverted parts of r236935 by pjd with some fixes.
> > 
> > If fdalloc decides to grow fdtable it does it once and at most doubles
> > the size. This still may be not enough for sufficiently large fd. Use fd
> > in calculations of new size in order to fix this.
> > 
> > Fix description of fd_first_free to note that it returns passed fd if it
> > exceeds fdtable's size.
> > 
> > ==
> 
> Look good and you can just add 'In co-operation with: pjd'.
> One minor thing is that fd_first_free() can return 'size' if there are
> no free slots available. Could you include that in the comment as well?
> 

http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch

> > fd_last_used has very same problem with comment as fd_first_free. This
> > function is static and the only caller always passes 0 as low. Given
> > that, how about the following:
> > http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch
> 
> Looks good too.
> 

Updated in similar manner:
http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup2.patch

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


svn commit: r236968 - head/sys/sys

2012-06-12 Thread John Baldwin
Author: jhb
Date: Tue Jun 12 18:19:46 2012
New Revision: 236968
URL: http://svn.freebsd.org/changeset/base/236968

Log:
  Replace a reference to the non-existent SI_ORDER_LAST in a comment with
  SI_ORDER_ANY.
  
  Submitted by: Brandon Gooch  brandongooch yahoo com

Modified:
  head/sys/sys/kernel.h

Modified: head/sys/sys/kernel.h
==
--- head/sys/sys/kernel.h   Tue Jun 12 17:14:19 2012(r236967)
+++ head/sys/sys/kernel.h   Tue Jun 12 18:19:46 2012(r236968)
@@ -267,7 +267,7 @@ voidsysinit_add(struct sysinit **set, s
 /*
  * Infrastructure for tunable 'constants'.  Value may be specified at compile
  * time or kernel load time.  Rules relating tunables together can be placed
- * in a SYSINIT function at SI_SUB_TUNABLES with SI_ORDER_LAST.
+ * in a SYSINIT function at SI_SUB_TUNABLES with SI_ORDER_ANY.
  *
  * WARNING: developers should never use the reserved suffixes specified in
  * loader.conf(5) for any tunables or conflicts will result.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236967 - head/lib/libcrypt

2012-06-12 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Jun 12 17:14:19 2012
New Revision: 236967
URL: http://svn.freebsd.org/changeset/base/236967

Log:
  Stop using auth_getval() now that it always returns NULL.  Instead,
  hardcode the default to what it would be if we didn't hardcode it,
  i.e. DES if supported and MD5 otherwise.
  
  MFC after:3 weeks

Modified:
  head/lib/libcrypt/Makefile
  head/lib/libcrypt/crypt.3
  head/lib/libcrypt/crypt.c

Modified: head/lib/libcrypt/Makefile
==
--- head/lib/libcrypt/Makefile  Tue Jun 12 17:04:56 2012(r236966)
+++ head/lib/libcrypt/Makefile  Tue Jun 12 17:14:19 2012(r236967)
@@ -26,11 +26,7 @@ SRCS+=   crypt-des.c crypt-blowfish.c blo
 CFLAGS+=   -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH
 .endif
 
-# And the auth_getval() code and support.
-.PATH: ${.CURDIR}/../libutil
-SRCS+= auth.c property.c
-.for sym in auth_getval property_find properties_read properties_free \
-   MD4Init MD4Final MD4Update MD4Pad \
+.for sym in MD4Init MD4Final MD4Update MD4Pad \
MD5Init MD5Final MD5Update MD5Pad \
SHA256_Init SHA256_Final SHA256_Update \
SHA512_Init SHA512_Final SHA512_Update

Modified: head/lib/libcrypt/crypt.3
==
--- head/lib/libcrypt/crypt.3   Tue Jun 12 17:04:56 2012(r236966)
+++ head/lib/libcrypt/crypt.3   Tue Jun 12 17:14:19 2012(r236967)
@@ -238,12 +238,6 @@ The
 .Fn crypt_set_format
 function sets the default encoding format according to the supplied
 .Fa string .
-.Pp
-The global default format can be set using the
-.Pa /etc/auth.conf
-file using the
-.Va crypt_default
-property.
 .Sh RETURN VALUES
 The
 .Fn crypt
@@ -260,9 +254,7 @@ Otherwise, a value of 0 is returned.
 .Sh SEE ALSO
 .Xr login 1 ,
 .Xr passwd 1 ,
-.Xr auth_getval 3 ,
 .Xr getpass 3 ,
-.Xr auth.conf 5 ,
 .Xr passwd 5
 .Sh HISTORY
 A rotor-based

Modified: head/lib/libcrypt/crypt.c
==
--- head/lib/libcrypt/crypt.c   Tue Jun 12 17:04:56 2012(r236966)
+++ head/lib/libcrypt/crypt.c   Tue Jun 12 17:14:19 2012(r236967)
@@ -79,23 +79,23 @@ static const struct {
}
 };
 
+#ifdef HAS_DES
+#define CRYPT_DEFAULT  "des"
+#else
+#define CRYPT_DEFAULT  "md5"
+#endif
+
 static int crypt_type = -1;
 
 static void
 crypt_setdefault(void)
 {
-   char *def;
size_t i;
 
if (crypt_type != -1)
return;
-   def = auth_getval("crypt_default");
-   if (def == NULL) {
-   crypt_type = 0;
-   return;
-   }
for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) {
-   if (strcmp(def, crypt_types[i].name) == 0) {
+   if (strcmp(CRYPT_DEFAULT, crypt_types[i].name) == 0) {
crypt_type = (int)i;
return;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236966 - head/sys/mips/rmi

2012-06-12 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Jun 12 17:04:56 2012
New Revision: 236966
URL: http://svn.freebsd.org/changeset/base/236966

Log:
  auth.conf is dead.

Modified:
  head/sys/mips/rmi/rootfs_list.txt

Modified: head/sys/mips/rmi/rootfs_list.txt
==
--- head/sys/mips/rmi/rootfs_list.txt   Tue Jun 12 17:02:53 2012
(r236965)
+++ head/sys/mips/rmi/rootfs_list.txt   Tue Jun 12 17:04:56 2012
(r236966)
@@ -1,3 +1,5 @@
+# $FreeBSD$
+#
 # This is the list of files that
 # should be in your rootfs (copy it from
 # the build world nfsmount dir. When the rge0
@@ -321,7 +323,6 @@
 ./etc/ssh/moduli
 ./etc/ssl
 ./etc/ssl/openssl.cnf
-./etc/auth.conf
 ./etc/crontab
 ./etc/devd.conf
 ./etc/devfs.conf
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236965 - in head: etc include lib/libutil share/examples/etc

2012-06-12 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Jun 12 17:02:53 2012
New Revision: 236965
URL: http://svn.freebsd.org/changeset/base/236965

Log:
  Finally nuke auth.conf, nine years after it was deprecated.  The only
  thing it was still used for was to set the "global default" password
  hash.  Since the stock auth.conf contained nothing but comments, the
  global default was actually the first algorithm in crypt(3)'s list,
  which happens to be DES; I take the fact that nobody noticed as proof
  that it was not used outside of crypt(3).
  
  The only other use in our tree was in the Kerberos support code in
  in tinyware's passwd(1).  I removed that code in an earlier commit;
  it would not have compiled anyway, as it only supported Kerberos IV.
  
  The auth_getval() function is now a stub that always returns NULL,
  which has the same effect as a functional auth_getval() with an
  empty auth.conf.
  
  MFC after:3 weeks

Deleted:
  head/etc/auth.conf
  head/lib/libutil/auth.3
  head/lib/libutil/auth.conf.5
Modified:
  head/etc/Makefile
  head/include/paths.h
  head/lib/libutil/Makefile
  head/lib/libutil/auth.c
  head/lib/libutil/property.3
  head/share/examples/etc/README.examples

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Tue Jun 12 16:07:03 2012(r236964)
+++ head/etc/Makefile   Tue Jun 12 17:02:53 2012(r236965)
@@ -7,8 +7,7 @@
 SUBDIR=sendmail
 .endif
 
-BIN1=  auth.conf \
-   crontab \
+BIN1=  crontab \
devd.conf \
devfs.conf \
ddb.conf \

Modified: head/include/paths.h
==
--- head/include/paths.hTue Jun 12 16:07:03 2012(r236964)
+++ head/include/paths.hTue Jun 12 17:02:53 2012(r236965)
@@ -42,7 +42,6 @@
 /* Locate system binaries. */
 #define_PATH_SYSPATH   "/sbin:/usr/sbin"
 
-#define_PATH_AUTHCONF  "/etc/auth.conf"
 #define_PATH_BSHELL"/bin/sh"
 #define_PATH_CAPABILITY"/etc/capability"
 #define_PATH_CAPABILITY_DB "/etc/capability.db"

Modified: head/lib/libutil/Makefile
==
--- head/lib/libutil/Makefile   Tue Jun 12 16:07:03 2012(r236964)
+++ head/lib/libutil/Makefile   Tue Jun 12 17:02:53 2012(r236965)
@@ -25,14 +25,13 @@ CFLAGS+= -DINET6
 
 CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libc/gen/
 
-MAN+=  auth.3 expand_number.3 flopen.3 fparseln.3 hexdump.3 \
+MAN+=  expand_number.3 flopen.3 fparseln.3 hexdump.3 \
humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \
kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \
login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \
property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \
_secure_path.3 trimdomain.3 uucplock.3
-MAN+=  auth.conf.5 login.conf.5
-MLINKS+= auth.3 auth_getval.3
+MAN+=  login.conf.5
 MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3
 MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3
 MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \

Modified: head/lib/libutil/auth.c
==
--- head/lib/libutil/auth.c Tue Jun 12 16:07:03 2012(r236964)
+++ head/lib/libutil/auth.c Tue Jun 12 17:02:53 2012(r236965)
@@ -31,40 +31,14 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static properties P;
-
-static int
-initauthconf(const char *path)
-{
-int fd;
+#include 
 
-if (!P) {
-   if ((fd = open(path, O_RDONLY)) < 0) {
-   syslog(LOG_ERR, "initauthconf: unable to open file: %s", path);
-   return 1;
-   }
-   P = properties_read(fd);
-   close(fd);
-   if (!P) {
-   syslog(LOG_ERR, "initauthconf: unable to parse file: %s", path);
-   return 1;
-   }
-}
-return 0;
-}
+#include 
 
 char *
 auth_getval(const char *name)
 {
-if (!P && initauthconf(_PATH_AUTHCONF))
-   return NULL;
-else
-   return property_find(P, name);
+
+   (void)name;
+   return (NULL);
 }

Modified: head/lib/libutil/property.3
==
--- head/lib/libutil/property.3 Tue Jun 12 16:07:03 2012(r236964)
+++ head/lib/libutil/property.3 Tue Jun 12 17:02:53 2012(r236965)
@@ -90,8 +90,6 @@ are desired, the entire value should be 
 characters.
 Any line beginning with a # or ; character is assumed to
 be a comment and will be ignored.
-.Sh SEE ALSO
-.Xr auth_getval 3
 .Sh AUTHORS
 .An Jordan Hubbard
 .Sh BUGS

Modified: head/share/examples/etc/README.examples
==
--- head/share/examples/etc/README.examples Tue Jun 12

Re: svn commit: r236962 - in head/contrib/gcc: . config/i386 doc

2012-06-12 Thread Pedro Giffuni

On 06/12/12 10:49, Dima Panov wrote:

13.06.2012 2:04, Pedro F. Giffuni написал:

@@ -1209,14 +1209,14 @@ i[34567]86-*-solaris2*)
  # FIXME: -m64 for i[34567]86-*-* should be allowed just
  # like -m32 for x86_64-*-*.
  case X"${with_cpu}" in
-
Xgeneric|Xcore2|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx)
+
Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)

  ;;
  X)
  with_cpu=generic
  ;;
  *)
  echo "Unsupported CPU used in --with-cpu=$with_cpu, 
supported values:" 1>&2
-echo "generic core2 nocona x86-64 k8 opteron athlon64 
athlon-fx" 1>&2
+echo "generic core2 nocona x86-64amd fam10 barcelona k8 
opteron


Please take a look at typo.  x86-64amd fam10



Thank you, just fixed in r236964 !!

Mentor approval implicit: I think we don't actually use config.gcc at 
all but it didn't

make much sense to wait before fixing space typo ;).

Thanks,

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


svn commit: r236964 - head/contrib/gcc

2012-06-12 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jun 12 16:07:03 2012
New Revision: 236964
URL: http://svn.freebsd.org/changeset/base/236964

Log:
  Space mismatch - typo in  r236962.
  
  Found by: Dima Panov
  Approved by:  jhb (mentor)
  MFC after:2 weeks

Modified:
  head/contrib/gcc/config.gcc

Modified: head/contrib/gcc/config.gcc
==
--- head/contrib/gcc/config.gcc Tue Jun 12 15:32:14 2012(r236963)
+++ head/contrib/gcc/config.gcc Tue Jun 12 16:07:03 2012(r236964)
@@ -1216,7 +1216,7 @@ i[34567]86-*-solaris2*)
;;
*)
echo "Unsupported CPU used in --with-cpu=$with_cpu, 
supported values:" 1>&2
-   echo "generic core2 nocona x86-64amd fam10 barcelona k8 
opteron athlon64 athlon-fx" 1>&2
+   echo "generic core2 nocona x86-64 amdfam10 barcelona k8 
opteron athlon64 athlon-fx" 1>&2
exit 1
;;
esac
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-06-12 Thread Pawel Jakub Dawidek
On Tue, Jun 12, 2012 at 03:49:50PM +0200, Mateusz Guzik wrote:
> On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote:
> > On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote:
> > > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which
> > > still may not be enough to have place for new fd with high number.
> > 
> > I was under impression that fd_first_free() can return at most
> > fdp->fd_nfiles, but indeed I missed this:
> > 
> > if (low >= size)
> > return (low);
> > 
> > So fd_first_free() can return number biffer than size...
> > 
> > > This fixed the problem for me, although I'm not sure whether it's ok to
> > > grow the table like this:
> > > http://people.freebsd.org/~mjg/patches/fdalloc.patch
> > 
> > The patch looks good to me, could you please commit it, preferably after
> > David's trying it and also update fd_first_free() comment, so it is
> > clear that returned value can exceed 'size -1'?
> > 
> 
> Given that you partially reverted r236935 I created a combined patch:
> http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch
> 
> Is this ok?
> 
> Most changes are obiously yours, so I see no problem if you prefer to
> commit this yourself.
> 
> Otherwise I plan to commit it with the following:
> Re-apply reverted parts of r236935 by pjd with some fixes.
> 
> If fdalloc decides to grow fdtable it does it once and at most doubles
> the size. This still may be not enough for sufficiently large fd. Use fd
> in calculations of new size in order to fix this.
> 
> Fix description of fd_first_free to note that it returns passed fd if it
> exceeds fdtable's size.
> 
> ==

Look good and you can just add 'In co-operation with: pjd'.
One minor thing is that fd_first_free() can return 'size' if there are
no free slots available. Could you include that in the comment as well?

> fd_last_used has very same problem with comment as fd_first_free. This
> function is static and the only caller always passes 0 as low. Given
> that, how about the following:
> http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch

Looks good too.

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


pgpkpgW2gEoWU.pgp
Description: PGP signature


Re: svn commit: r236962 - in head/contrib/gcc: . config/i386 doc

2012-06-12 Thread Pedro Giffuni

On 06/12/12 10:04, Pedro F. Giffuni wrote:

Author: pfg
Date: Tue Jun 12 15:04:18 2012
New Revision: 236962
URL: http://svn.freebsd.org/changeset/base/236962

Log:
   Add experimental support for amdfam10/barcelona from the GCC 4.3 branch.

   Initial support for the AMD barcelona chipsets has been available in the
   gcc43 branch under GPLv2 but was not included when the Core 2 support
   was brought to the system gcc.

   AMD and some linux distributions (OpenSUSE) did a backport of the amdfam10
   support and made them available. Unfortunately this is still experimental
   and while it can improve performance, enabling the CPUTYPE may break some
   C++ ports (like clang).

   Special care was taken to make sure that the patches predate the GPLv3
   switch upstream.

   Tested by:   Vladimir Kushnir
   Reviewed by: mm
   Approved by: jhb (mentor)
   MFC after:   2 weeks




As a side note, I didn't add the CPUTYPE to bsd.cpu.mk
because it may break buildworld in clang, so normally
most of this optimizations are not available.

The patch does include some minor fixes for optimizations
that GCC developers didn't consider regressions so were
never back ported. This was, of course, tested by building
world on amd64 (not amdfam10) and shouldn't cause any
trouble.

I think this ends the series of GPLv2 patches we could
bring in.

Pedro.

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


Re: svn commit: r236962 - in head/contrib/gcc: . config/i386 doc

2012-06-12 Thread Dima Panov

13.06.2012 2:04, Pedro F. Giffuni написал:

@@ -1209,14 +1209,14 @@ i[34567]86-*-solaris2*)
# FIXME: -m64 for i[34567]86-*-* should be allowed just
# like -m32 for x86_64-*-*.
case X"${with_cpu}" in
-   
Xgeneric|Xcore2|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx)
+   
Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
;;
X)
with_cpu=generic
;;
*)
echo "Unsupported CPU used in --with-cpu=$with_cpu, supported 
values:" 1>&2
-   echo "generic core2 nocona x86-64 k8 opteron athlon64 
athlon-fx" 1>&2
+   echo "generic core2 nocona x86-64amd fam10 barcelona k8 
opteron


Please take a look at typo.  x86-64amd fam10


athlon64 athlon-fx" 1>&2
exit 1
;;
esac
@@ -2515,6 +2515,9 @@ if test x$with_cpu = x ; then





--
Dima Panov (flu...@freebsd.org)
(KDE, Office)@FreeBSD team

Facebook: http://www.facebook.com/fluffy.khv
IRC: fluffy@EFNet, fluffykhv@FreeNode
twitter: fluffy_khv | skype: dima.panov

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


svn commit: r236963 - head/release/picobsd/tinyware/passwd

2012-06-12 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Jun 12 15:32:14 2012
New Revision: 236963
URL: http://svn.freebsd.org/changeset/base/236963

Log:
  Remove dead code.

Modified:
  head/release/picobsd/tinyware/passwd/passwd.c

Modified: head/release/picobsd/tinyware/passwd/passwd.c
==
--- head/release/picobsd/tinyware/passwd/passwd.c   Tue Jun 12 15:04:18 
2012(r236962)
+++ head/release/picobsd/tinyware/passwd/passwd.c   Tue Jun 12 15:32:14 
2012(r236963)
@@ -64,10 +64,6 @@ int yp_errno = YP_TRUE;
 extern int yp_passwd( char * );
 #endif
 
-#ifdef KERBEROS
-#include "krb.h"
-#endif
-
 #include "extern.h"
 
 static void usage(void);
@@ -81,26 +77,12 @@ main(argc, argv)
 {
int ch;
char *uname;
-#ifdef KERBEROS
-   char *iflag = 0, *rflag = 0, *uflag = 0;
-   char *k;
-#endif
 
 #ifdef YP
-#ifdef KERBEROS
-   char realm[REALM_SZ];
-#define OPTIONS "d:h:lysfoi:r:u:"
-#else
 #define OPTIONS "d:h:lysfo"
-#endif
-#else
-#ifdef KERBEROS
-   char realm[REALM_SZ];
-#define OPTIONS "li:r:u:"
 #else
 #define OPTIONS "l"
 #endif
-#endif
 
 #ifdef YP
int res = 0;
@@ -113,17 +95,6 @@ main(argc, argv)
case 'l':   /* change local password file */
use_local_passwd = 1;
break;
-#ifdef KERBEROS
-   case 'i':
-   iflag = optarg;
-   break;
-   case 'r':
-   rflag = optarg;
-   break;
-   case 'u':
-   uflag = optarg;
-   break;
-#endif /* KERBEROS */
 #ifdef YP
case 'y':   /* Change NIS password */
__use_yp = 1;
@@ -182,46 +153,29 @@ main(argc, argv)
/*
 * If NIS is turned on in the password database, use it, else punt.
 */
-#ifdef KERBEROS
-   if (__use_yp || (iflag == NULL && rflag == NULL && uflag == NULL)) {
-#endif
-   res = use_yp(uname, 0, 0);
-   if (res == USER_YP_ONLY) {
-   if (!use_local_passwd) {
-   exit(yp_passwd(uname));
-   } else {
+   res = use_yp(uname, 0, 0);
+   if (res == USER_YP_ONLY) {
+   if (!use_local_passwd) {
+   exit(yp_passwd(uname));
+   } else {
/*
 * Reject -l flag if NIS is turned on and the user
 * doesn't exist in the local password database.
 */
-   errx(1, "unknown local user: %s", uname);
-   }
-   } else if (res == USER_LOCAL_ONLY) {
-   /*
-* Reject -y flag if user only exists locally.
-*/
-   if (__use_yp)
-   errx(1, "unknown NIS user: %s", uname);
-   } else if (res == USER_YP_AND_LOCAL) {
-   if (!use_local_passwd && (yp_in_pw_file || __use_yp))
-   exit(yp_passwd(uname));
+   errx(1, "unknown local user: %s", uname);
}
-#ifdef KERBEROS
+   } else if (res == USER_LOCAL_ONLY) {
+   /*
+* Reject -y flag if user only exists locally.
+*/
+   if (__use_yp)
+   errx(1, "unknown NIS user: %s", uname);
+   } else if (res == USER_YP_AND_LOCAL) {
+   if (!use_local_passwd && (yp_in_pw_file || __use_yp))
+   exit(yp_passwd(uname));
}
 #endif
-#endif
 
-   if (!use_local_passwd) {
-#ifdef KERBEROS
-   k = auth_getval("auth_list");
-   if (k && strstr(k, "kerberos"))
-   if(krb_get_lrealm(realm, 0) == KSUCCESS) {
-   setuid(getuid());
-   fprintf(stderr, "realm %s\n", realm);
-   exit(krb_passwd(argv[0], iflag, rflag, uflag));
-   }
-#endif
-   }
exit(local_passwd(uname));
 }
 
@@ -230,21 +184,10 @@ usage()
 {
 
 #ifdef YP
-#ifdef KERBEROS
-   fprintf(stderr, "%s\n%s\n",
-   "usage: passwd [-l] [-i instance] [-r realm] [-u fullname]",
-   "   passwd [-l] [-y] [-o] [-d domain [-h host]] [user]");
-#else
(void)fprintf(stderr,
"usage: passwd [-l] [-y] [-o] [-d domain [-h host]] [user]\n");
-#endif
 #else
-#ifdef KERBEROS
-   fprintf(stderr,
-   "usage: passwd [-l] [-i instance] [-r realm] [-u fullname] 
[user]\n");
-#else
-   (void)fprintf(stderr, "usage: passwd user\n");
-#endif
+   (void)fprintf(stderr, "usage: passwd [-l] user\n");
 #endif
exit(1);
 }
___
svn-src-head@freebsd.org mailing list
h

svn commit: r236962 - in head/contrib/gcc: . config/i386 doc

2012-06-12 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jun 12 15:04:18 2012
New Revision: 236962
URL: http://svn.freebsd.org/changeset/base/236962

Log:
  Add experimental support for amdfam10/barcelona from the GCC 4.3 branch.
  
  Initial support for the AMD barcelona chipsets has been available in the
  gcc43 branch under GPLv2 but was not included when the Core 2 support
  was brought to the system gcc.
  
  AMD and some linux distributions (OpenSUSE) did a backport of the amdfam10
  support and made them available. Unfortunately this is still experimental
  and while it can improve performance, enabling the CPUTYPE may break some
  C++ ports (like clang).
  
  Special care was taken to make sure that the patches predate the GPLv3
  switch upstream.
  
  Tested by:Vladimir Kushnir
  Reviewed by:  mm
  Approved by:  jhb (mentor)
  MFC after:2 weeks

Added:
  head/contrib/gcc/config/i386/ammintrin.h   (contents, props changed)
Modified:
  head/contrib/gcc/ChangeLog.gcc43
  head/contrib/gcc/builtins.c
  head/contrib/gcc/config.gcc
  head/contrib/gcc/config/i386/athlon.md
  head/contrib/gcc/config/i386/driver-i386.c
  head/contrib/gcc/config/i386/i386.c
  head/contrib/gcc/config/i386/i386.h
  head/contrib/gcc/config/i386/i386.md
  head/contrib/gcc/config/i386/i386.opt
  head/contrib/gcc/config/i386/mmx.md
  head/contrib/gcc/config/i386/pmmintrin.h
  head/contrib/gcc/config/i386/sse.md
  head/contrib/gcc/config/i386/tmmintrin.h
  head/contrib/gcc/doc/extend.texi
  head/contrib/gcc/doc/invoke.texi
  head/contrib/gcc/fold-const.c
  head/contrib/gcc/gimplify.c
  head/contrib/gcc/tree-ssa-ccp.c
  head/contrib/gcc/tree-ssa-pre.c

Modified: head/contrib/gcc/ChangeLog.gcc43
==
--- head/contrib/gcc/ChangeLog.gcc43Tue Jun 12 14:56:08 2012
(r236961)
+++ head/contrib/gcc/ChangeLog.gcc43Tue Jun 12 15:04:18 2012
(r236962)
@@ -1,3 +1,8 @@
+2007-05-01  Dwarakanath Rajagopal 
+
+   * doc/invoke.texi: Fix typo, 'AMD Family 10h core' instead of 
+   'AMD Family 10 core'.
+
 2007-05-01  Dwarakanath Rajagopal  (r124339)
  
* config/i386/i386.c (override_options): Accept k8-sse3, opteron-sse3 
@@ -5,10 +10,39 @@
with SSE3 instruction set support.
* doc/invoke.texi: Likewise.
 
+2007-05-01  Dwarakanath Rajagopal 
+
+   * config/i386/i386.c (override_options): Tuning 32-byte loop
+   alignment for amdfam10 architecture. Increasing the max loop
+   alignment to 24 bytes.
+
+2007-04-12  Richard Guenther  
+
+   PR tree-optimization/24689
+   PR tree-optimization/31307
+   * fold-const.c (operand_equal_p): Compare INTEGER_CST array
+   indices by value.
+   * gimplify.c (canonicalize_addr_expr): To be consistent with
+   gimplify_compound_lval only set operands two and three of
+   ARRAY_REFs if they are not gimple_min_invariant.  This makes
+   it never at this place.
+   * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise.
+
 2007-04-07  H.J. Lu   (r123639)
 
* config/i386/i386.c (ix86_handle_option): Handle SSSE3.
 
+2007-03-28  Dwarakanath Rajagopal  
+
+   * config.gcc: Accept barcelona as a variant of amdfam10.
+   * config/i386/i386.c (override_options): Likewise.
+   * doc/invoke.texi: Likewise.
+
+2007-02-09  Dwarakanath Rajagopal  
+
+   * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10.
+   (bit_SSE4a): New.
+
 2007-02-08  Harsha Jagasia   (r121726)
 
* config/i386/xmmintrin.h: Make inclusion of emmintrin.h
@@ -26,6 +60,173 @@
 
* config/i386/i386.c (override_options): Set PTA_SSSE3 for core2.
 
+2007-02-05  Harsha Jagasia  
+
+   * config/i386/athlon.md (athlon_fldxf_k8, athlon_fld_k8,
+   athlon_fstxf_k8, athlon_fst_k8, athlon_fist, athlon_fmov,
+   athlon_fadd_load, athlon_fadd_load_k8, athlon_fadd, athlon_fmul,
+   athlon_fmul_load, athlon_fmul_load_k8, athlon_fsgn,
+   athlon_fdiv_load, athlon_fdiv_load_k8, athlon_fdiv_k8,
+   athlon_fpspc_load, athlon_fpspc, athlon_fcmov_load,
+   athlon_fcmov_load_k8, athlon_fcmov_k8, athlon_fcomi_load_k8,
+   athlon_fcomi, athlon_fcom_load_k8, athlon_fcom): Added amdfam10.
+
+2007-02-05  Harsha Jagasia  
+
+   * config/i386/i386.md (x86_sahf_1, cmpfp_i_mixed, cmpfp_i_sse,
+   cmpfp_i_i387, cmpfp_iu_mixed, cmpfp_iu_sse, cmpfp_iu_387,
+   swapsi, swaphi_1, swapqi_1, swapdi_rex64, fix_truncsfdi_sse,
+   fix_truncdfdi_sse, fix_truncsfsi_sse, fix_truncdfsi_sse,
+   x86_fldcw_1, floatsisf2_mixed, floatsisf2_sse, floatdisf2_mixed,
+   floatdisf2_sse, floatsidf2_mixed, floatsidf2_sse,
+   floatdidf2_mixed, floatdidf2_sse, muldi3_1_rex64, mulsi3_1,
+   mulsi3_1_zext, mulhi3_1, mulqi3_1, umulqihi3_1, mulqihi3_insn,
+   umulditi3_insn, umulsidi3_insn, mulditi3_insn, mulsidi3_insn,
+   umuldi3_highpart_rex64, umulsi3_highpart_insn,
+   umulsi3_highpart_zext, smuldi3_highpart_rex64,
+   smulsi3_hig

svn commit: r236961 - head/sys/netinet

2012-06-12 Thread Michael Tuexen
Author: tuexen
Date: Tue Jun 12 14:56:08 2012
New Revision: 236961
URL: http://svn.freebsd.org/changeset/base/236961

Log:
  Add a cmsg of type IP_TOS for UDP/IPv4 sockets to specify the TOS byte.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Tue Jun 12 14:40:19 2012
(r236960)
+++ head/sys/netinet/udp_usrreq.c   Tue Jun 12 14:56:08 2012
(r236961)
@@ -956,6 +956,7 @@ udp_output(struct inpcb *inp, struct mbu
int ipflags;
u_short fport, lport;
int unlock_udbinfo;
+   u_char tos;
 
/*
 * udp_output() may need to temporarily bind or connect the current
@@ -972,6 +973,7 @@ udp_output(struct inpcb *inp, struct mbu
 
src.sin_family = 0;
INP_RLOCK(inp);
+   tos = inp->inp_ip_tos;
if (control != NULL) {
/*
 * XXX: Currently, we assume all the optional information is
@@ -1010,6 +1012,14 @@ udp_output(struct inpcb *inp, struct mbu
*(struct in_addr *)CMSG_DATA(cm);
break;
 
+   case IP_TOS:
+   if (cm->cmsg_len != CMSG_LEN(sizeof(u_char))) {
+   error = EINVAL;
+   break;
+   }
+   tos = *(u_char *)CMSG_DATA(cm);
+   break;
+
default:
error = ENOPROTOOPT;
break;
@@ -1225,7 +1235,7 @@ udp_output(struct inpcb *inp, struct mbu
ui->ui_sum = 0;
((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len;
((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl;/* XXX */
-   ((struct ip *)ui)->ip_tos = inp->inp_ip_tos;/* XXX */
+   ((struct ip *)ui)->ip_tos = tos;/* XXX */
UDPSTAT_INC(udps_opackets);
 
if (unlock_udbinfo == UH_WLOCKED)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236960 - head/cddl/contrib/opensolaris/cmd/zpool

2012-06-12 Thread Martin Matuska
Author: mm
Date: Tue Jun 12 14:40:19 2012
New Revision: 236960
URL: http://svn.freebsd.org/changeset/base/236960

Log:
  Document the -v flag for zpool list.
  
  PR:   168970
  Suggested by: Marcelo Araujo 
  MFC after:3 days

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Tue Jun 12 14:02:38 
2012(r236959)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Tue Jun 12 14:40:19 
2012(r236960)
@@ -1348,6 +1348,8 @@ reports are printed.
 .It Fl H
 Scripted mode. Do not display headers, and separate fields by a single tab
 instead of arbitrary space.
+.It Fl v
+Show more detailed information.
 .It Fl o Ar property Ns Op , Ns Ar ...
 Comma-separated list of properties to display. See the
 .Qq Sx Properties

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cTue Jun 12 
14:02:38 2012(r236959)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cTue Jun 12 
14:40:19 2012(r236960)
@@ -235,7 +235,7 @@ get_usage(zpool_help_t idx) {
case HELP_LABELCLEAR:
return (gettext("\tlabelclear [-f] \n"));
case HELP_LIST:
-   return (gettext("\tlist [-H] [-o property[,...]] "
+   return (gettext("\tlist [-Hv] [-o property[,...]] "
"[-T d|u] [pool] ... [interval [count]]\n"));
case HELP_OFFLINE:
return (gettext("\toffline [-t]   ...\n"));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236959 - in head: share/man/man4 sys/netinet

2012-06-12 Thread Michael Tuexen
Author: tuexen
Date: Tue Jun 12 14:02:38 2012
New Revision: 236959
URL: http://svn.freebsd.org/changeset/base/236959

Log:
  Add a IP_RECVTOS socket option to receive for received UDP/IPv4
  packets a cmsg of type IP_RECVTOS which contains the TOS byte.
  Much like IP_RECVTTL does for TTL. This allows to implement a
  protocol on top of UDP and implementing ECN.
  
  MFC after: 3 days

Modified:
  head/share/man/man4/ip.4
  head/sys/netinet/in.h
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_output.c

Modified: head/share/man/man4/ip.4
==
--- head/share/man/man4/ip.4Tue Jun 12 13:57:56 2012(r236958)
+++ head/share/man/man4/ip.4Tue Jun 12 14:02:38 2012(r236959)
@@ -32,7 +32,7 @@
 .\" @(#)ip.4   8.2 (Berkeley) 11/30/93
 .\" $FreeBSD$
 .\"
-.Dd November 14, 2011
+.Dd June 12, 2012
 .Dt IP 4
 .Os
 .Sh NAME
@@ -286,6 +286,29 @@ cmsg_type = IP_RECVTTL
 .\"
 .Pp
 If the
+.Dv IP_RECVTOS
+option is enabled on a
+.Dv SOCK_DGRAM
+socket, the
+.Xr recvmsg 2
+call will return the
+.Tn IP
+.Tn TOS
+(type of service) field for a
+.Tn UDP
+datagram.
+The msg_control field in the msghdr structure points to a buffer
+that contains a cmsghdr structure followed by the
+.Tn TOS .
+The cmsghdr fields have the following values:
+.Bd -literal
+cmsg_len = CMSG_LEN(sizeof(u_char))
+cmsg_level = IPPROTO_IP
+cmsg_type = IP_RECVTOS
+.Ed
+.\"
+.Pp
+If the
 .Dv IP_RECVIF
 option is enabled on a
 .Dv SOCK_DGRAM

Modified: head/sys/netinet/in.h
==
--- head/sys/netinet/in.h   Tue Jun 12 13:57:56 2012(r236958)
+++ head/sys/netinet/in.h   Tue Jun 12 14:02:38 2012(r236959)
@@ -462,6 +462,7 @@ __END_DECLS
 #defineIP_RECVTTL  65   /* bool; receive IP TTL w/dgram */
 #defineIP_MINTTL   66   /* minimum TTL for packet or drop 
*/
 #defineIP_DONTFRAG 67   /* don't fragment packet */
+#defineIP_RECVTOS  68   /* bool; receive IP TOS w/dgram */
 
 /* IPv4 Source Filter Multicast API [RFC3678] */
 #defineIP_ADD_SOURCE_MEMBERSHIP70   /* join a source-specific 
group */

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Tue Jun 12 13:57:56 2012(r236958)
+++ head/sys/netinet/in_pcb.c   Tue Jun 12 14:02:38 2012(r236959)
@@ -2295,6 +2295,10 @@ db_print_inpflags(int inp_flags)
db_printf("%sINP_DONTFRAG", comma ? ", " : "");
comma = 1;
}
+   if (inp_flags & INP_RECVTOS) {
+   db_printf("%sINP_RECVTOS", comma ? ", " : "");
+   comma = 1;
+   }
if (inp_flags & IN6P_IPV6_V6ONLY) {
db_printf("%sIN6P_IPV6_V6ONLY", comma ? ", " : "");
comma = 1;

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Tue Jun 12 13:57:56 2012(r236958)
+++ head/sys/netinet/in_pcb.h   Tue Jun 12 14:02:38 2012(r236959)
@@ -509,6 +509,7 @@ voidinp_4tuple_get(struct inpcb *inp, 
 #defineINP_DONTFRAG0x0800 /* don't fragment packet */
 #defineINP_BINDANY 0x1000 /* allow bind to any address 
*/
 #defineINP_INHASHLIST  0x2000 /* in_pcbinshash() has been 
called */
+#defineINP_RECVTOS 0x4000 /* receive incoming IP TOS */
 #defineIN6P_IPV6_V6ONLY0x8000 /* restrict AF_INET6 socket 
for v6 */
 #defineIN6P_PKTINFO0x0001 /* receive IP6 dst and I/F */
 #defineIN6P_HOPLIMIT   0x0002 /* receive hoplimit */
@@ -528,7 +529,7 @@ voidinp_4tuple_get(struct inpcb *inp, 
 #defineIN6P_MTU0x8000 /* receive path MTU */
 
 #defineINP_CONTROLOPTS 
(INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
-INP_RECVIF|INP_RECVTTL|\
+INP_RECVIF|INP_RECVTTL|INP_RECVTOS|\
 IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\
 IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\
 IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Tue Jun 12 13:57:56 2012(r236958)
+++ head/sys/netinet/ip_input.c Tue Jun 12 14:02:38 2012(r236959)
@@ -1684,6 +1684,12 @@ makedummy:   
if (*mp)
mp = &(*mp)->m_next;
}
+   if (inp->inp_flags & INP_RECVTOS) {
+   *mp = sbcreatecontrol((caddr_t)

svn commit: r236958 - head/sys/netinet6

2012-06-12 Thread Michael Tuexen
Author: tuexen
Date: Tue Jun 12 13:57:56 2012
New Revision: 236958
URL: http://svn.freebsd.org/changeset/base/236958

Log:
  Deliver IPV6_TCLASS, IPV6_HOPLIMIT and IPV6_PKTINFO cmsgs (if
  requested) on IPV6 sockets, which have been marked to be not IPV6_V6ONLY,
  for each received IPV4 packet.
  
  MFC after: 3 days

Modified:
  head/sys/netinet6/ip6_input.c

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Tue Jun 12 13:31:32 2012
(r236957)
+++ head/sys/netinet6/ip6_input.c   Tue Jun 12 13:57:56 2012
(r236958)
@@ -1321,19 +1321,28 @@ ip6_savecontrol_v4(struct inpcb *inp, st
}
 #endif
 
-   if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
-   if (v4only != NULL)
-   *v4only = 1;
-   return (mp);
-   }
-
 #define IS2292(inp, x, y)  (((inp)->inp_flags & IN6P_RFC2292) ? (x) : (y))
/* RFC 2292 sec. 5 */
if ((inp->inp_flags & IN6P_PKTINFO) != 0) {
struct in6_pktinfo pi6;
 
-   bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr));
-   in6_clearscope(&pi6.ipi6_addr); /* XXX */
+   if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
+#ifdef INET
+   struct ip *ip;
+
+   ip = mtod(m, struct ip *);
+   pi6.ipi6_addr.s6_addr32[0] = 0;
+   pi6.ipi6_addr.s6_addr32[1] = 0;
+   pi6.ipi6_addr.s6_addr32[2] = IPV6_ADDR_INT32_SMP;
+   pi6.ipi6_addr.s6_addr32[3] = ip->ip_dst.s_addr;
+#else
+   /* We won't hit this code */
+   bzero(&pi6.ipi6_addr, sizeof(struct in6_addr));
+#endif
+   } else {
+   bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct 
in6_addr));
+   in6_clearscope(&pi6.ipi6_addr); /* XXX */
+   }
pi6.ipi6_ifindex =
(m && m->m_pkthdr.rcvif) ? m->m_pkthdr.rcvif->if_index : 0;
 
@@ -1345,8 +1354,21 @@ ip6_savecontrol_v4(struct inpcb *inp, st
}
 
if ((inp->inp_flags & IN6P_HOPLIMIT) != 0) {
-   int hlim = ip6->ip6_hlim & 0xff;
+   int hlim;
+
+   if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
+#ifdef INET
+   struct ip *ip;
 
+   ip = mtod(m, struct ip *);
+   hlim = ip->ip_ttl;
+#else
+   /* We won't hit this code */
+   hlim = 0;
+#endif
+   } else {
+   hlim = ip6->ip6_hlim & 0xff;
+   }
*mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int),
IS2292(inp, IPV6_2292HOPLIMIT, IPV6_HOPLIMIT),
IPPROTO_IPV6);
@@ -1354,8 +1376,40 @@ ip6_savecontrol_v4(struct inpcb *inp, st
mp = &(*mp)->m_next;
}
 
-   if (v4only != NULL)
-   *v4only = 0;
+   if ((inp->inp_flags & IN6P_TCLASS) != 0) {
+   int tclass;
+
+   if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
+#ifdef INET
+   struct ip *ip;
+
+   ip = mtod(m, struct ip *);
+   tclass = ip->ip_tos;
+#else
+   /* We won't hit this code */
+   tclass = 0;
+#endif
+   } else {
+   u_int32_t flowinfo;
+
+   flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & 
IPV6_FLOWINFO_MASK);
+   flowinfo >>= 20;
+   tclass = flowinfo & 0xff;
+   }
+   *mp = sbcreatecontrol((caddr_t) &tclass, sizeof(int),
+   IPV6_TCLASS, IPPROTO_IPV6);
+   if (*mp)
+   mp = &(*mp)->m_next;
+   }
+
+   if (v4only != NULL) {
+   if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
+   *v4only = 1;
+   } else {
+   *v4only = 0;
+   }
+   }
+
return (mp);
 }
 
@@ -1369,20 +1423,6 @@ ip6_savecontrol(struct inpcb *in6p, stru
if (v4only)
return;
 
-   if ((in6p->inp_flags & IN6P_TCLASS) != 0) {
-   u_int32_t flowinfo;
-   int tclass;
-
-   flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & IPV6_FLOWINFO_MASK);
-   flowinfo >>= 20;
-
-   tclass = flowinfo & 0xff;
-   *mp = sbcreatecontrol((caddr_t) &tclass, sizeof(tclass),
-   IPV6_TCLASS, IPPROTO_IPV6);
-   if (*mp)
-   mp = &(*mp)->m_next;
-   }
-
/*
 * IPV6_HOPOPTS socket option.  Recall that we required super-user
 * privilege for the option (see ip6_ctloutput), bu

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

2012-06-12 Thread Mateusz Guzik
On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote:
> On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote:
> > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which
> > still may not be enough to have place for new fd with high number.
> 
> I was under impression that fd_first_free() can return at most
> fdp->fd_nfiles, but indeed I missed this:
> 
>   if (low >= size)
>   return (low);
> 
> So fd_first_free() can return number biffer than size...
> 
> > This fixed the problem for me, although I'm not sure whether it's ok to
> > grow the table like this:
> > http://people.freebsd.org/~mjg/patches/fdalloc.patch
> 
> The patch looks good to me, could you please commit it, preferably after
> David's trying it and also update fd_first_free() comment, so it is
> clear that returned value can exceed 'size -1'?
> 

Given that you partially reverted r236935 I created a combined patch:
http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch

Is this ok?

Most changes are obiously yours, so I see no problem if you prefer to
commit this yourself.

Otherwise I plan to commit it with the following:
Re-apply reverted parts of r236935 by pjd with some fixes.

If fdalloc decides to grow fdtable it does it once and at most doubles
the size. This still may be not enough for sufficiently large fd. Use fd
in calculations of new size in order to fix this.

Fix description of fd_first_free to note that it returns passed fd if it
exceeds fdtable's size.

==

fd_last_used has very same problem with comment as fd_first_free. This
function is static and the only caller always passes 0 as low. Given
that, how about the following:
http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch

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


svn commit: r236957 - head/sys/net

2012-06-12 Thread Randall Stewart
Author: rrs
Date: Tue Jun 12 13:31:32 2012
New Revision: 236957
URL: http://svn.freebsd.org/changeset/base/236957

Log:
  Fix comment to better reflect how we are
  cheating and using the csum_data. Also fix
  style issues with the comments.

Modified:
  head/sys/net/if_gif.c

Modified: head/sys/net/if_gif.c
==
--- head/sys/net/if_gif.c   Tue Jun 12 13:15:27 2012(r236956)
+++ head/sys/net/if_gif.c   Tue Jun 12 13:31:32 2012(r236957)
@@ -385,8 +385,9 @@ keep_going:
m->m_pkthdr.len -= GIF_HDR_LEN6;
 #endif
 #endif
-   /* Now pull back the af in packet that
-* was saved in the address location.
+   /* 
+* Now pull back the af that we
+* stashed in the csum_data.
 */
af = m->m_pkthdr.csum_data;

@@ -504,9 +505,12 @@ gif_output(ifp, m, dst, ro)
dst->sa_family = af;
}
af = dst->sa_family;
-   /* Now save the af in the inbound pkt csum
-* data, this is a cheat since really
-* gif tunnels don't do offload.
+   /* 
+* Now save the af in the inbound pkt csum
+* data, this is a cheat since we are using
+* the inbound csum_data field to carry the
+* af over to the gif_start() routine, avoiding
+* using yet another mtag. 
 */
m->m_pkthdr.csum_data = af;
if (!(ifp->if_flags & IFF_UP) ||
@@ -516,7 +520,8 @@ gif_output(ifp, m, dst, ro)
goto end;
}
 #ifdef ALTQ
-   /* Make altq aware of the bytes we will add 
+   /*
+* Make altq aware of the bytes we will add 
 * when we actually send it.
 */
 #ifdef INET
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r236955 - head/sys/net

2012-06-12 Thread Randall Stewart
That actually will not effect things. Since the packet is
on the way out. If the csum_data field gets set on the way in
(not out)… so reusing it here I think is safe.

R
On Jun 12, 2012, at 8:53 AM, Bjoern A. Zeeb wrote:

> 
> On 12. Jun 2012, at 12:44 , Randall Stewart wrote:
> 
>> Author: rrs
>> Date: Tue Jun 12 12:44:17 2012
>> New Revision: 236955
>> URL: http://svn.freebsd.org/changeset/base/236955
>> 
>> Log:
>> Note to self. Have morning coffee *before* committing things.
>> There is no mac_addr in the mbuf for BSD.. cheat like
>> we are supposed to and use the csum field since our friend
>> the gif tunnel itself will never use offload.
> 
> There are cards that can do checksums for IPIP... with drivers in out tree.
> 
> 
>> 
>> Modified:
>> head/sys/net/if_gif.c
>> 
>> Modified: head/sys/net/if_gif.c
>> ==
>> --- head/sys/net/if_gif.cTue Jun 12 12:40:15 2012(r236954)
>> +++ head/sys/net/if_gif.cTue Jun 12 12:44:17 2012(r236955)
>> @@ -388,7 +388,8 @@ keep_going:
>>  /* Now pull back the af in packet that
>>   * was saved in the address location.
>>   */
>> -bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af));
>> +af = m->m_pkthdr.csum_data;
>> +
>>  if (ifp->if_bridge)
>>  af = AF_LINK;
>> 
>> @@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro)
>>  dst->sa_family = af;
>>  }
>>  af = dst->sa_family;
>> -/* Now save the af in the inbound pkt mac
>> - * address location.
>> +/* Now save the af in the inbound pkt csum
>> + * data, this is a cheat since really
>> + * gif tunnels don't do offload.
>>   */
>> -bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af));
>> +m->m_pkthdr.csum_data = af;
>>  if (!(ifp->if_flags & IFF_UP) ||
>>  sc->gif_psrc == NULL || sc->gif_pdst == NULL) {
>>  m_freem(m);
> 
> -- 
> Bjoern A. Zeeb You have to have visions!
>   It does not matter how good you are. It matters what good you do!
> 
> 

--
Randall Stewart
803-317-4952 (cell)

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


svn commit: r236956 - head/sys/netinet

2012-06-12 Thread Michael Tuexen
Author: tuexen
Date: Tue Jun 12 13:15:27 2012
New Revision: 236956
URL: http://svn.freebsd.org/changeset/base/236956

Log:
  Unify the sending of ABORT, SHUTDOWN-COMPLETE and ERROR chunks.
  While there: Fix also some minor bugs and prepare for SCTP/DTLS.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_output.h

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Tue Jun 12 12:44:17 2012
(r236955)
+++ head/sys/netinet/sctp_input.c   Tue Jun 12 13:15:27 2012
(r236956)
@@ -1442,7 +1442,7 @@ sctp_process_cookie_existing(struct mbuf
ph = mtod(op_err, struct sctp_paramhdr *);
ph->param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN);
ph->param_length = htons(sizeof(struct sctp_paramhdr));
-   sctp_send_operr_to(m, iphlen, op_err, cookie->peers_vtag,
+   sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err,
vrf_id, net->port);
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 2;
@@ -2570,7 +2570,7 @@ sctp_handle_cookie_echo(struct mbuf *m, 
if (tim == 0)
tim = now.tv_usec - cookie->time_entered.tv_usec;
scm->time_usec = htonl(tim);
-   sctp_send_operr_to(m, iphlen, op_err, cookie->peers_vtag,
+   sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err,
vrf_id, port);
return (NULL);
}

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Tue Jun 12 12:44:17 2012
(r236955)
+++ head/sys/netinet/sctp_output.c  Tue Jun 12 13:15:27 2012
(r236956)
@@ -4478,7 +4478,7 @@ sctp_lowlevel_chunk_output(struct sctp_i
 #if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
 #else
-   m->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
+   m->m_pkthdr.csum_flags = CSUM_SCTP;
m->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
 #endif
@@ -10854,19 +10854,20 @@ sctp_send_shutdown_complete(struct sctp_
return;
 }
 
-void
-sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh,
-uint32_t vrf_id, uint16_t port)
+static void
+sctp_send_resp_msg(struct mbuf *m, struct sctphdr *sh, uint32_t vtag,
+uint8_t type, struct mbuf *cause, uint32_t vrf_id, uint16_t port)
 {
-   /* formulate and SEND a SHUTDOWN-COMPLETE */
struct mbuf *o_pak;
struct mbuf *mout;
+   struct sctphdr *shout;
+   struct sctp_chunkhdr *ch;
struct ip *iph;
-   struct udphdr *udp = NULL;
-   int offset_out, len, mlen;
-   struct sctp_shutdown_complete_msg *comp_cp;
+   struct udphdr *udp;
+   int len, cause_len, padding_len, ret;
 
 #ifdef INET
+   sctp_route_t ro;
struct ip *iph_out;
 
 #endif
@@ -10875,31 +10876,59 @@ sctp_send_shutdown_complete2(struct mbuf
 
 #endif
 
+   /* Compute the length of the cause and add final padding. */
+   cause_len = 0;
+   if (cause != NULL) {
+   struct mbuf *m_at, *m_last = NULL;
+
+   for (m_at = cause; m_at; m_at = SCTP_BUF_NEXT(m_at)) {
+   if (SCTP_BUF_NEXT(m_at) == NULL)
+   m_last = m_at;
+   cause_len += SCTP_BUF_LEN(m_at);
+   }
+   padding_len = cause_len % 4;
+   if (padding_len != 0) {
+   padding_len = 4 - padding_len;
+   }
+   if (padding_len != 0) {
+   if (sctp_add_pad_tombuf(m_last, padding_len)) {
+   sctp_m_freem(cause);
+   return;
+   }
+   }
+   } else {
+   padding_len = 0;
+   }
+   /* Get an mbuf for the header. */
+   len = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr);
iph = mtod(m, struct ip *);
switch (iph->ip_v) {
 #ifdef INET
case IPVERSION:
-   len = (sizeof(struct ip) + sizeof(struct 
sctp_shutdown_complete_msg));
+   len += sizeof(struct ip);
break;
 #endif
 #ifdef INET6
case IPV6_VERSION >> 4:
-   len = (sizeof(struct ip6_hdr) + sizeof(struct 
sctp_shutdown_complete_msg));
+   len += sizeof(struct ip6_hdr);
break;
 #endif
default:
-   return;
+   break;
}
if (port) {
len += sizeof(struct udphdr);
}
mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWA

Re: svn commit: r236955 - head/sys/net

2012-06-12 Thread Bjoern A. Zeeb

On 12. Jun 2012, at 12:44 , Randall Stewart wrote:

> Author: rrs
> Date: Tue Jun 12 12:44:17 2012
> New Revision: 236955
> URL: http://svn.freebsd.org/changeset/base/236955
> 
> Log:
>  Note to self. Have morning coffee *before* committing things.
>  There is no mac_addr in the mbuf for BSD.. cheat like
>  we are supposed to and use the csum field since our friend
>  the gif tunnel itself will never use offload.

There are cards that can do checksums for IPIP... with drivers in out tree.


> 
> Modified:
>  head/sys/net/if_gif.c
> 
> Modified: head/sys/net/if_gif.c
> ==
> --- head/sys/net/if_gif.c Tue Jun 12 12:40:15 2012(r236954)
> +++ head/sys/net/if_gif.c Tue Jun 12 12:44:17 2012(r236955)
> @@ -388,7 +388,8 @@ keep_going:
>   /* Now pull back the af in packet that
>* was saved in the address location.
>*/
> - bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af));
> + af = m->m_pkthdr.csum_data;
> + 
>   if (ifp->if_bridge)
>   af = AF_LINK;
> 
> @@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro)
>   dst->sa_family = af;
>   }
>   af = dst->sa_family;
> - /* Now save the af in the inbound pkt mac
> -  * address location.
> + /* Now save the af in the inbound pkt csum
> +  * data, this is a cheat since really
> +  * gif tunnels don't do offload.
>*/
> - bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af));
> + m->m_pkthdr.csum_data = af;
>   if (!(ifp->if_flags & IFF_UP) ||
>   sc->gif_psrc == NULL || sc->gif_pdst == NULL) {
>   m_freem(m);

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

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


svn commit: r236955 - head/sys/net

2012-06-12 Thread Randall Stewart
Author: rrs
Date: Tue Jun 12 12:44:17 2012
New Revision: 236955
URL: http://svn.freebsd.org/changeset/base/236955

Log:
  Note to self. Have morning coffee *before* committing things.
  There is no mac_addr in the mbuf for BSD.. cheat like
  we are supposed to and use the csum field since our friend
  the gif tunnel itself will never use offload.

Modified:
  head/sys/net/if_gif.c

Modified: head/sys/net/if_gif.c
==
--- head/sys/net/if_gif.c   Tue Jun 12 12:40:15 2012(r236954)
+++ head/sys/net/if_gif.c   Tue Jun 12 12:44:17 2012(r236955)
@@ -388,7 +388,8 @@ keep_going:
/* Now pull back the af in packet that
 * was saved in the address location.
 */
-   bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af));
+   af = m->m_pkthdr.csum_data;
+   
if (ifp->if_bridge)
af = AF_LINK;
 
@@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro)
dst->sa_family = af;
}
af = dst->sa_family;
-   /* Now save the af in the inbound pkt mac
-* address location.
+   /* Now save the af in the inbound pkt csum
+* data, this is a cheat since really
+* gif tunnels don't do offload.
 */
-   bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af));
+   m->m_pkthdr.csum_data = af;
if (!(ifp->if_flags & IFF_UP) ||
sc->gif_psrc == NULL || sc->gif_pdst == NULL) {
m_freem(m);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236954 - head/sys/net

2012-06-12 Thread Randall Stewart
Author: rrs
Date: Tue Jun 12 12:40:15 2012
New Revision: 236954
URL: http://svn.freebsd.org/changeset/base/236954

Log:
  Opps forgot to commit the flag.

Modified:
  head/sys/net/if.h

Modified: head/sys/net/if.h
==
--- head/sys/net/if.h   Tue Jun 12 12:10:10 2012(r236953)
+++ head/sys/net/if.h   Tue Jun 12 12:40:15 2012(r236954)
@@ -153,7 +153,7 @@ struct if_data {
 #defineIFF_STATICARP   0x8 /* (n) static ARP */
 #defineIFF_DYING   0x20/* (n) interface is winding 
down */
 #defineIFF_RENAMING0x40/* (n) interface is being 
renamed */
-
+#define IFF_GIF_WANTED 0x100   /* (n) The gif tunnel is wanted */
 /*
  * Old names for driver flags so that user space tools can continue to use
  * the old (portable) names.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r236953 - head/sys/amd64/amd64 releng/7.4 releng/7.4/contrib/bind9/lib/dns releng/7.4/sys/amd64/amd64 releng/7.4/sys/conf releng/8.1 releng/8.1/contrib/bind9/lib/dns releng/8.1/sys/amd6...

2012-06-12 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Jun 12 12:10:10 2012
New Revision: 236953
URL: http://svn.freebsd.org/changeset/base/236953

Log:
  Fix a problem where zero-length RDATA fields can cause named(8) to crash.
  [12:03]
  
  Correct a privilege escalation when returning from kernel if
  running FreeBSD/amd64 on non-AMD processors. [12:04]
  
  Fix reference count errors in IPv6 code. [EN-12:02]
  
  Security: CVE-2012-1667
  Security: FreeBSD-SA-12:03.bind
  Security: CVE-2012-0217
  Security: FreeBSD-SA-12:04.sysret
  Security: FreeBSD-EN-12:02.ipv6refcount
  Approved by:  so (simon, bz)

Modified:
  head/sys/amd64/amd64/trap.c

Changes in other areas also in this revision:
Modified:
  releng/7.4/UPDATING
  releng/7.4/contrib/bind9/lib/dns/rdata.c
  releng/7.4/contrib/bind9/lib/dns/rdataslab.c
  releng/7.4/sys/amd64/amd64/trap.c
  releng/7.4/sys/conf/newvers.sh
  releng/8.1/UPDATING
  releng/8.1/contrib/bind9/lib/dns/rdata.c
  releng/8.1/contrib/bind9/lib/dns/rdataslab.c
  releng/8.1/sys/amd64/amd64/trap.c
  releng/8.1/sys/conf/newvers.sh
  releng/8.1/sys/netinet/tcp_input.c
  releng/8.1/sys/netinet6/in6.c
  releng/8.1/sys/netinet6/ip6_input.c
  releng/8.2/UPDATING
  releng/8.2/contrib/bind9/lib/dns/rdata.c
  releng/8.2/contrib/bind9/lib/dns/rdataslab.c
  releng/8.2/sys/amd64/amd64/trap.c
  releng/8.2/sys/conf/newvers.sh
  releng/8.2/sys/netinet/tcp_input.c
  releng/8.2/sys/netinet6/in6.c
  releng/8.2/sys/netinet6/ip6_input.c
  releng/8.3/UPDATING
  releng/8.3/contrib/bind9/lib/dns/rdata.c
  releng/8.3/contrib/bind9/lib/dns/rdataslab.c
  releng/8.3/sys/amd64/amd64/trap.c
  releng/8.3/sys/conf/newvers.sh
  releng/8.3/sys/netinet/tcp_input.c
  releng/8.3/sys/netinet6/in6.c
  releng/8.3/sys/netinet6/ip6_input.c
  releng/9.0/UPDATING
  releng/9.0/contrib/bind9/lib/dns/rdata.c
  releng/9.0/contrib/bind9/lib/dns/rdataslab.c
  releng/9.0/sys/amd64/amd64/trap.c
  releng/9.0/sys/conf/newvers.sh
  releng/9.0/sys/netinet/tcp_input.c
  releng/9.0/sys/netinet6/in6.c
  releng/9.0/sys/netinet6/ip6_input.c
  stable/7/contrib/bind9/lib/dns/rdata.c
  stable/7/contrib/bind9/lib/dns/rdataslab.c
  stable/7/sys/amd64/amd64/trap.c
  stable/8/sys/amd64/amd64/trap.c
  stable/9/sys/amd64/amd64/trap.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012(r236952)
+++ head/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012(r236953)
@@ -972,4 +972,21 @@ amd64_syscall(struct thread *td, int tra
 syscallname(td->td_proc, sa.code)));
 
syscallret(td, error, &sa);
+
+   /*
+* If the user-supplied value of %rip is not a canonical
+* address, then some CPUs will trigger a ring 0 #GP during
+* the sysret instruction.  However, the fault handler would
+* execute with the user's %gs and %rsp in ring 0 which would
+* not be safe.  Instead, preemptively kill the thread with a
+* SIGBUS.
+*/
+   if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) {
+   ksiginfo_init_trap(&ksi);
+   ksi.ksi_signo = SIGBUS;
+   ksi.ksi_code = BUS_OBJERR;
+   ksi.ksi_trapno = T_PROTFLT;
+   ksi.ksi_addr = (void *)td->td_frame->tf_rip;
+   trapsignal(td, &ksi);
+   }
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-06-12 Thread Pawel Jakub Dawidek
On Tue, Jun 12, 2012 at 12:53:47PM +1000, Bruce Evans wrote:
> On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote:
> > -KASSERT(fd >= 0 && fd < fdp->fd_nfiles,
> > +KASSERT((unsigned int)fd < fdp->fd_nfiles,
> > ("file descriptor %d out of range (0, %d)", fd, 
> > fdp->fd_nfiles));
> > return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0);
> > }
> 
> This is backwards.  Apart from using the worst possible (most verbose)
> spelling of `unsigned', it uses a type hack manually optimize away the
> test for fd being < 0.  The compiler will do this "optimization"
> automatically if it is any good (or undo it if it is not), so all the
> hack does is obfuscate the test.  With the verbose spelling of u_int,
> it even takes more space.

Well, to be honest I presonally would prefer explicit check for fd being
less than 0, but my impression was that using cast is the most popular
way and I wanted this check to be consistent across our source tree.

Feel free to change it.

BTW. I really dislike using 'unsigned' with omitted 'int'. u_int is fine.

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


pgpFmDxXIVhuE.pgp
Description: PGP signature


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

2012-06-12 Thread Pawel Jakub Dawidek
On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote:
> The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which
> still may not be enough to have place for new fd with high number.

I was under impression that fd_first_free() can return at most
fdp->fd_nfiles, but indeed I missed this:

if (low >= size)
return (low);

So fd_first_free() can return number biffer than size...

> This fixed the problem for me, although I'm not sure whether it's ok to
> grow the table like this:
> http://people.freebsd.org/~mjg/patches/fdalloc.patch

The patch looks good to me, could you please commit it, preferably after
David's trying it and also update fd_first_free() comment, so it is
clear that returned value can exceed 'size -1'?

David, can you try Mateusz's patch?

Thanks.

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


pgpCJqSIRyyap.pgp
Description: PGP signature


svn commit: r236952 - head/sys/dev/mvs

2012-06-12 Thread Alexander Motin
Author: mav
Date: Tue Jun 12 11:08:51 2012
New Revision: 236952
URL: http://svn.freebsd.org/changeset/base/236952

Log:
   - Limit r214102 workaround to only x86. On arm it causes more problems
  then solves because of cache coherency issues. This fixes periodic error
  messages on console and command timeouts.
   - Patch SATA PHY configuration for 65nm SoCs to improve SNR same as
  Linux does.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/mvs/mvs.c
  head/sys/dev/mvs/mvs.h
  head/sys/dev/mvs/mvs_soc.c

Modified: head/sys/dev/mvs/mvs.c
==
--- head/sys/dev/mvs/mvs.c  Tue Jun 12 10:44:09 2012(r236951)
+++ head/sys/dev/mvs/mvs.c  Tue Jun 12 11:08:51 2012(r236952)
@@ -1048,14 +1048,19 @@ mvs_crbq_intr(device_t dev)
 * Handle only successfull completions here.
 * Errors will be handled by main intr handler.
 */
+#if defined(__i386__) || defined(__amd64__)
if (crpb->id == 0x && crpb->rspflg == 0x) {
device_printf(dev, "Unfilled CRPB "
"%d (%d->%d) tag %d flags %04x rs %08x\n",
cin_idx, fin_idx, in_idx, slot, flags, ch->rslots);
-   } else if (ch->numtslots != 0 ||
+   } else
+#endif
+   if (ch->numtslots != 0 ||
(flags & EDMA_IE_EDEVERR) == 0) {
+#if defined(__i386__) || defined(__amd64__)
crpb->id = 0x;
crpb->rspflg = 0x;
+#endif
if (ch->slot[slot].state >= MVS_SLOT_RUNNING) {
ccb = ch->slot[slot].ccb;
ccb->ataio.res.status =
@@ -1999,6 +2004,39 @@ mvs_reset_to(void *arg)
 }
 
 static void
+mvs_errata(device_t dev)
+{
+   struct mvs_channel *ch = device_get_softc(dev);
+   uint32_t val;
+
+   if (ch->quirks & MVS_Q_SOC65) {
+   val = ATA_INL(ch->r_mem, SATA_PHYM3);
+   val &= ~(0x3 << 27);/* SELMUPF = 1 */
+   val |= (0x1 << 27);
+   val &= ~(0x3 << 29);/* SELMUPI = 1 */
+   val |= (0x1 << 29);
+   ATA_OUTL(ch->r_mem, SATA_PHYM3, val);
+
+   val = ATA_INL(ch->r_mem, SATA_PHYM4);
+   val &= ~0x1;/* SATU_OD8 = 0 */
+   val |= (0x1 << 16); /* reserved bit 16 = 1 */
+   ATA_OUTL(ch->r_mem, SATA_PHYM4, val);
+
+   val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN2);
+   val &= ~0xf;/* TXAMP[3:0] = 8 */
+   val |= 0x8;
+   val &= ~(0x1 << 14);/* TXAMP[4] = 0 */
+   ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN2, val);
+
+   val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN1);
+   val &= ~0xf;/* TXAMP[3:0] = 8 */
+   val |= 0x8;
+   val &= ~(0x1 << 14);/* TXAMP[4] = 0 */
+   ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN1, val);
+   }
+}
+
+static void
 mvs_reset(device_t dev)
 {
struct mvs_channel *ch = device_get_softc(dev);
@@ -2044,6 +2082,7 @@ mvs_reset(device_t dev)
ATA_OUTL(ch->r_mem, EDMA_CMD, EDMA_CMD_EATARST);
DELAY(25);
ATA_OUTL(ch->r_mem, EDMA_CMD, 0);
+   mvs_errata(dev);
/* Reset and reconnect PHY, */
if (!mvs_sata_phy_reset(dev)) {
if (bootverbose)

Modified: head/sys/dev/mvs/mvs.h
==
--- head/sys/dev/mvs/mvs.h  Tue Jun 12 10:44:09 2012(r236951)
+++ head/sys/dev/mvs/mvs.h  Tue Jun 12 11:08:51 2012(r236952)
@@ -382,6 +382,10 @@
 #define SATA_FISDW50x384   /* FIS DW5 */
 #define SATA_FISDW60x388   /* FIS DW6 */
 
+#define SATA_PHYM9_GEN20x398
+#define SATA_PHYM9_GEN10x39c
+#define SATA_PHYCFG_OFS0x3a0   /* 65nm SoCs only */
+
 #define MVS_MAX_PORTS  8
 #define MVS_MAX_SLOTS  32
 
@@ -537,6 +541,7 @@ struct mvs_channel {
 #define MVS_Q_GENIIE   4
 #define MVS_Q_SOC  8
 #define MVS_Q_CT   16
+#define MVS_Q_SOC6532
int pm_level;   /* power management level */
 
struct mvs_slot slot[MVS_MAX_SLOTS];

Modified: head/sys/dev/mvs/mvs_soc.c
==
--- head/sys/dev/mvs/mvs_soc.c  Tue Jun 12 10:44:09 2012(r236951)
+++ head/sys/dev/mvs/mvs_soc.c  Tue Jun 12 11:08:51 2012(r236952)
@@ -135,6 +135,8 @@ mvs_attach(device_t dev)
if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
&ctlr->r_rid, RF_ACTIVE)))
return ENXIO;
+   if (ATA_INL(ctlr->r_mem, PORT_BASE(0) + SATA_PHYCFG_OFS) != 0)
+   ctlr

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

2012-06-12 Thread Mateusz Guzik
On Tue, Jun 12, 2012 at 04:26:33PM +0800, David Xu wrote:
> On 2012/6/12 6:05, Pawel Jakub Dawidek wrote:
> >Author: pjd
> >Date: Mon Jun 11 22:05:26 2012
> >New Revision: 236935
> >URL: http://svn.freebsd.org/changeset/base/236935
> >
> >Log:
> >   fdgrowtable() no longer drops the filedesc lock so it is enough to
> >   retry finding free file descriptor only once after fdgrowtable().
> >
> >   Spotted by:   pluknet
> >   MFC after:1 month
> >
> >Modified:
> >   head/sys/kern/kern_descrip.c
> >
> >Modified: head/sys/kern/kern_descrip.c
> >==
> >--- head/sys/kern/kern_descrip.c Mon Jun 11 21:56:37 2012
> >(r236934)
> >+++ head/sys/kern/kern_descrip.c Mon Jun 11 22:05:26 2012
> >(r236935)
> >@@ -1478,29 +1478,33 @@ fdalloc(struct thread *td, int minfd, in
> > /*
> >  * Search the bitmap for a free descriptor.  If none is found, try
> >  * to grow the file table.  Keep at it until we either get a file
> >- * descriptor or run into process or system limits; fdgrowtable()
> >- * may drop the filedesc lock, so we're in a race.
> >+ * descriptor or run into process or system limits.
> >  */
> >-for (;;) {
> >-fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
> >-if (fd>= maxfd)
> >-return (EMFILE);
> >-if (fd<  fdp->fd_nfiles)
> >-break;
> >+fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
> >+if (fd>= maxfd)
> >+return (EMFILE);
> >+if (fd>= fdp->fd_nfiles) {
> >  #ifdef RACCT
> > PROC_LOCK(p);
> >-error = racct_set(p, RACCT_NOFILE, min(fdp->fd_nfiles * 2, 
> >maxfd));
> >+error = racct_set(p, RACCT_NOFILE,
> >+min(fdp->fd_nfiles * 2, maxfd));
> > PROC_UNLOCK(p);
> > if (error != 0)
> > return (EMFILE);
> >  #endif
> > fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd));
> >+/* Retry... */
> >+fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
> >+if (fd>= maxfd)
> >+return (EMFILE);
> > }
> >
> > /*
> >  * Perform some sanity checks, then mark the file descriptor as
> >  * used and return it to the caller.
> >  */
> >+KASSERT((unsigned int)fd<  min(maxfd, fdp->fd_nfiles),
> >+("invalid descriptor %d", fd));
> > KASSERT(!fdisused(fdp, fd),
> > ("fd_first_free() returned non-free descriptor"));
> > KASSERT(fdp->fd_ofiles[fd] == NULL, ("file descriptor isn't free"));
> >
> My machine crashed with this change.
> http://people.freebsd.org/~davidxu/fdcrash.jpg
> 
> 

The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which
still may not be enough to have place for new fd with high number.

This fixed the problem for me, although I'm not sure whether it's ok to
grow the table like this:
http://people.freebsd.org/~mjg/patches/fdalloc.patch

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


svn commit: r236951 - head/sys/net

2012-06-12 Thread Randall Stewart
Author: rrs
Date: Tue Jun 12 10:44:09 2012
New Revision: 236951
URL: http://svn.freebsd.org/changeset/base/236951

Log:
  Allow a gif tunnel to be used with ALTq.
  
  Reviewed by:  gnn

Modified:
  head/sys/net/if_gif.c

Modified: head/sys/net/if_gif.c
==
--- head/sys/net/if_gif.c   Tue Jun 12 10:25:11 2012(r236950)
+++ head/sys/net/if_gif.c   Tue Jun 12 10:44:09 2012(r236951)
@@ -342,26 +342,98 @@ gif_encapcheck(m, off, proto, arg)
return 0;
}
 }
+#ifdef INET
+#define GIF_HDR_LEN (ETHER_HDR_LEN + sizeof (struct ip))
+#endif
+#ifdef INET6
+#define GIF_HDR_LEN6 (ETHER_HDR_LEN + sizeof (struct ip6_hdr))
+#endif
 
 static void
 gif_start(struct ifnet *ifp)
 {
struct gif_softc *sc;
struct mbuf *m;
+   uint32_t af;
+   int error = 0;
 
sc = ifp->if_softc;
-
+   GIF_LOCK(sc);
+   if (ifp->if_drv_flags & IFF_DRV_OACTIVE) {
+   /* Already active */
+   ifp->if_drv_flags |= IFF_GIF_WANTED;
+   GIF_UNLOCK(sc);
+   return;
+   }
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-   for (;;) {
-   IFQ_DEQUEUE(&ifp->if_snd, m);
+   GIF_UNLOCK(sc);
+keep_going:
+   while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
+
+   IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
if (m == 0)
break;
 
-   gif_output(ifp, m, sc->gif_pdst, NULL);
+#ifdef ALTQ
+   /* Take out those altq bytes we add in gif_output  */
+#ifdef INET
+   if (sc->gif_psrc->sa_family == AF_INET) 
+   m->m_pkthdr.len -= GIF_HDR_LEN;
+#endif
+#ifdef INET6
+   if (sc->gif_psrc->sa_family == AF_INET6) 
+   m->m_pkthdr.len -= GIF_HDR_LEN6;
+#endif
+#endif
+   /* Now pull back the af in packet that
+* was saved in the address location.
+*/
+   bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af));
+   if (ifp->if_bridge)
+   af = AF_LINK;
+
+   BPF_MTAP2(ifp, &af, sizeof(af), m);
+   ifp->if_opackets++; 
+
+/*  Done by IFQ_HANDOFF */
+/* ifp->if_obytes += m->m_pkthdr.len;*/
+   /* override to IPPROTO_ETHERIP for bridged traffic */
+
+   M_SETFIB(m, sc->gif_fibnum);
+   /* inner AF-specific encapsulation */
+   /* XXX should we check if our outer source is legal? */
+   /* dispatch to output logic based on outer AF */
+   switch (sc->gif_psrc->sa_family) {
+#ifdef INET
+   case AF_INET:
+   error = in_gif_output(ifp, af, m);
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   error = in6_gif_output(ifp, af, m);
+   break;
+#endif
+   default:
+   m_freem(m); 
+   error = ENETDOWN;
+   }
+   if (error)
+   ifp->if_oerrors++;
 
}
+   GIF_LOCK(sc);
+   if (ifp->if_drv_flags & IFF_GIF_WANTED) {
+   /* Someone did a start while
+* we were unlocked and processing
+* lets clear the flag and try again.
+*/
+   ifp->if_drv_flags &= ~IFF_GIF_WANTED;
+   GIF_UNLOCK(sc);
+   goto keep_going;
+   }
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-
+   GIF_UNLOCK(sc);
return;
 }
 
@@ -376,8 +448,7 @@ gif_output(ifp, m, dst, ro)
struct m_tag *mtag;
int error = 0;
int gif_called;
-   u_int32_t af;
-
+   uint32_t af;
 #ifdef MAC
error = mac_ifnet_check_transmit(ifp, m);
if (error) {
@@ -426,55 +497,40 @@ gif_output(ifp, m, dst, ro)
m_tag_prepend(m, mtag);
 
m->m_flags &= ~(M_BCAST|M_MCAST);
-
-   GIF_LOCK(sc);
-
-   if (!(ifp->if_flags & IFF_UP) ||
-   sc->gif_psrc == NULL || sc->gif_pdst == NULL) {
-   GIF_UNLOCK(sc);
-   m_freem(m);
-   error = ENETDOWN;
-   goto end;
-   }
-
/* BPF writes need to be handled specially. */
if (dst->sa_family == AF_UNSPEC) {
bcopy(dst->sa_data, &af, sizeof(af));
dst->sa_family = af;
}
-
af = dst->sa_family;
-   BPF_MTAP2(ifp, &af, sizeof(af), m);
-   ifp->if_opackets++; 
-   ifp->if_obytes += m->m_pkthdr.len;
-
-   /* override to IPPROTO_ETHERIP for bridged traffic */
-   if (ifp->if_bridge)
-   af = AF_LINK;
-
-   M_SETFIB(m, sc->gif_fibnum);
-   /* inner AF-specific encapsulation */
-
-   /* XXX should we check if our outer source is legal? */
-
-   /* dispatch to output logic based on outer AF */
-   switch (sc->gif

svn commit: r236950 - head/sys/kern

2012-06-12 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Jun 12 10:25:11 2012
New Revision: 236950
URL: http://svn.freebsd.org/changeset/base/236950

Log:
  Revert part of the r236935 for now, until I figure out why it doesn't
  work properly.
  
  Reported by:  davidxu

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cTue Jun 12 09:18:28 2012
(r236949)
+++ head/sys/kern/kern_descrip.cTue Jun 12 10:25:11 2012
(r236950)
@@ -1480,10 +1480,12 @@ fdalloc(struct thread *td, int minfd, in
 * to grow the file table.  Keep at it until we either get a file
 * descriptor or run into process or system limits.
 */
-   fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
-   if (fd >= maxfd)
-   return (EMFILE);
-   if (fd >= fdp->fd_nfiles) {
+   for (;;) {
+   fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
+   if (fd >= maxfd)
+   return (EMFILE);
+   if (fd < fdp->fd_nfiles)
+   break;
 #ifdef RACCT
PROC_LOCK(p);
error = racct_set(p, RACCT_NOFILE,
@@ -1493,10 +1495,6 @@ fdalloc(struct thread *td, int minfd, in
return (EMFILE);
 #endif
fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd));
-   /* Retry... */
-   fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
-   if (fd >= maxfd)
-   return (EMFILE);
}
 
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r236909 - head/sbin/hastd

2012-06-12 Thread Bruce Evans

On Tue, 12 Jun 2012, Hans Petter Selasky wrote:


On Tuesday 12 June 2012 05:49:33 Bruce Evans wrote:

On Mon, 11 Jun 2012, Hans Petter Selasky wrote:

On Monday 11 June 2012 22:21:51 Hans Petter Selasky wrote:

On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote:

On Mon, Jun 11, 2012 at 07:21:00PM +, Hans Petter Selasky wrote:

Author: hselasky
Date: Mon Jun 11 19:20:59 2012
New Revision: 236909
URL: http://svn.freebsd.org/changeset/base/236909



The point is in 2038, on systems with 32-bit signed time_t's.  None
should exist then.  Even if time_t is 32 bits, it can be unsigned, and
never become negative, and work until 2106.  Changing time_t from
signed to unsigned would break mainly times before the Epoch, which
are invalid for current times anyway, and expose broken code which
assumes that time_t is signed.


Lets assume you need to reboot the system at some point and that solves the
problem.


Yes, that solves it for >= 86 years after rebooting, provided the clock id
is CLOCK_MONOTONIC and the time that this clock is relative to is the
boot time.


functionality stop working then, because pthread_cond_timedwait() has a
check for negative time?


This check is just to prevent invalid times.  It does prevents hacks like
the kernel treating negative times as large unsigned ones so that the
result is much the same as changing time_t to unsigned, without actually
changing time_t.


Or is hastd wrong, that it can compute a timeout offset which is outside
the valid range, because it uses a simple:

tv_sec += timeout?
tv_sec %= 10; /* Is this perhaps missing in hastd and other
drivers  */

What is the modulus which should be used for tv_sec?


`tv_sec %= ANY' makes no sense.

With CLOCK_MONOTONIC, signed 32-bit time_t's work for 86 years after the
unspecified point in the past that CLOCK_MONOTONIC is relative to.  This
should be enough for anyone, provided the unspecified point is the boot
time.  hastd also uses mostly-relative, mostly-monotonic, often 32-bit
signed in timeouts internally.  E.g., in the function that seems to be
causing problems:


When CLOCK_REALTIME finally goes negative, then pthread_cond_timedwait() will
simply return an error code, due to the negative tv_sec check in there! I see
other clients like sendmail, using even simpler formats like:


Are you going to wait around for 86 years after rebooting for that? :-).


tv_nsec = 0;
tv_sec = time(NULL);

If this piece of code stops working at a given data, regardless of uptime,
shouldn't that be fixed now?


Only if you urgently need current systems 32-bit signed time_t, which are
rebooted tomorrow with this fix, to not need another reboot for 86 years.

Actually `tv_sec = time(NULL);' will overflow on only 26 years on such
systems, but time() use not usable together with CLOCK_MONOTONIC.  32-bit
signed time_t's are a more general problem.


...
A final question on the matter:

I tried to use CLOCK_MONOTONIC_FAST when setting up the condition variable.
That did not appear to be support in 9-stable. Is there a list of supported
clocks anywhere?


Don't know, but the list in clock_gettime(2) for -current seems to have
them all except CLOCK_THREAD_CPUTIME_ID.  That one is also badly named:
- verbosely named
- has an _ID suffix, unlike all the others
Since it is like CLOCK_PROF (the differences are that it is for threads
instead of processes, and interrupt times are broken in a different way
for it), it should be named more like CLOCK_PROF.

Of course the kernel source code has the correct list.

Most of these clock ids are only supported by clock_gettime() and
clock_getres().  Most of them arent't writeable, so clock_settime()
doesn't apply to them.  clock_settime(2) is identical with
clock_gettime(2), and doesn't say anything about which clocks are
read-only -- you have to try to set them to see which, or you can
read the POSIX spec to see that CLOCK_MONOTONIC must be read-only.
clock_settime(2) also fails to document the (bad) errno for failure
with CLOCK_MONOTONIC.  It only says "the following error codes _may_
be set", with EINVAL meaning that the clock id was invalid.  But in
POSIX, EINVAL for just clock_settime() is grossly overloaded; it means
any of:
- clock_id for unknown clock (this applies to all the functions; the
  rest are for clock_settime())
- the tp arg (sic; should be the value pointed to be the tp arg) is
  out of bounds for the specified clock_id
- the tp arg (sic) has an out of bounds nanosecond value
- the clock_id arg is CLOCK_MONOTONIC.

I don't like the explosion of clock ids in FreeBSD, and support for them
outside of clock_gettime() and clock_getres() seems to be nonexistent.
In man pages for POSIX realtime timers, only the standard CLOCK_REALTIME
and CLOCK_MONOTONIC are documented, and the code seems to agree.  FreeBSD
aliases like CLOCK_REALTIME_PRECISE will work because they are just
spelling errors.  FreeBSD extensions like CLOCK_REALTIME_FAST won't
work for timers, but timers are already 

svn commit: r236949 - head/sys/netinet

2012-06-12 Thread Michael Tuexen
Author: tuexen
Date: Tue Jun 12 09:18:28 2012
New Revision: 236949
URL: http://svn.freebsd.org/changeset/base/236949

Log:
  Small cleanup.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Tue Jun 12 08:10:14 2012(r236948)
+++ head/sys/netinet/sctputil.c Tue Jun 12 09:18:28 2012(r236949)
@@ -2573,15 +2573,13 @@ sctp_pad_lastmbuf(struct mbuf *m, int pa
/* find the last mbuf in chain and pad it */
struct mbuf *m_at;
 
-   m_at = m;
if (last_mbuf) {
return (sctp_add_pad_tombuf(last_mbuf, padval));
} else {
-   while (m_at) {
+   for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) {
if (SCTP_BUF_NEXT(m_at) == NULL) {
return (sctp_add_pad_tombuf(m_at, padval));
}
-   m_at = SCTP_BUF_NEXT(m_at);
}
}
SCTP_LTRACE_ERR_RET_PKT(m, NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, 
EFAULT);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-06-12 Thread David Xu

On 2012/6/12 6:05, Pawel Jakub Dawidek wrote:

Author: pjd
Date: Mon Jun 11 22:05:26 2012
New Revision: 236935
URL: http://svn.freebsd.org/changeset/base/236935

Log:
   fdgrowtable() no longer drops the filedesc lock so it is enough to
   retry finding free file descriptor only once after fdgrowtable().

   Spotted by:  pluknet
   MFC after:   1 month

Modified:
   head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cMon Jun 11 21:56:37 2012
(r236934)
+++ head/sys/kern/kern_descrip.cMon Jun 11 22:05:26 2012
(r236935)
@@ -1478,29 +1478,33 @@ fdalloc(struct thread *td, int minfd, in
/*
 * Search the bitmap for a free descriptor.  If none is found, try
 * to grow the file table.  Keep at it until we either get a file
-* descriptor or run into process or system limits; fdgrowtable()
-* may drop the filedesc lock, so we're in a race.
+* descriptor or run into process or system limits.
 */
-   for (;;) {
-   fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
-   if (fd>= maxfd)
-   return (EMFILE);
-   if (fd<  fdp->fd_nfiles)
-   break;
+   fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
+   if (fd>= maxfd)
+   return (EMFILE);
+   if (fd>= fdp->fd_nfiles) {
  #ifdef RACCT
PROC_LOCK(p);
-   error = racct_set(p, RACCT_NOFILE, min(fdp->fd_nfiles * 2, 
maxfd));
+   error = racct_set(p, RACCT_NOFILE,
+   min(fdp->fd_nfiles * 2, maxfd));
PROC_UNLOCK(p);
if (error != 0)
return (EMFILE);
  #endif
fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd));
+   /* Retry... */
+   fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
+   if (fd>= maxfd)
+   return (EMFILE);
}

/*
 * Perform some sanity checks, then mark the file descriptor as
 * used and return it to the caller.
 */
+   KASSERT((unsigned int)fd<  min(maxfd, fdp->fd_nfiles),
+   ("invalid descriptor %d", fd));
KASSERT(!fdisused(fdp, fd),
("fd_first_free() returned non-free descriptor"));
KASSERT(fdp->fd_ofiles[fd] == NULL, ("file descriptor isn't free"));


My machine crashed with this change.
http://people.freebsd.org/~davidxu/fdcrash.jpg


Regards,


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


Re: svn commit: r236909 - head/sbin/hastd

2012-06-12 Thread Hans Petter Selasky
On Tuesday 12 June 2012 05:49:33 Bruce Evans wrote:
> On Mon, 11 Jun 2012, Hans Petter Selasky wrote:
> > On Monday 11 June 2012 22:21:51 Hans Petter Selasky wrote:
> >> On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote:
> >>> On Mon, Jun 11, 2012 at 07:21:00PM +, Hans Petter Selasky wrote:
>  Author: hselasky
>  Date: Mon Jun 11 19:20:59 2012
>  New Revision: 236909
>  URL: http://svn.freebsd.org/changeset/base/236909
>  
> 

Hi,

> The point is in 2038, on systems with 32-bit signed time_t's.  None
> should exist then.  Even if time_t is 32 bits, it can be unsigned, and
> never become negative, and work until 2106.  Changing time_t from
> signed to unsigned would break mainly times before the Epoch, which
> are invalid for current times anyway, and expose broken code which
> assumes that time_t is signed.

Lets assume you need to reboot the system at some point and that solves the 
problem.

> 
> > functionality stop working then, because pthread_cond_timedwait() has a
> > check for negative time?
> 
> This check is just to prevent invalid times.  It does prevents hacks like
> the kernel treating negative times as large unsigned ones so that the
> result is much the same as changing time_t to unsigned, without actually
> changing time_t.
> 
> > Or is hastd wrong, that it can compute a timeout offset which is outside
> > the valid range, because it uses a simple:
> > 
> > tv_sec += timeout?
> > tv_sec %= 10; /* Is this perhaps missing in hastd and other
> > drivers  */
> > 
> > What is the modulus which should be used for tv_sec?
> 
> `tv_sec %= ANY' makes no sense.
> 
> With CLOCK_MONOTONIC, signed 32-bit time_t's work for 86 years after the
> unspecified point in the past that CLOCK_MONOTONIC is relative to.  This
> should be enough for anyone, provided the unspecified point is the boot
> time.  hastd also uses mostly-relative, mostly-monotonic, often 32-bit
> signed in timeouts internally.  E.g., in the function that seems to be
> causing problems:
> 

When CLOCK_REALTIME finally goes negative, then pthread_cond_timedwait() will 
simply return an error code, due to the negative tv_sec check in there! I see 
other clients like sendmail, using even simpler formats like:

tv_nsec = 0;
tv_sec = time(NULL);

If this piece of code stops working at a given data, regardless of uptime, 
shouldn't that be fixed now?

> % static __inline bool
> % cv_timedwait(pthread_cond_t *cv, pthread_mutex_t *lock, int timeout)
> % {
> % struct timespec ts;
> % int error;
> %
> % if (timeout == 0) {
> % cv_wait(cv, lock);
> % return (false);
> % }
> %
> % error = clock_gettime(CLOCK_MONOTONIC, &ts);
> 
> Style bug (corrupt tab in Oct 22 2011 version).

I think I fixed this style bug when reverting.

> 
> % PJDLOG_ASSERT(error == 0);
> % ts.tv_sec += timeout;
> 
> This converts to absolute monotonic time.  Even a 16-bit signed int is
> probably enough for `timeout'.
> 
> % error = pthread_cond_timedwait(cv, lock, &ts);
> % PJDLOG_ASSERT(error == 0 || error == ETIMEDOUT);
> % return (error == ETIMEDOUT);
> % }
> 
> I don't see any bugs here.

Thanks for feedback Bruce.

A final question on the matter:

I tried to use CLOCK_MONOTONIC_FAST when setting up the condition variable. 
That did not appear to be support in 9-stable. Is there a list of supported 
clocks anywhere?

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


svn commit: r236944 - head/lib/libusb

2012-06-12 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun 12 07:28:25 2012
New Revision: 236944
URL: http://svn.freebsd.org/changeset/base/236944

Log:
  LibUSB v1.0 API compiliance and bugfixes.
  
  - Use CLOCK_MONOTONIC instead of CLOCK_REALTIME, because CLOCK_MONOTONIC
  does not wrap into negative in near future. This fixes any potential
  problems using "pthread_cond_timedwait()".
  
  - Fix a bug where the "libusb_wait_for_event()" function computes an
  absolute timeout instead of a relative timeout. USB transfers do
  not depend on this timeout value.
  
  - Add dependency towards LibPthread to Makefile, because LibUSB v1.0
  needs this library to function correctly.
  
  MFC after:1 week

Modified:
  head/lib/libusb/Makefile
  head/lib/libusb/libusb10.c
  head/lib/libusb/libusb10_io.c

Modified: head/lib/libusb/Makefile
==
--- head/lib/libusb/MakefileTue Jun 12 04:58:52 2012(r236943)
+++ head/lib/libusb/MakefileTue Jun 12 07:28:25 2012(r236944)
@@ -18,6 +18,9 @@ NOGCCERROR=
 
 WARNS?=2
 
+DPADD= ${LIBPTHREAD}
+LDADD= -lpthread
+
 MLINKS+=   libusb.3 usb.3
 
 # libusb 0.1 compat

Modified: head/lib/libusb/libusb10.c
==
--- head/lib/libusb/libusb10.c  Tue Jun 12 04:58:52 2012(r236943)
+++ head/lib/libusb/libusb10.c  Tue Jun 12 07:28:25 2012(r236944)
@@ -92,6 +92,7 @@ int
 libusb_init(libusb_context **context)
 {
struct libusb_context *ctx;
+   pthread_condattr_t attr;
char *debug;
int ret;
 
@@ -110,8 +111,28 @@ libusb_init(libusb_context **context)
TAILQ_INIT(&ctx->pollfds);
TAILQ_INIT(&ctx->tr_done);
 
-   pthread_mutex_init(&ctx->ctx_lock, NULL);
-   pthread_cond_init(&ctx->ctx_cond, NULL);
+   if (pthread_mutex_init(&ctx->ctx_lock, NULL) != 0) {
+   free(ctx);
+   return (LIBUSB_ERROR_NO_MEM);
+   }
+   if (pthread_condattr_init(&attr) != 0) {
+   pthread_mutex_destroy(&ctx->ctx_lock);
+   free(ctx);
+   return (LIBUSB_ERROR_NO_MEM);
+   }
+   if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0) {
+   pthread_mutex_destroy(&ctx->ctx_lock);
+   pthread_condattr_destroy(&attr);
+   free(ctx);
+   return (LIBUSB_ERROR_OTHER);
+   }
+   if (pthread_cond_init(&ctx->ctx_cond, &attr) != 0) {
+   pthread_mutex_destroy(&ctx->ctx_lock);
+   pthread_condattr_destroy(&attr);
+   free(ctx);
+   return (LIBUSB_ERROR_NO_MEM);
+   }
+   pthread_condattr_destroy(&attr);
 
ctx->ctx_handler = NO_THREAD;
 

Modified: head/lib/libusb/libusb10_io.c
==
--- head/lib/libusb/libusb10_io.c   Tue Jun 12 04:58:52 2012
(r236943)
+++ head/lib/libusb/libusb10_io.c   Tue Jun 12 07:28:25 2012
(r236944)
@@ -307,12 +307,16 @@ libusb_wait_for_event(libusb_context *ct
&ctx->ctx_lock);
return (0);
}
-   err = clock_gettime(CLOCK_REALTIME, &ts);
+   err = clock_gettime(CLOCK_MONOTONIC, &ts);
if (err < 0)
return (LIBUSB_ERROR_OTHER);
 
-   ts.tv_sec = tv->tv_sec;
-   ts.tv_nsec = tv->tv_usec * 1000;
+   /*
+* The "tv" arguments points to a relative time structure and
+* not an absolute time structure.
+*/
+   ts.tv_sec += tv->tv_sec;
+   ts.tv_nsec += tv->tv_usec * 1000;
if (ts.tv_nsec >= 10) {
ts.tv_nsec -= 10;
ts.tv_sec++;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"