svn commit: r306288 - head/sys/dev/iicbus

2016-09-23 Thread Justin Hibbits
Author: jhibbits
Date: Sat Sep 24 05:27:12 2016
New Revision: 306288
URL: https://svnweb.freebsd.org/changeset/base/306288

Log:
  Fix ds1307 probing
  
  'compat' can never be NULL, because the compatible check loop ends when
  compat->ocd_str is NULL.  This causes ds1307 to attach to any unclaimed i2c
  device.

Modified:
  head/sys/dev/iicbus/ds1307.c

Modified: head/sys/dev/iicbus/ds1307.c
==
--- head/sys/dev/iicbus/ds1307.cSat Sep 24 04:08:16 2016
(r306287)
+++ head/sys/dev/iicbus/ds1307.cSat Sep 24 05:27:12 2016
(r306288)
@@ -274,7 +274,7 @@ ds1307_probe(device_t dev)
 
compat = ofw_bus_search_compatible(dev, ds1307_compat_data);
 
-   if (compat == NULL)
+   if (compat->ocd_str == NULL)
return (ENXIO);
 
device_set_desc(dev, (const char *)compat->ocd_data);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306287 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/cores/pmu dev/bhnd/cores/usb dev/bhnd/siba modules/bhnd/bcma modules/bhnd/siba

2016-09-23 Thread Landon J. Fuller
Author: landonf
Date: Sat Sep 24 04:08:16 2016
New Revision: 306287
URL: https://svnweb.freebsd.org/changeset/base/306287

Log:
  bhnd(4): Implement common API for IOST/IOCTL register access and core reset
  
  
  - Added bhnd(4) bus APIs for per-core ioctl/iost register access.
  - Updated reset/suspend bhnd(4) APIs for compatibility with ioctl/iost
changes.
  - Implemented core reset/suspend support for both bcma(4) and siba(4).
  - Implemented explicit release of all outstanding PMU requests at the bus
level when putting a core into reset.
  
  Approved by:adrian (mentor, implicit)
  Differential Revision:  https://reviews.freebsd.org/D8009

Deleted:
  head/sys/dev/bhnd/bhnd_core.h
Modified:
  head/sys/dev/bhnd/bcma/bcma.c
  head/sys/dev/bhnd/bcma/bcma_dmp.h
  head/sys/dev/bhnd/bcma/bcma_subr.c
  head/sys/dev/bhnd/bcma/bcmavar.h
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhndvar.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_private.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c
  head/sys/dev/bhnd/cores/usb/bhnd_usb.c
  head/sys/dev/bhnd/siba/siba.c
  head/sys/dev/bhnd/siba/siba_subr.c
  head/sys/dev/bhnd/siba/sibareg.h
  head/sys/dev/bhnd/siba/sibavar.h
  head/sys/modules/bhnd/bcma/Makefile
  head/sys/modules/bhnd/siba/Makefile

Modified: head/sys/dev/bhnd/bcma/bcma.c
==
--- head/sys/dev/bhnd/bcma/bcma.c   Sat Sep 24 01:21:42 2016
(r306286)
+++ head/sys/dev/bhnd/bcma/bcma.c   Sat Sep 24 04:08:16 2016
(r306287)
@@ -39,14 +39,14 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include "bcmavar.h"
+#include 
 
 #include "bcma_dmp.h"
 
 #include "bcma_eromreg.h"
 #include "bcma_eromvar.h"
 
-#include 
+#include "bcmavar.h"
 
 /* RID used when allocating EROM table */
 #defineBCMA_EROM_RID   0
@@ -91,6 +91,44 @@ bcma_detach(device_t dev)
return (bhnd_generic_detach(dev));
 }
 
+static device_t
+bcma_add_child(device_t dev, u_int order, const char *name, int unit)
+{
+   struct bcma_devinfo *dinfo;
+   device_t child;
+
+   child = device_add_child_ordered(dev, order, name, unit);
+   if (child == NULL)
+   return (NULL);
+
+   if ((dinfo = bcma_alloc_dinfo(dev)) == NULL) {
+   device_delete_child(dev, child);
+   return (NULL);
+   }
+
+   device_set_ivars(child, dinfo);
+
+   return (child);
+}
+
+static void
+bcma_child_deleted(device_t dev, device_t child)
+{
+   struct bhnd_softc   *sc;
+   struct bcma_devinfo *dinfo;
+
+   sc = device_get_softc(dev);
+
+   /* Call required bhnd(4) implementation */
+   bhnd_generic_child_deleted(dev, child);
+
+   /* Free bcma device info */
+   if ((dinfo = device_get_ivars(child)) != NULL)
+   bcma_free_dinfo(dev, dinfo);
+
+   device_set_ivars(child, NULL);
+}
+
 static int
 bcma_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
 {
@@ -125,6 +163,9 @@ bcma_read_ivar(device_t dev, device_t ch
case BHND_IVAR_CORE_UNIT:
*result = ci->unit;
return (0);
+   case BHND_IVAR_PMU_INFO:
+   *result = (uintptr_t) dinfo->pmu_info;
+   return (0);
default:
return (ENOENT);
}
@@ -133,6 +174,10 @@ bcma_read_ivar(device_t dev, device_t ch
 static int
 bcma_write_ivar(device_t dev, device_t child, int index, uintptr_t value)
 {
+   struct bcma_devinfo *dinfo;
+
+   dinfo = device_get_ivars(child);
+
switch (index) {
case BHND_IVAR_VENDOR:
case BHND_IVAR_DEVICE:
@@ -143,6 +188,9 @@ bcma_write_ivar(device_t dev, device_t c
case BHND_IVAR_CORE_INDEX:
case BHND_IVAR_CORE_UNIT:
return (EINVAL);
+   case BHND_IVAR_PMU_INFO:
+   dinfo->pmu_info = (struct bhnd_core_pmu_info *) value;
+   return (0);
default:
return (ENOENT);
}
@@ -156,136 +204,262 @@ bcma_get_resource_list(device_t dev, dev
 }
 
 static int
-bcma_reset_core(device_t dev, device_t child, uint16_t flags)
+bcma_read_iost(device_t dev, device_t child, uint16_t *iost)
 {
-   struct bcma_devinfo *dinfo;
+   uint32_tvalue;
+   int error;
+
+   if ((error = bhnd_read_config(child, BCMA_DMP_IOSTATUS, , 4)))
+   return (error);
+
+   /* Return only the bottom 16 bits */
+   *iost = (value & BCMA_DMP_IOST_MASK);
+   return (0);
+}
+
+static int
+bcma_read_ioctl(device_t dev, device_t child, uint16_t *ioctl)
+{
+   uint32_tvalue;
+   int error;
+
+   if ((error = bhnd_read_config(child, BCMA_DMP_IOCTRL, , 4)))
+   return (error);
+
+   /* Return only the bottom 16 bits */
+   *ioctl = 

svn commit: r306286 - head/sys/dev/iwm

2016-09-23 Thread Adrian Chadd
Author: adrian
Date: Sat Sep 24 01:21:42 2016
New Revision: 306286
URL: https://svnweb.freebsd.org/changeset/base/306286

Log:
  [iwm] fix default antenna selection a bit; fix 5GHz rate control handling.
  
  * Don't do the antenna switching when setting up the rate table - we don't
take into account whether it's an active antenna or not (eg shared with BT.)
I'll look into this a bit more later.
  
  * The default antenna is still 1, I'll look into that a bit more later.
(So no, this doesn't fix it for Larry who needs ANT_B to be active, not
ANT_A.)
  
  * My changes to the rate control setup used the wrong method for finding
a suitable rate, which led to 1M CCK frames being queued for 11a operation.
This is .. sub-optimal.  Change the rate control lookup path to use
the global table instead of the per-node table, which won't be setup
until the node rate table is setup (which happens way too late in this
game.)
  
  Tested:
  
  * Intel 7260, 2G and 5G operation.

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Sep 24 01:14:25 2016(r306285)
+++ head/sys/dev/iwm/if_iwm.c   Sat Sep 24 01:21:42 2016(r306286)
@@ -2672,6 +2672,15 @@ iwm_run_init_mvm_ucode(struct iwm_softc 
if (error != 0)
return error;
 
+   IWM_DPRINTF(sc, IWM_DEBUG_RESET,
+   "%s: phy_txant=0x%08x, nvm_valid_tx_ant=0x%02x, valid=0x%02x\n",
+   __func__,
+   ((sc->sc_fw_phy_config & IWM_FW_PHY_CFG_TX_CHAIN)
+ >> IWM_FW_PHY_CFG_TX_CHAIN_POS),
+   sc->sc_nvm.valid_tx_ant,
+   iwm_fw_valid_tx_ant(sc));
+
+
/* Send TX valid antennas before triggering calibrations */
if ((error = iwm_send_tx_ant_cfg(sc, iwm_fw_valid_tx_ant(sc))) != 0) {
device_printf(sc->sc_dev,
@@ -3187,11 +3196,34 @@ iwm_tx_rateidx_lookup(struct iwm_softc *
if (rate == r)
return (i);
}
+
+   IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE,
+   "%s: couldn't find an entry for rate=%d\n",
+   __func__,
+   rate);
+
/* XXX Return the first */
/* XXX TODO: have it return the /lowest/ */
return (0);
 }
 
+static int
+iwm_tx_rateidx_global_lookup(struct iwm_softc *sc, uint8_t rate)
+{
+   int i;
+
+   for (i = 0; i < nitems(iwm_rates); i++) {
+   if (iwm_rates[i].rate == rate)
+   return (i);
+   }
+   /* XXX error? */
+   IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE,
+   "%s: couldn't find an entry for rate=%d\n",
+   __func__,
+   rate);
+   return (0);
+}
+
 /*
  * Fill in the rate related information for a transmit command.
  */
@@ -3204,7 +3236,7 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
const struct ieee80211_txparam *tp = ni->ni_txparms;
const struct iwm_rate *rinfo;
int type;
-   int ridx, rate_flags, i;
+   int ridx, rate_flags;
 
wh = mtod(m, struct ieee80211_frame *);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
@@ -3213,19 +3245,26 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
tx->data_retry_limit = IWM_DEFAULT_TX_RETRY;
 
if (type == IEEE80211_FC0_TYPE_MGT) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->mgmtrate);
-   ridx = in->in_ridx[i];
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mgmtrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: MGT (%d)\n", __func__, tp->mgmtrate);
} else if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->mcastrate);
-   ridx = in->in_ridx[i];
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mcastrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: MCAST (%d)\n", __func__, tp->mcastrate);
} else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->ucastrate);
-   ridx = in->in_ridx[i];
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->ucastrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: FIXED_RATE (%d)\n", __func__, tp->ucastrate);
} else if (m->m_flags & M_EAPOL) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->mgmtrate);
-   ridx = in->in_ridx[i];
-   } else {
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mgmtrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: EAPOL\n", __func__);
+   } else if (type == IEEE80211_FC0_TYPE_DATA) {
+   int i;
+
/* for data frames, use RS table */
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, "%s: DATA\n", __func__);
/* XXX pass pktlen */

svn commit: r306285 - head/sys/netinet6

2016-09-23 Thread Mark Johnston
Author: markj
Date: Sat Sep 24 01:14:25 2016
New Revision: 306285
URL: https://svnweb.freebsd.org/changeset/base/306285

Log:
  Rename ndpr_refcnt to ndpr_addrcnt.
  
  This field counts derived addresses and is not a true refcount for prefix
  objects, so the previous name was misleading.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/in6.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/in6.c Sat Sep 24 01:14:25 2016(r306285)
@@ -630,7 +630,7 @@ in6_control(struct socket *so, u_long cm
/* relate the address to the prefix */
if (ia->ia6_ndpr == NULL) {
ia->ia6_ndpr = pr;
-   pr->ndpr_refcnt++;
+   pr->ndpr_addrcnt++;
 
/*
 * If this is the first autoconf address from the
@@ -638,7 +638,7 @@ in6_control(struct socket *so, u_long cm
 * (when required).
 */
if ((ia->ia6_flags & IN6_IFF_AUTOCONF) &&
-   V_ip6_use_tempaddr && pr->ndpr_refcnt == 1) {
+   V_ip6_use_tempaddr && pr->ndpr_addrcnt == 1) {
int e;
if ((e = in6_tmpifadd(ia, 1, 0)) != 0) {
log(LOG_NOTICE, "in6_control: failed "
@@ -690,11 +690,11 @@ aifaddr_out:
 * and the prefix management.  We do this, however, to provide
 * as much backward compatibility as possible in terms of
 * the ioctl operation.
-* Note that in6_purgeaddr() will decrement ndpr_refcnt.
+* Note that in6_purgeaddr() will decrement ndpr_addrcnt.
 */
pr = ia->ia6_ndpr;
in6_purgeaddr(>ia_ifa);
-   if (pr && pr->ndpr_refcnt == 0)
+   if (pr && pr->ndpr_addrcnt == 0)
prelist_remove(pr);
EVENTHANDLER_INVOKE(ifaddr_event, ifp);
break;
@@ -1305,9 +1305,9 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st
"in6_unlink_ifa: autoconf'ed address "
"%s has no prefix\n", ip6_sprintf(ip6buf, IA6_IN6(ia;
} else {
-   ia->ia6_ndpr->ndpr_refcnt--;
+   ia->ia6_ndpr->ndpr_addrcnt--;
/* Do not delete lles within prefix if refcont != 0 */
-   if (ia->ia6_ndpr->ndpr_refcnt == 0)
+   if (ia->ia6_ndpr->ndpr_addrcnt == 0)
remove_lle = 1;
ia->ia6_ndpr = NULL;
}

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/nd6.c Sat Sep 24 01:14:25 2016(r306285)
@@ -1159,7 +1159,7 @@ nd6_purge(struct ifnet *ifp)
 * still be above zero. We therefore reset it to
 * make sure that the prefix really gets purged.
 */
-   pr->ndpr_refcnt = 0;
+   pr->ndpr_addrcnt = 0;
 
prelist_remove(pr);
}
@@ -2674,7 +2674,7 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
else
p.expire = maxexpire;
}
-   p.refcnt = pr->ndpr_refcnt;
+   p.refcnt = pr->ndpr_addrcnt;
p.flags = pr->ndpr_stateflags;
p.advrtrs = 0;
LIST_FOREACH(pfr, >ndpr_advrtrs, pfr_entry)

Modified: head/sys/netinet6/nd6.h
==
--- head/sys/netinet6/nd6.h Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/nd6.h Sat Sep 24 01:14:25 2016(r306285)
@@ -275,7 +275,7 @@ struct nd_prefix {
/* list of routers that advertise the prefix: */
LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
u_char  ndpr_plen;
-   int ndpr_refcnt;/* reference couter from addresses */
+   int ndpr_addrcnt;   /* count of derived addresses */
 };
 
 #define ndpr_raf   ndpr_flags

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/nd6_rtr.c Sat Sep 24 01:14:25 2016(r306285)
@@ -1053,7 +1053,7 @@ prelist_remove(struct nd_prefix *pr)
/* what should we do? */
}
 
-   if (pr->ndpr_refcnt > 0)
+   if (pr->ndpr_addrcnt > 0)
 

Re: svn commit: r306284 - head/sys/dev/bxe

2016-09-23 Thread hiren panchasara
On 09/23/16 at 11:18P, David C Somayajulu wrote:
> Author: davidcs
> Date: Fri Sep 23 23:18:54 2016
> New Revision: 306284
> URL: https://svnweb.freebsd.org/changeset/base/306284
> 
> Log:
>   Fixes for issues under high workloads

David,

It is really useful to have details about said issues in the commit-log.

Can you share them here, if possible? I'd suggest you add that to your
MFC commit(s).

>   
>   MFC after:5 days
> 
> Modified:
>   head/sys/dev/bxe/bxe.c
>   head/sys/dev/bxe/bxe.h
>   head/sys/dev/bxe/bxe_stats.h

Cheers,
Hiren


pgpGVCtvLlw9E.pgp
Description: PGP signature


svn commit: r306284 - head/sys/dev/bxe

2016-09-23 Thread David C Somayajulu
Author: davidcs
Date: Fri Sep 23 23:18:54 2016
New Revision: 306284
URL: https://svnweb.freebsd.org/changeset/base/306284

Log:
  Fixes for issues under high workloads
  
  MFC after:5 days

Modified:
  head/sys/dev/bxe/bxe.c
  head/sys/dev/bxe/bxe.h
  head/sys/dev/bxe/bxe_stats.h

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Fri Sep 23 23:11:58 2016(r306283)
+++ head/sys/dev/bxe/bxe.c  Fri Sep 23 23:18:54 2016(r306284)
@@ -27,7 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define BXE_DRIVER_VERSION "1.78.81"
+#define BXE_DRIVER_VERSION "1.78.89"
 
 #include "bxe.h"
 #include "ecore_sp.h"
@@ -489,7 +489,16 @@ static const struct {
 { STATS_OFFSET32(mbuf_alloc_tpa),
 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"},
 { STATS_OFFSET32(tx_queue_full_return),
-4, STATS_FLAGS_FUNC, "tx_queue_full_return"}
+4, STATS_FLAGS_FUNC, "tx_queue_full_return"},
+{ STATS_OFFSET32(bxe_tx_mq_start_lock_failures),
+4, STATS_FLAGS_FUNC, "bxe_tx_mq_start_lock_failures"},
+{ STATS_OFFSET32(tx_request_link_down_failures),
+4, STATS_FLAGS_FUNC, "tx_request_link_down_failures"},
+{ STATS_OFFSET32(bd_avail_too_less_failures),
+4, STATS_FLAGS_FUNC, "bd_avail_too_less_failures"},
+{ STATS_OFFSET32(tx_mq_not_empty),
+4, STATS_FLAGS_FUNC, "tx_mq_not_empty"}
+
 };
 
 static const struct {
@@ -602,7 +611,15 @@ static const struct {
 { Q_STATS_OFFSET32(mbuf_alloc_tpa),
 4, "mbuf_alloc_tpa"},
 { Q_STATS_OFFSET32(tx_queue_full_return),
-4, "tx_queue_full_return"}
+4, "tx_queue_full_return"},
+{ Q_STATS_OFFSET32(bxe_tx_mq_start_lock_failures),
+4, "bxe_tx_mq_start_lock_failures"},
+{ Q_STATS_OFFSET32(tx_request_link_down_failures),
+4, "tx_request_link_down_failures"},
+{ Q_STATS_OFFSET32(bd_avail_too_less_failures),
+4, "bd_avail_too_less_failures"},
+{ Q_STATS_OFFSET32(tx_mq_not_empty),
+4, "tx_mq_not_empty"}
 };
 
 #define BXE_NUM_ETH_STATS   ARRAY_SIZE(bxe_eth_stats_arr)
@@ -5621,11 +5638,18 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 return (EINVAL);
 }
 
+if (m != NULL) {
+rc = drbr_enqueue(ifp, tx_br, m);
+if (rc != 0) {
+fp->eth_q_stats.tx_soft_errors++;
+goto bxe_tx_mq_start_locked_exit;
+}
+}
+
 if (!sc->link_vars.link_up ||
 (if_getdrvflags(ifp) &
 (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) {
-if (m != NULL)
-rc = drbr_enqueue(ifp, tx_br, m);
+fp->eth_q_stats.tx_request_link_down_failures++;
 goto bxe_tx_mq_start_locked_exit;
 }
 
@@ -5635,24 +5659,22 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 fp->eth_q_stats.tx_max_drbr_queue_depth = depth;
 }
 
-if (m == NULL) {
-/* no new work, check for pending frames */
-next = drbr_dequeue_drv(ifp, tx_br);
-} else if (drbr_needs_enqueue_drv(ifp, tx_br)) {
-/* have both new and pending work, maintain packet order */
-rc = drbr_enqueue(ifp, tx_br, m);
-if (rc != 0) {
-fp->eth_q_stats.tx_soft_errors++;
-goto bxe_tx_mq_start_locked_exit;
-}
-next = drbr_dequeue_drv(ifp, tx_br);
-} else {
-/* new work only and nothing pending */
-next = m;
-}
-
 /* keep adding entries while there are frames to send */
-while (next != NULL) {
+while ((next = drbr_peek(ifp, tx_br)) != NULL) {
+/* handle any completions if we're running low */
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < BXE_TX_CLEANUP_THRESHOLD) {
+/* bxe_txeof will set IFF_DRV_OACTIVE appropriately */
+bxe_txeof(sc, fp);
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < (BXE_TSO_MAX_SEGMENTS + 1)) {
+fp->eth_q_stats.bd_avail_too_less_failures++;
+m_freem(next);
+drbr_advance(ifp, tx_br);
+rc = ENOBUFS;
+break;
+}
+}
 
 /* the mbuf now belongs to us */
 fp->eth_q_stats.mbuf_alloc_tx++;
@@ -5667,12 +5689,12 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 fp->eth_q_stats.tx_encap_failures++;
 if (next != NULL) {
 /* mark the TX queue as full and save the frame */
-if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
-/* XXX this may reorder the frame */
-rc = drbr_enqueue(ifp, tx_br, next);
+ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+drbr_putback(ifp, tx_br, next);
 fp->eth_q_stats.mbuf_alloc_tx--;
 fp->eth_q_stats.tx_frames_deferred++;
-}
+

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

2016-09-23 Thread Mateusz Guzik
On Fri, Sep 23, 2016 at 10:38:05PM +0200, Andreas Tobler wrote:
> On 23.09.16 22:03, Mateusz Guzik wrote:
> >On Fri, Sep 23, 2016 at 09:59:32PM +0200, Andreas Tobler wrote:
> >>On 23.09.16 18:47, Mateusz Guzik wrote:
> >>>Author: mjg
> >>>Date: Fri Sep 23 16:47:12 2016
> >>>New Revision: 306272
> >>>URL: https://svnweb.freebsd.org/changeset/base/306272
> >>>
> >>>Log:
> >>> fd: hide fd_modified under CAPABILITIES
> >>>
> >>> It has no use without it and is now less error prone.
> >>>
> >>>Modified:
> >>> head/sys/sys/filedesc.h
> >>>
> >>>Modified: head/sys/sys/filedesc.h
> >>>==
> >>>--- head/sys/sys/filedesc.hFri Sep 23 16:22:03 2016
> >>>(r306271)
> >>>+++ head/sys/sys/filedesc.hFri Sep 23 16:47:12 2016
> >>>(r306272)
> >>>@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
> >>>   return (fde);
> >>>}
> >>>
> >>>+#ifdef CAPABILITIES
> >>>static __inline bool
> >>>fd_modified(struct filedesc *fdp, int fd, seq_t seq)
> >>>{
> >>>
> >>>   return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
> >>>}
> >>>+#endif
> >>>
> >>>/* cdir/rdir/jdir manipulation functions. */
> >>>void   pwd_chdir(struct thread *td, struct vnode *vp);
> >>
> >>I think this breaks kernel builds:
> >>
> >>/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14:
> >>error: implicit declaration of function 'fd_modified' is invalid in
> >>C99 [-Werror,-Wimplicit-function-declaration]
> >>modified = fd_modified(fdp, uap->fd, seq);
> >>   ^
> >>1 error generated.
> >>*** [cloudabi_fd.o] Error code 1
> >>
> >
> >Ye indeed, I hacked up a fix:
> >https://people.freebsd.org/~mjg/patches/cloudabi-fd_modified.diff
> >
> >if ed@ does not respond soon acking the patch, I'll temporarily reviert
> >this change.
> >
> 
> Thanks, I reverted locally to continue my work. So no hurry.
> 

Fixed in r306282.

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


svn commit: r306282 - head/sys/compat/cloudabi

2016-09-23 Thread Mateusz Guzik
Author: mjg
Date: Fri Sep 23 23:08:23 2016
New Revision: 306282
URL: https://svnweb.freebsd.org/changeset/base/306282

Log:
  cloudabi: use fget_cap instead of hand-rolling capability read
  
  This has a side effect of unbreaking the build after r306272.
  
  Discussed with:   ed

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Fri Sep 23 22:46:19 2016
(r306281)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Fri Sep 23 23:08:23 2016
(r306282)
@@ -456,32 +456,19 @@ cloudabi_sys_fd_stat_get(struct thread *
 struct cloudabi_sys_fd_stat_get_args *uap)
 {
cloudabi_fdstat_t fsb = {};
-   struct filedesc *fdp;
struct file *fp;
-   seq_t seq;
cap_rights_t rights;
+   struct filecaps fcaps;
int error, oflags;
-   bool modified;
 
/* Obtain file descriptor properties. */
-   fdp = td->td_proc->p_fd;
-   do {
-   error = fget_unlocked(fdp, uap->fd, cap_rights_init(),
-   , );
-   if (error != 0)
-   return (error);
-   if (fp->f_ops == ) {
-   fdrop(fp, td);
-   return (EBADF);
-   }
-
-   rights = *cap_rights(fdp, uap->fd);
-   oflags = OFLAGS(fp->f_flag);
-   fsb.fs_filetype = cloudabi_convert_filetype(fp);
-
-   modified = fd_modified(fdp, uap->fd, seq);
-   fdrop(fp, td);
-   } while (modified);
+   error = fget_cap(td, uap->fd, cap_rights_init(), ,
+   );
+   if (error != 0)
+   return (error);
+   oflags = OFLAGS(fp->f_flag);
+   fsb.fs_filetype = cloudabi_convert_filetype(fp);
+   fdrop(fp, td);
 
/* Convert file descriptor flags. */
if (oflags & O_APPEND)
@@ -492,8 +479,9 @@ cloudabi_sys_fd_stat_get(struct thread *
fsb.fs_flags |= CLOUDABI_FDFLAG_SYNC;
 
/* Convert capabilities to CloudABI rights. */
-   convert_capabilities(, fsb.fs_filetype,
+   convert_capabilities(_rights, fsb.fs_filetype,
_rights_base, _rights_inheriting);
+   filecaps_free();
return (copyout(, (void *)uap->buf, sizeof(fsb)));
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306281 - in head: targets/pseudo/userland usr.bin/proccontrol

2016-09-23 Thread Bryan Drewery
Author: bdrewery
Date: Fri Sep 23 22:46:19 2016
New Revision: 306281
URL: https://svnweb.freebsd.org/changeset/base/306281

Log:
  DIRDEPS_BUILD: Connect new directories.
  
  Sponsored by: Dell EMC Isilon

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

Modified: head/targets/pseudo/userland/Makefile.depend
==
--- head/targets/pseudo/userland/Makefile.dependFri Sep 23 22:37:05 
2016(r306280)
+++ head/targets/pseudo/userland/Makefile.dependFri Sep 23 22:46:19 
2016(r306281)
@@ -325,6 +325,7 @@ DIRDEPS+= \
usr.bin/pr \
usr.bin/printenv \
usr.bin/printf \
+   usr.bin/proccontrol \
usr.bin/procstat \
usr.bin/protect \
usr.bin/quota \

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


Re: svn commit: r305353 - in head/sys/boot: i386 i386/boot0 i386/boot2 i386/btx/btx i386/btx/btxldr i386/cdboot i386/gptboot i386/gptzfsboot i386/mbr i386/pmbr i386/pxeldr i386/zfsboot pc98 pc98/boot0

2016-09-23 Thread Allan Jude
On 09/03/16 11:26 AM, Warner Losh wrote:
> Author: imp
> Date: Sat Sep  3 15:26:28 2016
> New Revision: 305353
> URL: https://svnweb.freebsd.org/changeset/base/305353
> 
> Log:
>   Don't use -N to set the OMAGIC with data and text writeable and data
>   not page aligned. To do this, use the ld script gnu ld installs on my
>   system.
>   
>   This is imperfect: LDFLAGS_BIN and LD_FLAGS_BIN describe different
>   things. The loader script could be better named and take into account
>   other architectures. And having two different mechanisms to do
>   basically the same thing needs study. However, it's blocking forward
>   progress on lld, so I'll work in parallel to sort these out.
>   
>   Differential Revision: https://reviews.freebsd.org/D7409
>   Reviewed by: emaste
> 

This breaks booting on my Lenovo laptop. The BTX client crashes and
dumps the registers.

Reverting this commit solved it.

Is there something I can do to help investigate this?

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


svn commit: r306279 - in head/sys/geom: bde concat gate journal linux_lvm mirror mountver raid3 shsec stripe vinum virstor

2016-09-23 Thread Alexander Motin
Author: mav
Date: Fri Sep 23 21:29:40 2016
New Revision: 306279
URL: https://svnweb.freebsd.org/changeset/base/306279

Log:
  Use g_wither_provider() where applicable.
  
  It is just a helper function combining G_PF_WITHER setting with
  g_orphan_provider().

Modified:
  head/sys/geom/bde/g_bde.c
  head/sys/geom/concat/g_concat.c
  head/sys/geom/gate/g_gate.c
  head/sys/geom/journal/g_journal.c
  head/sys/geom/linux_lvm/g_linux_lvm.c
  head/sys/geom/mirror/g_mirror.c
  head/sys/geom/mountver/g_mountver.c
  head/sys/geom/raid3/g_raid3.c
  head/sys/geom/shsec/g_shsec.c
  head/sys/geom/stripe/g_stripe.c
  head/sys/geom/vinum/geom_vinum_rm.c
  head/sys/geom/virstor/g_virstor.c

Modified: head/sys/geom/bde/g_bde.c
==
--- head/sys/geom/bde/g_bde.c   Fri Sep 23 20:20:50 2016(r306278)
+++ head/sys/geom/bde/g_bde.c   Fri Sep 23 21:29:40 2016(r306279)
@@ -85,7 +85,7 @@ g_bde_orphan(struct g_consumer *cp)
sc = gp->softc;
gp->flags |= G_GEOM_WITHER;
LIST_FOREACH(pp, >provider, provider)
-   g_orphan_provider(pp, ENXIO);
+   g_wither_provider(pp, ENXIO);
bzero(sc, sizeof(struct g_bde_softc));  /* destroy evidence */
return;
 }

Modified: head/sys/geom/concat/g_concat.c
==
--- head/sys/geom/concat/g_concat.c Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/concat/g_concat.c Fri Sep 23 21:29:40 2016
(r306279)
@@ -129,10 +129,9 @@ g_concat_remove_disk(struct g_concat_dis
}
 
if (sc->sc_provider != NULL) {
-   sc->sc_provider->flags |= G_PF_WITHER;
G_CONCAT_DEBUG(0, "Device %s deactivated.",
sc->sc_provider->name);
-   g_orphan_provider(sc->sc_provider, ENXIO);
+   g_wither_provider(sc->sc_provider, ENXIO);
sc->sc_provider = NULL;
}
 

Modified: head/sys/geom/gate/g_gate.c
==
--- head/sys/geom/gate/g_gate.c Fri Sep 23 20:20:50 2016(r306278)
+++ head/sys/geom/gate/g_gate.c Fri Sep 23 21:29:40 2016(r306279)
@@ -109,8 +109,7 @@ g_gate_destroy(struct g_gate_softc *sc, 
wakeup(sc);
mtx_unlock(>sc_queue_mtx);
gp = pp->geom;
-   pp->flags |= G_PF_WITHER;
-   g_orphan_provider(pp, ENXIO);
+   g_wither_provider(pp, ENXIO);
callout_drain(>sc_callout);
bioq_init();
mtx_lock(>sc_queue_mtx);

Modified: head/sys/geom/journal/g_journal.c
==
--- head/sys/geom/journal/g_journal.c   Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/journal/g_journal.c   Fri Sep 23 21:29:40 2016
(r306279)
@@ -2462,8 +2462,7 @@ g_journal_destroy(struct g_journal_softc
GJ_DEBUG(1, "Marking %s as clean.", sc->sc_name);
g_journal_metadata_update(sc);
g_topology_lock();
-   pp->flags |= G_PF_WITHER;
-   g_orphan_provider(pp, ENXIO);
+   g_wither_provider(pp, ENXIO);
} else {
g_topology_lock();
}

Modified: head/sys/geom/linux_lvm/g_linux_lvm.c
==
--- head/sys/geom/linux_lvm/g_linux_lvm.c   Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/linux_lvm/g_linux_lvm.c   Fri Sep 23 21:29:40 2016
(r306279)
@@ -333,7 +333,7 @@ g_llvm_remove_disk(struct g_llvm_vg *vg,
if (found) {
G_LLVM_DEBUG(0, "Device %s removed.",
lv->lv_gprov->name);
-   g_orphan_provider(lv->lv_gprov, ENXIO);
+   g_wither_provider(lv->lv_gprov, ENXIO);
lv->lv_gprov = NULL;
}
}

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/mirror/g_mirror.c Fri Sep 23 21:29:40 2016
(r306279)
@@ -2154,10 +2154,9 @@ g_mirror_destroy_provider(struct g_mirro
mtx_unlock(>sc_queue_mtx);
G_MIRROR_DEBUG(0, "Device %s: provider %s destroyed.", sc->sc_name,
sc->sc_provider->name);
-   sc->sc_provider->flags |= G_PF_WITHER;
-   g_orphan_provider(sc->sc_provider, ENXIO);
-   g_topology_unlock();
+   g_wither_provider(sc->sc_provider, ENXIO);
sc->sc_provider = NULL;
+   g_topology_unlock();
LIST_FOREACH(disk, >sc_disks, d_next) {
if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING)
g_mirror_sync_stop(disk, 1);

Modified: head/sys/geom/mountver/g_mountver.c

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

2016-09-23 Thread Andreas Tobler

On 23.09.16 22:03, Mateusz Guzik wrote:

On Fri, Sep 23, 2016 at 09:59:32PM +0200, Andreas Tobler wrote:

On 23.09.16 18:47, Mateusz Guzik wrote:

Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
 fd: hide fd_modified under CAPABILITIES

 It has no use without it and is now less error prone.

Modified:
 head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
return (fde);
}

+#ifdef CAPABILITIES
static __inline bool
fd_modified(struct filedesc *fdp, int fd, seq_t seq)
{

return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
}
+#endif

/* cdir/rdir/jdir manipulation functions. */
voidpwd_chdir(struct thread *td, struct vnode *vp);


I think this breaks kernel builds:

/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14:
error: implicit declaration of function 'fd_modified' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
modified = fd_modified(fdp, uap->fd, seq);
   ^
1 error generated.
*** [cloudabi_fd.o] Error code 1



Ye indeed, I hacked up a fix:
https://people.freebsd.org/~mjg/patches/cloudabi-fd_modified.diff

if ed@ does not respond soon acking the patch, I'll temporarily reviert
this change.



Thanks, I reverted locally to continue my work. So no hurry.

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


svn commit: r306277 - head/sys/dev/cxgbe

2016-09-23 Thread Navdeep Parhar
Author: np
Date: Fri Sep 23 20:03:28 2016
New Revision: 306277
URL: https://svnweb.freebsd.org/changeset/base/306277

Log:
  cxgbe(4): Make the location/length of all descriptor rings available in
  the sysctl MIB.

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Fri Sep 23 19:05:07 2016(r306276)
+++ head/sys/dev/cxgbe/t4_sge.c Fri Sep 23 20:03:28 2016(r306277)
@@ -177,8 +177,8 @@ static int free_ring(struct adapter *, b
 static int alloc_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *,
 int, int);
 static int free_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *);
-static void add_fl_sysctls(struct sysctl_ctx_list *, struct sysctl_oid *,
-struct sge_fl *);
+static void add_fl_sysctls(struct adapter *, struct sysctl_ctx_list *,
+struct sysctl_oid *, struct sge_fl *);
 static int alloc_fwq(struct adapter *);
 static int free_fwq(struct adapter *);
 static int alloc_mgmtq(struct adapter *);
@@ -2878,8 +2878,8 @@ free_iq_fl(struct vi_info *vi, struct sg
 }
 
 static void
-add_fl_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid,
-struct sge_fl *fl)
+add_fl_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx,
+struct sysctl_oid *oid, struct sge_fl *fl)
 {
struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid);
 
@@ -2887,6 +2887,11 @@ add_fl_sysctls(struct sysctl_ctx_list *c
"freelist");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   >ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   fl->sidx * EQ_ESIZE + sc->params.sge.spg_len,
+   "desc ring size in bytes");
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id",
CTLTYPE_INT | CTLFLAG_RD, >cntxt_id, 0, sysctl_uint16, "I",
"SGE context id of the freelist");
@@ -2942,6 +2947,10 @@ alloc_fwq(struct adapter *sc)
NULL, "firmware event queue");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(>ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   >ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(>ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   fwq->qsize * IQ_ESIZE, "descriptor ring size in bytes");
SYSCTL_ADD_PROC(>ctx, children, OID_AUTO, "abs_id",
CTLTYPE_INT | CTLFLAG_RD, >abs_id, 0, sysctl_uint16, "I",
"absolute id of the queue");
@@ -3053,6 +3062,10 @@ alloc_rxq(struct vi_info *vi, struct sge
NULL, "rx queue");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(>ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   >iq.ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(>ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   rxq->iq.qsize * IQ_ESIZE, "descriptor ring size in bytes");
SYSCTL_ADD_PROC(>ctx, children, OID_AUTO, "abs_id",
CTLTYPE_INT | CTLFLAG_RD, >iq.abs_id, 0, sysctl_uint16, "I",
"absolute id of the queue");
@@ -3074,7 +3087,7 @@ alloc_rxq(struct vi_info *vi, struct sge
CTLFLAG_RD, >vlan_extraction,
"# of times hardware extracted 802.1Q tag");
 
-   add_fl_sysctls(>ctx, oid, >fl);
+   add_fl_sysctls(sc, >ctx, oid, >fl);
 
return (rc);
 }
@@ -3103,12 +3116,13 @@ static int
 alloc_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq,
 int intr_idx, int idx, struct sysctl_oid *oid)
 {
+   struct port_info *pi = vi->pi;
int rc;
struct sysctl_oid_list *children;
char name[16];
 
rc = alloc_iq_fl(vi, _rxq->iq, _rxq->fl, intr_idx,
-   vi->pi->rx_chan_map);
+   pi->rx_chan_map);
if (rc != 0)
return (rc);
 
@@ -3119,6 +3133,10 @@ alloc_ofld_rxq(struct vi_info *vi, struc
NULL, "rx queue");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(>ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   _rxq->iq.ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(>ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   ofld_rxq->iq.qsize * IQ_ESIZE, "descriptor ring size in bytes");
SYSCTL_ADD_PROC(>ctx, children, OID_AUTO, "abs_id",
CTLTYPE_INT | CTLFLAG_RD, _rxq->iq.abs_id, 0, sysctl_uint16,
"I", "absolute id of the queue");
@@ -3129,7 +3147,7 @@ alloc_ofld_rxq(struct vi_info *vi, struc
CTLTYPE_INT | CTLFLAG_RD, _rxq->iq.cidx, 0, sysctl_uint16, "I",
"consumer index");
 
-   add_fl_sysctls(>ctx, oid, _rxq->fl);
+   add_fl_sysctls(pi->adapter, >ctx, oid, _rxq->fl);
 
return (rc);
 }
@@ -3550,6 +3568,11 @@ alloc_wrq(struct adapter *sc, struct vi_
wrq->nwr_pending = 0;
wrq->ndesc_needed = 0;
 
+   

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

2016-09-23 Thread Mateusz Guzik
On Fri, Sep 23, 2016 at 09:59:32PM +0200, Andreas Tobler wrote:
> On 23.09.16 18:47, Mateusz Guzik wrote:
> >Author: mjg
> >Date: Fri Sep 23 16:47:12 2016
> >New Revision: 306272
> >URL: https://svnweb.freebsd.org/changeset/base/306272
> >
> >Log:
> >  fd: hide fd_modified under CAPABILITIES
> >
> >  It has no use without it and is now less error prone.
> >
> >Modified:
> >  head/sys/sys/filedesc.h
> >
> >Modified: head/sys/sys/filedesc.h
> >==
> >--- head/sys/sys/filedesc.h  Fri Sep 23 16:22:03 2016(r306271)
> >+++ head/sys/sys/filedesc.h  Fri Sep 23 16:47:12 2016(r306272)
> >@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
> > return (fde);
> > }
> >
> >+#ifdef CAPABILITIES
> > static __inline bool
> > fd_modified(struct filedesc *fdp, int fd, seq_t seq)
> > {
> >
> > return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
> > }
> >+#endif
> >
> > /* cdir/rdir/jdir manipulation functions. */
> > voidpwd_chdir(struct thread *td, struct vnode *vp);
> 
> I think this breaks kernel builds:
> 
> /usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14:
> error: implicit declaration of function 'fd_modified' is invalid in
> C99 [-Werror,-Wimplicit-function-declaration]
> modified = fd_modified(fdp, uap->fd, seq);
>^
> 1 error generated.
> *** [cloudabi_fd.o] Error code 1
> 

Ye indeed, I hacked up a fix:
https://people.freebsd.org/~mjg/patches/cloudabi-fd_modified.diff

if ed@ does not respond soon acking the patch, I'll temporarily reviert
this change.

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


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

2016-09-23 Thread Andreas Tobler

On 23.09.16 18:47, Mateusz Guzik wrote:

Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
  fd: hide fd_modified under CAPABILITIES

  It has no use without it and is now less error prone.

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
return (fde);
 }

+#ifdef CAPABILITIES
 static __inline bool
 fd_modified(struct filedesc *fdp, int fd, seq_t seq)
 {

return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
 }
+#endif

 /* cdir/rdir/jdir manipulation functions. */
 void   pwd_chdir(struct thread *td, struct vnode *vp);


I think this breaks kernel builds:

/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14: 
error: implicit declaration of function 'fd_modified' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]

modified = fd_modified(fdp, uap->fd, seq);
   ^
1 error generated.
*** [cloudabi_fd.o] Error code 1

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


svn commit: r306276 - in head: sbin/mount_msdosfs sys/fs/msdosfs sys/sys

2016-09-23 Thread Alan Somers
Author: asomers
Date: Fri Sep 23 19:05:07 2016
New Revision: 306276
URL: https://svnweb.freebsd.org/changeset/base/306276

Log:
  Mount msdosfs with longnames support by default.
  
  The old behavior depended on the FAT version and on what files were in the
  root directory. "mount_msdosfs -o shortnames" is still supported.
  
  Reviewed by:  wblock, cem
  Discussed with:   trasz, adrian, imp
  MFC after:4 weeks
  X-MFC-Notes:  Don't MFC the removal of findwin95
  Differential Revision:https://reviews.freebsd.org/D8018

Modified:
  head/sbin/mount_msdosfs/mount_msdosfs.8
  head/sys/fs/msdosfs/denode.h
  head/sys/fs/msdosfs/msdosfs_lookup.c
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/sys/param.h

Modified: head/sbin/mount_msdosfs/mount_msdosfs.8
==
--- head/sbin/mount_msdosfs/mount_msdosfs.8 Fri Sep 23 18:55:32 2016
(r306275)
+++ head/sbin/mount_msdosfs/mount_msdosfs.8 Fri Sep 23 19:05:07 2016
(r306276)
@@ -142,15 +142,8 @@ If neither
 nor
 .Fl l
 are given,
-.Nm
-searches the root directory of the file system to
-be mounted for any existing Win'95 long filenames.
-If no such entries are found, but short DOS filenames are found,
-.Fl s
-is the default.
-Otherwise
 .Fl l
-is assumed.
+is the default.
 .It Fl 9
 Ignore the special Win'95 directory entries even
 if deleting or renaming a file.

Modified: head/sys/fs/msdosfs/denode.h
==
--- head/sys/fs/msdosfs/denode.hFri Sep 23 18:55:32 2016
(r306275)
+++ head/sys/fs/msdosfs/denode.hFri Sep 23 19:05:07 2016
(r306276)
@@ -265,7 +265,6 @@ int msdosfs_reclaim(struct vop_reclaim_a
  */
 int deget(struct msdosfsmount *, u_long, u_long, struct denode **);
 int uniqdosname(struct denode *, struct componentname *, u_char *);
-int findwin95(struct denode *);
 
 int readep(struct msdosfsmount *pmp, u_long dirclu, u_long dirofs,  struct buf 
**bpp, struct direntry **epp);
 int readde(struct denode *dep, struct buf **bpp, struct direntry **epp);

Modified: head/sys/fs/msdosfs/msdosfs_lookup.c
==
--- head/sys/fs/msdosfs/msdosfs_lookup.cFri Sep 23 18:55:32 2016
(r306275)
+++ head/sys/fs/msdosfs/msdosfs_lookup.cFri Sep 23 19:05:07 2016
(r306276)
@@ -1062,55 +1062,3 @@ uniqdosname(struct denode *dep, struct c
}
}
 }
-
-/*
- * Find any Win'95 long filename entry in directory dep
- */
-int
-findwin95(struct denode *dep)
-{
-   struct msdosfsmount *pmp = dep->de_pmp;
-   struct direntry *dentp;
-   int blsize, win95;
-   u_long cn;
-   daddr_t bn;
-   struct buf *bp;
-
-   win95 = 1;
-   /*
-* Read through the directory looking for Win'95 entries
-* Note: Error currently handled just as EOFXXX
-*/
-   for (cn = 0;; cn++) {
-   if (pcbmap(dep, cn, , 0, ))
-   return (win95);
-   if (bread(pmp->pm_devvp, bn, blsize, NOCRED, )) {
-   brelse(bp);
-   return (win95);
-   }
-   for (dentp = (struct direntry *)bp->b_data;
-(char *)dentp < bp->b_data + blsize;
-dentp++) {
-   if (dentp->deName[0] == SLOT_EMPTY) {
-   /*
-* Last used entry and not found
-*/
-   brelse(bp);
-   return (win95);
-   }
-   if (dentp->deName[0] == SLOT_DELETED) {
-   /*
-* Ignore deleted files
-* Note: might be an indication of Win'95 
anywayXXX
-*/
-   continue;
-   }
-   if (dentp->deAttributes == ATTR_WIN95) {
-   brelse(bp);
-   return 1;
-   }
-   win95 = 0;
-   }
-   brelse(bp);
-   }
-}

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cFri Sep 23 18:55:32 2016
(r306275)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cFri Sep 23 19:05:07 2016
(r306276)
@@ -175,24 +175,8 @@ update_mp(struct mount *mp, struct threa
 
if (pmp->pm_flags & MSDOSFSMNT_NOWIN95)
pmp->pm_flags |= MSDOSFSMNT_SHORTNAME;
-   else if (!(pmp->pm_flags &
-   (MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) {
-   struct vnode *rootvp;
-
- 

svn commit: r306275 - head/sys/dev/usb/input

2016-09-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Sep 23 18:55:32 2016
New Revision: 306275
URL: https://svnweb.freebsd.org/changeset/base/306275

Log:
  Do not perform extra check for NULL, evdev_free can handle NULL value
  
  Submitted by: Vladimir Kondratiev 

Modified:
  head/sys/dev/usb/input/ukbd.c

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Fri Sep 23 18:54:08 2016
(r306274)
+++ head/sys/dev/usb/input/ukbd.c   Fri Sep 23 18:55:32 2016
(r306275)
@@ -1432,8 +1432,7 @@ ukbd_detach(device_t dev)
 #endif
 
 #ifdef EVDEV
-   if (sc->sc_evdev != NULL)
-   evdev_free(sc->sc_evdev);
+   evdev_free(sc->sc_evdev);
 #endif
 
if (KBD_IS_CONFIGURED(>sc_kbd)) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306274 - head/sys/dev/evdev

2016-09-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Sep 23 18:54:08 2016
New Revision: 306274
URL: https://svnweb.freebsd.org/changeset/base/306274

Log:
  Handle NULL argument in evdev_free
  
  Add check for evdev argument of evdev_free being NULL. This is valid
  value and should not cause crash. In this case evdev_free does nothing
  
  Submitted by: Vladimir Kondratiev 

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

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Fri Sep 23 17:24:06 2016(r306273)
+++ head/sys/dev/evdev/evdev.c  Fri Sep 23 18:54:08 2016(r306274)
@@ -92,7 +92,8 @@ void
 evdev_free(struct evdev_dev *evdev)
 {
 
-   if (evdev->ev_cdev != NULL && evdev->ev_cdev->si_drv1 != NULL)
+   if (evdev != NULL && evdev->ev_cdev != NULL &&
+   evdev->ev_cdev->si_drv1 != NULL)
evdev_unregister(evdev);
 
free(evdev, M_EVDEV);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306273 - head/sys/dev/cxgbe

2016-09-23 Thread Navdeep Parhar
Author: np
Date: Fri Sep 23 17:24:06 2016
New Revision: 306273
URL: https://svnweb.freebsd.org/changeset/base/306273

Log:
  cxgbe(4): Fix netmap with T6, which doesn't encapsulate SGE_EGR_UPDATE
  message inside a FW_MSG.  The base NIC already deals with updates in
  either form.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Fri Sep 23 16:47:12 2016
(r306272)
+++ head/sys/dev/cxgbe/t4_netmap.c  Fri Sep 23 17:24:06 2016
(r306273)
@@ -883,19 +883,23 @@ cxgbe_nm_detach(struct vi_info *vi)
netmap_detach(vi->ifp);
 }
 
+static inline const void *
+unwrap_nm_fw6_msg(const struct cpl_fw6_msg *cpl)
+{
+
+   MPASS(cpl->type == FW_TYPE_RSSCPL || cpl->type == FW6_TYPE_RSSCPL);
+
+   /* data[0] is RSS header */
+   return (>data[1]);
+}
+
 static void
-handle_nm_fw6_msg(struct adapter *sc, struct ifnet *ifp,
-const struct cpl_fw6_msg *cpl)
+handle_nm_sge_egr_update(struct adapter *sc, struct ifnet *ifp,
+const struct cpl_sge_egr_update *egr)
 {
-   const struct cpl_sge_egr_update *egr;
uint32_t oq;
struct sge_nm_txq *nm_txq;
 
-   if (cpl->type != FW_TYPE_RSSCPL && cpl->type != FW6_TYPE_RSSCPL)
-   panic("%s: FW_TYPE 0x%x on nm_rxq.", __func__, cpl->type);
-
-   /* data[0] is RSS header */
-   egr = (const void *)>data[1];
oq = be32toh(egr->opcode_qid);
MPASS(G_CPL_OPCODE(oq) == CPL_SGE_EGR_UPDATE);
nm_txq = (void *)sc->sge.eqmap[G_EGR_QID(oq) - sc->sge.eq_start];
@@ -914,6 +918,7 @@ t4_nm_intr(void *arg)
struct netmap_kring *kring = >rx_rings[nm_rxq->nid];
struct netmap_ring *ring = kring->ring;
struct iq_desc *d = _rxq->iq_desc[nm_rxq->iq_cidx];
+   const void *cpl;
uint32_t lq;
u_int n = 0, work = 0;
uint8_t opcode;
@@ -926,6 +931,7 @@ t4_nm_intr(void *arg)
 
lq = be32toh(d->rsp.pldbuflen_qid);
opcode = d->rss.opcode;
+   cpl = >cpl[0];
 
switch (G_RSPD_TYPE(d->rsp.u.type_gen)) {
case X_RSPD_TYPE_FLBUF:
@@ -942,8 +948,10 @@ t4_nm_intr(void *arg)
switch (opcode) {
case CPL_FW4_MSG:
case CPL_FW6_MSG:
-   handle_nm_fw6_msg(sc, ifp,
-   (const void *)>cpl[0]);
+   cpl = unwrap_nm_fw6_msg(cpl);
+   /* fall through */
+   case CPL_SGE_EGR_UPDATE:
+   handle_nm_sge_egr_update(sc, ifp, cpl);
break;
case CPL_RX_PKT:
ring->slot[fl_cidx].len = G_RSPD_LEN(lq) -
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306272 - head/sys/sys

2016-09-23 Thread Mateusz Guzik
Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
  fd: hide fd_modified under CAPABILITIES
  
  It has no use without it and is now less error prone.

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int 
return (fde);
 }
 
+#ifdef CAPABILITIES
 static __inline bool
 fd_modified(struct filedesc *fdp, int fd, seq_t seq)
 {
 
return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
 }
+#endif
 
 /* cdir/rdir/jdir manipulation functions. */
 void   pwd_chdir(struct thread *td, struct vnode *vp);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306268 - head/sys/arm/broadcom/bcm2835

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 15:28:15 2016
New Revision: 306268
URL: https://svnweb.freebsd.org/changeset/base/306268

Log:
  Also implement platform_cpu_reset on bcm2836

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Sep 23 14:11:23 
2016(r306267)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Sep 23 15:28:15 
2016(r306268)
@@ -137,6 +137,7 @@ static platform_method_t bcm2836_methods
PLATFORMMETHOD(platform_devmap_init,bcm2836_devmap_init),
PLATFORMMETHOD(platform_lastaddr,   bcm2835_lastaddr),
PLATFORMMETHOD(platform_late_init,  bcm2835_late_init),
+   PLATFORMMETHOD(platform_cpu_reset,  bcm2835_cpu_reset),
 
PLATFORMMETHOD_END,
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306267 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/nvidia/...

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 14:11:23 2016
New Revision: 306267
URL: https://svnweb.freebsd.org/changeset/base/306267

Log:
  Restrict where we need to define fdt_fixup_table to just PowerPC and
  Marvell.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/a10_common.c
  head/sys/arm/altera/socfpga/socfpga_common.c
  head/sys/arm/amlogic/aml8726/aml8726_machdep.c
  head/sys/arm/annapurna/alpine/common.c
  head/sys/arm/at91/at91_common.c
  head/sys/arm/broadcom/bcm2835/bcm2835_common.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/freescale/imx/imx_common.c
  head/sys/arm/freescale/vybrid/vf_common.c
  head/sys/arm/lpc/lpc_intc.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_common.c
  head/sys/arm/rockchip/rk30xx_common.c
  head/sys/arm/samsung/exynos/exynos5_common.c
  head/sys/arm/ti/ti_common.c
  head/sys/arm/versatile/versatile_common.c
  head/sys/arm/xilinx/zy7_machdep.c
  head/sys/dev/ofw/ofw_fdt.c

Modified: head/sys/arm/allwinner/a10_common.c
==
--- head/sys/arm/allwinner/a10_common.c Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/allwinner/a10_common.c Fri Sep 23 14:11:23 2016
(r306267)
@@ -38,10 +38,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 
 static int

Modified: head/sys/arm/altera/socfpga/socfpga_common.c
==
--- head/sys/arm/altera/socfpga/socfpga_common.cFri Sep 23 13:23:52 
2016(r306266)
+++ head/sys/arm/altera/socfpga/socfpga_common.cFri Sep 23 14:11:23 
2016(r306267)
@@ -70,10 +70,6 @@ end:
while (1);
 }
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 static int
 fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,

Modified: head/sys/arm/amlogic/aml8726/aml8726_machdep.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 13:23:52 
2016(r306266)
+++ head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 14:11:23 
2016(r306267)
@@ -165,10 +165,6 @@ platform_devmap_init(void)
return (0);
 }
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 #ifndef DEV_GIC
 static int

Modified: head/sys/arm/annapurna/alpine/common.c
==
--- head/sys/arm/annapurna/alpine/common.c  Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/annapurna/alpine/common.c  Fri Sep 23 14:11:23 2016
(r306267)
@@ -56,9 +56,6 @@ __FBSDID("$FreeBSD$");
 #define LOCK   0x0001
 
 extern bus_addr_t  al_devmap_pa;
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
 
 static int alpine_get_wdt_base(uint32_t *pbase, uint32_t *psize);
 static int alpine_pic_decode_fdt(uint32_t iparent, uint32_t *intr,

Modified: head/sys/arm/at91/at91_common.c
==
--- head/sys/arm/at91/at91_common.c Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/at91/at91_common.c Fri Sep 23 14:11:23 2016
(r306267)
@@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$");
 
 extern const struct devmap_entry at91_devmap[];
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 static int
 fdt_aic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_common.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Fri Sep 23 13:23:52 
2016(r306266)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Fri Sep 23 14:11:23 
2016(r306267)
@@ -46,10 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 static int
 fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==
--- head/sys/arm/freescale/imx/imx6_machdep.c   Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/freescale/imx/imx6_machdep.c   Fri Sep 23 14:11:23 2016
(r306267)
@@ -52,10 +52,6 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 static uint32_t gpio1_node;
 
 #ifndef INTRNG

Modified: head/sys/arm/freescale/imx/imx_common.c
==
--- head/sys/arm/freescale/imx/imx_common.c 

svn commit: r306266 - head/lib/libcompiler_rt

2016-09-23 Thread Ed Maste
Author: emaste
Date: Fri Sep 23 13:23:52 2016
New Revision: 306266
URL: https://svnweb.freebsd.org/changeset/base/306266

Log:
  libcompiler_rt: use ${SRCTOP} for the top of the FreeBSD tree

Modified:
  head/lib/libcompiler_rt/Makefile

Modified: head/lib/libcompiler_rt/Makefile
==
--- head/lib/libcompiler_rt/MakefileFri Sep 23 13:21:29 2016
(r306265)
+++ head/lib/libcompiler_rt/MakefileFri Sep 23 13:23:52 2016
(r306266)
@@ -8,7 +8,7 @@ NO_PIC=
 WARNS?=2
 
 CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
-CFLAGS+=-I${.CURDIR}/../../contrib/libcxxrt
+CFLAGS+=-I${SRCTOP}/contrib/libcxxrt
 
 .if ${MACHINE_CPUARCH} == "amd64"
 CRTARCH=x86_64
@@ -16,7 +16,7 @@ CRTARCH=x86_64
 CRTARCH=${MACHINE_CPUARCH}
 .endif
 
-CRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib/builtins
+CRTSRC=${SRCTOP}/contrib/compiler-rt/lib/builtins
 
 .PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306265 - head/share/mk

2016-09-23 Thread Ed Maste
Author: emaste
Date: Fri Sep 23 13:21:29 2016
New Revision: 306265
URL: https://svnweb.freebsd.org/changeset/base/306265

Log:
  Force LLVM_LIBUNWIND off if we don't have a C++11 compiler
  
  Tested by:bde
  Differential Revision:https://reviews.freebsd.org/D7746

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

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Fri Sep 23 13:18:59 2016(r306264)
+++ head/share/mk/src.opts.mk   Fri Sep 23 13:21:29 2016(r306265)
@@ -289,6 +289,10 @@ MK_${var}:=no
 # Force some options off if their dependencies are off.
 # Order is somewhat important.
 #
+.if !${COMPILER_FEATURES:Mc++11}
+MK_LLVM_LIBUNWIND:=no
+.endif
+
 .if ${MK_LIBPTHREAD} == "no"
 MK_LIBTHR:=no
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306264 - in head/sys/boot/efi/loader/arch: amd64 i386

2016-09-23 Thread Ed Maste
Author: emaste
Date: Fri Sep 23 13:18:59 2016
New Revision: 306264
URL: https://svnweb.freebsd.org/changeset/base/306264

Log:
  Use 32-bit value for .text padding, for linker portability
  
  GNU ld interprets the padding value as a variable-length byte string,
  while GNU gold and LLVM lld interpret it as a 32-bit value.

Modified:
  head/sys/boot/efi/loader/arch/amd64/ldscript.amd64
  head/sys/boot/efi/loader/arch/i386/ldscript.i386

Modified: head/sys/boot/efi/loader/arch/amd64/ldscript.amd64
==
--- head/sys/boot/efi/loader/arch/amd64/ldscript.amd64  Fri Sep 23 13:08:15 
2016(r306263)
+++ head/sys/boot/efi/loader/arch/amd64/ldscript.amd64  Fri Sep 23 13:18:59 
2016(r306264)
@@ -19,7 +19,7 @@ SECTIONS
 /* .gnu.warning sections are handled specially by elf32.em. */
 *(.gnu.warning)
 *(.plt)
-  } =0xCC
+  } =0x
   . = ALIGN(4096);
   .data: {
 *(.rodata .rodata.* .gnu.linkonce.r.*)

Modified: head/sys/boot/efi/loader/arch/i386/ldscript.i386
==
--- head/sys/boot/efi/loader/arch/i386/ldscript.i386Fri Sep 23 13:08:15 
2016(r306263)
+++ head/sys/boot/efi/loader/arch/i386/ldscript.i386Fri Sep 23 13:18:59 
2016(r306264)
@@ -14,7 +14,7 @@ SECTIONS
 /* .gnu.warning sections are handled specially by elf32.em. */
 *(.gnu.warning)
 *(.plt)
-  } =0xCC
+  } =0x
   . = ALIGN(4096);
   .data: {
 *(.rodata .rodata.* .gnu.linkonce.r.*)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306263 - in head/sys/arm: allwinner arm broadcom/bcm2835 freescale/imx nvidia/tegra124 qemu ti

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 13:08:15 2016
New Revision: 306263
URL: https://svnweb.freebsd.org/changeset/base/306263

Log:
  Move cpu_reset to be a platform method to allow multiple implementations.
  
  Reviewed by:  mmel
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D8010

Modified:
  head/sys/arm/allwinner/aw_machdep.c
  head/sys/arm/arm/platform.c
  head/sys/arm/arm/platform_if.m
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/freescale/imx/imx51_machdep.c
  head/sys/arm/freescale/imx/imx53_machdep.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_machdep.c
  head/sys/arm/ti/ti_machdep.c

Modified: head/sys/arm/allwinner/aw_machdep.c
==
--- head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 12:38:05 2016
(r306262)
+++ head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 13:08:15 2016
(r306263)
@@ -146,8 +146,8 @@ allwinner_devmap_init(platform_t plat)
return (0);
 }
 
-void
-cpu_reset()
+static void
+allwinner_cpu_reset(platform_t plat)
 {
aw_wdog_watchdog_reset();
printf("Reset failed!\n");
@@ -159,6 +159,7 @@ static platform_method_t a10_methods[] =
PLATFORMMETHOD(platform_attach, a10_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
PLATFORMMETHOD_END,
 };
@@ -170,6 +171,7 @@ static platform_method_t a13_methods[] =
PLATFORMMETHOD(platform_attach, a13_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
PLATFORMMETHOD_END,
 };
@@ -181,6 +183,7 @@ static platform_method_t a20_methods[] =
PLATFORMMETHOD(platform_attach, a20_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
@@ -196,6 +199,7 @@ static platform_method_t a31_methods[] =
PLATFORMMETHOD(platform_attach, a31_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
@@ -211,6 +215,7 @@ static platform_method_t a31s_methods[] 
PLATFORMMETHOD(platform_attach, a31s_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
@@ -226,6 +231,7 @@ static platform_method_t a83t_methods[] 
PLATFORMMETHOD(platform_attach, a83t_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,a83t_mp_start_ap),
@@ -241,6 +247,7 @@ static platform_method_t h3_methods[] = 
PLATFORMMETHOD(platform_attach, h3_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),

Modified: head/sys/arm/arm/platform.c
==
--- head/sys/arm/arm/platform.c Fri Sep 23 12:38:05 2016(r306262)
+++ head/sys/arm/arm/platform.c Fri Sep 23 13:08:15 2016(r306263)
@@ -188,6 +188,20 @@ platform_late_init(void)
PLATFORM_LATE_INIT(plat_obj);
 }
 
+void
+cpu_reset(void)
+{
+
+   PLATFORM_CPU_RESET(plat_obj);
+
+   printf("cpu_reset failed");
+
+   intr_disable();
+   while(1) {
+   cpu_sleep(0);
+   }
+}
+
 #ifdef MULTIDELAY
 static void
 platform_delay(int usec, void *arg __unused)

Modified: head/sys/arm/arm/platform_if.m
==
--- head/sys/arm/arm/platform_if.m  Fri Sep 23 12:38:05 2016
(r306262)
+++ head/sys/arm/arm/platform_if.m  Fri Sep 23 13:08:15 2016
(r306263)
@@ -133,3 +133,10 @@ METHOD void 

svn commit: r306262 - in head/sys/arm: allwinner altera/socfpga amlogic/aml8726 annapurna/alpine arm broadcom/bcm2835 freescale/imx freescale/vybrid include mv nvidia/tegra124 qemu rockchip samsung...

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 12:38:05 2016
New Revision: 306262
URL: https://svnweb.freebsd.org/changeset/base/306262

Log:
  Remove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
  this on a few earlier arm SoCs.
  
  Reviewed by:  manu (earlier version)
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/aw_machdep.c
  head/sys/arm/altera/socfpga/socfpga_machdep.c
  head/sys/arm/amlogic/aml8726/aml8726_machdep.c
  head/sys/arm/annapurna/alpine/alpine_machdep.c
  head/sys/arm/arm/busdma_machdep-v6.c
  head/sys/arm/arm/platform.c
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/freescale/imx/imx_machdep.c
  head/sys/arm/freescale/vybrid/vf_machdep.c
  head/sys/arm/include/bus_dma.h
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_machdep.c
  head/sys/arm/rockchip/rk30xx_machdep.c
  head/sys/arm/samsung/exynos/exynos5_machdep.c
  head/sys/arm/ti/ti_machdep.c
  head/sys/arm/versatile/versatile_machdep.c
  head/sys/arm/xilinx/zy7_machdep.c

Modified: head/sys/arm/allwinner/aw_machdep.c
==
--- head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 12:34:54 2016
(r306261)
+++ head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 12:38:05 2016
(r306262)
@@ -36,7 +36,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -147,18 +146,6 @@ allwinner_devmap_init(platform_t plat)
return (0);
 }
 
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-   return (0);
-}
-
 void
 cpu_reset()
 {

Modified: head/sys/arm/altera/socfpga/socfpga_machdep.c
==
--- head/sys/arm/altera/socfpga/socfpga_machdep.c   Fri Sep 23 12:34:54 
2016(r306261)
+++ head/sys/arm/altera/socfpga/socfpga_machdep.c   Fri Sep 23 12:38:05 
2016(r306262)
@@ -34,7 +34,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define_ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -100,17 +99,3 @@ platform_devmap_init(void)
 
return (0);
 }
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
-   return (0);
-}

Modified: head/sys/arm/amlogic/aml8726/aml8726_machdep.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 12:34:54 
2016(r306261)
+++ head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 12:38:05 
2016(r306262)
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_platform.h"
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -166,20 +165,6 @@ platform_devmap_init(void)
return (0);
 }
 
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
-   return (0);
-}
-
 struct fdt_fixup_entry fdt_fixup_table[] = {
{ NULL, NULL }
 };

Modified: head/sys/arm/annapurna/alpine/alpine_machdep.c
==
--- head/sys/arm/annapurna/alpine/alpine_machdep.c  Fri Sep 23 12:34:54 
2016(r306261)
+++ head/sys/arm/annapurna/alpine/alpine_machdep.c  Fri Sep 23 12:38:05 
2016(r306262)
@@ -29,7 +29,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -92,17 +91,3 @@ platform_devmap_init(void)
devmap_add_entry(al_devmap_pa, al_devmap_size);
return (0);
 }
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
-   return (0);
-}

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cFri Sep 23 12:34:54 2016
(r306261)
+++ head/sys/arm/arm/busdma_machdep-v6.cFri Sep 23 12:38:05 2016
(r306262)
@@ -33,7 +33,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -95,14 +94,6 @@ struct bus_dma_tag {
bus_dma_lock_t  *lockfunc;
void*lockfuncarg;
struct bounce_zone  *bounce_zone;
-   /*
-* DMA range for this tag.  If the page doesn't fall within
-* one of these ranges, an error is returned.  The caller
-* may then decide what to do with the transfer.  If the
-* range pointer is NULL, it is ignored.
-*/
-   struct arm32_dma_range  *ranges;
-   int _nranges;
 };
 
 struct bounce_page {
@@ -407,22 +398,6 @@ must_bounce(bus_dma_tag_t dmat, bus_dmam
return (0);
 }
 
-static __inline struct 

svn commit: r306261 - in head/usr.bin: . proccontrol

2016-09-23 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 23 12:34:54 2016
New Revision: 306261
URL: https://svnweb.freebsd.org/changeset/base/306261

Log:
  Provide proccontrol(1), an utility to control processes behaviour, related
  to procctl(2).
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Added:
  head/usr.bin/proccontrol/
  head/usr.bin/proccontrol/Makefile   (contents, props changed)
  head/usr.bin/proccontrol/proccontrol.c   (contents, props changed)
Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Fri Sep 23 12:32:20 2016(r306260)
+++ head/usr.bin/Makefile   Fri Sep 23 12:34:54 2016(r306261)
@@ -122,6 +122,7 @@ SUBDIR= alias \
pr \
printenv \
printf \
+   proccontrol \
procstat \
protect \
rctl \

Added: head/usr.bin/proccontrol/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/proccontrol/Makefile   Fri Sep 23 12:34:54 2016
(r306261)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG=   proccontrol
+WARNS?=6
+MK_MAN=no
+
+.include 

Added: head/usr.bin/proccontrol/proccontrol.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/proccontrol/proccontrol.c  Fri Sep 23 12:34:54 2016
(r306261)
@@ -0,0 +1,180 @@
+/*-
+ * Copyright (c) 2016 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+enum {
+   MODE_INVALID,
+   MODE_TRACE,
+   MODE_TRAPCAP,
+};
+
+static pid_t
+str2pid(const char *str)
+{
+   pid_t res;
+   char *tail;
+
+   res = strtol(str, , 0);
+   if (*tail != '\0') {
+   warnx("non-numeric pid");
+   return (-1);
+   }
+   return (res);
+}
+
+static void __dead2
+usage(void)
+{
+
+   fprintf(stderr, "Usage: proccontrol -m (trace|trapcap) [-q] "
+   "[-s (enable|disable)] [-p pid | command]\n");
+   exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+   int arg, ch, error, mode;
+   pid_t pid;
+   bool enable, do_command, query;
+
+   mode = MODE_INVALID;
+   enable = true;
+   pid = -1;
+   query = false;
+   while ((ch = getopt(argc, argv, "m:qs:p:")) != -1) {
+   switch (ch) {
+   case 'm':
+   if (strcmp(optarg, "trace") == 0)
+   mode = MODE_TRACE;
+   else if (strcmp(optarg, "trapcap") == 0)
+   mode = MODE_TRAPCAP;
+   else
+   usage();
+   break;
+   case 's':
+   if (strcmp(optarg, "enable") == 0)
+   enable = true;
+   else if (strcmp(optarg, "disable") == 0)
+   enable = false;
+   else
+   usage();
+   break;
+   case 'p':
+   pid = str2pid(optarg);
+   break;
+   case 'q':
+   query = true;
+   break;
+   case '?':
+   

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

2016-09-23 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 23 12:32:20 2016
New Revision: 306260
URL: https://svnweb.freebsd.org/changeset/base/306260

Log:
  Add the foundation copyrights to procctl kernel sources.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_procctl.c
  head/sys/sys/procctl.h

Modified: head/sys/kern/kern_procctl.c
==
--- head/sys/kern/kern_procctl.cFri Sep 23 12:13:06 2016
(r306259)
+++ head/sys/kern/kern_procctl.cFri Sep 23 12:32:20 2016
(r306260)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2014 John Baldwin
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (c) 2014, 2016 The FreeBSD Foundation
  *
  * Portions of this software were developed by Konstantin Belousov
  * under sponsorship from the FreeBSD Foundation.

Modified: head/sys/sys/procctl.h
==
--- head/sys/sys/procctl.h  Fri Sep 23 12:13:06 2016(r306259)
+++ head/sys/sys/procctl.h  Fri Sep 23 12:32:20 2016(r306260)
@@ -1,8 +1,12 @@
 /*-
  * Copyright (c) 2013 Hudson River Trading LLC
+ * Copyright (c) 2014, 2016 The FreeBSD Foundation
  * Written by: John H. Baldwin 
  * All rights reserved.
  *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306257 - head/lib/libc/sys

2016-09-23 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 23 09:26:40 2016
New Revision: 306257
URL: https://svnweb.freebsd.org/changeset/base/306257

Log:
  Document r306081, i.e. procctl(PROC_TRAPCAP) and sysctl kern.trap_enocap.
  
  Reviewed by:  cem
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D8003

Modified:
  head/lib/libc/sys/cap_enter.2
  head/lib/libc/sys/procctl.2

Modified: head/lib/libc/sys/cap_enter.2
==
--- head/lib/libc/sys/cap_enter.2   Fri Sep 23 09:20:42 2016
(r306256)
+++ head/lib/libc/sys/cap_enter.2   Fri Sep 23 09:26:40 2016
(r306257)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2016
+.Dd September 22, 2016
 .Dt CAP_ENTER 2
 .Os
 .Sh NAME
@@ -69,6 +69,34 @@ appropriately-crafted applications or ap
 .Fn cap_getmode
 returns a flag indicating whether or not the process is in a capability mode
 sandbox.
+.Sh RUN-TIME SETTINGS
+If the
+.Dv kern.trap_enocap
+sysctl MIB is set to non-zero value, then for any process executing in a
+capability mode sandbox, any syscall which results in either
+.Er ENOTCAPABLE
+or
+.Er ECAPMODE
+error, also generates the synchronous
+.Dv SIGTRAP
+signal to the thread on the syscall return.
+On the signal delivery, the
+.Va si_errno
+member of the
+.Fa siginfo
+signal handler parameter is set to the syscall error value,
+and the
+.Va si_code
+member is set to
+.Dv TRAP_CAP .
+.Pp
+See also the
+.Dv PROC_TRAPCAP_CTL
+and
+.Dv PROC_TRAPCAP_STATUS
+operations of the
+.Xr procctl 2
+function for similar per-process functionality.
 .Sh CAVEAT
 Creating effective process sandboxes is a tricky process that involves
 identifying the least possible rights required by the process and then
@@ -116,6 +144,8 @@ points outside the process's allocated a
 .Xr cap_fcntls_limit 2 ,
 .Xr cap_ioctls_limit 2 ,
 .Xr cap_rights_limit 2 ,
+.Xr procctl 2 ,
+.Xr sysctl 2 ,
 .Xr fexecve 2 ,
 .Xr cap_sandboxed 3 ,
 .Xr capsicum 4

Modified: head/lib/libc/sys/procctl.2
==
--- head/lib/libc/sys/procctl.2 Fri Sep 23 09:20:42 2016(r306256)
+++ head/lib/libc/sys/procctl.2 Fri Sep 23 09:26:40 2016(r306257)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2015
+.Dd September 22, 2016
 .Dt PROCCTL 2
 .Os
 .Sh NAME
@@ -71,7 +71,7 @@ The control request to perform is specif
 .Fa cmd
 argument.
 The following commands are supported:
-.Bl -tag -width "PROC_REAP_GETPIDS"
+.Bl -tag -width "Dv PROC_TRAPCAP_STATUS"
 .It Dv PROC_SPROTECT
 Set process protection state.
 This is used to mark a process as protected from being killed if the system
@@ -327,6 +327,63 @@ is set to 0.
 If a debugger is attached,
 .Fa data
 is set to the pid of the debugger process.
+.It Dv PROC_TRAPCAP_CTL
+Enable or disable, for the specified processes which are executing in a
+capability mode sandbox, the synchronous
+.Dv SIGTRAP
+signal on return from any syscall which gives either
+.Er ENOTCAPABLE
+or
+.Er ECAPMODE
+error.
+.Pp
+Possible values for the
+.Fa data
+argument are:
+.Bl -tag -width "Dv PROC_TRAPCAP_CTL_DISABLE"
+.It Dv PROC_TRAPCAP_CTL_ENABLE
+Enable the
+.Dv SIGTRAP
+signal delivery on capability mode access violations.
+The enabled mode is inherited by the children of the process,
+and is kept after
+.Xr fexecve 2
+calls.
+.It Dv PROC_TRAPCAP_CTL_DISABLE
+Disable the signal delivery on capability mode access violations.
+Note that the global sysctl
+.Dv kern.trap_enocap
+might still cause the signal to be delivered; see
+.Xr capsicum 4 .
+.El
+.Pp
+On signal delivery, the
+.Va si_errno
+member of the
+.Fa siginfo
+signal handler parameter is set to the syscall error value,
+and the
+.Va si_code
+member is set to
+.Dv TRAP_CAP .
+.Pp
+See
+.Xr capsicum 4
+for more information about the capability mode.
+.It Dv PROC_TRAPCAP_STATUS
+Returns the current status of signalling capability mode access
+violations for the specified process.
+The integer value pointed to by the
+.Fa data
+argument is set to the
+.Dv PROC_TRAPCAP_CTL_ENABLE
+value if the process control enables signal delivery, and to
+.Dv PROC_TRAPCAP_CTL_DISABLE
+otherwise.
+.Pp
+See the note about sysctl
+.Dv kern.trap_enocap
+above, which gives independent global control of signal delivery.
 .El
 .Sh NOTES
 Disabling tracing on a process should not be considered a security
@@ -420,14 +477,18 @@ The value of the integer
 .Fa data
 parameter for the
 .Dv PROC_TRACE_CTL
+or
+.Dv PROC_TRAPCAP_CTL
 request is invalid.
 .El
 .Sh SEE ALSO
 .Xr dtrace 1 ,
+.Xr cap_enter 2,
 .Xr kill 2 ,
 .Xr ktrace 2 ,
 .Xr ptrace 2 ,
 .Xr wait 2 ,
+.Xr capsicum 4 ,
 .Xr hwpmc 4 ,
 .Xr init 8
 .Sh HISTORY
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r306232 - head/sys/kern

2016-09-23 Thread Mariusz Zaborski
Author: oshogbo
Date: Fri Sep 23 08:13:46 2016
New Revision: 306232
URL: https://svnweb.freebsd.org/changeset/base/306232

Log:
  fd: fix up fget_cap
  
  If the kernel is not compiled with the CAPABILITIES kernel options
  fget_unlocked doesn't return the sequence number so fd_modify will
  always report modification, in that case we got infinity loop.
  
  Reported by:  br
  Reviewed by:  mjg
  Tested by:br, def

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cFri Sep 23 07:51:01 2016
(r306231)
+++ head/sys/kern/kern_descrip.cFri Sep 23 08:13:46 2016
(r306232)
@@ -2480,12 +2480,16 @@ int
 fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp,
 struct file **fpp, struct filecaps *havecapsp)
 {
-   struct filedesc *fdp;
-   struct file *fp;
+   struct filedesc *fdp = td->td_proc->p_fd;
int error;
+#ifndef CAPABILITIES
+   error = fget_unlocked(fdp, fd, needrightsp, fpp, NULL);
+   if (error == 0 && havecapsp != NULL)
+   filecaps_fill(havecapsp);
+#else
+   struct file *fp;
seq_t seq;
 
-   fdp = td->td_proc->p_fd;
for (;;) {
error = fget_unlocked(fdp, fd, needrightsp, , );
if (error != 0)
@@ -2513,7 +2517,7 @@ get_locked:
if (error == 0)
fhold(*fpp);
FILEDESC_SUNLOCK(fdp);
-
+#endif
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306231 - head/tests/etc/rc.d

2016-09-23 Thread Ruslan Bukin
Author: br
Date: Fri Sep 23 07:51:01 2016
New Revision: 306231
URL: https://svnweb.freebsd.org/changeset/base/306231

Log:
  Check if IPv6 supported before running the test, skip otherwise.
  
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Modified:
  head/tests/etc/rc.d/routing_test.sh

Modified: head/tests/etc/rc.d/routing_test.sh
==
--- head/tests/etc/rc.d/routing_test.sh Fri Sep 23 07:48:34 2016
(r306230)
+++ head/tests/etc/rc.d/routing_test.sh Fri Sep 23 07:51:01 2016
(r306231)
@@ -58,6 +58,10 @@ static_ipv6_loopback_route_for_each_fib_
local nfibs fib
nfibs=`sysctl -n net.fibs`
 
+   if [ "`sysctl -in kern.features.inet6`" != "1" ]; then
+   atf_skip "This test requires IPv6 support"
+   fi
+
# Check for an IPv6 loopback route
for fib in `seq 0 $((${nfibs} - 1))`; do
atf_check -o match:"interface: lo0" -s exit:0 \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-23 Thread Ruslan Bukin
Hi

It is booting fine with patch.

Thanks!

Ruslan

On Fri, Sep 23, 2016 at 12:34:40AM +0200, Mariusz Zaborski wrote:
> Thanks, I was able to reproduce that :)
> I attached the patch. Could you please confirm that it fix the problem?
> 
> Thank you and sorry for inconveniences,
> Mariusz
> 
> On 22 September 2016 at 18:11, Ruslan Bukin  wrote:
> > I have just tested this with MIPS64EL and the result is the same.
> > So you can try both EL or EB
> >
> > e.g. make -j16 TARGET=mips TARGET_ARCH=mips64el KERNCONF=MALTA64 buildkernel
> >
> > Ruslan
> >
> > On Thu, Sep 22, 2016 at 03:21:53PM +, Ruslan Bukin wrote:
> >> Hi
> >>
> >> It reports nothing. Yes I use qemu:
> >> /home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M 
> >> malta -kernel 
> >> ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel -hda 
> >> /home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net 
> >> nic -net user -m 2048M -redir tcp:4022::22
> >>
> >> Ruslan
> >>
> >> On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
> >> > I tested it on the mips for Malta kernel and it's works fine. I will
> >> > try to do it on mips64, are you using qemu to test it?
> >> > What is ctrl + t reporting you?
> >> >
> >> >
> >> > On 22 September 2016 at 16:56, Ruslan Bukin  
> >> > wrote:
> >> > > May be. The next line should be
> >> > > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
> >> > >
> >> > > but it hangs before this line
> >> > >
> >> > > Ruslan
> >> > >
> >> > > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> >> > >> Hi Ruslan,
> >> > >>
> >> > >> Does it hang on some network script?
> >> > >>
> >> > >> Thanks,
> >> > >> Mariusz
> >> > >>
> >> > >>
> >> > >> On 22 September 2016 at 16:34, Ruslan Bukin 
> >> > >>  wrote:
> >> > >> > Hi Mariusz
> >> > >> >
> >> > >> > my MIPS64EB kernel stops booting with this
> >> > >> >
> >> > >> > somewhere here:
> >> > >> > [...]
> >> > >> > Starting file system checks:
> >> > >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 
> >> > >> > 946580 blocks, 0.0% fragmentation)
> >> > >> > Mounting local filesystems:.
> >> > >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> >> > >> > random: unblocking device.
> >> > >> >
> >> > >> > any idea ? (should I rebuild something?)
> >> > >> >
> >> > >> > thanks!
> >> > >> >
> >> > >> > Ruslan
> >> > >> >
> >> > >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> >> > >> >> Author: oshogbo
> >> > >> >> Date: Thu Sep 22 09:58:46 2016
> >> > >> >> New Revision: 306174
> >> > >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> >> > >> >>
> >> > >> >> Log:
> >> > >> >>   capsicum: propagate rights on accept(2)
> >> > >> >>
> >> > >> >>   Descriptor returned by accept(2) should inherits capabilities 
> >> > >> >> rights from
> >> > >> >>   the listening socket.
> >> > >> >>
> >> > >> >>   PR: 201052
> >> > >> >>   Reviewed by:emaste, jonathan
> >> > >> >>   Discussed with: many
> >> > >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> >> > >> >>
> >> > >> >> Modified:
> >> > >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> >> > >> >>   head/sys/compat/linux/linux_socket.c
> >> > >> >>   head/sys/kern/kern_sendfile.c
> >> > >> >>   head/sys/kern/uipc_syscalls.c
> >> > >> >>   head/sys/netinet/sctp_syscalls.c
> >> > >> >>   head/sys/sys/socketvar.h
> >> > >> >>
> >> > >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> >> > >> >> ==
> >> > >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 
> >> > >> >> 2016(r306173)
> >> > >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 
> >> > >> >> 2016(r306174)
> >> > >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> >> > >> >>   int error;
> >> > >> >>
> >> > >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> >> > >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> >> > >> >> NULL);
> >> > >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> >> > >> >> NULL, NULL);
> >> > >> >>   if (error != 0)
> >> > >> >>   return (error);
> >> > >> >>   so = fp->f_data;
> >> > >> >>
> >> > >> >> Modified: head/sys/compat/linux/linux_socket.c
> >> > >> >> ==
> >> > >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 
> >> > >> >> 2016(r306173)
> >> > >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 
> >> > >> >> 2016(r306174)
> >> > >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> >> > >> >>   if (error == EFAULT && namelen != sizeof(struct 
> >> > >> >> sockaddr_in))
> >> > >> >>  

svn commit: r306228 - head/sys/fs/cuse

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 07:41:23 2016
New Revision: 306228
URL: https://svnweb.freebsd.org/changeset/base/306228

Log:
  Prevent cuse4bsd.ko and cuse.ko from loading at the same time by
  declaring support for the cuse4bsd interface in cuse.ko.
  
  Found by: Sergey V. Dyatko 
  MFC after:1 week

Modified:
  head/sys/fs/cuse/cuse.c

Modified: head/sys/fs/cuse/cuse.c
==
--- head/sys/fs/cuse/cuse.c Fri Sep 23 07:06:39 2016(r306227)
+++ head/sys/fs/cuse/cuse.c Fri Sep 23 07:41:23 2016(r306228)
@@ -63,6 +63,12 @@
 
 MODULE_VERSION(cuse, 1);
 
+/*
+ * Prevent cuse4bsd.ko and cuse.ko from loading at the same time by
+ * declaring support for the cuse4bsd interface in cuse.ko:
+ */
+MODULE_VERSION(cuse4bsd, 1);
+
 #defineNBUSY   ((uint8_t *)1)
 
 #ifdef FEATURE
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306226 - head/sys/kern

2016-09-23 Thread Mateusz Guzik
Author: mjg
Date: Fri Sep 23 06:51:46 2016
New Revision: 306226
URL: https://svnweb.freebsd.org/changeset/base/306226

Log:
  fd: fix up fgetvp_rights after r306184
  
  fget_cap_locked returns a referenced file, but the fgetvp_rights does
  not need it. Instead, due to the filedesc lock being held, it can
  ref the vnode after the file was looked up.
  
  Fix up fget_cap_locked to be consistent with other _locked helpers and not
  ref the file.
  
  This plugs a leak introduced in r306184.
  
  Pointy hat to: mjg, oshogbo

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cFri Sep 23 04:53:47 2016
(r306225)
+++ head/sys/kern/kern_descrip.cFri Sep 23 06:51:46 2016
(r306226)
@@ -2469,7 +2469,6 @@ fget_cap_locked(struct filedesc *fdp, in
if (havecapsp != NULL)
filecaps_copy(>fde_caps, havecapsp, true);
 
-   fhold(fde->fde_file);
*fpp = fde->fde_file;
 
error = 0;
@@ -2511,6 +2510,8 @@ fget_cap(struct thread *td, int fd, cap_
 get_locked:
FILEDESC_SLOCK(fdp);
error = fget_cap_locked(fdp, fd, needrightsp, fpp, havecapsp);
+   if (error == 0)
+   fhold(*fpp);
FILEDESC_SUNLOCK(fdp);
 
return (error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"