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

2016-08-23 Thread Bruce Evans
Author: bde
Date: Wed Aug 24 05:54:11 2016
New Revision: 304735
URL: https://svnweb.freebsd.org/changeset/base/304735

Log:
  Fix key delay and repeat, part 2.
  
  Use sbintime_t timeouts with precision control to get very accurate
  timing.  It costs little to always ask for about 1% accuracy, and the
  not so new event timer implementation usual delivers that, and when
  it can't it gets much closer than our previous coarse timeouts and
  buggy simple countdown.
  
  The 2 fastest atkbd repeat rates have periods 34 and 38 msec, and ukbd
  pretended to support rates in between these.  This requires
  sub-microsecond precision and accuracy even to handle the 4 msec
  difference very well, but ukbd asked the timeout subsystem for timeouts
  of 25 msec and the buggy simple countdown of this gave a a wide range
  of precisions and accuracies depending on HZ and other timer
  configuration (sometimes better than 25 msec but usually more like 50
  msec).  We now ask for and usually get precision and accuracy of about
  1% for each repeat and much better on average.
  
  The 1% accuracy is overkill.  Rounding of 30 cps to 34 msec instead of
  33 already gives an error of +2% instead of -1%, and ut AT keyboards on
  PS/2 interfaces have similar errors.
  
  A timeout is now scheduled for every keypress and release.  This allows
  some simplifications that are not done.  It allows removing the timeout
  scheduling for exiting polled mode where it was unsafe in ddb mode.  This
  is done.  Exiting polled mode had some problems with extra repeats.  Now
  exiting polled mode lets an extra timeout fire and the state is fudged
  so that the timeout handler does very little.
  
  The sc->time_ms variable is unsigned to avoid overflow.  Differences of
  it need to be signed.  Signed comparisons were emulated by testing an
  emulated sign bits.  This only works easily for '<' comparisonss, but
  we now need a '<=' comparison.  Change the difference variable to
  signed and use a signed comparison.  Using unsigned types here didn't
  prevent overflow bugs but just reduced them.  Overflow occurs with
  n repeats at the silly repeat period of [U]INT_MAX / n.  The old countdown
  had an off by 1 error, and the simplifications would simply count down
  1 to 0 and not need to accumulate possibly-large repeat repeats.

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

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Wed Aug 24 05:01:20 2016
(r304734)
+++ head/sys/dev/usb/input/ukbd.c   Wed Aug 24 05:54:11 2016
(r304735)
@@ -163,6 +163,8 @@ struct ukbd_softc {
struct usb_interface *sc_iface;
struct usb_xfer *sc_xfer[UKBD_N_TRANSFER];
 
+   sbintime_t sc_co_basetime;
+   int sc_delay;
uint32_t sc_ntime[UKBD_NKEYCODE];
uint32_t sc_otime[UKBD_NKEYCODE];
uint32_t sc_input[UKBD_IN_BUF_SIZE];/* input buffer */
@@ -182,7 +184,6 @@ struct ukbd_softc {
 #defineUKBD_FLAG_APPLE_EJECT   0x0040
 #defineUKBD_FLAG_APPLE_FN  0x0080
 #defineUKBD_FLAG_APPLE_SWAP0x0100
-#defineUKBD_FLAG_TIMER_RUNNING 0x0200
 #defineUKBD_FLAG_CTRL_L0x0400
 #defineUKBD_FLAG_CTRL_R0x0800
 #defineUKBD_FLAG_SHIFT_L   0x1000
@@ -393,8 +394,14 @@ ukbd_any_key_pressed(struct ukbd_softc *
 static void
 ukbd_start_timer(struct ukbd_softc *sc)
 {
-   sc->sc_flags |= UKBD_FLAG_TIMER_RUNNING;
-   usb_callout_reset(>sc_callout, hz / 40, _timeout, sc);
+   sbintime_t delay, prec;
+
+   delay = SBT_1MS * sc->sc_delay;
+   sc->sc_co_basetime += delay;
+   /* This is rarely called, so prefer precision to efficiency. */
+   prec = qmin(delay >> 7, SBT_1MS * 10);
+   callout_reset_sbt(>sc_callout.co, sc->sc_co_basetime, prec,
+   ukbd_timeout, sc, C_ABSOLUTE);
 }
 
 static void
@@ -503,10 +510,11 @@ ukbd_get_key(struct ukbd_softc *sc, uint
 static void
 ukbd_interrupt(struct ukbd_softc *sc)
 {
+   struct timeval ctv;
uint32_t n_mod;
uint32_t o_mod;
uint32_t now = sc->sc_time_ms;
-   uint32_t dtime;
+   int32_t dtime;
uint8_t key;
uint8_t i;
uint8_t j;
@@ -564,7 +572,7 @@ rfound: ;
sc->sc_ntime[i] = sc->sc_otime[j];
dtime = (sc->sc_otime[j] - now);
 
-   if (!(dtime & 0x8000)) {
+   if (dtime > 0) {
/* time has not elapsed */
goto pfound;
}
@@ -572,6 +580,15 @@ rfound:;
break;
}
}
+   if (j < UKBD_NKEYCODE) {
+   /* Old key repeating. */
+  

svn commit: r304730 - head/sys/dev/hyperv/utilities

2016-08-23 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 24 04:36:04 2016
New Revision: 304730
URL: https://svnweb.freebsd.org/changeset/base/304730

Log:
  hyperv/ic: Redefine IC version negotiate message.
  
  And stringent input IC version negotiate message checks.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7614

Added:
  head/sys/dev/hyperv/utilities/vmbus_icreg.h   (contents, props changed)
Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/utilities/hv_util.h

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cWed Aug 24 04:33:21 
2016(r304729)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cWed Aug 24 04:36:04 
2016(r304730)
@@ -80,7 +80,11 @@ hv_heartbeat_cb(struct vmbus_channel *ch
[sizeof(struct hv_vmbus_pipe_hdr)];
 
if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) {
-   hv_negotiate_version(icmsghdrp, buf);
+   int error;
+
+   error = vmbus_ic_negomsg(softc, buf, recvlen);
+   if (error)
+   return;
} else {
heartbeat_msg =
(struct hv_vmbus_heartbeat_msg_data *)

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Aug 24 04:33:21 2016
(r304729)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Aug 24 04:36:04 2016
(r304730)
@@ -85,7 +85,11 @@ hv_shutdown_cb(struct vmbus_channel *cha
[sizeof(struct hv_vmbus_pipe_hdr)];
 
if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) {
-   hv_negotiate_version(icmsghdrp, buf);
+   int error;
+
+   error = vmbus_ic_negomsg(softc, buf, recv_len);
+   if (error)
+   return;
} else {
shutdown_msg =
(struct hv_vmbus_shutdown_msg_data *)

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Wed Aug 24 04:33:21 2016
(r304729)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Wed Aug 24 04:36:04 2016
(r304730)
@@ -160,7 +160,11 @@ hv_timesync_cb(struct vmbus_channel *cha
sizeof(struct hv_vmbus_pipe_hdr)];
 
if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) {
-   hv_negotiate_version(icmsghdrp, time_buf);
+   int error;
+
+   error = vmbus_ic_negomsg(>util_sc, time_buf, recvlen);
+   if (error)
+   return;
} else {
timedatap = (struct hv_ictimesync_data *) _buf[
sizeof(struct hv_vmbus_pipe_hdr) +

Modified: head/sys/dev/hyperv/utilities/hv_util.c
==
--- head/sys/dev/hyperv/utilities/hv_util.c Wed Aug 24 04:33:21 2016
(r304729)
+++ head/sys/dev/hyperv/utilities/hv_util.c Wed Aug 24 04:36:04 2016
(r304730)
@@ -36,44 +36,62 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 
 #define VMBUS_IC_BRSIZE(4 * PAGE_SIZE)
 
-void
-hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf)
+CTASSERT(sizeof(struct vmbus_icmsg_negotiate) < VMBUS_IC_BRSIZE);
+
+int
+vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int dlen)
 {
-   struct hv_vmbus_icmsg_negotiate *negop;
+   struct vmbus_icmsg_negotiate *nego;
+   int cnt, major;
 
-   icmsghdrp->icmsgsize = 0x10;
+   /*
+* Preliminary message size verification
+*/
+   if (dlen < sizeof(*nego)) {
+   device_printf(sc->ic_dev, "truncated ic negotiate, len %d\n",
+   dlen);
+   return EINVAL;
+   }
+   nego = data;
 
-   negop = (struct hv_vmbus_icmsg_negotiate *)[
-   sizeof(struct hv_vmbus_pipe_hdr) +
-   sizeof(struct hv_vmbus_icmsg_hdr)];
-
-   if (negop->icframe_vercnt >= 2 &&
-   negop->icversion_data[1].major == 3) {
-   negop->icversion_data[0].major = 3;
-   negop->icversion_data[0].minor = 0;
-   negop->icversion_data[1].major = 3;
-   negop->icversion_data[1].minor = 0;
-   } else {
-   negop->icversion_data[0].major = 1;
-   negop->icversion_data[0].minor = 0;
-   negop->icversion_data[1].major = 1;
-

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

2016-08-23 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 24 04:21:15 2016
New Revision: 304728
URL: https://svnweb.freebsd.org/changeset/base/304728

Log:
  hyperv/hn: Log a warning for RESET_CMPLT.
  
  RESET is not used by the hn(4) at all, and RESET_CMPLT does not even
  have a rid to match with the pending requests.  So, let's put it
  onto an independent switch branch and log a warning about it.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7602

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

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 24 03:51:40 
2016(r304727)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 24 04:21:15 
2016(r304728)
@@ -324,16 +324,9 @@ hv_rf_receive_response(rndis_device *dev
memcpy(>response_msg, response,
response->msg_len);
} else {
-   if (response->ndis_msg_type == REMOTE_NDIS_RESET_CMPLT) 
{
-   /* Does not have a request id field */
-   request->response_msg.msg.reset_complete.status 
=
-   STATUS_BUFFER_OVERFLOW;
-   } else {
-   request->response_msg.msg.init_complete.status =
-   STATUS_BUFFER_OVERFLOW;
-   }
+   request->response_msg.msg.init_complete.status =
+   STATUS_BUFFER_OVERFLOW;
}
-
sema_post(>wait_sema);
}
 }
@@ -566,29 +559,40 @@ hv_rf_on_receive(struct hn_softc *sc, st
 
rndis_hdr = data;
switch (rndis_hdr->ndis_msg_type) {
-
/* data message */
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_RESET_CMPLT:
case REMOTE_NDIS_KEEPALIVE_CMPLT:
hv_rf_receive_response(rndis_dev, rndis_hdr);
break;
+
/* notification message */
case REMOTE_NDIS_INDICATE_STATUS_MSG:
hv_rf_receive_indicate_status(rndis_dev, rndis_hdr);
break;
+
+   case REMOTE_NDIS_RESET_CMPLT:
+   /*
+* Reset completed, no rid.
+*
+* NOTE:
+* RESET is not issued by hn(4), so this message should
+* _not_ be observed.
+*/
+   if_printf(sc->hn_ifp, "RESET CMPLT received\n");
+   break;
+
default:
-   printf("hv_rf_on_receive():  Unknown msg_type 0x%x\n",
+   if_printf(sc->hn_ifp, "unknown RNDIS message 0x%x\n",
rndis_hdr->ndis_msg_type);
break;
}
-
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304727 - in head/sys/powerpc: booke include

2016-08-23 Thread Justin Hibbits
Author: jhibbits
Date: Wed Aug 24 03:51:40 2016
New Revision: 304727
URL: https://svnweb.freebsd.org/changeset/base/304727

Log:
  Fix system hang when large FDT is in use
  
  Summary:
  Kernel maps only one page of FDT. When FDT is more than one page in size, data
  TLB miss occurs on memmove() when FDT is moved to kernel storage
  (sys/powerpc/booke/booke_machdep.c, booke_init())
  
  This introduces a pmap_early_io_unmap() to complement pmap_early_io_map(), 
which
  can be used for any early I/O mapping, but currently is only used when mapping
  the fdt.
  
  Submitted by: Ivan Krivonos 
  Differential Revision: https://reviews.freebsd.org/D7605

Modified:
  head/sys/powerpc/booke/booke_machdep.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/include/pmap.h

Modified: head/sys/powerpc/booke/booke_machdep.c
==
--- head/sys/powerpc/booke/booke_machdep.c  Wed Aug 24 03:44:20 2016
(r304726)
+++ head/sys/powerpc/booke/booke_machdep.c  Wed Aug 24 03:51:40 2016
(r304727)
@@ -249,6 +249,7 @@ static int
 booke_check_for_fdt(uint32_t arg1, vm_offset_t *dtbp)
 {
void *ptr;
+   int fdt_size;
 
if (arg1 % 8 != 0)
return (-1);
@@ -257,6 +258,19 @@ booke_check_for_fdt(uint32_t arg1, vm_of
if (fdt_check_header(ptr) != 0)
return (-1);
 
+   /*
+* Read FDT total size from the header of FDT.
+* This for sure hits within first page which is
+* already mapped.
+*/
+   fdt_size = fdt_totalsize((void *)ptr);
+
+   /* 
+* Ok, arg1 points to FDT, so we need to map it in.
+* First, unmap this page and then map FDT again with full size
+*/
+   pmap_early_io_unmap((vm_offset_t)ptr, PAGE_SIZE);
+   ptr = (void *)pmap_early_io_map(arg1, fdt_size); 
*dtbp = (vm_offset_t)ptr;
 
return (0);

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Wed Aug 24 03:44:20 2016
(r304726)
+++ head/sys/powerpc/booke/pmap.c   Wed Aug 24 03:51:40 2016
(r304727)
@@ -3419,6 +3419,29 @@ tlb1_init()
set_mas4_defaults();
 }
 
+void
+pmap_early_io_unmap(vm_offset_t va, vm_size_t size)
+{
+   int i;
+   tlb_entry_t e;
+
+   for (i = 0; i < TLB1_ENTRIES && size > 0; i ++) {
+   tlb1_read_entry(, i);
+   if (!(e.mas1 & MAS1_VALID))
+   continue;
+   /*
+* FIXME: this code does not work if VA region
+* spans multiple TLB entries. This does not cause
+* problems right now but shall be fixed in the future
+*/
+   if (va >= e.virt && (va + size) <= (e.virt + e.size)) {
+   size -= e.size;
+   e.mas1 &= ~MAS1_VALID;
+   tlb1_write_entry(, i);
+   }
+   }
+}  
+   
 vm_offset_t 
 pmap_early_io_map(vm_paddr_t pa, vm_size_t size)
 {

Modified: head/sys/powerpc/include/pmap.h
==
--- head/sys/powerpc/include/pmap.h Wed Aug 24 03:44:20 2016
(r304726)
+++ head/sys/powerpc/include/pmap.h Wed Aug 24 03:51:40 2016
(r304727)
@@ -260,6 +260,7 @@ extern  vm_offset_t msgbuf_phys;
 extern int pmap_bootstrapped;
 
 vm_offset_t pmap_early_io_map(vm_paddr_t pa, vm_size_t size);
+void pmap_early_io_unmap(vm_offset_t va, vm_size_t size);
 
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-23 Thread Kevin Lo
Author: kevlo
Date: Wed Aug 24 03:44:16 2016
New Revision: 304725
URL: https://svnweb.freebsd.org/changeset/base/304725

Log:
  Bring datasheet URL up to date.

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

Modified: head/sys/dev/usb/input/uep.c
==
--- head/sys/dev/usb/input/uep.cWed Aug 24 03:28:58 2016
(r304724)
+++ head/sys/dev/usb/input/uep.cWed Aug 24 03:44:16 2016
(r304725)
@@ -27,7 +27,7 @@
  */
 
 /*
- *  
http://home.eeti.com.tw/web20/drivers/Software%20Programming%20Guide_v2.0.pdf
+ *  http://www.eeti.com.tw/pdf/Software%20Programming%20Guide_v2.0.pdf
  */
 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-23 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 24 03:28:58 2016
New Revision: 304724
URL: https://svnweb.freebsd.org/changeset/base/304724

Log:
  hyperv/hn: Remove the redundant rid setting for RNDIS HALT.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7595

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

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 24 03:16:25 
2016(r304723)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 24 03:28:58 
2016(r304724)
@@ -928,7 +928,6 @@ static int
 hv_rf_halt_device(rndis_device *device)
 {
rndis_request *request;
-   rndis_halt_request *halt;
int i, ret;
 
/* Attempt to do a rndis device halt */
@@ -941,12 +940,6 @@ hv_rf_halt_device(rndis_device *device)
/* initialize "poor man's semaphore" */
request->halt_complete_flag = 0;
 
-   /* Set up the rndis set */
-   halt = >request_msg.msg.halt_request;
-   halt->request_id = atomic_fetchadd_int(>new_request_id, 1);
-   /* Increment to get the new value (call above returns old value) */
-   halt->request_id += 1;
-   
ret = hv_rf_send_request(device, request, REMOTE_NDIS_HALT_MSG);
if (ret != 0) {
return (-1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304723 - head/sys/net

2016-08-23 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 24 03:16:25 2016
New Revision: 304723
URL: https://svnweb.freebsd.org/changeset/base/304723

Log:
  net/rndis: Fix RNDIS_STATUS_PENDING definition.
  
  While I'm here, sort the RNDIS status in ascending order.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7594

Modified:
  head/sys/net/rndis.h

Modified: head/sys/net/rndis.h
==
--- head/sys/net/rndis.hWed Aug 24 03:08:13 2016(r304722)
+++ head/sys/net/rndis.hWed Aug 24 03:16:25 2016(r304723)
@@ -27,15 +27,15 @@
 #defineRNDIS_VERSION_MAJOR 0x0001
 #defineRNDIS_VERSION_MINOR 0x
 
-#defineRNDIS_STATUS_BUFFER_OVERFLOW0x8005L
-#defineRNDIS_STATUS_FAILURE0xC001L
-#defineRNDIS_STATUS_INVALID_DATA   0xC0010015L
+#defineRNDIS_STATUS_SUCCESS0xL
+#defineRNDIS_STATUS_PENDING0x0103L
 #defineRNDIS_STATUS_MEDIA_CONNECT  0x4001000BL
 #defineRNDIS_STATUS_MEDIA_DISCONNECT   0x4001000CL
+#defineRNDIS_STATUS_BUFFER_OVERFLOW0x8005L
+#defineRNDIS_STATUS_FAILURE0xC001L
 #defineRNDIS_STATUS_NOT_SUPPORTED  0xC0BBL
-#defineRNDIS_STATUS_PENDINGSTATUS_PENDING  /* XXX */
 #defineRNDIS_STATUS_RESOURCES  0xC09AL
-#defineRNDIS_STATUS_SUCCESS0xL
+#defineRNDIS_STATUS_INVALID_DATA   0xC0010015L
 
 #defineOID_GEN_SUPPORTED_LIST  0x00010101
 #defineOID_GEN_HARDWARE_STATUS 0x00010102
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304722 - in head/sys: dev/usb/net net

2016-08-23 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 24 03:08:13 2016
New Revision: 304722
URL: https://svnweb.freebsd.org/changeset/base/304722

Log:
  net/rndis: Add canonical RNDIS major/minor version as of today.
  
  Reviewed by:  hps
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7593

Modified:
  head/sys/dev/usb/net/if_urndis.c
  head/sys/net/rndis.h

Modified: head/sys/dev/usb/net/if_urndis.c
==
--- head/sys/dev/usb/net/if_urndis.cWed Aug 24 02:41:24 2016
(r304721)
+++ head/sys/dev/usb/net/if_urndis.cWed Aug 24 03:08:13 2016
(r304722)
@@ -658,7 +658,7 @@ urndis_ctrl_init(struct urndis_softc *sc
msg.rm_type = htole32(REMOTE_NDIS_INITIALIZE_MSG);
msg.rm_len = htole32(sizeof(msg));
msg.rm_rid = 0;
-   msg.rm_ver_major = htole32(1);
+   msg.rm_ver_major = htole32(RNDIS_VERSION_MAJOR);
msg.rm_ver_minor = htole32(1);
msg.rm_max_xfersz = htole32(RNDIS_RX_MAXLEN);
 

Modified: head/sys/net/rndis.h
==
--- head/sys/net/rndis.hWed Aug 24 02:41:24 2016(r304721)
+++ head/sys/net/rndis.hWed Aug 24 03:08:13 2016(r304722)
@@ -23,6 +23,10 @@
 #ifndef_NET_RNDIS_H_
 #define_NET_RNDIS_H_
 
+/* Canonical major/minor version as of 22th Aug. 2016. */
+#defineRNDIS_VERSION_MAJOR 0x0001
+#defineRNDIS_VERSION_MINOR 0x
+
 #defineRNDIS_STATUS_BUFFER_OVERFLOW0x8005L
 #defineRNDIS_STATUS_FAILURE0xC001L
 #defineRNDIS_STATUS_INVALID_DATA   0xC0010015L
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Bruce Evans

On Tue, 23 Aug 2016, Ngie Cooper (yaneurabeya) wrote:


On Aug 23, 2016, at 13:57, Bryan Drewery  wrote:

...


Well yours only supports stable/10+ and not 9- with the older merge style.


*shrugs* The older method promoted broken mergeinfo? The method I wrote 
up works fine with ^/stable/9- ? just with non-sparse checkouts (I don?t 
recommend sparse checkouts, again because it can screw up mergeinfo) :).


I have to/want to use a very sparse checkout.  Currently 19MB.  This
doesn't seem to have caused any problems so far, except I somehow got
.svn databases in the most active subdirs.

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

svn commit: r304721 - head/usr.sbin/ntp/doc

2016-08-23 Thread Cy Schubert
Author: cy
Date: Wed Aug 24 02:41:24 2016
New Revision: 304721
URL: https://svnweb.freebsd.org/changeset/base/304721

Log:
  Fixup man page formatting.
  
  Submitted by: Steve Kargl 
  Discussed with:   bjk@
  MFC after:3 days

Modified:
  head/usr.sbin/ntp/doc/sntp.8

Modified: head/usr.sbin/ntp/doc/sntp.8
==
--- head/usr.sbin/ntp/doc/sntp.8Wed Aug 24 02:32:40 2016
(r304720)
+++ head/usr.sbin/ntp/doc/sntp.8Wed Aug 24 02:41:24 2016
(r304721)
@@ -213,7 +213,7 @@ of seconds specified before giving up.  
 more than enough for a unicast response.  If \fBsntp\fP is
 only waiting for a broadcast response a longer timeout is
 likely needed.
-.It  Fl \-wait , " Fl \-no\-wait"
+.It  Fl \-wait , Fl \-no\-wait
 Wait for pending replies (if not setting the time).
 The \fIno\-wait\fP form will disable the option.
 This option is enabled by default.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304713 - head/sys/netinet6

2016-08-23 Thread Mike Karels
Author: karels
Date: Wed Aug 24 00:52:30 2016
New Revision: 304713
URL: https://svnweb.freebsd.org/changeset/base/304713

Log:
  Fix L2 caching for UDP over IPv6
  
  ip6_output() was missing cache invalidation code analougous to
  ip_output.c. r304545 disabled L2 caching for UDP/IPv6 as a workaround.
  This change adds the missing cache invalidation code and reverts
  r304545.
  
  Reviewed by:  gnn
  Approved by:  gnn (mentor)
  Tested by:peter@, Mike Andrews
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D7591

Modified:
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Wed Aug 24 00:02:20 2016
(r304712)
+++ head/sys/netinet6/ip6_output.c  Wed Aug 24 00:52:30 2016
(r304713)
@@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -552,6 +553,9 @@ again:
rt = ro->ro_rt;
ifp = ro->ro_rt->rt_ifp;
} else {
+   if (ro->ro_lle)
+   LLE_FREE(ro->ro_lle);   /* zeros ro_lle */
+   ro->ro_lle = NULL;
if (fwd_tag == NULL) {
bzero(_sa, sizeof(dst_sa));
dst_sa.sin6_family = AF_INET6;
@@ -821,6 +825,9 @@ again:
} else {
RO_RTFREE(ro);
needfiblookup = 1; /* Redo the routing table lookup. */
+   if (ro->ro_lle)
+   LLE_FREE(ro->ro_lle);   /* zeros ro_lle */
+   ro->ro_lle = NULL;
}
}
/* See if fib was changed by packet filter. */
@@ -829,6 +836,9 @@ again:
fibnum = M_GETFIB(m);
RO_RTFREE(ro);
needfiblookup = 1;
+   if (ro->ro_lle)
+   LLE_FREE(ro->ro_lle);   /* zeros ro_lle */
+   ro->ro_lle = NULL;
}
if (needfiblookup)
goto again;

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Wed Aug 24 00:02:20 2016
(r304712)
+++ head/sys/netinet6/udp6_usrreq.c Wed Aug 24 00:52:30 2016
(r304713)
@@ -898,7 +898,7 @@ udp6_output(struct inpcb *inp, struct mb
 
UDP_PROBE(send, NULL, inp, ip6, inp, udp6);
UDPSTAT_INC(udps_opackets);
-   error = ip6_output(m, optp, NULL, flags,
+   error = ip6_output(m, optp, >inp_route6, flags,
inp->in6p_moptions, NULL, inp);
break;
case AF_INET:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304712 - head/lib/libc/gen

2016-08-23 Thread Brooks Davis
Author: brooks
Date: Wed Aug 24 00:02:20 2016
New Revision: 304712
URL: https://svnweb.freebsd.org/changeset/base/304712

Log:
  Avoid a redecleartion of __getosreldate().
  
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/libc/gen/__getosreldate.c

Modified: head/lib/libc/gen/__getosreldate.c
==
--- head/lib/libc/gen/__getosreldate.c  Wed Aug 24 00:00:54 2016
(r304711)
+++ head/lib/libc/gen/__getosreldate.c  Wed Aug 24 00:02:20 2016
(r304712)
@@ -33,8 +33,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "libc_private.h"
 
-int __getosreldate(void);
-
 /*
  * This is private to libc.  It is intended for wrapping syscall stubs in order
  * to avoid having to put SIGSYS signal handlers in place to test for presence
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304711 - head/contrib/binutils/bfd

2016-08-23 Thread Brooks Davis
Author: brooks
Date: Wed Aug 24 00:00:54 2016
New Revision: 304711
URL: https://svnweb.freebsd.org/changeset/base/304711

Log:
  Spell MIPS more traditionally in "bfd_elf32_ntradbigmips_vec".
  
  Sponsored by: DAPRA, AFRL

Modified:
  head/contrib/binutils/bfd/config.bfd

Modified: head/contrib/binutils/bfd/config.bfd
==
--- head/contrib/binutils/bfd/config.bfdTue Aug 23 22:26:50 2016
(r304710)
+++ head/contrib/binutils/bfd/config.bfdWed Aug 24 00:00:54 2016
(r304711)
@@ -875,11 +875,11 @@ case "${targ}" in
 ;;
   mips*el-*-freebsd*)
 targ_defvec=bfd_elf32_tradlittlemips_vec
-targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf32_ntradbigmisp_vec 
bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec 
bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
+targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf32_ntradbigmips_vec 
bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec 
bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
 ;;
   mips*-*-freebsd*)
 targ_defvec=bfd_elf32_tradbigmips_vec
-targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmisp_vec 
bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec 
bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
+targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmips_vec 
bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec 
bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
 ;;
   mips*-dec-* | mips*el-*-ecoff*)
 targ_defvec=ecoff_little_vec
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304710 - head/sys/arm/allwinner

2016-08-23 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 23 22:26:50 2016
New Revision: 304710
URL: https://svnweb.freebsd.org/changeset/base/304710

Log:
  Allwinner: Add thermal sensor driver for A10/A20
  The thermal sensor lives in the touch screen controller. Touch screen part
  isn't done for now.
  Temperature is read every ~2 seconds and exposed via sysctl.

Added:
  head/sys/arm/allwinner/aw_ts.c   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner

Added: head/sys/arm/allwinner/aw_ts.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/aw_ts.c  Tue Aug 23 22:26:50 2016
(r304710)
@@ -0,0 +1,230 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Allwinner Touch Sreen driver
+ * Touch screen part is not done, only the thermal sensor part is.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#defineREAD(_sc, _r) bus_read_4((_sc)->res[0], (_r))
+#defineWRITE(_sc, _r, _v) bus_write_4((_sc)->res[0], (_r), (_v))
+
+/* Control register 0 */
+#defineTP_CTRL00x00
+#define TP_CTRL0_TACQ(x)   ((x & 0xFF) << 0)
+#define TP_CTRL0_FS_DIV(x) ((x & 0xF) << 16)
+#define TP_CTRL0_CLK_DIV(x)((x & 0x3) << 20)
+#define TP_CTRL0_CLK_SELECT(x) ((x & 0x1) << 22)
+
+/* Control register 1 */
+#defineTP_CTRL10x04
+#define TP_CTRL1_MODE_EN   (1 << 4)
+
+/* Control register 2 */
+#defineTP_CTRL20x08
+
+/* Control register 3 */
+#defineTP_CTRL30x0C
+
+/* Int/FIFO control register */
+#defineTP_FIFOC0x10
+#define TP_FIFOC_TEMP_IRQ_ENABLE   (1 << 18)
+
+/* Int/FIFO status register */
+#defineTP_FIFOS0x14
+#define TP_FIFOS_TEMP_IRQ_PENDING  (1 << 18)
+
+/* Temperature Period Register */
+#defineTP_TPR  0x18
+#define TP_TPR_TEMP_EN (1 << 16)
+#define TP_TPR_TEMP_PERIOD(x)  (x << 0)
+
+/* Common data register */
+#defineTP_CDAT 0x1C
+
+/* Temperature data register */
+#defineTEMP_DATA   0x20
+
+/* TP Data register*/
+#defineTP_DATA 0x24
+
+/* TP IO config register */
+#defineTP_IO_CONFIG0x28
+
+/* TP IO port data register */
+#defineTP_IO_DATA  0x2C
+
+struct aw_ts_softc {
+   device_tdev;
+   struct resource *   res[2];
+   void *  intrhand;
+   int temp_data;
+   int temp_offset;
+   int temp_step;
+};
+
+static struct resource_spec aw_ts_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE | RF_SHAREABLE },
+   { -1, 0 }
+};
+
+#defineA10_TS  1
+#defineA13_TS  2
+
+#defineAW_TS_TEMP_SYSCTL   1
+
+static struct ofw_compat_data compat_data[] = {
+   {"allwinner,sun4i-a10-ts", A10_TS},
+   {"allwinner,sun5i-a13-ts", A13_TS},
+   {NULL, 0}
+};
+
+static void
+aw_ts_intr(void *arg)
+{
+   struct aw_ts_softc *sc;
+   int val;
+
+   sc= (struct aw_ts_softc *)arg;
+
+   val = READ(sc, TP_FIFOS);
+   if (val & TP_FIFOS_TEMP_IRQ_PENDING) {
+   /* Convert the value to millicelsius then millikelvin */
+   sc->temp_data = (READ(sc, TEMP_DATA) * sc->temp_step - 
sc->temp_offset)

Re: svn commit: r304703 - head/include/xlocale

2016-08-23 Thread Andrey Chernov
On 23.08.2016 23:53, Ngie Cooper (yaneurabeya) wrote:
> 
>> On Aug 23, 2016, at 13:33, Andrey A. Chernov  wrote:
>>
>> Author: ache
>> Date: Tue Aug 23 20:33:56 2016
>> New Revision: 304703
>> URL: https://svnweb.freebsd.org/changeset/base/304703
>>
>> Log:
>>  LC_*_MASK bit shifting order was partially broken from the initial commit
>>  time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the
>>  right order.
>>
>>  The order here should match XLC_* from "xlocale_private.h" which, in turn,
>>  match LC_* publicly visible order from  which determines how
>>  locale components are stored in the structure.
>>  LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale()
>>  and equivalent shift loop in the newlocale(), so mapped to some wrong
>>  components (excluding two mentioned above).
>>
>>  Formally the fix is ABI breakage, but old code using those masks
>>  never works properly in any case.
>>  Only newlocale() and querylocale() are affected.
>>
>>  MFC after:  7 days
>>
>> Modified:
>>  head/include/xlocale/_locale.h
> 
>   Should __FreeBSD_version be bumped?
> Thanks,
> -Ngie
> 

Yes, I'll do it later.




signature.asc
Description: OpenPGP digital signature


Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Florian Smeets
On 18/08/2016 02:37, Toomas Soome wrote:
> Author: tsoome
> Date: Thu Aug 18 00:37:07 2016
> New Revision: 304321
> URL: https://svnweb.freebsd.org/changeset/base/304321
> 
> Log:
>   Add SHA512, skein, large blocks support for loader zfs.
>   

Hi,

this commit seems to break booting zroot bhyve VMs. Reverting
userboot.so to 304320 on the host system makes it work again.

I start bhyve like this

/usr/share/examples/bhyve/vmrun.sh -d /dev/zvol/zroot/bhyve/poudriere -t
tap8 -c 7 -m 20G poudriere

Launching virtual machine "poudriere" ...
Consoles: userboot

FreeBSD/amd64 User boot, Revision 1.1
(r...@fry.smeets.xyz, Tue Aug 23 16:47:12 CEST 2016)
-
can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
OK lsdev -v
host devices:
host0:   Host filesystem
disk devices:
disk0:   Guest drive image
  disk0p1: FreeBSD boot512KB
  disk0p2: FreeBSD swap2048MB
  disk0p3: FreeBSD ZFS 67GB
zfs devices:
OK show
LINES=24
boot_serial=1
console=userboot
currdev=disk0p3:
interpret=OK
loaddev=disk0p3:
prompt=${interpret}
smbios.bios.vendor=BHYVE
twiddle_divisor=1
OK ls
open '/' failed: no such file or directory
OK

Here the zroot setup in the VM

root@poudriere:~ # zpool get -oname,property,value all
NAME   PROPERTY   VALUE
zroot  size   67.5G
zroot  capacity   61%
zroot  altroot-
zroot  health ONLINE
zroot  guid   13278473142560840663
zroot  version-
zroot  bootfs zroot/ROOT/default
zroot  delegation on
zroot  autoreplaceoff
zroot  cachefile  -
zroot  failmode   wait
zroot  listsnapshots  off
zroot  autoexpand off
zroot  dedupditto 0
zroot  dedupratio 1.00x
zroot  free   25.9G
zroot  allocated  41.6G
zroot  readonly   off
zroot  comment-
zroot  expandsize -
zroot  freeing0
zroot  fragmentation  67%
zroot  leaked 0
zroot  feature@async_destroy  enabled
zroot  feature@empty_bpobjactive
zroot  feature@lz4_compress   active
zroot  feature@multi_vdev_crash_dump  enabled
zroot  feature@spacemap_histogram active
zroot  feature@enabled_txgactive
zroot  feature@hole_birth active
zroot  feature@extensible_dataset enabled
zroot  feature@embedded_data  active
zroot  feature@bookmarks  enabled
zroot  feature@filesystem_limits  enabled
zroot  feature@large_blocks   disabled
zroot  feature@sha512 disabled
zroot  feature@skein  disabled

root@poudriere:~ # zfs get all zroot/ROOT/default
NAMEPROPERTY  VALUE  SOURCE
zroot/ROOT/default  type  filesystem -
zroot/ROOT/default  creation  Sun Jul 27 16:32 2014  -
zroot/ROOT/default  used  7.12G  -
zroot/ROOT/default  available 23.8G  -
zroot/ROOT/default  referenced7.12G  -
zroot/ROOT/default  compressratio 2.18x  -
zroot/ROOT/default  mounted   yes-
zroot/ROOT/default  quota none   default
zroot/ROOT/default  reservation   none   default
zroot/ROOT/default  recordsize128K   default
zroot/ROOT/default  mountpoint/  local
zroot/ROOT/default  sharenfs  offdefault
zroot/ROOT/default  checksum  on default
zroot/ROOT/default  compression   lz4
inherited from zroot
zroot/ROOT/default  atime off
inherited from zroot
zroot/ROOT/default  devices   on default
zroot/ROOT/default  exec  on default
zroot/ROOT/default  setuidon default
zroot/ROOT/default  readonly  offdefault
zroot/ROOT/default  jailedoffdefault
zroot/ROOT/default  snapdir   hidden default
zroot/ROOT/default  aclmode   discarddefault
zroot/ROOT/default  aclinheritrestricted default
zroot/ROOT/default  canmount  on default
zroot/ROOT/default  xattr offtemporary
zroot/ROOT/default  copies1  default
zroot/ROOT/default  version   5  -

Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Ngie Cooper (yaneurabeya)

> On Aug 23, 2016, at 13:57, Bryan Drewery  wrote:

...

> Well yours only supports stable/10+ and not 9- with the older merge style.

*shrugs* The older method promoted broken mergeinfo… The method I wrote 
up works fine with ^/stable/9- — just with non-sparse checkouts (I don’t 
recommend sparse checkouts, again because it can screw up mergeinfo) :).
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Bryan Drewery
On 8/23/2016 1:49 PM, Ngie Cooper (yaneurabeya) wrote:
> 
>> On Aug 23, 2016, at 13:38, Bryan Drewery  wrote:
> 
> …
> 
>> I've written a script to do MFCing with the proper svn merge style for
>> each branch.  It's not perfect but it seems good enough.
>>
>> https://people.freebsd.org/~bdrewery/mfc.sh
>>
>> It can take multiple revisions.
>> cd svn/stable/7
>> mfc.sh r123 r124 r125
>>
>> It will merge each one at a time, invoke EDITOR for conflicts (SVN does
>> this), then opens EDITOR to edit the commit log and saves that to
>> 'commit'. You can then review and modify the commit as you like and 'svn
>> commit -F commit' when done to use the saved commit log.
>>
>> If you pass -r to it then it will also prepare an email in mutt to send
>> to r...@freebsd.org for approval to commit.
>>
>> It defaults to merging from head, but in the case of wanting to commit
>> to releng/ you need to pass -b to specify which branch to merge from,
>> such as -b stable/11 for releng/11.0 commits.
> 
> I have one that I noted a while back — it’s a bit less featureful, but it 
> works pretty well IMHO:
> 
> https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc
> https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc_log
> 
> Example usage:
> 
> ~/mfc ^/head 
> # Do whatever you need to make sure that the commit is ok.
> svn ci -F commit
> 
> The only thing it fubars is some of the spacing with some of the commit 
> messages (I don’t remember if it was with my commits being MFCed or other’s 
> commits being MFCed). I’m a bit pedantic about formatting -- that’s the only 
> reason why I haven’t posted it up earlier as an official solution for others 
> to use.
> 

Well yours only supports stable/10+ and not 9- with the older merge style.


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r304703 - head/include/xlocale

2016-08-23 Thread Ngie Cooper (yaneurabeya)

> On Aug 23, 2016, at 13:33, Andrey A. Chernov  wrote:
> 
> Author: ache
> Date: Tue Aug 23 20:33:56 2016
> New Revision: 304703
> URL: https://svnweb.freebsd.org/changeset/base/304703
> 
> Log:
>  LC_*_MASK bit shifting order was partially broken from the initial commit
>  time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the
>  right order.
> 
>  The order here should match XLC_* from "xlocale_private.h" which, in turn,
>  match LC_* publicly visible order from  which determines how
>  locale components are stored in the structure.
>  LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale()
>  and equivalent shift loop in the newlocale(), so mapped to some wrong
>  components (excluding two mentioned above).
> 
>  Formally the fix is ABI breakage, but old code using those masks
>  never works properly in any case.
>  Only newlocale() and querylocale() are affected.
> 
>  MFC after:  7 days
> 
> Modified:
>  head/include/xlocale/_locale.h

Should __FreeBSD_version be bumped?
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Ngie Cooper (yaneurabeya)

> On Aug 23, 2016, at 13:38, Bryan Drewery  wrote:

…

> I've written a script to do MFCing with the proper svn merge style for
> each branch.  It's not perfect but it seems good enough.
> 
> https://people.freebsd.org/~bdrewery/mfc.sh
> 
> It can take multiple revisions.
> cd svn/stable/7
> mfc.sh r123 r124 r125
> 
> It will merge each one at a time, invoke EDITOR for conflicts (SVN does
> this), then opens EDITOR to edit the commit log and saves that to
> 'commit'. You can then review and modify the commit as you like and 'svn
> commit -F commit' when done to use the saved commit log.
> 
> If you pass -r to it then it will also prepare an email in mutt to send
> to r...@freebsd.org for approval to commit.
> 
> It defaults to merging from head, but in the case of wanting to commit
> to releng/ you need to pass -b to specify which branch to merge from,
> such as -b stable/11 for releng/11.0 commits.

I have one that I noted a while back — it’s a bit less featureful, but it works 
pretty well IMHO:

https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc
https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc_log

Example usage:

~/mfc ^/head 
# Do whatever you need to make sure that the commit is ok.
svn ci -F commit

The only thing it fubars is some of the spacing with some of the commit 
messages (I don’t remember if it was with my commits being MFCed or other’s 
commits being MFCed). I’m a bit pedantic about formatting -- that’s the only 
reason why I haven’t posted it up earlier as an official solution for others to 
use.

Cheers,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Bryan Drewery
On 8/22/2016 1:59 AM, Bruce Evans wrote:
> On Sun, 21 Aug 2016, Hans Petter Selasky wrote:
> 
>> On 08/21/16 18:06, Bruce Evans wrote:
>>> Author: bde
>>> Date: Sun Aug 21 16:06:00 2016
>>> New Revision: 304567
>>> URL: https://svnweb.freebsd.org/changeset/base/304567
>>
>> Don't forget to MFC.
> 
> I had forgotten if for this commit.  I might do it for combined
> commits, but don't have enough svn fu for as many MFCs as I would
> like.  I want a few things back to FreeBSD-7.
> 
> Bruce
> 

I've written a script to do MFCing with the proper svn merge style for
each branch.  It's not perfect but it seems good enough.

https://people.freebsd.org/~bdrewery/mfc.sh

It can take multiple revisions.
cd svn/stable/7
mfc.sh r123 r124 r125

It will merge each one at a time, invoke EDITOR for conflicts (SVN does
this), then opens EDITOR to edit the commit log and saves that to
'commit'. You can then review and modify the commit as you like and 'svn
commit -F commit' when done to use the saved commit log.

If you pass -r to it then it will also prepare an email in mutt to send
to r...@freebsd.org for approval to commit.

It defaults to merging from head, but in the case of wanting to commit
to releng/ you need to pass -b to specify which branch to merge from,
such as -b stable/11 for releng/11.0 commits.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r304703 - head/include/xlocale

2016-08-23 Thread Andrey A. Chernov
Author: ache
Date: Tue Aug 23 20:33:56 2016
New Revision: 304703
URL: https://svnweb.freebsd.org/changeset/base/304703

Log:
  LC_*_MASK bit shifting order was partially broken from the initial commit
  time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the
  right order.
  
  The order here should match XLC_* from "xlocale_private.h" which, in turn,
  match LC_* publicly visible order from  which determines how
  locale components are stored in the structure.
  LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale()
  and equivalent shift loop in the newlocale(), so mapped to some wrong
  components (excluding two mentioned above).
  
  Formally the fix is ABI breakage, but old code using those masks
  never works properly in any case.
  Only newlocale() and querylocale() are affected.
  
  MFC after:  7 days

Modified:
  head/include/xlocale/_locale.h

Modified: head/include/xlocale/_locale.h
==
--- head/include/xlocale/_locale.h  Tue Aug 23 20:04:23 2016
(r304702)
+++ head/include/xlocale/_locale.h  Tue Aug 23 20:33:56 2016
(r304703)
@@ -32,12 +32,13 @@
 #ifndef _XLOCALE_LOCALE_H
 #define _XLOCALE_LOCALE_H
 
+/* Bit shifting order of LC_*_MASK should match XLC_* and LC_* order. */
 #define LC_COLLATE_MASK  (1<<0)
 #define LC_CTYPE_MASK(1<<1)
-#define LC_MESSAGES_MASK (1<<2)
-#define LC_MONETARY_MASK (1<<3)
-#define LC_NUMERIC_MASK  (1<<4)
-#define LC_TIME_MASK (1<<5)
+#define LC_MONETARY_MASK (1<<2)
+#define LC_NUMERIC_MASK  (1<<3)
+#define LC_TIME_MASK (1<<4)
+#define LC_MESSAGES_MASK (1<<5)
 #define LC_ALL_MASK  (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | 
\
  LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
 #define LC_GLOBAL_LOCALE ((locale_t)-1)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304699 - head/sys/dev/usb/input

2016-08-23 Thread Bruce Evans

On Tue, 23 Aug 2016, Oliver Pinter wrote:


On 8/23/16, Bruce Evans  wrote:

...
Log:
  Fix key delay and repeat, part 1.
...
  Convert 0.0 to the documented 250.34.
...

Do you plan to MFC these changes to 10-STABLE? It would be really nice
to see all of these improvements.


Maybe when I "finish".  There is now also 11-NOTQUITESTABLE.

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


svn commit: r304702 - head/tools/tools/nanobsd

2016-08-23 Thread Gleb Smirnoff
Author: glebius
Date: Tue Aug 23 20:04:23 2016
New Revision: 304702
URL: https://svnweb.freebsd.org/changeset/base/304702

Log:
  The -f check here is used to determine whether we have a single kernel
  config or a list of them.  Put the variable into quotes, to avoid syntax
  error from [ in case of list.  Without this change list is still working,
  but an error is reported in the build log file.
  
  Reviewed by:  imp

Modified:
  head/tools/tools/nanobsd/defaults.sh

Modified: head/tools/tools/nanobsd/defaults.sh
==
--- head/tools/tools/nanobsd/defaults.shTue Aug 23 19:57:37 2016
(r304701)
+++ head/tools/tools/nanobsd/defaults.shTue Aug 23 20:04:23 2016
(r304702)
@@ -227,7 +227,7 @@ nano_make_install_env ( ) {
 
 # Extra environment variables for kernel builds
 nano_make_kernel_env ( ) {
-   if [ -f ${NANO_KERNEL} ] ; then
+   if [ -f "${NANO_KERNEL}" ] ; then
KERNCONFDIR="$(realpath $(dirname ${NANO_KERNEL}))"
KERNCONF="$(basename ${NANO_KERNEL})"
make_export KERNCONFDIR
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304699 - head/sys/dev/usb/input

2016-08-23 Thread Oliver Pinter
On 8/23/16, Bruce Evans  wrote:
> Author: bde
> Date: Tue Aug 23 19:50:16 2016
> New Revision: 304699
> URL: https://svnweb.freebsd.org/changeset/base/304699
>
> Log:
>   Fix key delay and repeat, part 1.
>
>   kbdcontrol -r fast is documented to give a non-emulated atkbd's fastest
>   rate of 250.34, but is misimplemented to request this as 0.0.  ukbd
>   supports many nonstandard rates, although it is currently too inaccurate
>   by a factor of several hundred for non-huge nonstandard rates to be
>   useful.  It mapped 0.0 to 200.0.  A repeat delay of 0 means a rate of
>   infinity which is quite fast, but physical constraints limit this to
>   a few MHz and the inaccuracies made it almost usable.
>
>   Convert 0.0 to the documented 250.34.
>
>   Also convert negative args and small args to the 250.34 minimal ones,
>   like atkbd does.  This is for KDSETREPEAT -- the 2 versions of the
>   deprecated KDSETRAD have bounds checking.  Keep not doing any bounds
>   checking or conversions for upper limits since nonstandard large
>   delays are useful for testing.
>
>   The inaccuracies are dependent on HZ and the timeout implementation.
>   With the old timeout implementation and HZ = 1000, 200.0 probably
>   worked better to emulate 250.34 than 250.34 itself.  HZ = 100 gives
>   roundoff errors that accidentally reduce the inaaccuracies, and
>   event timers reduce the inaccuracies even more, so 200.0 was giving
>   more like itself (perhaps 215.15 on average but sometimes close to
>   10 msec repeat which is noticebly too fast).  This commit makes 0.0
>   noticeably too slow, like 250.34 always was.
>
> Modified:
>   head/sys/dev/usb/input/ukbd.c
>
> Modified: head/sys/dev/usb/input/ukbd.c

Hi Bruce!

Do you plan to MFC these changes to 10-STABLE? It would be really nice
to see all of these improvements.


> ==
> --- head/sys/dev/usb/input/ukbd.c Tue Aug 23 19:41:49 2016
> (r304698)
> +++ head/sys/dev/usb/input/ukbd.c Tue Aug 23 19:50:16 2016
> (r304699)
> @@ -1887,17 +1887,14 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_lon
>   if (!KBD_HAS_DEVICE(kbd)) {
>   return (0);
>   }
> - if (((int *)arg)[1] < 0) {
> - return (EINVAL);
> - }
> - if (((int *)arg)[0] < 0) {
> - return (EINVAL);
> - }
> - if (((int *)arg)[0] < 200)  /* fastest possible value */
> - kbd->kb_delay1 = 200;
> - else
> - kbd->kb_delay1 = ((int *)arg)[0];
> - kbd->kb_delay2 = ((int *)arg)[1];
> + /*
> +  * Convert negative, zero and tiny args to the same limits
> +  * as atkbd.  We could support delays of 1 msec, but
> +  * anything much shorter than the shortest atkbd value
> +  * of 250.34 is almost unusable as well as incompatible.
> +  */
> + kbd->kb_delay1 = imax(((int *)arg)[0], 250);
> + kbd->kb_delay2 = imax(((int *)arg)[1], 34);
>   return (0);
>
>  #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
> ___
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-23 Thread Bruce Evans
Author: bde
Date: Tue Aug 23 19:50:16 2016
New Revision: 304699
URL: https://svnweb.freebsd.org/changeset/base/304699

Log:
  Fix key delay and repeat, part 1.
  
  kbdcontrol -r fast is documented to give a non-emulated atkbd's fastest
  rate of 250.34, but is misimplemented to request this as 0.0.  ukbd
  supports many nonstandard rates, although it is currently too inaccurate
  by a factor of several hundred for non-huge nonstandard rates to be
  useful.  It mapped 0.0 to 200.0.  A repeat delay of 0 means a rate of
  infinity which is quite fast, but physical constraints limit this to
  a few MHz and the inaccuracies made it almost usable.
  
  Convert 0.0 to the documented 250.34.
  
  Also convert negative args and small args to the 250.34 minimal ones,
  like atkbd does.  This is for KDSETREPEAT -- the 2 versions of the
  deprecated KDSETRAD have bounds checking.  Keep not doing any bounds
  checking or conversions for upper limits since nonstandard large
  delays are useful for testing.
  
  The inaccuracies are dependent on HZ and the timeout implementation.
  With the old timeout implementation and HZ = 1000, 200.0 probably
  worked better to emulate 250.34 than 250.34 itself.  HZ = 100 gives
  roundoff errors that accidentally reduce the inaaccuracies, and
  event timers reduce the inaccuracies even more, so 200.0 was giving
  more like itself (perhaps 215.15 on average but sometimes close to
  10 msec repeat which is noticebly too fast).  This commit makes 0.0
  noticeably too slow, like 250.34 always was.

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

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Tue Aug 23 19:41:49 2016
(r304698)
+++ head/sys/dev/usb/input/ukbd.c   Tue Aug 23 19:50:16 2016
(r304699)
@@ -1887,17 +1887,14 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_lon
if (!KBD_HAS_DEVICE(kbd)) {
return (0);
}
-   if (((int *)arg)[1] < 0) {
-   return (EINVAL);
-   }
-   if (((int *)arg)[0] < 0) {
-   return (EINVAL);
-   }
-   if (((int *)arg)[0] < 200)  /* fastest possible value */
-   kbd->kb_delay1 = 200;
-   else
-   kbd->kb_delay1 = ((int *)arg)[0];
-   kbd->kb_delay2 = ((int *)arg)[1];
+   /*
+* Convert negative, zero and tiny args to the same limits
+* as atkbd.  We could support delays of 1 msec, but
+* anything much shorter than the shortest atkbd value
+* of 250.34 is almost unusable as well as incompatible.
+*/
+   kbd->kb_delay1 = imax(((int *)arg)[0], 250);
+   kbd->kb_delay2 = imax(((int *)arg)[1], 34);
return (0);
 
 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304698 - head/usr.bin/getconf

2016-08-23 Thread Garrett Cooper
Author: ngie
Date: Tue Aug 23 19:41:49 2016
New Revision: 304698
URL: https://svnweb.freebsd.org/changeset/base/304698

Log:
  Add support for _PC_ACL_NFS4 as TRUSTEDBSD_ACL_NFS4
  
  The TRUSTEDBSD prefix was chosen for consistency with the other
  related `_PC_ACL*` prefixed variables.
  
  MFC after: 3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/getconf/pathconf.gperf

Modified: head/usr.bin/getconf/pathconf.gperf
==
--- head/usr.bin/getconf/pathconf.gperf Tue Aug 23 19:37:18 2016
(r304697)
+++ head/usr.bin/getconf/pathconf.gperf Tue Aug 23 19:41:49 2016
(r304698)
@@ -35,6 +35,7 @@ POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFE
 POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN
 SYMLINK_MAX, _PC_SYMLINK_MAX
 TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED
+TRUSTEDBSD_ACL_NFS4, _PC_ACL_NFS4
 TRUSTEDBSD_ACL_PATH_MAX, _PC_ACL_PATH_MAX
 TRUSTEDBSD_CAP_PRESENT, _PC_CAP_PRESENT
 TRUSTEDBSD_INF_PRESENT, _PC_INF_PRESENT
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304697 - in head: share/mk sys/conf

2016-08-23 Thread Bryan Drewery
Author: bdrewery
Date: Tue Aug 23 19:37:18 2016
New Revision: 304697
URL: https://svnweb.freebsd.org/changeset/base/304697

Log:
  FAST_DEPEND: Fix 'make all install' not properly rebuilding based on 
.depend.* files.
  
  An optimization is in place to skip reading the .depend.* files with
  'make install'.  This was too strong and broke 'make all install' and
  'make foo.o foo install'.  Now only skip reading the dependency files
  if all make targets ran are install targets.
  
  The problem comes about because headers are only added in as a guessed
  dependency if .depend.* files do not yet exist.  If they do exist, even
  if being skipped from being read, then the header dependencies are not
  applied.  This applies to all #included files, and not just headers.
  
  Reported by:  kib
  MFC after:1 day
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/bsd.dep.mk
  head/sys/conf/kern.post.mk

Modified: head/share/mk/bsd.dep.mk
==
--- head/share/mk/bsd.dep.mkTue Aug 23 19:31:43 2016(r304696)
+++ head/share/mk/bsd.dep.mkTue Aug 23 19:37:18 2016(r304697)
@@ -76,12 +76,13 @@ tags: ${SRCS}
 _meta_filemon= 1
 .endif
 
-# Skip reading .depend when not needed to speed up tree-walks
-# and simple lookups.
+# Skip reading .depend when not needed to speed up tree-walks and simple
+# lookups.  For install, only do this if no other targets are specified.
 # Also skip generating or including .depend.* files if in meta+filemon mode
 # since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
 .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
-make(install*) || make(analyze) || defined(_meta_filemon)
+${.TARGETS:M*install*} == ${.TARGETS} || \
+make(analyze) || defined(_meta_filemon)
 _SKIP_READ_DEPEND= 1
 .if ${MK_DIRDEPS_BUILD} == "no"
 .MAKE.DEPENDFILE=  /dev/null

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Tue Aug 23 19:31:43 2016(r304696)
+++ head/sys/conf/kern.post.mk  Tue Aug 23 19:37:18 2016(r304697)
@@ -196,12 +196,13 @@ ${SYSTEM_OBJS} genassym.o vers.o: opt_gl
 .if !empty(.MAKE.MODE:Unormal:Mmeta) && empty(.MAKE.MODE:Unormal:Mnofilemon)
 _meta_filemon= 1
 .endif
-# Skip reading .depend when not needed to speed up tree-walks
-# and simple lookups.
+# Skip reading .depend when not needed to speed up tree-walks and simple
+# lookups.  For install, only do this if no other targets are specified.
 # Also skip generating or including .depend.* files if in meta+filemon mode
 # since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
 .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
-make(install*) || make(kernel-obj) || make(kernel-clean*) || \
+${.TARGETS:M*install*} == ${.TARGETS} || \
+make(kernel-obj) || make(kernel-clean*) || \
 make(kernel-install*) || defined(_meta_filemon)
 _SKIP_READ_DEPEND= 1
 .MAKE.DEPENDFILE=  /dev/null
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304696 - head/share/mk

2016-08-23 Thread Dimitry Andric
Author: dim
Date: Tue Aug 23 19:31:43 2016
New Revision: 304696
URL: https://svnweb.freebsd.org/changeset/base/304696

Log:
  In addition to creating subdirectories under .OBJDIR for SRCS with
  relative paths, also create them for DPSRCS.  This is needed for builds
  that generate files during the depend stage, which cannot be compiled by
  themselves, since those have to be put in DPSRCS.

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

Modified: head/share/mk/bsd.obj.mk
==
--- head/share/mk/bsd.obj.mkTue Aug 23 19:29:37 2016(r304695)
+++ head/share/mk/bsd.obj.mkTue Aug 23 19:31:43 2016(r304696)
@@ -102,7 +102,7 @@ obj: .PHONY
fi; \
${ECHO} "${CANONICALOBJDIR} created for ${.CURDIR}"; \
fi
-.for dir in ${SRCS:H:O:u}
+.for dir in ${SRCS:H:O:u} ${DPSRCS:H:O:u}
@if ! test -d ${CANONICALOBJDIR}/${dir}/; then \
mkdir -p ${CANONICALOBJDIR}/${dir}; \
if ! test -d ${CANONICALOBJDIR}/${dir}/; then \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304695 - head

2016-08-23 Thread Bryan Drewery
Author: bdrewery
Date: Tue Aug 23 19:29:37 2016
New Revision: 304695
URL: https://svnweb.freebsd.org/changeset/base/304695

Log:
  Fix in-tree GCC builds after r304681.
  
  There were a few issues.
  - In-tree GCC won't have X_COMPILER_TYPE defined but will have
WANT_COMPILER_TYPE==gcc set from the SYSTEM_COMPILER logic that can
be used.  Make the clang check specific to clang as well to ensure
-target doesn't leak into a GCC build.
  - When using a cross-compiler GCC (with a default sysroot or arch) and also
passing --sysroot, it basically forgets all internal paths for
libraries.  We've already worked around this quite a bit for
the external toolchains.  Now for the in-tree bootstrap cross-compiler
GCC, also pass in the needed -B${WORLDTMP}/usr/lib to find the crt
object files, but also -isystem and -L to fix the paths.  This creates
quite a spammy build log, but it is clear and still achieves the goals
and stays consistent between internal and external build flags.
Reducing the spam by using the '=' prefix feature will help and be
done later.
  
  MFC after:3 days
  X-MFC-With:   r304681
  Reported by:  bz
  Pointyhat to: bdrewery
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1
  head/Makefile.libcompat

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Aug 23 19:28:01 2016(r304694)
+++ head/Makefile.inc1  Tue Aug 23 19:29:37 2016(r304695)
@@ -572,18 +572,23 @@ TARGET_ABI=   gnueabihf
 TARGET_ABI=gnueabi
 .endif
 .endif
-.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
+.if ${WANT_COMPILER_TYPE} == gcc || \
+(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
 # GCC requires -isystem and -L when using a cross-compiler.  --sysroot
 # won't set header path and -L is used to ensure the base library path
 # is added before the port PREFIX library path.
 XCFLAGS+=  -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
+# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler
+# combined with --sysroot.
+XCFLAGS+=  -B${WORLDTMP}/usr/lib
 # Force using libc++ for external GCC.
 # XXX: This should be checking MK_GNUCXX == no
 .if ${X_COMPILER_VERSION} >= 40800
 XCXXFLAGS+=-isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \
-nostdinc++ -L${WORLDTMP}/../lib/libc++
 .endif
-.else
+.elif ${WANT_COMPILER_TYPE} == clang || \
+(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang)
 TARGET_ABI?=   unknown
 TARGET_TRIPLE?=${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0
 XCFLAGS+=  -target ${TARGET_TRIPLE}

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Tue Aug 23 19:28:01 2016(r304694)
+++ head/Makefile.libcompat Tue Aug 23 19:29:37 2016(r304695)
@@ -73,7 +73,8 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \
 # Clang/GCC.
 LIBCOMPATCFLAGS+=  -B${LIBCOMPATTMP}/usr/lib${libcompat}
 
-.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
+.if ${WANT_COMPILER_TYPE} == gcc || \
+(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
 # GCC requires -isystem when using a cross-compiler and --sysroot.  Note that
 # Makefile.inc1 only applies this with an external compiler but libcompat
 # always does since even in-tree GCC 4.2 needs this to override the built-in
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304694 - head/usr.bin/getconf

2016-08-23 Thread Garrett Cooper
Author: ngie
Date: Tue Aug 23 19:28:01 2016
New Revision: 304694
URL: https://svnweb.freebsd.org/changeset/base/304694

Log:
  Add `MIN_HOLE_SIZE` pathconf(2) support to getconf
  
  This allows shell programs to programmatically determine whether
  or not a filesystem supports sparse files
  
  MFC after: 3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/getconf/pathconf.gperf

Modified: head/usr.bin/getconf/pathconf.gperf
==
--- head/usr.bin/getconf/pathconf.gperf Tue Aug 23 19:15:01 2016
(r304693)
+++ head/usr.bin/getconf/pathconf.gperf Tue Aug 23 19:28:01 2016
(r304694)
@@ -24,6 +24,7 @@ FILESIZEBITS, _PC_FILESIZEBITS
 LINK_MAX, _PC_LINK_MAX
 MAX_CANON, _PC_MAX_CANON
 MAX_INPUT, _PC_MAX_INPUT
+MIN_HOLE_SIZE, _PC_MIN_HOLE_SIZE
 NAME_MAX, _PC_NAME_MAX
 PATH_MAX, _PC_PATH_MAX
 PIPE_BUF, _PC_PIPE_BUF
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304693 - head/usr.bin/getconf

2016-08-23 Thread Garrett Cooper
Author: ngie
Date: Tue Aug 23 19:15:01 2016
New Revision: 304693
URL: https://svnweb.freebsd.org/changeset/base/304693

Log:
  Clean up trailing whitespace
  
  MFC after: 3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/getconf/getconf.c

Modified: head/usr.bin/getconf/getconf.c
==
--- head/usr.bin/getconf/getconf.c  Tue Aug 23 19:03:11 2016
(r304692)
+++ head/usr.bin/getconf/getconf.c  Tue Aug 23 19:15:01 2016
(r304693)
@@ -109,13 +109,13 @@ main(int argc, char **argv)
do_confstr(name, key);
else
printf("undefined\n");
-   } else {
+   } else {
valid = find_sysconf(name, );
if (valid > 0) {
do_sysconf(name, key);
} else if (valid < 0) {
printf("undefined\n");
-   } else 
+   } else
errx(EX_USAGE,
 "no such configuration parameter `%s'",
 name);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304692 - head/sys/dev/bhnd/bhndb

2016-08-23 Thread Landon J. Fuller
Author: landonf
Date: Tue Aug 23 19:03:11 2016
New Revision: 304692
URL: https://svnweb.freebsd.org/changeset/base/304692

Log:
  bhndb(4): Fix unsigned integer underflow in dynamic register window
  handling. This resulted in the window target being left uninitialized
  when an underflow occured.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7617

Modified:
  head/sys/dev/bhnd/bhndb/bhndb.c

Modified: head/sys/dev/bhnd/bhndb/bhndb.c
==
--- head/sys/dev/bhnd/bhndb/bhndb.c Tue Aug 23 17:42:03 2016
(r304691)
+++ head/sys/dev/bhnd/bhndb/bhndb.c Tue Aug 23 19:03:11 2016
(r304692)
@@ -1728,8 +1728,9 @@ bhndb_io_resource(struct bhndb_softc *sc
 
/* Adjust the window if the I/O request won't fit in the current
 * target range. */
-   if (addr < dwa->target || 
-  (dwa->target + dwa->win->win_size) - addr < size)
+   if (addr < dwa->target ||
+   addr > dwa->target + dwa->win->win_size ||
+   (dwa->target + dwa->win->win_size) - addr < size)
{
error = bhndb_dw_set_addr(sc->dev, sc->bus_res, dwa, addr,
size);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304691 - head/usr.bin/bsdiff/bspatch

2016-08-23 Thread Ed Maste
Author: emaste
Date: Tue Aug 23 17:42:03 2016
New Revision: 304691
URL: https://svnweb.freebsd.org/changeset/base/304691

Log:
  bspatch: apply style(9)
  
  Make style changes (and trivial refactoring of open calls) now in order
  to reduce noise in diffs for future capsicum changes.
  
  Reviewed by:  oshogbo
  No objection: cperciva
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D7610

Modified:
  head/usr.bin/bsdiff/bspatch/bspatch.c

Modified: head/usr.bin/bsdiff/bspatch/bspatch.c
==
--- head/usr.bin/bsdiff/bspatch/bspatch.c   Tue Aug 23 17:38:06 2016
(r304690)
+++ head/usr.bin/bsdiff/bspatch/bspatch.c   Tue Aug 23 17:42:03 2016
(r304691)
@@ -28,12 +28,12 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
 #include 
-#include 
 
 #ifndef O_BINARY
 #define O_BINARY 0
@@ -43,18 +43,19 @@ static off_t offtin(u_char *buf)
 {
off_t y;
 
-   y=buf[7]&0x7F;
-   y=y*256;y+=buf[6];
-   y=y*256;y+=buf[5];
-   y=y*256;y+=buf[4];
-   y=y*256;y+=buf[3];
-   y=y*256;y+=buf[2];
-   y=y*256;y+=buf[1];
-   y=y*256;y+=buf[0];
+   y = buf[7] & 0x7F;
+   y = y * 256; y += buf[6];
+   y = y * 256; y += buf[5];
+   y = y * 256; y += buf[4];
+   y = y * 256; y += buf[3];
+   y = y * 256; y += buf[2];
+   y = y * 256; y += buf[1];
+   y = y * 256; y += buf[0];
 
-   if(buf[7]&0x80) y=-y;
+   if (buf[7] & 0x80)
+   y = -y;
 
-   return y;
+   return (y);
 }
 
 static void
@@ -65,17 +66,17 @@ usage(void)
exit(1);
 }
 
-int main(int argc,char * argv[])
+int main(int argc, char *argv[])
 {
-   FILE * f, * cpf, * dpf, * epf;
-   BZFILE * cpfbz2, * dpfbz2, * epfbz2;
+   FILE *f, *cpf, *dpf, *epf;
+   BZFILE *cpfbz2, *dpfbz2, *epfbz2;
int cbz2err, dbz2err, ebz2err;
-   int fd;
-   ssize_t oldsize,newsize;
-   ssize_t bzctrllen,bzdatalen;
-   u_char header[32],buf[8];
+   int newfd, oldfd;
+   ssize_t oldsize, newsize;
+   ssize_t bzctrllen, bzdatalen;
+   u_char header[32], buf[8];
u_char *old, *new;
-   off_t oldpos,newpos;
+   off_t oldpos, newpos;
off_t ctrl[3];
off_t lenread;
off_t i;
@@ -113,11 +114,11 @@ int main(int argc,char * argv[])
errx(1, "Corrupt patch\n");
 
/* Read lengths from header */
-   bzctrllen=offtin(header+8);
-   bzdatalen=offtin(header+16);
-   newsize=offtin(header+24);
-   if((bzctrllen<0) || (bzdatalen<0) || (newsize<0))
-   errx(1,"Corrupt patch\n");
+   bzctrllen = offtin(header + 8);
+   bzdatalen = offtin(header + 16);
+   newsize = offtin(header + 24);
+   if ((bzctrllen < 0) || (bzdatalen < 0) || (newsize < 0))
+   errx(1, "Corrupt patch\n");
 
/* Close patch file and re-open it via libbzip2 at the right places */
if (fclose(f))
@@ -144,32 +145,37 @@ int main(int argc,char * argv[])
if ((epfbz2 = BZ2_bzReadOpen(, epf, 0, 0, NULL, 0)) == NULL)
errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err);
 
-   if(((fd=open(argv[1],O_RDONLY|O_BINARY,0))<0) ||
-   ((oldsize=lseek(fd,0,SEEK_END))==-1) ||
-   ((old=malloc(oldsize+1))==NULL) ||
-   (lseek(fd,0,SEEK_SET)!=0) ||
-   (read(fd,old,oldsize)!=oldsize) ||
-   (close(fd)==-1)) err(1,"%s",argv[1]);
-   if((new=malloc(newsize+1))==NULL) err(1,NULL);
-
-   oldpos=0;newpos=0;
-   while(newpos

svn commit: r304689 - head/sys/arm64/arm64

2016-08-23 Thread Andrew Turner
Author: andrew
Date: Tue Aug 23 16:37:34 2016
New Revision: 304689
URL: https://svnweb.freebsd.org/changeset/base/304689

Log:
  Also adjust the virtual address passed to vm_page_pa_tryrelock.
  
  Reported by:  alc
  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 Tue Aug 23 16:20:56 2016(r304688)
+++ head/sys/arm64/arm64/pmap.c Tue Aug 23 16:37:34 2016(r304689)
@@ -1028,7 +1028,8 @@ retry:
default:
off = 0;
}
-   if (vm_page_pa_tryrelock(pmap, tpte & ~ATTR_MASK, ))
+   if (vm_page_pa_tryrelock(pmap,
+   (tpte & ~ATTR_MASK) | off, ))
goto retry;
m = PHYS_TO_VM_PAGE((tpte & ~ATTR_MASK) | off);
vm_page_hold(m);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304681 - head

2016-08-23 Thread Bryan Drewery
On 8/23/2016 8:20 AM, Bryan Drewery wrote:
> Author: bdrewery
> Date: Tue Aug 23 15:20:32 2016
> New Revision: 304681
> URL: https://svnweb.freebsd.org/changeset/base/304681
> 
> Log:
>   Always pass in -target and --sysroot flags for the build.

Sorry this breaks in-tree GCC builds. Testing a fix now.


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r304688 - head/sys/arm64/arm64

2016-08-23 Thread Andrew Turner
Author: andrew
Date: Tue Aug 23 16:20:56 2016
New Revision: 304688
URL: https://svnweb.freebsd.org/changeset/base/304688

Log:
  Map memory as read-only in pmap_enter_quick_locked as is done in other
  pmap implementations.
  
  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 Tue Aug 23 16:12:25 2016(r304687)
+++ head/sys/arm64/arm64/pmap.c Tue Aug 23 16:20:56 2016(r304688)
@@ -2794,7 +2794,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
pmap_resident_count_inc(pmap, 1);
 
pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_IDX(m->md.pv_memattr) |
-   ATTR_AP(ATTR_AP_RW) | L3_PAGE;
+   ATTR_AP(ATTR_AP_RO) | L3_PAGE;
 
/*
 * Now validate mapping with RO protection
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304685 - head/sys/arm64/arm64

2016-08-23 Thread Alan Cox
On 08/23/2016 10:48, Andrew Turner wrote:
> Author: andrew
> Date: Tue Aug 23 15:48:27 2016
> New Revision: 304685
> URL: https://svnweb.freebsd.org/changeset/base/304685
>
> Log:
>   Include the offset the virtual address is within an L1 or L2 block when
>   finding the vm_page_t in pmap_extract_and_hold. Previously it would return
>   the vm_page_t of the first page in a block. This would cause issues when,
>   for example, fsck reads from a device into the middle of a superpage. In
>   this case the read call would write to the start of the block, and not to
>   the buffer passed in.
>   
>   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   Tue Aug 23 15:46:20 2016
> (r304684)
> +++ head/sys/arm64/arm64/pmap.c   Tue Aug 23 15:48:27 2016
> (r304685)
> @@ -995,6 +995,7 @@ vm_page_t
>  pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
>  {
>   pt_entry_t *pte, tpte;
> + vm_offset_t off;
>   vm_paddr_t pa;
>   vm_page_t m;
>   int lvl;
> @@ -1016,9 +1017,20 @@ retry:
>tpte & ATTR_DESCR_MASK));
>   if (((tpte & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) ||
>   ((prot & VM_PROT_WRITE) == 0)) {
> + switch(lvl) {
> + case 1:
> + off = va & L1_OFFSET;
> + break;
> + case 2:
> + off = va & L2_OFFSET;
> + break;
> + case 3:
> + default:
> + off = 0;
> + }

I would strongly suggest that you also include the page offset in the
value passed to vm_page_pa_tryrelock().  Otherwise, if we ever change
the mapping from physical addresses to page locks, this code will be
acquiring the wrong lock.  Other pmap implementations, e.g., amd64, do
include the offset.

>   if (vm_page_pa_tryrelock(pmap, tpte & ~ATTR_MASK, ))
>   goto retry;
> - m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK);
> + m = PHYS_TO_VM_PAGE((tpte & ~ATTR_MASK) | off);
>   vm_page_hold(m);
>   }
>   }
>
>


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


svn commit: r304687 - head/sys/arm64/arm64

2016-08-23 Thread Andrew Turner
Author: andrew
Date: Tue Aug 23 16:12:25 2016
New Revision: 304687
URL: https://svnweb.freebsd.org/changeset/base/304687

Log:
  If we find we have a superpage in pmap_enter_quick_locked return without
  trying to add a new level 3 page.
  
  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 Tue Aug 23 15:49:31 2016(r304686)
+++ head/sys/arm64/arm64/pmap.c Tue Aug 23 16:12:25 2016(r304687)
@@ -2696,7 +2696,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 {
struct spglist free;
pd_entry_t *pde;
-   pt_entry_t *l3;
+   pt_entry_t *l2, *l3;
vm_paddr_t pa;
int lvl;
 
@@ -2731,6 +2731,12 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 * attempt to allocate a page table page.  If this
 * attempt fails, we don't retry.  Instead, we give up.
 */
+   if (lvl == 1) {
+   l2 = pmap_l1_to_l2(pde, va);
+   if ((pmap_load(l2) & ATTR_DESCR_MASK) ==
+   L2_BLOCK)
+   return (NULL);
+   }
if (lvl == 2 && pmap_load(pde) != 0) {
mpte =
PHYS_TO_VM_PAGE(pmap_load(pde) & 
~ATTR_MASK);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304686 - head/usr.bin/indent

2016-08-23 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug 23 15:49:31 2016
New Revision: 304686
URL: https://svnweb.freebsd.org/changeset/base/304686

Log:
  indent(1): have the memset invocation somewhat more canonical.
  
  While correct, the previous invocation was somewhat more error prone.
  
  Pointed out by:   delphij, bde

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cTue Aug 23 15:48:27 2016(r304685)
+++ head/usr.bin/indent/io.cTue Aug 23 15:49:31 2016(r304686)
@@ -630,7 +630,7 @@ parsefont(struct fstate *f, const char *
 const char *s = s0;
 int sizedelta = 0;
 
-memset(f, 0, sizeof(struct fstate));
+memset(f, '\0', sizeof(*f));
 while (*s) {
if (isdigit(*s))
f->size = f->size * 10 + *s - '0';
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304685 - head/sys/arm64/arm64

2016-08-23 Thread Andrew Turner
Author: andrew
Date: Tue Aug 23 15:48:27 2016
New Revision: 304685
URL: https://svnweb.freebsd.org/changeset/base/304685

Log:
  Include the offset the virtual address is within an L1 or L2 block when
  finding the vm_page_t in pmap_extract_and_hold. Previously it would return
  the vm_page_t of the first page in a block. This would cause issues when,
  for example, fsck reads from a device into the middle of a superpage. In
  this case the read call would write to the start of the block, and not to
  the buffer passed in.
  
  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 Tue Aug 23 15:46:20 2016(r304684)
+++ head/sys/arm64/arm64/pmap.c Tue Aug 23 15:48:27 2016(r304685)
@@ -995,6 +995,7 @@ vm_page_t
 pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
 {
pt_entry_t *pte, tpte;
+   vm_offset_t off;
vm_paddr_t pa;
vm_page_t m;
int lvl;
@@ -1016,9 +1017,20 @@ retry:
 tpte & ATTR_DESCR_MASK));
if (((tpte & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) ||
((prot & VM_PROT_WRITE) == 0)) {
+   switch(lvl) {
+   case 1:
+   off = va & L1_OFFSET;
+   break;
+   case 2:
+   off = va & L2_OFFSET;
+   break;
+   case 3:
+   default:
+   off = 0;
+   }
if (vm_page_pa_tryrelock(pmap, tpte & ~ATTR_MASK, ))
goto retry;
-   m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK);
+   m = PHYS_TO_VM_PAGE((tpte & ~ATTR_MASK) | off);
vm_page_hold(m);
}
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304684 - head/usr.bin/indent

2016-08-23 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug 23 15:46:20 2016
New Revision: 304684
URL: https://svnweb.freebsd.org/changeset/base/304684

Log:
  indent(1): remove dead assignments.
  
  Taken from:   Piotr Sephaniak

Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cTue Aug 23 15:31:53 2016
(r304683)
+++ head/usr.bin/indent/indent.cTue Aug 23 15:46:20 2016
(r304684)
@@ -1161,7 +1161,6 @@ check_type:
 
case comment:   /* we have gotten a / followed by * this is a 
biggie */
if (flushed_nl) {   /* we should force a broken line here */
-   flushed_nl = false;
dump_line();
ps.want_blank = false;  /* dont insert blank at line start */
force_nl = false;

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cTue Aug 23 15:31:53 2016(r304683)
+++ head/usr.bin/indent/io.cTue Aug 23 15:46:20 2016(r304684)
@@ -242,7 +242,7 @@ dump_line(void)
}
while (e_com > com_st && isspace(e_com[-1]))
e_com--;
-   cur_col = pad_output(cur_col, target);
+   (void)pad_output(cur_col, target);
fwrite(com_st, e_com - com_st, 1, output);
ps.comment_delta = ps.n_comment_delta;
++ps.com_lines; /* count lines with comments */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304683 - head/share/man/man5

2016-08-23 Thread Bryan Drewery
Author: bdrewery
Date: Tue Aug 23 15:31:53 2016
New Revision: 304683
URL: https://svnweb.freebsd.org/changeset/base/304683

Log:
  Regenerate

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Tue Aug 23 15:22:17 2016
(r304682)
+++ head/share/man/man5/src.conf.5  Tue Aug 23 15:31:53 2016
(r304683)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 292283 2015-12-15 18:42:30Z 
bdrewery
 .\" $FreeBSD$
-.Dd August 22, 2016
+.Dd August 23, 2016
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -542,10 +542,6 @@ When set, it also enforces the following
 When set, the following options are also in effect:
 .Pp
 .Bl -inset -compact
-.It Va WITHOUT_SYSTEM_COMPILER
-(unless
-.Va WITH_SYSTEM_COMPILER
-is set explicitly)
 .It Va WITH_AUTO_OBJ
 (unless
 .Va WITHOUT_AUTO_OBJ
@@ -1147,14 +1143,6 @@ to
 .Pp
 Currently this also enforces
 .Va WITHOUT_SYSTEM_COMPILER .
-When set, the following options are also in effect:
-.Pp
-.Bl -inset -compact
-.It Va WITHOUT_SYSTEM_COMPILER
-(unless
-.Va WITH_SYSTEM_COMPILER
-is set explicitly)
-.El
 .Pp
 This must be set in the environment, make command line, or
 .Pa /etc/src-env.conf ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304682 - head/share/mk

2016-08-23 Thread Bryan Drewery
Author: bdrewery
Date: Tue Aug 23 15:22:17 2016
New Revision: 304682
URL: https://svnweb.freebsd.org/changeset/base/304682

Log:
  Re-enable WITH_SYSTEM_COMPILER with WITH_META_MODE.
  
  This was disabled in r301468 due to -target/--sysroot sometimes being used in
  the build and other times not being used.  Now that it is always used since
  r304681, it is safe to combine the features.
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Tue Aug 23 15:20:32 2016(r304681)
+++ head/share/mk/src.opts.mk   Tue Aug 23 15:22:17 2016(r304682)
@@ -356,10 +356,6 @@ MK_ELFTOOLCHAIN_BOOTSTRAP:= no
 MK_GCC_BOOTSTRAP:= no
 .endif
 
-.if ${MK_META_MODE} == "yes"
-MK_SYSTEM_COMPILER:= no
-.endif
-
 .if ${MK_TOOLCHAIN} == "no"
 MK_BINUTILS:=  no
 MK_CLANG:= no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304681 - head

2016-08-23 Thread Bryan Drewery
Author: bdrewery
Date: Tue Aug 23 15:20:32 2016
New Revision: 304681
URL: https://svnweb.freebsd.org/changeset/base/304681

Log:
  Always pass in -target and --sysroot flags for the build.
  
  The internal bootstrap compiler has a default sysroot set by TOOLS_PREFIX
  and target set by TARGET/TARGET_ARCH.  However, there are several needs to
  always pass an explicit --sysroot and -target.
  - External compiler needs sysroot and target flags.
  - External ld needs sysroot.
  - To be clear about the use of a sysroot when using the internal compiler.
  - Easier debugging.
  - Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to
the flip-flopping build command when sometimes using external and
sometimes using internal.
  - Allow using no lld which has support for default paths.
  
  The default sysroot in the bootstrap compiler is not changed.  The
  buildenv compiler will still work with its default and will also
  include -target/--sysroot from CC in the environment.
  
  MFC after:3 days
  Discussed with:   emaste, brooks (BSDCam)
  Reviewed by:  emaste
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Aug 23 13:53:38 2016(r304680)
+++ head/Makefile.inc1  Tue Aug 23 15:20:32 2016(r304681)
@@ -550,8 +550,18 @@ CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="$
 BFLAGS+=   -B${CROSS_BINUTILS_PREFIX}
 .endif
 
-# External compiler needs sysroot and target flags.
-.if ${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no"
+
+# The internal bootstrap compiler has a default sysroot set by TOOLS_PREFIX
+# and target set by TARGET/TARGET_ARCH.  However, there are several needs to
+# always pass an explicit --sysroot and -target.
+# - External compiler needs sysroot and target flags.
+# - External ld needs sysroot.
+# - To be clear about the use of a sysroot when using the internal compiler.
+# - Easier debugging.
+# - Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to
+#   the flip-flopping build command when sometimes using external and
+#   sometimes using internal.
+# - Allow using lld which has no support for default paths.
 .if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX})
 BFLAGS+=   -B${WORLDTMP}/usr/bin
 .endif
@@ -579,7 +589,6 @@ TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x8
 XCFLAGS+=  -target ${TARGET_TRIPLE}
 .endif
 XCFLAGS+=  --sysroot=${WORLDTMP}
-.endif # ${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no"
 
 .if !empty(BFLAGS)
 XCFLAGS+=  ${BFLAGS}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304680 - in head/sys/boot/efi: libefi loader

2016-08-23 Thread Baptiste Daroussin
Author: bapt
Date: Tue Aug 23 13:53:38 2016
New Revision: 304680
URL: https://svnweb.freebsd.org/changeset/base/304680

Log:
  EFI loader: only open/close on the net device with tftpfs
  
  It prevents issuing a dhcp request before each file open
  As a consequence netbooting over tftpfs is significantly faster
  
  Sponsored by: Gandi.net

Modified:
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/loader/Makefile

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Tue Aug 23 13:51:55 2016
(r304679)
+++ head/sys/boot/efi/libefi/Makefile   Tue Aug 23 13:53:38 2016
(r304680)
@@ -14,7 +14,7 @@ SRCS+=time_event.c
 .endif
 
 .if defined(LOADER_TFTP_SUPPORT)
-CFLAGS+=   -DLOADER_TFTP_SUPPORT
+CFLAGS+=   -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
 .endif
 
 # We implement a slightly non-standard %S in that it always takes a

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Tue Aug 23 13:51:55 2016
(r304679)
+++ head/sys/boot/efi/loader/Makefile   Tue Aug 23 13:53:38 2016
(r304680)
@@ -22,7 +22,7 @@ SRCS= autoload.c \
vers.c
 
 .if defined(LOADER_TFTP_SUPPORT)
-CFLAGS+=   -DLOADER_TFTP_SUPPORT
+CFLAGS+=   -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
 .endif
 
 .if ${MK_ZFS} != "no"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Toomas Soome

> On 23. aug 2016, at 15:36, Slawa Olhovchenkov  wrote:
> 
> On Tue, Aug 23, 2016 at 03:26:04PM +0300, Toomas Soome wrote:
> 
>>> Main trouble (by kib@) is 640KB real mode limit.
>>> Separated heap don't soled this.
>>> May be solution is early switch to protected mode, boot2?
>> 
>> hm, but boot2 is already btx client and btx is setting up the
>> protected mode. Only zfsboot/gpt[zfs]boot memory copy (boot2
>> relocator) is working in segmented real mode, so the gptldr.S and
>> zfsldr.S has to deal with memory segments to set boot2 up. Or did
>> got you wrong?
> 
> Mat be I am wrong.
> May be I am not very clean.
> As I understund kib@ restriction caused by 640KB realmode limit.
> In case of boot2 start in real mode and read enterly by boot1 -- we
> also touch this trouble.
> 
> How to resolve this:
> 
> 1) start entirely; boot2 in protected mode and read all boot2 to
> extended memory
> 
> 2) read only part of boot2 (boot2 relocator) by boot1 and switch to
> protected mode before reading rest of boot2 by boot2 code.


Ah, well, the boot2 by itself is not an issue - it is much smaller and the only 
related problem was that real mode relocator was using segment size (64k) for 
copy, but this limit is removed (was pre-requisite for geli support in gptboot 
and I did port that change to zfsboot as well). The size issue with loader 
(stage3) is due to fact that loader memory image is located in low memory,  
base 0xa000 and the upper limit is EBDA and video memory area. Since boot2 is 
running in protected mode, it can load loader (or kernel) were needed, just 
that placing loader must be careful… in that sense the current location is 
almost perfect (with exception about the size limit;) and I would avoid moving 
it without the very good reason.

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

svn commit: r304678 - head/usr.sbin/kldxref

2016-08-23 Thread Marcelo Araujo
Author: araujo
Date: Tue Aug 23 13:43:43 2016
New Revision: 304678
URL: https://svnweb.freebsd.org/changeset/base/304678

Log:
  Use roundup2() from sys/param.h.

Modified:
  head/usr.sbin/kldxref/kldxref.c

Modified: head/usr.sbin/kldxref/kldxref.c
==
--- head/usr.sbin/kldxref/kldxref.c Tue Aug 23 13:35:48 2016
(r304677)
+++ head/usr.sbin/kldxref/kldxref.c Tue Aug 23 13:43:43 2016
(r304678)
@@ -74,7 +74,7 @@ static int reccnt;/* total record writt
 static void
 intalign(void)
 {
-   recpos = (recpos + sizeof(int) - 1) & ~(sizeof(int) - 1);
+   recpos = roundup2(recpos, sizeof(int));
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304677 - in head/sys/boot: common efi/libefi efi/loader

2016-08-23 Thread Baptiste Daroussin
Author: bapt
Date: Tue Aug 23 13:35:48 2016
New Revision: 304677
URL: https://svnweb.freebsd.org/changeset/base/304677

Log:
  Add tftpfs support for the EFI loader
  
  Allow netbooting on efi without having to setup any NFS server by rebuilding 
the
  loader with LOADER_TFTP_SUPPORT like for the i386 pxeloader
  
  Sponsored by: Gandi.net

Modified:
  head/sys/boot/common/dev_net.c
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/efi/loader/conf.c

Modified: head/sys/boot/common/dev_net.c
==
--- head/sys/boot/common/dev_net.c  Tue Aug 23 13:19:42 2016
(r304676)
+++ head/sys/boot/common/dev_net.c  Tue Aug 23 13:35:48 2016
(r304677)
@@ -167,8 +167,13 @@ net_open(struct open_file *f, ...)
setenv("boot.netif.ip", inet_ntoa(myip), 1);
setenv("boot.netif.netmask", intoa(netmask), 1);
setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
+#ifdef LOADER_TFTP_SUPPORT
+   setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
+   setenv("boot.tftproot.path", rootpath, 1);
+#else
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
setenv("boot.nfsroot.path", rootpath, 1);
+#endif
if (intf_mtu != 0) {
char mtu[16];
sprintf(mtu, "%u", intf_mtu);

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Tue Aug 23 13:19:42 2016
(r304676)
+++ head/sys/boot/efi/libefi/Makefile   Tue Aug 23 13:35:48 2016
(r304677)
@@ -13,6 +13,10 @@ SRCS+=   time.c
 SRCS+= time_event.c
 .endif
 
+.if defined(LOADER_TFTP_SUPPORT)
+CFLAGS+=   -DLOADER_TFTP_SUPPORT
+.endif
+
 # We implement a slightly non-standard %S in that it always takes a
 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
 # seems to matter on arm64 where wchar_t defaults to an int instead

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Tue Aug 23 13:19:42 2016
(r304676)
+++ head/sys/boot/efi/loader/Makefile   Tue Aug 23 13:35:48 2016
(r304677)
@@ -21,6 +21,10 @@ SRCS=autoload.c \
smbios.c \
vers.c
 
+.if defined(LOADER_TFTP_SUPPORT)
+CFLAGS+=   -DLOADER_TFTP_SUPPORT
+.endif
+
 .if ${MK_ZFS} != "no"
 SRCS+= zfs.c
 .PATH: ${.CURDIR}/../../zfs

Modified: head/sys/boot/efi/loader/conf.c
==
--- head/sys/boot/efi/loader/conf.c Tue Aug 23 13:19:42 2016
(r304676)
+++ head/sys/boot/efi/loader/conf.c Tue Aug 23 13:35:48 2016
(r304677)
@@ -51,7 +51,11 @@ struct fs_ops *file_system[] = {
_fsops,
_fsops,
_fsops,
+#ifdef LOADER_TFTP_SUPPORT
+   _fsops,
+#else
_fsops,
+#endif
_fsops,
_fsops,
NULL
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304676 - head/usr.sbin/fifolog/lib

2016-08-23 Thread Marcelo Araujo
Author: araujo
Date: Tue Aug 23 13:19:42 2016
New Revision: 304676
URL: https://svnweb.freebsd.org/changeset/base/304676

Log:
  Fix calloc(3) argument order.
  
  MFC after:4 weeks.

Modified:
  head/usr.sbin/fifolog/lib/fifolog_int.c
  head/usr.sbin/fifolog/lib/fifolog_reader.c

Modified: head/usr.sbin/fifolog/lib/fifolog_int.c
==
--- head/usr.sbin/fifolog/lib/fifolog_int.c Tue Aug 23 12:22:35 2016
(r304675)
+++ head/usr.sbin/fifolog/lib/fifolog_int.c Tue Aug 23 13:19:42 2016
(r304676)
@@ -125,7 +125,7 @@ fifolog_int_open_i(struct fifolog_file *
 
/* Initialize zlib handling */
 
-   f->zs = calloc(sizeof *f->zs, 1);
+   f->zs = calloc(1, sizeof(*f->zs));
if (f->zs == NULL)
return ("cannot malloc");
 

Modified: head/usr.sbin/fifolog/lib/fifolog_reader.c
==
--- head/usr.sbin/fifolog/lib/fifolog_reader.c  Tue Aug 23 12:22:35 2016
(r304675)
+++ head/usr.sbin/fifolog/lib/fifolog_reader.c  Tue Aug 23 13:19:42 2016
(r304676)
@@ -59,7 +59,7 @@ fifolog_reader_open(const char *fname)
struct fifolog_reader *fr;
int i;
 
-   fr = calloc(sizeof *fr, 1);
+   fr = calloc(1, sizeof(*fr));
if (fr == NULL)
err(1, "Cannot malloc");
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Slawa Olhovchenkov
On Tue, Aug 23, 2016 at 03:26:04PM +0300, Toomas Soome wrote:

> > Main trouble (by kib@) is 640KB real mode limit.
> > Separated heap don't soled this.
> > May be solution is early switch to protected mode, boot2?
> 
> hm, but boot2 is already btx client and btx is setting up the
> protected mode. Only zfsboot/gpt[zfs]boot memory copy (boot2
> relocator) is working in segmented real mode, so the gptldr.S and
> zfsldr.S has to deal with memory segments to set boot2 up. Or did
> got you wrong?

Mat be I am wrong.
May be I am not very clean.
As I understund kib@ restriction caused by 640KB realmode limit.
In case of boot2 start in real mode and read enterly by boot1 -- we
also touch this trouble.

How to resolve this:

1) start entirely; boot2 in protected mode and read all boot2 to
extended memory

2) read only part of boot2 (boot2 relocator) by boot1 and switch to
protected mode before reading rest of boot2 by boot2 code.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Toomas Soome

> On 23. aug 2016, at 15:16, Slawa Olhovchenkov  wrote:
> 
> On Tue, Aug 23, 2016 at 03:00:32PM +0300, Toomas Soome wrote:
> 
>> 
>>> On 23. aug 2016, at 14:29, Slawa Olhovchenkov  wrote:
>>> 
>>> On Tue, Aug 23, 2016 at 11:05:47AM +0300, Toomas Soome wrote:
>>> 
 
> On 22. aug 2016, at 17:56, Toomas Soome  wrote:
> 
> 
>> On 22. aug 2016, at 17:19, Warner Losh  wrote:
>> 
>> On Mon, Aug 22, 2016 at 3:44 AM, Toomas Soome  wrote:
>>> I do suspect the size difference there is partially due to ficl, in 
>>> illumos (ficl 4):
>>> 
>>> -rw-r--r--   1 tsoome   staff 132508 aug 22 09:18 libficl.a
>>> 
>>> and freebsd (ficl 3):
>>> 
>>> -rw-r--r--  1 root  wheel  213748 Aug 19 01:57 libficl.a
>>> 
>>> so, there definitely is some space…
>> 
>> Same compiler? Clang bloats the boot code rather substantially, even 
>> after
>> all the flags to tell it to generate smaller code are used. gcc 4.2.x
>> built stuff
>> was substantially smaller.
>> 
>> There's a 520kb limit enforced in the boot1 for similar reasons. Looks 
>> like
>> the combination of options makes us use just enough extra memory to
>> sink the battleship...
>> 
>> Warner
>> 
> 
> 
> Actually I only now realized I was comparing apples with oranges… I 
> forgot the fbsd builds 32bit version in ficl32, this one is 64bit. and 
> yes the 32bit version is not that big at all:D
> 
> Also, after done some digging, I have found few instances of duplicated 
> code (we can share sha2 with geli and so if sha512 is already needed, it 
> will become another “free lunch”). Also, unless I’m mistaken, for some 
> reason the bzip *compression* is brought in - correct me if I’m wrong, 
> but afaik only decompression is needed…
> 
> So before going after “useless features”, there are some “hidden” 
> resources to remove extra fat.
> 
 
 I did some more digging. while ld has —gc-sections to clean up unused 
 bits, to make it effective, the code build does also need -Os 
 -fdata-sections -ffunction-sections.
 So I did just very simple test by adding those flags to bsd.stand.mk and:
 
 first the “default” binaries from /boot:
 -r-xr-xr-x  1 root  wheel  446464 Aug 19 08:46 /boot/zfsloader
 -rw-r--r--  1 root  wheel  438272 Aug 23 00:30 /boot/zfsloader.b
 -r-xr-xr-x  1 root  wheel  446464 Aug  5 08:37 /boot/zfsloader.old
 -r--r--r--  1 root  wheel  406568 Aug 19 08:46 /boot/userboot.so
 
 (note, zfsloader.b here is built with https://reviews.freebsd.org/D7600)
 
 now after adding compile flags  -Os -fdata-sections -ffunction-sections:
 
 -rw-r--r--  1 root  wheel  389120 Aug 23 10:12 zfsloader
 -rwxr-xr-x  1 root  wheel  378156 Aug 23 10:12 zfsloader.bin
 -rwxr-xr-x  1 root  wheel  437514 Aug 23 10:12 zfsloader.sym
 -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:03 userboot.so
 
 and finally test for Andriy with:
 LOADER_BZIP2_SUPPORT=yes
 LOADER_FIREWIRE_SUPPORT=yes
 
 -rw-r--r--  1 root  wheel  421888 Aug 23 10:22 zfsloader
 -rwxr-xr-x  1 root  wheel  409932 Aug 23 10:22 zfsloader.bin
 -rwxr-xr-x  1 root  wheel  472021 Aug 23 10:22 zfsloader.sym
 -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:22 userboot.so
 
 note the userboot.so did not change from those flags.
 
 This is just an result from compile, and by adding 3 options to 
 bsd.stand.mk; however, not all Makefiles in loader tree seem to include 
 it, and most importantly, haven’t tested real boot yet;)
 
 To conclude, some more work is needed to review the Makefiles, build 
 options used etc, also I don’t know all the background why the compiler 
 options are set as they currently are - were there any related 
 compiler/linker bugs, or any other reasons, also how/if other platforms 
 are affected - for example bsd.stand.mk does set -Os for pc98, but not for 
 others…
>>> 
>>> This is only size on disk, memory consuming still same, IMHO.
>> 
>> Actually this reduction above is entirely due to -Os, the —gc-sections is 
>> not passed to linker (at least for zfsloader case). I think we will need 
>> linker script to preserve set_Xcommand_set linker set to use —gc-sections 
>> with ld.
>> 
>> Loader heap is separate already and does not contribute to this issue. Also, 
>> I already did test the boot with thinned zfsloader, both with and without 
>> bzip2 are appearing to work, at least for this quick test anyhow.
> 
> Main trouble (by kib@) is 640KB real mode limit.
> Separated heap don't soled this.
> May be solution is early switch to protected mode, boot2?

hm, but boot2 is already btx client and btx is setting up the protected mode. 
Only zfsboot/gpt[zfs]boot memory copy (boot2 relocator) is 

Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Slawa Olhovchenkov
On Tue, Aug 23, 2016 at 03:00:32PM +0300, Toomas Soome wrote:

> 
> > On 23. aug 2016, at 14:29, Slawa Olhovchenkov  wrote:
> > 
> > On Tue, Aug 23, 2016 at 11:05:47AM +0300, Toomas Soome wrote:
> > 
> >> 
> >>> On 22. aug 2016, at 17:56, Toomas Soome  wrote:
> >>> 
> >>> 
>  On 22. aug 2016, at 17:19, Warner Losh  wrote:
>  
>  On Mon, Aug 22, 2016 at 3:44 AM, Toomas Soome  wrote:
> > I do suspect the size difference there is partially due to ficl, in 
> > illumos (ficl 4):
> > 
> > -rw-r--r--   1 tsoome   staff 132508 aug 22 09:18 libficl.a
> > 
> > and freebsd (ficl 3):
> > 
> > -rw-r--r--  1 root  wheel  213748 Aug 19 01:57 libficl.a
> > 
> > so, there definitely is some space…
>  
>  Same compiler? Clang bloats the boot code rather substantially, even 
>  after
>  all the flags to tell it to generate smaller code are used. gcc 4.2.x
>  built stuff
>  was substantially smaller.
>  
>  There's a 520kb limit enforced in the boot1 for similar reasons. Looks 
>  like
>  the combination of options makes us use just enough extra memory to
>  sink the battleship...
>  
>  Warner
>  
> >>> 
> >>> 
> >>> Actually I only now realized I was comparing apples with oranges… I 
> >>> forgot the fbsd builds 32bit version in ficl32, this one is 64bit. and 
> >>> yes the 32bit version is not that big at all:D
> >>> 
> >>> Also, after done some digging, I have found few instances of duplicated 
> >>> code (we can share sha2 with geli and so if sha512 is already needed, it 
> >>> will become another “free lunch”). Also, unless I’m mistaken, for some 
> >>> reason the bzip *compression* is brought in - correct me if I’m wrong, 
> >>> but afaik only decompression is needed…
> >>> 
> >>> So before going after “useless features”, there are some “hidden” 
> >>> resources to remove extra fat.
> >>> 
> >> 
> >> I did some more digging. while ld has —gc-sections to clean up unused 
> >> bits, to make it effective, the code build does also need -Os 
> >> -fdata-sections -ffunction-sections.
> >> So I did just very simple test by adding those flags to bsd.stand.mk and:
> >> 
> >> first the “default” binaries from /boot:
> >> -r-xr-xr-x  1 root  wheel  446464 Aug 19 08:46 /boot/zfsloader
> >> -rw-r--r--  1 root  wheel  438272 Aug 23 00:30 /boot/zfsloader.b
> >> -r-xr-xr-x  1 root  wheel  446464 Aug  5 08:37 /boot/zfsloader.old
> >> -r--r--r--  1 root  wheel  406568 Aug 19 08:46 /boot/userboot.so
> >> 
> >> (note, zfsloader.b here is built with https://reviews.freebsd.org/D7600)
> >> 
> >> now after adding compile flags  -Os -fdata-sections -ffunction-sections:
> >> 
> >> -rw-r--r--  1 root  wheel  389120 Aug 23 10:12 zfsloader
> >> -rwxr-xr-x  1 root  wheel  378156 Aug 23 10:12 zfsloader.bin
> >> -rwxr-xr-x  1 root  wheel  437514 Aug 23 10:12 zfsloader.sym
> >> -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:03 userboot.so
> >> 
> >> and finally test for Andriy with:
> >> LOADER_BZIP2_SUPPORT=yes
> >> LOADER_FIREWIRE_SUPPORT=yes
> >> 
> >> -rw-r--r--  1 root  wheel  421888 Aug 23 10:22 zfsloader
> >> -rwxr-xr-x  1 root  wheel  409932 Aug 23 10:22 zfsloader.bin
> >> -rwxr-xr-x  1 root  wheel  472021 Aug 23 10:22 zfsloader.sym
> >> -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:22 userboot.so
> >> 
> >> note the userboot.so did not change from those flags.
> >> 
> >> This is just an result from compile, and by adding 3 options to 
> >> bsd.stand.mk; however, not all Makefiles in loader tree seem to include 
> >> it, and most importantly, haven’t tested real boot yet;)
> >> 
> >> To conclude, some more work is needed to review the Makefiles, build 
> >> options used etc, also I don’t know all the background why the compiler 
> >> options are set as they currently are - were there any related 
> >> compiler/linker bugs, or any other reasons, also how/if other platforms 
> >> are affected - for example bsd.stand.mk does set -Os for pc98, but not for 
> >> others…
> > 
> > This is only size on disk, memory consuming still same, IMHO.
> 
> Actually this reduction above is entirely due to -Os, the —gc-sections is not 
> passed to linker (at least for zfsloader case). I think we will need linker 
> script to preserve set_Xcommand_set linker set to use —gc-sections with ld.
> 
> Loader heap is separate already and does not contribute to this issue. Also, 
> I already did test the boot with thinned zfsloader, both with and without 
> bzip2 are appearing to work, at least for this quick test anyhow.

Main trouble (by kib@) is 640KB real mode limit.
Separated heap don't soled this.
May be solution is early switch to protected mode, boot2?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Toomas Soome

> On 23. aug 2016, at 14:29, Slawa Olhovchenkov  wrote:
> 
> On Tue, Aug 23, 2016 at 11:05:47AM +0300, Toomas Soome wrote:
> 
>> 
>>> On 22. aug 2016, at 17:56, Toomas Soome  wrote:
>>> 
>>> 
 On 22. aug 2016, at 17:19, Warner Losh  wrote:
 
 On Mon, Aug 22, 2016 at 3:44 AM, Toomas Soome  wrote:
> I do suspect the size difference there is partially due to ficl, in 
> illumos (ficl 4):
> 
> -rw-r--r--   1 tsoome   staff 132508 aug 22 09:18 libficl.a
> 
> and freebsd (ficl 3):
> 
> -rw-r--r--  1 root  wheel  213748 Aug 19 01:57 libficl.a
> 
> so, there definitely is some space…
 
 Same compiler? Clang bloats the boot code rather substantially, even after
 all the flags to tell it to generate smaller code are used. gcc 4.2.x
 built stuff
 was substantially smaller.
 
 There's a 520kb limit enforced in the boot1 for similar reasons. Looks like
 the combination of options makes us use just enough extra memory to
 sink the battleship...
 
 Warner
 
>>> 
>>> 
>>> Actually I only now realized I was comparing apples with oranges… I forgot 
>>> the fbsd builds 32bit version in ficl32, this one is 64bit. and yes the 
>>> 32bit version is not that big at all:D
>>> 
>>> Also, after done some digging, I have found few instances of duplicated 
>>> code (we can share sha2 with geli and so if sha512 is already needed, it 
>>> will become another “free lunch”). Also, unless I’m mistaken, for some 
>>> reason the bzip *compression* is brought in - correct me if I’m wrong, but 
>>> afaik only decompression is needed…
>>> 
>>> So before going after “useless features”, there are some “hidden” resources 
>>> to remove extra fat.
>>> 
>> 
>> I did some more digging. while ld has —gc-sections to clean up unused bits, 
>> to make it effective, the code build does also need -Os -fdata-sections 
>> -ffunction-sections.
>> So I did just very simple test by adding those flags to bsd.stand.mk and:
>> 
>> first the “default” binaries from /boot:
>> -r-xr-xr-x  1 root  wheel  446464 Aug 19 08:46 /boot/zfsloader
>> -rw-r--r--  1 root  wheel  438272 Aug 23 00:30 /boot/zfsloader.b
>> -r-xr-xr-x  1 root  wheel  446464 Aug  5 08:37 /boot/zfsloader.old
>> -r--r--r--  1 root  wheel  406568 Aug 19 08:46 /boot/userboot.so
>> 
>> (note, zfsloader.b here is built with https://reviews.freebsd.org/D7600)
>> 
>> now after adding compile flags  -Os -fdata-sections -ffunction-sections:
>> 
>> -rw-r--r--  1 root  wheel  389120 Aug 23 10:12 zfsloader
>> -rwxr-xr-x  1 root  wheel  378156 Aug 23 10:12 zfsloader.bin
>> -rwxr-xr-x  1 root  wheel  437514 Aug 23 10:12 zfsloader.sym
>> -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:03 userboot.so
>> 
>> and finally test for Andriy with:
>> LOADER_BZIP2_SUPPORT=yes
>> LOADER_FIREWIRE_SUPPORT=yes
>> 
>> -rw-r--r--  1 root  wheel  421888 Aug 23 10:22 zfsloader
>> -rwxr-xr-x  1 root  wheel  409932 Aug 23 10:22 zfsloader.bin
>> -rwxr-xr-x  1 root  wheel  472021 Aug 23 10:22 zfsloader.sym
>> -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:22 userboot.so
>> 
>> note the userboot.so did not change from those flags.
>> 
>> This is just an result from compile, and by adding 3 options to 
>> bsd.stand.mk; however, not all Makefiles in loader tree seem to include it, 
>> and most importantly, haven’t tested real boot yet;)
>> 
>> To conclude, some more work is needed to review the Makefiles, build options 
>> used etc, also I don’t know all the background why the compiler options are 
>> set as they currently are - were there any related compiler/linker bugs, or 
>> any other reasons, also how/if other platforms are affected - for example 
>> bsd.stand.mk does set -Os for pc98, but not for others…
> 
> This is only size on disk, memory consuming still same, IMHO.

Actually this reduction above is entirely due to -Os, the —gc-sections is not 
passed to linker (at least for zfsloader case). I think we will need linker 
script to preserve set_Xcommand_set linker set to use —gc-sections with ld.

Loader heap is separate already and does not contribute to this issue. Also, I 
already did test the boot with thinned zfsloader, both with and without bzip2 
are appearing to work, at least for this quick test anyhow.

rgds,
toomas

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

Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Slawa Olhovchenkov
On Tue, Aug 23, 2016 at 11:05:47AM +0300, Toomas Soome wrote:

> 
> > On 22. aug 2016, at 17:56, Toomas Soome  wrote:
> > 
> > 
> >> On 22. aug 2016, at 17:19, Warner Losh  wrote:
> >> 
> >> On Mon, Aug 22, 2016 at 3:44 AM, Toomas Soome  wrote:
> >>> I do suspect the size difference there is partially due to ficl, in 
> >>> illumos (ficl 4):
> >>> 
> >>> -rw-r--r--   1 tsoome   staff 132508 aug 22 09:18 libficl.a
> >>> 
> >>> and freebsd (ficl 3):
> >>> 
> >>> -rw-r--r--  1 root  wheel  213748 Aug 19 01:57 libficl.a
> >>> 
> >>> so, there definitely is some space…
> >> 
> >> Same compiler? Clang bloats the boot code rather substantially, even after
> >> all the flags to tell it to generate smaller code are used. gcc 4.2.x
> >> built stuff
> >> was substantially smaller.
> >> 
> >> There's a 520kb limit enforced in the boot1 for similar reasons. Looks like
> >> the combination of options makes us use just enough extra memory to
> >> sink the battleship...
> >> 
> >> Warner
> >> 
> > 
> > 
> > Actually I only now realized I was comparing apples with oranges… I forgot 
> > the fbsd builds 32bit version in ficl32, this one is 64bit. and yes the 
> > 32bit version is not that big at all:D
> > 
> > Also, after done some digging, I have found few instances of duplicated 
> > code (we can share sha2 with geli and so if sha512 is already needed, it 
> > will become another “free lunch”). Also, unless I’m mistaken, for some 
> > reason the bzip *compression* is brought in - correct me if I’m wrong, but 
> > afaik only decompression is needed…
> > 
> > So before going after “useless features”, there are some “hidden” resources 
> > to remove extra fat.
> > 
> 
> I did some more digging. while ld has —gc-sections to clean up unused bits, 
> to make it effective, the code build does also need -Os -fdata-sections 
> -ffunction-sections.
> So I did just very simple test by adding those flags to bsd.stand.mk and:
> 
> first the “default” binaries from /boot:
> -r-xr-xr-x  1 root  wheel  446464 Aug 19 08:46 /boot/zfsloader
> -rw-r--r--  1 root  wheel  438272 Aug 23 00:30 /boot/zfsloader.b
> -r-xr-xr-x  1 root  wheel  446464 Aug  5 08:37 /boot/zfsloader.old
> -r--r--r--  1 root  wheel  406568 Aug 19 08:46 /boot/userboot.so
> 
> (note, zfsloader.b here is built with https://reviews.freebsd.org/D7600)
> 
> now after adding compile flags  -Os -fdata-sections -ffunction-sections:
> 
> -rw-r--r--  1 root  wheel  389120 Aug 23 10:12 zfsloader
> -rwxr-xr-x  1 root  wheel  378156 Aug 23 10:12 zfsloader.bin
> -rwxr-xr-x  1 root  wheel  437514 Aug 23 10:12 zfsloader.sym
> -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:03 userboot.so
> 
> and finally test for Andriy with:
> LOADER_BZIP2_SUPPORT=yes
> LOADER_FIREWIRE_SUPPORT=yes
> 
> -rw-r--r--  1 root  wheel  421888 Aug 23 10:22 zfsloader
> -rwxr-xr-x  1 root  wheel  409932 Aug 23 10:22 zfsloader.bin
> -rwxr-xr-x  1 root  wheel  472021 Aug 23 10:22 zfsloader.sym
> -rwxr-xr-x  1 root  wheel  375912 Aug 23 10:22 userboot.so
> 
> note the userboot.so did not change from those flags.
> 
> This is just an result from compile, and by adding 3 options to bsd.stand.mk; 
> however, not all Makefiles in loader tree seem to include it, and most 
> importantly, haven’t tested real boot yet;)
> 
> To conclude, some more work is needed to review the Makefiles, build options 
> used etc, also I don’t know all the background why the compiler options are 
> set as they currently are - were there any related compiler/linker bugs, or 
> any other reasons, also how/if other platforms are affected - for example 
> bsd.stand.mk does set -Os for pc98, but not for others…

This is only size on disk, memory consuming still same, IMHO.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r304674 - head/sys/dev/intpm

2016-08-23 Thread Andriy Gapon
Author: avg
Date: Tue Aug 23 10:40:53 2016
New Revision: 304674
URL: https://svnweb.freebsd.org/changeset/base/304674

Log:
  intpm: add support for SB800
  
  This code should be able to support later AMD chipsets as well, but that
  hasn't been tested.
  
  SB800 supports accessing several different SMBus buses using the same
  set of constrol registeirs plus special PMIO registers that control which
  bus is selected.  This could be exposed to consumers as several smb devices
  each talking to its bus.  This feature is not implemented yet.
  
  MFC after:2 weeks

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

Modified: head/sys/dev/intpm/intpm.c
==
--- head/sys/dev/intpm/intpm.c  Tue Aug 23 08:13:08 2016(r304673)
+++ head/sys/dev/intpm/intpm.c  Tue Aug 23 10:40:53 2016(r304674)
@@ -52,8 +52,10 @@ struct intsmb_softc {
struct resource *irq_res;
void*irq_hand;
device_tsmbus;
+   int io_rid;
int isbusy;
int cfg_irq9;
+   int sb8xx;
int poll;
struct mtx  lock;
 };
@@ -102,10 +104,8 @@ intsmb_probe(device_t dev)
device_set_desc(dev, "ATI IXP400 SMBus Controller");
break;
case 0x43851002:
-   /* SB800 and newer can not be configured in a compatible way. */
-   if (pci_get_revid(dev) >= 0x40)
-   return (ENXIO);
-   device_set_desc(dev, "AMD SB600/700/710/750 SMBus Controller");
+   case 0x780b1022:/* AMD Hudson */
+   device_set_desc(dev, "AMD SB600/7xx/8xx SMBus Controller");
/* XXX Maybe force polling right here? */
break;
default:
@@ -115,6 +115,87 @@ intsmb_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
 }
 
+static uint8_t
+sb8xx_pmio_read(struct resource *res, uint8_t reg)
+{
+   bus_write_1(res, 0, reg);   /* Index */
+   return (bus_read_1(res, 1));/* Data */
+}
+
+static int
+sb8xx_attach(device_t dev)
+{
+   static const intAMDSB_PMIO_INDEX = 0xcd6;
+   static const intAMDSB_PMIO_WIDTH = 2;
+   static const intAMDSB8_SMBUS_ADDR = 0x2c;
+   static const intAMDSB8_SMBUS_EN = 0x01;
+   static const intAMDSB8_SMBUS_ADDR_MASK = ~0x1fu;
+   static const intAMDSB_SMBIO_WIDTH = 0x14;
+   static const intAMDSB_SMBUS_CFG = 0x10;
+   static const intAMDSB_SMBUS_IRQ = 0x01;
+   static const intAMDSB_SMBUS_REV_MASK = ~0x0fu;
+   static const intAMDSB_SMBUS_REV_SHIFT = 4;
+   static const intAMDSB_IO_RID = 0;
+
+   struct intsmb_softc *sc;
+   struct resource *res;
+   uint16_taddr;
+   uint8_t cfg;
+   int rid;
+   int rc;
+
+   sc = device_get_softc(dev);
+   rid = AMDSB_IO_RID;
+   rc = bus_set_resource(dev, SYS_RES_IOPORT, rid, AMDSB_PMIO_INDEX,
+   AMDSB_PMIO_WIDTH);
+   if (rc != 0) {
+   device_printf(dev, "bus_set_resource for PM IO failed\n");
+   return (ENXIO);
+   }
+   res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, ,
+   RF_ACTIVE | RF_SHAREABLE);
+   if (res == NULL) {
+   device_printf(dev, "bus_alloc_resource for PM IO failed\n");
+   return (ENXIO);
+   }
+
+   addr = sb8xx_pmio_read(res, AMDSB8_SMBUS_ADDR + 1);
+   addr <<= 8;
+   addr |= sb8xx_pmio_read(res, AMDSB8_SMBUS_ADDR);
+
+   bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
+   bus_delete_resource(dev, SYS_RES_IOPORT, rid);
+
+   if ((addr & AMDSB8_SMBUS_EN) == 0) {
+   device_printf(dev, "SB8xx SMBus not enabled\n");
+   return (ENXIO);
+   }
+
+   addr &= AMDSB8_SMBUS_ADDR_MASK;
+   sc->io_rid = AMDSB_IO_RID;
+   rc = bus_set_resource(dev, SYS_RES_IOPORT, sc->io_rid, addr,
+   AMDSB_SMBIO_WIDTH);
+   if (rc != 0) {
+   device_printf(dev, "bus_set_resource for SMBus IO failed\n");
+   return (ENXIO);
+   }
+   if (res == NULL) {
+   device_printf(dev, "bus_alloc_resource for SMBus IO failed\n");
+   return (ENXIO);
+   }
+   sc->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, >io_rid,
+   RF_ACTIVE | RF_SHAREABLE);
+   cfg = bus_read_1(sc->io_res, AMDSB_SMBUS_CFG);
+
+   sc->poll = 1;
+   device_printf(dev, "intr %s disabled ",
+   (cfg & AMDSB_SMBUS_IRQ) != 0 ? "IRQ" : "SMI");
+   printf("revision %d\n",
+   (cfg & AMDSB_SMBUS_REV_MASK) >> AMDSB_SMBUS_REV_SHIFT);
+
+   return (0);
+}
+
 

Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Toomas Soome

> On 23. aug 2016, at 11:22, Andriy Gapon  wrote:
> 
> On 22/08/2016 17:56, Toomas Soome wrote:
>> Actually I only now realized I was comparing apples with oranges… I forgot
>> the fbsd builds 32bit version in ficl32, this one is 64bit. and yes the 32bit
>> version is not that big at all:D
>> 
>> Also, after done some digging, I have found few instances of duplicated code
>> (we can share sha2 with geli and so if sha512 is already needed, it will
>> become another “free lunch”). Also, unless I’m mistaken, for some reason the
>> bzip *compression* is brought in - correct me if I’m wrong, but afaik only
>> decompression is needed…
>> 
>> So before going after “useless features”, there are some “hidden” resources
>> to remove extra fat.
> 
> I certainly agree with this and those things would be good to do.
> But if we do not change the trend then sooner or later we will run out of 
> things
> that we can optimize.  But it's also possible that the current limitations 
> will
> be a history by then.
> 
> -- 
> Andriy Gapon

Yes, also from my illumos work, even building framebuffer based GFX interface 
haven’t added too much extra code, but it is important to recognize the limits, 
and this issue did  provide really good lesson about it;)

Right now there are two tasks to finalize - complete the review/test/fix for 
proper compiler options, and to understand the actual limits regarding userboot 
module - for me it is absolutely unknown area.

rgds,
toomas

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

Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Andriy Gapon
On 22/08/2016 17:56, Toomas Soome wrote:
> Actually I only now realized I was comparing apples with oranges… I forgot
> the fbsd builds 32bit version in ficl32, this one is 64bit. and yes the 32bit
> version is not that big at all:D
> 
> Also, after done some digging, I have found few instances of duplicated code
> (we can share sha2 with geli and so if sha512 is already needed, it will
> become another “free lunch”). Also, unless I’m mistaken, for some reason the
> bzip *compression* is brought in - correct me if I’m wrong, but afaik only
> decompression is needed…
> 
> So before going after “useless features”, there are some “hidden” resources
> to remove extra fat.

I certainly agree with this and those things would be good to do.
But if we do not change the trend then sooner or later we will run out of things
that we can optimize.  But it's also possible that the current limitations will
be a history by then.

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

Re: svn commit: r304321 - in head/sys: boot/efi/boot1 boot/efi/loader boot/i386/boot2 boot/i386/gptboot boot/i386/gptzfsboot boot/i386/zfsboot boot/userboot/ficl boot/userboot/userboot boot/userboot/z

2016-08-23 Thread Toomas Soome

> On 22. aug 2016, at 17:56, Toomas Soome  wrote:
> 
> 
>> On 22. aug 2016, at 17:19, Warner Losh  wrote:
>> 
>> On Mon, Aug 22, 2016 at 3:44 AM, Toomas Soome  wrote:
>>> I do suspect the size difference there is partially due to ficl, in illumos 
>>> (ficl 4):
>>> 
>>> -rw-r--r--   1 tsoome   staff 132508 aug 22 09:18 libficl.a
>>> 
>>> and freebsd (ficl 3):
>>> 
>>> -rw-r--r--  1 root  wheel  213748 Aug 19 01:57 libficl.a
>>> 
>>> so, there definitely is some space…
>> 
>> Same compiler? Clang bloats the boot code rather substantially, even after
>> all the flags to tell it to generate smaller code are used. gcc 4.2.x
>> built stuff
>> was substantially smaller.
>> 
>> There's a 520kb limit enforced in the boot1 for similar reasons. Looks like
>> the combination of options makes us use just enough extra memory to
>> sink the battleship...
>> 
>> Warner
>> 
> 
> 
> Actually I only now realized I was comparing apples with oranges… I forgot 
> the fbsd builds 32bit version in ficl32, this one is 64bit. and yes the 32bit 
> version is not that big at all:D
> 
> Also, after done some digging, I have found few instances of duplicated code 
> (we can share sha2 with geli and so if sha512 is already needed, it will 
> become another “free lunch”). Also, unless I’m mistaken, for some reason the 
> bzip *compression* is brought in - correct me if I’m wrong, but afaik only 
> decompression is needed…
> 
> So before going after “useless features”, there are some “hidden” resources 
> to remove extra fat.
> 

I did some more digging. while ld has —gc-sections to clean up unused bits, to 
make it effective, the code build does also need -Os -fdata-sections 
-ffunction-sections.
So I did just very simple test by adding those flags to bsd.stand.mk and:

first the “default” binaries from /boot:
-r-xr-xr-x  1 root  wheel  446464 Aug 19 08:46 /boot/zfsloader
-rw-r--r--  1 root  wheel  438272 Aug 23 00:30 /boot/zfsloader.b
-r-xr-xr-x  1 root  wheel  446464 Aug  5 08:37 /boot/zfsloader.old
-r--r--r--  1 root  wheel  406568 Aug 19 08:46 /boot/userboot.so

(note, zfsloader.b here is built with https://reviews.freebsd.org/D7600)

now after adding compile flags  -Os -fdata-sections -ffunction-sections:

-rw-r--r--  1 root  wheel  389120 Aug 23 10:12 zfsloader
-rwxr-xr-x  1 root  wheel  378156 Aug 23 10:12 zfsloader.bin
-rwxr-xr-x  1 root  wheel  437514 Aug 23 10:12 zfsloader.sym
-rwxr-xr-x  1 root  wheel  375912 Aug 23 10:03 userboot.so

and finally test for Andriy with:
LOADER_BZIP2_SUPPORT=yes
LOADER_FIREWIRE_SUPPORT=yes

-rw-r--r--  1 root  wheel  421888 Aug 23 10:22 zfsloader
-rwxr-xr-x  1 root  wheel  409932 Aug 23 10:22 zfsloader.bin
-rwxr-xr-x  1 root  wheel  472021 Aug 23 10:22 zfsloader.sym
-rwxr-xr-x  1 root  wheel  375912 Aug 23 10:22 userboot.so

note the userboot.so did not change from those flags.

This is just an result from compile, and by adding 3 options to bsd.stand.mk; 
however, not all Makefiles in loader tree seem to include it, and most 
importantly, haven’t tested real boot yet;)

To conclude, some more work is needed to review the Makefiles, build options 
used etc, also I don’t know all the background why the compiler options are set 
as they currently are - were there any related compiler/linker bugs, or any 
other reasons, also how/if other platforms are affected - for example 
bsd.stand.mk does set -Os for pc98, but not for others…

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