svn commit: r283002 - in head/tools/tools: ath/athaggrstats ath/athstats mwl/mwlstats net80211/wlanstats npe/npestats

2015-05-15 Thread Adrian Chadd
Author: adrian
Date: Sat May 16 06:18:39 2015
New Revision: 283002
URL: https://svnweb.freebsd.org/changeset/base/283002

Log:
  Make these all work with the new way of doing privatelib.
  
  Without these CFLAGS settings a cross-compile won't find the headers
  anywhere.
  
  Tested:
  
  * mips (32, big endian) cross-build w/ LOCAL_DIRS including these
tools.

Modified:
  head/tools/tools/ath/athaggrstats/Makefile
  head/tools/tools/ath/athstats/Makefile
  head/tools/tools/mwl/mwlstats/Makefile
  head/tools/tools/net80211/wlanstats/Makefile
  head/tools/tools/npe/npestats/Makefile

Modified: head/tools/tools/ath/athaggrstats/Makefile
==
--- head/tools/tools/ath/athaggrstats/Makefile  Sat May 16 06:15:49 2015
(r283001)
+++ head/tools/tools/ath/athaggrstats/Makefile  Sat May 16 06:18:39 2015
(r283002)
@@ -12,6 +12,7 @@ CLEANFILES+=  opt_ah.h
 
 CFLAGS+=-DATH_SUPPORT_ANI
 CFLAGS+=-DATH_SUPPORT_TDMA
+CFLAGS+=-I${.CURDIR}/../../../../lib/libbsdstat/
 LIBADD+=   bsdstat
 
 opt_ah.h:

Modified: head/tools/tools/ath/athstats/Makefile
==
--- head/tools/tools/ath/athstats/Makefile  Sat May 16 06:15:49 2015
(r283001)
+++ head/tools/tools/ath/athstats/Makefile  Sat May 16 06:18:39 2015
(r283002)
@@ -8,10 +8,6 @@ MAN=
 
 PROG=  athstats
 
-# Because of a clang preprocessor parser limitation causing this
-# to not compile, use gcc for now.
-#CC=   gcc
-
 SRCS=  main.c athstats.c opt_ah.h ah_osdep.h
 
 CLEANFILES+=   opt_ah.h
@@ -21,6 +17,8 @@ CLEANFILES+=  opt_ah.h
 CFLAGS+=-DATH_SUPPORT_ANI
 CFLAGS+=-DATH_SUPPORT_TDMA
 
+CFLAGS+=-I${.CURDIR}/../../../../lib/libbsdstat/
+
 CFLAGS.clang+= -fbracket-depth=512
 
 LIBADD=bsdstat

Modified: head/tools/tools/mwl/mwlstats/Makefile
==
--- head/tools/tools/mwl/mwlstats/Makefile  Sat May 16 06:15:49 2015
(r283001)
+++ head/tools/tools/mwl/mwlstats/Makefile  Sat May 16 06:18:39 2015
(r283002)
@@ -6,6 +6,7 @@ MAN=
 
 SRCS=  main.c mwlstats.c
 LIBADD=bsdstat
+CFLAGS+=-I${.CURDIR}/../../../../lib/libbsdstat/
 
 .include 
 

Modified: head/tools/tools/net80211/wlanstats/Makefile
==
--- head/tools/tools/net80211/wlanstats/MakefileSat May 16 06:15:49 
2015(r283001)
+++ head/tools/tools/net80211/wlanstats/MakefileSat May 16 06:18:39 
2015(r283002)
@@ -6,6 +6,7 @@ PROG=   wlanstats
 BINDIR=/usr/local/bin
 MAN=
 LIBADD=bsdstat
+CFLAGS+=-I${.CURDIR}/../../../../lib/libbsdstat/
 
 SRCS=  wlanstats.c main.c
 

Modified: head/tools/tools/npe/npestats/Makefile
==
--- head/tools/tools/npe/npestats/Makefile  Sat May 16 06:15:49 2015
(r283001)
+++ head/tools/tools/npe/npestats/Makefile  Sat May 16 06:18:39 2015
(r283002)
@@ -5,5 +5,6 @@ SRCS=   main.c npestats.c
 BINDIR=/usr/local/bin
 MAN=
 LIBADD=bsdstat
+CFLAGS+=-I${.CURDIR}/../../../../lib/libbsdstat/
 
 .include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r283001 - head/usr.bin/ssh-copy-id

2015-05-15 Thread Eitan Adler
Author: eadler
Date: Sat May 16 06:15:49 2015
New Revision: 283001
URL: https://svnweb.freebsd.org/changeset/base/283001

Log:
  ssh-copy-id: Add missing line continuation
  
  PR:   194301
  Reported by:  pku...@riseup.net
  Patch by: Ross Kilgariff 

Modified:
  head/usr.bin/ssh-copy-id/ssh-copy-id.sh

Modified: head/usr.bin/ssh-copy-id/ssh-copy-id.sh
==
--- head/usr.bin/ssh-copy-id/ssh-copy-id.sh Sat May 16 06:04:53 2015
(r283000)
+++ head/usr.bin/ssh-copy-id/ssh-copy-id.sh Sat May 16 06:15:49 2015
(r283001)
@@ -48,7 +48,7 @@ sendkey() {
done ; \
if [ -x /sbin/restorecon ]; then \
/sbin/restorecon -F "$HOME/.ssh/" "$keyfile" >/dev/null 
2>&1 || true ; \
-   fi
+   fi \
'\' 
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r283000 - head/sys/dev/sfxge

2015-05-15 Thread Andrew Rybchenko
Author: arybchik
Date: Sat May 16 06:04:53 2015
New Revision: 283000
URL: https://svnweb.freebsd.org/changeset/base/283000

Log:
  sfxge: add local variable with changed capabilities mask
  
  It is required for the next patch which adds dependency of TSO
  capabilities from Tx checksum offloads.
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision: https://reviews.freebsd.org/D2553

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

Modified: head/sys/dev/sfxge/sfxge.c
==
--- head/sys/dev/sfxge/sfxge.c  Sat May 16 05:59:25 2015(r282999)
+++ head/sys/dev/sfxge/sfxge.c  Sat May 16 06:04:53 2015(r283000)
@@ -258,26 +258,36 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign
sfxge_mac_filter_set(sc);
break;
case SIOCSIFCAP:
+   {
+   int reqcap = ifr->ifr_reqcap;
+   int capchg_mask;
+
SFXGE_ADAPTER_LOCK(sc);
 
+   /* Capabilities to be changed in accordance with request */
+   capchg_mask = ifp->if_capenable ^ reqcap;
+
/*
 * The networking core already rejects attempts to
 * enable capabilities we don't have.  We still have
 * to reject attempts to disable capabilities that we
 * can't (yet) disable.
 */
-   if (~ifr->ifr_reqcap & SFXGE_CAP_FIXED) {
+   KASSERT((reqcap & ~ifp->if_capabilities) == 0,
+   ("Unsupported capabilities %x requested %x vs %x",
+reqcap & ~ifp->if_capabilities,
+reqcap , ifp->if_capabilities));
+   if (capchg_mask & SFXGE_CAP_FIXED) {
error = EINVAL;
SFXGE_ADAPTER_UNLOCK(sc);
break;
}
 
-   ifp->if_capenable = ifr->ifr_reqcap;
-   if (ifp->if_capenable & IFCAP_TXCSUM)
+   if (reqcap & IFCAP_TXCSUM)
ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP);
else
ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP);
-   if (ifp->if_capenable & IFCAP_TXCSUM_IPV6)
+   if (reqcap & IFCAP_TXCSUM_IPV6)
ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
else
ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
@@ -290,8 +300,11 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign
 * but both bits are set in IPv4 and IPv6 mbufs.
 */
 
+   ifp->if_capenable = reqcap;
+
SFXGE_ADAPTER_UNLOCK(sc);
break;
+   }
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
error = ifmedia_ioctl(ifp, ifr, &sc->media, command);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282999 - head/sys/dev/iwn

2015-05-15 Thread Adrian Chadd
Author: adrian
Date: Sat May 16 05:59:25 2015
New Revision: 282999
URL: https://svnweb.freebsd.org/changeset/base/282999

Log:
  Various iwn(4) fixes.
  
  * simplify channel logic for determining RF gain setting in scan setup
  * don't set TX timer on error
  * free node references for unsent frames on device stop
  * set maxfrags to IWN_MAX_SCATTER-1 (first segment is used by TX command)
  * add missing IWN_UNLOCK() from interrupt path when the hardware
disappears.
  * pass control frames to host
  * nitems() instead of local macro
  
  Tested:
  
  * Intel 5100, STA mode
  
  PR:   kern/196264
  Submitted by: Andriy Voskoboinyk 

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sat May 16 05:43:20 2015(r282998)
+++ head/sys/dev/iwn/if_iwn.c   Sat May 16 05:59:25 2015(r282999)
@@ -1875,7 +1875,7 @@ iwn_alloc_rx_ring(struct iwn_softc *sc, 
&paddr, BUS_DMA_NOWAIT);
if (error != 0 && error != EFBIG) {
device_printf(sc->sc_dev,
-   "%s: can't not map mbuf, error %d\n", __func__,
+   "%s: can't map mbuf, error %d\n", __func__,
error);
goto fail;
}
@@ -2036,6 +2036,10 @@ iwn_reset_tx_ring(struct iwn_softc *sc, 
m_freem(data->m);
data->m = NULL;
}
+   if (data->ni != NULL) {
+   ieee80211_free_node(data->ni);
+   data->ni = NULL;
+   }
}
/* Clear TX descriptors. */
memset(ring->desc, 0, ring->desc_dma.size);
@@ -2969,7 +2973,7 @@ iwn_rx_done(struct iwn_softc *sc, struct
return;
}
/* Discard frames that are too short. */
-   if (len < sizeof (*wh)) {
+   if (len < sizeof (struct ieee80211_frame_ack)) {
DPRINTF(sc, IWN_DEBUG_RECV, "%s: frame too short: %d\n",
__func__, len);
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
@@ -3021,7 +3025,10 @@ iwn_rx_done(struct iwn_softc *sc, struct
 
/* Grab a reference to the source node. */
wh = mtod(m, struct ieee80211_frame *);
-   ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
+   if (len >= sizeof(struct ieee80211_frame_min))
+   ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min 
*)wh);
+   else
+   ni = NULL;
nf = (ni != NULL && ni->ni_vap->iv_state == IEEE80211_S_RUN &&
(ic->ic_flags & IEEE80211_F_SCAN) == 0) ? sc->noise : -95;
 
@@ -4047,8 +4054,10 @@ iwn_intr(void *arg)
r2 = 0; /* Unused. */
} else {
r1 = IWN_READ(sc, IWN_INT);
-   if (r1 == 0x || (r1 & 0xfff0) == 0xa5a5a5a0)
+   if (r1 == 0x || (r1 & 0xfff0) == 0xa5a5a5a0) {
+   IWN_UNLOCK(sc);
return; /* Hardware gone! */
+   }
r2 = IWN_READ(sc, IWN_FH_INT);
}
 
@@ -4519,7 +4528,7 @@ iwn_tx_data(struct iwn_softc *sc, struct
return error;
}
/* Too many DMA segments, linearize mbuf. */
-   m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER);
+   m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER - 1);
if (m1 == NULL) {
device_printf(sc->sc_dev,
"%s: could not defrag mbuf\n", __func__);
@@ -4725,7 +4734,7 @@ iwn_tx_data_raw(struct iwn_softc *sc, st
return error;
}
/* Too many DMA segments, linearize mbuf. */
-   m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER);
+   m1 = m_collapse(m, M_NOWAIT, IWN_MAX_SCATTER - 1);
if (m1 == NULL) {
device_printf(sc->sc_dev,
"%s: could not defrag mbuf\n", __func__);
@@ -4825,8 +4834,8 @@ iwn_raw_xmit(struct ieee80211_node *ni, 
/* NB: m is reclaimed on tx failure */
ieee80211_free_node(ni);
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-   }
-   sc->sc_tx_timer = 5;
+   } else
+   sc->sc_tx_timer = 5;
 
IWN_UNLOCK(sc);
 
@@ -4872,9 +4881,8 @@ iwn_start_locked(struct ifnet *ifp)
if (iwn_tx_data(sc, m, ni) != 0) {
ieee80211_free_node(ni);
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-   continue;
-   }
-   sc->sc_tx_timer = 5;
+   } else
+   sc->sc_tx_timer = 5;
}
 
DPRINTF(sc, IWN_DEBUG_XMIT, "%s: done\n", __func__);
@@ -4950,7 +4958,6 @@ iwn_ioctl(str

svn commit: r282998 - head/sys/dev/sfxge

2015-05-15 Thread Andrew Rybchenko
Author: arybchik
Date: Sat May 16 05:43:20 2015
New Revision: 282998
URL: https://svnweb.freebsd.org/changeset/base/282998

Log:
  sfxge: move mbuf free to sfxge_if_transmit()
  
  It is a preparation to the next patch which will service packet queue even
  if packet addtion fails.
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision: https://reviews.freebsd.org/D2552

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Sat May 16 05:37:47 2015
(r282997)
+++ head/sys/dev/sfxge/sfxge_tx.c   Sat May 16 05:43:20 2015
(r282998)
@@ -605,9 +605,8 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
int rc;
 
if (!SFXGE_LINK_UP(txq->sc)) {
-   rc = ENETDOWN;
atomic_add_long(&txq->netdown_drops, 1);
-   goto fail;
+   return (ENETDOWN);
}
 
/*
@@ -622,7 +621,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
rc = sfxge_tx_qdpl_put_locked(txq, m);
if (rc != 0) {
SFXGE_TXQ_UNLOCK(txq);
-   goto fail;
+   return (rc);
}
 
/* Try to service the list. */
@@ -631,7 +630,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
} else {
rc = sfxge_tx_qdpl_put_unlocked(txq, m);
if (rc != 0)
-   goto fail;
+   return (rc);
 
/*
 * Try to grab the lock again.
@@ -649,10 +648,6 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq);
 
return (0);
-
-fail:
-   m_freem(m);
-   return (rc);
 }
 
 static void
@@ -730,6 +725,8 @@ sfxge_if_transmit(struct ifnet *ifp, str
}
 
rc = sfxge_tx_packet_add(txq, m);
+   if (rc != 0)
+   m_freem(m);
 
return (rc);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282997 - head/sys/dev/sfxge

2015-05-15 Thread Andrew Rybchenko
Author: arybchik
Date: Sat May 16 05:37:47 2015
New Revision: 282997
URL: https://svnweb.freebsd.org/changeset/base/282997

Log:
  sfxge: get rid of locked variable in sfxge_tx_packet_add()
  
  Now each branch has one and only one possible TxQ lock state.
  It simplifies understanding of the code.
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision: https://reviews.freebsd.org/D2551

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Sat May 16 05:36:40 2015
(r282996)
+++ head/sys/dev/sfxge/sfxge_tx.c   Sat May 16 05:37:47 2015
(r282997)
@@ -602,7 +602,6 @@ sfxge_tx_qdpl_put_unlocked(struct sfxge_
 int
 sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m)
 {
-   int locked;
int rc;
 
if (!SFXGE_LINK_UP(txq->sc)) {
@@ -616,9 +615,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
 * the packet will be appended to the "get list" of the deferred
 * packet list.  Otherwise, it will be pushed on the "put list".
 */
-   locked = SFXGE_TXQ_TRYLOCK(txq);
-
-   if (locked) {
+   if (SFXGE_TXQ_TRYLOCK(txq)) {
/* First swizzle put-list to get-list to keep order */
sfxge_tx_qdpl_swizzle(txq);
 
@@ -627,6 +624,10 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
SFXGE_TXQ_UNLOCK(txq);
goto fail;
}
+
+   /* Try to service the list. */
+   sfxge_tx_qdpl_service(txq);
+   /* Lock has been dropped. */
} else {
rc = sfxge_tx_qdpl_put_unlocked(txq, m);
if (rc != 0)
@@ -639,14 +640,13 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
 * the deferred packet list.  If we are not able to get
 * the lock, another thread is processing the list.
 */
-   locked = SFXGE_TXQ_TRYLOCK(txq);
+   if (SFXGE_TXQ_TRYLOCK(txq)) {
+   sfxge_tx_qdpl_service(txq);
+   /* Lock has been dropped. */
+   }
}
 
-   if (locked) {
-   /* Try to service the list. */
-   sfxge_tx_qdpl_service(txq);
-   /* Lock has been dropped. */
-   }
+   SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq);
 
return (0);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282996 - head/sys/dev/sfxge

2015-05-15 Thread Andrew Rybchenko
Author: arybchik
Date: Sat May 16 05:36:40 2015
New Revision: 282996
URL: https://svnweb.freebsd.org/changeset/base/282996

Log:
  sfxge: support Rx checksum offloads disabling
  
  We can't disable it in HW, but we can ignore result.
  Discard Rx descriptor checksum flags if Rx checksum offload is off.
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision: https://reviews.freebsd.org/D2544

Modified:
  head/sys/dev/sfxge/sfxge.c
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/sfxge.c
==
--- head/sys/dev/sfxge/sfxge.c  Sat May 16 01:13:37 2015(r282995)
+++ head/sys/dev/sfxge/sfxge.c  Sat May 16 05:36:40 2015(r282996)
@@ -65,8 +65,7 @@ __FBSDID("$FreeBSD$");
   IFCAP_JUMBO_MTU | IFCAP_LRO |\
   IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWSTATS)
 #defineSFXGE_CAP_ENABLE SFXGE_CAP
-#defineSFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_RXCSUM | 
IFCAP_VLAN_HWCSUM | \
-IFCAP_RXCSUM_IPV6 |\
+#defineSFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM |   
\
 IFCAP_JUMBO_MTU | IFCAP_LINKSTATE | IFCAP_HWSTATS)
 
 MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver");

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Sat May 16 01:13:37 2015
(r282995)
+++ head/sys/dev/sfxge/sfxge_rx.c   Sat May 16 05:36:40 2015
(r282996)
@@ -795,7 +795,8 @@ void
 sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop)
 {
struct sfxge_softc *sc = rxq->sc;
-   int lro_enabled = sc->ifnet->if_capenable & IFCAP_LRO;
+   int if_capenable = sc->ifnet->if_capenable;
+   int lro_enabled = if_capenable & IFCAP_LRO;
unsigned int index;
struct sfxge_evq *evq;
unsigned int completed;
@@ -825,21 +826,37 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq
 
prefetch_read_many(mtod(m, caddr_t));
 
-   /* Check for loopback packets */
-   if (!(rx_desc->flags & EFX_PKT_IPV4) &&
-   !(rx_desc->flags & EFX_PKT_IPV6)) {
-   struct ether_header *etherhp;
-
-   /*LINTED*/
-   etherhp = mtod(m, struct ether_header *);
-
-   if (etherhp->ether_type ==
-   htons(SFXGE_ETHERTYPE_LOOPBACK)) {
-   EFSYS_PROBE(loopback);
-
-   rxq->loopback++;
-   goto discard;
+   switch (rx_desc->flags & (EFX_PKT_IPV4 | EFX_PKT_IPV6)) {
+   case EFX_PKT_IPV4:
+   if (~if_capenable & IFCAP_RXCSUM)
+   rx_desc->flags &=
+   ~(EFX_CKSUM_IPV4 | EFX_CKSUM_TCPUDP);
+   break;
+   case EFX_PKT_IPV6:
+   if (~if_capenable & IFCAP_RXCSUM_IPV6)
+   rx_desc->flags &= ~EFX_CKSUM_TCPUDP;
+   break;
+   case 0:
+   /* Check for loopback packets */
+   {
+   struct ether_header *etherhp;
+
+   /*LINTED*/
+   etherhp = mtod(m, struct ether_header *);
+
+   if (etherhp->ether_type ==
+   htons(SFXGE_ETHERTYPE_LOOPBACK)) {
+   EFSYS_PROBE(loopback);
+
+   rxq->loopback++;
+   goto discard;
+   }
}
+   break;
+   default:
+   KASSERT(B_FALSE,
+   ("Rx descriptor with both IPv4 and IPv6 flags"));
+   goto discard;
}
 
/* Pass packet up the stack or into LRO (pipelined) */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r282948 - head/lib/libthr/thread

2015-05-15 Thread Rui Paulo
On Friday 15 May 2015 08:40:17 Konstantin Belousov wrote:
> Author: kib
> Date: Fri May 15 08:40:17 2015
> New Revision: 282948
> URL: https://svnweb.freebsd.org/changeset/base/282948
> 
> Log:
>   Some third-party malloc(3) implementations use pthread_setspecific(3)
>   to handle per-thread information.  Since our pthread_setspecific()
>   implementation calls calloc(3) to allocate per-thread specific data
>   storage, things get complicated.
> 
>   Switch the allocator to use bare mmap(2).  There is some loss of the
>   allocated page, since e.g. on amd64, PTHREAD_KEYS_MAX * sizeof(struct
>   pthread_specific_elem) is 3K (it actually spans whole page due to
>   padding), but I believe it is more acceptable than additional code for
>   specialized allocator().
> 
>   The alternatives would either to make the specific data array be part of
>   the struct thread, or use internal bindings to call the libc malloc,
>   avoiding interposing.
> 
>   Also do the style pass over the thr_spec.c, esp. simplify the
>   conditionals nesting by returning early when an error detected.
>   Remove trivial comments.
> 
>   Found by:   y...@rawbw.com
>   PR: 200138
>   Sponsored by:   The FreeBSD Foundation
>   MFC after:  2 weeks

Thanks!  I think umem might be affected as well.

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


svn commit: r282995 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-05-15 Thread Steven Hartland
Author: smh
Date: Sat May 16 01:13:37 2015
New Revision: 282995
URL: https://svnweb.freebsd.org/changeset/base/282995

Log:
  MFC r282880:
  
  Add copyright info missing from r282205
  
  Sponsored by: Multiplay

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
Directory Properties:
  stable/10/   (props changed)

Modified: 
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c 
Fri May 15 22:19:35 2015(r282994)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c 
Sat May 16 01:13:37 2015(r282995)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2015 Chunwei Chen. All rights reserved.
  */
 
 #include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282994 - head/tools/build

2015-05-15 Thread Dimitry Andric
Author: dim
Date: Fri May 15 22:19:35 2015
New Revision: 282994
URL: https://svnweb.freebsd.org/changeset/base/282994

Log:
  Provide reallocarray() in -legacy, if needed, to allow building head on
  previous releases.
  
  Also add a stdlib.h wrapper, which declares the function, otherwise the
  compiler may assume it returns int, which can cause segfaults on LP64
  architectures.
  
  Reviewed by: bapt
  Differential Revision: https://reviews.freebsd.org/D2558

Added:
  head/tools/build/stdlib.h   (contents, props changed)
Modified:
  head/tools/build/Makefile

Modified: head/tools/build/Makefile
==
--- head/tools/build/Makefile   Fri May 15 22:14:42 2015(r282993)
+++ head/tools/build/Makefile   Fri May 15 22:19:35 2015(r282994)
@@ -25,6 +25,14 @@ CFLAGS+= -I${.CURDIR}/../../contrib/libc
-I${.CURDIR}/../../lib/libc/include
 .endif
 
+_WITH_REALLOCARRAY!= grep -c reallocarray /usr/include/stdlib.h || true
+.if ${_WITH_REALLOCARRAY} == 0
+.PATH: ${.CURDIR}/../../lib/libc/stdlib
+INCS+= stdlib.h
+SRCS+= reallocarray.c
+CFLAGS+=   -I${.CURDIR}/../../lib/libc/include
+.endif
+
 .if empty(SRCS)
 SRCS=  dummy.c
 .endif

Added: head/tools/build/stdlib.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/stdlib.h   Fri May 15 22:19:35 2015(r282994)
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2015 Dimitry Andric 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LEGACY_STDLIB_H_
+#define_LEGACY_STDLIB_H_
+
+#include_next 
+
+__BEGIN_DECLS
+   
+#if __BSD_VISIBLE
+void   *reallocarray(void *, size_t, size_t);
+#endif /* __BSD_VISIBLE */
+
+__END_DECLS
+
+#endif /* !_LEGACY_STDLIB_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r282992 - in stable/9/tools/regression/aio/kqueue: . lio

2015-05-15 Thread Garrett Cooper
On May 15, 2015, at 15:13, Garrett Cooper  wrote:

> Author: ngie
> Date: Fri May 15 22:13:11 2015
> New Revision: 282992
> URL: https://svnweb.freebsd.org/changeset/base/282992
> 
> Log:
>  MFC r280893,r280894,r280895:
> 
>  r280893:
> 
>  Cleanup and do minor refactoring before converting testcases to ATF
> 
>  - Convert errx(-1, ..) to errx(1, ..)
>  - Move the aio(4) checks to a single function (aio_available); use modfind(2)
>instead of depending on SIGSYS (doesn't work when aio(4) support is 
> missing,
>not documented in the aio syscall manpages).
>  - Use aio_available liberally in the testcase functions
>  - Use mkstemp(3) + unlink(2) instead of mktemp(3)
>  - Fix some -Wunused warnings
>  - Bump WARNS to 6
> 
>  Submitted by: mjohnston [*]
>  Sponsored by: EMC / Isilon Storage Division

I forgot to remove this portion of the commit (fixed in r282993) -- I ran into 
conflicts and couldn’t do a simple merge. Will retry after I figure out what 
revisions are missing from stable/10 and head…
-NGie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r282993 - stable/9/tools/regression/aio/aiotest

2015-05-15 Thread Garrett Cooper
Author: ngie
Date: Fri May 15 22:14:42 2015
New Revision: 282993
URL: https://svnweb.freebsd.org/changeset/base/282993

Log:
  Remove mergeinfo for r280893
  
  It wasn't actually committed to stable/9 in r282992

Modified:
Directory Properties:
  stable/9/tools/regression/aio/aiotest/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282992 - in stable/9/tools/regression/aio/kqueue: . lio

2015-05-15 Thread Garrett Cooper
Author: ngie
Date: Fri May 15 22:13:11 2015
New Revision: 282992
URL: https://svnweb.freebsd.org/changeset/base/282992

Log:
  MFC r280893,r280894,r280895:
  
  r280893:
  
  Cleanup and do minor refactoring before converting testcases to ATF
  
  - Convert errx(-1, ..) to errx(1, ..)
  - Move the aio(4) checks to a single function (aio_available); use modfind(2)
instead of depending on SIGSYS (doesn't work when aio(4) support is missing,
not documented in the aio syscall manpages).
  - Use aio_available liberally in the testcase functions
  - Use mkstemp(3) + unlink(2) instead of mktemp(3)
  - Fix some -Wunused warnings
  - Bump WARNS to 6
  
  Submitted by: mjohnston [*]
  Sponsored by: EMC / Isilon Storage Division
  
  r280894:
  
  Minor cleanup before converting to ATF testcases
  
  - Remove blank (tab-only) lines.
  - Fix -Wunused warnings.
  - Bump up to WARNS= 6
  
  r280895:
  
  - Fix -Wsign issue
  - Bump up to WARNS=6

Modified:
  stable/9/tools/regression/aio/kqueue/Makefile
  stable/9/tools/regression/aio/kqueue/aio_kqueue.c
  stable/9/tools/regression/aio/kqueue/lio/Makefile
  stable/9/tools/regression/aio/kqueue/lio/lio_kqueue.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/tools/   (props changed)
  stable/9/tools/regression/   (props changed)
  stable/9/tools/regression/aio/aiotest/   (props changed)

Modified: stable/9/tools/regression/aio/kqueue/Makefile
==
--- stable/9/tools/regression/aio/kqueue/Makefile   Fri May 15 21:33:19 
2015(r282991)
+++ stable/9/tools/regression/aio/kqueue/Makefile   Fri May 15 22:13:11 
2015(r282992)
@@ -3,4 +3,8 @@
 PROG=  aio_kqueue
 NO_MAN=
 
+WARNS?=6
+
+SUBDIR+=   lio
+
 .include 

Modified: stable/9/tools/regression/aio/kqueue/aio_kqueue.c
==
--- stable/9/tools/regression/aio/kqueue/aio_kqueue.c   Fri May 15 21:33:19 
2015(r282991)
+++ stable/9/tools/regression/aio/kqueue/aio_kqueue.c   Fri May 15 22:13:11 
2015(r282992)
@@ -177,7 +177,7 @@ main (int argc, char *argv[])
 #endif
if (result != sizeof(buffer)) {
printf("FAIL: run %d, operation %d, result %d "
-   " (errno=%d) should be %d\n", run, pending,
+   " (errno=%d) should be %zu\n", run, pending,
result, errno, sizeof(buffer));
failed++;
} else

Modified: stable/9/tools/regression/aio/kqueue/lio/Makefile
==
--- stable/9/tools/regression/aio/kqueue/lio/Makefile   Fri May 15 21:33:19 
2015(r282991)
+++ stable/9/tools/regression/aio/kqueue/lio/Makefile   Fri May 15 22:13:11 
2015(r282992)
@@ -3,4 +3,6 @@
 PROG=  lio_kqueue
 NO_MAN=
 
+WARNS?=6
+
 .include 

Modified: stable/9/tools/regression/aio/kqueue/lio/lio_kqueue.c
==
--- stable/9/tools/regression/aio/kqueue/lio/lio_kqueue.c   Fri May 15 
21:33:19 2015(r282991)
+++ stable/9/tools/regression/aio/kqueue/lio/lio_kqueue.c   Fri May 15 
22:13:11 2015(r282992)
@@ -37,13 +37,15 @@
  * http://www.ambrisko.com/doug/listio_kqueue/listio_kqueue.patch
  */
 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 
 #define PATH_TEMPLATE   "/tmp/aio.XX"
@@ -52,9 +54,10 @@
 #define MAX LIO_MAX * 16
 #define MAX_RUNS 300
 
+int
 main(int argc, char *argv[]){
int fd;
-   struct aiocb *iocb[MAX], *kq_iocb;
+   struct aiocb *iocb[MAX];
struct aiocb **lio[LIO_MAX], **lio_element, **kq_lio;
int i, result, run, error, j, k;
char buffer[32768];
@@ -65,7 +68,7 @@ main(int argc, char *argv[]){
time_t time1, time2;
char *file, pathname[sizeof(PATH_TEMPLATE)-1];
int tmp_file = 0, failed = 0;
-   
+
if (kq < 0) {
perror("No kqeueue\n");
exit(1);
@@ -89,7 +92,7 @@ main(int argc, char *argv[]){
 #ifdef DEBUG
printf("Hello kq %d fd %d\n", kq, fd);
 #endif
-   
+
for (run = 0; run < MAX_RUNS; run++){
 #ifdef DEBUG
printf("Run %d\n", run);
@@ -137,13 +140,13 @@ main(int argc, char *argv[]){
printf("write %d is at %p\n", j, lio[j]);
 #endif
}
-   
+
for(i = 0; i < LIO_MAX; i++) {
for(j = LIO_MAX - 1; j >=0; j--) {
if (lio[j])
break;
}
-   
+
for(;;) {
   

svn commit: r282991 - head/sys/x86/acpica

2015-05-15 Thread Adrian Chadd
Author: adrian
Date: Fri May 15 21:33:19 2015
New Revision: 282991
URL: https://svnweb.freebsd.org/changeset/base/282991

Log:
  Update the comments to match what the code ended up becoming.
  
  -1 is now "no locality information available".
  
  Sponsored by: Norse Corp, Inc.

Modified:
  head/sys/x86/acpica/srat.c

Modified: head/sys/x86/acpica/srat.c
==
--- head/sys/x86/acpica/srat.c  Fri May 15 20:53:43 2015(r282990)
+++ head/sys/x86/acpica/srat.c  Fri May 15 21:33:19 2015(r282991)
@@ -428,7 +428,7 @@ init_mem_locality(void)
int i;
 
/*
-* For now, assume 255 == "no locality information for
+* For now, assume -1 == "no locality information for
 * this pairing.
 */
for (i = 0; i < MAXMEMDOM * MAXMEMDOM; i++)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r282987 - head/sys/sys

2015-05-15 Thread Pedro Giffuni



On 05/15/15 15:35, John Baldwin wrote:

On Friday, May 15, 2015 07:51:06 PM Pedro F. Giffuni wrote:

Author: pfg
Date: Fri May 15 19:51:05 2015
New Revision: 282987
URL: https://svnweb.freebsd.org/changeset/base/282987

Log:
   Break apart the gnu_inline attribute and use "artificial" if available.
   
   In general it is bad practice to use the gnu_inline attribute but we

   will need it in special cases like FORTIFY_SOURCE. In this specific
   case it is also useful to have the "artificial" attribute:
   
   "This attribute is useful for small inline wrappers which if possible

   should appear during debugging as a unit, depending on the debug info
   format it will either mean marking the function as artificial or using the
   caller location for all instructions within the inlined body."
   
   This attribute appears to be currently implemented only in GCC. Use it

   only in conjuntion with gnu_inline in the cases where it is available,
   which is similar in spirit in how it's used in glibc.

Modified:
   head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri May 15 19:37:17 2015(r282986)
+++ head/sys/sys/cdefs.hFri May 15 19:51:05 2015(r282987)
@@ -375,10 +375,8 @@
  #endif
  
  #if __GNUC_PREREQ__(4, 1)

-#define__gnu_inline__attribute__((__gnu_inline__))
  #define   __returns_twice __attribute__((__returns_twice__))
  #else
-#define__gnu_inline
  #define   __returns_twice
  #endif
  
@@ -538,6 +536,21 @@

__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
  #endif
  
+/*

+ * FORTIFY_SOURCE, and perhaps other compiler-specific features, require
+ * the use of non-standard inlining.  In general we should try to avoid
+ * using these but GCC-compatible compilers tend to support the extensions
+ * well enough to use them in limited cases.
+ */
+#if __GNUC_PREREQ__(4, 1)
+#if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3)
+#define__gnu_inline__attribute__((__gnu_inline__, __artificial__))
+#else
+#define__gnu_inline__attribute__((__gnu_inline__))

 missing an #endif here?

I'm getting this error from buildworld:

/usr/obj/usr/src/tmp/usr/include/sys/cdefs.h:550:2: error: #else after #else
#else
  ^
/usr/obj/usr/src/tmp/usr/include/sys/cdefs.h:36:2: error: unterminated 
conditional directive
#ifndef _SYS_CDEFS_H_
  ^
14 errors generated.
mkdep: compile failed


(Bah... you guys beat my tinderbox.)

Fixed sorry.

Pedro.

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


svn commit: r282990 - head/sys/sys

2015-05-15 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 15 20:53:43 2015
New Revision: 282990
URL: https://svnweb.freebsd.org/changeset/base/282990

Log:
  Break apart the gnu_inline attribute and use "artificial" if available.
  
  Missing #endif (in wrong place)
  
  Pointed hat:  me

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri May 15 20:47:25 2015(r282989)
+++ head/sys/sys/cdefs.hFri May 15 20:53:43 2015(r282990)
@@ -547,10 +547,10 @@
 #define__gnu_inline__attribute__((__gnu_inline__, __artificial__))
 #else
 #define__gnu_inline__attribute__((__gnu_inline__))
+#endif /* artificial */
 #else
 #define__gnu_inline
 #endif
-#endif
 
 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
 #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 31 && \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282989 - head/sys/sys

2015-05-15 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 15 20:47:25 2015
New Revision: 282989
URL: https://svnweb.freebsd.org/changeset/base/282989

Log:
  Break apart the gnu_inline attribute and use "artificial" if available.
  
  Missing #endif
  
  Reported by:  jhb, jenkins
  Pointed hat:  me

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri May 15 20:43:37 2015(r282988)
+++ head/sys/sys/cdefs.hFri May 15 20:47:25 2015(r282989)
@@ -550,6 +550,7 @@
 #else
 #define__gnu_inline
 #endif
+#endif
 
 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
 #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 31 && \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282988 - in head: include sys/sys

2015-05-15 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 15 20:43:37 2015
New Revision: 282988
URL: https://svnweb.freebsd.org/changeset/base/282988

Log:
  Make use of GCC alloc_align attribute
  
  This lets the compiler know about the alignment of pointers returned
  by aligned_alloc(3), posix_memalign(3). and contigmalloc(9)
  
  Currently this is only supported in recent gcc but we are ready to
  use it if clang implements it.
  
  Relnotes: yes

Modified:
  head/include/stdlib.h
  head/sys/sys/malloc.h

Modified: head/include/stdlib.h
==
--- head/include/stdlib.h   Fri May 15 19:51:05 2015(r282987)
+++ head/include/stdlib.h   Fri May 15 20:43:37 2015(r282988)
@@ -156,7 +156,8 @@ _Noreturn void   _Exit(int);
  * If we're in a mode greater than C99, expose C11 functions.
  */
 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
-void * aligned_alloc(size_t, size_t) __malloc_like __alloc_size(2);
+void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
+   __alloc_size(2);
 intat_quick_exit(void (*)(void));
 _Noreturn void
quick_exit(int);
@@ -171,7 +172,7 @@ char*realpath(const char * __restrict, 
 int rand_r(unsigned *);/* (TSF) */
 #endif
 #if __POSIX_VISIBLE >= 200112
-int posix_memalign(void **, size_t, size_t) __nonnull(1)
+int posix_memalign(void **, size_t, size_t) __nonnull(1) __alloc_align(2)
__alloc_size(3);/* (ADV) */
 int setenv(const char *, const char *, int);
 int unsetenv(const char *);

Modified: head/sys/sys/malloc.h
==
--- head/sys/sys/malloc.h   Fri May 15 19:51:05 2015(r282987)
+++ head/sys/sys/malloc.h   Fri May 15 20:43:37 2015(r282988)
@@ -174,7 +174,7 @@ voidcontigfree(void *addr, unsigned lon
 void   *contigmalloc(unsigned long size, struct malloc_type *type, int flags,
vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
vm_paddr_t boundary) __malloc_like __result_use_check
-   __alloc_size(1);
+   __alloc_size(1) __alloc_align(6);
 void   free(void *addr, struct malloc_type *type);
 void   *malloc(unsigned long size, struct malloc_type *type, int flags)
__malloc_like __result_use_check __alloc_size(1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r282987 - head/sys/sys

2015-05-15 Thread John Baldwin
On Friday, May 15, 2015 07:51:06 PM Pedro F. Giffuni wrote:
> Author: pfg
> Date: Fri May 15 19:51:05 2015
> New Revision: 282987
> URL: https://svnweb.freebsd.org/changeset/base/282987
> 
> Log:
>   Break apart the gnu_inline attribute and use "artificial" if available.
>   
>   In general it is bad practice to use the gnu_inline attribute but we
>   will need it in special cases like FORTIFY_SOURCE. In this specific
>   case it is also useful to have the "artificial" attribute:
>   
>   "This attribute is useful for small inline wrappers which if possible
>   should appear during debugging as a unit, depending on the debug info
>   format it will either mean marking the function as artificial or using the
>   caller location for all instructions within the inlined body."
>   
>   This attribute appears to be currently implemented only in GCC. Use it
>   only in conjuntion with gnu_inline in the cases where it is available,
>   which is similar in spirit in how it's used in glibc.
> 
> Modified:
>   head/sys/sys/cdefs.h
> 
> Modified: head/sys/sys/cdefs.h
> ==
> --- head/sys/sys/cdefs.h  Fri May 15 19:37:17 2015(r282986)
> +++ head/sys/sys/cdefs.h  Fri May 15 19:51:05 2015(r282987)
> @@ -375,10 +375,8 @@
>  #endif
>  
>  #if __GNUC_PREREQ__(4, 1)
> -#define  __gnu_inline__attribute__((__gnu_inline__))
>  #define  __returns_twice __attribute__((__returns_twice__))
>  #else
> -#define  __gnu_inline
>  #define  __returns_twice
>  #endif
>  
> @@ -538,6 +536,21 @@
>   __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
>  #endif
>  
> +/*
> + * FORTIFY_SOURCE, and perhaps other compiler-specific features, require
> + * the use of non-standard inlining.  In general we should try to avoid
> + * using these but GCC-compatible compilers tend to support the extensions
> + * well enough to use them in limited cases.
> + */ 
> +#if __GNUC_PREREQ__(4, 1)
> +#if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3)
> +#define  __gnu_inline__attribute__((__gnu_inline__, __artificial__))
> +#else
> +#define  __gnu_inline__attribute__((__gnu_inline__))

 missing an #endif here?

I'm getting this error from buildworld:

/usr/obj/usr/src/tmp/usr/include/sys/cdefs.h:550:2: error: #else after #else
#else
 ^
/usr/obj/usr/src/tmp/usr/include/sys/cdefs.h:36:2: error: unterminated 
conditional directive
#ifndef _SYS_CDEFS_H_
 ^
14 errors generated.
mkdep: compile failed

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


svn commit: r282987 - head/sys/sys

2015-05-15 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 15 19:51:05 2015
New Revision: 282987
URL: https://svnweb.freebsd.org/changeset/base/282987

Log:
  Break apart the gnu_inline attribute and use "artificial" if available.
  
  In general it is bad practice to use the gnu_inline attribute but we
  will need it in special cases like FORTIFY_SOURCE. In this specific
  case it is also useful to have the "artificial" attribute:
  
  "This attribute is useful for small inline wrappers which if possible
  should appear during debugging as a unit, depending on the debug info
  format it will either mean marking the function as artificial or using the
  caller location for all instructions within the inlined body."
  
  This attribute appears to be currently implemented only in GCC. Use it
  only in conjuntion with gnu_inline in the cases where it is available,
  which is similar in spirit in how it's used in glibc.

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri May 15 19:37:17 2015(r282986)
+++ head/sys/sys/cdefs.hFri May 15 19:51:05 2015(r282987)
@@ -375,10 +375,8 @@
 #endif
 
 #if __GNUC_PREREQ__(4, 1)
-#define__gnu_inline__attribute__((__gnu_inline__))
 #define__returns_twice __attribute__((__returns_twice__))
 #else
-#define__gnu_inline
 #define__returns_twice
 #endif
 
@@ -538,6 +536,21 @@
__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
 #endif
 
+/*
+ * FORTIFY_SOURCE, and perhaps other compiler-specific features, require
+ * the use of non-standard inlining.  In general we should try to avoid
+ * using these but GCC-compatible compilers tend to support the extensions
+ * well enough to use them in limited cases.
+ */ 
+#if __GNUC_PREREQ__(4, 1)
+#if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3)
+#define__gnu_inline__attribute__((__gnu_inline__, __artificial__))
+#else
+#define__gnu_inline__attribute__((__gnu_inline__))
+#else
+#define__gnu_inline
+#endif
+
 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
 #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 31 && \
 defined(__GNUC__) && !defined(__INTEL_COMPILER)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282986 - head/share/mk

2015-05-15 Thread Cy Schubert
Author: cy
Date: Fri May 15 19:37:17 2015
New Revision: 282986
URL: https://svnweb.freebsd.org/changeset/base/282986

Log:
  Correct location for libntpevent.a.

Modified:
  head/share/mk/src.libnames.mk

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Fri May 15 18:25:48 2015
(r282985)
+++ head/share/mk/src.libnames.mk   Fri May 15 19:37:17 2015
(r282986)
@@ -340,7 +340,7 @@ LIBNTPDIR=  ${ROOTOBJDIR}/usr.sbin/ntp/li
 LIBNTP?=   ${LIBNTPDIR}/libntp.a
 
 LIBNTPEVENTDIR=${ROOTOBJDIR}/usr.sbin/ntp/libntpevent
-LIBNTPEVENT?=  ${LIBNTPDIR}/libntpevent.a
+LIBNTPEVENT?=  ${LIBNTPEVENTDIR}/libntpevent.a
 
 LIBOPTSDIR=${ROOTOBJDIR}/usr.sbin/ntp/libopts
 LIBOTPS?=  ${LIBOPTSDIR}/libopts.a
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282985 - in head/sys: arm/annapurna arm/annapurna/alpine arm/annapurna/alpine/hal arm/conf boot/fdt/dts/arm

2015-05-15 Thread Zbigniew Bodek
Author: zbb
Date: Fri May 15 18:25:48 2015
New Revision: 282985
URL: https://svnweb.freebsd.org/changeset/base/282985

Log:
  Introduce support for the Alpine PoC from Annapurna Labs
  
  The Alpine Platform-On-Chip offers multicore processing
  (quad ARM Cortex-A15), 1/10Gb Ethernet, SATA 3, PCI-E 3,
  DMA engines, Virtualization, Advanced Power Management and other.
  
  This code drop involves basic platform support including:
  SMP, IRQs, SerDes, SATA. As of now it is missing the PCIe support.
  Part of the functionality is provided by the low-level code (HAL)
  delivered by the chip vendor (Annapurna Labs) and is a subject to
  change in the future (is planned to be moved to sys/contrib directory).
  
  The review log for this commit is available here:
  https://reviews.freebsd.org/D2340
  
  Reviewed by:andrew, ian, imp
  Obtained from:  Semihalf
  Sponsored by:   Annapurna Labs

Added:
  head/sys/arm/annapurna/
  head/sys/arm/annapurna/alpine/
  head/sys/arm/annapurna/alpine/alpine_machdep.c   (contents, props changed)
  head/sys/arm/annapurna/alpine/alpine_machdep_mp.c   (contents, props changed)
  head/sys/arm/annapurna/alpine/common.c   (contents, props changed)
  head/sys/arm/annapurna/alpine/files.alpine   (contents, props changed)
  head/sys/arm/annapurna/alpine/hal/
  head/sys/arm/annapurna/alpine/hal/al_hal_common.h   (contents, props changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_iofic.h   (contents, props changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_iofic_regs.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_nb_regs.h   (contents, props changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_pbs_regs.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_pcie.c   (contents, props changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_pcie.h   (contents, props changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_pcie_axi_reg.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_pcie_interrupts.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_pcie_regs.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_pcie_w_reg.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_plat_services.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_plat_types.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_reg_utils.h   (contents, props 
changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_types.h   (contents, props changed)
  head/sys/arm/annapurna/alpine/hal/al_hal_unit_adapter_regs.h   (contents, 
props changed)
  head/sys/arm/annapurna/alpine/std.alpine   (contents, props changed)
  head/sys/arm/conf/ALPINE   (contents, props changed)
  head/sys/boot/fdt/dts/arm/annapurna-alpine.dts   (contents, props changed)

Added: head/sys/arm/annapurna/alpine/alpine_machdep.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/annapurna/alpine/alpine_machdep.c  Fri May 15 18:25:48 
2015(r282985)
@@ -0,0 +1,148 @@
+/*-
+ * Copyright (c) 2013 Ruslan Bukin 
+ * Copyright (c) 2015 Semihalf
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#define _ARM32_BUS_DMA_PRIVATE
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include  /* For trapframe_t, used in  */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "opt_ddb.h"
+#include "opt_platform.h"
+
+struct mtx al_dbg_lock;
+
+#defineDEVMAP_MAX_VA_ADDRESS   0xF000
+bus_

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

2015-05-15 Thread Ian Lepore
Author: ian
Date: Fri May 15 18:10:00 2015
New Revision: 282984
URL: https://svnweb.freebsd.org/changeset/base/282984

Log:
  Add assertions that the addresses passed to tlb maintenance are page-aligned.
  
  Perform cache writebacks and invalidations in the correct (inner to outer
  or vice versa) order, and add comments that explain that.
  
  Consistantly use 'va' as the variable name for virtual addresses.
  
  Submitted by: Michal Meloun 

Modified:
  head/sys/arm/include/cpu-v6.h

Modified: head/sys/arm/include/cpu-v6.h
==
--- head/sys/arm/include/cpu-v6.h   Fri May 15 18:07:58 2015
(r282983)
+++ head/sys/arm/include/cpu-v6.h   Fri May 15 18:10:00 2015
(r282984)
@@ -39,7 +39,6 @@
 #include "machine/cpuinfo.h"
 #include "machine/sysreg.h"
 
-
 #define CPU_ASID_KERNEL 0
 
 vm_offset_t dcache_wb_pou_checked(vm_offset_t, vm_size_t);
@@ -281,24 +280,29 @@ tlb_flush_all_ng_local(void)
 
 /* Flush single TLB entry (even global). */
 static __inline void
-tlb_flush_local(vm_offset_t sva)
+tlb_flush_local(vm_offset_t va)
 {
 
+   KASSERT((va & PAGE_MASK) == 0, ("%s: va %#x not aligned", __func__, 
va));
+
dsb();
-   _CP15_TLBIMVA((sva & ~PAGE_MASK ) | CPU_ASID_KERNEL);
+   _CP15_TLBIMVA(va | CPU_ASID_KERNEL);
dsb();
 }
 
 /* Flush range of TLB entries (even global). */
 static __inline void
-tlb_flush_range_local(vm_offset_t sva, vm_size_t size)
+tlb_flush_range_local(vm_offset_t va, vm_size_t size)
 {
-   vm_offset_t va;
-   vm_offset_t eva = sva + size;
+   vm_offset_t eva = va + size;
+
+   KASSERT((va & PAGE_MASK) == 0, ("%s: va %#x not aligned", __func__, 
va));
+   KASSERT((size & PAGE_MASK) == 0, ("%s: size %#x not aligned", __func__,
+   size));
 
dsb();
-   for (va = sva; va < eva; va += PAGE_SIZE)
-   _CP15_TLBIMVA((va & ~PAGE_MASK ) | CPU_ASID_KERNEL);
+   for (; va < eva; va += PAGE_SIZE)
+   _CP15_TLBIMVA(va | CPU_ASID_KERNEL);
dsb();
 }
 
@@ -324,22 +328,27 @@ tlb_flush_all_ng(void)
 }
 
 static __inline void
-tlb_flush(vm_offset_t sva)
+tlb_flush(vm_offset_t va)
 {
 
+   KASSERT((va & PAGE_MASK) == 0, ("%s: va %#x not aligned", __func__, 
va));
+
dsb();
-   _CP15_TLBIMVAAIS(sva);
+   _CP15_TLBIMVAAIS(va);
dsb();
 }
 
 static __inline void
-tlb_flush_range(vm_offset_t sva,  vm_size_t size)
+tlb_flush_range(vm_offset_t va,  vm_size_t size)
 {
-   vm_offset_t va;
-   vm_offset_t eva = sva + size;
+   vm_offset_t eva = va + size;
+
+   KASSERT((va & PAGE_MASK) == 0, ("%s: va %#x not aligned", __func__, 
va));
+   KASSERT((size & PAGE_MASK) == 0, ("%s: size %#x not aligned", __func__,
+   size));
 
dsb();
-   for (va = sva; va < eva; va += PAGE_SIZE)
+   for (; va < eva; va += PAGE_SIZE)
_CP15_TLBIMVAAIS(va);
dsb();
 }
@@ -347,8 +356,8 @@ tlb_flush_range(vm_offset_t sva,  vm_siz
 
 #define tlb_flush_all()tlb_flush_all_local()
 #define tlb_flush_all_ng() tlb_flush_all_ng_local()
-#define tlb_flush(sva) tlb_flush_local(sva)
-#define tlb_flush_range(sva, size) tlb_flush_range_local(sva, size)
+#define tlb_flush(va)  tlb_flush_local(va)
+#define tlb_flush_range(va, size)  tlb_flush_range_local(va, size)
 
 #endif /* SMP */
 
@@ -358,13 +367,13 @@ tlb_flush_range(vm_offset_t sva,  vm_siz
 
 /*  Sync I and D caches to PoU */
 static __inline void
-icache_sync(vm_offset_t sva, vm_size_t size)
+icache_sync(vm_offset_t va, vm_size_t size)
 {
-   vm_offset_t va;
-   vm_offset_t eva = sva + size;
+   vm_offset_t eva = va + size;
 
dsb();
-   for (va = sva; va < eva; va += cpuinfo.dcache_line_size) {
+   va &= ~cpuinfo.dcache_line_mask;
+   for ( ; va < eva; va += cpuinfo.dcache_line_size) {
 #if __ARM_ARCH >= 7 && defined SMP
_CP15_DCCMVAU(va);
 #else
@@ -409,13 +418,13 @@ bpb_inv_all(void)
 
 /* Write back D-cache to PoU */
 static __inline void
-dcache_wb_pou(vm_offset_t sva, vm_size_t size)
+dcache_wb_pou(vm_offset_t va, vm_size_t size)
 {
-   vm_offset_t va;
-   vm_offset_t eva = sva + size;
+   vm_offset_t eva = va + size;
 
dsb();
-   for (va = sva; va < eva; va += cpuinfo.dcache_line_size) {
+   va &= ~cpuinfo.dcache_line_mask;
+   for ( ; va < eva; va += cpuinfo.dcache_line_size) {
 #if __ARM_ARCH >= 7 && defined SMP
_CP15_DCCMVAU(va);
 #else
@@ -425,40 +434,46 @@ dcache_wb_pou(vm_offset_t sva, vm_size_t
dsb();
 }
 
-/* Invalidate D-cache to PoC */
+/*
+ * Invalidate D-cache to PoC
+ *
+ * Caches are invalidated from outermost to innermost as fresh cachelines
+ * flow in this direction. In given range, if there was no dirty cacheline
+ * in any cache before, no stale cacheline should remain in them after this
+ * operation finishes

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

2015-05-15 Thread Ian Lepore
Author: ian
Date: Fri May 15 18:07:58 2015
New Revision: 282983
URL: https://svnweb.freebsd.org/changeset/base/282983

Log:
  Retrieve the cache parms in the proper arch-specific way.
  
  Submitted by: Michal Meloun 

Modified:
  head/sys/arm/arm/cpuinfo.c

Modified: head/sys/arm/arm/cpuinfo.c
==
--- head/sys/arm/arm/cpuinfo.c  Fri May 15 18:04:49 2015(r282982)
+++ head/sys/arm/arm/cpuinfo.c  Fri May 15 18:07:58 2015(r282983)
@@ -131,8 +131,17 @@ cpuinfo_init(void)
cpuinfo.security_ext = (cpuinfo.id_pfr1 >> 4) & 0xF;
 
/* L1 Cache sizes */
-   cpuinfo.dcache_line_size = 1 << (CPU_CT_DMINLINE(cpuinfo.ctr ) + 2);
+   if (CPU_CT_FORMAT(cpuinfo.ctr) == CPU_CT_ARMV7) {
+   cpuinfo.dcache_line_size =
+   1 << (CPU_CT_DMINLINE(cpuinfo.ctr) + 2);
+   cpuinfo.icache_line_size =
+   1 << (CPU_CT_IMINLINE(cpuinfo.ctr) + 2);
+   } else {
+   cpuinfo.dcache_line_size =
+   1 << (CPU_CT_xSIZE_LEN(CPU_CT_DSIZE(cpuinfo.ctr)) + 3);
+   cpuinfo.icache_line_size =
+   1 << (CPU_CT_xSIZE_LEN(CPU_CT_ISIZE(cpuinfo.ctr)) + 3);
+   }
cpuinfo.dcache_line_mask = cpuinfo.dcache_line_size - 1;
-   cpuinfo.icache_line_size= 1 << (CPU_CT_IMINLINE(cpuinfo.ctr ) + 2);
cpuinfo.icache_line_mask = cpuinfo.icache_line_size - 1;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282982 - head/sys/netipsec

2015-05-15 Thread George V. Neville-Neil
Author: gnn
Date: Fri May 15 18:04:49 2015
New Revision: 282982
URL: https://svnweb.freebsd.org/changeset/base/282982

Log:
  Summary: Remove spurious, extra, next header comments.
  Correct the name of the pad length field.

Modified:
  head/sys/netipsec/esp.h

Modified: head/sys/netipsec/esp.h
==
--- head/sys/netipsec/esp.h Fri May 15 17:51:03 2015(r282981)
+++ head/sys/netipsec/esp.h Fri May 15 18:04:49 2015(r282982)
@@ -42,8 +42,7 @@ struct esp {
/*variable size, 32bit bound*/  /* Initialization Vector */
/*variable size*/   /* Payload data */
/*variable size*/   /* padding */
-   /*8bit*//* pad size */
-   /*8bit*//* next header */
+   /*8bit*//* pad length */
/*8bit*//* next header */
/*variable size, 32bit bound*/  /* Authentication data (new IPsec) */
 };
@@ -53,8 +52,7 @@ struct newesp {
u_int32_t   esp_seq;/* Sequence number */
/*variable size*/   /* (IV and) Payload data */
/*variable size*/   /* padding */
-   /*8bit*//* pad size */
-   /*8bit*//* next header */
+   /*8bit*//* pad length */
/*8bit*//* next header */
/*variable size, 32bit bound*/  /* Authentication data */
 };
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282981 - head/sys/sys

2015-05-15 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 15 17:51:03 2015
New Revision: 282981
URL: https://svnweb.freebsd.org/changeset/base/282981

Log:
  Replace a CONSTCOND for a void value as a replacement for __unreachable 
builtin
  
  This only applies if we are not using clang or gcc but it lets us use the
  __unreachable() buitin in expressions.
  
  Suggested by: tijl

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri May 15 15:56:28 2015(r282980)
+++ head/sys/sys/cdefs.hFri May 15 17:51:03 2015(r282981)
@@ -391,7 +391,7 @@
 #if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6)
 #define__unreachable() __builtin_unreachable()
 #else
-#define__unreachable() do {} while (/*CONSTCOND*/0)
+#define__unreachable() ((void)0)
 #endif
 
 #if __has_attribute(alloc_align) || __GNUC_PREREQ__(4, 9)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r282907 - head/sys/sys

2015-05-15 Thread Pedro Giffuni



On 05/15/15 05:33, Tijl Coosemans wrote:

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hThu May 14 15:14:03 2015(r282906)
+++ head/sys/sys/cdefs.hThu May 14 15:49:48 2015(r282907)
@@ -388,6 +388,12 @@
  #define   __alloc_size(x)
  #endif
  
+#if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6)

+#define__unreachable() __builtin_unreachable()
+#else
+#define__unreachable() do {} while (/*CONSTCOND*/0)
__builtin_unreachable() can be used in expressions so I think it's better
to replace do-while with ((void)0).  You can then do things like this:

#define assume(e)  ((e) ? (void)0 : __unreachable())
(like assert(e) but without error)

Looks reasonable, thanks!

FWIW, there was some discussion about having a debugging
macro that warns when such unreachable code is reached.
We are just not sure where such a macro belongs, probably
not in cdefs.

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


svn commit: r282980 - head/usr.bin/man

2015-05-15 Thread Baptiste Daroussin
Author: bapt
Date: Fri May 15 15:56:28 2015
New Revision: 282980
URL: https://svnweb.freebsd.org/changeset/base/282980

Log:
  Allow MANWIDTH to work with mandoc(1)
  
  Reported by:  bdrewery

Modified:
  head/usr.bin/man/man.sh

Modified: head/usr.bin/man/man.sh
==
--- head/usr.bin/man/man.sh Fri May 15 15:49:24 2015(r282979)
+++ head/usr.bin/man/man.sh Fri May 15 15:56:28 2015(r282980)
@@ -311,8 +311,11 @@ man_display_page() {
return
fi
 
+   if [ -n "$use_width" ]; then
+   mandoc_args="-O width=${use_width}"
+   fi
testline="mandoc -Tlint -Wunsupp 2>/dev/null"
-   pipeline="mandoc | $MANPAGER"
+   pipeline="mandoc $mandoc_args | $MANPAGER"
 
if ! eval "$cattool $manpage | $testline" ;then
if which -s groff; then
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282979 - stable/10/lib/libc/gen

2015-05-15 Thread Julian Elischer
Author: julian
Date: Fri May 15 15:49:24 2015
New Revision: 282979
URL: https://svnweb.freebsd.org/changeset/base/282979

Log:
  MFH: r282485
Tweak seekdir, telldir and readdir so that when htere are deletes going on,
as seek to teh last location saved will still work. This is needed for Samba
to be able to correctly handle delete requests from windows. This does not
completely fix seekdir when deletes are present but fixes the worst of the
problems. The real solution must involve some changes to the API for eh VFS
and getdirentries(2).
  
Obtained from:  Panzura inc
  MFH: r282550 (jhb@)
A few style fixes and expand the comment a bit on what _fixtelldir() is
doing.
  MFH: r282560 (jhb@)
Tweak the comment here some more.  In particular, the previous opening
sentence was a bit confusing.
Noted by:   kib

Modified:
  stable/10/lib/libc/gen/directory.3
  stable/10/lib/libc/gen/readdir.c
  stable/10/lib/libc/gen/rewinddir.c
  stable/10/lib/libc/gen/telldir.c
  stable/10/lib/libc/gen/telldir.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/directory.3
==
--- stable/10/lib/libc/gen/directory.3  Fri May 15 15:36:57 2015
(r282978)
+++ stable/10/lib/libc/gen/directory.3  Fri May 15 15:49:24 2015
(r282979)
@@ -267,4 +267,27 @@ The invalidation of
 .Fn telldir
 tokens when calling
 .Fn seekdir
-is non-standard.
+is non-standard. This is a compile time option.
+.Pp
+The behaviour of
+.Fn telldir
+and
+.Fn seekdir
+is likely to be wrong if there are parallel unlinks happening
+and the directory is larger than one page.
+There is code to ensure that a
+.Fn seekdir
+to the location given by a 
+.Fn telldir
+immediately before the last 
+.Fn readdir
+will always set the correct location to return the same value as that last
+.Fn readdir
+performed.
+This is enough for some applications which want to "push back the last entry 
read" E.g. Samba. 
+Seeks back to any other location,
+other than the beginning of the directory,
+may result in unexpected behaviour if deletes are present.
+It is hoped that this situation will be resolved with changes to
+.Fn getdirentries
+and the VFS.

Modified: stable/10/lib/libc/gen/readdir.c
==
--- stable/10/lib/libc/gen/readdir.cFri May 15 15:36:57 2015
(r282978)
+++ stable/10/lib/libc/gen/readdir.cFri May 15 15:49:24 2015
(r282979)
@@ -54,19 +54,25 @@ _readdir_unlocked(dirp, skip)
int skip;
 {
struct dirent *dp;
+   long initial_seek;
+   long initial_loc = 0;
 
for (;;) {
if (dirp->dd_loc >= dirp->dd_size) {
if (dirp->dd_flags & __DTF_READALL)
return (NULL);
+   initial_loc = dirp->dd_loc;
+   dirp->dd_flags &= ~__DTF_SKIPREAD;
dirp->dd_loc = 0;
}
if (dirp->dd_loc == 0 &&
!(dirp->dd_flags & (__DTF_READALL | __DTF_SKIPREAD))) {
+   initial_seek = dirp->dd_seek;
dirp->dd_size = _getdirentries(dirp->dd_fd,
dirp->dd_buf, dirp->dd_len, &dirp->dd_seek);
if (dirp->dd_size <= 0)
return (NULL);
+   _fixtelldir(dirp, initial_seek, initial_loc);
}
dirp->dd_flags &= ~__DTF_SKIPREAD;
dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc);

Modified: stable/10/lib/libc/gen/rewinddir.c
==
--- stable/10/lib/libc/gen/rewinddir.c  Fri May 15 15:36:57 2015
(r282978)
+++ stable/10/lib/libc/gen/rewinddir.c  Fri May 15 15:49:24 2015
(r282979)
@@ -51,6 +51,7 @@ rewinddir(dirp)
 
if (__isthreaded)
_pthread_mutex_lock(&dirp->dd_lock);
+   dirp->dd_flags &= ~__DTF_SKIPREAD; /* current contents are invalid */
if (dirp->dd_flags & __DTF_READALL)
_filldir(dirp, false);
else {

Modified: stable/10/lib/libc/gen/telldir.c
==
--- stable/10/lib/libc/gen/telldir.cFri May 15 15:36:57 2015
(r282978)
+++ stable/10/lib/libc/gen/telldir.cFri May 15 15:49:24 2015
(r282979)
@@ -101,9 +101,22 @@ _seekdir(dirp, loc)
return;
if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek)
return;
+
+   /* If it's within the same chunk of data, don't bother reloading. */
+   if (lp->loc_seek == dirp->dd_seek) {
+   /*
+* If we go back to 0 don't make the next readdir
+* trigger a call to getdirentries().
+   

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

2015-05-15 Thread Patrick Kelsey
Author: pkelsey
Date: Fri May 15 15:36:57 2015
New Revision: 282978
URL: https://svnweb.freebsd.org/changeset/base/282978

Log:
  When a netmap process terminates without the full set of buffers it
  was granted via rings and ni_bufs_list_head represented in those rings
  and lists (e.g., via SIGKILL), those buffers are no longer available
  for subsequent users for the lifetime of the system. To mitigate this
  resource leak, reset the allocator state when the last ref to that
  allocator is released.
  
  Note that this only recovers leaked resources for an allocator when
  there are no longer any users of that allocator, so there remain
  circumstances in which leaked allocator resources may not ever be
  recovered - consider a set of multiple netmap processes that are all
  using the same allocator (say, the global allocator) where members of
  that set may be killed and restarted over time but at any given point
  there is one member of that set running.
  
  Based on intial work by adrian@.
  
  Reviewed by: Giuseppe Lettieri (g.letti...@iet.unipi.it), luigi
  Approved by: jmallett (mentor)
  MFC after: 1 week
  Sponsored by: Norse Corp, Inc.

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

Modified: head/sys/dev/netmap/netmap_mem2.c
==
--- head/sys/dev/netmap/netmap_mem2.c   Fri May 15 15:13:51 2015
(r282977)
+++ head/sys/dev/netmap/netmap_mem2.c   Fri May 15 15:36:57 2015
(r282978)
@@ -130,9 +130,9 @@ struct netmap_mem_d {
/* the three allocators */
struct netmap_obj_pool pools[NETMAP_POOLS_NR];
 
-   netmap_mem_config_t   config;
-   netmap_mem_finalize_t finalize;
-   netmap_mem_deref_tderef;
+   netmap_mem_config_t   config;   /* called with NMA_LOCK held */
+   netmap_mem_finalize_t finalize; /* called with NMA_LOCK held */
+   netmap_mem_deref_tderef;/* called with NMA_LOCK held */
 
nm_memid_t nm_id;   /* allocator identifier */
int nm_grp; /* iommu groupd id */
@@ -751,6 +751,12 @@ netmap_reset_obj_allocator(struct netmap
u_int i;
size_t sz = p->_clustsize;
 
+   /*
+* Free each cluster allocated in
+* netmap_finalize_obj_allocator().  The cluster start
+* addresses are stored at multiples of p->_clusterentries
+* in the lut.
+*/
for (i = 0; i < p->objtotal; i += p->_clustentries) {
if (p->lut[i].vaddr)
contigfree(p->lut[i].vaddr, sz, M_NETMAP);
@@ -929,6 +935,7 @@ netmap_finalize_obj_allocator(struct net
if (i % p->_clustentries == 0 && 
p->lut[i].vaddr)
contigfree(p->lut[i].vaddr,
n, M_NETMAP);
+   p->lut[i].vaddr = NULL;
}
out:
p->objtotal = i;
@@ -936,6 +943,17 @@ netmap_finalize_obj_allocator(struct net
p->numclusters = (i + p->_clustentries - 1) / 
p->_clustentries;
break;
}
+   /*
+* Set bitmap and lut state for all buffers in the current
+* cluster.
+*
+* [i, lim) is the set of buffer indexes that cover the
+* current cluster.
+*
+* 'clust' is really the address of the current buffer in
+* the current cluster as we index through it with a stride
+* of p->_objsize.
+*/
for (; i < lim; i++, clust += p->_objsize) {
p->bitmap[ (i>>5) ] |=  ( 1 << (i & 31) );
p->lut[i].vaddr = clust;
@@ -1092,10 +1110,8 @@ static int
 netmap_mem_private_finalize(struct netmap_mem_d *nmd)
 {
int err;
-   NMA_LOCK(nmd);
nmd->refcount++;
err = netmap_mem_finalize_all(nmd);
-   NMA_UNLOCK(nmd);
return err;
 
 }
@@ -1103,10 +1119,8 @@ netmap_mem_private_finalize(struct netma
 static void
 netmap_mem_private_deref(struct netmap_mem_d *nmd)
 {
-   NMA_LOCK(nmd);
if (--nmd->refcount <= 0)
netmap_mem_reset_all(nmd);
-   NMA_UNLOCK(nmd);
 }
 
 
@@ -1242,10 +1256,7 @@ static int
 netmap_mem_global_finalize(struct netmap_mem_d *nmd)
 {
int err;
-
-   NMA_LOCK(nmd);
-
-
+   
/* update configuration if changed */
if (netmap_mem_global_config(nmd))
goto out;
@@ -1268,8 +1279,6 @@ out:
nmd->refcount--;
err = nmd->lasterr;
 
-   NMA_UNLOCK(nmd);
-
return err;
 
 }
@@ -1518,7 +1527,6 @@ netmap_mem_if_delete(struct netmap_adapt
 static void
 netmap_mem_global_deref(struct netmap_mem_d *nmd)
 {
-   NMA

Re: svn commit: r282971 - in head/sys: kern sys

2015-05-15 Thread John Baldwin
On Friday, May 15, 2015 01:50:38 PM John Baldwin wrote:
> Author: jhb
> Date: Fri May 15 13:50:37 2015
> New Revision: 282971
> URL: https://svnweb.freebsd.org/changeset/base/282971
> 
> Log:
>   Previously, cv_waiters was only updated by cv_signal or cv_wait. If a
>   thread awakened due to a time out, then cv_waiters was not decremented.
>   If INT_MAX threads timed out on a cv without an intervening cv_broadcast,
>   then cv_waiters could overflow. To fix this, have each sleeping thread
>   decrement cv_waiters when it resumes.
>   
>   Note that previously cv_waiters was protected by the sleepq chain lock.
>   However, that lock is not held when threads resume from sleep. In
>   addition, the interlock is also not always reacquired after resuming
>   (cv_wait_unlock), nor is it always held by callers of cv_signal() or
>   cv_broadcast(). Instead, use atomic ops to update cv_waiters. Since
>   the sleepq chain lock is still held on every increment, it should
>   still be safe to compare cv_waiters against zero while holding the
>   lock in the wakeup routines as the only way the race should be lost
>   would result in extra calls to sleepq_signal() or sleepq_broadcast().
>   
>   Differential Revision:  https://reviews.freebsd.org/D2427
>   Reviewed by:benno
>   Reported by:benno (wrap of cv_waiters in the field)
>   MFC after:  2 weeks

With the additional overhead of the atomic ops it might be worth running
some benchmarks to compare this with removing cv_waiters entirely.  The
theoretical gain from cv_waiters is avoiding looking in the hash table for
a matching sleepqueue when there are no waiters.  When cv_waiters was
a simple integer the cost of having it around was very small, so even a
tiny gain was worth having.  (It is worth noting that in pre-SMPng code it
was fairly common practice to keep a "WANTED" flag around that was set by
waiters and would result in wakeup() being skipped if it wasn't set.  These
flags were maintained by each caller, not centrally.  cv_waiters makes this
sort of thing centrally maintained rather than something that each caller
has to do.)  Now that cv_waiters is updated with atomics, the cost is not
quite as small.

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


svn commit: r282977 - stable/10/share/man/man8

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 15:13:51 2015
New Revision: 282977
URL: https://svnweb.freebsd.org/changeset/base/282977

Log:
  MFC r279316:
  
  Add uefisign(8) reference to uefi(8) manual page.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/share/man/man8/uefi.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man8/uefi.8
==
--- stable/10/share/man/man8/uefi.8 Fri May 15 15:12:12 2015
(r282976)
+++ stable/10/share/man/man8/uefi.8 Fri May 15 15:13:51 2015
(r282977)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 17, 2014
+.Dd February 26, 2015
 .Dt UEFI 8
 .Os
 .Sh NAME
@@ -114,7 +114,8 @@ typical non-default kernel (optional)
 .Xr vt 4 ,
 .Xr msdosfs 5 ,
 .Xr boot 8 ,
-.Xr gpart 8
+.Xr gpart 8 , 
+.Xr uefisign 8
 .Sh HISTORY
 .Nm
 boot support first appeared in
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282976 - stable/10/share/examples/uefisign

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 15:12:12 2015
New Revision: 282976
URL: https://svnweb.freebsd.org/changeset/base/282976

Log:
  MFC r279321:
  
  Make the uefikeys script output slightly more obvious.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/share/examples/uefisign/uefikeys
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/examples/uefisign/uefikeys
==
--- stable/10/share/examples/uefisign/uefikeys  Fri May 15 15:10:34 2015
(r282975)
+++ stable/10/share/examples/uefisign/uefikeys  Fri May 15 15:12:12 2015
(r282976)
@@ -18,7 +18,6 @@ fi
 certfile="${1}.pem"
 efifile="${1}.cer"
 keyfile="${1}.key"
-p12file="${1}.p12"
 # XXX: Set this to ten years; we don't want system to suddenly stop booting
 #  due to certificate expiration.  Better way would be to use Authenticode
 #  Timestamp.  That said, the rumor is UEFI implementations ignore it 
anyway.
@@ -28,13 +27,11 @@ subj="/CN=${1}"
 [ ! -e "${certfile}" ] || die "${certfile} already exists"
 [ ! -e "${efifile}" ] || die "${efifile} already exists"
 [ ! -e "${keyfile}" ] || die "${keyfile} already exists"
-[ ! -e "${p12file}" ] || die "${p12file} already exists"
 
 umask 077 || die "umask 077 failed"
 
 openssl genrsa -out "${keyfile}" 2048 2> /dev/null || die "openssl genrsa 
failed"
 openssl req -new -x509 -sha256 -days "${days}" -subj "${subj}" -key 
"${keyfile}" -out "${certfile}" || die "openssl req failed"
 openssl x509 -inform PEM -outform DER -in "${certfile}" -out "${efifile}" || 
die "openssl x509 failed"
-openssl pkcs12 -export -out "${p12file}" -inkey "${keyfile}" -in "${certfile}" 
-password 'pass:' || die "openssl pkcs12 failed"
 
-echo "certificate: ${certfile}; private key: ${keyfile}; UEFI public key: 
${efifile}; private key with empty password for pesign: ${p12file}"
+echo "certificate: ${certfile}; private key: ${keyfile}; certificate to enroll 
in UEFI: ${efifile}"
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282975 - in stable/10: etc/mtree share/examples share/examples/uefisign

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 15:10:34 2015
New Revision: 282975
URL: https://svnweb.freebsd.org/changeset/base/282975

Log:
  MFC r279317:
  
  Add key/cert generation script for uefisign(8).
  
  Sponsored by: The FreeBSD Foundation

Added:
  stable/10/share/examples/uefisign/
 - copied from r279317, head/share/examples/uefisign/
Modified:
  stable/10/etc/mtree/BSD.usr.dist
  stable/10/share/examples/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/mtree/BSD.usr.dist
==
--- stable/10/etc/mtree/BSD.usr.distFri May 15 15:08:37 2015
(r282974)
+++ stable/10/etc/mtree/BSD.usr.distFri May 15 15:10:34 2015
(r282975)
@@ -409,6 +409,8 @@
 ..
 tcsh
 ..
+uefisign
+..
 ..
 games
 fortune

Modified: stable/10/share/examples/Makefile
==
--- stable/10/share/examples/Makefile   Fri May 15 15:08:37 2015
(r282974)
+++ stable/10/share/examples/Makefile   Fri May 15 15:10:34 2015
(r282975)
@@ -27,7 +27,8 @@ LDIRS=BSD_daemon \
printing \
ses \
scsi_target \
-   sunrpc
+   sunrpc \
+   uefisign
 
 XFILES=BSD_daemon/FreeBSD.pfa \
BSD_daemon/README \
@@ -181,7 +182,8 @@ XFILES= BSD_daemon/FreeBSD.pfa \
sunrpc/sort/Makefile \
sunrpc/sort/rsort.c \
sunrpc/sort/sort.x \
-   sunrpc/sort/sort_proc.c
+   sunrpc/sort/sort_proc.c \
+   uefisign/uefikeys
 
 BINDIR= ${SHAREDIR}/examples
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282974 - in stable/10/usr.sbin: . uefisign

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 15:08:37 2015
New Revision: 282974
URL: https://svnweb.freebsd.org/changeset/base/282974

Log:
  MFC r279315:
  
  Add uefisign(8), UEFI Secure Boot signing utility.
  
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Added:
  stable/10/usr.sbin/uefisign/
 - copied from r279315, head/usr.sbin/uefisign/
Modified:
  stable/10/usr.sbin/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/Makefile
==
--- stable/10/usr.sbin/Makefile Fri May 15 14:22:33 2015(r282973)
+++ stable/10/usr.sbin/Makefile Fri May 15 15:08:37 2015(r282974)
@@ -86,6 +86,7 @@ SUBDIR=   adduser \
traceroute \
trpt \
tzsetup \
+   uefisign \
ugidfw \
vipw \
wake \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282973 - in head: gnu/lib tools/build/mk

2015-05-15 Thread Ed Maste
Author: emaste
Date: Fri May 15 14:22:33 2015
New Revision: 282973
URL: https://svnweb.freebsd.org/changeset/base/282973

Log:
  Build libgomp only if we're also building base system GCC
  
  Clang's OpenMP support will emit Intel OpenMP API library calls,
  and will therefore require libiomp (or whatever name is settled on).
  An up-to-date version of libgomp is included in ports or pkg GCC.
  Thus, there is no reason to build base libgomp without base system GCC.
  
  PR:   199979 (exp-run)
  Reviewed by:  pfg
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D2459

Modified:
  head/gnu/lib/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/gnu/lib/Makefile
==
--- head/gnu/lib/Makefile   Fri May 15 13:55:18 2015(r282972)
+++ head/gnu/lib/Makefile   Fri May 15 14:22:33 2015(r282973)
@@ -2,7 +2,11 @@
 
 .include 
 
-SUBDIR= csu libgcc libgcov libdialog libgomp libregex libreadline
+SUBDIR= csu libgcc libgcov libdialog libregex libreadline
+
+.if ${MK_GCC} != "no"
+SUBDIR+= libgomp
+.endif
 
 .if ${MK_SSP} != "no"
 SUBDIR+= libssp

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Fri May 15 13:55:18 
2015(r282972)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Fri May 15 14:22:33 
2015(r282973)
@@ -1743,6 +1743,11 @@ OLD_FILES+=usr/include/gcc/4.2/altivec.h
 OLD_FILES+=usr/include/gcc/4.2/ppc-asm.h
 OLD_FILES+=usr/include/gcc/4.2/spe.h
 .endif
+OLD_FILES+=usr/include/omp.h
+OLD_FILES+=usr/lib/libgomp.a
+OLD_FILES+=usr/lib/libgomp.so
+OLD_FILES+=usr/lib/libgomp.so.1
+OLD_FILES+=usr/lib/libgomp_p.a
 OLD_FILES+=usr/libexec/cc1
 OLD_FILES+=usr/libexec/cc1plus
 OLD_FILES+=usr/share/info/cpp.info.gz
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282972 - in head/sys: dev/fdt dev/gpio dev/ofw mips/beri powerpc/ofw powerpc/pseries

2015-05-15 Thread Ruslan Bukin
Author: br
Date: Fri May 15 13:55:18 2015
New Revision: 282972
URL: https://svnweb.freebsd.org/changeset/base/282972

Log:
  Provide the number of interrupt resources added to the list
  by using extra argument, so caller will know that.

Modified:
  head/sys/dev/fdt/simplebus.c
  head/sys/dev/gpio/ofw_gpiobus.c
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h
  head/sys/dev/ofw/ofw_iicbus.c
  head/sys/mips/beri/beri_simplebus.c
  head/sys/powerpc/ofw/ofw_pcibus.c
  head/sys/powerpc/pseries/vdevice.c

Modified: head/sys/dev/fdt/simplebus.c
==
--- head/sys/dev/fdt/simplebus.cFri May 15 13:50:37 2015
(r282971)
+++ head/sys/dev/fdt/simplebus.cFri May 15 13:55:18 2015
(r282972)
@@ -251,7 +251,7 @@ simplebus_setup_dinfo(device_t dev, phan
 
resource_list_init(&ndi->rl);
ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->rl);
-   ofw_bus_intr_to_rl(dev, node, &ndi->rl);
+   ofw_bus_intr_to_rl(dev, node, &ndi->rl, NULL);
 
return (ndi);
 }

Modified: head/sys/dev/gpio/ofw_gpiobus.c
==
--- head/sys/dev/gpio/ofw_gpiobus.c Fri May 15 13:50:37 2015
(r282971)
+++ head/sys/dev/gpio/ofw_gpiobus.c Fri May 15 13:55:18 2015
(r282972)
@@ -147,7 +147,7 @@ ofw_gpiobus_setup_devinfo(device_t bus, 
}
free(pins, M_DEVBUF);
/* Parse the interrupt resources. */
-   if (ofw_bus_intr_to_rl(bus, node, &dinfo->opd_dinfo.rl) != 0) {
+   if (ofw_bus_intr_to_rl(bus, node, &dinfo->opd_dinfo.rl, NULL) != 0) {
ofw_gpiobus_destroy_devinfo(bus, dinfo);
return (NULL);
}

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Fri May 15 13:50:37 2015
(r282971)
+++ head/sys/dev/ofw/ofw_bus_subr.c Fri May 15 13:55:18 2015
(r282972)
@@ -430,7 +430,8 @@ ofw_bus_reg_to_rl(device_t dev, phandle_
 }
 
 int
-ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl)
+ofw_bus_intr_to_rl(device_t dev, phandle_t node,
+struct resource_list *rl, int *rlen)
 {
phandle_t iparent;
uint32_t icells, *intr;
@@ -495,6 +496,8 @@ ofw_bus_intr_to_rl(device_t dev, phandle
irqnum = ofw_bus_map_intr(dev, iparent, icells, &intr[i]);
resource_list_add(rl, SYS_RES_IRQ, rid++, irqnum, irqnum, 1);
}
+   if (rlen != NULL)
+   *rlen = rid;
free(intr, M_OFWPROP);
return (err);
 }

Modified: head/sys/dev/ofw/ofw_bus_subr.h
==
--- head/sys/dev/ofw/ofw_bus_subr.h Fri May 15 13:50:37 2015
(r282971)
+++ head/sys/dev/ofw/ofw_bus_subr.h Fri May 15 13:55:18 2015
(r282972)
@@ -75,7 +75,7 @@ int   ofw_bus_search_intrmap(void *, int, 
 /* Routines for parsing device-tree data into resource lists. */
 int ofw_bus_reg_to_rl(device_t, phandle_t, pcell_t, pcell_t,
 struct resource_list *);
-int ofw_bus_intr_to_rl(device_t, phandle_t, struct resource_list *);
+int ofw_bus_intr_to_rl(device_t, phandle_t, struct resource_list *, int *);
 
 /* Helper to get device status property */
 const char *ofw_bus_get_status(device_t dev);

Modified: head/sys/dev/ofw/ofw_iicbus.c
==
--- head/sys/dev/ofw/ofw_iicbus.c   Fri May 15 13:50:37 2015
(r282971)
+++ head/sys/dev/ofw/ofw_iicbus.c   Fri May 15 13:55:18 2015
(r282972)
@@ -156,7 +156,8 @@ ofw_iicbus_attach(device_t dev)
 
childdev = device_add_child(dev, NULL, -1);
resource_list_init(&dinfo->opd_dinfo.rl);
-   ofw_bus_intr_to_rl(childdev, child, &dinfo->opd_dinfo.rl);
+   ofw_bus_intr_to_rl(childdev, child,
+   &dinfo->opd_dinfo.rl, NULL);
device_set_ivars(childdev, dinfo);
}
 

Modified: head/sys/mips/beri/beri_simplebus.c
==
--- head/sys/mips/beri/beri_simplebus.c Fri May 15 13:50:37 2015
(r282971)
+++ head/sys/mips/beri/beri_simplebus.c Fri May 15 13:55:18 2015
(r282972)
@@ -198,7 +198,7 @@ simplebus_attach(device_t dev)
continue;
}
 
-   if (ofw_bus_intr_to_rl(dev, dt_child, &di->di_res)) {
+   if (ofw_bus_intr_to_rl(dev, dt_child, &di->di_res, NULL)) {
device_printf(dev, "%s: could not process "
"'interrupts' property\n", di->di_ofw.obd_name);
resource_list_free(&di->di_res);

Modified: head/sys/powerpc/ofw/ofw_pcibus.c
=

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

2015-05-15 Thread John Baldwin
Author: jhb
Date: Fri May 15 13:50:37 2015
New Revision: 282971
URL: https://svnweb.freebsd.org/changeset/base/282971

Log:
  Previously, cv_waiters was only updated by cv_signal or cv_wait. If a
  thread awakened due to a time out, then cv_waiters was not decremented.
  If INT_MAX threads timed out on a cv without an intervening cv_broadcast,
  then cv_waiters could overflow. To fix this, have each sleeping thread
  decrement cv_waiters when it resumes.
  
  Note that previously cv_waiters was protected by the sleepq chain lock.
  However, that lock is not held when threads resume from sleep. In
  addition, the interlock is also not always reacquired after resuming
  (cv_wait_unlock), nor is it always held by callers of cv_signal() or
  cv_broadcast(). Instead, use atomic ops to update cv_waiters. Since
  the sleepq chain lock is still held on every increment, it should
  still be safe to compare cv_waiters against zero while holding the
  lock in the wakeup routines as the only way the race should be lost
  would result in extra calls to sleepq_signal() or sleepq_broadcast().
  
  Differential Revision:https://reviews.freebsd.org/D2427
  Reviewed by:  benno
  Reported by:  benno (wrap of cv_waiters in the field)
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_condvar.c
  head/sys/sys/condvar.h

Modified: head/sys/kern/kern_condvar.c
==
--- head/sys/kern/kern_condvar.cFri May 15 13:36:50 2015
(r282970)
+++ head/sys/kern/kern_condvar.cFri May 15 13:50:37 2015
(r282971)
@@ -122,7 +122,7 @@ _cv_wait(struct cv *cvp, struct lock_obj
 
sleepq_lock(cvp);
 
-   cvp->cv_waiters++;
+   atomic_add_int(&cvp->cv_waiters, 1);
if (lock == &Giant.lock_object)
mtx_assert(&Giant, MA_OWNED);
DROP_GIANT();
@@ -137,6 +137,7 @@ _cv_wait(struct cv *cvp, struct lock_obj
sleepq_lock(cvp);
}
sleepq_wait(cvp, 0);
+   atomic_subtract_int(&cvp->cv_waiters, 1);
 
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
@@ -184,7 +185,7 @@ _cv_wait_unlock(struct cv *cvp, struct l
 
sleepq_lock(cvp);
 
-   cvp->cv_waiters++;
+   atomic_add_int(&cvp->cv_waiters, 1);
DROP_GIANT();
 
sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR, 0);
@@ -194,6 +195,7 @@ _cv_wait_unlock(struct cv *cvp, struct l
if (class->lc_flags & LC_SLEEPABLE)
sleepq_lock(cvp);
sleepq_wait(cvp, 0);
+   atomic_subtract_int(&cvp->cv_waiters, 1);
 
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
@@ -240,7 +242,7 @@ _cv_wait_sig(struct cv *cvp, struct lock
 
sleepq_lock(cvp);
 
-   cvp->cv_waiters++;
+   atomic_add_int(&cvp->cv_waiters, 1);
if (lock == &Giant.lock_object)
mtx_assert(&Giant, MA_OWNED);
DROP_GIANT();
@@ -256,6 +258,7 @@ _cv_wait_sig(struct cv *cvp, struct lock
sleepq_lock(cvp);
}
rval = sleepq_wait_sig(cvp, 0);
+   atomic_subtract_int(&cvp->cv_waiters, 1);
 
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
@@ -307,7 +310,7 @@ _cv_timedwait_sbt(struct cv *cvp, struct
 
sleepq_lock(cvp);
 
-   cvp->cv_waiters++;
+   atomic_add_int(&cvp->cv_waiters, 1);
if (lock == &Giant.lock_object)
mtx_assert(&Giant, MA_OWNED);
DROP_GIANT();
@@ -323,6 +326,7 @@ _cv_timedwait_sbt(struct cv *cvp, struct
sleepq_lock(cvp);
}
rval = sleepq_timedwait(cvp, 0);
+   atomic_subtract_int(&cvp->cv_waiters, 1);
 
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
@@ -376,7 +380,7 @@ _cv_timedwait_sig_sbt(struct cv *cvp, st
 
sleepq_lock(cvp);
 
-   cvp->cv_waiters++;
+   atomic_add_int(&cvp->cv_waiters, 1);
if (lock == &Giant.lock_object)
mtx_assert(&Giant, MA_OWNED);
DROP_GIANT();
@@ -393,6 +397,7 @@ _cv_timedwait_sig_sbt(struct cv *cvp, st
sleepq_lock(cvp);
}
rval = sleepq_timedwait_sig(cvp, 0);
+   atomic_subtract_int(&cvp->cv_waiters, 1);
 
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
@@ -421,10 +426,8 @@ cv_signal(struct cv *cvp)
 
wakeup_swapper = 0;
sleepq_lock(cvp);
-   if (cvp->cv_waiters > 0) {
-   cvp->cv_waiters--;
+   if (cvp->cv_waiters > 0)
wakeup_swapper = sleepq_signal(cvp, SLEEPQ_CONDVAR, 0, 0);
-   }
sleepq_release(cvp);
if (wakeup_swapper)
kick_proc0();
@@ -447,10 +450,8 @@ cv_broadcastpri(struct cv *cvp, int pri)
if (pri == -1)
pri = 0;
sleepq_lock(cvp);
-   if (cvp->cv_waiters > 0) {
-   cvp->cv_waiters = 0;
+   if (cvp->cv_waiters > 0)
wakeup_swapper = sleepq_broadcast(cvp, SLEEPQ_CONDVAR, pri, 0);
-   }
sleepq_release(cvp);
if (wake

svn commit: r282970 - head/sys/dev/iscsi

2015-05-15 Thread Alexander Motin
Author: mav
Date: Fri May 15 13:36:50 2015
New Revision: 282970
URL: https://svnweb.freebsd.org/changeset/base/282970

Log:
  Close some potential races around socket start/close.
  
  There are some reports about panics on ic->ic_socket NULL derefence.
  This kind of races is the only way I can imagine it to happen.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/iscsi/icl_soft.c

Modified: head/sys/dev/iscsi/icl_soft.c
==
--- head/sys/dev/iscsi/icl_soft.c   Fri May 15 13:04:14 2015
(r282969)
+++ head/sys/dev/iscsi/icl_soft.c   Fri May 15 13:36:50 2015
(r282970)
@@ -773,10 +773,6 @@ icl_receive_thread(void *arg)
ic = arg;
so = ic->ic_socket;
 
-   ICL_CONN_LOCK(ic);
-   ic->ic_receive_running = true;
-   ICL_CONN_UNLOCK(ic);
-
for (;;) {
if (ic->ic_disconnecting) {
//ICL_DEBUG("terminating");
@@ -998,8 +994,6 @@ icl_send_thread(void *arg)
STAILQ_INIT(&queue);
 
ICL_CONN_LOCK(ic);
-   ic->ic_send_running = true;
-
for (;;) {
for (;;) {
/*
@@ -1275,35 +1269,45 @@ icl_conn_start(struct icl_conn *ic)
}
 
/*
+* Register socket upcall, to get notified about incoming PDUs
+* and free space to send outgoing ones.
+*/
+   SOCKBUF_LOCK(&ic->ic_socket->so_snd);
+   soupcall_set(ic->ic_socket, SO_SND, icl_soupcall_send, ic);
+   SOCKBUF_UNLOCK(&ic->ic_socket->so_snd);
+   SOCKBUF_LOCK(&ic->ic_socket->so_rcv);
+   soupcall_set(ic->ic_socket, SO_RCV, icl_soupcall_receive, ic);
+   SOCKBUF_UNLOCK(&ic->ic_socket->so_rcv);
+
+   /*
 * Start threads.
 */
+   ICL_CONN_LOCK(ic);
+   ic->ic_send_running = ic->ic_receive_running = true;
+   ICL_CONN_UNLOCK(ic);
error = kthread_add(icl_send_thread, ic, NULL, NULL, 0, 0, "%stx",
ic->ic_name);
if (error != 0) {
ICL_WARN("kthread_add(9) failed with error %d", error);
+   ICL_CONN_LOCK(ic);
+   ic->ic_send_running = ic->ic_receive_running = false;
+   cv_signal(&ic->ic_send_cv);
+   ICL_CONN_UNLOCK(ic);
icl_soft_conn_close(ic);
return (error);
}
-
error = kthread_add(icl_receive_thread, ic, NULL, NULL, 0, 0, "%srx",
ic->ic_name);
if (error != 0) {
ICL_WARN("kthread_add(9) failed with error %d", error);
+   ICL_CONN_LOCK(ic);
+   ic->ic_receive_running = false;
+   cv_signal(&ic->ic_send_cv);
+   ICL_CONN_UNLOCK(ic);
icl_soft_conn_close(ic);
return (error);
}
 
-   /*
-* Register socket upcall, to get notified about incoming PDUs
-* and free space to send outgoing ones.
-*/
-   SOCKBUF_LOCK(&ic->ic_socket->so_snd);
-   soupcall_set(ic->ic_socket, SO_SND, icl_soupcall_send, ic);
-   SOCKBUF_UNLOCK(&ic->ic_socket->so_snd);
-   SOCKBUF_LOCK(&ic->ic_socket->so_rcv);
-   soupcall_set(ic->ic_socket, SO_RCV, icl_soupcall_receive, ic);
-   SOCKBUF_UNLOCK(&ic->ic_socket->so_rcv);
-
return (0);
 }
 
@@ -1357,46 +1361,42 @@ void
 icl_soft_conn_close(struct icl_conn *ic)
 {
struct icl_pdu *pdu;
+   struct socket *so;
 
-   ICL_CONN_LOCK_ASSERT_NOT(ic);
-
-   ICL_CONN_LOCK(ic);
-   if (ic->ic_socket == NULL) {
-   ICL_CONN_UNLOCK(ic);
-   return;
-   }
-
-   /*
-* Deregister socket upcalls.
-*/
-   ICL_CONN_UNLOCK(ic);
-   SOCKBUF_LOCK(&ic->ic_socket->so_snd);
-   if (ic->ic_socket->so_snd.sb_upcall != NULL)
-   soupcall_clear(ic->ic_socket, SO_SND);
-   SOCKBUF_UNLOCK(&ic->ic_socket->so_snd);
-   SOCKBUF_LOCK(&ic->ic_socket->so_rcv);
-   if (ic->ic_socket->so_rcv.sb_upcall != NULL)
-   soupcall_clear(ic->ic_socket, SO_RCV);
-   SOCKBUF_UNLOCK(&ic->ic_socket->so_rcv);
ICL_CONN_LOCK(ic);
 
-   ic->ic_disconnecting = true;
-
/*
 * Wake up the threads, so they can properly terminate.
 */
+   ic->ic_disconnecting = true;
while (ic->ic_receive_running || ic->ic_send_running) {
-   //ICL_DEBUG("waiting for send/receive threads to terminate");
cv_signal(&ic->ic_receive_cv);
cv_signal(&ic->ic_send_cv);
cv_wait(&ic->ic_send_cv, ic->ic_lock);
}
-   //ICL_DEBUG("send/receive threads terminated");
 
+   /* Some other thread could close the connection same time. */
+   so = ic->ic_socket;
+   if (so == NULL) {
+   ICL_CONN_UNLOCK(ic);
+   return;
+   }
+   ic->ic_socket = NULL;
+
+   /*
+* Deregister socket upcalls.
+*/
ICL_CONN_UNLOCK(ic);
-

svn commit: r282969 - head/share/man/man4

2015-05-15 Thread Jason A. Harmening
Author: jah
Date: Fri May 15 13:04:14 2015
New Revision: 282969
URL: https://svnweb.freebsd.org/changeset/base/282969

Log:
  Bump date for iic.4

Modified:
  head/share/man/man4/iic.4

Modified: head/share/man/man4/iic.4
==
--- head/share/man/man4/iic.4   Fri May 15 12:35:18 2015(r282968)
+++ head/share/man/man4/iic.4   Fri May 15 13:04:14 2015(r282969)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 24, 2014
+.Dd May 15, 2015
 .Dt IIC 4
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282968 - stable/10/sys/netinet

2015-05-15 Thread Julien Charbon
Author: jch
Date: Fri May 15 12:35:18 2015
New Revision: 282968
URL: https://svnweb.freebsd.org/changeset/base/282968

Log:
  MFC r279821:
  
  In TCP, connect() can return incorrect error code EINVAL
  instead of EADDRINUSE or ECONNREFUSED
  
  PR: 196035
  Differential Revision:  https://reviews.freebsd.org/D1982
  Reported by:Mark Nunberg 
  Submitted by:   Harrison Grundy 

  Reviewed by:adrian, jch, glebius, gnn
  Approved by:jhb

Modified:
  stable/10/sys/netinet/tcp_usrreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_usrreq.c
==
--- stable/10/sys/netinet/tcp_usrreq.c  Fri May 15 12:32:17 2015
(r282967)
+++ stable/10/sys/netinet/tcp_usrreq.c  Fri May 15 12:35:18 2015
(r282968)
@@ -475,8 +475,12 @@ tcp_usr_connect(struct socket *so, struc
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL"));
INP_WLOCK(inp);
-   if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
-   error = EINVAL;
+   if (inp->inp_flags & INP_TIMEWAIT) {
+   error = EADDRINUSE;
+   goto out;
+   }
+   if (inp->inp_flags & INP_DROPPED) {
+   error = ECONNREFUSED;
goto out;
}
tp = intotcpcb(inp);
@@ -522,8 +526,12 @@ tcp6_usr_connect(struct socket *so, stru
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL"));
INP_WLOCK(inp);
-   if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
-   error = EINVAL;
+   if (inp->inp_flags & INP_TIMEWAIT) {
+   error = EADDRINUSE;
+   goto out;
+   }
+   if (inp->inp_flags & INP_DROPPED) {
+   error = ECONNREFUSED;
goto out;
}
tp = intotcpcb(inp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282967 - head/sbin/ifconfig

2015-05-15 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri May 15 12:32:17 2015
New Revision: 282967
URL: https://svnweb.freebsd.org/changeset/base/282967

Log:
  Simplify i2c reader: we don't need per-NIC handler anymore.
  Make code use read_i2c() function instead of callback.
  Simplify&document struct i2c_info.
  Consistently use uint8_t to read from i2c.

Modified:
  head/sbin/ifconfig/sfp.c

Modified: head/sbin/ifconfig/sfp.c
==
--- head/sbin/ifconfig/sfp.cFri May 15 12:28:17 2015(r282966)
+++ head/sbin/ifconfig/sfp.cFri May 15 12:32:17 2015(r282967)
@@ -48,25 +48,16 @@ static const char rcsid[] =
 
 #include "ifconfig.h"
 
-struct i2c_info;
-typedef int (read_i2c)(struct i2c_info *ii, uint8_t addr, uint8_t off,
-uint8_t len, caddr_t buf);
-
 struct i2c_info {
-   int s;
-   int error;
-   int bshift;
-   int qsfp;
-   int do_diag;
-   struct ifreq *ifr;
-   read_i2c *f;
-   char *textbuf;
-   size_t bufsize;
-   int cfd;
-   int port_id;
-   int chip_id;
+   int fd; /* fd to issue SIOCGI2C */
+   int error;  /* Store first error */
+   int qsfp;   /* True if transceiver is QSFP */
+   int do_diag;/* True if we need to request DDM */
+   struct ifreq *ifr;  /* Pointer to pre-filled ifreq */
 };
 
+static int read_i2c(struct i2c_info *ii, uint8_t addr, uint8_t off,
+uint8_t len, uint8_t *buf);
 static void dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off,
 uint8_t len);
 
@@ -259,7 +250,7 @@ get_sfp_identifier(struct i2c_info *ii, 
 {
uint8_t data;
 
-   ii->f(ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&data);
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_ID, 1, &data);
convert_sff_identifier(buf, size, data);
 }
 
@@ -268,7 +259,7 @@ get_sfp_connector(struct i2c_info *ii, c
 {
uint8_t data;
 
-   ii->f(ii, SFF_8472_BASE, SFF_8472_CONNECTOR, 1, (caddr_t)&data);
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_CONNECTOR, 1, &data);
convert_sff_connector(buf, size, data);
 }
 
@@ -277,7 +268,7 @@ get_qsfp_identifier(struct i2c_info *ii,
 {
uint8_t data;
 
-   ii->f(ii, SFF_8436_BASE, SFF_8436_ID, 1, (caddr_t)&data);
+   read_i2c(ii, SFF_8436_BASE, SFF_8436_ID, 1, &data);
convert_sff_identifier(buf, size, data);
 }
 
@@ -286,7 +277,7 @@ get_qsfp_connector(struct i2c_info *ii, 
 {
uint8_t data;
 
-   ii->f(ii, SFF_8436_BASE, SFF_8436_CONNECTOR, 1, (caddr_t)&data);
+   read_i2c(ii, SFF_8436_BASE, SFF_8436_CONNECTOR, 1, &data);
convert_sff_connector(buf, size, data);
 }
 
@@ -303,7 +294,7 @@ printf_sfp_transceiver_descr(struct i2c_
tech_speed = NULL;
 
/* Read bytes 3-10 at once */
-   ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, &xbuf[3]);
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, &xbuf[3]);
 
/* Check 10G ethernet first */
tech_class = find_zero_bit(eth_10g, xbuf[3], 1);
@@ -331,14 +322,14 @@ get_sfp_transceiver_class(struct i2c_inf
uint8_t code;
 
unsigned char qbuf[8];
-   ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (caddr_t)qbuf);
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (uint8_t *)qbuf);
 
/* Check 10G Ethernet/IB first */
-   ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, (caddr_t)&code);
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, &code);
tech_class = find_zero_bit(eth_10g, code, 1);
if (tech_class == NULL) {
/* No match. Try Ethernet 1G */
-   ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START + 3,
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START + 3,
1, (caddr_t)&code);
tech_class = find_zero_bit(eth_compat, code, 1);
}
@@ -356,7 +347,7 @@ get_qsfp_transceiver_class(struct i2c_in
uint8_t code;
 
/* Check 10/40G Ethernet class only */
-   ii->f(ii, SFF_8436_BASE, SFF_8436_CODE_E1040G, 1, (caddr_t)&code);
+   read_i2c(ii, SFF_8436_BASE, SFF_8436_CODE_E1040G, 1, &code);
tech_class = find_zero_bit(eth_1040g, code, 1);
if (tech_class == NULL)
tech_class = "Unknown";
@@ -393,7 +384,7 @@ get_sfp_vendor_name(struct i2c_info *ii,
char xbuf[17];
 
memset(xbuf, 0, sizeof(xbuf));
-   ii->f(ii, SFF_8472_BASE, SFF_8472_VENDOR_START, 16, xbuf);
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_VENDOR_START, 16, (uint8_t *)xbuf);
convert_sff_name(buf, size, xbuf);
 }
 
@@ -403,7 +394,7 @@ get_sfp_vendor_pn(struct i2c_info *ii, c
char xbuf[17];
 
memset(xbuf, 0, sizeof(xbuf));
-   ii->f(ii, SFF_8472_BASE, SFF_8472_PN_START, 16, xbuf);
+   read_i2c(ii, SFF_8472_BASE, SFF_8472_PN_START, 16, (uint8_t *)xbuf);
convert_sff_name(buf, size, xbuf);
 }
 
@@ -413,7 +404,7 @@ get_sfp_vendo

svn commit: r282966 - head/share/man/man4

2015-05-15 Thread Jason A. Harmening
Author: jah
Date: Fri May 15 12:28:17 2015
New Revision: 282966
URL: https://svnweb.freebsd.org/changeset/base/282966

Log:
  Update iic(4) man page to reflect recent changes
  
  Differential Revision:https://reviews.freebsd.org/D2461
  Reviewed by:  wblock
  Approved by:  kib (mentor)

Modified:
  head/share/man/man4/iic.4

Modified: head/share/man/man4/iic.4
==
--- head/share/man/man4/iic.4   Fri May 15 12:19:45 2015(r282965)
+++ head/share/man/man4/iic.4   Fri May 15 12:28:17 2015(r282966)
@@ -54,10 +54,12 @@ element to the bus.
 The
 .Va slave
 element consists of a 7-bit address and a read/write bit
-(i.e., 7-bit address << 1 | r/w).
-If the read/write bit is set a read operation is initiated, if the read/write
-bit is cleared a write operation is initiated.
+(that is, a 7-bit address << 1 | r/w).
+A read operation is initiated when the read/write bit is set, or a write
+operation when it is cleared.
 All other elements are ignored.
+If successful, the file descriptor receives exclusive
+ownership of the underlying iicbus instance.
 .It Dv I2CRPTSTART
 .Pq Vt "struct iiccmd"
 Sends the repeated start condition to the slave specified by the
@@ -66,19 +68,33 @@ element to the bus.
 The slave address should be specified as in
 .Dv I2CSTART .
 All other elements are ignored.
+.Dv I2CSTART
+must have previously been issued on the same file descriptor.
 .It Dv I2CSTOP
 No argument is passed.
 Sends the stop condition to the bus.
-This terminates the current transaction.
+If
+.Dv I2CSTART
+was previously issued on the file descriptor, the current transaction is
+terminated and exclusive ownership of the underlying iicbus instance is
+released.
+Otherwise, no action is performed.
 .It Dv I2CRSTCARD
 .Pq Vt "struct iiccmd"
 Resets the bus.
 The argument is completely ignored.
+This command does not require
+.Dv I2CSTART
+to have been previously issued on the file descriptor.
+If it was previously issued, exclusive ownership of the underlying iicbus
+instance is released.
 .It Dv I2CWRITE
 .Pq Vt "struct iiccmd"
 Writes data to the
 .Xr iicbus 4 .
-The bus should already be started.
+The bus must already be started by a previous
+.Dv I2CSTART
+on the file descriptor.
 The
 .Va slave
 element is ignored.
@@ -96,7 +112,9 @@ element is a pointer to the data to writ
 .Pq Vt "struct iiccmd"
 Reads data from the
 .Xr iicbus 4 .
-The bus should already be started.
+The bus must already be started by a previous
+.Dv I2CSTART
+on the file descriptor.
 The
 .Va slave
 element is ignored.
@@ -116,6 +134,15 @@ Short reads on the bus produce undefined
 Generic read/write interface.
 Allows for an arbitrary number of commands to be sent to
 an arbitrary number of devices on the bus.
+Any previous transaction started by
+.Dv I2CSTART
+must be terminated by
+.Dv I2CSTOP
+or
+.Dv I2CRSTCARD
+before
+.Dv I2CRDWR
+can be issued on the same file descriptor.
 A read transfer is specified if
 .Dv IIC_M_RD
 is set in
@@ -138,6 +165,17 @@ element is a buffer for that data.
 This ioctl is intended to be
 .Tn Linux
 compatible.
+.It Dv I2CSADDR
+.Pq Vt "uint8_t"
+Associate the specified address with the file descriptor for use by
+subsequent
+.Xr read 2
+or
+.Xr write 2
+calls.
+The argument is an 8-bit address (that is, a 7-bit address << 1).
+The read/write bit in the least-significant position is ignored.
+Any subsequent read or write operation will set or clear that bit as needed.
 .El
 .Pp
 The following data structures are defined in
@@ -156,7 +194,10 @@ struct iic_msg
 {
uint16_tslave;
uint16_tflags;
-#define IIC_M_RD   0x0001  /* read vs write */
+#defineIIC_M_WR0   /* Fake flag for write */
+#defineIIC_M_RD0x0001  /* read vs write */
+#defineIIC_M_NOSTOP0x0002  /* do not send a I2C stop after message 
*/
+#defineIIC_M_NOSTART   0x0004  /* do not send a I2C start before 
message */
uint16_tlen;/* msg length */
uint8_t *   buf;
 };
@@ -167,15 +208,37 @@ struct iic_rdwr_data {
 };
 .Ed
 .Pp
-It is also possible to use read/write routines, then I2C start/stop handshake 
is
-managed by the
-.Xr iicbus 4
-system.
-However, the address used for the read/write routines is the one
-passed to last
+It is also possible to use
+.Xr read 2
+or
+.Xr write 2 ,
+in which case the I2C start/stop handshake is managed by
+.Xr iicbus 4 .
+The address used for the read/write operation is the one passed to the most
+recent
 .Dv I2CSTART
 .Xr ioctl 2
-to this device.
+or
+.Dv I2CSADDR
+.Xr ioctl 2
+on the open
+.Pa /dev/iic?
+file descriptor.
+Closing the file descriptor clears any addressing state established by a
+previous
+.Dv I2CSTART
+or
+.Dv I2CSADDR ,
+stops any transaction established by a not-yet-terminated
+.Dv I2CSTART ,
+and releases iicbus ownership.
+Because addressing state is stored on a per-file-descriptor basis,

svn commit: r282965 - in head: sbin/ifconfig sys/net sys/netinet sys/netinet6

2015-05-15 Thread Andrey V. Elsukov
Author: ae
Date: Fri May 15 12:19:45 2015
New Revision: 282965
URL: https://svnweb.freebsd.org/changeset/base/282965

Log:
  Add an ability accept encapsulated packets from different sources by one
  gif(4) interface. Add new option "ignore_source" for gif(4) interface.
  When it is enabled, gif's encapcheck function requires match only for
  packet's destination address.
  
  Differential Revision:https://reviews.freebsd.org/D2004
  Obtained from:Yandex LLC
  MFC after:2 weeks
  Sponsored by: Yandex LLC

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/ifgif.c
  head/sys/net/if_gif.h
  head/sys/netinet/in_gif.c
  head/sys/netinet6/in6_gif.c

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Fri May 15 12:07:43 2015
(r282964)
+++ head/sbin/ifconfig/ifconfig.8   Fri May 15 12:19:45 2015
(r282965)
@@ -28,7 +28,7 @@
 .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd May 12, 2015
+.Dd May 15, 2015
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2428,6 +2428,14 @@ This is for backward compatibility with
 .It Cm -accept_rev_ethip_ver
 Clear a flag
 .Cm accept_rev_ethip_ver .
+.It Cm ignore_source
+Set a flag to accept encapsulated packets destined to this host
+independently from source address.
+This may be useful for hosts, that receive encapsulated packets
+from the load balancers.
+.It Cm -ignore_source
+Clear a flag
+.Cm ignore_source .
 .It Cm send_rev_ethip_ver
 Set a flag to send EtherIP packets with reversed version
 field intentionally.

Modified: head/sbin/ifconfig/ifgif.c
==
--- head/sbin/ifconfig/ifgif.c  Fri May 15 12:07:43 2015(r282964)
+++ head/sbin/ifconfig/ifgif.c  Fri May 15 12:19:45 2015(r282965)
@@ -51,7 +51,7 @@ static const char rcsid[] =
 
 #include "ifconfig.h"
 
-#defineGIFBITS "\020\1ACCEPT_REV_ETHIP_VER\5SEND_REV_ETHIP_VER"
+#defineGIFBITS 
"\020\1ACCEPT_REV_ETHIP_VER\2IGNORE_SOURCE\5SEND_REV_ETHIP_VER"
 
 static voidgif_status(int);
 
@@ -95,6 +95,8 @@ setgifopts(const char *val,
 static struct cmd gif_cmds[] = {
DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP,setgifopts),
DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP,   setgifopts),
+   DEF_CMD("ignore_source",GIF_IGNORE_SOURCE,  setgifopts),
+   DEF_CMD("-ignore_source",   -GIF_IGNORE_SOURCE, setgifopts),
DEF_CMD("send_rev_ethip_ver",   GIF_SEND_REVETHIP,  setgifopts),
DEF_CMD("-send_rev_ethip_ver",  -GIF_SEND_REVETHIP, setgifopts),
 };

Modified: head/sys/net/if_gif.h
==
--- head/sys/net/if_gif.h   Fri May 15 12:07:43 2015(r282964)
+++ head/sys/net/if_gif.h   Fri May 15 12:19:45 2015(r282965)
@@ -127,7 +127,9 @@ int in6_gif_attach(struct gif_softc *);
 #define GIFSOPTS   _IOW('i', 151, struct ifreq)
 
 #defineGIF_ACCEPT_REVETHIP 0x0001
+#defineGIF_IGNORE_SOURCE   0x0002
 #defineGIF_SEND_REVETHIP   0x0010
-#defineGIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)
+#defineGIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP| 
\
+GIF_IGNORE_SOURCE)
 
 #endif /* _NET_IF_GIF_H_ */

Modified: head/sys/netinet/in_gif.c
==
--- head/sys/netinet/in_gif.c   Fri May 15 12:07:43 2015(r282964)
+++ head/sys/netinet/in_gif.c   Fri May 15 12:19:45 2015(r282965)
@@ -168,13 +168,19 @@ in_gif_input(struct mbuf **mp, int *offp
 static int
 gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp)
 {
+   int ret;
 
GIF_RLOCK_ASSERT(sc);
 
/* check for address match */
-   if (sc->gif_iphdr->ip_src.s_addr != ip->ip_dst.s_addr ||
-   sc->gif_iphdr->ip_dst.s_addr != ip->ip_src.s_addr)
+   if (sc->gif_iphdr->ip_src.s_addr != ip->ip_dst.s_addr)
return (0);
+   ret = 32;
+   if (sc->gif_iphdr->ip_dst.s_addr != ip->ip_src.s_addr) {
+   if ((sc->gif_options & GIF_IGNORE_SOURCE) == 0)
+   return (0);
+   } else
+   ret += 32;
 
/* martian filters on outer source - NOT done in ip_input! */
if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)))
@@ -205,7 +211,7 @@ gif_validate4(const struct ip *ip, struc
}
RTFREE_LOCKED(rt);
}
-   return (32 * 2);
+   return (ret);
 }
 
 /*

Modified: head/sys/netinet6/in6_gif.c
==
--- head/sys/netinet6/in6_gif.c Fri May 15 12:07:43 2015(r282964)
+++ head/sys/netinet6/in6_gif.c Fri May 15 12:19:45 2015(r282965)
@@ -180,6 +180,7 

svn commit: r282964 - stable/10/sys/netinet

2015-05-15 Thread Julien Charbon
Author: jch
Date: Fri May 15 12:07:43 2015
New Revision: 282964
URL: https://svnweb.freebsd.org/changeset/base/282964

Log:
  MFC: r280904, r280990, r281599
  
  r280904:
  Use appropriate timeout_t* instead of void* in tcp_timer_activate()
  
  Suggested by:   imp
  Differential Revision:  https://reviews.freebsd.org/D2154
  Reviewed by:imp, jhb
  Approved by:jhb
  
  r280990:
  Provide better debugging information in tcp_timer_activate() and
  tcp_timer_active()
  
  Differential Revision:  https://reviews.freebsd.org/D2179
  Suggested by:   bz
  Reviewed by:jhb
  Approved by:jhb
  
  r281599:
  Fix an old and well-documented use-after-free race condition in
  TCP timers:
   - Add a reference from tcpcb to its inpcb
   - Defer tcpcb deletion until TCP timers have finished
  
  Differential Revision:  https://reviews.freebsd.org/D2079
  Submitted by:   jch, Marc De La Gueronniere 

  Reviewed by:imp, rrs, adrian, jhb, bz
  Approved by:jhb
  Sponsored by:   Verisign, Inc.

Modified:
  stable/10/sys/netinet/tcp_subr.c
  stable/10/sys/netinet/tcp_timer.c
  stable/10/sys/netinet/tcp_timer.h
  stable/10/sys/netinet/tcp_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_subr.c
==
--- stable/10/sys/netinet/tcp_subr.cFri May 15 11:10:01 2015
(r282963)
+++ stable/10/sys/netinet/tcp_subr.cFri May 15 12:07:43 2015
(r282964)
@@ -230,6 +230,7 @@ static struct inpcb *tcp_notify(struct i
 static struct inpcb *tcp_mtudisc_notify(struct inpcb *, int);
 static char *  tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th,
void *ip4hdr, const void *ip6hdr);
+static voidtcp_timer_discard(struct tcpcb *, uint32_t);
 
 /*
  * Target size of TCP PCB hash tables. Must be a power of two.
@@ -790,7 +791,13 @@ tcp_newtcpcb(struct inpcb *inp)
if (V_tcp_do_sack)
tp->t_flags |= TF_SACK_PERMIT;
TAILQ_INIT(&tp->snd_holes);
-   tp->t_inpcb = inp;  /* XXX */
+   /*
+* The tcpcb will hold a reference on its inpcb until tcp_discardcb()
+* is called.
+*/
+   in_pcbref(inp); /* Reference for tcpcb */
+   tp->t_inpcb = inp;
+
/*
 * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no
 * rtt estimate.  Set rttvar so that srtt + 4 * rttvar gives
@@ -909,6 +916,7 @@ tcp_discardcb(struct tcpcb *tp)
 #ifdef INET6
int isipv6 = (inp->inp_vflag & INP_IPV6) != 0;
 #endif /* INET6 */
+   int released;
 
INP_WLOCK_ASSERT(inp);
 
@@ -916,22 +924,15 @@ tcp_discardcb(struct tcpcb *tp)
 * Make sure that all of our timers are stopped before we delete the
 * PCB.
 *
-* XXXRW: Really, we would like to use callout_drain() here in order
-* to avoid races experienced in tcp_timer.c where a timer is already
-* executing at this point.  However, we can't, both because we're
-* running in a context where we can't sleep, and also because we
-* hold locks required by the timers.  What we instead need to do is
-* test to see if callout_drain() is required, and if so, defer some
-* portion of the remainder of tcp_discardcb() to an asynchronous
-* context that can callout_drain() and then continue.  Some care
-* will be required to ensure that no further processing takes place
-* on the tcpcb, even though it hasn't been freed (a flag?).
-*/
-   callout_stop(&tp->t_timers->tt_rexmt);
-   callout_stop(&tp->t_timers->tt_persist);
-   callout_stop(&tp->t_timers->tt_keep);
-   callout_stop(&tp->t_timers->tt_2msl);
-   callout_stop(&tp->t_timers->tt_delack);
+* If stopping a timer fails, we schedule a discard function in same
+* callout, and the last discard function called will take care of
+* deleting the tcpcb.
+*/
+   tcp_timer_stop(tp, TT_REXMT);
+   tcp_timer_stop(tp, TT_PERSIST);
+   tcp_timer_stop(tp, TT_KEEP);
+   tcp_timer_stop(tp, TT_2MSL);
+   tcp_timer_stop(tp, TT_DELACK);
 
/*
 * If we got enough samples through the srtt filter,
@@ -1008,8 +1009,80 @@ tcp_discardcb(struct tcpcb *tp)
 
CC_ALGO(tp) = NULL;
inp->inp_ppcb = NULL;
-   tp->t_inpcb = NULL;
-   uma_zfree(V_tcpcb_zone, tp);
+   if ((tp->t_timers->tt_flags & TT_MASK) == 0) {
+   /* We own the last reference on tcpcb, let's free it. */
+   tp->t_inpcb = NULL;
+   uma_zfree(V_tcpcb_zone, tp);
+   released = in_pcbrele_wlocked(inp);
+   KASSERT(!released, ("%s: inp %p should not have been released "

svn commit: r282963 - stable/10/share/man/man4

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 11:10:01 2015
New Revision: 282963
URL: https://svnweb.freebsd.org/changeset/base/282963

Log:
  MFC r281265:
  
  Add a hint that "device ctl" kind of depends on "device iscsi".
  
  It actually doesn't - "device ctl" automatically pulls in ICL, which
  would normally be a part of iscsi.ko.  However, doing it that way makes
  iscsi.ko unloadable, and building ctl.ko without iscsi.ko (using
  MODULES_OVERRIDE) results in ctl.ko that is unloadable, due to missing
  symbols that would be resolved to iscsi.ko.  And since the symbols
  are named "icl_whatever", it's not obvious that it's iscsi.ko that's
  required.
  
  If there is a better way - let me know.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/share/man/man4/ctl.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/ctl.4
==
--- stable/10/share/man/man4/ctl.4  Fri May 15 11:07:49 2015
(r282962)
+++ stable/10/share/man/man4/ctl.4  Fri May 15 11:10:01 2015
(r282963)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd October 23, 2014
+.Dd April 8, 2015
 .Dt CTL 4
 .Os
 .Sh NAME
@@ -34,6 +34,7 @@ To compile this driver into the kernel,
 place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device iscsi"
 .Cd "device ctl"
 .Ed
 .Pp
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282962 - stable/10/lib/libc/sys

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 11:07:49 2015
New Revision: 282962
URL: https://svnweb.freebsd.org/changeset/base/282962

Log:
  MFC r280983:
  
  Update open(2) to make it more obvious that O_NOCTTY and O_TTY_INIT
  are ignored.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/lib/libc/sys/open.2
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/sys/open.2
==
--- stable/10/lib/libc/sys/open.2   Fri May 15 11:06:10 2015
(r282961)
+++ stable/10/lib/libc/sys/open.2   Fri May 15 11:07:49 2015
(r282962)
@@ -28,7 +28,7 @@
 .\" @(#)open.2 8.2 (Berkeley) 11/16/93
 .\" $FreeBSD$
 .\"
-.Dd February 7, 2013
+.Dd April 2, 2015
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -115,8 +115,8 @@ O_DIRECTeliminate or reduce cache effec
 O_FSYNCsynchronous writes
 O_SYNC synchronous writes
 O_NOFOLLOW do not follow symlinks
-O_NOCTTY   don't assign controlling terminal
-O_TTY_INIT restore default terminal attributes
+O_NOCTTY   ignored
+O_TTY_INIT ignored
 O_DIRECTORYerror if file is not a directory
 O_CLOEXEC  set FD_CLOEXEC upon open
 .Ed
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282961 - stable/10/etc/autofs

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 11:06:10 2015
New Revision: 282961
URL: https://svnweb.freebsd.org/changeset/base/282961

Log:
  MFC r280321:
  
  Make the autofs LDAP script cope with server returning entries with
  ENTRY_ATTRIBUTE (eg cn) after the VALUE_ATTRIBUTE (eg automountInformation),
  instead of before.
  
  PR:   198557
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/etc/autofs/include_ldap
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/autofs/include_ldap
==
--- stable/10/etc/autofs/include_ldap   Fri May 15 11:03:19 2015
(r282960)
+++ stable/10/etc/autofs/include_ldap   Fri May 15 11:06:10 2015
(r282961)
@@ -15,24 +15,41 @@ $1 == "'$ENTRY_ATTRIBUTE':" {
key = $2
 }
 
-$1 == "'$VALUE_ATTRIBUTE':" && key {
-   printf "%s%s", key, OFS
-   key = ""
-   for (i=2; i 0 {
printf "%s%s", key, OFS
-   key = ""
-   for (i=2; ihttp://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282960 - stable/10/sys/fs/fuse

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 11:03:19 2015
New Revision: 282960
URL: https://svnweb.freebsd.org/changeset/base/282960

Log:
  MFC r279536:
  
  Make fuse(4) respect FOPEN_DIRECT_IO.  This is required for correct
  operation of GlusterFS.
  
  PR:   192701
  Submitted by: harsha at harshavardhana.net
  Reviewed by:  kib@
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/fs/fuse/fuse_node.c
  stable/10/sys/fs/fuse/fuse_node.h
  stable/10/sys/fs/fuse/fuse_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/fuse/fuse_node.c
==
--- stable/10/sys/fs/fuse/fuse_node.c   Fri May 15 11:00:12 2015
(r282959)
+++ stable/10/sys/fs/fuse/fuse_node.c   Fri May 15 11:03:19 2015
(r282960)
@@ -273,8 +273,26 @@ fuse_vnode_open(struct vnode *vp, int32_
  * Funcation is called for every vnode open.
  * Merge fuse_open_flags it may be 0
  *
- * XXXIP: Handle FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE
+ * XXXIP: Handle FOPEN_KEEP_CACHE
  */
+/*
+ * Ideally speaking, direct io should be enabled on
+ * fd's but do not see of any way of providing that
+ * this implementation.
+
+ * Also cannot think of a reason why would two
+ * different fd's on same vnode would like
+ * have DIRECT_IO turned on and off. But linux
+ * based implementation works on an fd not an
+ * inode and provides such a feature.
+ *
+ * XXXIP: Handle fd based DIRECT_IO
+ */
+   if (fuse_open_flags & FOPEN_DIRECT_IO) {
+   VTOFUD(vp)->flag |= FN_DIRECTIO;
+   } else {
+   VTOFUD(vp)->flag &= ~FN_DIRECTIO;
+   }
 
if (vnode_vtype(vp) == VREG) {
/* XXXIP prevent getattr, by using cached node size */

Modified: stable/10/sys/fs/fuse/fuse_node.h
==
--- stable/10/sys/fs/fuse/fuse_node.h   Fri May 15 11:00:12 2015
(r282959)
+++ stable/10/sys/fs/fuse/fuse_node.h   Fri May 15 11:03:19 2015
(r282960)
@@ -67,6 +67,7 @@
 #define FN_FLUSHINPROG   0x0040
 #define FN_FLUSHWANT 0x0080
 #define FN_SIZECHANGE0x0100
+#define FN_DIRECTIO  0x0200
 
 struct fuse_vnode_data {
 /** self **/

Modified: stable/10/sys/fs/fuse/fuse_vnops.c
==
--- stable/10/sys/fs/fuse/fuse_vnops.c  Fri May 15 11:00:12 2015
(r282959)
+++ stable/10/sys/fs/fuse/fuse_vnops.c  Fri May 15 11:03:19 2015
(r282960)
@@ -1173,6 +1173,11 @@ fuse_vnop_read(struct vop_read_args *ap)
if (fuse_isdeadfs(vp)) {
return ENXIO;
}
+
+   if (VTOFUD(vp)->flag & FN_DIRECTIO) {
+   ioflag |= IO_DIRECT;
+   }
+
return fuse_io_dispatch(vp, uio, ioflag, cred);
 }
 
@@ -1712,6 +1717,10 @@ fuse_vnop_write(struct vop_write_args *a
}
fuse_vnode_refreshsize(vp, cred);
 
+   if (VTOFUD(vp)->flag & FN_DIRECTIO) {
+   ioflag |= IO_DIRECT;
+   }
+
return fuse_io_dispatch(vp, uio, ioflag, cred);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282959 - stable/10/sbin/mount_fusefs

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 11:00:12 2015
New Revision: 282959
URL: https://svnweb.freebsd.org/changeset/base/282959

Log:
  MFC r279489:
  
  Make the "automounted" flag work for FUSE filesystems.
  
  PR:   192852
  Submitted by: taku at tackymt.homeip.net (earlier version)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sbin/mount_fusefs/mount_fusefs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/mount_fusefs/mount_fusefs.c
==
--- stable/10/sbin/mount_fusefs/mount_fusefs.c  Fri May 15 10:56:22 2015
(r282958)
+++ stable/10/sbin/mount_fusefs/mount_fusefs.c  Fri May 15 11:00:12 2015
(r282959)
@@ -73,6 +73,13 @@ static struct mntopt mopts[] = {
{ "subtype=",0, ALTF_SUBTYPE, 1 },
#define ALTF_SYNC_UNMOUNT 0x80
{ "sync_unmount",0, ALTF_SYNC_UNMOUNT, 1 },
+   /*
+* MOPT_AUTOMOUNTED, included by MOPT_STDOPTS, does not fit into
+* the 'flags' argument to nmount(2).  We have to abuse altflags
+* to pass it, as string, via iovec.
+*/
+   #define ALTF_AUTOMOUNTED 0x100
+   { "automounted",0, ALTF_AUTOMOUNTED, 1 },
/* Linux specific options, we silently ignore them */
{ "fsname=", 0, 0x00, 1 },
{ "fd=", 0, 0x00, 1 },
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282958 - in stable/10/usr.sbin/bluetooth: hccontrol sdpcontrol

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 10:56:22 2015
New Revision: 282958
URL: https://svnweb.freebsd.org/changeset/base/282958

Log:
  MFC r278360:
  
  Make hccontrol(8) and sdpcontrol(8) appear in "man -k bluetooth" output.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/usr.sbin/bluetooth/hccontrol/hccontrol.8
  stable/10/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bluetooth/hccontrol/hccontrol.8
==
--- stable/10/usr.sbin/bluetooth/hccontrol/hccontrol.8  Fri May 15 10:54:40 
2015(r282957)
+++ stable/10/usr.sbin/bluetooth/hccontrol/hccontrol.8  Fri May 15 10:56:22 
2015(r282958)
@@ -25,12 +25,12 @@
 .\" $Id: hccontrol.8,v 1.6 2003/08/06 21:26:38 max Exp $
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2002
+.Dd February 7, 2015
 .Dt HCCONTROL 8
 .Os
 .Sh NAME
 .Nm hccontrol
-.Nd HCI configuration utility
+.Nd Bluetooth HCI configuration utility
 .Sh SYNOPSIS
 .Nm
 .Op Fl hN

Modified: stable/10/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8
==
--- stable/10/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8Fri May 15 
10:54:40 2015(r282957)
+++ stable/10/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8Fri May 15 
10:56:22 2015(r282958)
@@ -25,12 +25,12 @@
 .\" $Id: sdpcontrol.8,v 1.1 2003/09/08 02:27:27 max Exp $
 .\" $FreeBSD$
 .\"
-.Dd September 7, 2003
+.Dd February 7, 2015
 .Dt SDPCONTROL 8
 .Os
 .Sh NAME
 .Nm sdpcontrol
-.Nd SDP query utility
+.Nd Bluetooth Service Discovery Protocol query utility
 .Sh SYNOPSIS
 .Nm
 .Fl h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282957 - stable/10/lib/libc/sys

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 10:54:40 2015
New Revision: 282957
URL: https://svnweb.freebsd.org/changeset/base/282957

Log:
  MFC r278352:
  
  Remove useless comment.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/lib/libc/sys/setresuid.2
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/sys/setresuid.2
==
--- stable/10/lib/libc/sys/setresuid.2  Fri May 15 10:53:06 2015
(r282956)
+++ stable/10/lib/libc/sys/setresuid.2  Fri May 15 10:54:40 2015
(r282957)
@@ -19,7 +19,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 13, 2001
+.Dd February 7, 2015
 .Dt SETRESUID 2
 .Os
 .Sh NAME
@@ -90,10 +90,5 @@ was invalid.
 .Xr setregid 2 ,
 .Xr setreuid 2 ,
 .Xr setuid 2
-.Sh STANDARDS
-These system calls are not available on many platforms.
-They exist in
-.Fx
-to support Linux binaries linked against GNU libc2.
 .Sh HISTORY
 These functions first appeared in HP-UX.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282956 - stable/10/usr.sbin/ctladm

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 10:53:06 2015
New Revision: 282956
URL: https://svnweb.freebsd.org/changeset/base/282956

Log:
  MFC r278316:
  
  Make "ctladm islist" ignore unknown elements, so the old version
  continues to work with newer kernel.
  
  Other ctladm(8) "*list" subcommands seem to already handle it in
  a reasonable way.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/usr.sbin/ctladm/ctladm.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctladm/ctladm.c
==
--- stable/10/usr.sbin/ctladm/ctladm.c  Fri May 15 10:50:58 2015
(r282955)
+++ stable/10/usr.sbin/ctladm/ctladm.c  Fri May 15 10:53:06 2015
(r282956)
@@ -3559,8 +3559,12 @@ cctl_islist_end_element(void *user_data,
} else if (strcmp(name, "connection") == 0) {
islist->cur_conn = NULL;
} else if (strcmp(name, "ctlislist") == 0) {
-   } else
-   errx(1, "unknown element %s", name);
+   /* Nothing. */
+   } else {
+   /*
+* Unknown element; ignore it for forward compatiblity.
+*/
+   }
 
free(str);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282955 - stable/10/sys/dev/iscsi

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 10:50:58 2015
New Revision: 282955
URL: https://svnweb.freebsd.org/changeset/base/282955

Log:
  MFC r278237:
  
  Don't call callout_drain() with iscsi mutex held; this fixes a warning
  that was introduced recently.  While here, don't try to access is_terminating
  without lock.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/iscsi/iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/iscsi/iscsi.c
==
--- stable/10/sys/dev/iscsi/iscsi.c Fri May 15 10:47:25 2015
(r282954)
+++ stable/10/sys/dev/iscsi/iscsi.c Fri May 15 10:50:58 2015
(r282955)
@@ -425,6 +425,7 @@ iscsi_maintenance_thread_terminate(struc
sx_xunlock(&sc->sc_lock);
 
icl_conn_close(is->is_conn);
+   callout_drain(&is->is_callout);
 
ISCSI_SESSION_LOCK(is);
 
@@ -438,8 +439,6 @@ iscsi_maintenance_thread_terminate(struc
cv_signal(&is->is_login_cv);
 #endif
 
-   callout_drain(&is->is_callout);
-
iscsi_session_cleanup(is, true);
 
KASSERT(TAILQ_EMPTY(&is->is_outstanding),
@@ -515,6 +514,7 @@ iscsi_session_reconnect(struct iscsi_ses
 static void
 iscsi_session_terminate(struct iscsi_session *is)
 {
+
if (is->is_terminating)
return;
 
@@ -536,12 +536,14 @@ iscsi_callout(void *context)
 
is = context;
 
-   if (is->is_terminating)
+   ISCSI_SESSION_LOCK(is);
+   if (is->is_terminating) {
+   ISCSI_SESSION_UNLOCK(is);
return;
+   }
 
callout_schedule(&is->is_callout, 1 * hz);
 
-   ISCSI_SESSION_LOCK(is);
is->is_timeout++;
 
if (is->is_waiting_for_iscsid) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282954 - stable/10/sys/dev/iscsi

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 10:47:25 2015
New Revision: 282954
URL: https://svnweb.freebsd.org/changeset/base/282954

Log:
  MFC r278233:
  
  Fix error handling.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/iscsi/iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/iscsi/iscsi.c
==
--- stable/10/sys/dev/iscsi/iscsi.c Fri May 15 10:42:48 2015
(r282953)
+++ stable/10/sys/dev/iscsi/iscsi.c Fri May 15 10:47:25 2015
(r282954)
@@ -1754,15 +1754,17 @@ iscsi_ioctl_session_add(struct iscsi_sof
arc4rand(&is->is_isid[1], 5, 0);
is->is_tsih = 0;
callout_init(&is->is_callout, 1);
-   callout_reset(&is->is_callout, 1 * hz, iscsi_callout, is);
-   TAILQ_INSERT_TAIL(&sc->sc_sessions, is, is_next);
 
error = kthread_add(iscsi_maintenance_thread, is, NULL, NULL, 0, 0, 
"iscsimt");
if (error != 0) {
ISCSI_SESSION_WARN(is, "kthread_add(9) failed with error %d", 
error);
+   sx_xunlock(&sc->sc_lock);
return (error);
}
 
+   callout_reset(&is->is_callout, 1 * hz, iscsi_callout, is);
+   TAILQ_INSERT_TAIL(&sc->sc_sessions, is, is_next);
+
/*
 * Trigger immediate reconnection.
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282953 - in stable/10: sbin/devd sys/geom

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 10:42:48 2015
New Revision: 282953
URL: https://svnweb.freebsd.org/changeset/base/282953

Log:
  MFC r277170:
  
  Add devd(8) notifications for creation and destruction of GEOM devices.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sbin/devd/devd.conf.5
  stable/10/sys/geom/geom_dev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/devd/devd.conf.5
==
--- stable/10/sbin/devd/devd.conf.5 Fri May 15 09:56:59 2015
(r282952)
+++ stable/10/sbin/devd/devd.conf.5 Fri May 15 10:42:48 2015
(r282953)
@@ -41,7 +41,7 @@
 .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 .\" SOFTWARE.
 .\"
-.Dd February 22, 2013
+.Dd January 14, 2015
 .Dt DEVD.CONF 5
 .Os
 .Sh NAME
@@ -370,6 +370,33 @@ node is destroyed.
 .El
 .El
 .Pp
+.It Li GEOM
+Events related to the
+.Xr geom 4
+framework.
+The difference compared to
+.Li DEVFS
+is that
+.Li GEOM
+only includes disk-like devices.
+.Bl -tag -width ".Sy Subsystem" -compact
+.It Sy Subsystem
+.It Li DEV
+.Bl -tag -width ".Li MEDIACHANGE" -compact
+.It Sy Type
+.It Li CREATE
+A
+.Xr geom 4
+device node is created.
+.It Li DESTROY
+A
+.Xr geom 4
+device node is destroyed.
+.It Li MEDIACHANGE
+Physical media has changed.
+.El
+.El
+.Pp
 .It Li USB
 Events related to the USB subsystem.
 .Bl -tag -width ".Sy Subsystem" -compact

Modified: stable/10/sys/geom/geom_dev.c
==
--- stable/10/sys/geom/geom_dev.c   Fri May 15 09:56:59 2015
(r282952)
+++ stable/10/sys/geom/geom_dev.c   Fri May 15 10:42:48 2015
(r282953)
@@ -169,12 +169,15 @@ g_dev_destroy(void *arg, int flags __unu
struct g_consumer *cp;
struct g_geom *gp;
struct g_dev_softc *sc;
+   char buf[SPECNAMELEN + 6];
 
g_topology_assert();
cp = arg;
gp = cp->geom;
sc = cp->private;
g_trace(G_T_TOPOLOGY, "g_dev_destroy(%p(%s))", cp, gp->name);
+   snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
+   devctl_notify_f("GEOM", "DEV", "DESTROY", buf, M_WAITOK);
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
g_access(cp, -cp->acr, -cp->acw, -cp->ace);
g_detach(cp);
@@ -209,11 +212,14 @@ g_dev_attrchanged(struct g_consumer *cp,
dev = sc->sc_dev;
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK);
+   devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK);
dev = sc->sc_alias;
if (dev != NULL) {
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf,
M_WAITOK);
+   devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf,
+   M_WAITOK);
}
return;
}
@@ -269,7 +275,7 @@ g_dev_taste(struct g_class *mp, struct g
struct g_dev_softc *sc;
int error, len;
struct cdev *dev, *adev;
-   char buf[64], *val;
+   char buf[SPECNAMELEN + 6], *val;
 
g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
@@ -324,6 +330,8 @@ g_dev_taste(struct g_class *mp, struct g
}
 
g_dev_attrchanged(cp, "GEOM::physpath");
+   snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
+   devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
 
return (gp);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r282907 - head/sys/sys

2015-05-15 Thread Tijl Coosemans
On Thu, 14 May 2015 15:49:49 + (UTC) "Pedro F. Giffuni"  
wrote:
> Author: pfg
> Date: Thu May 14 15:49:48 2015
> New Revision: 282907
> URL: https://svnweb.freebsd.org/changeset/base/282907
> 
> Log:
>   Add new __unreachable() builtin
>   
>   This is one of the few post gcc4.2 builtins that has been implemented by
>   clang:
>   
>   __builtin_unreachable is used to indicate that a specific point in the
>   program cannot be reached, even if the compiler might otherwise think it
>   can. This is useful to improve optimization and eliminates certain
>   warnings.
>   
>   Hinted by:  NetBSD
>   Differential Revision:  https://reviews.freebsd.org/D2536
> 
> Modified:
>   head/sys/sys/cdefs.h
> 
> Modified: head/sys/sys/cdefs.h
> ==
> --- head/sys/sys/cdefs.h  Thu May 14 15:14:03 2015(r282906)
> +++ head/sys/sys/cdefs.h  Thu May 14 15:49:48 2015(r282907)
> @@ -388,6 +388,12 @@
>  #define  __alloc_size(x)
>  #endif
>  
> +#if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6)
> +#define  __unreachable() __builtin_unreachable()
> +#else
> +#define  __unreachable() do {} while (/*CONSTCOND*/0)

__builtin_unreachable() can be used in expressions so I think it's better
to replace do-while with ((void)0).  You can then do things like this:

#define assume(e)  ((e) ? (void)0 : __unreachable())
(like assert(e) but without error)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282952 - in stable/10: usr.bin/man usr.sbin/bhyve

2015-05-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 15 09:56:59 2015
New Revision: 282952
URL: https://svnweb.freebsd.org/changeset/base/282952

Log:
  MFC r274720:
  
  Fix improper .Fx macro usage.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/usr.bin/man/man.1
  stable/10/usr.sbin/bhyve/bhyve.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/man/man.1
==
--- stable/10/usr.bin/man/man.1 Fri May 15 09:00:20 2015(r282951)
+++ stable/10/usr.bin/man/man.1 Fri May 15 09:56:59 2015(r282952)
@@ -61,23 +61,32 @@ restricts the search to the specific sec
 The sections of the manual are:
 .Bl -enum -offset indent -compact
 .It
-.Fx General Commands Manual
+.Fx
+General Commands Manual
 .It
-.Fx System Calls Manual
+.Fx
+System Calls Manual
 .It
-.Fx Library Functions Manual
+.Fx
+Library Functions Manual
 .It
-.Fx Kernel Interfaces Manual
+.Fx
+Kernel Interfaces Manual
 .It
-.Fx File Formats Manual
+.Fx
+File Formats Manual
 .It
-.Fx Games Manual
+.Fx
+Games Manual
 .It
-.Fx Miscellaneous Information Manual
+.Fx
+Miscellaneous Information Manual
 .It
-.Fx System Manager's Manual
+.Fx
+System Manager's Manual
 .It
-.Fx Kernel Developer's Manual
+.Fx
+Kernel Developer's Manual
 .El
 .Pp
 Options that

Modified: stable/10/usr.sbin/bhyve/bhyve.8
==
--- stable/10/usr.sbin/bhyve/bhyve.8Fri May 15 09:00:20 2015
(r282951)
+++ stable/10/usr.sbin/bhyve/bhyve.8Fri May 15 09:56:59 2015
(r282952)
@@ -70,7 +70,8 @@ Required for
 guests.
 .It Fl b
 Enable a low-level console device supported by
-.Fx kernels compiled with
+.Fx
+kernels compiled with
 .Cd "device bvmconsole" .
 This option will be deprecated in a future version.
 .It Fl c Ar numcpus
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282951 - stable/10/usr.bin/checknr

2015-05-15 Thread Baptiste Daroussin
Author: bapt
Date: Fri May 15 09:00:20 2015
New Revision: 282951
URL: https://svnweb.freebsd.org/changeset/base/282951

Log:
  MFC: r282437, r282438, r282439, r282462, r282463, r282464, r282466, r282467,
   r282468, r282609
  
  Update the list of known roff commands (both from NetBSD and heirloom 
doctools)
  Improve memory checking
  Remove limitation on input lines by using getline(3)

Modified:
  stable/10/usr.bin/checknr/checknr.1
  stable/10/usr.bin/checknr/checknr.c

Modified: stable/10/usr.bin/checknr/checknr.1
==
--- stable/10/usr.bin/checknr/checknr.1 Fri May 15 08:53:52 2015
(r282950)
+++ stable/10/usr.bin/checknr/checknr.1 Fri May 15 09:00:20 2015
(r282951)
@@ -28,7 +28,7 @@
 .\" @(#)checknr.1  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd January 26, 2005
+.Dd May 5, 2015
 .Dt CHECKNR 1
 .Os
 .Sh NAME
@@ -157,7 +157,3 @@ There is no way to define a 1 character 
 .Pp
 Does not correctly recognize certain reasonable constructs,
 such as conditionals.
-.Pp
-Input lines are limited to
-.Dv LINE_MAX
-(2048) bytes in length.

Modified: stable/10/usr.bin/checknr/checknr.c
==
--- stable/10/usr.bin/checknr/checknr.c Fri May 15 08:53:52 2015
(r282950)
+++ stable/10/usr.bin/checknr/checknr.c Fri May 15 09:00:20 2015
(r282951)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
  * structured typesetting.
  */
 #include 
+#define _WITH_GETLINE
 #include 
 #include 
 #include 
@@ -57,7 +58,7 @@ __FBSDID("$FreeBSD$");
 
 #define MAXSTK 100 /* Stack size */
 #define MAXBR  100 /* Max number of bracket pairs known */
-#define MAXCMDS500 /* Max number of commands known */
+#define MAXCMDS600 /* Max number of commands known */
 
 static void addcmd(char *);
 static void addmac(const char *);
@@ -133,6 +134,19 @@ static struct brstr {
{"(q",  ")q"},
{"(x",  ")x"},
{"(z",  ")z"},
+   /* The -mdoc package */
+   {"Ao",  "Ac"},
+   {"Bd",  "Ed"},
+   {"Bk",  "Ek"},
+   {"Bo",  "Bc"},
+   {"Do",  "Dc"},
+   {"Fo",  "Fc"},
+   {"Oo",  "Oc"},
+   {"Po",  "Pc"},
+   {"Qo",  "Qc"},
+   {"Rs",  "Re"},
+   {"So",  "Sc"},
+   {"Xo",  "Xc"},
/* Things needed by preprocessors */
{"EQ",  "EN"},
{"TS",  "TE"},
@@ -146,37 +160,47 @@ static struct brstr {
  * Used so we can complain about unrecognized commands.
  */
 static const char *knowncmds[MAXCMDS] = {
-"$c", "$f", "$h", "$p", "$s", "(b", "(c", "(d", "(f", "(l", "(q", "(t",
-"(x", "(z", ")b", ")c", ")d", ")f", ")l", ")q", ")t", ")x", ")z", "++",
-"+c", "1C", "1c", "2C", "2c", "@(", "@)", "@C", "@D", "@F", "@I", "@M",
-"@c", "@e", "@f", "@h", "@m", "@n", "@o", "@p", "@r", "@t", "@z", "AB",
-"AE", "AF", "AI", "AL", "AM", "AS", "AT", "AU", "AX", "B",  "B1", "B2",
-"BD", "BE", "BG", "BL", "BS", "BT", "BX", "C1", "C2", "CD", "CM", "CT",
-"D",  "DA", "DE", "DF", "DL", "DS", "DT", "EC", "EF", "EG", "EH", "EM",
-"EN", "EQ", "EX", "FA", "FD", "FE", "FG", "FJ", "FK", "FL", "FN", "FO",
-"FQ", "FS", "FV", "FX", "H",  "HC", "HD", "HM", "HO", "HU", "I",  "ID",
-"IE", "IH", "IM", "IP", "IX", "IZ", "KD", "KE", "KF", "KQ", "KS", "LB",
-"LC", "LD", "LE", "LG", "LI", "LP", "MC", "ME", "MF", "MH", "ML", "MR",
-"MT", "ND", "NE", "NH", "NL", "NP", "NS", "OF", "OH", "OK", "OP", "P",
-"P1", "PF", "PH", "PP", "PT", "PX", "PY", "QE", "QP", "QS", "R",  "RA",
-"RC", "RE", "RL", "RP", "RQ", "RS", "RT", "S",  "S0", "S2", "S3", "SA",
-"SG", "SH", "SK", "SM", "SP", "SY", "T&", "TA", "TB", "TC", "TD", "TE",
-"TH", "TL", "TM", "TP", "TQ", "TR", "TS", "TX", "UL", "US", "UX", "VL",
-"WC", "WH", "XA", "XD", "XE", "XF", "XK", "XP", "XS", "[",  "[-", "[0",
-"[1", "[2", "[3", "[4", "[5", "[<", "[>", "[]", "]",  "]-", "]<", "]>",
-"][", "ab", "ac", "ad", "af", "am", "ar", "as", "b",  "ba", "bc", "bd",
-"bi", "bl", "bp", "br", "bx", "c.", "c2", "cc", "ce", "cf", "ch", "cs",
-"ct", "cu", "da", "de", "di", "dl", "dn", "ds", "dt", "dw", "dy", "ec",
-"ef", "eh", "el", "em", "eo", "ep", "ev", "ex", "fc", "fi", "fl", "fo",
-"fp", "ft", "fz", "hc", "he", "hl", "hp", "ht", "hw", "hx", "hy", "i",
-"ie", "if", "ig", "in", "ip", "it", "ix", "lc", "lg", "li", "ll", "ln",
-"lo", "lp", "ls", "lt", "m1", "m2", "m3", "m4", "mc", "mk", "mo", "n1",
-"n2", "na", "ne", "nf", "nh", "nl", "nm", "nn", "np", "nr", "ns", "nx",
-"of", "oh", "os", "pa", "pc", "pi", "pl", "pm", "pn", "po", "pp", "ps",
-"q",  "r",  "rb", "rd", "re", "rm", "rn", "ro", "rr", "rs", "rt", "sb",
-"sc", "sh", "sk", "so", "sp", "ss", "st", "sv", "sz", "ta", "tc", "th",
-"ti", "tl", "tm", "tp", "tr", "u",  "uf", "uh", "ul", "vs", "wh", "xp",
-"yr", 0
+"$c", "$f", "$h", "$p", "$s", "%A", "%B", "%C", "%D", "%I", "%J", "%N", "%O",
+"%P", "%Q", "%R", "%T", "%V", "(b", "(c", "(d", "(f", "(l", "(q", "(t", "(x",
+"(z", ")b", ")c", ")d", ")f", ")l", ")q", ")t", ")x",

svn commit: r282950 - stable/10/usr.bin/vgrind

2015-05-15 Thread Baptiste Daroussin
Author: bapt
Date: Fri May 15 08:53:52 2015
New Revision: 282950
URL: https://svnweb.freebsd.org/changeset/base/282950

Log:
  MFC: r282449, r282450, r282451, r282452, r282453, r282454, r282455, r282457,
   r282459, r282460, r282461
  
  Modernize code: ansification, use c99 features
  Improve style(9)
  Better memory checking

Modified:
  stable/10/usr.bin/vgrind/Makefile
  stable/10/usr.bin/vgrind/extern.h
  stable/10/usr.bin/vgrind/regexp.c
  stable/10/usr.bin/vgrind/vfontedpr.c
  stable/10/usr.bin/vgrind/vgrindefs.c

Modified: stable/10/usr.bin/vgrind/Makefile
==
--- stable/10/usr.bin/vgrind/Makefile   Fri May 15 08:45:55 2015
(r282949)
+++ stable/10/usr.bin/vgrind/Makefile   Fri May 15 08:53:52 2015
(r282950)
@@ -11,7 +11,7 @@ FILESDIR= ${SHAREDIR}/misc
 FILESDIR_tmac.vgrind=  ${SHAREDIR}/tmac
 MAN=   vgrind.1 vgrindefs.5
 
-WARNS?=2
+WARNS?=3
 
 BINDIR=/usr/libexec
 SCRIPTSDIR=/usr/bin

Modified: stable/10/usr.bin/vgrind/extern.h
==
--- stable/10/usr.bin/vgrind/extern.h   Fri May 15 08:45:55 2015
(r282949)
+++ stable/10/usr.bin/vgrind/extern.h   Fri May 15 08:53:52 2015
(r282950)
@@ -31,9 +31,7 @@
  * $FreeBSD$
  */
 
-typedef int boolean;
-
-extern boolean  _escaped; /* if last character was an escape */
+extern bool _escaped; /* if last character was an escape */
 extern char*s_start;   /* start of the current string */
 extern char*l_acmbeg;  /* string introducing a comment */
 extern char*l_acmend;  /* string ending a comment */
@@ -45,11 +43,11 @@ extern char*l_combeg;  /
 extern char*l_comend;  /* string ending a comment */
 extern char l_escape;  /* character used to escape characters 
*/
 extern char*l_keywds[];   /* keyword table address */
-extern boolean  l_onecase; /* upper and lower case are equivalent 
*/
+extern bool l_onecase; /* upper and lower case are equivalent 
*/
 extern char*l_prcbeg;  /* regular expr for procedure begin */
 extern char*l_strbeg;  /* delimiter for string constant */
 extern char*l_strend;  /* delimiter for string constant */
-extern boolean  l_toplex;  /* procedures only defined at top lex 
level */
+extern bool l_toplex;  /* procedures only defined at top lex 
level */
 extern const char *language;   /* the language indicator */
 
 #include 

Modified: stable/10/usr.bin/vgrind/regexp.c
==
--- stable/10/usr.bin/vgrind/regexp.c   Fri May 15 08:45:55 2015
(r282949)
+++ stable/10/usr.bin/vgrind/regexp.c   Fri May 15 08:53:52 2015
(r282950)
@@ -44,19 +44,16 @@ static const char sccsid[] = "@(#)regexp
 
 #include 
 #include 
+#include 
 #include 
 
 #include "extern.h"
 
-#define FALSE  0
-#define TRUE   !(FALSE)
-#define NIL0
-
 static voidexpconv(void);
 
-boolean _escaped;  /* true if we are currently _escaped */
+bool_escaped;  /* true if we are currently x_escaped */
 char   *s_start;   /* start of string */
-boolean l_onecase; /* true if upper and lower equivalent */
+booll_onecase; /* true if upper and lower equivalent */
 
 #define makelower(c) (isupper((c)) ? tolower((c)) : (c))
 
@@ -66,9 +63,7 @@ booleanl_onecase; /* true if upper and
  */
 
 int
-STRNCMP(s1, s2, len)
-   register char *s1,*s2;
-   register int len;
+STRNCMP(register char *s1, register char *s2, register int len)
 {
if (l_onecase) {
do
@@ -147,18 +142,18 @@ STRNCMP(s1, s2, len)
 static char *ccre; /* pointer to current position in converted exp*/
 static char *ure;  /* pointer current position in unconverted exp */
 
+/* re: unconverted irregular expression */
 char *
-convexp(re)
-char *re;  /* unconverted irregular expression */
+convexp(char *re)
 {
 register char *cre;/* pointer to converted regular 
expression */
 
 /* allocate room for the converted expression */
-if (re == NIL)
-   return (NIL);
+if (re == NULL)
+   return (NULL);
 if (*re == '\0')
-   return (NIL);
-cre = malloc (4 * strlen(re) + 3);
+   return (NULL);
+cre = malloc(4 * strlen(re) + 3);
 ccre = cre;
 ure = re;
 
@@ -182,9 +177,9 @@ expconv()
 register int temp;
 
 /* let the conversion begin */
-acs = NIL;
-cs = NIL;
-while (*ure != NIL) {
+acs = NULL;
+cs = NULL;
+while (*ure) {
switch (c = *ure++) {
 
case '\\':
@@ -192,7 +187,7 @@ expconv()
 
/* escaped characters are just characters */
default:
-  

svn commit: r282949 - stable/10/usr.bin/col

2015-05-15 Thread Baptiste Daroussin
Author: bapt
Date: Fri May 15 08:45:55 2015
New Revision: 282949
URL: https://svnweb.freebsd.org/changeset/base/282949

Log:
  MFC: r282305, r282309, r282342, r282669, r282722
  
  r282305:
  col: fixing 25 year old bug
  
  Makes col(1) respect POSIX again for escape sequences as decribed in its 
manpage
  The bug was introduced in CSRG in 1990
  
  r282309:
  Use defines to improve clarity
  
  r282342:
  Capsicumize col(1)
  
  r282669:
  Fix about ten integer overflows and underflows and a handful of logic
  errors in line number handling.
  
  Submitted by: schwarze at OpenBSD
  Discussed with:   schwarze at OpenBSD
  Obtained from:OpenBSD
  
  r282722:
  For half and reverse line feeds, recognize both SUSv2-style escape-digit
  and BSD-style escape-control-char sequences in the input stream.
  
  Submitted by: schwarze at OpenBSD
  Discussed with:   schwarze at OpenBSD
  Obtained from:OpenBSD

Modified:
  stable/10/usr.bin/col/col.1
  stable/10/usr.bin/col/col.c

Modified: stable/10/usr.bin/col/col.1
==
--- stable/10/usr.bin/col/col.1 Fri May 15 08:40:17 2015(r282948)
+++ stable/10/usr.bin/col/col.1 Fri May 15 08:45:55 2015(r282949)
@@ -31,7 +31,7 @@
 .\" @(#)col.1  8.1 (Berkeley) 6/29/93
 .\" $FreeBSD$
 .\"
-.Dd August 4, 2004
+.Dd May 10, 2015
 .Dt COL 1
 .Os
 .Sh NAME
@@ -82,18 +82,33 @@ recognized and interpreted by itself, wh
 Output multiple spaces instead of tabs.
 .El
 .Pp
-The control sequences for carriage motion that
+In the input stream,
 .Nm
-understands and their decimal values are listed in the following
-table:
+understands both the escape sequences of the form escape-digit
+mandated by
+.St -susv2
+and the traditional
+.Bx
+format escape-control-character.
+The control sequences for carriage motion and their ASCII values
+are as follows:
 .Pp
 .Bl -tag -width "carriage return" -compact
+.It ESC\-BELL
+reverse line feed (escape then bell).
 .It ESC\-7
-reverse line feed (escape then 7)
+reverse line feed (escape then 7).
+.It ESC\-BACKSPACE
+half reverse line feed (escape then backspace).
 .It ESC\-8
-half reverse line feed (escape then 8)
+half reverse line feed (escape then 8).
+.It ESC\-TAB
+half forward line feed (escape than tab).
 .It ESC\-9
-half forward line feed (escape then 9)
+half forward line feed (escape then 9).
+In
+.Fl f
+mode, this sequence may also occur in the output stream.
 .It backspace
 moves back one column (8); ignored in the first column
 .It carriage return

Modified: stable/10/usr.bin/col/col.c
==
--- stable/10/usr.bin/col/col.c Fri May 15 08:40:17 2015(r282948)
+++ stable/10/usr.bin/col/col.c Fri May 15 08:45:55 2015(r282949)
@@ -45,11 +45,15 @@ static char sccsid[] = "@(#)col.c   8.5 (B
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -63,9 +67,9 @@ __FBSDID("$FreeBSD$");
 #defineSI  '\017'  /* shift in to normal character set */
 #defineSO  '\016'  /* shift out to alternate character set 
*/
 #defineVT  '\013'  /* vertical tab (aka reverse line feed) 
*/
-#defineRLF '\007'  /* ESC-07 reverse line feed */
-#defineRHLF'\010'  /* ESC-010 reverse half-line feed */
-#defineFHLF'\011'  /* ESC-011 forward half-line feed */
+#defineRLF '7' /* ESC-7 reverse line feed */
+#defineRHLF'8' /* ESC-8 reverse half-line feed */
+#defineFHLF'9' /* ESC-9 forward half-line feed */
 
 /* build up at least this many lines before flushing them out */
 #defineBUFFER_MARGIN   32
@@ -92,6 +96,7 @@ struct line_str {
int l_max_col;  /* max column in the line */
 };
 
+static voidaddto_lineno(int *, int);
 static LINE   *alloc_line(void);
 static voiddowarn(int);
 static voidflush_line(LINE *);
@@ -104,7 +109,7 @@ static CSET last_set;   /* char_set of la
 static LINE*lines;
 static int compress_spaces;/* if doing space -> tab conversion */
 static int fine;   /* if `fine' resolution (half lines) */
-static int max_bufd_lines; /* max # lines to keep in memory */
+static int max_bufd_lines; /* max # of half lines to keep in 
memory */
 static int nblank_lines;   /* # blanks after last flushed line */
 static int no_backspaces;  /* if not to output any backspaces */
 static int pass_unknown_seqs;  /* pass unknown control sequences */
@@ -129,10 +134,26 @@ main(int argc, char **argv)
int this_line;  /* line l points to */
int nflushd_lines;  /* number of lines that were flushe

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

2015-05-15 Thread Konstantin Belousov
Author: kib
Date: Fri May 15 08:40:17 2015
New Revision: 282948
URL: https://svnweb.freebsd.org/changeset/base/282948

Log:
  Some third-party malloc(3) implementations use pthread_setspecific(3)
  to handle per-thread information.  Since our pthread_setspecific()
  implementation calls calloc(3) to allocate per-thread specific data
  storage, things get complicated.
  
  Switch the allocator to use bare mmap(2).  There is some loss of the
  allocated page, since e.g. on amd64, PTHREAD_KEYS_MAX * sizeof(struct
  pthread_specific_elem) is 3K (it actually spans whole page due to
  padding), but I believe it is more acceptable than additional code for
  specialized allocator().
  
  The alternatives would either to make the specific data array be part of
  the struct thread, or use internal bindings to call the libc malloc,
  avoiding interposing.
  
  Also do the style pass over the thr_spec.c, esp. simplify the
  conditionals nesting by returning early when an error detected.
  Remove trivial comments.
  
  Found by: y...@rawbw.com
  PR:   200138
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

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

Modified: head/lib/libthr/thread/thr_spec.c
==
--- head/lib/libthr/thread/thr_spec.c   Fri May 15 08:30:29 2015
(r282947)
+++ head/lib/libthr/thread/thr_spec.c   Fri May 15 08:40:17 2015
(r282948)
@@ -30,6 +30,7 @@
  */
 
 #include "namespace.h"
+#include 
 #include 
 #include 
 #include 
@@ -40,7 +41,6 @@
 
 #include "thr_private.h"
 
-/* Static variables: */
 struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX];
 
 __weak_reference(_pthread_key_create, pthread_key_create);
@@ -50,7 +50,7 @@ __weak_reference(_pthread_setspecific, p
 
 
 int
-_pthread_key_create(pthread_key_t *key, void (*destructor) (void *))
+_pthread_key_create(pthread_key_t *key, void (*destructor)(void *))
 {
struct pthread *curthread;
int i;
@@ -59,7 +59,6 @@ _pthread_key_create(pthread_key_t *key, 
 
curthread = _get_curthread();
 
-   /* Lock the key table: */
THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
for (i = 0; i < PTHREAD_KEYS_MAX; i++) {
 
@@ -68,14 +67,12 @@ _pthread_key_create(pthread_key_t *key, 
_thread_keytable[i].destructor = destructor;
_thread_keytable[i].seqno++;
 
-   /* Unlock the key table: */
THR_LOCK_RELEASE(curthread, &_keytable_lock);
*key = i + 1;
return (0);
}
 
}
-   /* Unlock the key table: */
THR_LOCK_RELEASE(curthread, &_keytable_lock);
return (EAGAIN);
 }
@@ -83,44 +80,40 @@ _pthread_key_create(pthread_key_t *key, 
 int
 _pthread_key_delete(pthread_key_t userkey)
 {
-   struct pthread *curthread = _get_curthread();
-   int key = userkey - 1;
-   int ret = 0;
-
-   if ((unsigned int)key < PTHREAD_KEYS_MAX) {
-   /* Lock the key table: */
-   THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
-
-   if (_thread_keytable[key].allocated)
-   _thread_keytable[key].allocated = 0;
-   else
-   ret = EINVAL;
-
-   /* Unlock the key table: */
-   THR_LOCK_RELEASE(curthread, &_keytable_lock);
-   } else
+   struct pthread *curthread;
+   int key, ret;
+
+   key = userkey - 1;
+   if ((unsigned int)key >= PTHREAD_KEYS_MAX)
+   return (EINVAL);
+   curthread = _get_curthread();
+   THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
+   if (_thread_keytable[key].allocated) {
+   _thread_keytable[key].allocated = 0;
+   ret = 0;
+   } else {
ret = EINVAL;
+   }
+   THR_LOCK_RELEASE(curthread, &_keytable_lock);
return (ret);
 }
 
 void 
 _thread_cleanupspecific(void)
 {
-   struct pthread  *curthread = _get_curthread();
-   void(*destructor)( void *);
-   const void  *data = NULL;
-   int key;
-   int i;
+   struct pthread *curthread;
+   void (*destructor)(void *);
+   const void *data;
+   int i, key;
 
+   curthread = _get_curthread();
if (curthread->specific == NULL)
return;
-
-   /* Lock the key table: */
THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
-   for (i = 0; (i < PTHREAD_DESTRUCTOR_ITERATIONS) &&
-   (curthread->specific_data_count > 0); i++) {
-   for (key = 0; (key < PTHREAD_KEYS_MAX) &&
-   (curthread->specific_data_count > 0); key++) {
+   for (i = 0; i < PTHREAD_DESTRUCTOR_ITERATIONS &&
+   curthread->specific_data_count > 0; i++) {
+   for (key = 0; key < PTHREAD_KEYS_MAX &&
+   curthread->specific_data_count > 0; key++

svn commit: r282947 - in head/sys: amd64/amd64 kern

2015-05-15 Thread Konstantin Belousov
Author: kib
Date: Fri May 15 08:30:29 2015
New Revision: 282947
URL: https://svnweb.freebsd.org/changeset/base/282947

Log:
  On amd64, make proc0 pmap initialization slightly more correct.  In
  particular, switch to the proc0 pmap to have expected %cr3 and PCID
  for the thread0 during initialization, and the up to date pm_active
  mask.
  
  pmap_pinit0() should be done after proc0->p_vmspace is assigned so
  that the amd64 pmap_activate() find the correct curproc pmap.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 weeks

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/kern/init_main.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri May 15 08:29:24 2015(r282946)
+++ head/sys/amd64/amd64/pmap.c Fri May 15 08:30:29 2015(r282947)
@@ -2129,7 +2129,6 @@ pmap_pinit0(pmap_t pmap)
pmap->pm_cr3 = KPML4phys;
pmap->pm_root.rt_root = 0;
CPU_ZERO(&pmap->pm_active);
-   PCPU_SET(curpmap, pmap);
TAILQ_INIT(&pmap->pm_pvchunk);
bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
pmap->pm_flags = pmap_flags;
@@ -2137,6 +2136,9 @@ pmap_pinit0(pmap_t pmap)
pmap->pm_pcids[i].pm_pcid = PMAP_PCID_NONE;
pmap->pm_pcids[i].pm_gen = 0;
}
+   PCPU_SET(curpmap, kernel_pmap);
+   pmap_activate(curthread);
+   CPU_FILL(&kernel_pmap->pm_active);
 }
 
 /*

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Fri May 15 08:29:24 2015(r282946)
+++ head/sys/kern/init_main.c   Fri May 15 08:30:29 2015(r282947)
@@ -561,9 +561,9 @@ proc0_init(void *dummy __unused)
p->p_stats = pstats_alloc();
 
/* Allocate a prototype map so we have something to fork. */
-   pmap_pinit0(vmspace_pmap(&vmspace0));
p->p_vmspace = &vmspace0;
vmspace0.vm_refcnt = 1;
+   pmap_pinit0(vmspace_pmap(&vmspace0));
 
/*
 * proc0 is not expected to enter usermode, so there is no special
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282945 - head/sys/amd64/amd64

2015-05-15 Thread Konstantin Belousov
Author: kib
Date: Fri May 15 07:57:47 2015
New Revision: 282945
URL: https://svnweb.freebsd.org/changeset/base/282945

Log:
  Implement the support for PCID in UP kernels.
  
  Requested by: alc
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:3 weeks

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri May 15 07:54:31 2015(r282944)
+++ head/sys/amd64/amd64/pmap.c Fri May 15 07:57:47 2015(r282945)
@@ -909,11 +909,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 * pc_pcid_next and pc_pcid_gen are initialized by AP
 * during pcpu setup.
 */
-#ifdef SMP
load_cr4(rcr4() | CR4_PCIDE);
-#else
-   pmap_pcid_enabled = 0;
-#endif
} else {
pmap_pcid_enabled = 0;
}
@@ -1559,61 +1555,79 @@ pmap_update_pde(pmap_t pmap, vm_offset_t
 #else /* !SMP */
 /*
  * Normal, non-SMP, invalidation functions.
- * We inline these within pmap.c for speed.
  */
-PMAP_INLINE void
+void
 pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
 {
 
-   switch (pmap->pm_type) {
-   case PT_X86:
-   if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active))
-   invlpg(va);
-   break;
-   case PT_RVI:
-   case PT_EPT:
+   if (pmap->pm_type == PT_RVI || pmap->pm_type == PT_EPT) {
pmap->pm_eptgen++;
-   break;
-   default:
-   panic("pmap_invalidate_page: unknown type: %d", pmap->pm_type);
+   return;
}
+   KASSERT(pmap->pm_type == PT_X86,
+   ("pmap_invalidate_range: unknown type %d", pmap->pm_type));
+
+   if (pmap == kernel_pmap || pmap == PCPU_GET(curpmap))
+   invlpg(va);
+   else if (pmap_pcid_enabled)
+   pmap->pm_pcids[0].pm_gen = 0;
 }
 
-PMAP_INLINE void
+void
 pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
 {
vm_offset_t addr;
 
-   switch (pmap->pm_type) {
-   case PT_X86:
-   if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active))
-   for (addr = sva; addr < eva; addr += PAGE_SIZE)
-   invlpg(addr);
-   break;
-   case PT_RVI:
-   case PT_EPT:
+   if (pmap->pm_type == PT_RVI || pmap->pm_type == PT_EPT) {
pmap->pm_eptgen++;
-   break;
-   default:
-   panic("pmap_invalidate_range: unknown type: %d", pmap->pm_type);
+   return;
+   }
+   KASSERT(pmap->pm_type == PT_X86,
+   ("pmap_invalidate_range: unknown type %d", pmap->pm_type));
+
+   if (pmap == kernel_pmap || pmap == PCPU_GET(curpmap)) {
+   for (addr = sva; addr < eva; addr += PAGE_SIZE)
+   invlpg(addr);
+   } else if (pmap_pcid_enabled) {
+   pmap->pm_pcids[0].pm_gen = 0;
}
 }
 
-PMAP_INLINE void
+void
 pmap_invalidate_all(pmap_t pmap)
 {
+   struct invpcid_descr d;
 
-   switch (pmap->pm_type) {
-   case PT_X86:
-   if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active))
-   invltlb();
-   break;
-   case PT_RVI:
-   case PT_EPT:
+   if (pmap->pm_type == PT_RVI || pmap->pm_type == PT_EPT) {
pmap->pm_eptgen++;
-   break;
-   default:
-   panic("pmap_invalidate_all: unknown type %d", pmap->pm_type);
+   return;
+   }
+   KASSERT(pmap->pm_type == PT_X86,
+   ("pmap_invalidate_all: unknown type %d", pmap->pm_type));
+
+   if (pmap == kernel_pmap) {
+   if (pmap_pcid_enabled && invpcid_works) {
+   bzero(&d, sizeof(d));
+   invpcid(&d, INVPCID_CTXGLOB);
+   } else {
+   invltlb_globpcid();
+   }
+   } else if (pmap == PCPU_GET(curpmap)) {
+   if (pmap_pcid_enabled) {
+   if (invpcid_works) {
+   d.pcid = pmap->pm_pcids[0].pm_pcid;
+   d.pad = 0;
+   d.addr = 0;
+   invpcid(&d, INVPCID_CTX);
+   } else {
+   load_cr3(pmap->pm_cr3 | pmap->pm_pcids[0].
+   pm_pcid);
+   }
+   } else {
+   invltlb();
+   }
+   } else if (pmap_pcid_enabled) {
+   pmap->pm_pcids[0].pm_gen = 0;
}
 }
 
@@ -1629,10 +1643,10 @@ pmap_update_pde(pmap_t pmap, vm_offset_t
 {
 
pmap_update_pde_store(pmap, pde, newpde);
-   if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active))
+   if (pmap == kernel_pmap || pmap == PCPU_GET(curpmap))
pm

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

2015-05-15 Thread Konstantin Belousov
Author: kib
Date: Fri May 15 07:54:31 2015
New Revision: 282944
URL: https://svnweb.freebsd.org/changeset/base/282944

Log:
  Right now, the process' p_boundary_count counter is decremented by the
  suspended thread itself, on the return path from
  thread_suspend_check().  A consequence is that return from
  thread_single_end(SINGLE_BOUNDARY) may leave p_boundary_count
  non-zero, it might be even equal to the threads count.
  
  Now, assume that we have two threads in the process, both calling
  execve(2).  Suppose that the first thread won the race to be the
  suspension thread, and that afterward its exec failed for any reason.
  After the first thread did thread_single_end(SINGLE_BOUNDARY), second
  thread becomes the process suspension thread and checks
  p_boundary_count.  The non-zero value of the count allows the
  suspension loop to finish without actually suspending some threads.
  In other words, we enter exec code with some threads not suspended.
  
  Fix this by decrementing p_boundary_count in the
  thread_single_end()->thread_unsuspend_one() during marking the thread
  as runnable.  This way, a return from thread_single_end() guarantees
  that the counter is cleared.  We do not care whether the unsuspended
  thread has a chance to run.
  
  Add some asserts to ensure the state of the process when single
  boundary suspension is lifted.  Also make thread_unuspend_one()
  static.
  
  In collaboration with:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Fri May 15 07:07:37 2015(r282943)
+++ head/sys/kern/kern_thread.c Fri May 15 07:54:31 2015(r282944)
@@ -74,6 +74,8 @@ static struct mtx zombie_lock;
 MTX_SYSINIT(zombie_lock, &zombie_lock, "zombie lock", MTX_SPIN);
 
 static void thread_zombie(struct thread *);
+static int thread_unsuspend_one(struct thread *td, struct proc *p,
+bool boundary);
 
 #define TID_BUFFER_SIZE1024
 
@@ -445,7 +447,7 @@ thread_exit(void)
if (p->p_numthreads == p->p_suspcount) {
thread_lock(p->p_singlethread);
wakeup_swapper = thread_unsuspend_one(
-   p->p_singlethread, p);
+   p->p_singlethread, p, false);
thread_unlock(p->p_singlethread);
if (wakeup_swapper)
kick_proc0();
@@ -603,19 +605,19 @@ weed_inhib(int mode, struct thread *td2,
switch (mode) {
case SINGLE_EXIT:
if (TD_IS_SUSPENDED(td2))
-   wakeup_swapper |= thread_unsuspend_one(td2, p);
+   wakeup_swapper |= thread_unsuspend_one(td2, p, true);
if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0)
wakeup_swapper |= sleepq_abort(td2, EINTR);
break;
case SINGLE_BOUNDARY:
if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0)
-   wakeup_swapper |= thread_unsuspend_one(td2, p);
+   wakeup_swapper |= thread_unsuspend_one(td2, p, false);
if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0)
wakeup_swapper |= sleepq_abort(td2, ERESTART);
break;
case SINGLE_NO_EXIT:
if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0)
-   wakeup_swapper |= thread_unsuspend_one(td2, p);
+   wakeup_swapper |= thread_unsuspend_one(td2, p, false);
if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0)
wakeup_swapper |= sleepq_abort(td2, ERESTART);
break;
@@ -630,7 +632,7 @@ weed_inhib(int mode, struct thread *td2,
 */
if (TD_IS_SUSPENDED(td2) && (td2->td_flags & (TDF_BOUNDARY |
TDF_ALLPROCSUSP)) == 0)
-   wakeup_swapper |= thread_unsuspend_one(td2, p);
+   wakeup_swapper |= thread_unsuspend_one(td2, p, false);
if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) {
if ((td2->td_flags & TDF_SBDRY) == 0) {
thread_suspend_one(td2);
@@ -898,8 +900,8 @@ thread_suspend_check(int return_instead)
if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) {
if (p->p_numthreads == p->p_suspcount + 1) {
thread_lock(p->p_singlethread);
-   wakeup_swapper =
-   thread_unsuspend_one(p->p_single

svn commit: r282943 - stable/10/sys/dev/ixl

2015-05-15 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri May 15 07:07:37 2015
New Revision: 282943
URL: https://svnweb.freebsd.org/changeset/base/282943

Log:
  MFC r282939: Free vsi->queues after use.

Modified:
  stable/10/sys/dev/ixl/if_ixlv.c

Modified: stable/10/sys/dev/ixl/if_ixlv.c
==
--- stable/10/sys/dev/ixl/if_ixlv.c Fri May 15 06:50:59 2015
(r282942)
+++ stable/10/sys/dev/ixl/if_ixlv.c Fri May 15 07:07:37 2015
(r282943)
@@ -1646,7 +1646,6 @@ ixlv_setup_queues(struct ixlv_sc *sc)
return (0);
 
 fail:
-   free(vsi->queues, M_DEVBUF);
for (int i = 0; i < vsi->num_queues; i++) {
que = &vsi->queues[i];
rxr = &que->rxr;
@@ -1656,6 +1655,7 @@ fail:
if (txr->base)
i40e_free_dma_mem(&sc->hw, &txr->dma);
}
+   free(vsi->queues, M_DEVBUF);
 
 early:
return (error);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"