svn commit: r290134 - head/sys/dev/ral

2015-10-28 Thread Kevin Lo
Author: kevlo
Date: Thu Oct 29 04:51:27 2015
New Revision: 290134
URL: https://svnweb.freebsd.org/changeset/base/290134

Log:
  Remove the static function declaration.

Modified:
  head/sys/dev/ral/rt2860.c

Modified: head/sys/dev/ral/rt2860.c
==
--- head/sys/dev/ral/rt2860.c   Thu Oct 29 04:21:34 2015(r290133)
+++ head/sys/dev/ral/rt2860.c   Thu Oct 29 04:51:27 2015(r290134)
@@ -115,7 +115,6 @@ static void rt2860_tx_intr(struct rt2860
 static voidrt2860_rx_intr(struct rt2860_softc *);
 static voidrt2860_tbtt_intr(struct rt2860_softc *);
 static voidrt2860_gp_intr(struct rt2860_softc *);
-static voidrt2860_intr(void *);
 static int rt2860_tx(struct rt2860_softc *, struct mbuf *,
struct ieee80211_node *);
 static int rt2860_raw_xmit(struct ieee80211_node *, struct mbuf *,
@@ -1387,7 +1386,7 @@ rt2860_gp_intr(struct rt2860_softc *sc)
rt2860_updatestats(sc);
 }
 
-static void
+void
 rt2860_intr(void *arg)
 {
struct rt2860_softc *sc = arg;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290133 - head/sys/dev/ral

2015-10-28 Thread Kevin Lo
Author: kevlo
Date: Thu Oct 29 04:21:34 2015
New Revision: 290133
URL: https://svnweb.freebsd.org/changeset/base/290133

Log:
  - Add a missing prototype
  - Fix typos

Modified:
  head/sys/dev/ral/rt2860.c
  head/sys/dev/ral/rt2860var.h

Modified: head/sys/dev/ral/rt2860.c
==
--- head/sys/dev/ral/rt2860.c   Thu Oct 29 04:16:52 2015(r290132)
+++ head/sys/dev/ral/rt2860.c   Thu Oct 29 04:21:34 2015(r290133)
@@ -115,6 +115,7 @@ static void rt2860_tx_intr(struct rt2860
 static voidrt2860_rx_intr(struct rt2860_softc *);
 static voidrt2860_tbtt_intr(struct rt2860_softc *);
 static voidrt2860_gp_intr(struct rt2860_softc *);
+static voidrt2860_intr(void *);
 static int rt2860_tx(struct rt2860_softc *, struct mbuf *,
struct ieee80211_node *);
 static int rt2860_raw_xmit(struct ieee80211_node *, struct mbuf *,
@@ -513,7 +514,7 @@ rt2860_alloc_tx_ring(struct rt2860_softc
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
size, 1, size, 0, NULL, NULL, &ring->desc_dmat);
if (error != 0) {
-   device_printf(sc->sc_dev, "could not create desc DMA map\n");
+   device_printf(sc->sc_dev, "could not create desc DMA tag\n");
goto fail;
}
 
@@ -1386,7 +1387,7 @@ rt2860_gp_intr(struct rt2860_softc *sc)
rt2860_updatestats(sc);
 }
 
-void
+static void
 rt2860_intr(void *arg)
 {
struct rt2860_softc *sc = arg;
@@ -1699,7 +1700,7 @@ rt2860_raw_xmit(struct ieee80211_node *n
RAL_LOCK(sc);
 
/* prevent management frames from being sent if we're not ready */
-   if (!(sc->sc_flags & RT2860_RUNNNING)) {
+   if (!(sc->sc_flags & RT2860_RUNNING)) {
RAL_UNLOCK(sc);
m_freem(m);
return ENETDOWN;
@@ -1940,7 +1941,7 @@ rt2860_transmit(struct ieee80211com *ic,
int error;
 
RAL_LOCK(sc);
-   if ((sc->sc_flags & RT2860_RUNNNING) == 0) {
+   if ((sc->sc_flags & RT2860_RUNNING) == 0) {
RAL_UNLOCK(sc);
return (ENXIO);
}
@@ -1963,7 +1964,7 @@ rt2860_start(struct rt2860_softc *sc)
 
RAL_LOCK_ASSERT(sc);
 
-   if ((sc->sc_flags & RT2860_RUNNNING) == 0)
+   if ((sc->sc_flags & RT2860_RUNNING) == 0)
return;
 
while (!SLIST_EMPTY(&sc->data_pool) && sc->qfullmsk == 0 &&
@@ -1986,7 +1987,7 @@ rt2860_watchdog(void *arg)
 
RAL_LOCK_ASSERT(sc);
 
-   KASSERT(sc->sc_flags & RT2860_RUNNNING, ("not running"));
+   KASSERT(sc->sc_flags & RT2860_RUNNING, ("not running"));
 
if (sc->sc_invalid) /* card ejected */
return;
@@ -2009,12 +2010,12 @@ rt2860_parent(struct ieee80211com *ic)
 
RAL_LOCK(sc);
if (ic->ic_nrunning> 0) {
-   if (!(sc->sc_flags & RT2860_RUNNNING)) {
+   if (!(sc->sc_flags & RT2860_RUNNING)) {
rt2860_init_locked(sc);
startall = 1;
} else
rt2860_update_promisc(ic);
-   } else if (sc->sc_flags & RT2860_RUNNNING)
+   } else if (sc->sc_flags & RT2860_RUNNING)
rt2860_stop_locked(sc);
RAL_UNLOCK(sc);
if (startall)
@@ -3791,7 +3792,7 @@ rt2860_init(void *arg)
rt2860_init_locked(sc);
RAL_UNLOCK(sc);
 
-   if (sc->sc_flags & RT2860_RUNNNING)
+   if (sc->sc_flags & RT2860_RUNNING)
ieee80211_start_all(ic);
 }
 
@@ -4051,7 +4052,7 @@ rt2860_init_locked(struct rt2860_softc *
if (sc->sc_flags & RT2860_ADVANCED_PS)
rt2860_mcu_cmd(sc, RT2860_MCU_CMD_PSLEVEL, sc->pslevel, 0);
 
-   sc->sc_flags |= RT2860_RUNNNING;
+   sc->sc_flags |= RT2860_RUNNING;
 
callout_reset(&sc->watchdog_ch, hz, rt2860_watchdog, sc);
 }
@@ -4072,12 +4073,12 @@ rt2860_stop_locked(struct rt2860_softc *
uint32_t tmp;
int qid;
 
-   if (sc->sc_flags & RT2860_RUNNNING)
+   if (sc->sc_flags & RT2860_RUNNING)
rt2860_set_leds(sc, 0); /* turn all LEDs off */
 
callout_stop(&sc->watchdog_ch);
sc->sc_tx_timer = 0;
-   sc->sc_flags &= ~RT2860_RUNNNING;
+   sc->sc_flags &= ~RT2860_RUNNING;
 
/* disable interrupts */
RAL_WRITE(sc, RT2860_INT_MASK, 0);

Modified: head/sys/dev/ral/rt2860var.h
==
--- head/sys/dev/ral/rt2860var.hThu Oct 29 04:16:52 2015
(r290132)
+++ head/sys/dev/ral/rt2860var.hThu Oct 29 04:21:34 2015
(r290133)
@@ -139,7 +139,7 @@ struct rt2860_softc {
 #define RT2860_ENABLED (1 << 0)
 #define RT2860_ADVANCED_PS (1 << 1)
 #define RT2860_PCIE(1 << 2)
-#defineRT2860_RUNNNING (1 << 3)
+#defineRT2860_RUNNING  (1 << 3)
 
struct ieee80211_nod

svn commit: r290131 - head/sys/dev/ioat

2015-10-28 Thread Conrad E. Meyer
Author: cem
Date: Thu Oct 29 04:16:39 2015
New Revision: 290131
URL: https://svnweb.freebsd.org/changeset/base/290131

Log:
  ioat: Drain/quiesce the device less racily
  
  On detach and during a forced HW reset.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_internal.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cThu Oct 29 04:16:28 2015(r290130)
+++ head/sys/dev/ioat/ioat.cThu Oct 29 04:16:39 2015(r290131)
@@ -96,7 +96,7 @@ static inline struct ioat_softc *ioat_ge
 static inline void ioat_put(struct ioat_softc *, enum ioat_ref_kind);
 static inline void ioat_putn(struct ioat_softc *, uint32_t,
 enum ioat_ref_kind);
-static void ioat_drain(struct ioat_softc *);
+static void ioat_drain_locked(struct ioat_softc *);
 
 #defineioat_log_message(v, ...) do {   
\
if ((v) <= g_ioat_debug_level) {\
@@ -271,6 +271,7 @@ ioat_attach(device_t device)
ioat_process_events(ioat);
ioat_setup_sysctl(device);
 
+   ioat->chan_idx = ioat_channel_index;
ioat_channel[ioat_channel_index++] = ioat;
ioat_test_attach();
 
@@ -288,7 +289,13 @@ ioat_detach(device_t device)
ioat = DEVICE2SOFTC(device);
 
ioat_test_detach();
-   ioat_drain(ioat);
+
+   mtx_lock(IOAT_REFLK);
+   ioat->quiescing = TRUE;
+   ioat_channel[ioat->chan_idx] = NULL;
+
+   ioat_drain_locked(ioat);
+   mtx_unlock(IOAT_REFLK);
 
ioat_teardown_intr(ioat);
callout_drain(&ioat->timer);
@@ -614,10 +621,16 @@ out:
 bus_dmaengine_t
 ioat_get_dmaengine(uint32_t index)
 {
+   struct ioat_softc *sc;
 
if (index >= ioat_channel_index)
return (NULL);
-   return (&ioat_get(ioat_channel[index], IOAT_DMAENGINE_REF)->dmaengine);
+
+   sc = ioat_channel[index];
+   if (sc == NULL || sc->quiescing)
+   return (NULL);
+
+   return (&ioat_get(sc, IOAT_DMAENGINE_REF)->dmaengine);
 }
 
 void
@@ -887,6 +900,10 @@ ioat_reserve_space(struct ioat_softc *io
error = EINVAL;
goto out;
}
+   if (ioat->quiescing) {
+   error = ENXIO;
+   goto out;
+   }
 
for (;;) {
if (ioat_get_ring_space(ioat) >= num_descs)
@@ -1238,6 +1255,12 @@ ioat_reset_hw(struct ioat_softc *ioat)
uint64_t status;
uint32_t chanerr;
unsigned timeout;
+   int error;
+
+   mtx_lock(IOAT_REFLK);
+   ioat->quiescing = TRUE;
+   ioat_drain_locked(ioat);
+   mtx_unlock(IOAT_REFLK);
 
status = ioat_get_chansts(ioat);
if (is_ioat_active(status) || is_ioat_idle(status))
@@ -1249,8 +1272,10 @@ ioat_reset_hw(struct ioat_softc *ioat)
DELAY(1000);
status = ioat_get_chansts(ioat);
}
-   if (timeout == 20)
-   return (ETIMEDOUT);
+   if (timeout == 20) {
+   error = ETIMEDOUT;
+   goto out;
+   }
 
KASSERT(ioat_get_active(ioat) == 0, ("active after quiesce"));
 
@@ -1280,8 +1305,10 @@ ioat_reset_hw(struct ioat_softc *ioat)
/* Wait at most 20 ms */
for (timeout = 0; ioat_reset_pending(ioat) && timeout < 20; timeout++)
DELAY(1000);
-   if (timeout == 20)
-   return (ETIMEDOUT);
+   if (timeout == 20) {
+   error = ETIMEDOUT;
+   goto out;
+   }
 
if (ioat_model_resets_msix(ioat)) {
ioat_log_message(1, "device resets registers; restored\n");
@@ -1294,13 +1321,16 @@ ioat_reset_hw(struct ioat_softc *ioat)
/* So this really shouldn't happen... */
ioat_log_message(0, "Device is active after a reset?\n");
ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN);
-   return (0);
+   error = 0;
+   goto out;
}
 
chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
ioat_halted_debug(ioat, chanerr);
-   if (chanerr != 0)
-   return (EIO);
+   if (chanerr != 0) {
+   error = EIO;
+   goto out;
+   }
 
/*
 * Bring device back online after reset.  Writing CHAINADDR brings the
@@ -1315,7 +1345,17 @@ ioat_reset_hw(struct ioat_softc *ioat)
ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN);
ioat_write_chancmp(ioat, ioat->comp_update_bus_addr);
ioat_write_chainaddr(ioat, ioat->ring[0]->hw_desc_bus_addr);
-   return (ioat_start_channel(ioat));
+   error = 0;
+
+out:
+   mtx_lock(IOAT_REFLK);
+   ioat->quiescing = FALSE;
+   mtx_unlock(IOAT_REFLK);
+
+   if (error == 0)
+   error = ioat_start_channel(ioat);
+
+   return (error);
 }
 
 static int
@@ -1456,11 +1496,10 @@ ioat_put(stru

svn commit: r290129 - in head: sys/dev/ioat tools/tools/ioat

2015-10-28 Thread Conrad E. Meyer
Author: cem
Date: Thu Oct 29 04:16:16 2015
New Revision: 290129
URL: https://svnweb.freebsd.org/changeset/base/290129

Log:
  ioatcontrol(8): Add and document "raw" testing mode
  
  Allows DMA from/to arbitrary KVA or physical address.  /dev/ioat_test
  must be enabled by root and is only R/W root, so this is approximately
  as dangerous as /dev/mem and /dev/kmem.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat_test.c
  head/sys/dev/ioat/ioat_test.h
  head/tools/tools/ioat/ioatcontrol.8
  head/tools/tools/ioat/ioatcontrol.c

Modified: head/sys/dev/ioat/ioat_test.c
==
--- head/sys/dev/ioat/ioat_test.c   Thu Oct 29 03:28:28 2015
(r290128)
+++ head/sys/dev/ioat/ioat_test.c   Thu Oct 29 04:16:16 2015
(r290129)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "ioat.h"
@@ -120,6 +121,18 @@ test_transaction *ioat_test_transaction_
return (tx);
 }
 
+static void
+dump_hex(void *p, size_t chunks)
+{
+   size_t i, j;
+
+   for (i = 0; i < chunks; i++) {
+   for (j = 0; j < 8; j++)
+   printf("%08x ", ((uint32_t *)p)[i * 8 + j]);
+   printf("\n");
+   }
+}
+
 static bool
 ioat_compare_ok(struct test_transaction *tx)
 {
@@ -140,9 +153,14 @@ ioat_compare_ok(struct test_transaction 
!= 0)
return (false);
}
-   } else if (test->testkind == IOAT_TEST_DMA)
+   } else if (test->testkind == IOAT_TEST_DMA) {
if (memcmp(src, dst, tx->length) != 0)
return (false);
+   } else if (test->testkind == IOAT_TEST_RAW_DMA) {
+   if (test->raw_write)
+   dst = test->raw_vtarget;
+   dump_hex(dst, tx->length / 32);
+   }
}
return (true);
 }
@@ -242,6 +260,13 @@ ioat_test_submit_1_tx(struct ioat_test *
src = vtophys((vm_offset_t)tx->buf[2*i]);
dest = vtophys((vm_offset_t)tx->buf[2*i+1]);
 
+   if (test->testkind == IOAT_TEST_RAW_DMA) {
+   if (test->raw_write)
+   dest = test->raw_target;
+   else
+   src = test->raw_target;
+   }
+
if (i == tx->depth - 1) {
cb = ioat_dma_test_callback;
flags = DMA_INT_EN;
@@ -250,7 +275,8 @@ ioat_test_submit_1_tx(struct ioat_test *
flags = 0;
}
 
-   if (test->testkind == IOAT_TEST_DMA)
+   if (test->testkind == IOAT_TEST_DMA ||
+   test->testkind == IOAT_TEST_RAW_DMA)
desc = ioat_copy(dma, dest, src, tx->length, cb, tx,
flags);
else if (test->testkind == IOAT_TEST_FILL) {
@@ -328,6 +354,16 @@ ioat_dma_test(void *arg)
goto out;
}
 
+   if (test->testkind == IOAT_TEST_RAW_DMA) {
+   if (test->raw_is_virtual) {
+   test->raw_vtarget = (void *)test->raw_target;
+   test->raw_target = vtophys(test->raw_vtarget);
+   } else {
+   test->raw_vtarget = pmap_mapdev(test->raw_target,
+   test->buffer_size);
+   }
+   }
+
index = g_thread_index++;
TAILQ_INIT(&test->free_q);
TAILQ_INIT(&test->pend_q);
@@ -373,6 +409,9 @@ ioat_dma_test(void *arg)
 
ioat_test_release_memory(test);
 out:
+   if (test->testkind == IOAT_TEST_RAW_DMA && !test->raw_is_virtual)
+   pmap_unmapdev((vm_offset_t)test->raw_vtarget,
+   test->buffer_size);
ioat_put_dmaengine(dmaengine);
 }
 

Modified: head/sys/dev/ioat/ioat_test.h
==
--- head/sys/dev/ioat/ioat_test.h   Thu Oct 29 03:28:28 2015
(r290128)
+++ head/sys/dev/ioat/ioat_test.h   Thu Oct 29 04:16:16 2015
(r290129)
@@ -41,6 +41,7 @@ enum ioat_res {
 enum ioat_test_kind {
IOAT_TEST_FILL = 0,
IOAT_TEST_DMA,
+   IOAT_TEST_RAW_DMA,
IOAT_NUM_TESTKINDS
 };
 
@@ -66,6 +67,12 @@ struct ioat_test {
/* If true, check for miscompares after a copy. */
bool verify;
 
+   /* DMA directly to/from some memory address */
+   uint64_t raw_target;
+   void *raw_vtarget;
+   bool raw_write;
+   bool raw_is_virtual;
+
/* Internal usage -- not test inputs */
TAILQ_HEAD(, test_transaction) free_q;
TAILQ_HEAD(, test_transaction) pend_q;

Modified: head/tools/tools/ioat/ioatcontrol.8
=

svn commit: r290130 - head/sys/dev/ntb/ntb_hw

2015-10-28 Thread Conrad E. Meyer
Author: cem
Date: Thu Oct 29 04:16:28 2015
New Revision: 290130
URL: https://svnweb.freebsd.org/changeset/base/290130

Log:
  ntb: Do not attempt to set write-combining on MWs
  
  AMD64 pmap assumes ranges will be in the DMAP, which isn't necessarily
  true for NTB memory windows (especially 64-bit BARs).
  
  Suggested by: pmap_change_attr_locked -> kassert_panic
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw.c

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==
--- head/sys/dev/ntb/ntb_hw/ntb_hw.cThu Oct 29 04:16:16 2015
(r290129)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.cThu Oct 29 04:16:28 2015
(r290130)
@@ -755,9 +755,13 @@ map_memory_window_bar(struct ntb_softc *
save_bar_parameters(bar);
}
 
+#if 0  /* XXX: amd64 pmap_change_attr() assumes region lies in DMAP. */
/* Mark bar region as write combining to improve performance. */
rc = pmap_change_attr((vm_offset_t)bar->vbase, bar->size,
VM_MEMATTR_WRITE_COMBINING);
+#else
+   rc = EINVAL;
+#endif
print_map_success(ntb, bar, "mw");
if (rc == 0)
device_printf(ntb->device,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290132 - head/sys/dev/ioat

2015-10-28 Thread Conrad E. Meyer
Author: cem
Date: Thu Oct 29 04:16:52 2015
New Revision: 290132
URL: https://svnweb.freebsd.org/changeset/base/290132

Log:
  ioat_test: Handled forced hardware resets gracefully
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat_test.c

Modified: head/sys/dev/ioat/ioat_test.c
==
--- head/sys/dev/ioat/ioat_test.c   Thu Oct 29 04:16:39 2015
(r290131)
+++ head/sys/dev/ioat/ioat_test.c   Thu Oct 29 04:16:52 2015
(r290132)
@@ -284,12 +284,23 @@ ioat_test_submit_1_tx(struct ioat_test *
desc = ioat_blockfill(dma, dest, fillpattern,
tx->length, cb, tx, flags);
}
-
if (desc == NULL)
-   panic("Failed to allocate a ring slot "
-   "-- this shouldn't happen!");
+   break;
}
ioat_release(dma);
+
+   /*
+* We couldn't issue an IO -- either the device is being detached or
+* the HW reset.  Essentially spin until the device comes back up or
+* our timer expires.
+*/
+   if (desc == NULL && tx->depth > 0) {
+   atomic_add_32(&test->status[IOAT_TEST_NO_DMA_ENGINE], 
tx->depth);
+   IT_LOCK();
+   TAILQ_REMOVE(&test->pend_q, tx, entry);
+   TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
+   IT_UNLOCK();
+   }
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-10-28 Thread Kevin Lo
Author: kevlo
Date: Thu Oct 29 03:28:28 2015
New Revision: 290128
URL: https://svnweb.freebsd.org/changeset/base/290128

Log:
  Add MLINKS for if_otus(4), if_rsu(4) and if_urtwn(4).

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileThu Oct 29 03:22:27 2015
(r290127)
+++ head/share/man/man4/MakefileThu Oct 29 03:28:28 2015
(r290128)
@@ -672,6 +672,7 @@ MLINKS+=nge.4 if_nge.4
 MLINKS+=${_ntb.4} ${_if_ntb.4} \
${_ntb.4} ${_ntb_hw.4}
 MLINKS+=${_nxge.4} ${_if_nxge.4}
+MLINKS+=otus.4 if_otus.4
 MLINKS+=ow.4 onewire.4
 MLINKS+=patm.4 if_patm.4
 MLINKS+=pccbb.4 cbb.4
@@ -685,6 +686,7 @@ MLINKS+=rl.4 if_rl.4
 MLINKS+=rue.4 if_rue.4
 MLINKS+=rum.4 if_rum.4
 MLINKS+=run.4 if_run.4
+MLINKS+=rsu.4 if_rsu.4
 MLINKS+=scsi.4 CAM.4 \
scsi.4 cam.4 \
scsi.4 scbus.4 \
@@ -713,6 +715,7 @@ MLINKS+=tl.4 if_tl.4
 MLINKS+=tun.4 if_tun.4
 MLINKS+=tx.4 if_tx.4
 MLINKS+=txp.4 if_txp.4
+MLINKS+=urtwn.4 if_urtwn.4
 MLINKS+=vge.4 if_vge.4
 MLINKS+=vlan.4 if_vlan.4
 MLINKS+=vxlan.4 if_vxlan.4
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-10-28 Thread Kevin Lo
Author: kevlo
Date: Thu Oct 29 03:22:27 2015
New Revision: 290127
URL: https://svnweb.freebsd.org/changeset/base/290127

Log:
  Xref otus(4).

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

Modified: head/share/man/man4/wlan.4
==
--- head/share/man/man4/wlan.4  Thu Oct 29 00:41:03 2015(r290126)
+++ head/share/man/man4/wlan.4  Thu Oct 29 03:22:27 2015(r290127)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 10, 2015
+.Dd October 29, 2015
 .Dt WLAN 4
 .Os
 .Sh NAME
@@ -182,6 +182,7 @@ may not interoperate.
 .Xr malo 4 ,
 .Xr mwl 4 ,
 .Xr netintro 4 ,
+.Xr otus 4 ,
 .Xr ral 4 ,
 .Xr rsu 4 ,
 .Xr rum 4 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290126 - head/share/mk

2015-10-28 Thread Bryan Drewery
Author: bdrewery
Date: Thu Oct 29 00:41:03 2015
New Revision: 290126
URL: https://svnweb.freebsd.org/changeset/base/290126

Log:
  Fix regression from using .USEBEFORE in _SUBDIR in r289705.
  
  Using .USEBEFORE had the unintended side-effect of changing the directory for
  the real target ran in the current directory.  For example this meant that
  the 'make clean' would run in one of the SUBDIR.
  
  Sponsored by: EMC / Isilon Storage Division
  Pointyhat to: bdrewery

Modified:
  head/share/mk/bsd.subdir.mk

Modified: head/share/mk/bsd.subdir.mk
==
--- head/share/mk/bsd.subdir.mk Thu Oct 29 00:36:10 2015(r290125)
+++ head/share/mk/bsd.subdir.mk Thu Oct 29 00:41:03 2015(r290126)
@@ -83,7 +83,7 @@ _SUBDIR_SH=   \
 _SUBDIR: .USEBEFORE
 .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
@${_+_}target=${.TARGET:S,realinstall,install,}; \
-   for dir in ${SUBDIR:N.WAIT}; do ${_SUBDIR_SH}; done
+   for dir in ${SUBDIR:N.WAIT}; do ( ${_SUBDIR_SH} ); done
 .endif
 
 ${SUBDIR:N.WAIT}: .PHONY .MAKE
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-10-28 Thread Hiren Panchasara
Author: hiren
Date: Thu Oct 29 00:36:10 2015
New Revision: 290125
URL: https://svnweb.freebsd.org/changeset/base/290125

Log:
  MFC r289293
  
  Fix an unnecessarily aggressive behavior where mtu clamping begins on first
  retransmission timeout (rto) when blackhole detection is enabled.  Make
  sure it only happens when the second attempt to send the same segment also 
fails
  with rto.
  
  Also make sure that each mtu probing stage (usually 1448 -> 1188 -> 524) 
follows
  the same pattern and gets 2 chances (rto) before further clamping down.
  
  Note: RFC4821 doesn't specify implementation details on how this situation
  should be handled.

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

Modified: stable/10/sys/netinet/tcp_timer.c
==
--- stable/10/sys/netinet/tcp_timer.c   Thu Oct 29 00:18:03 2015
(r290124)
+++ stable/10/sys/netinet/tcp_timer.c   Thu Oct 29 00:36:10 2015
(r290125)
@@ -617,9 +617,15 @@ tcp_timer_rexmt(void * xtp)
int isipv6;
 #endif
 
+   /*
+* Idea here is that at each stage of mtu probe (usually, 1448
+* -> 1188 -> 524) should be given 2 chances to recover before
+*  further clamping down. 'tp->t_rxtshift % 2 == 0' should
+*  take care of that.
+*/
if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) ==
(TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) &&
-   (tp->t_rxtshift <= 2)) {
+   (tp->t_rxtshift >= 2 && tp->t_rxtshift % 2 == 0)) {
/*
 * Enter Path MTU Black-hole Detection mechanism:
 * - Disable Path MTU Discovery (IP "DF" bit).
@@ -687,9 +693,11 @@ tcp_timer_rexmt(void * xtp)
 * with a lowered MTU, maybe this isn't a blackhole and
 * we restore the previous MSS and blackhole detection
 * flags.
+* The limit '6' is determined by giving each probe
+* stage (1448, 1188, 524) 2 chances to recover.
 */
if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) &&
-   (tp->t_rxtshift > 4)) {
+   (tp->t_rxtshift > 6)) {
tp->t_flags2 |= TF2_PLPMTU_PMTUD;
tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
optlen = tp->t_maxopd - tp->t_maxseg;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290124 - stable/10/sys/boot/pc98/boot2

2015-10-28 Thread John Baldwin
Author: jhb
Date: Thu Oct 29 00:18:03 2015
New Revision: 290124
URL: https://svnweb.freebsd.org/changeset/base/290124

Log:
  MFC 278582:
  MFi386:
  When building some of the boot loaders with clang, and DEBUG_FLAGS or
  CFLAGS having '-g' in it, clang outputs several assembly directives that
  are too new for our version of binutils.
  
  Therefore, assemble the resulting .s files with clang instead.  A more
  general solution can be implemented when a GNU as-compatible driver for
  clang's integrated assembler appears.

Modified:
  stable/10/sys/boot/pc98/boot2/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/pc98/boot2/Makefile
==
--- stable/10/sys/boot/pc98/boot2/Makefile  Wed Oct 28 23:39:33 2015
(r290123)
+++ stable/10/sys/boot/pc98/boot2/Makefile  Thu Oct 29 00:18:03 2015
(r290124)
@@ -93,6 +93,7 @@ boot2.out: ${BTXCRT} boot2.o sio.o
${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
 
 boot2.o: boot2.s
+   ${CC} ${ACFLAGS} -c boot2.s
 
 SRCS=  boot2.c boot2.h
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290123 - head/sys/mips/atheros

2015-10-28 Thread Adrian Chadd
Author: adrian
Date: Wed Oct 28 23:39:33 2015
New Revision: 290123
URL: https://svnweb.freebsd.org/changeset/base/290123

Log:
  Oops - use the wrong array offset.

Modified:
  head/sys/mips/atheros/if_arge.c

Modified: head/sys/mips/atheros/if_arge.c
==
--- head/sys/mips/atheros/if_arge.c Wed Oct 28 22:57:51 2015
(r290122)
+++ head/sys/mips/atheros/if_arge.c Wed Oct 28 23:39:33 2015
(r290123)
@@ -2485,7 +2485,7 @@ arge_intr(void *arg)
 #ifdef ARGE_DEBUG
for (i = 0; i < 32; i++) {
if (status & (1 << i)) {
-   sc->intr_stats.count[1 << i]++;
+   sc->intr_stats.count[i]++;
}
}
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290122 - head/sys/netinet

2015-10-28 Thread Hiren Panchasara
Author: hiren
Date: Wed Oct 28 22:57:51 2015
New Revision: 290122
URL: https://svnweb.freebsd.org/changeset/base/290122

Log:
  Calculate the correct amount of bytes that are in-flight for a connection as
  suggested by RFC 6675.
  
  Currently differnt places in the stack tries to guess this in suboptimal ways.
  The main problem is that current calculations don't take sacked bytes into
  account. Sacked bytes are the bytes receiver acked via SACK option. This is
  suboptimal because it assumes that network has more outstanding (unacked) 
bytes
  than the actual value and thus sends less data by setting congestion window
  lower than what's possible which in turn may cause slower recovery from 
losses.
  
  As an example, one of the current calculations looks something like this:
  snd_nxt - snd_fack + sackhint.sack_bytes_rexmit
  New proposal from RFC 6675 is:
  snd_max - snd_una - sackhint.sacked_bytes + sackhint.sack_bytes_rexmit
  which takes sacked bytes into account which is a new addition to the sackhint
  struct. Only thing we are missing from RFC 6675 is isLost() i.e. segment being
  considered lost and thus adjusting pipe based on that which makes this
  calculation a bit on conservative side.
  
  The approach is very simple. We already process each ack with sack info in
  tcp_sack_doack() and extract sack blocks/holes out of it. We'd now also track
  this new variable sacked_bytes which keeps track of total sacked bytes 
reported.
  
  One downside to this approach is that we may get incorrect count of 
sacked_bytes
  if the other end decides to drop sack info in the ack because of memory 
pressure
  or some other reasons. But in this (not very likely) case also the pipe
  calculation would be conservative which is okay as opposed to being aggressive
  in sending packets into the network.
  
  Next step is to use this more accurate pipe estimation to drive congestion
  window adjustments.
  
  In collaboration with:rrs
  Reviewed by:  jason_eggnet dot com, rrs
  MFC after:2 weeks
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D3971

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_sack.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Oct 28 22:49:37 2015
(r290121)
+++ head/sys/netinet/tcp_input.cWed Oct 28 22:57:51 2015
(r290122)
@@ -148,6 +148,11 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop
 &VNET_NAME(drop_synfin), 0,
 "Drop TCP packets with SYN+FIN set");
 
+VNET_DEFINE(int, tcp_do_rfc6675_pipe) = 0;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_pipe, CTLFLAG_VNET | CTLFLAG_RW,
+&VNET_NAME(tcp_do_rfc6675_pipe), 0,
+"Use calculated pipe/in-flight bytes per RFC 6675");
+
 VNET_DEFINE(int, tcp_do_rfc3042) = 1;
 #defineV_tcp_do_rfc3042VNET(tcp_do_rfc3042)
 SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc3042, CTLFLAG_VNET | CTLFLAG_RW,
@@ -2420,6 +2425,12 @@ tcp_do_segment(struct mbuf *m, struct tc
((to.to_flags & TOF_SACK) ||
 !TAILQ_EMPTY(&tp->snd_holes)))
tcp_sack_doack(tp, &to, th->th_ack);
+   else
+   /*
+* Reset the value so that previous (valid) value
+* from the last ack with SACK doesn't get used.
+*/
+   tp->sackhint.sacked_bytes = 0;
 
/* Run HHOOK_TCP_ESTABLISHED_IN helper hooks. */
hhook_run_tcp_est_in(tp, th, &to);
@@ -2483,8 +2494,12 @@ tcp_do_segment(struct mbuf *m, struct tc
 * we have less than 1/2 the 
original window's
 * worth of data in flight.
 */
-   awnd = (tp->snd_nxt - 
tp->snd_fack) +
-   
tp->sackhint.sack_bytes_rexmit;
+   if (V_tcp_do_rfc6675_pipe)
+   awnd = 
tcp_compute_pipe(tp);
+   else
+   awnd = (tp->snd_nxt - 
tp->snd_fack) +
+   
tp->sackhint.sack_bytes_rexmit;
+
if (awnd < tp->snd_ssthresh) {
tp->snd_cwnd += 
tp->t_maxseg;
if (tp->snd_cwnd > 
tp->snd_ssthresh)
@@ -3729,3 +3744,11 @@ tcp_newreno_partial_ack(struct tcpcb *tp
tp->snd_cwnd = 0;
tp->snd_cwnd += tp->t_maxseg;
 }
+
+int
+tcp_compute_pipe

svn commit: r290121 - head/secure/lib/libcrypto

2015-10-28 Thread Jung-uk Kim
Author: jkim
Date: Wed Oct 28 22:49:37 2015
New Revision: 290121
URL: https://svnweb.freebsd.org/changeset/base/290121

Log:
  Define endianness for non-x86 platforms.
  
  MFC after:3 days

Modified:
  head/secure/lib/libcrypto/Makefile.inc

Modified: head/secure/lib/libcrypto/Makefile.inc
==
--- head/secure/lib/libcrypto/Makefile.inc  Wed Oct 28 21:17:38 2015
(r290120)
+++ head/secure/lib/libcrypto/Makefile.inc  Wed Oct 28 22:49:37 2015
(r290121)
@@ -13,8 +13,16 @@ CFLAGS+= -DTERMIOS -DANSI_SOURCE
 CFLAGS+=   -I${LCRYPTO_SRC} -I${LCRYPTO_SRC}/crypto -I${.OBJDIR}
 CFLAGS+=   -DOPENSSL_THREADS -DDSO_DLFCN -DHAVE_DLFCN_H
 
+.include 
+
+.if ${TARGET_ENDIANNESS} == 1234
+CFLAGS+=-DL_ENDIAN
+.elif ${TARGET_ENDIANNESS} == 4321
+CFLAGS+=-DB_ENDIAN
+.endif
+
 .if ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+=-DL_ENDIAN -DOPENSSL_IA32_SSE2
+CFLAGS+=-DOPENSSL_IA32_SSE2
 CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM
 CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m
 CFLAGS+=-DMD5_ASM
@@ -22,7 +30,7 @@ CFLAGS+=-DGHASH_ASM
 CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
 CFLAGS+=-DWHIRLPOOL_ASM
 .elif ${MACHINE_CPUARCH} == "i386"
-CFLAGS+=-DL_ENDIAN -DOPENSSL_IA32_SSE2
+CFLAGS+=-DOPENSSL_IA32_SSE2
 CFLAGS+=-DAES_ASM -DVPAES_ASM
 CFLAGS+=-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
 CFLAGS+=-DMD5_ASM
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r290110 - in head: include lib/libc/stdio

2015-10-28 Thread John Baldwin
On Wednesday, October 28, 2015 08:52:15 AM Xin Li wrote:
> 
> On 10/28/15 07:40, Andrey A. Chernov wrote:
> > Author: ache
> > Date: Wed Oct 28 14:40:02 2015
> > New Revision: 290110
> > URL: https://svnweb.freebsd.org/changeset/base/290110
> > 
> > Log:
> >   Add _flags2 per jhb@ suggestion since no room left in _flags.
> >   Rewrite O_APPEND flag checking using new __S2OAP flag.
> 
> Is this ABI-safe?  (I was somewhat surprised that struct FILE is not
> opaque, which seems to be unavoidable because some methods are
> traditionally macros that have direct access to the members; the
> addition is done in the end of the structure so it looks like the change
> is safe).

I believe that adding new fields should be safe.  Allocating a static
FILE object in an application hasn't been supported in a long while.

However, we cannot make FILE fully opaque.  (I tried and had to revert
it.)  I have thought about using an #ifdef to hide all of the members
not marked for ABI compat though so that they are otherwise only
accessible to libc's implementation.  This is probably worth doing to
at least prevent accidental use of the internal fields.

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


svn commit: r290120 - in head/sys/arm: arm include

2015-10-28 Thread Jason A. Harmening
Author: jah
Date: Wed Oct 28 21:17:38 2015
New Revision: 290120
URL: https://svnweb.freebsd.org/changeset/base/290120

Log:
  Retire pmap_dmap_iscurrent().  It is only a wrapper around pmap_is_current(), 
and is no longer called.

Modified:
  head/sys/arm/arm/pmap-v6-new.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/include/pmap-v6.h
  head/sys/arm/include/pmap.h

Modified: head/sys/arm/arm/pmap-v6-new.c
==
--- head/sys/arm/arm/pmap-v6-new.c  Wed Oct 28 19:11:06 2015
(r290119)
+++ head/sys/arm/arm/pmap-v6-new.c  Wed Oct 28 21:17:38 2015
(r290120)
@@ -5947,13 +5947,6 @@ pmap_activate(struct thread *td)
critical_exit();
 }
 
-int
-pmap_dmap_iscurrent(pmap_t pmap)
-{
-
-   return (pmap_is_current(pmap));
-}
-
 /*
  *  Perform the pmap work for mincore.
  */

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Wed Oct 28 19:11:06 2015(r290119)
+++ head/sys/arm/arm/pmap-v6.c  Wed Oct 28 21:17:38 2015(r290120)
@@ -5398,12 +5398,6 @@ pmap_map_chunk(vm_offset_t l1pt, vm_offs
 
 }
 
-int
-pmap_dmap_iscurrent(pmap_t pmap)
-{
-   return(pmap_is_current(pmap));
-}
-
 void
 pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma)
 {

Modified: head/sys/arm/include/pmap-v6.h
==
--- head/sys/arm/include/pmap-v6.h  Wed Oct 28 19:11:06 2015
(r290119)
+++ head/sys/arm/include/pmap-v6.h  Wed Oct 28 21:17:38 2015
(r290120)
@@ -265,11 +265,6 @@ void pmap_devmap_bootstrap(const struct 
 #definePMAP_DOMAIN_KERNEL  0   /* The kernel uses domain #0 */
 
 /*
- * sys/arm/arm/busdma_machdep-v6.c
- */
-int pmap_dmap_iscurrent(pmap_t pmap);
-
-/*
  * sys/arm/arm/cpufunc.c
  */
 void pmap_pte_init_mmu_v6(void);

Modified: head/sys/arm/include/pmap.h
==
--- head/sys/arm/include/pmap.h Wed Oct 28 19:11:06 2015(r290119)
+++ head/sys/arm/include/pmap.h Wed Oct 28 21:17:38 2015(r290120)
@@ -277,7 +277,6 @@ void
 pmap_map_entry(vm_offset_t l1pt, vm_offset_t va, vm_offset_t pa, int prot,
 int cache);
 int pmap_fault_fixup(pmap_t, vm_offset_t, vm_prot_t, int);
-int pmap_dmap_iscurrent(pmap_t pmap);
 
 /*
  * Definitions for MMU domains
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290118 - head/sys/dev/isp

2015-10-28 Thread Alexander Motin
Author: mav
Date: Wed Oct 28 19:08:51 2015
New Revision: 290118
URL: https://svnweb.freebsd.org/changeset/base/290118

Log:
  Change the way how target mode is enabled on 23xx chips.
  
  Without docs I am not completely sure about this, but on my tests new
  method works better then previous, at least with our latest firmware.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Wed Oct 28 18:53:18 2015(r290117)
+++ head/sys/dev/isp/isp.c  Wed Oct 28 19:08:51 2015(r290118)
@@ -1895,7 +1895,7 @@ isp_fibre_init(ispsoftc_t *isp)
icbp->icb_logintime = ICB_LOGIN_TOV;
 
 #ifdef ISP_TARGET_MODE
-   if (ISP_FW_NEWER_THAN(isp, 3, 25, 0) && (icbp->icb_fwoptions & 
ICBOPT_TGT_ENABLE)) {
+   if (IS_23XX(isp) && (icbp->icb_fwoptions & ICBOPT_TGT_ENABLE)) {
icbp->icb_lunenables = 0x;
icbp->icb_ccnt = DFLT_CMND_CNT;
icbp->icb_icnt = DFLT_INOT_CNT;

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Wed Oct 28 18:53:18 2015
(r290117)
+++ head/sys/dev/isp/isp_freebsd.c  Wed Oct 28 19:08:51 2015
(r290118)
@@ -1414,7 +1414,8 @@ isp_enable_deferred(ispsoftc_t *isp, int
 
ISP_GET_PC(isp, bus, tm_luns_enabled, luns_already_enabled);
isp_prt(isp, ISP_LOGTINFO, "%s: bus %d lun %jx luns_enabled %d", 
__func__, bus, (uintmax_t)lun, luns_already_enabled);
-   if (IS_24XX(isp) || (IS_FC(isp) && luns_already_enabled)) {
+   if (IS_23XX(isp) || IS_24XX(isp) ||
+   (IS_FC(isp) && luns_already_enabled)) {
status = CAM_REQ_CMP;
} else {
int cmd_cnt, not_cnt;
@@ -1485,7 +1486,7 @@ isp_disable_lun(ispsoftc_t *isp, union c
/*
 * If we're a 24XX card, we're done.
 */
-   if (IS_24XX(isp)) {
+   if (IS_23XX(isp) || IS_24XX(isp)) {
status = CAM_REQ_CMP;
goto done;
}
@@ -1501,7 +1502,7 @@ isp_disable_lun(ispsoftc_t *isp, union c
if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun, 0, 0)) {
status = CAM_RESRC_UNAVAIL;
} else {
-   mtx_sleep(ccb, &isp->isp_lock, PRIBIO, "isp_disable_lun", 0);
+   mtx_sleep(&status, &isp->isp_lock, PRIBIO, "isp_disable_lun", 
0);
}
isp->isp_osinfo.rptr = NULL;
 done:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290119 - head/share/man/man9

2015-10-28 Thread Warner Losh
Author: imp
Date: Wed Oct 28 19:11:06 2015
New Revision: 290119
URL: https://svnweb.freebsd.org/changeset/base/290119

Log:
  BUS_ADD_CHILD calls device_add_child. device_add_child does not call
  BUS_ADD_CHILD. Make it explicit since it follows the command paradigm
  rather than the callback paradigm. Add other clarifying notes as well.

Modified:
  head/share/man/man9/BUS_ADD_CHILD.9
  head/share/man/man9/device_add_child.9

Modified: head/share/man/man9/BUS_ADD_CHILD.9
==
--- head/share/man/man9/BUS_ADD_CHILD.9 Wed Oct 28 19:08:51 2015
(r290118)
+++ head/share/man/man9/BUS_ADD_CHILD.9 Wed Oct 28 19:11:06 2015
(r290119)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 13, 2004
+.Dd October 28, 2015
 .Dt BUS_ADD_CHILD 9
 .Os
 .Sh NAME
@@ -44,6 +44,8 @@ The
 .Fn BUS_ADD_CHILD
 method
 is used by the driver identify routine to add devices to the tree.
+It can also be used to add children to buses that implement this
+routine in other contexts, although the behavior is bus specific.
 Please see
 .Xr device_add_child 9
 for more details.
@@ -53,18 +55,31 @@ however, the bus'
 .Fn BUS_ADD_CHILD
 is called.
 .Pp
-Busses implementing
+Buses implementing
 .Fn BUS_ADD_CHILD
 should insert the device into the tree using
 .Xr device_add_child 9
 before adding things such as their own ivars and resource lists to the device.
+.Fn BUS_ADD_CHILD
+is not called by
+.Xr device_add_child 9 .
+.Fn BUS_ADD_CHILD
+instead calls
+.Xr device_add_child 9 .
+.Pp
+A panic will result when called for a bus that does not implement
+.Fn BUS_ADD_CHILD .
+Some buses require a special bus-specific routine to be called instead
+of
+.Fn BUS_ADD_CHILD .
 .Sh RETURN VALUES
 The
 .Fn BUS_ADD_CHILD
 method returns
 .Vt device_t
 added to the tree, or
-.Dv NULL .
+.Dv NULL
+to indicate failure.
 .Sh SEE ALSO
 .Xr device 9 ,
 .Xr device_add_child 9 ,

Modified: head/share/man/man9/device_add_child.9
==
--- head/share/man/man9/device_add_child.9  Wed Oct 28 19:08:51 2015
(r290118)
+++ head/share/man/man9/device_add_child.9  Wed Oct 28 19:11:06 2015
(r290119)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 12, 2006
+.Dd October 28, 2015
 .Dt DEVICE_ADD_CHILD 9
 .Os
 .Sh NAME
@@ -74,14 +74,14 @@ Normally unit numbers will be chosen aut
 unit number of
 .Dv -1
 should be given.
-When a specific unit number is desired (e.g.\& for wiring a particular
+When a specific unit number is desired (e.g.,\& for wiring a particular
 piece of hardware to a pre-configured unit number), that unit should
 be passed.
 If the specified unit number is already allocated, a new
 unit will be allocated and a diagnostic message printed.
 .Pp
 If the devices attached to a bus must be probed in a specific order
-(e.g.\& for the ISA bus some devices are sensitive to failed probe attempts
+(e.g.,\& for the ISA bus some devices are sensitive to failed probe attempts
 of unrelated drivers and therefore must be probed first),
 the
 .Fa order
@@ -109,10 +109,18 @@ Authors of bus drivers must likewise be 
 when they are loaded and unloaded to avoid duplication of children
 devices.
 .Pp
-Identify routines should use
+When adding a child to another device node, such as in an identify
+routine, use
 .Xr BUS_ADD_CHILD 9
 instead of
 .Xr device_add_child 9 .
+.Xr BUS_ADD_CHILD 9
+will call
+.Xr device_add_child 9
+and add the proper bus-specific data to the new child.
+.Fn device_add_child
+does not call
+.Xr BUS_ADD_CHILD 9 .
 .Sh RETURN VALUES
 The new device if successful, NULL otherwise.
 .Sh SEE ALSO
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290117 - head/sys/kern

2015-10-28 Thread Warner Losh
Author: imp
Date: Wed Oct 28 18:53:18 2015
New Revision: 290117
URL: https://svnweb.freebsd.org/changeset/base/290117

Log:
  Add a note to the effect that BUS_ADD_CHILD calls
  device_add_child_ordered to add the child. device_add_child_ordered
  doesn't call BUS_ADD_CHILD.

Modified:
  head/sys/kern/bus_if.m

Modified: head/sys/kern/bus_if.m
==
--- head/sys/kern/bus_if.m  Wed Oct 28 17:55:37 2015(r290116)
+++ head/sys/kern/bus_if.m  Wed Oct 28 18:53:18 2015(r290117)
@@ -209,7 +209,9 @@ METHOD void driver_added {
  * For busses which use use drivers supporting DEVICE_IDENTIFY() to
  * enumerate their devices, this method is used to create new
  * device instances. The new device will be added after the last
- * existing child with the same order.
+ * existing child with the same order. Implementations of bus_add_child
+ * call device_add_child_ordered to add the child and often add
+ * a suitable ivar to the device specific to that bus.
  * 
  * @param _dev the bus device which will be the parent of the
  * new child device
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r290110 - in head: include lib/libc/stdio

2015-10-28 Thread Wolfgang Jenkner
On Wed, Oct 28 2015, Conrad Meyer wrote:

> JHB has a patch floating around to remove all the FILE macros
> and re-private the contents of the FILE struct.  As Bryan
> said already, Perl reaches in directly for the fd number and
> needs to be fixed before that can land.

And Emacs uses _p and _bf (or rather, _bf._base) via a gnulib module:

https://www.gnu.org/software/gnulib/MODULES.html#module=fpending

(the interesting stuff is in fpending.m4).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290116 - head/sys/net

2015-10-28 Thread Andrey V. Elsukov
Author: ae
Date: Wed Oct 28 17:55:37 2015
New Revision: 290116
URL: https://svnweb.freebsd.org/changeset/base/290116

Log:
  Check the size of data available in mbuf, before using them.
  
  PR:   202667
  MFC after:1 week

Modified:
  head/sys/net/if_gre.c

Modified: head/sys/net/if_gre.c
==
--- head/sys/net/if_gre.c   Wed Oct 28 16:31:04 2015(r290115)
+++ head/sys/net/if_gre.c   Wed Oct 28 17:55:37 2015(r290116)
@@ -691,6 +691,14 @@ gre_input(struct mbuf **mp, int *offp, i
KASSERT(sc != NULL, ("encap_getarg returned NULL"));
 
ifp = GRE2IFP(sc);
+   hlen = *offp + sizeof(struct grehdr) + 4 * sizeof(uint32_t);
+   if (m->m_pkthdr.len < hlen)
+   goto drop;
+   if (m->m_len < hlen) {
+   m = m_pullup(m, hlen);
+   if (m == NULL)
+   goto drop;
+   }
gh = (struct grehdr *)mtodo(m, *offp);
flags = ntohs(gh->gre_flags);
if (flags & ~GRE_FLAGS_MASK)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r290110 - in head: include lib/libc/stdio

2015-10-28 Thread Conrad Meyer
On Wed, 28 Oct 2015 08:52:15 -0700
Xin Li  wrote:
> On 10/28/15 07:40, Andrey A. Chernov wrote:

> >   Add _flags2 per jhb@ suggestion since no room left in
> > _flags. Rewrite O_APPEND flag checking using new __S2OAP
> > flag.
> 
> Is this ABI-safe?  (I was somewhat surprised that struct
> FILE is not opaque, which seems to be unavoidable because
> some methods are traditionally macros that have direct
> access to the members; the addition is done in the end of
> the structure so it looks like the change is safe).


It breaks anything that depends on the size of __sFILE
(IMO dead code walking).  Otherwise it should be ABI
compatible, since the flags2 member is only added at the end.

JHB has a patch floating around to remove all the FILE macros
and re-private the contents of the FILE struct.  As Bryan
said already, Perl reaches in directly for the fd number and
needs to be fixed before that can land.

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


Re: svn commit: r290110 - in head: include lib/libc/stdio

2015-10-28 Thread Andrey Chernov
On 28.10.2015 18:52, Xin Li wrote:
> 
> On 10/28/15 07:40, Andrey A. Chernov wrote:
>> Author: ache Date: Wed Oct 28 14:40:02 2015 New Revision: 290110 
>> URL: https://svnweb.freebsd.org/changeset/base/290110
>> 
>> Log: Add _flags2 per jhb@ suggestion since no room left in
>> _flags. Rewrite O_APPEND flag checking using new __S2OAP flag.
> 
> Is this ABI-safe?  (I was somewhat surprised that struct FILE is
> not opaque, which seems to be unavoidable because some methods are 
> traditionally macros that have direct access to the members; the 
> addition is done in the end of the structure so it looks like the
> change is safe).

According to jhb@, yes. See
https://lists.freebsd.org/pipermail/svn-src-head/2015-October/078113.html

-- 
http://ache.vniz.net/



signature.asc
Description: OpenPGP digital signature


svn commit: r290115 - head/usr.sbin/mpsutil

2015-10-28 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 28 16:31:04 2015
New Revision: 290115
URL: https://svnweb.freebsd.org/changeset/base/290115

Log:
  Include libutil's headers directly from src to avoid recording a dirdeps
  dependency for META MODE.

Modified:
  head/usr.sbin/mpsutil/Makefile
  head/usr.sbin/mpsutil/Makefile.depend

Modified: head/usr.sbin/mpsutil/Makefile
==
--- head/usr.sbin/mpsutil/Makefile  Wed Oct 28 16:28:28 2015
(r290114)
+++ head/usr.sbin/mpsutil/Makefile  Wed Oct 28 16:31:04 2015
(r290115)
@@ -11,7 +11,8 @@ LINKS=${BINDIR}/mpsutil ${BINDIR}/mprut
 MLINKS=mpsutil.8 mprutil.8
 
 CFLAGS+= -I${.CURDIR}/../../sys -I. -DUSE_MPT_IOCTLS
-
+# Avoid dirdep dependency on libutil
+CFLAGS+= -I${SRCTOP}/lib/libutil
 
 # Here be dragons
 .ifdef DEBUG

Modified: head/usr.sbin/mpsutil/Makefile.depend
==
--- head/usr.sbin/mpsutil/Makefile.depend   Wed Oct 28 16:28:28 2015
(r290114)
+++ head/usr.sbin/mpsutil/Makefile.depend   Wed Oct 28 16:31:04 2015
(r290115)
@@ -9,7 +9,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
-   lib/libutil \
 
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290114 - svnadmin/conf

2015-10-28 Thread Konstantin Belousov
Author: kib
Date: Wed Oct 28 16:28:28 2015
New Revision: 290114
URL: https://svnweb.freebsd.org/changeset/base/290114

Log:
  Welcome Svatopluk Kraus to the rank of src committers.  His main interest
  area is ARM architecture.
  
  Approved by:  core

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessWed Oct 28 16:22:00 2015(r290113)
+++ svnadmin/conf/accessWed Oct 28 16:28:28 2015(r290114)
@@ -207,6 +207,7 @@ se
 silby
 simon
 sjg
+skra
 slm
 smh
 sobomax

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Wed Oct 28 16:22:00 2015(r290113)
+++ svnadmin/conf/mentors   Wed Oct 28 16:28:28 2015(r290114)
@@ -33,6 +33,7 @@ peterjjhb Co-mentor: grog
 slmken Co-mentor: scottl, ambrisko
 snbdwmalone
 lidl   rpaulo  Co-mentor: adrian
+skra   kib
 torek  rpaulo
 venkat delphij Co-mentor: luigi, jhb
 versus gavin   Co-mentor: fjoe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290113 - in head: targets/pseudo/userland usr.sbin/mpsutil

2015-10-28 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 28 16:22:00 2015
New Revision: 290113
URL: https://svnweb.freebsd.org/changeset/base/290113

Log:
  Connect mpsutil for META MODE.

Added:
  head/usr.sbin/mpsutil/Makefile.depend   (contents, props changed)
Modified:
  head/targets/pseudo/userland/Makefile.depend

Modified: head/targets/pseudo/userland/Makefile.depend
==
--- head/targets/pseudo/userland/Makefile.dependWed Oct 28 15:00:21 
2015(r290112)
+++ head/targets/pseudo/userland/Makefile.dependWed Oct 28 16:22:00 
2015(r290113)
@@ -564,6 +564,7 @@ DIRDEPS+= \
usr.sbin/mlxcontrol \
usr.sbin/mountd \
usr.sbin/moused \
+   usr.sbin/mpsutil \
usr.sbin/mptutil \
usr.sbin/mtest \
usr.sbin/mtree \

Added: head/usr.sbin/mpsutil/Makefile.depend
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/mpsutil/Makefile.depend   Wed Oct 28 16:22:00 2015
(r290113)
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+   gnu/lib/csu \
+   gnu/lib/libgcc \
+   include \
+   include/xlocale \
+   lib/${CSU_DIR} \
+   lib/libc \
+   lib/libcompiler_rt \
+   lib/libutil \
+
+
+.include 
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r290110 - in head: include lib/libc/stdio

2015-10-28 Thread Bryan Drewery
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 10/28/15 8:52 AM, Xin Li wrote:
> 
> On 10/28/15 07:40, Andrey A. Chernov wrote:
>> Author: ache Date: Wed Oct 28 14:40:02 2015 New Revision: 290110 
>> URL: https://svnweb.freebsd.org/changeset/base/290110
>> 
>> Log: Add _flags2 per jhb@ suggestion since no room left in
>> _flags. Rewrite O_APPEND flag checking using new __S2OAP flag.
> 
> Is this ABI-safe?  (I was somewhat surprised that struct FILE is
> not opaque, which seems to be unavoidable because some methods are 
> traditionally macros that have direct access to the members; the 
> addition is done in the end of the structure so it looks like the
> change is safe).

Perl reaches in and uses FILE->_file directly even. There's a lot of
work behind fixing that case.


- -- 
Regards,
Bryan Drewery
-BEGIN PGP SIGNATURE-
Comment: GPGTools - https://gpgtools.org

iQEcBAEBCgAGBQJWMPOQAAoJEDXXcbtuRpfPE1sH/iZRQk+XU9Uh0Ca06RHBRz/d
jROUeRLX4ILWopsRHTd/nZ8XE28R9pynxcLeVc5EbX/9eQVyXSx4xAUBkkPag5aw
B7HE+15e1fmH5EjmHeL3jW90U501lYLY9H3kwmngonzUXV2f6Rb2Y3DS+YveKWO3
H9KS9bGYt8c6H0fe7IDI7TuscaJ/ihG1GZucr0pM7pArGrO/c/9hO1T4YIO10K1O
KseVcy4sMeae5OXos8bGsFvKWzyeQ58q07Y5K3mv2nEr+FhlR+dyOYLaeNLYw3tG
p5lxYiT9UVwFvJZvjEiHxLq8NWf/4r59rmcid5xeh2Pl//Etc3fBnuz6l+50HaM=
=vQ8q
-END PGP SIGNATURE-
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r290110 - in head: include lib/libc/stdio

2015-10-28 Thread Xin Li

On 10/28/15 07:40, Andrey A. Chernov wrote:
> Author: ache
> Date: Wed Oct 28 14:40:02 2015
> New Revision: 290110
> URL: https://svnweb.freebsd.org/changeset/base/290110
> 
> Log:
>   Add _flags2 per jhb@ suggestion since no room left in _flags.
>   Rewrite O_APPEND flag checking using new __S2OAP flag.

Is this ABI-safe?  (I was somewhat surprised that struct FILE is not
opaque, which seems to be unavoidable because some methods are
traditionally macros that have direct access to the members; the
addition is done in the end of the structure so it looks like the change
is safe).

Cheers,



signature.asc
Description: OpenPGP digital signature


svn commit: r290112 - head/tools/test

2015-10-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Oct 28 15:00:21 2015
New Revision: 290112
URL: https://svnweb.freebsd.org/changeset/base/290112

Log:
  Fix spelling and grammer in tools/test/README.
  
  Reviewed by:  gnn

Modified:
  head/tools/test/README

Modified: head/tools/test/README
==
--- head/tools/test/README  Wed Oct 28 14:48:32 2015(r290111)
+++ head/tools/test/README  Wed Oct 28 15:00:21 2015(r290112)
@@ -1,6 +1,6 @@
 $FreeBSD$
 
-This directory is for standalone test programs, for the FreeBSD
+This directory is for standalone test programs.  For the FreeBSD
 Test Suite, which uses Kyua, please see /usr/src/tests/
 
 A test program is one that exercises a particular bit of the system
@@ -17,8 +17,8 @@ net   A set of generic test programs for 
 netfibsPrograms to test multi-FIB network stacks.
 posixshm   A program to test POSIX shared memory.
 ppsapi Test 1 Pulse Per Second (1PPS) input for time control.
-pthread_vfork  Chack that vfork and pthreads work together.
+pthread_vfork  Check that vfork and pthreads work together.
 ptrace Verify that ptrace works with syscalls, vfork etc.
 sort   Tests for the sort command, including a full regression.
 testfloat  Programs to test floating-point implementations
-upsdl  Test of mmap funcationality.
+upsdl  Test of mmap functionality.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290110 - in head: include lib/libc/stdio

2015-10-28 Thread Andrey A. Chernov
Author: ache
Date: Wed Oct 28 14:40:02 2015
New Revision: 290110
URL: https://svnweb.freebsd.org/changeset/base/290110

Log:
  Add _flags2 per jhb@ suggestion since no room left in _flags.
  Rewrite O_APPEND flag checking using new __S2OAP flag.
  
  MFC after:  3 weeks

Modified:
  head/include/stdio.h
  head/lib/libc/stdio/fdopen.c
  head/lib/libc/stdio/findfp.c
  head/lib/libc/stdio/fopen.c
  head/lib/libc/stdio/freopen.c
  head/lib/libc/stdio/ftell.c
  head/lib/libc/stdio/stdio.c

Modified: head/include/stdio.h
==
--- head/include/stdio.hWed Oct 28 14:21:53 2015(r290109)
+++ head/include/stdio.hWed Oct 28 14:40:02 2015(r290110)
@@ -144,6 +144,7 @@ struct __sFILE {
int _fl_count;  /* recursive lock count */
int _orientation;   /* orientation for fwide() */
__mbstate_t _mbstate;   /* multibyte conversion state */
+   int _flags2;/* additional flags */
 };
 #ifndef _STDFILE_DECLARED
 #define _STDFILE_DECLARED
@@ -176,6 +177,8 @@ __END_DECLS
 #define__SALC  0x4000  /* allocate string space dynamically */
 #define__SIGN  0x8000  /* ignore this file in _fwalk */
 
+#define__S2OAP 0x0001  /* O_APPEND mode is set */
+
 /*
  * The following three definitions are for ANSI C, which took them
  * from System V, which brilliantly took internal interface macros and

Modified: head/lib/libc/stdio/fdopen.c
==
--- head/lib/libc/stdio/fdopen.cWed Oct 28 14:21:53 2015
(r290109)
+++ head/lib/libc/stdio/fdopen.cWed Oct 28 14:40:02 2015
(r290110)
@@ -91,9 +91,8 @@ fdopen(int fd, const char *mode)
 * O_APPEND bit set, assert __SAPP so that __swrite() caller
 * will _sseek() to the end before write.
 */
-   /* XXX: Reuse __SALC for O_APPEND. */
if (fdflags & O_APPEND)
-   fp->_flags |= __SALC;
+   fp->_flags2 |= __S2OAP;
else if (oflags & O_APPEND)
fp->_flags |= __SAPP;
fp->_file = fd;

Modified: head/lib/libc/stdio/findfp.c
==
--- head/lib/libc/stdio/findfp.cWed Oct 28 14:21:53 2015
(r290109)
+++ head/lib/libc/stdio/findfp.cWed Oct 28 14:40:02 2015
(r290110)
@@ -155,6 +155,7 @@ found:
 /* fp->_fl_mutex = NULL; */ /* once set always set (reused) */
fp->_orientation = 0;
memset(&fp->_mbstate, 0, sizeof(mbstate_t));
+   fp->_flags2 = 0;
return (fp);
 }
 

Modified: head/lib/libc/stdio/fopen.c
==
--- head/lib/libc/stdio/fopen.c Wed Oct 28 14:21:53 2015(r290109)
+++ head/lib/libc/stdio/fopen.c Wed Oct 28 14:40:02 2015(r290110)
@@ -92,8 +92,7 @@ fopen(const char * __restrict file, cons
 * fseek and ftell.)
 */
if (oflags & O_APPEND) {
-   /* XXX: Reuse __SALC for O_APPEND. */
-   fp->_flags |= __SALC;
+   fp->_flags2 |= __S2OAP;
(void)_sseek(fp, (fpos_t)0, SEEK_END);
}
return (fp);

Modified: head/lib/libc/stdio/freopen.c
==
--- head/lib/libc/stdio/freopen.c   Wed Oct 28 14:21:53 2015
(r290109)
+++ head/lib/libc/stdio/freopen.c   Wed Oct 28 14:40:02 2015
(r290110)
@@ -187,6 +187,7 @@ finish:
fp->_lb._size = 0;
fp->_orientation = 0;
memset(&fp->_mbstate, 0, sizeof(mbstate_t));
+   fp->_flags2 = 0;
 
if (f < 0) {/* did not get it after all */
if (isopen)
@@ -241,8 +242,7 @@ finish:
 * fseek and ftell.)
 */
if (oflags & O_APPEND) {
-   /* XXX: Reuse __SALC for O_APPEND. */
-   fp->_flags |= __SALC;
+   fp->_flags2 |= __S2OAP;
(void) _sseek(fp, (fpos_t)0, SEEK_END);
}
FUNLOCKFILE(fp);

Modified: head/lib/libc/stdio/ftell.c
==
--- head/lib/libc/stdio/ftell.c Wed Oct 28 14:21:53 2015(r290109)
+++ head/lib/libc/stdio/ftell.c Wed Oct 28 14:40:02 2015(r290110)
@@ -119,8 +119,7 @@ _ftello(FILE *fp, fpos_t *offset)
if (HASUB(fp))
pos -= fp->_r;  /* Can be negative at this point. */
} else if ((fp->_flags & __SWR) && fp->_p != NULL) {
-   /* XXX: Reuse __SALC for O_APPEND. */
-   if (fp->_flags & (__SAPP|__SALC)) {
+   if ((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP)) {
int serrno = errno;
 
errno = 0;

Modified: head/lib/libc/stdio/stdio

svn commit: r290107 - in stable/10/etc: etc.amd64 etc.i386 etc.ia64 etc.mips etc.pc98 etc.powerpc etc.sparc64

2015-10-28 Thread Glen Barber
Author: gjb
Date: Wed Oct 28 13:30:14 2015
New Revision: 290107
URL: https://svnweb.freebsd.org/changeset/base/290107

Log:
  MFC r262957, r267591, r289634:
  
   r262957 (marcel):
Change the terminal type/class for enabled serial lines to 3wire. This
allows us to change the uart(4) driver to not hardcode specific line
settings for the serial console.
  
A terminal type of 3wire makes sure the console still works when no DCD
signal is present, which preserves behviour. When it is known that the
terminal server (or DCE in general) provides DCD, a terminal type/class
of std can be used. This has the effect of being logged out when one
disconnects from the console -- improving security overall.
  
   r267591 (grehan):
Convert the potential console port over to using 3wire, for i386/amd64.
  
   r289634:
Enable all callin ttys if the tty is an available console.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/etc/etc.amd64/ttys
  stable/10/etc/etc.i386/ttys
  stable/10/etc/etc.ia64/ttys
  stable/10/etc/etc.mips/ttys
  stable/10/etc/etc.pc98/ttys
  stable/10/etc/etc.powerpc/ttys
  stable/10/etc/etc.sparc64/ttys
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/etc.amd64/ttys
==
--- stable/10/etc/etc.amd64/ttysWed Oct 28 13:14:16 2015
(r290106)
+++ stable/10/etc/etc.amd64/ttysWed Oct 28 13:30:14 2015
(r290107)
@@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm   on 
 ttyv8  "/usr/local/bin/xdm -nodaemon"  xterm   off secure
 # Serial terminals
 # The 'dialup' keyword identifies dialin lines to login, fingerd etc.
-ttyu0  "/usr/libexec/getty std.9600"   vt100   onifconsole secure
-ttyu1  "/usr/libexec/getty std.9600"   dialup  off secure
-ttyu2  "/usr/libexec/getty std.9600"   dialup  off secure
-ttyu3  "/usr/libexec/getty std.9600"   dialup  off secure
+ttyu0  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu1  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu2  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu3  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
 # Dumb console
 dcons  "/usr/libexec/getty std.9600"   vt100   off secure

Modified: stable/10/etc/etc.i386/ttys
==
--- stable/10/etc/etc.i386/ttys Wed Oct 28 13:14:16 2015(r290106)
+++ stable/10/etc/etc.i386/ttys Wed Oct 28 13:30:14 2015(r290107)
@@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm   on 
 ttyv8  "/usr/local/bin/xdm -nodaemon"  xterm   off secure
 # Serial terminals
 # The 'dialup' keyword identifies dialin lines to login, fingerd etc.
-ttyu0  "/usr/libexec/getty std.9600"   vt100   onifconsole secure
-ttyu1  "/usr/libexec/getty std.9600"   dialup  off secure
-ttyu2  "/usr/libexec/getty std.9600"   dialup  off secure
-ttyu3  "/usr/libexec/getty std.9600"   dialup  off secure
+ttyu0  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu1  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu2  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu3  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
 # Dumb console
 dcons  "/usr/libexec/getty std.9600"   vt100   off secure

Modified: stable/10/etc/etc.ia64/ttys
==
--- stable/10/etc/etc.ia64/ttys Wed Oct 28 13:14:16 2015(r290106)
+++ stable/10/etc/etc.ia64/ttys Wed Oct 28 13:30:14 2015(r290107)
@@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm   off
 ttyv8  "/usr/local/bin/xdm -nodaemon"  xterm   off secure
 # Serial terminals. The 'dialup' keyword identifies dialin lines to login,
 # fingerd etc.
-ttyu0  "/usr/libexec/getty std.9600"   vt100   onifconsole secure
-ttyu1  "/usr/libexec/getty std.9600"   vt100   onifconsole secure
-ttyu2  "/usr/libexec/getty std.9600"   dialup  off secure
-ttyu3  "/usr/libexec/getty std.9600"   dialup  off secure
+ttyu0  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu1  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu2  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
+ttyu3  "/usr/libexec/getty 3wire"  vt100   onifconsole secure
 # Dumb console
 dcons  "/usr/libexec/getty std.9600"   vt100   off secure

Modified: stable/10/etc/etc.mips/ttys
==
--- stable/10/etc/etc.mips/ttys Wed Oct 28 13:14:16 2015(r290106)
+++ stable/10/etc/etc.mips/ttys Wed Oct 28 13:30:14 2015(r290107)
@@ -30,7 +30,7 @@
 consolenoneunknown off secure
 # Serial terminals
 # The 'dialup' keyword identifies dialin lines to login, fingerd etc.
-ttyu0  "/usr/libexec/getty std.115200" dialup  on  secure
-ttyu1  "/usr/libexec/g

svn commit: r290106 - head/sys/arm/samsung/s3c2xx0

2015-10-28 Thread Andrew Turner
Author: andrew
Date: Wed Oct 28 13:14:16 2015
New Revision: 290106
URL: https://svnweb.freebsd.org/changeset/base/290106

Log:
  Remove the s3c2xx0 code, it's no longer used. As far as I know I as the
  main user of this code, however I haven't used it in over two years, and
  don't expect to in the future.

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


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

2015-10-28 Thread Andrew Turner
Author: andrew
Date: Wed Oct 28 13:07:56 2015
New Revision: 290105
URL: https://svnweb.freebsd.org/changeset/base/290105

Log:
  Start to remove support for the XScale i80321. As far as I can tell nobody
  uses this which makes it difficult to support.

Deleted:
  head/sys/arm/conf/EP80219
  head/sys/arm/conf/IQ31244
Modified:
  head/sys/arm/conf/NOTES

Modified: head/sys/arm/conf/NOTES
==
--- head/sys/arm/conf/NOTES Wed Oct 28 12:34:59 2015(r290104)
+++ head/sys/arm/conf/NOTES Wed Oct 28 13:07:56 2015(r290105)
@@ -19,10 +19,6 @@ files"../mv/discovery/files.db78xxx"
 files  "../mv/kirkwood/files.kirkwood"
 files  "../mv/orion/files.db88f5xxx"
 files  "../mv/orion/files.ts7800"
-files  "../xscale/i80321/files.ep80219"
-files  "../xscale/i80321/files.i80219"
-files  "../xscale/i80321/files.i80321"
-files  "../xscale/i80321/files.iq31244"
 files  "../xscale/i8134x/files.crb"
 files  "../xscale/i8134x/files.i81342"
 files  "../xscale/ixp425/files.avila"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290104 - head/sys/dev/isp

2015-10-28 Thread Alexander Motin
Author: mav
Date: Wed Oct 28 12:34:59 2015
New Revision: 290104
URL: https://svnweb.freebsd.org/changeset/base/290104

Log:
  Improve/fix loop scanning routine.
  
  For the most of chips (except anscient ones) port handlers have no relation
  to port IDs.  In such situation old code scanning first 125 handlers was
  quite naive.  Instead of doing that, send to chip single request to get full
  list of port handlers available on specific virtual port and scan only them.
  
  Old code had problems with case of several virtual ports enabled, when port
  handlers allocated from global address space could easily go above 125.
  This change was successfully tested on 23xx, 24xx and 25xx chips in loop
  mode with 4 virtual initiator ports, each seing 50 virtual target ports.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_library.c
  head/sys/dev/isp/isp_library.h
  head/sys/dev/isp/ispmbox.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Wed Oct 28 12:31:29 2015(r290103)
+++ head/sys/dev/isp/isp.c  Wed Oct 28 12:34:59 2015(r290104)
@@ -119,6 +119,7 @@ static int isp_plogx(ispsoftc_t *, int, 
 static int isp_port_login(ispsoftc_t *, uint16_t, uint32_t);
 static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t);
 static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *, int);
+static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int, int);
 static void isp_dump_chip_portdb(ispsoftc_t *, int, int);
 static uint64_t isp_get_wwn(ispsoftc_t *, int, int, int);
 static int isp_fclink_test(ispsoftc_t *, int, int);
@@ -2587,7 +2588,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
if (dolock) {
FC_SCRATCH_RELEASE(isp, chan);
}
-   return (mbs.param[0]);
+   return (mbs.param[0] | (mbs.param[1] << 16));
}
if (IS_24XX(isp)) {
isp_get_pdb_24xx(isp, fcp->isp_scratch, &un.bill);
@@ -2618,6 +2619,78 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
return (0);
 }
 
+static int
+isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num,
+int dolock, int loop)
+{
+   fcparam *fcp = FCPARAM(isp, chan);
+   mbreg_t mbs;
+   isp_pnhle_21xx_t el1, *elp1;
+   isp_pnhle_23xx_t el3, *elp3;
+   isp_pnhle_24xx_t el4, *elp4;
+   int i, j;
+   uint32_t p;
+   uint16_t h;
+
+   MBSINIT(&mbs, MBOX_GET_ID_LIST, MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR, 
25);
+   if (IS_24XX(isp)) {
+   mbs.param[2] = DMA_WD1(fcp->isp_scdma);
+   mbs.param[3] = DMA_WD0(fcp->isp_scdma);
+   mbs.param[6] = DMA_WD3(fcp->isp_scdma);
+   mbs.param[7] = DMA_WD2(fcp->isp_scdma);
+   mbs.param[8] = ISP_FC_SCRLEN;
+   mbs.param[9] = chan;
+   } else {
+   mbs.ibits = (1 << 1)|(1 << 2)|(1 << 3)|(1 << 6);
+   mbs.param[1] = DMA_WD1(fcp->isp_scdma);
+   mbs.param[2] = DMA_WD0(fcp->isp_scdma);
+   mbs.param[3] = DMA_WD3(fcp->isp_scdma);
+   mbs.param[6] = DMA_WD2(fcp->isp_scdma);
+   }
+   if (dolock) {
+   if (FC_SCRATCH_ACQUIRE(isp, chan)) {
+   isp_prt(isp, ISP_LOGERR, sacq);
+   return (-1);
+   }
+   }
+   MEMORYBARRIER(isp, SYNC_SFORDEV, 0, ISP_FC_SCRLEN, chan);
+   isp_mboxcmd(isp, &mbs);
+   if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+   if (dolock) {
+   FC_SCRATCH_RELEASE(isp, chan);
+   }
+   return (mbs.param[0] | (mbs.param[1] << 16));
+   }
+   elp1 = fcp->isp_scratch;
+   elp3 = fcp->isp_scratch;
+   elp4 = fcp->isp_scratch;
+   for (i = 0, j = 0; i < mbs.param[1] && j < *num; i++) {
+   if (IS_24XX(isp)) {
+   isp_get_pnhle_24xx(isp, &elp4[i], &el4);
+   p = el4.pnhle_port_id_lo |
+   (el4.pnhle_port_id_hi << 16);
+   h = el4.pnhle_handle;
+   } else if (IS_23XX(isp)) {
+   isp_get_pnhle_23xx(isp, &elp3[i], &el3);
+   p = el3.pnhle_port_id_lo |
+   (el3.pnhle_port_id_hi << 16);
+   h = el3.pnhle_handle;
+   } else { /* 21xx */
+   isp_get_pnhle_21xx(isp, &elp1[i], &el1);
+   p = el1.pnhle_port_id_lo |
+   ((el1.pnhle_port_id_hi_handle & 0xff) << 16);
+   h = el1.pnhle_port_id_hi_handle >> 8;
+   }
+   if (loop && (p >> 8) != (fcp->isp_portid >> 8))
+   continue;
+   handles[j++] = h;
+   }
+   *num = j;
+   if (dolock)
+   FC_SCRATCH_RELEASE(isp, chan);
+   return (0);
+}
+
 static void

svn commit: r290103 - head/usr.sbin

2015-10-28 Thread Baptiste Daroussin
Author: bapt
Date: Wed Oct 28 12:31:29 2015
New Revision: 290103
URL: https://svnweb.freebsd.org/changeset/base/290103

Log:
  Connect mpsutil(8) to the build
  
  Sponsored by: Gandi.net

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Wed Oct 28 12:30:29 2015(r290102)
+++ head/usr.sbin/Makefile  Wed Oct 28 12:31:29 2015(r290103)
@@ -45,6 +45,7 @@ SUBDIR=   adduser \
mixer \
mlxcontrol \
mountd \
+   mpsutil \
mptutil \
mtest \
${_mtree} \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290102 - in head: . contrib/ipfilter contrib/llvm/lib/Target/Sparc/AsmParser contrib/llvm/lib/Target/Sparc/Disassembler contrib/llvm/lib/Target/Sparc/InstPrinter sys/amd64/include sys/...

2015-10-28 Thread Baptiste Daroussin
Author: bapt
Date: Wed Oct 28 12:30:29 2015
New Revision: 290102
URL: https://svnweb.freebsd.org/changeset/base/290102

Log:
  Merge mpsutil(8) branch
  
  mpsutil(8)/mprutil(8) are new utilities for managing LSI Fusion-MPT
  2/3 controllers (mps(4) and mpr(4))
  
  For now only informational commands have been implemented.
  
  This utility has been written by scottl@ [1] and polished by myself[2]
  
  Submitted by: scottl
  Discussed with:   scottl
  Relnotes: yes
  Sponsored by: Netflix [1]
  Sponsored by: Gandi.net [2]

Added:
  head/usr.sbin/mpsutil/
 - copied from r290100, projects/mpsutil/usr.sbin/mpsutil/
Modified:
Directory Properties:
  head/   (props changed)
  head/MAINTAINERS   (props changed)
  head/cddl/   (props changed)
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/   (props 
changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  head/contrib/apr/   (props changed)
  head/contrib/binutils/   (props changed)
  head/contrib/bmake/   (props changed)
  head/contrib/compiler-rt/   (props changed)
  head/contrib/dma/   (props changed)
  head/contrib/dtc/   (props changed)
  head/contrib/elftoolchain/   (props changed)
  head/contrib/elftoolchain/ar/   (props changed)
  head/contrib/elftoolchain/brandelf/   (props changed)
  head/contrib/elftoolchain/elfdump/   (props changed)
  head/contrib/expat/   (props changed)
  head/contrib/file/   (props changed)
  head/contrib/gcc/   (props changed)
  head/contrib/groff/   (props changed)
  head/contrib/ipfilter/   (props changed)
  head/contrib/ipfilter/ml_ipl.c   (props changed)
  head/contrib/ipfilter/mlfk_ipl.c   (props changed)
  head/contrib/ipfilter/mlh_rule.c   (props changed)
  head/contrib/ipfilter/mli_ipl.c   (props changed)
  head/contrib/ipfilter/mln_ipl.c   (props changed)
  head/contrib/ipfilter/mls_ipl.c   (props changed)
  head/contrib/libarchive/   (props changed)
  head/contrib/libarchive/libarchive/   (props changed)
  head/contrib/libc++/   (props changed)
  head/contrib/libcxxrt/   (props changed)
  head/contrib/libucl/   (props changed)
  head/contrib/llvm/   (props changed)
  head/contrib/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp   (props 
changed)
  head/contrib/llvm/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp   
(props changed)
  head/contrib/llvm/lib/Target/Sparc/InstPrinter/SparcInstPrinter.cpp   (props 
changed)
  head/contrib/llvm/lib/Target/Sparc/InstPrinter/SparcInstPrinter.h   (props 
changed)
  head/contrib/llvm/projects/libunwind/   (props changed)
  head/contrib/llvm/tools/clang/   (props changed)
  head/contrib/llvm/tools/lldb/   (props changed)
  head/contrib/llvm/tools/llvm-dwarfdump/   (props changed)
  head/contrib/llvm/tools/llvm-lto/   (props changed)
  head/contrib/mdocml/   (props changed)
  head/contrib/ncurses/   (props changed)
  head/contrib/netcat/   (props changed)
  head/contrib/ntp/   (props changed)
  head/contrib/openpam/   (props changed)
  head/contrib/pf/   (props changed)
  head/contrib/sendmail/   (props changed)
  head/contrib/serf/   (props changed)
  head/contrib/sqlite3/   (props changed)
  head/contrib/subversion/   (props changed)
  head/contrib/tcpdump/   (props changed)
  head/contrib/top/   (props changed)
  head/contrib/tzcode/stdtime/   (props changed)
  head/contrib/tzdata/   (props changed)
  head/contrib/unbound/   (props changed)
  head/contrib/wpa/   (props changed)
  head/crypto/openssh/   (props changed)
  head/crypto/openssl/   (props changed)
  head/gnu/lib/   (props changed)
  head/gnu/usr.bin/binutils/   (props changed)
  head/gnu/usr.bin/cc/cc_tools/   (props changed)
  head/gnu/usr.bin/gdb/   (props changed)
  head/include/   (props changed)
  head/lib/libc/   (props changed)
  head/lib/libc/stdtime/   (props changed)
  head/lib/libutil/   (props changed)
  head/lib/libvmmapi/   (props changed)
  head/lib/libz/   (props changed)
  head/sbin/   (props changed)
  head/sbin/dumpon/   (props changed)
  head/sbin/ipfw/   (props changed)
  head/share/   (props changed)
  head/share/man/man4/   (props changed)
  head/share/zoneinfo/   (props changed)
  head/sys/   (props changed)
  head/sys/amd64/include/vmm.h   (props changed)
  head/sys/amd64/include/vmm_dev.h   (props changed)
  head/sys/amd64/include/xen/   (props changed)
  head/sys/amd64/vmm/   (props changed)
  head/sys/boot/   (props changed)
  head/sys/boot/powerpc/kboot/   (props changed)
  head/sys/boot/powerpc/ofw/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)
  head/sys/conf/   (props changed)
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/ipfilter/   (props changed)
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c   (props changed)
  head/sys/dev/hyperv/   (props changed)
  head/sys/modules/hyperv/   (props changed)
  head/targets/   (props changed)
  head/usr.bin/calendar/   (props changed)

svn commit: r290101 - head/sys/i386/i386

2015-10-28 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct 28 12:10:01 2015
New Revision: 290101
URL: https://svnweb.freebsd.org/changeset/base/290101

Log:
  Build fix for i386/XBOX and pc98/GENERIC.
  
  Reviewed by:  kib

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

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Wed Oct 28 11:58:18 2015(r290100)
+++ head/sys/i386/i386/pmap.c   Wed Oct 28 12:10:01 2015(r290101)
@@ -1259,8 +1259,10 @@ pmap_invalidate_cache_range(vm_offset_t 
mfence();
} else if ((cpu_feature & CPUID_CLFSH) != 0 &&
eva - sva < PMAP_CLFLUSH_THRESHOLD) {
+#ifdef DEV_APIC
if (pmap_kextract(sva) == lapic_paddr)
return;
+#endif
/*
 * Writes are ordered by CLFLUSH on Intel CPUs.
 */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290099 - stable/10/libexec/rtld-elf

2015-10-28 Thread Konstantin Belousov
Author: kib
Date: Wed Oct 28 11:32:39 2015
New Revision: 290099
URL: https://svnweb.freebsd.org/changeset/base/290099

Log:
  MFC r289324:
  Allow PT_NOTES segments to be located anywhere in the executable
  image.

Modified:
  stable/10/libexec/rtld-elf/map_object.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/rtld-elf/map_object.c
==
--- stable/10/libexec/rtld-elf/map_object.c Wed Oct 28 11:29:58 2015
(r290098)
+++ stable/10/libexec/rtld-elf/map_object.c Wed Oct 28 11:32:39 2015
(r290099)
@@ -88,6 +88,8 @@ map_object(int fd, const char *path, con
 size_t relro_size;
 Elf_Addr note_start;
 Elf_Addr note_end;
+char *note_map;
+size_t note_map_len;
 
 hdr = get_elf_header(fd, path);
 if (hdr == NULL)
@@ -108,6 +110,7 @@ map_object(int fd, const char *path, con
 relro_size = 0;
 note_start = 0;
 note_end = 0;
+note_map = NULL;
 segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
 stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W;
 while (phdr < phlimit) {
@@ -150,9 +153,20 @@ map_object(int fd, const char *path, con
 
case PT_NOTE:
if (phdr->p_offset > PAGE_SIZE ||
- phdr->p_offset + phdr->p_filesz > PAGE_SIZE)
-   break;
-   note_start = (Elf_Addr)(char *)hdr + phdr->p_offset;
+ phdr->p_offset + phdr->p_filesz > PAGE_SIZE) {
+   note_map_len = round_page(phdr->p_offset +
+ phdr->p_filesz) - trunc_page(phdr->p_offset);
+   note_map = mmap(NULL, note_map_len, PROT_READ,
+ MAP_PRIVATE, fd, trunc_page(phdr->p_offset));
+   if (note_map == MAP_FAILED) {
+   _rtld_error("%s: error mapping PT_NOTE (%d)", path, errno);
+   goto error;
+   }
+   note_start = (Elf_Addr)(note_map + phdr->p_offset -
+ trunc_page(phdr->p_offset));
+   } else {
+   note_start = (Elf_Addr)(char *)hdr + phdr->p_offset;
+   }
note_end = note_start + phdr->p_filesz;
break;
}
@@ -295,12 +309,16 @@ map_object(int fd, const char *path, con
 obj->relro_size = round_page(relro_size);
 if (note_start < note_end)
digest_notes(obj, note_start, note_end);
+if (note_map != NULL)
+   munmap(note_map, note_map_len);
 munmap(hdr, PAGE_SIZE);
 return (obj);
 
 error1:
 munmap(mapbase, mapsize);
 error:
+if (note_map != NULL && note_map != MAP_FAILED)
+   munmap(note_map, note_map_len);
 munmap(hdr, PAGE_SIZE);
 return (NULL);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290097 - stable/10/sys/kern

2015-10-28 Thread Konstantin Belousov
Author: kib
Date: Wed Oct 28 11:29:54 2015
New Revision: 290097
URL: https://svnweb.freebsd.org/changeset/base/290097

Log:
  MFC r289322:
  Allow PT_INTERP and PT_NOTES segments to be located anywhere in the
  executable image.

Modified:
  stable/10/sys/kern/imgact_elf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/imgact_elf.c
==
--- stable/10/sys/kern/imgact_elf.c Wed Oct 28 11:28:46 2015
(r290096)
+++ stable/10/sys/kern/imgact_elf.c Wed Oct 28 11:29:54 2015
(r290097)
@@ -715,21 +715,22 @@ fail:
 static int
 __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
 {
-   const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
+   struct thread *td;
+   const Elf_Ehdr *hdr;
const Elf_Phdr *phdr;
Elf_Auxargs *elf_auxargs;
struct vmspace *vmspace;
-   vm_prot_t prot;
-   u_long text_size = 0, data_size = 0, total_size = 0;
-   u_long text_addr = 0, data_addr = 0;
-   u_long seg_size, seg_addr;
-   u_long addr, baddr, et_dyn_addr, entry = 0, proghdr = 0;
-   int32_t osrel = 0;
-   int error = 0, i, n, interp_name_len = 0;
-   const char *err_str = NULL, *interp = NULL, *newinterp = NULL;
+   const char *err_str, *newinterp;
+   char *interp, *interp_buf, *path;
Elf_Brandinfo *brand_info;
-   char *path;
struct sysentvec *sv;
+   vm_prot_t prot;
+   u_long text_size, data_size, total_size, text_addr, data_addr;
+   u_long seg_size, seg_addr, addr, baddr, et_dyn_addr, entry, proghdr;
+   int32_t osrel;
+   int error, i, n, interp_name_len, have_interp;
+
+   hdr = (const Elf_Ehdr *)imgp->image_header;
 
/*
 * Do we have a valid ELF header ?
@@ -757,8 +758,17 @@ __CONCAT(exec_, __elfN(imgact))(struct i
uprintf("Unaligned program headers\n");
return (ENOEXEC);
}
-   n = 0;
+
+   n = error = 0;
baddr = 0;
+   osrel = 0;
+   text_size = data_size = total_size = text_addr = data_addr = 0;
+   entry = proghdr = 0;
+   interp_name_len = 0;
+   err_str = newinterp = NULL;
+   interp = interp_buf = NULL;
+   td = curthread;
+
for (i = 0; i < hdr->e_phnum; i++) {
switch (phdr[i].p_type) {
case PT_LOAD:
@@ -768,14 +778,32 @@ __CONCAT(exec_, __elfN(imgact))(struct i
break;
case PT_INTERP:
/* Path to interpreter */
-   if (phdr[i].p_filesz > MAXPATHLEN ||
-   phdr[i].p_offset > PAGE_SIZE ||
-   phdr[i].p_filesz > PAGE_SIZE - phdr[i].p_offset) {
+   if (phdr[i].p_filesz > MAXPATHLEN) {
uprintf("Invalid PT_INTERP\n");
-   return (ENOEXEC);
+   error = ENOEXEC;
+   goto ret;
}
-   interp = imgp->image_header + phdr[i].p_offset;
interp_name_len = phdr[i].p_filesz;
+   if (phdr[i].p_offset > PAGE_SIZE ||
+   interp_name_len > PAGE_SIZE - phdr[i].p_offset) {
+   VOP_UNLOCK(imgp->vp, 0);
+   interp_buf = malloc(interp_name_len + 1, M_TEMP,
+   M_WAITOK);
+   vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
+   error = vn_rdwr(UIO_READ, imgp->vp, interp_buf,
+   interp_name_len, phdr[i].p_offset,
+   UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred,
+   NOCRED, NULL, td);
+   if (error != 0) {
+   uprintf("i/o error PT_INTERP\n");
+   goto ret;
+   }
+   interp_buf[interp_name_len] = '\0';
+   interp = interp_buf;
+   } else {
+   interp = __DECONST(char *, imgp->image_header) +
+   phdr[i].p_offset;
+   }
break;
case PT_GNU_STACK:
if (__elfN(nxstack))
@@ -791,12 +819,14 @@ __CONCAT(exec_, __elfN(imgact))(struct i
if (brand_info == NULL) {
uprintf("ELF binary type \"%u\" not known.\n",
hdr->e_ident[EI_OSABI]);
-   return (ENOEXEC);
+   error = ENOEXEC;
+   goto ret;
}
if (hdr->e_type == ET_DYN) {
if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) {
uprintf("Cannot 

svn commit: r290094 - stable/10/sys/kern

2015-10-28 Thread Konstantin Belousov
Author: kib
Date: Wed Oct 28 11:22:30 2015
New Revision: 290094
URL: https://svnweb.freebsd.org/changeset/base/290094

Log:
  MFC r284157 (by emaste):
  Add user facing errors for exceeding process memory limits.

Modified:
  stable/10/sys/kern/imgact_elf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/imgact_elf.c
==
--- stable/10/sys/kern/imgact_elf.c Wed Oct 28 11:20:55 2015
(r290093)
+++ stable/10/sys/kern/imgact_elf.c Wed Oct 28 11:22:30 2015
(r290094)
@@ -726,7 +726,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i
u_long addr, baddr, et_dyn_addr, entry = 0, proghdr = 0;
int32_t osrel = 0;
int error = 0, i, n, interp_name_len = 0;
-   const char *interp = NULL, *newinterp = NULL;
+   const char *err_str = NULL, *interp = NULL, *newinterp = NULL;
Elf_Brandinfo *brand_info;
char *path;
struct sysentvec *sv;
@@ -749,11 +749,14 @@ __CONCAT(exec_, __elfN(imgact))(struct i
if ((hdr->e_phoff > PAGE_SIZE) ||
(u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) {
/* Only support headers in first page for now */
+   uprintf("Program headers not in the first page\n");
return (ENOEXEC);
}
-   phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
-   if (!aligned(phdr, Elf_Addr))
+   phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); 
+   if (!aligned(phdr, Elf_Addr)) {
+   uprintf("Unaligned program headers\n");
return (ENOEXEC);
+   }
n = 0;
baddr = 0;
for (i = 0; i < hdr->e_phnum; i++) {
@@ -767,8 +770,10 @@ __CONCAT(exec_, __elfN(imgact))(struct i
/* Path to interpreter */
if (phdr[i].p_filesz > MAXPATHLEN ||
phdr[i].p_offset > PAGE_SIZE ||
-   phdr[i].p_filesz > PAGE_SIZE - phdr[i].p_offset)
+   phdr[i].p_filesz > PAGE_SIZE - phdr[i].p_offset) {
+   uprintf("Invalid PT_INTERP\n");
return (ENOEXEC);
+   }
interp = imgp->image_header + phdr[i].p_offset;
interp_name_len = phdr[i].p_filesz;
break;
@@ -789,8 +794,10 @@ __CONCAT(exec_, __elfN(imgact))(struct i
return (ENOEXEC);
}
if (hdr->e_type == ET_DYN) {
-   if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0)
+   if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) {
+   uprintf("Cannot execute shared object\n");
return (ENOEXEC);
+   }
/*
 * Honour the base load address from the dso if it is
 * non-zero for some reason.
@@ -895,12 +902,19 @@ __CONCAT(exec_, __elfN(imgact))(struct i
 * not actually fault in all the segments pages.
 */
PROC_LOCK(imgp->proc);
-   if (data_size > lim_cur(imgp->proc, RLIMIT_DATA) ||
-   text_size > maxtsiz ||
-   total_size > lim_cur(imgp->proc, RLIMIT_VMEM) ||
-   racct_set(imgp->proc, RACCT_DATA, data_size) != 0 ||
-   racct_set(imgp->proc, RACCT_VMEM, total_size) != 0) {
+   if (data_size > lim_cur(imgp->proc, RLIMIT_DATA))
+   err_str = "Data segment size exceeds process limit";
+   else if (text_size > maxtsiz)
+   err_str = "Text segment size exceeds system limit";
+   else if (total_size > lim_cur(imgp->proc, RLIMIT_VMEM))
+   err_str = "Total segment size exceeds process limit";
+   else if (racct_set(imgp->proc, RACCT_DATA, data_size) != 0)
+   err_str = "Data segment size exceeds resource limit";
+   else if (racct_set(imgp->proc, RACCT_VMEM, total_size) != 0)
+   err_str = "Total segment size exceeds resource limit";
+   if (err_str != NULL) {
PROC_UNLOCK(imgp->proc);
+   uprintf("%s\n", err_str);
return (ENOMEM);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r290003 - head/sys/ofed/include/linux

2015-10-28 Thread Hans Petter Selasky

On 10/28/15 03:14, Julian Elischer wrote:

On 10/26/15 9:28 PM, Hans Petter Selasky wrote:

Author: hselasky
Date: Mon Oct 26 13:28:34 2015
New Revision: 290003
URL: https://svnweb.freebsd.org/changeset/base/290003

Log:
   Add support for binding IRQs to CPUs in the LinuxKPI. The new function
   added is for BSD only and does not exist in Linux.


um, then who would use it and why?



Hi Julian,

The parameters for bus_bind_intr() are not available outside the 
LinuxKPI. To support such a functionality we should wrap it, for the 
sake of maintainability.


The LinuxKPI is not a binary compatibility module, and will at some 
point have API's diverging from Linux, to fit BSD API's better.


There is a plan to use this new function alongside some new network 
drivers which are not yet committed, to support RSS.


--HPS

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