svn commit: r305411 - head/sys/dev/hyperv/netvsc

2016-09-04 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep  5 05:07:40 2016
New Revision: 305411
URL: https://svnweb.freebsd.org/changeset/base/305411

Log:
  hyperv/hn: Stringent RNDIS control message length check.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7758

Modified:
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon Sep  5 04:56:56 
2016(r305410)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon Sep  5 05:07:40 
2016(r305411)
@@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
  * Forward declarations
  */
 static void hv_rf_receive_indicate_status(struct hn_softc *sc,
-const rndis_msg *response);
+const void *data, int dlen);
 static void hv_rf_receive_data(struct hn_rx_ring *rxr,
 const void *data, int dlen);
 static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr);
@@ -131,21 +131,29 @@ hv_set_rppi_data(rndis_msg *rndis_mesg, 
  * RNDIS filter receive indicate status
  */
 static void 
-hv_rf_receive_indicate_status(struct hn_softc *sc, const rndis_msg *response)
+hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen)
 {
-   const rndis_indicate_status *indicate = >msg.indicate_status;
-   
-   switch(indicate->status) {
+   const struct rndis_status_msg *msg;
+
+   if (dlen < sizeof(*msg)) {
+   if_printf(sc->hn_ifp, "invalid RNDIS status\n");
+   return;
+   }
+   msg = data;
+
+   switch (msg->rm_status) {
case RNDIS_STATUS_MEDIA_CONNECT:
netvsc_linkstatus_callback(sc, 1);
break;
+
case RNDIS_STATUS_MEDIA_DISCONNECT:
netvsc_linkstatus_callback(sc, 0);
break;
+
default:
/* TODO: */
-   if_printf(sc->hn_ifp,
-   "unknown status %d received\n", indicate->status);
+   if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n",
+   msg->rm_status);
break;
}
 }
@@ -283,34 +291,41 @@ hv_rf_receive_data(struct hn_rx_ring *rx
 /*
  * RNDIS filter on receive
  */
-int
+void
 hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr,
 const void *data, int dlen)
 {
-   const rndis_msg *rndis_hdr;
const struct rndis_comp_hdr *comp;
+   const struct rndis_msghdr *hdr;
+
+   if (__predict_false(dlen < sizeof(*hdr))) {
+   if_printf(rxr->hn_ifp, "invalid RNDIS msg\n");
+   return;
+   }
+   hdr = data;
 
-   rndis_hdr = data;
-   switch (rndis_hdr->ndis_msg_type) {
-   /* data message */
+   switch (hdr->rm_type) {
case REMOTE_NDIS_PACKET_MSG:
hv_rf_receive_data(rxr, data, dlen);
break;
 
-   /* completion messages */
case REMOTE_NDIS_INITIALIZE_CMPLT:
case REMOTE_NDIS_QUERY_CMPLT:
case REMOTE_NDIS_SET_CMPLT:
-   case REMOTE_NDIS_KEEPALIVE_CMPLT:
+   case REMOTE_NDIS_KEEPALIVE_CMPLT:   /* unused */
+   if (dlen < sizeof(*comp)) {
+   if_printf(rxr->hn_ifp, "invalid RNDIS cmplt\n");
+   return;
+   }
comp = data;
+
KASSERT(comp->rm_rid > HN_RNDIS_RID_COMPAT_MAX,
-   ("invalid rid 0x%08x\n", comp->rm_rid));
+   ("invalid RNDIS rid 0x%08x\n", comp->rm_rid));
vmbus_xact_ctx_wakeup(sc->hn_xact, comp, dlen);
break;
 
-   /* notification message */
case REMOTE_NDIS_INDICATE_STATUS_MSG:
-   hv_rf_receive_indicate_status(sc, rndis_hdr);
+   hv_rf_receive_indicate_status(sc, data, dlen);
break;
 
case REMOTE_NDIS_RESET_CMPLT:
@@ -321,15 +336,14 @@ hv_rf_on_receive(struct hn_softc *sc, st
 * RESET is not issued by hn(4), so this message should
 * _not_ be observed.
 */
-   if_printf(sc->hn_ifp, "RESET CMPLT received\n");
+   if_printf(rxr->hn_ifp, "RESET cmplt received\n");
break;
 
default:
-   if_printf(sc->hn_ifp, "unknown RNDIS message 0x%x\n",
-   rndis_hdr->ndis_msg_type);
+   if_printf(rxr->hn_ifp, "unknown RNDIS msg 0x%x\n",
+   hdr->rm_type);
break;
}
-   return (0);
 }
 
 /*

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.hMon Sep  5 04:56:56 
2016(r305410)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.hMon Sep  5 05:07:40 
2016 

svn commit: r305410 - head/sys/net

2016-09-04 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep  5 04:56:56 2016
New Revision: 305410
URL: https://svnweb.freebsd.org/changeset/base/305410

Log:
  net/rndis: Define RNDIS status message, which could be sent by device.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7757

Modified:
  head/sys/net/rndis.h

Modified: head/sys/net/rndis.h
==
--- head/sys/net/rndis.hMon Sep  5 04:49:58 2016(r305409)
+++ head/sys/net/rndis.hMon Sep  5 04:56:56 2016(r305410)
@@ -295,9 +295,28 @@ struct rndis_reset_comp {
uint32_t rm_adrreset;
 };
 
-/* 802.3 link-state or undefined message error. */
+/* 802.3 link-state or undefined message error.  Sent by device. */
 #defineREMOTE_NDIS_INDICATE_STATUS_MSG 0x0007
 
+struct rndis_status_msg {
+   uint32_t rm_type;
+   uint32_t rm_len;
+   uint32_t rm_status;
+   uint32_t rm_stbuflen;
+   uint32_t rm_stbufoffset;
+   /* rndis_diag_info */
+};
+
+/*
+ * Immediately after rndis_status_msg.rm_stbufoffset, if a control
+ * message is malformatted, or a packet message contains inappropriate
+ * content.
+ */
+struct rndis_diag_info {
+   uint32_t rm_diagstatus;
+   uint32_t rm_erroffset;
+};
+
 /* Keepalive messsage.  May be sent by device. */
 #defineREMOTE_NDIS_KEEPALIVE_MSG   0x0008
 #defineREMOTE_NDIS_KEEPALIVE_CMPLT 0x8008
___
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: r305409 - head/lib/libc/stdio

2016-09-04 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 04:49:58 2016
New Revision: 305409
URL: https://svnweb.freebsd.org/changeset/base/305409

Log:
  1) Prevent out of bounds access to ws[-1] (passed buffer) which happens
  when the first mb sequence is incomplete and there are not enougn chars in
  the read buffer. ws[-1] may lead to memory faults or false results, in
  case the memory here contains '\n'.
  
  2) Fix EOF checking I mess in my previos r305406 commit.
  
  MFC after:  3 days

Modified:
  head/lib/libc/stdio/fgetws.c

Modified: head/lib/libc/stdio/fgetws.c
==
--- head/lib/libc/stdio/fgetws.cMon Sep  5 04:47:31 2016
(r305408)
+++ head/lib/libc/stdio/fgetws.cMon Sep  5 04:49:58 2016
(r305409)
@@ -93,7 +93,7 @@ fgetws_l(wchar_t * __restrict ws, int n,
fp->_p = (unsigned char *)src;
n -= nconv;
wsp += nconv;
-   } while (wsp[-1] != L'\n' && n > 1 && (fp->_r > 0 ||
+   } while ((wsp == ws || wsp[-1] != L'\n') && n > 1 && (fp->_r > 0 ||
(sret = __srefill(fp)) == 0));
if (sret && !__sfeof(fp))
/* ferror */
@@ -104,7 +104,7 @@ fgetws_l(wchar_t * __restrict ws, int n,
errno = EILSEQ;
goto error;
}
-   if (sret)
+   if (wsp == ws)
/* EOF */
goto error;
*wsp = L'\0';
___
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: r305408 - head/sys/dev/hyperv/netvsc

2016-09-04 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep  5 04:47:31 2016
New Revision: 305408
URL: https://svnweb.freebsd.org/changeset/base/305408

Log:
  hyperv/hn: Stringent NVS RNDIS packets length checks.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7755

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep  5 03:39:04 2016
(r305407)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep  5 04:47:31 2016
(r305408)
@@ -742,32 +742,53 @@ hv_nv_on_receive(struct hn_softc *sc, st
 {
const struct vmbus_chanpkt_rxbuf *pkt;
const struct hn_nvs_hdr *nvs_hdr;
-   int count = 0;
-   int i = 0;
+   int count, i, hlen;
 
-   /* Make sure that this is a RNDIS message. */
+   if (__predict_false(VMBUS_CHANPKT_DATALEN(pkthdr) < sizeof(*nvs_hdr))) {
+   if_printf(rxr->hn_ifp, "invalid nvs RNDIS\n");
+   return;
+   }
nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr);
+
+   /* Make sure that this is a RNDIS message. */
if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) {
if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n",
nvs_hdr->nvs_type);
return;
}
-   
+
+   hlen = VMBUS_CHANPKT_GETLEN(pkthdr->cph_hlen);
+   if (__predict_false(hlen < sizeof(*pkt))) {
+   if_printf(rxr->hn_ifp, "invalid rxbuf chanpkt\n");
+   return;
+   }
pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr;
 
-   if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) {
-   if_printf(rxr->hn_ifp, "rxbuf_id %d is invalid!\n",
+   if (__predict_false(pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID)) {
+   if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n",
pkt->cp_rxbuf_id);
return;
}
 
count = pkt->cp_rxbuf_cnt;
+   if (__predict_false(hlen <
+   __offsetof(struct vmbus_chanpkt_rxbuf, cp_rxbuf[count]))) {
+   if_printf(rxr->hn_ifp, "invalid rxbuf_cnt %d\n", count);
+   return;
+   }
 
/* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */
-   for (i = 0; i < count; i++) {
-   hv_rf_on_receive(sc, rxr,
-   rxr->hn_rxbuf + pkt->cp_rxbuf[i].rb_ofs,
-   pkt->cp_rxbuf[i].rb_len);
+   for (i = 0; i < count; ++i) {
+   int ofs, len;
+
+   ofs = pkt->cp_rxbuf[i].rb_ofs;
+   len = pkt->cp_rxbuf[i].rb_len;
+   if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) {
+   if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, "
+   "ofs %d, len %d\n", i, ofs, len);
+   continue;
+   }
+   hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len);
}

/*
___
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: r305407 - head/sys/dev/hyperv/netvsc

2016-09-04 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep  5 03:39:04 2016
New Revision: 305407
URL: https://svnweb.freebsd.org/changeset/base/305407

Log:
  hyperv/hn: Stringent NVS notification length check.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7753

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep  5 03:37:28 2016
(r305406)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Sep  5 03:39:04 2016
(r305407)
@@ -816,7 +816,12 @@ hn_proc_notify(struct hn_softc *sc, cons
 {
const struct hn_nvs_hdr *hdr;
 
+   if (VMBUS_CHANPKT_DATALEN(pkt) < sizeof(*hdr)) {
+   if_printf(sc->hn_ifp, "invalid nvs notify\n");
+   return;
+   }
hdr = VMBUS_CHANPKT_CONST_DATA(pkt);
+
if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) {
/* Useless; ignore */
return;
___
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: r305406 - head/lib/libc/stdio

2016-09-04 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 03:37:28 2016
New Revision: 305406
URL: https://svnweb.freebsd.org/changeset/base/305406

Log:
  Fix errors handling.
  
  MFC after:  3 days

Modified:
  head/lib/libc/stdio/fgetws.c

Modified: head/lib/libc/stdio/fgetws.c
==
--- head/lib/libc/stdio/fgetws.cMon Sep  5 03:21:31 2016
(r305405)
+++ head/lib/libc/stdio/fgetws.cMon Sep  5 03:37:28 2016
(r305406)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 wchar_t *
 fgetws_l(wchar_t * __restrict ws, int n, FILE * __restrict fp, locale_t locale)
 {
+   int sret;
wchar_t *wsp;
size_t nconv;
const char *src;
@@ -56,23 +57,27 @@ fgetws_l(wchar_t * __restrict ws, int n,
ORIENT(fp, 1);
 
if (n <= 0) {
+   fp->_flags |= __SERR;
errno = EINVAL;
goto error;
}
 
if (fp->_r <= 0 && __srefill(fp))
-   /* EOF */
+   /* EOF or ferror */
goto error;
wsp = ws;
+   sret = 0;
do {
src = fp->_p;
nl = memchr(fp->_p, '\n', fp->_r);
nconv = l->__mbsnrtowcs(wsp, ,
nl != NULL ? (nl - fp->_p + 1) : fp->_r,
n - 1, >_mbstate);
-   if (nconv == (size_t)-1)
+   if (nconv == (size_t)-1) {
/* Conversion error */
+   fp->_flags |= __SERR;
goto error;
+   }
if (src == NULL) {
/*
 * We hit a null byte. Increment the character count,
@@ -89,12 +94,18 @@ fgetws_l(wchar_t * __restrict ws, int n,
n -= nconv;
wsp += nconv;
} while (wsp[-1] != L'\n' && n > 1 && (fp->_r > 0 ||
-   __srefill(fp) == 0));
-   if (wsp == ws)
-   /* EOF */
+   (sret = __srefill(fp)) == 0));
+   if (sret && !__sfeof(fp))
+   /* ferror */
goto error;
-   if (!l->__mbsinit(>_mbstate))
+   if (!l->__mbsinit(>_mbstate)) {
/* Incomplete character */
+   fp->_flags |= __SERR;
+   errno = EILSEQ;
+   goto error;
+   }
+   if (sret)
+   /* EOF */
goto error;
*wsp = L'\0';
FUNLOCKFILE(fp);
@@ -105,6 +116,7 @@ error:
FUNLOCKFILE(fp);
return (NULL);
 }
+
 wchar_t *
 fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
 {
___
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: r305405 - head/sys/dev/hyperv/vmbus

2016-09-04 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep  5 03:21:31 2016
New Revision: 305405
URL: https://svnweb.freebsd.org/changeset/base/305405

Log:
  hyperv/vmbus: Stringent header length and total length check.
  
  While I'm here, minor style changes.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7752

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_chan.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c  Mon Sep  5 02:00:35 2016
(r305404)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c  Mon Sep  5 03:21:31 2016
(r305405)
@@ -721,7 +721,20 @@ vmbus_chan_recv(struct vmbus_channel *ch
 
error = vmbus_rxbr_peek(>ch_rxbr, , sizeof(pkt));
if (error)
-   return error;
+   return (error);
+
+   if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) {
+   device_printf(chan->ch_dev, "invalid hlen %u\n",
+   pkt.cph_hlen);
+   /* XXX this channel is dead actually. */
+   return (EIO);
+   }
+   if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) {
+   device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n",
+   pkt.cph_hlen, pkt.cph_tlen);
+   /* XXX this channel is dead actually. */
+   return (EIO);
+   }
 
hlen = VMBUS_CHANPKT_GETLEN(pkt.cph_hlen);
dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen;
@@ -729,7 +742,7 @@ vmbus_chan_recv(struct vmbus_channel *ch
if (*dlen0 < dlen) {
/* Return the size of this packet's data. */
*dlen0 = dlen;
-   return ENOBUFS;
+   return (ENOBUFS);
}
 
*xactid = pkt.cph_xactid;
@@ -739,7 +752,7 @@ vmbus_chan_recv(struct vmbus_channel *ch
error = vmbus_rxbr_read(>ch_rxbr, data, dlen, hlen);
KASSERT(!error, ("vmbus_rxbr_read failed"));
 
-   return 0;
+   return (0);
 }
 
 int
@@ -751,13 +764,26 @@ vmbus_chan_recv_pkt(struct vmbus_channel
 
error = vmbus_rxbr_peek(>ch_rxbr, , sizeof(pkt));
if (error)
-   return error;
+   return (error);
+
+   if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) {
+   device_printf(chan->ch_dev, "invalid hlen %u\n",
+   pkt.cph_hlen);
+   /* XXX this channel is dead actually. */
+   return (EIO);
+   }
+   if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) {
+   device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n",
+   pkt.cph_hlen, pkt.cph_tlen);
+   /* XXX this channel is dead actually. */
+   return (EIO);
+   }
 
pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen);
if (*pktlen0 < pktlen) {
/* Return the size of this packet. */
*pktlen0 = pktlen;
-   return ENOBUFS;
+   return (ENOBUFS);
}
*pktlen0 = pktlen;
 
@@ -765,7 +791,7 @@ vmbus_chan_recv_pkt(struct vmbus_channel
error = vmbus_rxbr_read(>ch_rxbr, pkt0, pktlen, 0);
KASSERT(!error, ("vmbus_rxbr_read failed"));
 
-   return 0;
+   return (0);
 }
 
 static void

Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_reg.h   Mon Sep  5 02:00:35 2016
(r305404)
+++ head/sys/dev/hyperv/vmbus/vmbus_reg.h   Mon Sep  5 03:21:31 2016
(r305405)
@@ -153,6 +153,9 @@ do {
\
 #define VMBUS_CHANPKT_TOTLEN(tlen) \
roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN)
 
+#define VMBUS_CHANPKT_HLEN_MIN \
+   (sizeof(struct vmbus_chanpkt_hdr) >> VMBUS_CHANPKT_SIZE_SHIFT)
+
 struct vmbus_chanpkt {
struct vmbus_chanpkt_hdr cp_hdr;
 } __packed;
___
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: r305358 - in head: bin/cat/tests contrib/netbsd-tests contrib/netbsd-tests/bin/cat contrib/netbsd-tests/bin/sh contrib/netbsd-tests/bin/sh/dotcmd contrib/netbsd-tests/crypto/opencrypto

2016-09-04 Thread Ngie Cooper

> On Sep 4, 2016, at 19:24, Craig Rodrigues  wrote:
> 
> Hi,
> 
> The tests in libc are broken after this commit.
> lib/libc/test/db/Makefile defines "PROGS = h_lfsr"
> but the test is trying to execute a binary "h_db"
> which no longer exists.
> 
> Can you fix this?
> 
> Thanks.

There's also the lib/libc/rpc tests that assume that rpcbind is up and running. 
I ran into this on some of my systems that didn't run rpcbind -- I was hoping 
it had been started with the bhyve slaves but that doesn't seem to be the case.

Thanks for the note.. I'll probably get to it tomorrow.

Cheers!
-Ngie

> 
> 
>> On Sat, Sep 3, 2016 at 11:11 AM, Ngie Cooper  wrote:
>> Author: ngie
>> Date: Sat Sep  3 18:11:48 2016
>> New Revision: 305358
>> URL: https://svnweb.freebsd.org/changeset/base/305358
>> 
>> Log:
>>   Update contrib/netbsd-tests with new content from NetBSD
>> 
>>   This updates the snapshot from 09/30/2014 to 08/11/2016
>> 
>>   This brings in a number of new testcases from upstream, most
>>   notably:
>> 
>>   - bin/cat
>>   - lib/libc
>>   - lib/msun
>>   - lib/libthr
>>   - usr.bin/sort
>> 
>>   lib/libc/tests/stdio/open_memstream_test.c was moved to
>>   lib/libc/tests/stdio/open_memstream2_test.c to accomodate
>>   the new open_memstream test from NetBSD.
>> 
>>   MFC after:2 months
>>   Tested on:amd64 (VMware fusion VM; various bare metal platforms); i386 
>> (VMware fusion VM); make tinderbox
>>   Sponsored by: EMC / Isilon Storage Division
>> 
>> Added:
>>   head/contrib/netbsd-tests/bin/cat/d_se_output.in
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/d_se_output.in
>>   head/contrib/netbsd-tests/bin/cat/d_se_output.out
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/d_se_output.out
>>   head/contrib/netbsd-tests/bin/sh/t_arith.sh
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_arith.sh
>>   head/contrib/netbsd-tests/bin/sh/t_cmdsub.sh
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_cmdsub.sh
>>   head/contrib/netbsd-tests/bin/sh/t_option.sh
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_option.sh
>>   head/contrib/netbsd-tests/bin/sh/t_redir.sh
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_redir.sh
>>   head/contrib/netbsd-tests/bin/sh/t_redircloexec.sh
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_redircloexec.sh
>>   head/contrib/netbsd-tests/bin/sh/t_shift.sh
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_shift.sh
>>   head/contrib/netbsd-tests/bin/sh/t_varval.sh
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_varval.sh
>>   head/contrib/netbsd-tests/dev/fss/
>>  - copied from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/dev/fss/
>>   head/contrib/netbsd-tests/dev/usb/
>>  - copied from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/dev/usb/
>>   head/contrib/netbsd-tests/include/sys/t_pslist.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/include/sys/t_pslist.c
>>   head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
>>   head/contrib/netbsd-tests/lib/libc/db/h_lfsr.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/db/h_lfsr.c
>>   head/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c
>>   head/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c
>>   head/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c
>>   head/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c
>>   head/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc
>>   head/contrib/netbsd-tests/lib/libc/sys/t_bind.c
>>  - copied unchanged from r305318, 
>> projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/sys/t_bind.c
>>   

Re: svn commit: r305358 - in head: bin/cat/tests contrib/netbsd-tests contrib/netbsd-tests/bin/cat contrib/netbsd-tests/bin/sh contrib/netbsd-tests/bin/sh/dotcmd contrib/netbsd-tests/crypto/opencrypto

2016-09-04 Thread Craig Rodrigues
Hi,

The tests in libc are broken after this commit.
lib/libc/test/db/Makefile defines "PROGS = h_lfsr"
but the test is trying to execute a binary "h_db"
which no longer exists.

Can you fix this?

Thanks.
--
Craig



On Sat, Sep 3, 2016 at 11:11 AM, Ngie Cooper  wrote:

> Author: ngie
> Date: Sat Sep  3 18:11:48 2016
> New Revision: 305358
> URL: https://svnweb.freebsd.org/changeset/base/305358
>
> Log:
>   Update contrib/netbsd-tests with new content from NetBSD
>
>   This updates the snapshot from 09/30/2014 to 08/11/2016
>
>   This brings in a number of new testcases from upstream, most
>   notably:
>
>   - bin/cat
>   - lib/libc
>   - lib/msun
>   - lib/libthr
>   - usr.bin/sort
>
>   lib/libc/tests/stdio/open_memstream_test.c was moved to
>   lib/libc/tests/stdio/open_memstream2_test.c to accomodate
>   the new open_memstream test from NetBSD.
>
>   MFC after:2 months
>   Tested on:amd64 (VMware fusion VM; various bare metal platforms);
> i386 (VMware fusion VM); make tinderbox
>   Sponsored by: EMC / Isilon Storage Division
>
> Added:
>   head/contrib/netbsd-tests/bin/cat/d_se_output.in
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/cat/d_se_output.in
>   head/contrib/netbsd-tests/bin/cat/d_se_output.out
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/cat/d_se_output.out
>   head/contrib/netbsd-tests/bin/sh/t_arith.sh
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/sh/t_arith.sh
>   head/contrib/netbsd-tests/bin/sh/t_cmdsub.sh
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/sh/t_cmdsub.sh
>   head/contrib/netbsd-tests/bin/sh/t_option.sh
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/sh/t_option.sh
>   head/contrib/netbsd-tests/bin/sh/t_redir.sh
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/sh/t_redir.sh
>   head/contrib/netbsd-tests/bin/sh/t_redircloexec.sh
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/sh/t_redircloexec.sh
>   head/contrib/netbsd-tests/bin/sh/t_shift.sh
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/sh/t_shift.sh
>   head/contrib/netbsd-tests/bin/sh/t_varval.sh
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/bin/sh/t_varval.sh
>   head/contrib/netbsd-tests/dev/fss/
>  - copied from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/dev/fss/
>   head/contrib/netbsd-tests/dev/usb/
>  - copied from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/dev/usb/
>   head/contrib/netbsd-tests/include/sys/t_pslist.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/include/sys/t_pslist.c
>   head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
>   head/contrib/netbsd-tests/lib/libc/db/h_lfsr.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/db/h_lfsr.c
>   head/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c
>   head/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c
>   head/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c
>   head/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c
>   head/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc
>   head/contrib/netbsd-tests/lib/libc/sys/t_bind.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/sys/t_bind.c
>   head/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c
>   head/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 12/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c
>   head/contrib/netbsd-tests/lib/libc/sys/t_wait.c
>  - copied unchanged from r305318, projects/netbsd-tests-update-
> 

svn commit: r305404 - stable/11/lib/libc/stdio

2016-09-04 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 02:00:35 2016
New Revision: 305404
URL: https://svnweb.freebsd.org/changeset/base/305404

Log:
  MFC r305241
  
  fgetwc(3) may set both __SEOF and __SERR at once (in case of incomplete
  sequence near EOF), so we can't just check for
  (wc == WEOF && !__sfeof(fp)) and must relay on __sferror(fp) with
  __SERR clearing/restoring.

Modified:
  stable/11/lib/libc/stdio/fgetwln.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/stdio/fgetwln.c
==
--- stable/11/lib/libc/stdio/fgetwln.c  Mon Sep  5 01:57:32 2016
(r305403)
+++ stable/11/lib/libc/stdio/fgetwln.c  Mon Sep  5 02:00:35 2016
(r305404)
@@ -47,11 +47,16 @@ fgetwln_l(FILE * __restrict fp, size_t *
 {
wint_t wc;
size_t len;
+   int savserr;
+
FIX_LOCALE(locale);
 
FLOCKFILE(fp);
ORIENT(fp, 1);
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
len = 0;
while ((wc = __fgetwc(fp, locale)) != WEOF) {
 #defineGROW512
@@ -64,7 +69,12 @@ fgetwln_l(FILE * __restrict fp, size_t *
if (wc == L'\n')
break;
}
-   if (len == 0 || (wc == WEOF && !__sfeof(fp)))
+   /* fgetwc(3) may set both __SEOF and __SERR at once. */
+   if (__sferror(fp))
+   goto error;
+
+   fp->_flags |= savserr;
+   if (len == 0)
goto error;
 
FUNLOCKFILE(fp);
___
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: r305403 - stable/10/lib/libc/stdio

2016-09-04 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 01:57:32 2016
New Revision: 305403
URL: https://svnweb.freebsd.org/changeset/base/305403

Log:
  MFC r305241
  
  fgetwc(3) may set both __SEOF and __SERR at once (in case of incomplete
  sequence near EOF), so we can't just check for
  (wc == WEOF && !__sfeof(fp)) and must relay on __sferror(fp) with
  __SERR clearing/restoring.

Modified:
  stable/10/lib/libc/stdio/fgetwln.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/stdio/fgetwln.c
==
--- stable/10/lib/libc/stdio/fgetwln.c  Mon Sep  5 00:41:17 2016
(r305402)
+++ stable/10/lib/libc/stdio/fgetwln.c  Mon Sep  5 01:57:32 2016
(r305403)
@@ -47,11 +47,16 @@ fgetwln_l(FILE * __restrict fp, size_t *
 {
wint_t wc;
size_t len;
+   int savserr;
+
FIX_LOCALE(locale);
 
FLOCKFILE(fp);
ORIENT(fp, 1);
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
len = 0;
while ((wc = __fgetwc(fp, locale)) != WEOF) {
 #defineGROW512
@@ -64,7 +69,12 @@ fgetwln_l(FILE * __restrict fp, size_t *
if (wc == L'\n')
break;
}
-   if (len == 0 || (wc == WEOF && !__sfeof(fp)))
+   /* fgetwc(3) may set both __SEOF and __SERR at once. */
+   if (__sferror(fp))
+   goto error;
+
+   fp->_flags |= savserr;
+   if (len == 0)
goto error;
 
FUNLOCKFILE(fp);
___
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: r305402 - stable/11/lib/libc/net

2016-09-04 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 00:41:17 2016
New Revision: 305402
URL: https://svnweb.freebsd.org/changeset/base/305402

Log:
  MFC r305144
  
  'addrlen' does not matter when we need to find the first non-zero bit in
  the byte from the left and 'addrlen' already counted in 'lim'.
  
  PR: 212121
  Submitted by:   herbie.robin...@stratus.com

Modified:
  stable/11/lib/libc/net/getaddrinfo.c
  stable/11/lib/libc/net/name6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/net/getaddrinfo.c
==
--- stable/11/lib/libc/net/getaddrinfo.cMon Sep  5 00:36:52 2016
(r305401)
+++ stable/11/lib/libc/net/getaddrinfo.cMon Sep  5 00:41:17 2016
(r305402)
@@ -949,7 +949,7 @@ matchlen(struct sockaddr *src, struct so
 
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
-   while (r < addrlen * 8) {
+   while ((r & 0x80) == 0) {
match++;
r <<= 1;
}

Modified: stable/11/lib/libc/net/name6.c
==
--- stable/11/lib/libc/net/name6.c  Mon Sep  5 00:36:52 2016
(r305401)
+++ stable/11/lib/libc/net/name6.c  Mon Sep  5 00:41:17 2016
(r305402)
@@ -930,7 +930,7 @@ matchlen(struct sockaddr *src, struct so
 
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
-   while (r < addrlen * 8) {
+   while ((r & 0x80) == 0) {
match++;
r <<= 1;
}
___
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: r305401 - stable/10/lib/libc/net

2016-09-04 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 00:36:52 2016
New Revision: 305401
URL: https://svnweb.freebsd.org/changeset/base/305401

Log:
  MFC r305144
  
  'addrlen' does not matter when we need to find the first non-zero bit in
  the byte from the left and 'addrlen' already counted in 'lim'.
  
  PR: 212121
  Submitted by:   herbie.robin...@stratus.com

Modified:
  stable/10/lib/libc/net/getaddrinfo.c
  stable/10/lib/libc/net/name6.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/net/getaddrinfo.c
==
--- stable/10/lib/libc/net/getaddrinfo.cSun Sep  4 22:55:05 2016
(r305400)
+++ stable/10/lib/libc/net/getaddrinfo.cMon Sep  5 00:36:52 2016
(r305401)
@@ -931,7 +931,7 @@ matchlen(struct sockaddr *src, struct so
 
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
-   while (r < addrlen * 8) {
+   while ((r & 0x80) == 0) {
match++;
r <<= 1;
}

Modified: stable/10/lib/libc/net/name6.c
==
--- stable/10/lib/libc/net/name6.c  Sun Sep  4 22:55:05 2016
(r305400)
+++ stable/10/lib/libc/net/name6.c  Mon Sep  5 00:36:52 2016
(r305401)
@@ -930,7 +930,7 @@ matchlen(struct sockaddr *src, struct so
 
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
-   while (r < addrlen * 8) {
+   while ((r & 0x80) == 0) {
match++;
r <<= 1;
}
___
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: r305399 - head/sys/boot/fdt/dts/arm64

2016-09-04 Thread Jared McNeill
Author: jmcneill
Date: Sun Sep  4 22:30:46 2016
New Revision: 305399
URL: https://svnweb.freebsd.org/changeset/base/305399

Log:
  A64 thermal sensor IRQ is GIC_SPI 31, not 41.

Modified:
  head/sys/boot/fdt/dts/arm64/a64.dtsi

Modified: head/sys/boot/fdt/dts/arm64/a64.dtsi
==
--- head/sys/boot/fdt/dts/arm64/a64.dtsiSun Sep  4 22:08:04 2016
(r305398)
+++ head/sys/boot/fdt/dts/arm64/a64.dtsiSun Sep  4 22:30:46 2016
(r305399)
@@ -110,7 +110,7 @@
rtp: rtp@01c25000 {
compatible = "allwinner,sun50i-a64-ts";
reg = <0x01c25000 0x400>;
-   interrupts = ;
+   interrupts = ;
clocks = <_gates 72>, <_clk>;
clock-names = "ahb", "ths";
resets = <_rst 136>;
___
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: r305398 - head/sys/sparc64/sparc64

2016-09-04 Thread Alan Cox
Author: alc
Date: Sun Sep  4 22:08:04 2016
New Revision: 305398
URL: https://svnweb.freebsd.org/changeset/base/305398

Log:
  Replace the number 4 in pmap_ts_referenced() by PMAP_TS_REFERENCED_MAX,
  like we've done elsewhere, e.g., amd64.
  
  As an optimization to the machine-independent layer, change the machine-
  dependent pmap_ts_referenced() so that it updates the page's dirty field
  if a modified bit is found while counting reference bits.  This
  opportunistic update can be performed at low cost and can eliminate the
  need for some future calls to pmap_is_modified() by the machine-
  independent layer.
  
  MFC after:3 weeks

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

Modified: head/sys/sparc64/sparc64/pmap.c
==
--- head/sys/sparc64/sparc64/pmap.c Sun Sep  4 21:54:24 2016
(r305397)
+++ head/sys/sparc64/sparc64/pmap.c Sun Sep  4 22:08:04 2016
(r305398)
@@ -2073,6 +2073,8 @@ pmap_page_is_mapped(vm_page_t m)
return (rv);
 }
 
+#definePMAP_TS_REFERENCED_MAX  5
+
 /*
  * Return a count of reference bits for a page, clearing those bits.
  * It is not necessary for every reference bit to be cleared, but it
@@ -2082,6 +2084,14 @@ pmap_page_is_mapped(vm_page_t m)
  * XXX: The exact number of bits to check and clear is a matter that
  * should be tested and standardized at some point in the future for
  * optimal aging of shared pages.
+ *
+ * As an optimization, update the page's dirty field if a modified bit is
+ * found while counting reference bits.  This opportunistic update can be
+ * performed at low cost and can eliminate the need for some future calls
+ * to pmap_is_modified().  However, since this function stops after
+ * finding PMAP_TS_REFERENCED_MAX reference bits, it may not detect some
+ * dirty pages.  Those dirty pages will only be detected by a future call
+ * to pmap_is_modified().
  */
 int
 pmap_ts_referenced(vm_page_t m)
@@ -2105,7 +2115,10 @@ pmap_ts_referenced(vm_page_t m)
if ((tp->tte_data & TD_PV) == 0)
continue;
data = atomic_clear_long(>tte_data, TD_REF);
-   if ((data & TD_REF) != 0 && ++count > 4)
+   if ((data & TD_W) != 0)
+   vm_page_dirty(m);
+   if ((data & TD_REF) != 0 && ++count >=
+   PMAP_TS_REFERENCED_MAX)
break;
} while ((tp = tpn) != NULL && tp != tpf);
}
___
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: r305396 - head/contrib/libcxxrt

2016-09-04 Thread Dimitry Andric
Author: dim
Date: Sun Sep  4 21:48:58 2016
New Revision: 305396
URL: https://svnweb.freebsd.org/changeset/base/305396

Log:
  Add _US_ACTION_MASK to libcxxrt's arm-specific unwind header.  This
  value is used in newer versions of compiler-rt.
  
  MFC after:3 days

Modified:
  head/contrib/libcxxrt/unwind-arm.h

Modified: head/contrib/libcxxrt/unwind-arm.h
==
--- head/contrib/libcxxrt/unwind-arm.h  Sun Sep  4 20:55:27 2016
(r305395)
+++ head/contrib/libcxxrt/unwind-arm.h  Sun Sep  4 21:48:58 2016
(r305396)
@@ -28,7 +28,7 @@
 {
_URC_OK = 0,/* operation completed successfully */
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
-_URC_END_OF_STACK = 5,
+   _URC_END_OF_STACK = 5,
_URC_HANDLER_FOUND = 6,
_URC_INSTALL_CONTEXT = 7,
_URC_CONTINUE_UNWIND = 8,
@@ -43,10 +43,12 @@ typedef uint32_t _Unwind_State;
 static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME  = 0;
 static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1;
 static const _Unwind_State _US_UNWIND_FRAME_RESUME   = 2;
+static const _Unwind_State _US_ACTION_MASK   = 3;
 #else // GCC fails at knowing what a constant expression is
 #  define _US_VIRTUAL_UNWIND_FRAME  0
 #  define _US_UNWIND_FRAME_STARTING 1
-#  define _US_UNWIND_FRAME_RESUME 2
+#  define _US_UNWIND_FRAME_RESUME   2
+#  define _US_ACTION_MASK   3
 #endif
 
 typedef struct _Unwind_Context _Unwind_Context;
___
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: r305392 - head/sys/conf

2016-09-04 Thread Conrad Meyer
Hm, the GCC 5.3 manual page mentions at least -Wshift-count-negative,
-Wshift-count-overflow, and -Wcast-qual.

Best,
Conrad

On Sun, Sep 4, 2016 at 1:36 PM, Dimitry Andric  wrote:
> Not in this particular case, as the section is exclusively meant for
> clang.  Most of these warning options are completely different from
> gcc's.  The gcc related section is just below this part in kern.mk.
>
> -Dimitry
>
>> On 04 Sep 2016, at 22:03, Conrad Meyer  wrote:
>>
>> Assuming we'd like to enable building with both compilers for now,
>> isn't it better to use a form both accept?
>>
>> Best,
>> Conrad
>>
>> On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric  wrote:
>>> On 04 Sep 2016, at 20:57, Conrad Meyer  wrote:

 On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric  wrote:
> Author: dim
> Date: Sun Sep  4 17:55:22 2016
> New Revision: 305392
> URL: https://svnweb.freebsd.org/changeset/base/305392
>
> Log:
> For kernel builds, instead of suppressing certain clang warnings, make
> them non-fatal, so there is some incentive to fix them eventually.
>
> Modified:
> head/sys/conf/kern.mk
>
> Modified: head/sys/conf/kern.mk
> ==
> --- head/sys/conf/kern.mk   Sun Sep  4 17:50:23 2016(r305391)
> +++ head/sys/conf/kern.mk   Sun Sep  4 17:55:22 2016(r305392)
> @@ -17,13 +17,13 @@ CWARNFLAGS?=-Wall -Wredundant-decls -Wn
> # kernel where fixing them is more trouble than it is worth, or where 
> there is
> # a false positive.
> .if ${COMPILER_TYPE} == "clang"
> -NO_WCONSTANT_CONVERSION=   -Wno-constant-conversion
> -NO_WSHIFT_COUNT_NEGATIVE=  -Wno-shift-count-negative
> -NO_WSHIFT_COUNT_OVERFLOW=  -Wno-shift-count-overflow
> -NO_WSELF_ASSIGN=   -Wno-self-assign
> -NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
> +NO_WCONSTANT_CONVERSION=   -Wno-error-constant-conversion
> +NO_WSHIFT_COUNT_NEGATIVE=  -Wno-error-shift-count-negative
> +NO_WSHIFT_COUNT_OVERFLOW=  -Wno-error-shift-count-overflow
> +NO_WSELF_ASSIGN=   -Wno-error-self-assign
> +NO_WUNNEEDED_INTERNAL_DECL=-Wno-error-unneeded-internal-declaration
> NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
> -NO_WCAST_QUAL= -Wno-cast-qual
> +NO_WCAST_QUAL= -Wno-error-cast-qual

 I like goal of the change.  Shouldn't these be -Wno-error=cast-qual,
 etc., though?
>>>
>>> That's how gcc spells them.  Clang accepts both forms, there is no
>>> functional difference.
>>>
>>> -Dimitry
>>>
>
___
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: r305395 - in head: lib/libifconfig share/examples/libifconfig

2016-09-04 Thread Kristof Provost
Author: kp
Date: Sun Sep  4 20:55:27 2016
New Revision: 305395
URL: https://svnweb.freebsd.org/changeset/base/305395

Log:
  libifconfig: style(9) fixes
  
  Also switch from BSD 3-clause to 2-clause license where possible, and
  consolidate duplicate 3-clause license into one.
  
  Submitted by: Marie Helene Kvello-Aune 
  Reviewed by:  cem, kp
  Differential Revision:https://reviews.freebsd.org/D7764

Modified:
  head/lib/libifconfig/libifconfig.c
  head/lib/libifconfig/libifconfig.h
  head/lib/libifconfig/libifconfig_internal.c
  head/lib/libifconfig/libifconfig_internal.h
  head/share/examples/libifconfig/ifcreate.c
  head/share/examples/libifconfig/ifdestroy.c
  head/share/examples/libifconfig/setdescription.c
  head/share/examples/libifconfig/setmtu.c

Modified: head/lib/libifconfig/libifconfig.c
==
--- head/lib/libifconfig/libifconfig.c  Sun Sep  4 18:00:14 2016
(r305394)
+++ head/lib/libifconfig/libifconfig.c  Sun Sep  4 20:55:27 2016
(r305395)
@@ -57,6 +57,8 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * $FreeBSD$
  */
 
 #include 
@@ -80,19 +82,17 @@ ifconfig_open(void)
 {
struct ifconfig_handle *h;
 
-   h = calloc(1, sizeof(struct ifconfig_handle));
-
+   h = calloc(1, sizeof(*h));
for (int i = 0; i <= AF_MAX; i++) {
h->sockets[i] = -1;
}
-
return (h);
 }
 
-
 void
 ifconfig_close(ifconfig_handle_t *h)
 {
+
for (int i = 0; i <= AF_MAX; i++) {
if (h->sockets[i] != -1) {
(void)close(h->sockets[i]);
@@ -101,37 +101,40 @@ ifconfig_close(ifconfig_handle_t *h)
free(h);
 }
 
-
 ifconfig_errtype
 ifconfig_err_errtype(ifconfig_handle_t *h)
 {
+
return (h->error.errtype);
 }
 
-
 int
 ifconfig_err_errno(ifconfig_handle_t *h)
 {
+
return (h->error.errcode);
 }
 
-
 unsigned long
 ifconfig_err_ioctlreq(ifconfig_handle_t *h)
 {
+
return (h->error.ioctl_request);
 }
 
-
 int
-ifconfig_get_description(ifconfig_handle_t *h, const char *name, char 
**description)
+ifconfig_get_description(ifconfig_handle_t *h, const char *name,
+char **description)
 {
struct ifreq ifr;
-   char *descr = NULL;
-   size_t descrlen = 64;
+   char *descr;
+   size_t descrlen;
 
-   memset(, 0, sizeof(struct ifreq));
+   descr = NULL;
+   descrlen = 64;
+   memset(, 0, sizeof(ifr));
(void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+
for (;;) {
if ((descr = reallocf(descr, descrlen)) == NULL) {
h->error.errtype = OTHER;
@@ -141,8 +144,7 @@ ifconfig_get_description(ifconfig_handle
 
ifr.ifr_buffer.buffer = descr;
ifr.ifr_buffer.length = descrlen;
-   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR,
-   ) != 0) {
+   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, ) != 0) {
return (-1);
}
 
@@ -164,7 +166,6 @@ ifconfig_get_description(ifconfig_handle
return (-1);
 }
 
-
 int
 ifconfig_set_description(ifconfig_handle_t *h, const char *name,
 const char *newdescription)
@@ -172,7 +173,7 @@ ifconfig_set_description(ifconfig_handle
struct ifreq ifr;
int desclen;
 
-   memset(, 0, sizeof(struct ifreq));
+   memset(, 0, sizeof(ifr));
desclen = strlen(newdescription);
 
/*
@@ -184,46 +185,49 @@ ifconfig_set_description(ifconfig_handle
}
 
(void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
-
ifr.ifr_buffer.length = desclen + 1;
ifr.ifr_buffer.buffer = strdup(newdescription);
+
if (ifr.ifr_buffer.buffer == NULL) {
h->error.errtype = OTHER;
h->error.errcode = ENOMEM;
return (-1);
}
 
-   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, ) != 0) {
+   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR,
+   ) != 0) {
free(ifr.ifr_buffer.buffer);
return (-1);
}
+
free(ifr.ifr_buffer.buffer);
return (0);
 }
 
-
-int ifconfig_unset_description(ifconfig_handle_t *h, const char *name)
+int
+ifconfig_unset_description(ifconfig_handle_t *h, const char *name)
 {
struct ifreq ifr;
 
-   memset(, 0, sizeof(struct ifreq));
+   memset(, 0, sizeof(ifr));
(void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_buffer.length = 0;
ifr.ifr_buffer.buffer = NULL;
 
-   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, ) < 0) {
+   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR,
+   ) < 0) {
return (-1);
}
return (0);
 }
 
-
-int 

Re: svn commit: r305392 - head/sys/conf

2016-09-04 Thread Dimitry Andric
Not in this particular case, as the section is exclusively meant for
clang.  Most of these warning options are completely different from
gcc's.  The gcc related section is just below this part in kern.mk.

-Dimitry

> On 04 Sep 2016, at 22:03, Conrad Meyer  wrote:
> 
> Assuming we'd like to enable building with both compilers for now,
> isn't it better to use a form both accept?
> 
> Best,
> Conrad
> 
> On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric  wrote:
>> On 04 Sep 2016, at 20:57, Conrad Meyer  wrote:
>>> 
>>> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric  wrote:
 Author: dim
 Date: Sun Sep  4 17:55:22 2016
 New Revision: 305392
 URL: https://svnweb.freebsd.org/changeset/base/305392
 
 Log:
 For kernel builds, instead of suppressing certain clang warnings, make
 them non-fatal, so there is some incentive to fix them eventually.
 
 Modified:
 head/sys/conf/kern.mk
 
 Modified: head/sys/conf/kern.mk
 ==
 --- head/sys/conf/kern.mk   Sun Sep  4 17:50:23 2016(r305391)
 +++ head/sys/conf/kern.mk   Sun Sep  4 17:55:22 2016(r305392)
 @@ -17,13 +17,13 @@ CWARNFLAGS?=-Wall -Wredundant-decls -Wn
 # kernel where fixing them is more trouble than it is worth, or where 
 there is
 # a false positive.
 .if ${COMPILER_TYPE} == "clang"
 -NO_WCONSTANT_CONVERSION=   -Wno-constant-conversion
 -NO_WSHIFT_COUNT_NEGATIVE=  -Wno-shift-count-negative
 -NO_WSHIFT_COUNT_OVERFLOW=  -Wno-shift-count-overflow
 -NO_WSELF_ASSIGN=   -Wno-self-assign
 -NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
 +NO_WCONSTANT_CONVERSION=   -Wno-error-constant-conversion
 +NO_WSHIFT_COUNT_NEGATIVE=  -Wno-error-shift-count-negative
 +NO_WSHIFT_COUNT_OVERFLOW=  -Wno-error-shift-count-overflow
 +NO_WSELF_ASSIGN=   -Wno-error-self-assign
 +NO_WUNNEEDED_INTERNAL_DECL=-Wno-error-unneeded-internal-declaration
 NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
 -NO_WCAST_QUAL= -Wno-cast-qual
 +NO_WCAST_QUAL= -Wno-error-cast-qual
>>> 
>>> I like goal of the change.  Shouldn't these be -Wno-error=cast-qual,
>>> etc., though?
>> 
>> That's how gcc spells them.  Clang accepts both forms, there is no
>> functional difference.
>> 
>> -Dimitry
>> 



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r305392 - head/sys/conf

2016-09-04 Thread Conrad Meyer
Assuming we'd like to enable building with both compilers for now,
isn't it better to use a form both accept?

Best,
Conrad

On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric  wrote:
> On 04 Sep 2016, at 20:57, Conrad Meyer  wrote:
>>
>> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric  wrote:
>>> Author: dim
>>> Date: Sun Sep  4 17:55:22 2016
>>> New Revision: 305392
>>> URL: https://svnweb.freebsd.org/changeset/base/305392
>>>
>>> Log:
>>>  For kernel builds, instead of suppressing certain clang warnings, make
>>>  them non-fatal, so there is some incentive to fix them eventually.
>>>
>>> Modified:
>>>  head/sys/conf/kern.mk
>>>
>>> Modified: head/sys/conf/kern.mk
>>> ==
>>> --- head/sys/conf/kern.mk   Sun Sep  4 17:50:23 2016(r305391)
>>> +++ head/sys/conf/kern.mk   Sun Sep  4 17:55:22 2016(r305392)
>>> @@ -17,13 +17,13 @@ CWARNFLAGS?=-Wall -Wredundant-decls -Wn
>>> # kernel where fixing them is more trouble than it is worth, or where there 
>>> is
>>> # a false positive.
>>> .if ${COMPILER_TYPE} == "clang"
>>> -NO_WCONSTANT_CONVERSION=   -Wno-constant-conversion
>>> -NO_WSHIFT_COUNT_NEGATIVE=  -Wno-shift-count-negative
>>> -NO_WSHIFT_COUNT_OVERFLOW=  -Wno-shift-count-overflow
>>> -NO_WSELF_ASSIGN=   -Wno-self-assign
>>> -NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
>>> +NO_WCONSTANT_CONVERSION=   -Wno-error-constant-conversion
>>> +NO_WSHIFT_COUNT_NEGATIVE=  -Wno-error-shift-count-negative
>>> +NO_WSHIFT_COUNT_OVERFLOW=  -Wno-error-shift-count-overflow
>>> +NO_WSELF_ASSIGN=   -Wno-error-self-assign
>>> +NO_WUNNEEDED_INTERNAL_DECL=-Wno-error-unneeded-internal-declaration
>>> NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
>>> -NO_WCAST_QUAL= -Wno-cast-qual
>>> +NO_WCAST_QUAL= -Wno-error-cast-qual
>>
>> I like goal of the change.  Shouldn't these be -Wno-error=cast-qual,
>> etc., though?
>
> That's how gcc spells them.  Clang accepts both forms, there is no
> functional difference.
>
> -Dimitry
>
___
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: r305392 - head/sys/conf

2016-09-04 Thread Joerg Sonnenberger
On Sun, Sep 04, 2016 at 09:31:19PM +0200, Dimitry Andric wrote:
> On 04 Sep 2016, at 20:57, Conrad Meyer  wrote:
> > 
> > On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric  wrote:
> >> Author: dim
> >> Date: Sun Sep  4 17:55:22 2016
> >> New Revision: 305392
> >> URL: https://svnweb.freebsd.org/changeset/base/305392
> >> 
> >> Log:
> >>  For kernel builds, instead of suppressing certain clang warnings, make
> >>  them non-fatal, so there is some incentive to fix them eventually.
> >> 
> >> Modified:
> >>  head/sys/conf/kern.mk
> >> 
> >> Modified: head/sys/conf/kern.mk
> >> ==
> >> --- head/sys/conf/kern.mk   Sun Sep  4 17:50:23 2016(r305391)
> >> +++ head/sys/conf/kern.mk   Sun Sep  4 17:55:22 2016(r305392)
> >> @@ -17,13 +17,13 @@ CWARNFLAGS?=-Wall -Wredundant-decls -Wn
> >> # kernel where fixing them is more trouble than it is worth, or where 
> >> there is
> >> # a false positive.
> >> .if ${COMPILER_TYPE} == "clang"
> >> -NO_WCONSTANT_CONVERSION=   -Wno-constant-conversion
> >> -NO_WSHIFT_COUNT_NEGATIVE=  -Wno-shift-count-negative
> >> -NO_WSHIFT_COUNT_OVERFLOW=  -Wno-shift-count-overflow
> >> -NO_WSELF_ASSIGN=   -Wno-self-assign
> >> -NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
> >> +NO_WCONSTANT_CONVERSION=   -Wno-error-constant-conversion
> >> +NO_WSHIFT_COUNT_NEGATIVE=  -Wno-error-shift-count-negative
> >> +NO_WSHIFT_COUNT_OVERFLOW=  -Wno-error-shift-count-overflow
> >> +NO_WSELF_ASSIGN=   -Wno-error-self-assign
> >> +NO_WUNNEEDED_INTERNAL_DECL=-Wno-error-unneeded-internal-declaration
> >> NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
> >> -NO_WCAST_QUAL= -Wno-cast-qual
> >> +NO_WCAST_QUAL= -Wno-error-cast-qual
> > 
> > I like goal of the change.  Shouldn't these be -Wno-error=cast-qual,
> > etc., though?
> 
> That's how gcc spells them.  Clang accepts both forms, there is no
> functional difference.

Actually, GCC documents them as -W(no-)error=* as well.

Joerg
___
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: r305392 - head/sys/conf

2016-09-04 Thread Dimitry Andric
On 04 Sep 2016, at 20:57, Conrad Meyer  wrote:
> 
> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric  wrote:
>> Author: dim
>> Date: Sun Sep  4 17:55:22 2016
>> New Revision: 305392
>> URL: https://svnweb.freebsd.org/changeset/base/305392
>> 
>> Log:
>>  For kernel builds, instead of suppressing certain clang warnings, make
>>  them non-fatal, so there is some incentive to fix them eventually.
>> 
>> Modified:
>>  head/sys/conf/kern.mk
>> 
>> Modified: head/sys/conf/kern.mk
>> ==
>> --- head/sys/conf/kern.mk   Sun Sep  4 17:50:23 2016(r305391)
>> +++ head/sys/conf/kern.mk   Sun Sep  4 17:55:22 2016(r305392)
>> @@ -17,13 +17,13 @@ CWARNFLAGS?=-Wall -Wredundant-decls -Wn
>> # kernel where fixing them is more trouble than it is worth, or where there 
>> is
>> # a false positive.
>> .if ${COMPILER_TYPE} == "clang"
>> -NO_WCONSTANT_CONVERSION=   -Wno-constant-conversion
>> -NO_WSHIFT_COUNT_NEGATIVE=  -Wno-shift-count-negative
>> -NO_WSHIFT_COUNT_OVERFLOW=  -Wno-shift-count-overflow
>> -NO_WSELF_ASSIGN=   -Wno-self-assign
>> -NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
>> +NO_WCONSTANT_CONVERSION=   -Wno-error-constant-conversion
>> +NO_WSHIFT_COUNT_NEGATIVE=  -Wno-error-shift-count-negative
>> +NO_WSHIFT_COUNT_OVERFLOW=  -Wno-error-shift-count-overflow
>> +NO_WSELF_ASSIGN=   -Wno-error-self-assign
>> +NO_WUNNEEDED_INTERNAL_DECL=-Wno-error-unneeded-internal-declaration
>> NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
>> -NO_WCAST_QUAL= -Wno-cast-qual
>> +NO_WCAST_QUAL= -Wno-error-cast-qual
> 
> I like goal of the change.  Shouldn't these be -Wno-error=cast-qual,
> etc., though?

That's how gcc spells them.  Clang accepts both forms, there is no
functional difference.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r305392 - head/sys/conf

2016-09-04 Thread Conrad Meyer
On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric  wrote:
> Author: dim
> Date: Sun Sep  4 17:55:22 2016
> New Revision: 305392
> URL: https://svnweb.freebsd.org/changeset/base/305392
>
> Log:
>   For kernel builds, instead of suppressing certain clang warnings, make
>   them non-fatal, so there is some incentive to fix them eventually.
>
> Modified:
>   head/sys/conf/kern.mk
>
> Modified: head/sys/conf/kern.mk
> ==
> --- head/sys/conf/kern.mk   Sun Sep  4 17:50:23 2016(r305391)
> +++ head/sys/conf/kern.mk   Sun Sep  4 17:55:22 2016(r305392)
> @@ -17,13 +17,13 @@ CWARNFLAGS?=-Wall -Wredundant-decls -Wn
>  # kernel where fixing them is more trouble than it is worth, or where there 
> is
>  # a false positive.
>  .if ${COMPILER_TYPE} == "clang"
> -NO_WCONSTANT_CONVERSION=   -Wno-constant-conversion
> -NO_WSHIFT_COUNT_NEGATIVE=  -Wno-shift-count-negative
> -NO_WSHIFT_COUNT_OVERFLOW=  -Wno-shift-count-overflow
> -NO_WSELF_ASSIGN=   -Wno-self-assign
> -NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
> +NO_WCONSTANT_CONVERSION=   -Wno-error-constant-conversion
> +NO_WSHIFT_COUNT_NEGATIVE=  -Wno-error-shift-count-negative
> +NO_WSHIFT_COUNT_OVERFLOW=  -Wno-error-shift-count-overflow
> +NO_WSELF_ASSIGN=   -Wno-error-self-assign
> +NO_WUNNEEDED_INTERNAL_DECL=-Wno-error-unneeded-internal-declaration
>  NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
> -NO_WCAST_QUAL= -Wno-cast-qual
> +NO_WCAST_QUAL= -Wno-error-cast-qual

I like goal of the change.  Shouldn't these be -Wno-error=cast-qual,
etc., though?

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: r305391 - head/sys/arm64/arm64

2016-09-04 Thread Alan Cox
On 09/04/2016 12:50, Andrew Turner wrote:
> Author: andrew
> Date: Sun Sep  4 17:50:23 2016
> New Revision: 305391
> URL: https://svnweb.freebsd.org/changeset/base/305391
>
> Log:
>   Enable superpages on arm64 by default. These seem to be stable, having
>   survived multiple world and kernel builds, and of poudriere building full
>   package sets.
>   
>   I have observed a 3% reduction in buildworld times with superpages enabled,
>   however further testing is needed to see if this is observed in other
>   workloads.
>   

Is the starting address of the text section on arm64 superpage aligned,
like it is on amd64?  If so, I expect that the reduction will increase
if you implement support for superpage mappings in pmap_enter_object().


___
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: r305393 - in head/sys: conf modules/bwn

2016-09-04 Thread Dimitry Andric
Author: dim
Date: Sun Sep  4 17:56:55 2016
New Revision: 305393
URL: https://svnweb.freebsd.org/changeset/base/305393

Log:
  Make some additional -Wconstant-conversion warnings from clang 3.9.0 in
  bwn(4) non-fatal for now.

Modified:
  head/sys/conf/files
  head/sys/modules/bwn/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Sep  4 17:55:22 2016(r305392)
+++ head/sys/conf/files Sun Sep  4 17:56:55 2016(r305393)
@@ -1211,13 +1211,13 @@ dev/bwi/bwiphy.coptional bwi
 dev/bwi/bwirf.coptional bwi
 dev/bwi/if_bwi.c   optional bwi
 dev/bwi/if_bwi_pci.c   optional bwi pci
-# XXX Work around clang warning, until maintainer approves fix.
+# XXX Work around clang warnings, until maintainer approves fix.
 dev/bwn/if_bwn.c   optional bwn siba_bwn \
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
 dev/bwn/if_bwn_pci.c   optional bwn pci bhnd
 dev/bwn/if_bwn_phy_common.coptional bwn siba_bwn
 dev/bwn/if_bwn_phy_g.c optional bwn siba_bwn \
-   compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
+   compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED} 
${NO_WCONSTANT_CONVERSION}"
 dev/bwn/if_bwn_phy_lp.coptional bwn siba_bwn \
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
 dev/bwn/if_bwn_phy_n.c optional bwn siba_bwn

Modified: head/sys/modules/bwn/Makefile
==
--- head/sys/modules/bwn/Makefile   Sun Sep  4 17:55:22 2016
(r305392)
+++ head/sys/modules/bwn/Makefile   Sun Sep  4 17:56:55 2016
(r305393)
@@ -28,7 +28,7 @@ SRCS+=device_if.h bus_if.h pci_if.h opt
 
 .include 
 
-# XXX Work around clang warning, until maintainer approves fix.
+# XXX Work around clang warnings, until maintainer approves fix.
 CWARNFLAGS.if_bwn.c=   ${NO_WSOMETIMES_UNINITIALIZED}
-CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED}
+CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED} 
${NO_WCONSTANT_CONVERSION}
 CWARNFLAGS.if_bwn_phy_lp.c=${NO_WSOMETIMES_UNINITIALIZED}
___
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: r305392 - head/sys/conf

2016-09-04 Thread Dimitry Andric
Author: dim
Date: Sun Sep  4 17:55:22 2016
New Revision: 305392
URL: https://svnweb.freebsd.org/changeset/base/305392

Log:
  For kernel builds, instead of suppressing certain clang warnings, make
  them non-fatal, so there is some incentive to fix them eventually.

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Sun Sep  4 17:50:23 2016(r305391)
+++ head/sys/conf/kern.mk   Sun Sep  4 17:55:22 2016(r305392)
@@ -17,13 +17,13 @@ CWARNFLAGS?=-Wall -Wredundant-decls -Wn
 # kernel where fixing them is more trouble than it is worth, or where there is
 # a false positive.
 .if ${COMPILER_TYPE} == "clang"
-NO_WCONSTANT_CONVERSION=   -Wno-constant-conversion
-NO_WSHIFT_COUNT_NEGATIVE=  -Wno-shift-count-negative
-NO_WSHIFT_COUNT_OVERFLOW=  -Wno-shift-count-overflow
-NO_WSELF_ASSIGN=   -Wno-self-assign
-NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
+NO_WCONSTANT_CONVERSION=   -Wno-error-constant-conversion
+NO_WSHIFT_COUNT_NEGATIVE=  -Wno-error-shift-count-negative
+NO_WSHIFT_COUNT_OVERFLOW=  -Wno-error-shift-count-overflow
+NO_WSELF_ASSIGN=   -Wno-error-self-assign
+NO_WUNNEEDED_INTERNAL_DECL=-Wno-error-unneeded-internal-declaration
 NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
-NO_WCAST_QUAL= -Wno-cast-qual
+NO_WCAST_QUAL= -Wno-error-cast-qual
 # Several other warnings which might be useful in some cases, but not severe
 # enough to error out the whole kernel build.  Display them anyway, so there is
 # some incentive to fix them eventually.
___
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: r305391 - head/sys/arm64/arm64

2016-09-04 Thread Andrew Turner
Author: andrew
Date: Sun Sep  4 17:50:23 2016
New Revision: 305391
URL: https://svnweb.freebsd.org/changeset/base/305391

Log:
  Enable superpages on arm64 by default. These seem to be stable, having
  survived multiple world and kernel builds, and of poudriere building full
  package sets.
  
  I have observed a 3% reduction in buildworld times with superpages enabled,
  however further testing is needed to see if this is observed in other
  workloads.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Sun Sep  4 17:26:42 2016(r305390)
+++ head/sys/arm64/arm64/pmap.c Sun Sep  4 17:50:23 2016(r305391)
@@ -242,7 +242,7 @@ extern pt_entry_t pagetable_dmap[];
 
 static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
 
-static int superpages_enabled = 0;
+static int superpages_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled,
 CTLFLAG_RDTUN | CTLFLAG_NOFETCH, _enabled, 0,
 "Are large page mappings enabled?");
___
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: r305389 - head/sys/netinet

2016-09-04 Thread Dimitry Andric
Author: dim
Date: Sun Sep  4 17:23:10 2016
New Revision: 305389
URL: https://svnweb.freebsd.org/changeset/base/305389

Log:
  With clang 3.9.0, compiling sys/netinet/igmp.c results in the following
  warning:
  
  sys/netinet/igmp.c:546:21: error: implicit conversion from 'int' to 'char' 
changes value from 148 to -108 [-Werror,-Wconstant-conversion]
  p->ipopt_list[0] = IPOPT_RA;/* Router Alert Option */
   ~ ^~~~
  sys/netinet/ip.h:153:19: note: expanded from macro 'IPOPT_RA'
  #define IPOPT_RA148 /* router alert */
  ^~~
  
  This is because ipopt_list is an array of char, so IPOPT_RA is wrapped
  to a negative value.  It would be nice to change ipopt_list to an array
  of u_char, but it changes the signature of the public struct ipoption,
  so add an explicit cast to suppress the warning.
  
  Reviewed by:  imp
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Sun Sep  4 16:59:35 2016(r305388)
+++ head/sys/netinet/igmp.c Sun Sep  4 17:23:10 2016(r305389)
@@ -543,10 +543,10 @@ igmp_ra_alloc(void)
m = m_get(M_WAITOK, MT_DATA);
p = mtod(m, struct ipoption *);
p->ipopt_dst.s_addr = INADDR_ANY;
-   p->ipopt_list[0] = IPOPT_RA;/* Router Alert Option */
-   p->ipopt_list[1] = 0x04;/* 4 bytes long */
-   p->ipopt_list[2] = IPOPT_EOL;   /* End of IP option list */
-   p->ipopt_list[3] = 0x00;/* pad byte */
+   p->ipopt_list[0] = (char)IPOPT_RA;  /* Router Alert Option */
+   p->ipopt_list[1] = 0x04;/* 4 bytes long */
+   p->ipopt_list[2] = IPOPT_EOL;   /* End of IP option list */
+   p->ipopt_list[3] = 0x00;/* pad byte */
m->m_len = sizeof(p->ipopt_dst) + p->ipopt_list[1];
 
return (m);
___
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: r305388 - head/sys/dev/usb/serial

2016-09-04 Thread Dimitry Andric
Author: dim
Date: Sun Sep  4 16:59:35 2016
New Revision: 305388
URL: https://svnweb.freebsd.org/changeset/base/305388

Log:
  With clang 3.9.0, compiling uplcom results in the following warnings:
  
  sys/dev/usb/serial/uplcom.c:543:29: error: implicit conversion from 'int' to 
'int8_t' (aka 'signed char') changes value from 192 to -64 
[-Werror,-Wconstant-conversion]
  if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 
0x8484, 0, 1)
     ^
  sys/dev/usb/usb.h:179:53: note: expanded from macro 'UT_READ_VENDOR_DEVICE'
  #define UT_READ_VENDOR_DEVICE   (UT_READ  | UT_VENDOR | UT_DEVICE)
   ~^~~
  
  This is because UT_READ is 0x80, so the int8_t argument is wrapped to a
  negative value.  Fix this by using uint8_t instead.
  
  Reviewed by:  imp, hselasky
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D7776

Modified:
  head/sys/dev/usb/serial/uplcom.c

Modified: head/sys/dev/usb/serial/uplcom.c
==
--- head/sys/dev/usb/serial/uplcom.cSun Sep  4 16:54:55 2016
(r305387)
+++ head/sys/dev/usb/serial/uplcom.cSun Sep  4 16:59:35 2016
(r305388)
@@ -166,7 +166,7 @@ struct uplcom_softc {
 /* prototypes */
 
 static usb_error_t uplcom_reset(struct uplcom_softc *, struct usb_device *);
-static usb_error_t uplcom_pl2303_do(struct usb_device *, int8_t, uint8_t,
+static usb_error_t uplcom_pl2303_do(struct usb_device *, uint8_t, uint8_t,
uint16_t, uint16_t, uint16_t);
 static int uplcom_pl2303_init(struct usb_device *, uint8_t);
 static voiduplcom_free(struct ucom_softc *);
@@ -514,7 +514,7 @@ uplcom_reset(struct uplcom_softc *sc, st
 }
 
 static usb_error_t
-uplcom_pl2303_do(struct usb_device *udev, int8_t req_type, uint8_t request,
+uplcom_pl2303_do(struct usb_device *udev, uint8_t req_type, uint8_t request,
 uint16_t value, uint16_t index, uint16_t length)
 {
struct usb_device_request req;
___
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: r305386 - head/sys/kern

2016-09-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Sep  4 16:52:14 2016
New Revision: 305386
URL: https://svnweb.freebsd.org/changeset/base/305386

Log:
  cache: defer freeing entries until after the global lock is dropped
  
  This also defers vdrop for held vnodes.
  
  Glanced at by:kib

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Sun Sep  4 15:08:14 2016(r305385)
+++ head/sys/kern/vfs_cache.c   Sun Sep  4 16:52:14 2016(r305386)
@@ -131,6 +131,7 @@ struct  namecache_ts {
 #define NCF_ISDOTDOT   0x02
 #defineNCF_TS  0x04
 #defineNCF_DTS 0x08
+#defineNCF_DVDROP  0x10
 
 /*
  * Name caching works as follows:
@@ -227,6 +228,8 @@ cache_free(struct namecache *ncp)
if (ncp == NULL)
return;
ts = ncp->nc_flag & NCF_TS;
+   if ((ncp->nc_flag & NCF_DVDROP) != 0)
+   vdrop(ncp->nc_dvp);
if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) {
if (ts)
uma_zfree(cache_zone_small_ts, ncp);
@@ -476,7 +479,7 @@ cache_negative_remove(struct namecache *
numneg--;
 }
 
-static void
+static struct namecache *
 cache_negative_zap_one(void)
 {
struct namecache *ncp;
@@ -486,6 +489,7 @@ cache_negative_zap_one(void)
KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg",
ncp, ncp->nc_vp));
cache_zap(ncp);
+   return (ncp);
 }
 
 /*
@@ -497,7 +501,6 @@ cache_negative_zap_one(void)
 static void
 cache_zap(struct namecache *ncp)
 {
-   struct vnode *vp;
 
rw_assert(_lock, RA_WLOCKED);
CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp);
@@ -508,7 +511,6 @@ cache_zap(struct namecache *ncp)
SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp,
nc_get_name(ncp));
}
-   vp = NULL;
LIST_REMOVE(ncp, nc_hash);
if (ncp->nc_flag & NCF_ISDOTDOT) {
if (ncp == ncp->nc_dvp->v_cache_dd)
@@ -516,7 +518,7 @@ cache_zap(struct namecache *ncp)
} else {
LIST_REMOVE(ncp, nc_src);
if (LIST_EMPTY(>nc_dvp->v_cache_src)) {
-   vp = ncp->nc_dvp;
+   ncp->nc_flag |= NCF_DVDROP;
numcachehv--;
}
}
@@ -528,9 +530,6 @@ cache_zap(struct namecache *ncp)
cache_negative_remove(ncp);
}
numcache--;
-   cache_free(ncp);
-   if (vp != NULL)
-   vdrop(vp);
 }
 
 /*
@@ -611,10 +610,14 @@ retry_wlocked:
if ((cnp->cn_flags & MAKEENTRY) == 0) {
if (!wlocked && !CACHE_UPGRADE_LOCK())
goto wlock;
-   if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT)
-   cache_zap(dvp->v_cache_dd);
+   ncp = NULL;
+   if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) {
+   ncp = dvp->v_cache_dd;
+   cache_zap(ncp);
+   }
dvp->v_cache_dd = NULL;
CACHE_WUNLOCK();
+   cache_free(ncp);
return (0);
}
ncp = dvp->v_cache_dd;
@@ -666,6 +669,7 @@ retry_wlocked:
goto wlock;
cache_zap(ncp);
CACHE_WUNLOCK();
+   cache_free(ncp);
return (0);
}
 
@@ -689,6 +693,7 @@ negative_success:
goto wlock;
cache_zap(ncp);
CACHE_WUNLOCK();
+   cache_free(ncp);
return (0);
}
 
@@ -767,7 +772,7 @@ void
 cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname 
*cnp,
 struct timespec *tsp, struct timespec *dtsp)
 {
-   struct namecache *ncp, *n2;
+   struct namecache *ncp, *n2, *ndd, *nneg;
struct namecache_ts *n3;
struct nchashhead *ncpp;
uint32_t hash;
@@ -789,6 +794,7 @@ cache_enter_time(struct vnode *dvp, stru
if (numcache >= desiredvnodes * ncsizefactor)
return;
 
+   ndd = nneg = NULL;
flag = 0;
if (cnp->cn_nameptr[0] == '.') {
if (cnp->cn_namelen == 1)
@@ -905,9 +911,12 @@ cache_enter_time(struct vnode *dvp, stru
 * directory name in it and the name ".." for 
the
 * directory's parent.
 */
-   if ((n2 = vp->v_cache_dd) != NULL &&
-   (n2->nc_flag & NCF_ISDOTDOT) != 0)
-   

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

2016-09-04 Thread Mateusz Guzik
On Sun, Sep 04, 2016 at 09:00:38AM -0700, Conrad Meyer wrote:
> Do you know which revision this was introduced (i.e. what revision
> range should be avoided)?  The most relevant commit seems to be
> r305093 but I'm not sure how that would have broken this (nothing in
> that diff was checking fde_file before).
> 

The problem was present since r305093 to this very commit.

The problem affects weird programs which do F_GETFD to see if they got
given fd installed, like bash.

Prior to r305093 they would get EBADF. But due to incorrect test in
fdeget_locked, they would get 0 instead.

> Best,
> Conrad
> 
> On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik  wrote:
> > Author: mjg
> > Date: Sun Sep  4 13:31:57 2016
> > New Revision: 305383
> > URL: https://svnweb.freebsd.org/changeset/base/305383
> >
> > Log:
> >   fd: fix up fdeget_file
> >
> >   It was supposed to return NULL if a fp is not installed.
> >
> >   Facepalm-by: mjg
> >
> > Modified:
> >   head/sys/sys/filedesc.h
> >
> > Modified: head/sys/sys/filedesc.h
> > ==
> > --- head/sys/sys/filedesc.h Sun Sep  4 12:22:14 2016(r305382)
> > +++ head/sys/sys/filedesc.h Sun Sep  4 13:31:57 2016(r305383)
> > @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd
> >  static __inline struct filedescent *
> >  fdeget_locked(struct filedesc *fdp, int fd)
> >  {
> > +   struct filedescent *fde;
> >
> > FILEDESC_LOCK_ASSERT(fdp);
> >
> > if (fd < 0 || fd > fdp->fd_lastfile)
> > return (NULL);
> >
> > -   return (>fd_ofiles[fd]);
> > +   fde = >fd_ofiles[fd];
> > +   if (fde->fde_file == NULL)
> > +   return (NULL);
> > +
> > +   return (fde);
> >  }
> >
> >  static __inline bool
> >

-- 
Mateusz Guzik 
___
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: r305383 - head/sys/sys

2016-09-04 Thread Conrad Meyer
Do you know which revision this was introduced (i.e. what revision
range should be avoided)?  The most relevant commit seems to be
r305093 but I'm not sure how that would have broken this (nothing in
that diff was checking fde_file before).

Best,
Conrad

On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik  wrote:
> Author: mjg
> Date: Sun Sep  4 13:31:57 2016
> New Revision: 305383
> URL: https://svnweb.freebsd.org/changeset/base/305383
>
> Log:
>   fd: fix up fdeget_file
>
>   It was supposed to return NULL if a fp is not installed.
>
>   Facepalm-by: mjg
>
> Modified:
>   head/sys/sys/filedesc.h
>
> Modified: head/sys/sys/filedesc.h
> ==
> --- head/sys/sys/filedesc.h Sun Sep  4 12:22:14 2016(r305382)
> +++ head/sys/sys/filedesc.h Sun Sep  4 13:31:57 2016(r305383)
> @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd
>  static __inline struct filedescent *
>  fdeget_locked(struct filedesc *fdp, int fd)
>  {
> +   struct filedescent *fde;
>
> FILEDESC_LOCK_ASSERT(fdp);
>
> if (fd < 0 || fd > fdp->fd_lastfile)
> return (NULL);
>
> -   return (>fd_ofiles[fd]);
> +   fde = >fd_ofiles[fd];
> +   if (fde->fde_file == NULL)
> +   return (NULL);
> +
> +   return (fde);
>  }
>
>  static __inline bool
>
___
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: r305382 - in head/lib/msun: amd64 i387

2016-09-04 Thread Bruce Evans

On Sun, 4 Sep 2016, Konstantin Belousov wrote:


On Sun, Sep 04, 2016 at 12:22:14PM +, Bruce Evans wrote:
...

Log:
  Add asm versions of fmod(), fmodf() and fmodl() on amd64.  Add asm
  versions of fmodf() amd fmodl() on i387.
...

It seems that wrong version of i387/f_fmodf.S, it is identical to the
amd64 version.


Indeed.  Fixed.


Added: head/lib/msun/amd64/e_fmod.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/msun/amd64/e_fmod.SSun Sep  4 12:22:14 2016
(r305382)
+ENTRY(fmod)
+   movsd   %xmm0,-8(%rsp)
+   movsd   %xmm1,-16(%rsp)
+   fldl-16(%rsp)
+   fldl-8(%rsp)
+1: fprem
+   fstsw   %ax
+   testw   $0x400,%ax
+   jne 1b
+   fstpl   -8(%rsp)
+   movsd   -8(%rsp),%xmm0
+   fstp%st
+   ret
+END(fmod)


I see that this is not a new approach in the amd64 subdirectory, to use
x87 FPU on amd64.  Please note that it might have non-obvious effects on
the performance, in particular, on the speed of the context switches and
handling of #NM exception.


For long double functions, the i387 gets used anyway.

This function is very slow even with the i387.  It takes about 500
cycles per call on args uniformly distributed in double precision
space, but this distribution is very non-average since it gives many
huge args.   The loop iterates many times on huge args.

This is still better the the C code which takes 3 or more times longer
or > 1500 cycles.  It does a loop on the bits using integer code.  The
C code is relatively even slower when there are fewer bits (something
like 9 times slower for args uniformly distributed in float precision
space).


Newer Intel and possibly AMD CPUs have an optimization which allows
coprocessor code to save and restore state to not save and restore state
which was not changed.  In other words, for typical amd64 binary which
uses %xmm register file but did not touched %st nor %ymm, only %xmm
bits are spilled and then loaded.  Touching %st defeats the optimization,
possible for the whole lifetime of the thread.

This feature (XSAVEOPT) is available at least starting from Haswell
microarchitecture, not sure about IvyBridge.


Isn't the i386 space too small to matter much?  There should be the
same number of NM#'s and just 100 bytes extra to save.  Avoiding use
of larger register sets by using only the i387 might save more :-).

The other amd64 asm uses of the i387 for floats and doubles are:
- 3 files for remainder and 3 files for remquo.  Needed for the same
  reason as for fmod
- s_scalbn.S, s_scalbnf.S.  To use i387 fscale.  Probably a mistake.
  The functions themselves are too slow to be very useful too.  libm
  almost never uses them internally, and in optimized functions like
  exp* the exponent scaling is done inline using special integer code.
  I have spent many hours fighting the compiler to stop it pessimizing
  the memory accesses to give pipeline stalls for this integer code.
  Using fscale probably tends to give another type of pipeline stall.

I plan to remove many more i387 uses on i386, but there aren't many more
on amd64.

Bruce
___
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: r305385 - head/lib/msun/i387

2016-09-04 Thread Bruce Evans
Author: bde
Date: Sun Sep  4 15:08:14 2016
New Revision: 305385
URL: https://svnweb.freebsd.org/changeset/base/305385

Log:
  Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
  actually the amd64 version.

Modified:
  head/lib/msun/i387/e_fmodf.S
  head/lib/msun/i387/e_fmodl.S

Modified: head/lib/msun/i387/e_fmodf.S
==
--- head/lib/msun/i387/e_fmodf.SSun Sep  4 14:12:19 2016
(r305384)
+++ head/lib/msun/i387/e_fmodf.SSun Sep  4 15:08:14 2016
(r305385)
@@ -1,5 +1,5 @@
 /*
- * Based on the i387 version written by J.T. Conklin .
+ * Written by J.T. Conklin .
  * Public domain.
  */
 
@@ -7,17 +7,13 @@
 __FBSDID("$FreeBSD$")
 
 ENTRY(fmodf)
-   movss   %xmm0,-4(%rsp)
-   movss   %xmm1,-8(%rsp)
-   flds-8(%rsp)
-   flds-4(%rsp)
+   flds8(%esp)
+   flds4(%esp)
 1: fprem
fstsw   %ax
-   testw   $0x400,%ax
-   jne 1b
-   fstps   -4(%rsp)
-   movss   -4(%rsp),%xmm0
-   fstp%st
+   sahf
+   jp  1b
+   fstp%st(1)
ret
 END(fmodf)
 

Modified: head/lib/msun/i387/e_fmodl.S
==
--- head/lib/msun/i387/e_fmodl.SSun Sep  4 14:12:19 2016
(r305384)
+++ head/lib/msun/i387/e_fmodl.SSun Sep  4 15:08:14 2016
(r305385)
@@ -29,7 +29,7 @@
  */
 
 /*
- * Based on the i387 version written by:
+ * Written by:
  * J.T. Conklin (j...@wimsey.com), Winning Strategies, Inc.
  */
 
@@ -37,12 +37,12 @@
 __FBSDID("$FreeBSD$")
 
 ENTRY(fmodl)
-   fldt24(%rsp)
-   fldt8(%rsp)
+   fldt16(%esp)
+   fldt4(%esp)
 1: fprem
fstsw   %ax
-   testw   $0x400,%ax
-   jne 1b
+   sahf
+   jp  1b
fstp%st(1)
ret
 END(fmodl)
___
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: r305382 - in head/lib/msun: amd64 i387

2016-09-04 Thread Konstantin Belousov
On Sun, Sep 04, 2016 at 12:22:14PM +, Bruce Evans wrote:
> Author: bde
> Date: Sun Sep  4 12:22:14 2016
> New Revision: 305382
> URL: https://svnweb.freebsd.org/changeset/base/305382
> 

> Log:
>   Add asm versions of fmod(), fmodf() and fmodl() on amd64.  Add asm
>   versions of fmodf() amd fmodl() on i387.
>   
>   fmod is similar to remainder, and the C versions are 3 to 9 times
>   slower than the asm versions on x86 for both, but we had the strange
>   mixture of all 6 variants of remainder in asm and only 1 of 6
>   variants of fmod in asm.
> 
> Added:
>   head/lib/msun/amd64/e_fmod.S   (contents, props changed)
>   head/lib/msun/amd64/e_fmodf.S   (contents, props changed)
>   head/lib/msun/amd64/e_fmodl.S   (contents, props changed)
>   head/lib/msun/i387/e_fmodf.S   (contents, props changed)
It seems that wrong version of i387/f_fmodf.S, it is identical to the
amd64 version.

> Added: head/lib/msun/amd64/e_fmod.S
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/lib/msun/amd64/e_fmod.S  Sun Sep  4 12:22:14 2016
> (r305382)
> +ENTRY(fmod)
> + movsd   %xmm0,-8(%rsp)
> + movsd   %xmm1,-16(%rsp)
> + fldl-16(%rsp)
> + fldl-8(%rsp)
> +1:   fprem
> + fstsw   %ax
> + testw   $0x400,%ax
> + jne 1b
> + fstpl   -8(%rsp)
> + movsd   -8(%rsp),%xmm0
> + fstp%st
> + ret
> +END(fmod)

I see that this is not a new approach in the amd64 subdirectory, to use
x87 FPU on amd64.  Please note that it might have non-obvious effects on
the performance, in particular, on the speed of the context switches and
handling of #NM exception.

Newer Intel and possibly AMD CPUs have an optimization which allows
coprocessor code to save and restore state to not save and restore state
which was not changed.  In other words, for typical amd64 binary which
uses %xmm register file but did not touched %st nor %ymm, only %xmm
bits are spilled and then loaded.  Touching %st defeats the optimization,
possible for the whole lifetime of the thread.

This feature (XSAVEOPT) is available at least starting from Haswell
microarchitecture, not sure about IvyBridge.
___
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: r305384 - head/lib/msun/i387

2016-09-04 Thread Bruce Evans
Author: bde
Date: Sun Sep  4 14:12:19 2016
New Revision: 305384
URL: https://svnweb.freebsd.org/changeset/base/305384

Log:
  Disconnect the "optimized" asm variants of cos(), sin() and tan() from
  the build on i386.  Leave them in the source tree for regression tests.
  
  The asm functions were always much less accurate (by a factor of more
  than 10**18 in the worst case).  They were faster on old CPUs.  But
  with each new generation of CPUs they get relatively slower.  The
  double precision C version's average advantage is about a factor of 2
  on Haswell.
  
  The asm functions were already intentionally avoided in float and long
  double precision on i386 and in all precisions on amd64.  Float
  precision and amd64 give larger advantages to the C version.  The long
  double precision C code and compilers' understanding of long double
  precision are not so good, so the i387 is still slightly faster for
  long double precision, except for the unimportant subcase of huge args
  where the sub-optimal C code now somehow beats the i387 by about a
  factor of 2.

Modified:
  head/lib/msun/i387/Makefile.inc

Modified: head/lib/msun/i387/Makefile.inc
==
--- head/lib/msun/i387/Makefile.inc Sun Sep  4 13:31:57 2016
(r305383)
+++ head/lib/msun/i387/Makefile.inc Sun Sep  4 14:12:19 2016
(r305384)
@@ -2,8 +2,8 @@
 
 ARCH_SRCS = e_exp.S e_fmod.S e_log.S e_log10.S \
e_remainder.S e_sqrt.S s_ceil.S s_copysign.S \
-   s_cos.S s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \
-   s_remquo.S s_rint.S s_scalbn.S s_significand.S s_sin.S s_tan.S \
+   s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \
+   s_remquo.S s_rint.S s_scalbn.S s_significand.S \
s_trunc.S
 
 # float counterparts
___
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: r305383 - head/sys/sys

2016-09-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Sep  4 13:31:57 2016
New Revision: 305383
URL: https://svnweb.freebsd.org/changeset/base/305383

Log:
  fd: fix up fdeget_file
  
  It was supposed to return NULL if a fp is not installed.
  
  Facepalm-by: mjg

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Sun Sep  4 12:22:14 2016(r305382)
+++ head/sys/sys/filedesc.h Sun Sep  4 13:31:57 2016(r305383)
@@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd
 static __inline struct filedescent *
 fdeget_locked(struct filedesc *fdp, int fd)
 {
+   struct filedescent *fde;
 
FILEDESC_LOCK_ASSERT(fdp);
 
if (fd < 0 || fd > fdp->fd_lastfile)
return (NULL);
 
-   return (>fd_ofiles[fd]);
+   fde = >fd_ofiles[fd];
+   if (fde->fde_file == NULL)
+   return (NULL);
+
+   return (fde);
 }
 
 static __inline bool
___
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: r305382 - in head/lib/msun: amd64 i387

2016-09-04 Thread Bruce Evans
Author: bde
Date: Sun Sep  4 12:22:14 2016
New Revision: 305382
URL: https://svnweb.freebsd.org/changeset/base/305382

Log:
  Add asm versions of fmod(), fmodf() and fmodl() on amd64.  Add asm
  versions of fmodf() amd fmodl() on i387.
  
  fmod is similar to remainder, and the C versions are 3 to 9 times
  slower than the asm versions on x86 for both, but we had the strange
  mixture of all 6 variants of remainder in asm and only 1 of 6
  variants of fmod in asm.

Added:
  head/lib/msun/amd64/e_fmod.S   (contents, props changed)
  head/lib/msun/amd64/e_fmodf.S   (contents, props changed)
  head/lib/msun/amd64/e_fmodl.S   (contents, props changed)
  head/lib/msun/i387/e_fmodf.S   (contents, props changed)
  head/lib/msun/i387/e_fmodl.S   (contents, props changed)
Modified:
  head/lib/msun/amd64/Makefile.inc
  head/lib/msun/i387/Makefile.inc

Modified: head/lib/msun/amd64/Makefile.inc
==
--- head/lib/msun/amd64/Makefile.incSun Sep  4 12:17:57 2016
(r305381)
+++ head/lib/msun/amd64/Makefile.incSun Sep  4 12:22:14 2016
(r305382)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
-ARCH_SRCS = e_remainder.S e_remainderf.S e_remainderl.S \
+ARCH_SRCS = e_fmod.S e_fmodf.S e_fmodl.S \
+   e_remainder.S e_remainderf.S e_remainderl.S \
e_sqrt.S e_sqrtf.S e_sqrtl.S \
s_llrint.S s_llrintf.S s_llrintl.S \
s_logbl.S s_lrint.S s_lrintf.S s_lrintl.S \

Added: head/lib/msun/amd64/e_fmod.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/msun/amd64/e_fmod.SSun Sep  4 12:22:14 2016
(r305382)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1993,94 Winning Strategies, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *  This product includes software developed by Winning Strategies, Inc.
+ * 4. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR 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.
+ */
+
+/*
+ * Based on the i387 version written by:
+ * J.T. Conklin (j...@wimsey.com), Winning Strategies, Inc.
+ */
+
+#include 
+__FBSDID("$FreeBSD$")
+
+ENTRY(fmod)
+   movsd   %xmm0,-8(%rsp)
+   movsd   %xmm1,-16(%rsp)
+   fldl-16(%rsp)
+   fldl-8(%rsp)
+1: fprem
+   fstsw   %ax
+   testw   $0x400,%ax
+   jne 1b
+   fstpl   -8(%rsp)
+   movsd   -8(%rsp),%xmm0
+   fstp%st
+   ret
+END(fmod)
+
+   .section .note.GNU-stack,"",%progbits

Added: head/lib/msun/amd64/e_fmodf.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/msun/amd64/e_fmodf.S   Sun Sep  4 12:22:14 2016
(r305382)
@@ -0,0 +1,24 @@
+/*
+ * Based on the i387 version written by J.T. Conklin .
+ * Public domain.
+ */
+
+#include 
+__FBSDID("$FreeBSD$")
+
+ENTRY(fmodf)
+   movss   %xmm0,-4(%rsp)
+   movss   %xmm1,-8(%rsp)
+   flds-8(%rsp)
+   flds-4(%rsp)
+1: fprem
+   fstsw   %ax
+   testw   $0x400,%ax
+   jne 1b
+   fstps   -4(%rsp)
+   movss   -4(%rsp),%xmm0
+   fstp%st
+   ret
+END(fmodf)
+
+   .section .note.GNU-stack,"",%progbits

Added: head/lib/msun/amd64/e_fmodl.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/msun/amd64/e_fmodl.S   

svn commit: r305381 - in head: contrib/unbound contrib/unbound/cachedb contrib/unbound/compat contrib/unbound/daemon contrib/unbound/dns64 contrib/unbound/dnstap contrib/unbound/doc contrib/unbound...

2016-09-04 Thread Dag-Erling Smørgrav
Author: des
Date: Sun Sep  4 12:17:57 2016
New Revision: 305381
URL: https://svnweb.freebsd.org/changeset/base/305381

Log:
  Upgrade to Unbound 1.5.9.

Added:
  head/contrib/unbound/cachedb/
 - copied from r305347, vendor/unbound/dist/cachedb/
  head/contrib/unbound/compat/strsep.c
 - copied unchanged from r305347, vendor/unbound/dist/compat/strsep.c
  head/contrib/unbound/util/ub_event.c
 - copied unchanged from r305347, vendor/unbound/dist/util/ub_event.c
  head/contrib/unbound/util/ub_event.h
 - copied, changed from r305347, vendor/unbound/dist/util/ub_event.h
  head/contrib/unbound/util/ub_event_pluggable.c
 - copied unchanged from r305347, 
vendor/unbound/dist/util/ub_event_pluggable.c
Modified:
  head/contrib/unbound/Makefile.in
  head/contrib/unbound/acx_nlnetlabs.m4
  head/contrib/unbound/compat/explicit_bzero.c
  head/contrib/unbound/compat/getentropy_linux.c
  head/contrib/unbound/config.h
  head/contrib/unbound/config.h.in
  head/contrib/unbound/configure
  head/contrib/unbound/configure.ac
  head/contrib/unbound/daemon/daemon.c
  head/contrib/unbound/daemon/daemon.h
  head/contrib/unbound/daemon/remote.c
  head/contrib/unbound/daemon/unbound.c
  head/contrib/unbound/daemon/worker.c
  head/contrib/unbound/dns64/dns64.c
  head/contrib/unbound/dnstap/dnstap.c
  head/contrib/unbound/doc/Changelog
  head/contrib/unbound/doc/README
  head/contrib/unbound/doc/example.conf
  head/contrib/unbound/doc/example.conf.in
  head/contrib/unbound/doc/libunbound.3
  head/contrib/unbound/doc/libunbound.3.in
  head/contrib/unbound/doc/unbound-anchor.8
  head/contrib/unbound/doc/unbound-anchor.8.in
  head/contrib/unbound/doc/unbound-checkconf.8
  head/contrib/unbound/doc/unbound-checkconf.8.in
  head/contrib/unbound/doc/unbound-control.8
  head/contrib/unbound/doc/unbound-control.8.in
  head/contrib/unbound/doc/unbound-host.1
  head/contrib/unbound/doc/unbound-host.1.in
  head/contrib/unbound/doc/unbound.8
  head/contrib/unbound/doc/unbound.8.in
  head/contrib/unbound/doc/unbound.conf.5
  head/contrib/unbound/doc/unbound.conf.5.in
  head/contrib/unbound/iterator/iter_fwd.c
  head/contrib/unbound/iterator/iter_utils.c
  head/contrib/unbound/iterator/iter_utils.h
  head/contrib/unbound/iterator/iterator.c
  head/contrib/unbound/iterator/iterator.h
  head/contrib/unbound/libunbound/context.h
  head/contrib/unbound/libunbound/libunbound.c
  head/contrib/unbound/libunbound/libworker.c
  head/contrib/unbound/libunbound/libworker.h
  head/contrib/unbound/libunbound/python/libunbound.i
  head/contrib/unbound/libunbound/ubsyms.def
  head/contrib/unbound/libunbound/unbound-event.h
  head/contrib/unbound/libunbound/worker.h
  head/contrib/unbound/services/cache/dns.c
  head/contrib/unbound/services/listen_dnsport.c
  head/contrib/unbound/services/listen_dnsport.h
  head/contrib/unbound/services/localzone.c
  head/contrib/unbound/services/localzone.h
  head/contrib/unbound/services/mesh.c
  head/contrib/unbound/services/modstack.c
  head/contrib/unbound/services/outside_network.c
  head/contrib/unbound/services/outside_network.h
  head/contrib/unbound/sldns/keyraw.c
  head/contrib/unbound/sldns/parseutil.c
  head/contrib/unbound/sldns/rrdef.h
  head/contrib/unbound/sldns/str2wire.c
  head/contrib/unbound/sldns/wire2str.c
  head/contrib/unbound/smallapp/unbound-checkconf.c
  head/contrib/unbound/smallapp/unbound-control.c
  head/contrib/unbound/smallapp/worker_cb.c
  head/contrib/unbound/util/config_file.c
  head/contrib/unbound/util/config_file.h
  head/contrib/unbound/util/configlexer.lex
  head/contrib/unbound/util/configparser.y
  head/contrib/unbound/util/data/dname.c
  head/contrib/unbound/util/data/msgencode.c
  head/contrib/unbound/util/data/msgparse.c
  head/contrib/unbound/util/data/msgparse.h
  head/contrib/unbound/util/data/msgreply.c
  head/contrib/unbound/util/data/msgreply.h
  head/contrib/unbound/util/fptr_wlist.c
  head/contrib/unbound/util/fptr_wlist.h
  head/contrib/unbound/util/iana_ports.inc
  head/contrib/unbound/util/module.h
  head/contrib/unbound/util/net_help.c
  head/contrib/unbound/util/netevent.c
  head/contrib/unbound/util/netevent.h
  head/contrib/unbound/util/tube.c
  head/contrib/unbound/util/tube.h
  head/contrib/unbound/validator/autotrust.c
  head/contrib/unbound/validator/val_anchor.c
  head/contrib/unbound/validator/val_secalgo.c
  head/contrib/unbound/validator/val_secalgo.h
  head/lib/libunbound/Makefile
  head/usr.sbin/unbound/checkconf/Makefile
  head/usr.sbin/unbound/control/Makefile
  head/usr.sbin/unbound/daemon/Makefile
Directory Properties:
  head/contrib/unbound/   (props changed)

Modified: head/contrib/unbound/Makefile.in
==
--- head/contrib/unbound/Makefile.inSun Sep  4 12:01:32 2016
(r305380)
+++ head/contrib/unbound/Makefile.inSun Sep  4 12:17:57 2016
(r305381)
@@ -108,11 +108,12 @@ util/fptr_wlist.c util/locks.c util/log.
 util/netevent.c util/net_help.c 

svn commit: r305380 - head/lib/msun/src

2016-09-04 Thread Bruce Evans
Author: bde
Date: Sun Sep  4 12:01:32 2016
New Revision: 305380
URL: https://svnweb.freebsd.org/changeset/base/305380

Log:
  Fix missing fmodl() on arches with 53-bit long doubles.
  
  PR:   199422, 211965
  MFC after:1 week

Modified:
  head/lib/msun/src/e_fmod.c

Modified: head/lib/msun/src/e_fmod.c
==
--- head/lib/msun/src/e_fmod.c  Sun Sep  4 08:58:35 2016(r305379)
+++ head/lib/msun/src/e_fmod.c  Sun Sep  4 12:01:32 2016(r305380)
@@ -20,6 +20,8 @@ __FBSDID("$FreeBSD$");
  * Method: shift and subtract
  */
 
+#include 
+
 #include "math.h"
 #include "math_private.h"
 
@@ -130,3 +132,7 @@ __ieee754_fmod(double x, double y)
}
return x;   /* exact output */
 }
+
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(fmod, fmodl);
+#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: r305379 - head/sys/kern

2016-09-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Sep  4 08:58:35 2016
New Revision: 305379
URL: https://svnweb.freebsd.org/changeset/base/305379

Log:
  cache: manage negative entry list with a dedicated lock
  
  Since negative entries are managed with a LRU list, a hit requires a
  modificaton.
  
  Currently the code tries to upgrade the global lock if needed and is
  forced to retry the lookup if it fails.
  
  Provide a dedicated lock for use when the cache is only shared-locked.
  
  Reviewed by:  kib
  MFC after:1 week

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Sun Sep  4 08:55:15 2016(r305378)
+++ head/sys/kern/vfs_cache.c   Sun Sep  4 08:58:35 2016(r305379)
@@ -186,6 +186,9 @@ RW_SYSINIT(vfscache, _lock, "Name 
 #defineCACHE_WLOCK()   rw_wlock(_lock)
 #defineCACHE_WUNLOCK() rw_wunlock(_lock)
 
+static struct mtx_padalign ncneg_mtx;
+MTX_SYSINIT(vfscache_neg, _mtx, "Name Cache neg", MTX_DEF);
+
 /*
  * UMA zones for the VFS cache.
  *
@@ -436,12 +439,21 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n
  * Negative entries management
  */
 static void
-cache_negative_hit(struct namecache *ncp)
+cache_negative_hit(struct namecache *ncp, int wlocked)
 {
 
-   rw_assert(_lock, RA_WLOCKED);
+   if (!wlocked) {
+   rw_assert(_lock, RA_RLOCKED);
+   mtx_lock(_mtx);
+   } else {
+   rw_assert(_lock, RA_WLOCKED);
+   }
+
TAILQ_REMOVE(, ncp, nc_dst);
TAILQ_INSERT_TAIL(, ncp, nc_dst);
+
+   if (!wlocked)
+   mtx_unlock(_mtx);
 }
 
 static void
@@ -680,16 +692,17 @@ negative_success:
return (0);
}
 
-   if (!wlocked && !CACHE_UPGRADE_LOCK())
-   goto wlock;
counter_u64_add(numneghits, 1);
-   cache_negative_hit(ncp);
+   cache_negative_hit(ncp, wlocked);
if (ncp->nc_flag & NCF_WHITE)
cnp->cn_flags |= ISWHITEOUT;
SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp,
nc_get_name(ncp));
cache_out_ts(ncp, tsp, ticksp);
-   CACHE_WUNLOCK();
+   if (wlocked)
+   CACHE_WUNLOCK();
+   else
+   CACHE_RUNLOCK();
return (ENOENT);
 
 wlock:
___
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: r305378 - head/sys/kern

2016-09-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Sep  4 08:55:15 2016
New Revision: 305378
URL: https://svnweb.freebsd.org/changeset/base/305378

Log:
  cache: put all negative entry management code into dedicated functions
  
  Reviewed by:  kib
  MFC after:1 week

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Sun Sep  4 08:53:58 2016(r305377)
+++ head/sys/kern/vfs_cache.c   Sun Sep  4 08:55:15 2016(r305378)
@@ -433,6 +433,50 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n
 #endif
 
 /*
+ * Negative entries management
+ */
+static void
+cache_negative_hit(struct namecache *ncp)
+{
+
+   rw_assert(_lock, RA_WLOCKED);
+   TAILQ_REMOVE(, ncp, nc_dst);
+   TAILQ_INSERT_TAIL(, ncp, nc_dst);
+}
+
+static void
+cache_negative_insert(struct namecache *ncp)
+{
+
+   rw_assert(_lock, RA_WLOCKED);
+   MPASS(ncp->nc_vp == NULL);
+   TAILQ_INSERT_TAIL(, ncp, nc_dst);
+   numneg++;
+}
+
+static void
+cache_negative_remove(struct namecache *ncp)
+{
+
+   rw_assert(_lock, RA_WLOCKED);
+   MPASS(ncp->nc_vp == NULL);
+   TAILQ_REMOVE(, ncp, nc_dst);
+   numneg--;
+}
+
+static void
+cache_negative_zap_one(void)
+{
+   struct namecache *ncp;
+
+   rw_assert(_lock, RA_WLOCKED);
+   ncp = TAILQ_FIRST();
+   KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg",
+   ncp, ncp->nc_vp));
+   cache_zap(ncp);
+}
+
+/*
  * cache_zap():
  *
  *   Removes a namecache entry from cache, whether it contains an actual
@@ -469,8 +513,7 @@ cache_zap(struct namecache *ncp)
if (ncp == ncp->nc_vp->v_cache_dd)
ncp->nc_vp->v_cache_dd = NULL;
} else {
-   TAILQ_REMOVE(, ncp, nc_dst);
-   numneg--;
+   cache_negative_remove(ncp);
}
numcache--;
cache_free(ncp);
@@ -640,14 +683,7 @@ negative_success:
if (!wlocked && !CACHE_UPGRADE_LOCK())
goto wlock;
counter_u64_add(numneghits, 1);
-   /*
-* We found a "negative" match, so we shift it to the end of
-* the "negative" cache entries queue to satisfy LRU.  Also,
-* check to see if the entry is a whiteout; indicate this to
-* the componentname, if so.
-*/
-   TAILQ_REMOVE(, ncp, nc_dst);
-   TAILQ_INSERT_TAIL(, ncp, nc_dst);
+   cache_negative_hit(ncp);
if (ncp->nc_flag & NCF_WHITE)
cnp->cn_flags |= ISWHITEOUT;
SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp,
@@ -759,15 +795,13 @@ cache_enter_time(struct vnode *dvp, stru
TAILQ_REMOVE(>nc_vp->v_cache_dst,
ncp, nc_dst);
} else {
-   TAILQ_REMOVE(, ncp, nc_dst);
-   numneg--;
+   cache_negative_remove(ncp);
}
if (vp != NULL) {
TAILQ_INSERT_HEAD(>v_cache_dst,
ncp, nc_dst);
} else {
-   TAILQ_INSERT_TAIL(, ncp, nc_dst);
-   numneg++;
+   cache_negative_insert(ncp);
}
ncp->nc_vp = vp;
CACHE_WUNLOCK();
@@ -893,17 +927,12 @@ cache_enter_time(struct vnode *dvp, stru
} else {
if (cnp->cn_flags & ISWHITEOUT)
ncp->nc_flag |= NCF_WHITE;
-   TAILQ_INSERT_TAIL(, ncp, nc_dst);
-   numneg++;
+   cache_negative_insert(ncp);
SDT_PROBE2(vfs, namecache, enter_negative, done, dvp,
nc_get_name(ncp));
}
-   if (numneg * ncnegfactor > numcache) {
-   ncp = TAILQ_FIRST();
-   KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg",
-   ncp, ncp->nc_vp));
-   cache_zap(ncp);
-   }
+   if (numneg * ncnegfactor > numcache)
+   cache_negative_zap_one();
CACHE_WUNLOCK();
 }
 
___
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: r305377 - stable/11/sys/boot/efi/libefi

2016-09-04 Thread Emmanuel Vadot
Author: manu
Date: Sun Sep  4 08:53:58 2016
New Revision: 305377
URL: https://svnweb.freebsd.org/changeset/base/305377

Log:
  MFC 304222
  
  Only use WaitForKeys event if it exists, this is not the case in u-boot efi 
implementation.

Modified:
  stable/11/sys/boot/efi/libefi/efi_console.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/efi/libefi/efi_console.c
==
--- stable/11/sys/boot/efi/libefi/efi_console.c Sun Sep  4 08:52:09 2016
(r305376)
+++ stable/11/sys/boot/efi/libefi/efi_console.c Sun Sep  4 08:53:58 2016
(r305377)
@@ -438,8 +438,10 @@ efi_cons_getchar()
 
/* Try to read a key stroke. We wait for one if none is pending. */
status = conin->ReadKeyStroke(conin, );
-   if (status == EFI_NOT_READY) {
-   BS->WaitForEvent(1, >WaitForKey, );
+   while (status == EFI_NOT_READY) {
+   /* Some EFI implementation (u-boot for example) do not support 
WaitForKey */
+   if (conin->WaitForKey != NULL)
+   BS->WaitForEvent(1, >WaitForKey, );
status = conin->ReadKeyStroke(conin, );
}
switch (key.ScanCode) {
@@ -454,6 +456,9 @@ efi_cons_getchar()
 int
 efi_cons_poll()
 {
+
+   if (conin->WaitForKey == NULL)
+   return (1);
/* This can clear the signaled state. */
return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS);
 }
___
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: r305376 - stable/11/sys/boot/efi/boot1

2016-09-04 Thread Emmanuel Vadot
Author: manu
Date: Sun Sep  4 08:52:09 2016
New Revision: 305376
URL: https://svnweb.freebsd.org/changeset/base/305376

Log:
  MFC 304221 and 304271
  
  Use %ju modifier for u_int64_t and %jd modifier for off_t.
  off_t is long long on arm32 and long on amd64
  
  Correctly print and cast u_int64_t and off_t.

Modified:
  stable/11/sys/boot/efi/boot1/ufs_module.c
  stable/11/sys/boot/efi/boot1/zfs_module.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/efi/boot1/ufs_module.c
==
--- stable/11/sys/boot/efi/boot1/ufs_module.c   Sun Sep  4 01:47:21 2016
(r305375)
+++ stable/11/sys/boot/efi/boot1/ufs_module.c   Sun Sep  4 08:52:09 2016
(r305376)
@@ -56,9 +56,9 @@ dskread(void *buf, u_int64_t lba, int nb
devinfo->dev->Media->MediaId, lba, size, buf);
 
if (status != EFI_SUCCESS) {
-   DPRINTF("dskread: failed dev: %p, id: %u, lba: %lu, size: %d, "
+   DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, "
"status: %lu\n", devinfo->dev,
-   devinfo->dev->Media->MediaId, lba, size,
+   devinfo->dev->Media->MediaId, (uintmax_t)lba, size,
EFI_ERROR_CODE(status));
return (-1);
}

Modified: stable/11/sys/boot/efi/boot1/zfs_module.c
==
--- stable/11/sys/boot/efi/boot1/zfs_module.c   Sun Sep  4 01:47:21 2016
(r305375)
+++ stable/11/sys/boot/efi/boot1/zfs_module.c   Sun Sep  4 08:52:09 2016
(r305376)
@@ -53,10 +53,10 @@ vdev_read(vdev_t *vdev, void *priv, off_
status = devinfo->dev->ReadBlocks(devinfo->dev,
devinfo->dev->Media->MediaId, lba, bytes, buf);
if (status != EFI_SUCCESS) {
-   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %zu, size: 
%zu,"
-" status: %lu\n", devinfo->dev,
-devinfo->dev->Media->MediaId, lba, bytes,
-EFI_ERROR_CODE(status));
+   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %jd, size: 
%zu,"
+   " status: %lu\n", devinfo->dev,
+   devinfo->dev->Media->MediaId, (intmax_t)lba, bytes,
+   EFI_ERROR_CODE(status));
return (-1);
}
 
___
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"