svn commit: r304586 - releng/11.0/sys/dev/hyperv/storvsc

2016-08-21 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Aug 22 05:38:44 2016
New Revision: 304586
URL: https://svnweb.freebsd.org/changeset/base/304586

Log:
  MFC 304251
  
  hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.
  
  SRB status is set to 0x20 by the hypervisor, if the specified LUN is
  unaccessible, and even worse the INQUIRY response will not be set by
  the hypervisor at all under this situation.  Additionally, SRB status
  is 0x20 too, for TUR on an unaccessible LUN.
  
  Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
  Scott Long, other values seems improper.
  
  This commit fixes the Hyper-V disk hotplug support.
  
  Submitted by:   Hongjiang Zhang 
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7521
  
  Approved by:  re (kib)

Modified:
  releng/11.0/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  releng/11.0/sys/dev/hyperv/storvsc/hv_vstorage.h
Directory Properties:
  releng/11.0/   (props changed)

Modified: releng/11.0/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- releng/11.0/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 22 
03:48:39 2016(r304585)
+++ releng/11.0/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 22 
05:38:44 2016(r304586)
@@ -810,6 +810,7 @@ hv_storvsc_on_iocompletion(struct storvs
 * because the fields will be used later in storvsc_io_done().
 */
request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status;
+   request->vstor_packet.u.vm_srb.srb_status = vm_srb->srb_status;
request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len;
 
if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) &&
@@ -1945,28 +1946,6 @@ create_storvsc_request(union ccb *ccb, s
return(0);
 }
 
-/*
- * SCSI Inquiry checks qualifier and type.
- * If qualifier is 011b, means the device server is not capable
- * of supporting a peripheral device on this logical unit, and
- * the type should be set to 1Fh.
- * 
- * Return 1 if it is valid, 0 otherwise.
- */
-static inline int
-is_inquiry_valid(const struct scsi_inquiry_data *inq_data)
-{
-   uint8_t type;
-   if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) {
-   return (0);
-   }
-   type = SID_TYPE(inq_data);
-   if (type == T_NODEVICE) {
-   return (0);
-   }
-   return (1);
-}
-
 /**
  * @brief completion function before returning to CAM
  *
@@ -1985,7 +1964,6 @@ storvsc_io_done(struct hv_storvsc_reques
struct vmscsi_req *vm_srb = >vstor_packet.u.vm_srb;
bus_dma_segment_t *ori_sglist = NULL;
int ori_sg_count = 0;
-
/* destroy bounce buffer if it is used */
if (reqp->bounce_sgl_count) {
ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;
@@ -2040,88 +2018,71 @@ storvsc_io_done(struct hv_storvsc_reques
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
if (vm_srb->scsi_status == SCSI_STATUS_OK) {
const struct scsi_generic *cmd;
-   /*
-* Check whether the data for INQUIRY cmd is valid or
-* not.  Windows 10 and Windows 2016 send all zero
-* inquiry data to VM even for unpopulated slots.
-*/
+
+   if (vm_srb->srb_status != SRB_STATUS_SUCCESS) {
+   if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) {
+   xpt_print(ccb->ccb_h.path, "invalid LUN %d\n",
+   vm_srb->lun);
+   } else {
+   xpt_print(ccb->ccb_h.path, "Unknown SRB flag: 
%d\n",
+   vm_srb->srb_status);
+   }
+   /*
+* If there are errors, for example, invalid LUN,
+* host will inform VM through SRB status.
+*/
+   ccb->ccb_h.status |= CAM_SEL_TIMEOUT;
+   } else {
+   ccb->ccb_h.status |= CAM_REQ_CMP;
+   }
+
cmd = (const struct scsi_generic *)
((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
 csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
if (cmd->opcode == INQUIRY) {
-   /*
-* The host of Windows 10 or 2016 server will response
-* the inquiry request with invalid data for unexisted 
device:
-   [0x7f 0x0 0x5 0x2 0x1f ... ]
-* But on windows 2012 R2, the response is:
-   [0x7f 0x0 0x0 0x0 0x0 ]
-* That is why here wants to validate the inquiry response.
-* The validation will skip the INQUIRY whose response is 
short,
-* which is 

Re: svn commit: r304584 - head/sys/dev/alc

2016-08-21 Thread YongHyeon PYUN
On Mon, Aug 22, 2016 at 03:28:06AM +, Pyun YongHyeon wrote:
> Author: yongari
> Date: Mon Aug 22 03:28:06 2016
> New Revision: 304584
> URL: https://svnweb.freebsd.org/changeset/base/304584
> 
> Log:
>   Add a missing change in r304575.
>   
>   Noticed by: jhb

Actually it was pointed out by markj. Sorry.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304584 - head/sys/dev/alc

2016-08-21 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug 22 03:28:06 2016
New Revision: 304584
URL: https://svnweb.freebsd.org/changeset/base/304584

Log:
  Add a missing change in r304575.
  
  Noticed by:   jhb

Modified:
  head/sys/dev/alc/if_alcvar.h

Modified: head/sys/dev/alc/if_alcvar.h
==
--- head/sys/dev/alc/if_alcvar.hMon Aug 22 03:23:28 2016
(r304583)
+++ head/sys/dev/alc/if_alcvar.hMon Aug 22 03:28:06 2016
(r304584)
@@ -235,7 +235,8 @@ struct alc_softc {
 #defineALC_FLAG_APS0x1000
 #defineALC_FLAG_AR816X_FAMILY  0x2000
 #defineALC_FLAG_LINK_WAR   0x4000
-#defineALC_FLAG_LINK   0x8000
+#defineALC_FLAG_E2X00  0x8000
+#defineALC_FLAG_LINK   0x1
 
struct callout  alc_tick_ch;
struct alc_hw_stats alc_stats;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304582 - stable/11/sys/dev/hyperv/storvsc

2016-08-21 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Aug 22 02:23:05 2016
New Revision: 304582
URL: https://svnweb.freebsd.org/changeset/base/304582

Log:
  MFC 304251
  
  hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.
  
  SRB status is set to 0x20 by the hypervisor, if the specified LUN is
  unaccessible, and even worse the INQUIRY response will not be set by
  the hypervisor at all under this situation.  Additionally, SRB status
  is 0x20 too, for TUR on an unaccessible LUN.
  
  Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
  Scott Long, other values seems improper.
  
  This commit fixes the Hyper-V disk hotplug support.
  
  Submitted by:   Hongjiang Zhang 
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7521

Modified:
  stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c   Mon Aug 22 
02:11:30 2016(r304581)
+++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c   Mon Aug 22 
02:23:05 2016(r304582)
@@ -810,6 +810,7 @@ hv_storvsc_on_iocompletion(struct storvs
 * because the fields will be used later in storvsc_io_done().
 */
request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status;
+   request->vstor_packet.u.vm_srb.srb_status = vm_srb->srb_status;
request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len;
 
if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) &&
@@ -1945,28 +1946,6 @@ create_storvsc_request(union ccb *ccb, s
return(0);
 }
 
-/*
- * SCSI Inquiry checks qualifier and type.
- * If qualifier is 011b, means the device server is not capable
- * of supporting a peripheral device on this logical unit, and
- * the type should be set to 1Fh.
- * 
- * Return 1 if it is valid, 0 otherwise.
- */
-static inline int
-is_inquiry_valid(const struct scsi_inquiry_data *inq_data)
-{
-   uint8_t type;
-   if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) {
-   return (0);
-   }
-   type = SID_TYPE(inq_data);
-   if (type == T_NODEVICE) {
-   return (0);
-   }
-   return (1);
-}
-
 /**
  * @brief completion function before returning to CAM
  *
@@ -1985,7 +1964,6 @@ storvsc_io_done(struct hv_storvsc_reques
struct vmscsi_req *vm_srb = >vstor_packet.u.vm_srb;
bus_dma_segment_t *ori_sglist = NULL;
int ori_sg_count = 0;
-
/* destroy bounce buffer if it is used */
if (reqp->bounce_sgl_count) {
ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;
@@ -2040,88 +2018,71 @@ storvsc_io_done(struct hv_storvsc_reques
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
if (vm_srb->scsi_status == SCSI_STATUS_OK) {
const struct scsi_generic *cmd;
-   /*
-* Check whether the data for INQUIRY cmd is valid or
-* not.  Windows 10 and Windows 2016 send all zero
-* inquiry data to VM even for unpopulated slots.
-*/
+
+   if (vm_srb->srb_status != SRB_STATUS_SUCCESS) {
+   if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) {
+   xpt_print(ccb->ccb_h.path, "invalid LUN %d\n",
+   vm_srb->lun);
+   } else {
+   xpt_print(ccb->ccb_h.path, "Unknown SRB flag: 
%d\n",
+   vm_srb->srb_status);
+   }
+   /*
+* If there are errors, for example, invalid LUN,
+* host will inform VM through SRB status.
+*/
+   ccb->ccb_h.status |= CAM_SEL_TIMEOUT;
+   } else {
+   ccb->ccb_h.status |= CAM_REQ_CMP;
+   }
+
cmd = (const struct scsi_generic *)
((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
 csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
if (cmd->opcode == INQUIRY) {
-   /*
-* The host of Windows 10 or 2016 server will response
-* the inquiry request with invalid data for unexisted 
device:
-   [0x7f 0x0 0x5 0x2 0x1f ... ]
-* But on windows 2012 R2, the response is:
-   [0x7f 0x0 0x0 0x0 0x0 ]
-* That is why here wants to validate the inquiry response.
-* The validation will skip the INQUIRY whose response is 
short,
-* which is less than SHORT_INQUIRY_LENGTH (36).
- 

svn commit: r304581 - stable/10/sys/dev/hyperv/storvsc

2016-08-21 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Aug 22 02:11:30 2016
New Revision: 304581
URL: https://svnweb.freebsd.org/changeset/base/304581

Log:
  MFC 304251
  
  hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.
  
  SRB status is set to 0x20 by the hypervisor, if the specified LUN is
  unaccessible, and even worse the INQUIRY response will not be set by
  the hypervisor at all under this situation.  Additionally, SRB status
  is 0x20 too, for TUR on an unaccessible LUN.
  
  Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
  Scott Long, other values seems improper.
  
  This commit fixes the Hyper-V disk hotplug support.
  
  Submitted by:   Hongjiang Zhang 
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7521

Modified:
  stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c   Mon Aug 22 
01:46:04 2016(r304580)
+++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c   Mon Aug 22 
02:11:30 2016(r304581)
@@ -810,6 +810,7 @@ hv_storvsc_on_iocompletion(struct storvs
 * because the fields will be used later in storvsc_io_done().
 */
request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status;
+   request->vstor_packet.u.vm_srb.srb_status = vm_srb->srb_status;
request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len;
 
if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) &&
@@ -1945,28 +1946,6 @@ create_storvsc_request(union ccb *ccb, s
return(0);
 }
 
-/*
- * SCSI Inquiry checks qualifier and type.
- * If qualifier is 011b, means the device server is not capable
- * of supporting a peripheral device on this logical unit, and
- * the type should be set to 1Fh.
- * 
- * Return 1 if it is valid, 0 otherwise.
- */
-static inline int
-is_inquiry_valid(const struct scsi_inquiry_data *inq_data)
-{
-   uint8_t type;
-   if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) {
-   return (0);
-   }
-   type = SID_TYPE(inq_data);
-   if (type == T_NODEVICE) {
-   return (0);
-   }
-   return (1);
-}
-
 /**
  * @brief completion function before returning to CAM
  *
@@ -1985,7 +1964,6 @@ storvsc_io_done(struct hv_storvsc_reques
struct vmscsi_req *vm_srb = >vstor_packet.u.vm_srb;
bus_dma_segment_t *ori_sglist = NULL;
int ori_sg_count = 0;
-
/* destroy bounce buffer if it is used */
if (reqp->bounce_sgl_count) {
ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;
@@ -2040,88 +2018,71 @@ storvsc_io_done(struct hv_storvsc_reques
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
if (vm_srb->scsi_status == SCSI_STATUS_OK) {
const struct scsi_generic *cmd;
-   /*
-* Check whether the data for INQUIRY cmd is valid or
-* not.  Windows 10 and Windows 2016 send all zero
-* inquiry data to VM even for unpopulated slots.
-*/
+
+   if (vm_srb->srb_status != SRB_STATUS_SUCCESS) {
+   if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) {
+   xpt_print(ccb->ccb_h.path, "invalid LUN %d\n",
+   vm_srb->lun);
+   } else {
+   xpt_print(ccb->ccb_h.path, "Unknown SRB flag: 
%d\n",
+   vm_srb->srb_status);
+   }
+   /*
+* If there are errors, for example, invalid LUN,
+* host will inform VM through SRB status.
+*/
+   ccb->ccb_h.status |= CAM_SEL_TIMEOUT;
+   } else {
+   ccb->ccb_h.status |= CAM_REQ_CMP;
+   }
+
cmd = (const struct scsi_generic *)
((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
 csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
if (cmd->opcode == INQUIRY) {
-   /*
-* The host of Windows 10 or 2016 server will response
-* the inquiry request with invalid data for unexisted 
device:
-   [0x7f 0x0 0x5 0x2 0x1f ... ]
-* But on windows 2012 R2, the response is:
-   [0x7f 0x0 0x0 0x0 0x0 ]
-* That is why here wants to validate the inquiry response.
-* The validation will skip the INQUIRY whose response is 
short,
-* which is less than SHORT_INQUIRY_LENGTH (36).
- 

svn commit: r304579 - head/sys/netinet

2016-08-21 Thread Michael Tuexen
Author: tuexen
Date: Mon Aug 22 01:45:29 2016
New Revision: 304579
URL: https://svnweb.freebsd.org/changeset/base/304579

Log:
  Improve the locking when sending user messages.
  
  First, keep a ref count on the stcb after looking it up, as
  done in the other lookup cases.
  Second, before looking again at sp, ensure that it is not
  freed, because the assoc is about to be freed.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Mon Aug 22 01:43:47 2016
(r304578)
+++ head/sys/netinet/sctp_output.c  Mon Aug 22 01:45:29 2016
(r304579)
@@ -12639,7 +12639,10 @@ sctp_lower_sosend(struct socket *so,
}
SCTP_INP_RUNLOCK(inp);
} else if (sinfo_assoc_id) {
-   stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 0);
+   stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 1);
+   if (stcb != NULL) {
+   hold_tcblock = 1;
+   }
} else if (addr) {
/*-
 * Since we did not use findep we must
@@ -13404,6 +13407,10 @@ skip_preblock:
}
}
SCTP_TCB_SEND_LOCK(stcb);
+   if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
+   SCTP_TCB_SEND_UNLOCK(stcb);
+   goto out_unlocked;
+   }
if (sp) {
if (sp->msg_is_complete == 0) {
strm->last_msg_incomplete = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-08-21 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug 22 01:28:02 2016
New Revision: 304576
URL: https://svnweb.freebsd.org/changeset/base/304576

Log:
  Add Killer E2400 to the supported hardware list.

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

Modified: head/share/man/man4/alc.4
==
--- head/share/man/man4/alc.4   Mon Aug 22 01:19:05 2016(r304575)
+++ head/share/man/man4/alc.4   Mon Aug 22 01:28:02 2016(r304576)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 8, 2014
+.Dd August 22, 2016
 .Dt ALC 4
 .Os
 .Sh NAME
@@ -122,6 +122,8 @@ Atheros AR8171 PCI Express Gigabit Ether
 Atheros AR8172 PCI Express Fast Ethernet controller
 .It
 Killer E2200 Gigabit Ethernet controller
+.It
+Killer E2400 Gigabit Ethernet controller
 .El
 .Sh LOADER TUNABLES
 Tunables can be set at the
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304575 - in head/sys/dev: alc pci

2016-08-21 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug 22 01:19:05 2016
New Revision: 304575
URL: https://svnweb.freebsd.org/changeset/base/304575

Log:
  Add Killer E2400 Gigabit Ethernet support.
  It seems Killer E2200/E2400 has a BIOS misconfiguration or silicon
  bug which triggers DMA write errors when driver uses advertised
  maximum payload size.  Force the maximum payload size to 128 bytes
  in DMA configuration.
  This change should fix occasional DMA write errors reported on
  Killer E2200.
  
  Tested by:

Modified:
  head/sys/dev/alc/if_alc.c
  head/sys/dev/alc/if_alcreg.h
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/alc/if_alc.c
==
--- head/sys/dev/alc/if_alc.c   Mon Aug 22 01:06:54 2016(r304574)
+++ head/sys/dev/alc/if_alc.c   Mon Aug 22 01:19:05 2016(r304575)
@@ -121,6 +121,8 @@ static struct alc_ident alc_ident_table[
"Atheros AR8172 PCIe Fast Ethernet" },
{ VENDORID_ATHEROS, DEVICEID_ATHEROS_E2200, 9 * 1024,
"Killer E2200 Gigabit Ethernet" },
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2400, 9 * 1024,
+   "Killer E2400 Gigabit Ethernet" },
{ 0, 0, 0, NULL}
 };
 
@@ -1080,6 +1082,7 @@ alc_phy_down(struct alc_softc *sc)
switch (sc->alc_ident->deviceid) {
case DEVICEID_ATHEROS_AR8161:
case DEVICEID_ATHEROS_E2200:
+   case DEVICEID_ATHEROS_E2400:
case DEVICEID_ATHEROS_AR8162:
case DEVICEID_ATHEROS_AR8171:
case DEVICEID_ATHEROS_AR8172:
@@ -1397,12 +1400,15 @@ alc_attach(device_t dev)
 * shows the same PHY model/revision number of AR8131.
 */
switch (sc->alc_ident->deviceid) {
+   case DEVICEID_ATHEROS_E2200:
+   case DEVICEID_ATHEROS_E2400:
+   sc->alc_flags |= ALC_FLAG_E2X00;
+   /* FALLTHROUGH */
case DEVICEID_ATHEROS_AR8161:
if (pci_get_subvendor(dev) == VENDORID_ATHEROS &&
pci_get_subdevice(dev) == 0x0091 && sc->alc_rev == 0)
sc->alc_flags |= ALC_FLAG_LINK_WAR;
/* FALLTHROUGH */
-   case DEVICEID_ATHEROS_E2200:
case DEVICEID_ATHEROS_AR8171:
sc->alc_flags |= ALC_FLAG_AR816X_FAMILY;
break;
@@ -1473,6 +1479,12 @@ alc_attach(device_t dev)
sc->alc_dma_rd_burst = 3;
if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024)
sc->alc_dma_wr_burst = 3;
+   /*
+* Force maximum payload size to 128 bytes for E2200/E2400.
+* Otherwise it triggers DMA write error.
+*/
+   if ((sc->alc_flags & ALC_FLAG_E2X00) != 0)
+   sc->alc_dma_wr_burst = 0;
alc_init_pcie(sc);
}
 

Modified: head/sys/dev/alc/if_alcreg.h
==
--- head/sys/dev/alc/if_alcreg.hMon Aug 22 01:06:54 2016
(r304574)
+++ head/sys/dev/alc/if_alcreg.hMon Aug 22 01:19:05 2016
(r304575)
@@ -45,10 +45,11 @@
 #defineDEVICEID_ATHEROS_AR8152_B   0x2060  /* L2C V1.1 */
 #defineDEVICEID_ATHEROS_AR8152_B2  0x2062  /* L2C V2.0 */
 #defineDEVICEID_ATHEROS_AR8161 0x1091
-#defineDEVICEID_ATHEROS_E2200  0xE091
 #defineDEVICEID_ATHEROS_AR8162 0x1090
 #defineDEVICEID_ATHEROS_AR8171 0x10A1
 #defineDEVICEID_ATHEROS_AR8172 0x10A0
+#defineDEVICEID_ATHEROS_E2200  0xE091
+#defineDEVICEID_ATHEROS_E2400  0xE0A1
 
 #defineATHEROS_AR8152_B_V100xC0
 #defineATHEROS_AR8152_B_V110xC1

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Mon Aug 22 01:06:54 2016(r304574)
+++ head/sys/dev/pci/pci.c  Mon Aug 22 01:19:05 2016(r304575)
@@ -281,12 +281,13 @@ static const struct pci_quirk pci_quirks
{ 0x43851002, PCI_QUIRK_UNMAP_REG,  0x14,   0 },
 
/*
-* Atheros AR8161/AR8162/E2200 Ethernet controllers have a bug that
-* MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of the
-* command register is set.
+* Atheros AR8161/AR8162/E2200/E2400 Ethernet controllers have a
+* bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit
+* of the command register is set.
 */
{ 0x10911969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
{ 0xE0911969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
+   { 0xE0A11969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
{ 0x10901969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To 

svn commit: r304574 - head/sys/dev/alc

2016-08-21 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug 22 01:06:54 2016
New Revision: 304574
URL: https://svnweb.freebsd.org/changeset/base/304574

Log:
  Correct DMA channel number selection on AR816x family of
  controllers. For Gigabit Ethernet version of AR816x, AR813x/AR815x
  except L1D controller, use vendor recommended ASPM parameters.
  While here, increase alc_dma_burst array size.  Broken H/W can
  return bogus value in theory.

Modified:
  head/sys/dev/alc/if_alc.c

Modified: head/sys/dev/alc/if_alc.c
==
--- head/sys/dev/alc/if_alc.c   Mon Aug 22 00:40:45 2016(r304573)
+++ head/sys/dev/alc/if_alc.c   Mon Aug 22 01:06:54 2016(r304574)
@@ -255,7 +255,7 @@ static struct resource_spec alc_irq_spec
{ -1,   0,  0 }
 };
 
-static uint32_t alc_dma_burst[] = { 128, 256, 512, 1024, 2048, 4096, 0 };
+static uint32_t alc_dma_burst[] = { 128, 256, 512, 1024, 2048, 4096, 0, 0 };
 
 static int
 alc_miibus_readreg(device_t dev, int phy, int reg)
@@ -4184,13 +4184,17 @@ alc_init_locked(struct alc_softc *sc)
reg = (RXQ_CFG_RD_BURST_DEFAULT << RXQ_CFG_RD_BURST_SHIFT) &
RXQ_CFG_RD_BURST_MASK;
reg |= RXQ_CFG_RSS_MODE_DIS;
-   if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0)
+   if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) {
reg |= (RXQ_CFG_816X_IDT_TBL_SIZE_DEFAULT <<
RXQ_CFG_816X_IDT_TBL_SIZE_SHIFT) &
RXQ_CFG_816X_IDT_TBL_SIZE_MASK;
-   if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0 &&
-   sc->alc_ident->deviceid != DEVICEID_ATHEROS_AR8151_V2)
-   reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_1M;
+   if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0)
+   reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M;
+   } else {
+   if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0 &&
+   sc->alc_ident->deviceid != DEVICEID_ATHEROS_AR8151_V2)
+   reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M;
+   }
CSR_WRITE_4(sc, ALC_RXQ_CFG, reg);
 
/* Configure DMA parameters. */
@@ -4214,12 +4218,12 @@ alc_init_locked(struct alc_softc *sc)
switch (AR816X_REV(sc->alc_rev)) {
case AR816X_REV_A0:
case AR816X_REV_A1:
-   reg |= DMA_CFG_RD_CHNL_SEL_1;
+   reg |= DMA_CFG_RD_CHNL_SEL_2;
break;
case AR816X_REV_B0:
/* FALLTHROUGH */
default:
-   reg |= DMA_CFG_RD_CHNL_SEL_3;
+   reg |= DMA_CFG_RD_CHNL_SEL_4;
break;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304573 - head/sys/netinet

2016-08-21 Thread Michael Tuexen
Author: tuexen
Date: Mon Aug 22 00:40:45 2016
New Revision: 304573
URL: https://svnweb.freebsd.org/changeset/base/304573

Log:
  Remove duplicate code, which is not protected by the appropriate locks.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Sun Aug 21 18:55:30 2016
(r304572)
+++ head/sys/netinet/sctp_usrreq.c  Mon Aug 22 00:40:45 2016
(r304573)
@@ -1506,11 +1506,6 @@ sctp_do_connect_x(struct socket *so, str
sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
}
SCTP_TCB_UNLOCK(stcb);
-   if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
-   stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED;
-   /* Set the connected flag so we can queue data */
-   soisconnecting(so);
-   }
 out_now:
if (creat_lock_on) {
SCTP_ASOC_CREATE_UNLOCK(inp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304569 - stable/10/usr.sbin/bhyve

2016-08-21 Thread Sean C. Farley

On Sun, 21 Aug 2016, Alexander Motin wrote:


Author: mav
Date: Sun Aug 21 17:57:32 2016
New Revision: 304569
URL: https://svnweb.freebsd.org/changeset/base/304569

Log:
 MFC r298355:
 Don't use SYSDIR to avoid conflicts with existing usage.
 Also, use SRCTOP to locate the top of the source tree
 instead of a relative path.

 PR:208856


Thanks!

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


Re: svn commit: r304513 - in head: . share/man/man4/man4.i386 sys/conf sys/dev/ie sys/i386/conf sys/modules sys/modules/ie sys/pc98/conf

2016-08-21 Thread Peter Jeremy
On 2016-Aug-20 07:51:55 -0700, John Baldwin  wrote:
>- tty drivers that haven't been updated to new tty and have been disconnected
>  from the build since 8.0 including digi(4) and cy(4).  I know Bruce has
>  patches for sio(4) that I just haven't merged, so I'm inclined to leave
>  sio(4), but the other disconnected drivers are candidates I think.

I have digi(4) patches but no longer have any digi cards.  Judging by the
time since they were disconnected, I think they can be deleted.

-- 
Peter Jeremy


signature.asc
Description: PGP signature


Re: svn commit: r304572 - in head: sbin/ipfw sys/conf sys/netinet sys/netinet6

2016-08-21 Thread Slawa Olhovchenkov
On Sun, Aug 21, 2016 at 07:20:12PM +, Bjoern A. Zeeb wrote:

> On 21 Aug 2016, at 19:08, Slawa Olhovchenkov wrote:
> 
> > On Sun, Aug 21, 2016 at 06:55:30PM +, Bjoern A. Zeeb wrote:
> >
> >> Author: bz
> >> Date: Sun Aug 21 18:55:30 2016
> >> New Revision: 304572
> >> URL: https://svnweb.freebsd.org/changeset/base/304572
> >>
> >> Log:
> >>   Remove the kernel optoion for IPSEC_FILTERTUNNEL, which was 
> >> deprecated
> >>   more than 7 years ago in favour of a sysctl in r192648.
> >
> > Need note to UPDAING.
> 
> Why?  The default behaviour hasn’t changed and a new custom kernel 
> with the option will not compile anymore.  Is there a compelling reason 
> to warn users anyway?

Old config don't compiling and need updating? This is break
compatibility and need record in UPDATING (because this place where
find information about like events).
After config updating behaivor changed? Yes. This is need also record
in UPDATING.
For restoring old beheaivor need updating /boot/loader.conf? Yes. This
is also need be documented.

Good documentation is very positive for krama :)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r304572 - in head: sbin/ipfw sys/conf sys/netinet sys/netinet6

2016-08-21 Thread Bjoern A. Zeeb

On 21 Aug 2016, at 19:08, Slawa Olhovchenkov wrote:


On Sun, Aug 21, 2016 at 06:55:30PM +, Bjoern A. Zeeb wrote:


Author: bz
Date: Sun Aug 21 18:55:30 2016
New Revision: 304572
URL: https://svnweb.freebsd.org/changeset/base/304572

Log:
  Remove the kernel optoion for IPSEC_FILTERTUNNEL, which was 
deprecated

  more than 7 years ago in favour of a sysctl in r192648.


Need note to UPDAING.


Why?  The default behaviour hasn’t changed and a new custom kernel 
with the option will not compile anymore.  Is there a compelling reason 
to warn users anyway?

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

Re: svn commit: r304572 - in head: sbin/ipfw sys/conf sys/netinet sys/netinet6

2016-08-21 Thread Slawa Olhovchenkov
On Sun, Aug 21, 2016 at 06:55:30PM +, Bjoern A. Zeeb wrote:

> Author: bz
> Date: Sun Aug 21 18:55:30 2016
> New Revision: 304572
> URL: https://svnweb.freebsd.org/changeset/base/304572
> 
> Log:
>   Remove the kernel optoion for IPSEC_FILTERTUNNEL, which was deprecated
>   more than 7 years ago in favour of a sysctl in r192648.

Need note to UPDAING.

> Modified:
>   head/sbin/ipfw/ipfw.8
>   head/sys/conf/NOTES
>   head/sys/conf/options
>   head/sys/netinet/ip_ipsec.c
>   head/sys/netinet6/ip6_ipsec.c
> 
> Modified: head/sbin/ipfw/ipfw.8
> ==
> --- head/sbin/ipfw/ipfw.8 Sun Aug 21 18:37:21 2016(r304571)
> +++ head/sbin/ipfw/ipfw.8 Sun Aug 21 18:55:30 2016(r304572)
> @@ -1,7 +1,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd August 13, 2016
> +.Dd August 21, 2016
>  .Dt IPFW 8
>  .Os
>  .Sh NAME
> @@ -1588,8 +1588,7 @@ Matches IPv4 packets whose precedence fi
>  .It Cm ipsec
>  Matches packets that have IPSEC history associated with them
>  (i.e., the packet comes encapsulated in IPSEC, the kernel
> -has IPSEC support and IPSEC_FILTERTUNNEL option, and can correctly
> -decapsulate it).
> +has IPSEC support, and can correctly decapsulate it).
>  .Pp
>  Note that specifying
>  .Cm ipsec
> 
> Modified: head/sys/conf/NOTES
> ==
> --- head/sys/conf/NOTES   Sun Aug 21 18:37:21 2016(r304571)
> +++ head/sys/conf/NOTES   Sun Aug 21 18:55:30 2016(r304572)
> @@ -626,17 +626,6 @@ options  TCP_OFFLOAD # TCP offload supp
>  options  IPSEC   #IP security (requires device crypto)
>  #options IPSEC_DEBUG #debug for IP security
>  #
> -# #DEPRECATED#
> -# Set IPSEC_FILTERTUNNEL to change the default of the sysctl to force packets
> -# coming through a tunnel to be processed by any configured packet filtering
> -# twice. The default is that packets coming out of a tunnel are _not_ 
> processed;
> -# they are assumed trusted.
> -#
> -# IPSEC history is preserved for such packets, and can be filtered
> -# using ipfw(8)'s 'ipsec' keyword, when this option is enabled.
> -#
> -#options IPSEC_FILTERTUNNEL  #filter ipsec packets from a tunnel
> -#
>  # Set IPSEC_NAT_T to enable NAT-Traversal support.  This enables
>  # optional UDP encapsulation of ESP packets.
>  #
> 
> Modified: head/sys/conf/options
> ==
> --- head/sys/conf/options Sun Aug 21 18:37:21 2016(r304571)
> +++ head/sys/conf/options Sun Aug 21 18:55:30 2016(r304572)
> @@ -424,7 +424,6 @@ IPFIREWALL_VERBOSEopt_ipfw.h
>  IPFIREWALL_VERBOSE_LIMIT opt_ipfw.h
>  IPSECopt_ipsec.h
>  IPSEC_DEBUG  opt_ipsec.h
> -IPSEC_FILTERTUNNEL   opt_ipsec.h
>  IPSEC_NAT_T  opt_ipsec.h
>  IPSTEALTH
>  KRPC
> 
> Modified: head/sys/netinet/ip_ipsec.c
> ==
> --- head/sys/netinet/ip_ipsec.c   Sun Aug 21 18:37:21 2016
> (r304571)
> +++ head/sys/netinet/ip_ipsec.c   Sun Aug 21 18:55:30 2016
> (r304572)
> @@ -68,11 +68,7 @@ __FBSDID("$FreeBSD$");
>  
>  extern   struct protosw inetsw[];
>  
> -#ifdef IPSEC_FILTERTUNNEL
> -static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 1;
> -#else
>  static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 0;
> -#endif
>  #define  V_ip4_ipsec_filtertunnel VNET(ip4_ipsec_filtertunnel)
>  
>  SYSCTL_DECL(_net_inet_ipsec);
> 
> Modified: head/sys/netinet6/ip6_ipsec.c
> ==
> --- head/sys/netinet6/ip6_ipsec.c Sun Aug 21 18:37:21 2016
> (r304571)
> +++ head/sys/netinet6/ip6_ipsec.c Sun Aug 21 18:55:30 2016
> (r304572)
> @@ -79,11 +79,7 @@ __FBSDID("$FreeBSD$");
>  
>  extern   struct protosw inet6sw[];
>  
> -#ifdef IPSEC_FILTERTUNNEL
> -static VNET_DEFINE(int, ip6_ipsec6_filtertunnel) = 1;
> -#else
>  static VNET_DEFINE(int, ip6_ipsec6_filtertunnel) = 0;
> -#endif
>  #define  V_ip6_ipsec6_filtertunnel   VNET(ip6_ipsec6_filtertunnel)
>  
>  SYSCTL_DECL(_net_inet6_ipsec6);
> ___
> svn-src-all@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304572 - in head: sbin/ipfw sys/conf sys/netinet sys/netinet6

2016-08-21 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Aug 21 18:55:30 2016
New Revision: 304572
URL: https://svnweb.freebsd.org/changeset/base/304572

Log:
  Remove the kernel optoion for IPSEC_FILTERTUNNEL, which was deprecated
  more than 7 years ago in favour of a sysctl in r192648.

Modified:
  head/sbin/ipfw/ipfw.8
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/netinet/ip_ipsec.c
  head/sys/netinet6/ip6_ipsec.c

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Sun Aug 21 18:37:21 2016(r304571)
+++ head/sbin/ipfw/ipfw.8   Sun Aug 21 18:55:30 2016(r304572)
@@ -1,7 +1,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 13, 2016
+.Dd August 21, 2016
 .Dt IPFW 8
 .Os
 .Sh NAME
@@ -1588,8 +1588,7 @@ Matches IPv4 packets whose precedence fi
 .It Cm ipsec
 Matches packets that have IPSEC history associated with them
 (i.e., the packet comes encapsulated in IPSEC, the kernel
-has IPSEC support and IPSEC_FILTERTUNNEL option, and can correctly
-decapsulate it).
+has IPSEC support, and can correctly decapsulate it).
 .Pp
 Note that specifying
 .Cm ipsec

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sun Aug 21 18:37:21 2016(r304571)
+++ head/sys/conf/NOTES Sun Aug 21 18:55:30 2016(r304572)
@@ -626,17 +626,6 @@ optionsTCP_OFFLOAD # TCP offload supp
 optionsIPSEC   #IP security (requires device crypto)
 #options   IPSEC_DEBUG #debug for IP security
 #
-# #DEPRECATED#
-# Set IPSEC_FILTERTUNNEL to change the default of the sysctl to force packets
-# coming through a tunnel to be processed by any configured packet filtering
-# twice. The default is that packets coming out of a tunnel are _not_ 
processed;
-# they are assumed trusted.
-#
-# IPSEC history is preserved for such packets, and can be filtered
-# using ipfw(8)'s 'ipsec' keyword, when this option is enabled.
-#
-#options   IPSEC_FILTERTUNNEL  #filter ipsec packets from a tunnel
-#
 # Set IPSEC_NAT_T to enable NAT-Traversal support.  This enables
 # optional UDP encapsulation of ESP packets.
 #

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Sun Aug 21 18:37:21 2016(r304571)
+++ head/sys/conf/options   Sun Aug 21 18:55:30 2016(r304572)
@@ -424,7 +424,6 @@ IPFIREWALL_VERBOSE  opt_ipfw.h
 IPFIREWALL_VERBOSE_LIMIT   opt_ipfw.h
 IPSEC  opt_ipsec.h
 IPSEC_DEBUGopt_ipsec.h
-IPSEC_FILTERTUNNEL opt_ipsec.h
 IPSEC_NAT_Topt_ipsec.h
 IPSTEALTH
 KRPC

Modified: head/sys/netinet/ip_ipsec.c
==
--- head/sys/netinet/ip_ipsec.c Sun Aug 21 18:37:21 2016(r304571)
+++ head/sys/netinet/ip_ipsec.c Sun Aug 21 18:55:30 2016(r304572)
@@ -68,11 +68,7 @@ __FBSDID("$FreeBSD$");
 
 extern struct protosw inetsw[];
 
-#ifdef IPSEC_FILTERTUNNEL
-static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 1;
-#else
 static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 0;
-#endif
 #defineV_ip4_ipsec_filtertunnel VNET(ip4_ipsec_filtertunnel)
 
 SYSCTL_DECL(_net_inet_ipsec);

Modified: head/sys/netinet6/ip6_ipsec.c
==
--- head/sys/netinet6/ip6_ipsec.c   Sun Aug 21 18:37:21 2016
(r304571)
+++ head/sys/netinet6/ip6_ipsec.c   Sun Aug 21 18:55:30 2016
(r304572)
@@ -79,11 +79,7 @@ __FBSDID("$FreeBSD$");
 
 extern struct protosw inet6sw[];
 
-#ifdef IPSEC_FILTERTUNNEL
-static VNET_DEFINE(int, ip6_ipsec6_filtertunnel) = 1;
-#else
 static VNET_DEFINE(int, ip6_ipsec6_filtertunnel) = 0;
-#endif
 #defineV_ip6_ipsec6_filtertunnel   VNET(ip6_ipsec6_filtertunnel)
 
 SYSCTL_DECL(_net_inet6_ipsec6);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-08-21 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Aug 21 18:37:21 2016
New Revision: 304571
URL: https://svnweb.freebsd.org/changeset/base/304571

Log:
  Make the UKBD USB transfers double buffered and set them up one by one,
  so they are memory independent which allows for handling panics
  triggered by the keyboard driver itself, typically via CTRL+ALT+ESC
  sequences. Or if the USB keyboard driver was processing a key at the
  moment of panic. Allow UKBD to be attached while keyboard polling is active.
  
  Tested by:Bruce Evans 
  MFC after:1 week

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

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Sun Aug 21 18:12:49 2016
(r304570)
+++ head/sys/dev/usb/input/ukbd.c   Sun Aug 21 18:37:21 2016
(r304571)
@@ -108,7 +108,7 @@ SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, pollr
 #defineUKBD_NMOD 8 /* units */
 #defineUKBD_NKEYCODE 6 /* units */
 #defineUKBD_IN_BUF_SIZE  (2*(UKBD_NMOD + (2*UKBD_NKEYCODE)))   /* 
bytes */
-#defineUKBD_IN_BUF_FULL  (UKBD_IN_BUF_SIZE / 2)/* bytes */
+#defineUKBD_IN_BUF_FULL  ((UKBD_IN_BUF_SIZE / 2) - 1)  /* bytes */
 #defineUKBD_NFKEY(sizeof(fkey_tab)/sizeof(fkey_tab[0]))
/* units */
 #defineUKBD_BUFFER_SIZE  64/* bytes */
 
@@ -129,7 +129,8 @@ struct ukbd_data {
 };
 
 enum {
-   UKBD_INTR_DT,
+   UKBD_INTR_DT_0,
+   UKBD_INTR_DT_1,
UKBD_CTRL_LED,
UKBD_N_TRANSFER,
 };
@@ -478,7 +479,8 @@ ukbd_get_key(struct ukbd_softc *sc, uint
if (sc->sc_inputs == 0 &&
(sc->sc_flags & UKBD_FLAG_GONE) == 0) {
/* start transfer, if not already started */
-   usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
+   usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_0]);
+   usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_1]);
}
 
if (sc->sc_flags & UKBD_FLAG_POLLING)
@@ -954,7 +956,16 @@ ukbd_set_leds_callback(struct usb_xfer *
 
 static const struct usb_config ukbd_config[UKBD_N_TRANSFER] = {
 
-   [UKBD_INTR_DT] = {
+   [UKBD_INTR_DT_0] = {
+   .type = UE_INTERRUPT,
+   .endpoint = UE_ADDR_ANY,
+   .direction = UE_DIR_IN,
+   .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
+   .bufsize = 0,   /* use wMaxPacketSize */
+   .callback = _intr_callback,
+   },
+
+   [UKBD_INTR_DT_1] = {
.type = UE_INTERRUPT,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -1201,9 +1212,26 @@ ukbd_attach(device_t dev)
 
usb_callout_init_mtx(>sc_callout, , 0);
 
+#ifdef UKBD_NO_POLLING
err = usbd_transfer_setup(uaa->device,
>info.bIfaceIndex, sc->sc_xfer, ukbd_config,
UKBD_N_TRANSFER, sc, );
+#else
+   /*
+* Setup the UKBD USB transfers one by one, so they are memory
+* independent which allows for handling panics triggered by
+* the keyboard driver itself, typically via CTRL+ALT+ESC
+* sequences. Or if the USB keyboard driver was processing a
+* key at the moment of panic.
+*/
+   for (n = 0; n != UKBD_N_TRANSFER; n++) {
+   err = usbd_transfer_setup(uaa->device,
+   >info.bIfaceIndex, sc->sc_xfer + n, ukbd_config + n,
+   1, sc, );
+   if (err)
+   break;
+   }
+#endif
 
if (err) {
DPRINTF("error=%s\n", usbd_errstr(err));
@@ -1295,11 +1323,13 @@ ukbd_attach(device_t dev)
rate = 1000 / rate;
 
/* set new polling interval in ms */
-   usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT], rate);
+   usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT_0], rate);
+   usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT_1], rate);
}
 #endif
/* start the keyboard */
-   usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
+   usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_0]);
+   usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_1]);
 
return (0); /* success */
 
@@ -1325,7 +1355,8 @@ ukbd_detach(device_t dev)
/* kill any stuck keys */
if (sc->sc_flags & UKBD_FLAG_ATTACHED) {
/* stop receiving events from the USB keyboard */
-   usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT]);
+   usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT_0]);
+   usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT_1]);
 
/* release all leftover keys, if any */
memset(>sc_ndata, 0, sizeof(sc->sc_ndata));
@@ -1979,7 +2010,7 @@ ukbd_poll(keyboard_t *kbd, int on)
 */
if (on)
sc->sc_polling++;
-   

svn commit: r304570 - head/usr.sbin/cron/cron

2016-08-21 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Aug 21 18:12:49 2016
New Revision: 304570
URL: https://svnweb.freebsd.org/changeset/base/304570

Log:
  Add the "-n" flag to cron(8), to prevent it from daemonizing.
  This makes it possible to use it with external supervisors.
  The "-n" flag name is compatible with Linux, NetBSD, and OpenBSD.
  
  Reviewed by:  jilles, pfg, wblock
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D7581

Modified:
  head/usr.sbin/cron/cron/cron.8
  head/usr.sbin/cron/cron/cron.c

Modified: head/usr.sbin/cron/cron/cron.8
==
--- head/usr.sbin/cron/cron/cron.8  Sun Aug 21 17:57:32 2016
(r304569)
+++ head/usr.sbin/cron/cron/cron.8  Sun Aug 21 18:12:49 2016
(r304570)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 29, 2008
+.Dd August 21, 2016
 .Dt CRON 8
 .Os
 .Sh NAME
@@ -28,6 +28,7 @@
 .Op Fl j Ar jitter
 .Op Fl J Ar rootjitter
 .Op Fl m Ar mailto
+.Op Fl n
 .Op Fl s
 .Op Fl o
 .Op Fl x Ar debugflag Ns Op , Ns Ar ...
@@ -132,6 +133,8 @@ set to a null string, usually specified 
 .Li ''
 or
 .Li \*q\*q .
+.It Fl n
+Don't daemonize, run in foreground instead.
 .It Fl s
 Enable special handling of situations when the GMT offset of the local
 timezone changes, such as the switches between the standard time and

Modified: head/usr.sbin/cron/cron/cron.c
==
--- head/usr.sbin/cron/cron/cron.c  Sun Aug 21 17:57:32 2016
(r304569)
+++ head/usr.sbin/cron/cron/cron.c  Sun Aug 21 18:12:49 2016
(r304570)
@@ -49,6 +49,7 @@ static intrun_at_secres(cron_db *);
 
 static time_t  last_time = 0;
 static int dst_enabled = 0;
+static int dont_daemonize = 0;
 struct pidfh *pfh;
 
 static void
@@ -58,7 +59,7 @@ usage() {
 #endif
 
fprintf(stderr, "usage: cron [-j jitter] [-J rootjitter] "
-   "[-m mailto] [-s] [-o] [-x debugflag[,...]]\n");
+   "[-m mailto] [-n ] [-s] [-o] [-x debugflag[,...]]\n");
 #if DEBUGGING
fprintf(stderr, "\ndebugflags: ");
 
@@ -136,7 +137,7 @@ main(argc, argv)
if (0) {
 # endif
(void) fprintf(stderr, "[%d] cron started\n", getpid());
-   } else {
+   } else if (dont_daemonize == 0) {
if (daemon(1, 0) == -1) {
pidfile_remove(pfh);
log_it("CRON",getpid(),"DEATH","can't become daemon");
@@ -512,7 +513,7 @@ parse_args(argc, argv)
int argch;
char*endp;
 
-   while ((argch = getopt(argc, argv, "j:J:m:osx:")) != -1) {
+   while ((argch = getopt(argc, argv, "j:J:m:nosx:")) != -1) {
switch (argch) {
case 'j':
Jitter = strtoul(optarg, , 10);
@@ -529,6 +530,9 @@ parse_args(argc, argv)
case 'm':
defmailto = optarg;
break;
+   case 'n':
+   dont_daemonize = 1;
+   break;
case 'o':
dst_enabled = 0;
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-08-21 Thread Hans Petter Selasky

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.

--HPS

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


svn commit: r304569 - stable/10/usr.sbin/bhyve

2016-08-21 Thread Alexander Motin
Author: mav
Date: Sun Aug 21 17:57:32 2016
New Revision: 304569
URL: https://svnweb.freebsd.org/changeset/base/304569

Log:
  MFC r298355:
  Don't use SYSDIR to avoid conflicts with existing usage.
  Also, use SRCTOP to locate the top of the source tree
  instead of a relative path.
  
  PR:   208856

Modified:
  stable/10/usr.sbin/bhyve/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bhyve/Makefile
==
--- stable/10/usr.sbin/bhyve/Makefile   Sun Aug 21 17:26:16 2016
(r304568)
+++ stable/10/usr.sbin/bhyve/Makefile   Sun Aug 21 17:57:32 2016
(r304569)
@@ -8,6 +8,8 @@ DEBUG_FLAGS= -g -O0 
 
 MAN=   bhyve.8
 
+BHYVE_SYSDIR?=${SRCTOP}
+
 SRCS=  \
atkbdc.c\
acpi.c  \
@@ -43,7 +45,7 @@ SRCS= \
xmsr.c  \
spinup_ap.c
 
-.PATH: ${.CURDIR}/../../sys/amd64/vmm
+.PATH:  ${BHYVE_SYSDIR}/sys/amd64/vmm
 SRCS+= vmm_instruction_emul.c
 
 DPADD= ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304568 - stable/11/sys/net

2016-08-21 Thread Andrey V. Elsukov
Author: ae
Date: Sun Aug 21 17:26:16 2016
New Revision: 304568
URL: https://svnweb.freebsd.org/changeset/base/304568

Log:
  MFC r304313:
Teach netisr_get_cpuid() to limit a given value to supported by netisr.
Use netisr_get_cpuid() in netisr_select_cpuid() to limit cpuid value
returned by protocol to be sure that it is not greather than nws_count.
  
PR: 211836

Modified:
  stable/11/sys/net/if_epair.c
  stable/11/sys/net/netisr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_epair.c
==
--- stable/11/sys/net/if_epair.cSun Aug 21 16:06:00 2016
(r304567)
+++ stable/11/sys/net/if_epair.cSun Aug 21 17:26:16 2016
(r304568)
@@ -807,9 +807,9 @@ epair_clone_create(struct if_clone *ifc,
 * cache locality but we can at least allow parallelism.
 */
sca->cpuid =
-   netisr_get_cpuid(sca->ifp->if_index % netisr_get_cpucount());
+   netisr_get_cpuid(sca->ifp->if_index);
scb->cpuid =
-   netisr_get_cpuid(scb->ifp->if_index % netisr_get_cpucount());
+   netisr_get_cpuid(scb->ifp->if_index);
 
/* Initialise pseudo media types. */
ifmedia_init(>media, 0, epair_media_change, epair_media_status);

Modified: stable/11/sys/net/netisr.c
==
--- stable/11/sys/net/netisr.c  Sun Aug 21 16:06:00 2016(r304567)
+++ stable/11/sys/net/netisr.c  Sun Aug 21 17:26:16 2016(r304568)
@@ -272,10 +272,7 @@ u_int
 netisr_get_cpuid(u_int cpunumber)
 {
 
-   KASSERT(cpunumber < nws_count, ("%s: %u > %u", __func__, cpunumber,
-   nws_count));
-
-   return (nws_array[cpunumber]);
+   return (nws_array[cpunumber % nws_count]);
 }
 
 /*
@@ -810,10 +807,12 @@ netisr_select_cpuid(struct netisr_proto 
 * dispatch.  In the queued case, fall back on the SOURCE
 * policy.
 */
-   if (*cpuidp != NETISR_CPUID_NONE)
+   if (*cpuidp != NETISR_CPUID_NONE) {
+   *cpuidp = netisr_get_cpuid(*cpuidp);
return (m);
+   }
if (dispatch_policy == NETISR_DISPATCH_HYBRID) {
-   *cpuidp = curcpu;
+   *cpuidp = netisr_get_cpuid(curcpu);
return (m);
}
policy = NETISR_POLICY_SOURCE;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Slawa Olhovchenkov
On Mon, Aug 22, 2016 at 02:49:07AM +1000, Bruce Evans wrote:

> On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:
> 
> > On Sun, Aug 21, 2016 at 11:39:02PM +1000, Bruce Evans wrote:
> >
> >> On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:
> >>> I am remeber about platforms with missaligment trap when
> >>> accessing int16 by odd address. Now platforms like this do not exist
> >>> anymore?
> >>
> >> i386 still exists, and it supports trapping on misalignement for at least
> >> CPL 3 (not kernel CPL 0).  IIRC, amd64 drops support for this.
> >
> > Someone enable and support this? I am don't see.
> > May be PPC trap on this?
> > Alpha trap on this, but support of Alpha is droped.
> 
> It is a 1-line change in asm (or a little more in C with #includes) to
> enable the trap:

OK, we can turn amd64 in this mode.
And cat do request to kernel with unalligned access, this cause trap
and panic, yes?

> It is a trillion-line change to fix the compilers and applications to not
> do misaligned accesses :-).  I only tried to use this ~25 years ago.  Then
> the most obvious compiler bug was generating 32-bit acccesses to assign
> large but misaligned structs.  If the compiler just generated calls to
> memcpy(), that might work, but in practice libraries also assume alignment.

This issuse can be trigerred and by two-bytes assigmen, yes?

>  There are also endianness problems.  The old version was even more broken
>  on big endian systems.  The current version needs some magic to reverse
>  the memcpy() of the bits.  We already depend on this for some 64-bit
>  syscalls like lseek().
> >>>
> >>> Can you explain some more?
> >>> This is not transfer over network and don't read from external media.
> >>> Where is problem?
> >>
> >> It is similar to a network transfer.  It needs a protocol to pass values
> >> to applications.  Type puns are fragile even within a single compilation
> >> unit.
> >
> > Application ad kernel run with same byte order, not?
> 
> The application can do anything it wants, but has to translate if it uses
> the kernel or a library written in another language.

You talk about different byte order in differenr languages?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Bruce Evans

On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:


On Sun, Aug 21, 2016 at 11:39:02PM +1000, Bruce Evans wrote:


On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:

I am remeber about platforms with missaligment trap when
accessing int16 by odd address. Now platforms like this do not exist
anymore?


i386 still exists, and it supports trapping on misalignement for at least
CPL 3 (not kernel CPL 0).  IIRC, amd64 drops support for this.


Someone enable and support this? I am don't see.
May be PPC trap on this?
Alpha trap on this, but support of Alpha is droped.


It is a 1-line change in asm (or a little more in C with #includes) to
enable the trap:

%%%
#include 
#include 
#include 

int
main(void)
{
char ch[5];

write_eflags(read_eflags() | PSL_AC);
*(int *)[0] = 0;
*(int *)[1] = 1;
/* NOTREACHED */
}
%%%

This works on amd64 too after s/eflags/rflags.

It is a trillion-line change to fix the compilers and applications to not
do misaligned accesses :-).  I only tried to use this ~25 years ago.  Then
the most obvious compiler bug was generating 32-bit acccesses to assign
large but misaligned structs.  If the compiler just generated calls to
memcpy(), that might work, but in practice libraries also assume alignment.


There are also endianness problems.  The old version was even more broken
on big endian systems.  The current version needs some magic to reverse
the memcpy() of the bits.  We already depend on this for some 64-bit
syscalls like lseek().


Can you explain some more?
This is not transfer over network and don't read from external media.
Where is problem?


It is similar to a network transfer.  It needs a protocol to pass values
to applications.  Type puns are fragile even within a single compilation
unit.


Application ad kernel run with same byte order, not?


The application can do anything it wants, but has to translate if it uses
the kernel or a library written in another language.

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


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

2016-08-21 Thread Bruce Evans
Author: bde
Date: Sun Aug 21 16:06:00 2016
New Revision: 304567
URL: https://svnweb.freebsd.org/changeset/base/304567

Log:
  Fix translation of the PrintScreen/SysRq and Pause/Break keys.  Almost
  everything was broken.  The cases that I noticed were Ctrl-PrintScreen
  not being mapped to the virtual scancode 0x5c (debug) and Pause not being
  mapped to the physical/virtual scancode 0x46 (slock).
  
  These keys are the most complicated ones due to kludges to give some
  compatibility back to before AT keyboards.
  
  Alt-PrintScreen must pretend to be a separate key from PrintScreen
  even at the "raw" level.  The (unique) usb code for it is 0x8a and we
  just have to map this to our unique virtual scancode 0x54, but we
  mapped it first to the internal code 0x7e and then to 0x79 which is a
  key on the Japanese 106/109 keyboard.  This fix is under the
  UKBD_EMULATE_ATASCANCODE option which shouldn't be used for non-AT
  keyboards.  If it is, then the syscons Japanese keymaps have nothing
  of importance for code 0x79 and can easily be changed.  0x54 is also
  unimportant in Japanese and US keymaps.
  
  NonAlt-PrintScreen and NonCtl-Pause/Break had many much larger bugs with
  smaller compatibility problems from fixing them.  The details are too
  ugly to give here.  Summary of the changed (hex) codes:
  
  K_RAW  PrintScreen (Ctl, Shift, Ctl-Shift): E0-2A-E0-37 -> E0-37
  K_RAW  Alt-PrintScreen (all shift states):  79 -> 54
  K_RAW  Pause/Break (unshifted, Shift, Alt, Alt-Shift)): E0-46 -> E1-1D-45
  K_CODE ALT-PrintScreen (all shift states):  79 -> 54
  
  That is 15 of 32 shift combinations for 2 keys fixed, with 8 easy cases
  from the 79 -> 54 remapping.
  
  The difference is only large and with no workaround using a keymap for
  for K_RAW, but this affects other modes when ukbd is layered under kbmux
  because kbmux keeps all subdevices in K_RAW mode and translates.  Oops.
  I used kbdmux to generate the above table of changes.

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

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Sun Aug 21 16:03:44 2016
(r304566)
+++ head/sys/dev/usb/input/ukbd.c   Sun Aug 21 16:06:00 2016
(r304567)
@@ -323,7 +323,7 @@ static const uint8_t ukbd_trtab[256] = {
NN, NN, NN, NN, 115, 108, 111, 113, /* 70 - 77 */
109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */
121, 120, NN, NN, NN, NN, NN, 123,  /* 80 - 87 */
-   124, 125, 126, 127, 128, NN, NN, NN,/* 88 - 8F */
+   124, 125, 84, 127, 128, NN, NN, NN, /* 88 - 8F */
129, 130, NN, NN, NN, NN, NN, NN,   /* 90 - 97 */
NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */
NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */
@@ -1659,17 +1659,6 @@ next_code:
}
}
break;
-   /* XXX: I don't like these... */
-   case 0x5c:  /* print screen */
-   if (sc->sc_flags & ALTS) {
-   keycode = 0x54; /* sysrq */
-   }
-   break;
-   case 0x68:  /* pause/break */
-   if (sc->sc_flags & CTLS) {
-   keycode = 0x6c; /* break */
-   }
-   break;
}
 
/* return the key code in the K_CODE mode */
@@ -2049,7 +2038,7 @@ ukbd_key2scan(struct ukbd_softc *sc, int
/* 90-99 */
0x11d,  /* Ctrl-R */
0x135,  /* Divide */
-   0x137 | SCAN_PREFIX_SHIFT,  /* PrintScreen */
+   0x137,  /* PrintScreen */
0x138,  /* Alt-R */
0x147,  /* Home */
0x148,  /* Up */
@@ -2100,13 +2089,15 @@ ukbd_key2scan(struct ukbd_softc *sc, int
if ((code >= 89) && (code < (int)(89 + nitems(scan {
code = scan[code - 89];
}
+   /* PrintScreen */
+   if (code == 0x137 && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R |
+   MOD_ALT_L | MOD_ALT_R | MOD_SHIFT_L | MOD_SHIFT_R {
+   code |= SCAN_PREFIX_SHIFT;
+   }
/* Pause/Break */
-   if ((code == 104) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R {
+   if ((code == 0x146) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R {
code = (0x45 | SCAN_PREFIX_E1 | SCAN_PREFIX_CTL);
}
-   if (shift & (MOD_SHIFT_L | MOD_SHIFT_R)) {
-   code &= ~SCAN_PREFIX_SHIFT;
-   }
code |= (up ? SCAN_RELEASE : SCAN_PRESS);
 
if (code & SCAN_PREFIX) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-08-21 Thread Emmanuel Vadot
Author: manu
Date: Sun Aug 21 16:03:44 2016
New Revision: 304566
URL: https://svnweb.freebsd.org/changeset/base/304566

Log:
  allwinner: Remove a20/a20_cpu_cfg.c from the build.
  This was needed when we used the SoC specific timer and not the generic-timer.

Modified:
  head/sys/arm/allwinner/files.allwinner

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Sun Aug 21 16:02:25 2016
(r304565)
+++ head/sys/arm/allwinner/files.allwinner  Sun Aug 21 16:03:44 2016
(r304566)
@@ -15,7 +15,6 @@ arm/allwinner/aw_if_dwc.c optionaldwc
 arm/allwinner/aw_rsb.c optionalrsb
 arm/allwinner/aw_rtc.c standard
 arm/allwinner/aw_wdog.cstandard
-arm/allwinner/a20/a20_cpu_cfg.cstandard
 arm/allwinner/aw_machdep.c standard
 arm/allwinner/aw_mp.c  optionalsmp
 arm/allwinner/axp209.c optionalaxp209
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304565 - head/sys/compat/cloudabi32

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 16:02:25 2016
New Revision: 304565
URL: https://svnweb.freebsd.org/changeset/base/304565

Log:
  Add source files generated from the 32-bit system call table.

Added:
  head/sys/compat/cloudabi32/cloudabi32_proto.h   (contents, props changed)
  head/sys/compat/cloudabi32/cloudabi32_syscall.h   (contents, props changed)
  head/sys/compat/cloudabi32/cloudabi32_syscalls.c   (contents, props changed)
  head/sys/compat/cloudabi32/cloudabi32_sysent.c   (contents, props changed)
  head/sys/compat/cloudabi32/cloudabi32_systrace_args.c   (contents, props 
changed)

Added: head/sys/compat/cloudabi32/cloudabi32_proto.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/cloudabi32/cloudabi32_proto.h   Sun Aug 21 16:02:25 
2016(r304565)
@@ -0,0 +1,465 @@
+/*
+ * System call prototypes.
+ *
+ * DO NOT EDIT-- this file is automatically generated.
+ * $FreeBSD$
+ * created from FreeBSD: head/sys/contrib/cloudabi/syscalls32.master 304563 
2016-08-21 15:56:19Z ed 
+ */
+
+#ifndef _CLOUDABI32_SYSPROTO_H_
+#define_CLOUDABI32_SYSPROTO_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+struct proc;
+
+struct thread;
+
+#definePAD_(t) (sizeof(register_t) <= sizeof(t) ? \
+   0 : sizeof(register_t) - sizeof(t))
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#definePADL_(t)0
+#definePADR_(t)PAD_(t)
+#else
+#definePADL_(t)PAD_(t)
+#definePADR_(t)0
+#endif
+
+struct cloudabi_sys_clock_res_get_args {
+   char clock_id_l_[PADL_(cloudabi_clockid_t)]; cloudabi_clockid_t 
clock_id; char clock_id_r_[PADR_(cloudabi_clockid_t)];
+};
+struct cloudabi_sys_clock_time_get_args {
+   char clock_id_l_[PADL_(cloudabi_clockid_t)]; cloudabi_clockid_t 
clock_id; char clock_id_r_[PADR_(cloudabi_clockid_t)];
+   char precision_l_[PADL_(cloudabi_timestamp_t)]; cloudabi_timestamp_t 
precision; char precision_r_[PADR_(cloudabi_timestamp_t)];
+};
+struct cloudabi_sys_condvar_signal_args {
+   char condvar_l_[PADL_(cloudabi_condvar_t *)]; cloudabi_condvar_t * 
condvar; char condvar_r_[PADR_(cloudabi_condvar_t *)];
+   char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char 
scope_r_[PADR_(cloudabi_scope_t)];
+   char nwaiters_l_[PADL_(cloudabi_nthreads_t)]; cloudabi_nthreads_t 
nwaiters; char nwaiters_r_[PADR_(cloudabi_nthreads_t)];
+};
+struct cloudabi_sys_fd_close_args {
+   char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char 
fd_r_[PADR_(cloudabi_fd_t)];
+};
+struct cloudabi_sys_fd_create1_args {
+   char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; 
char type_r_[PADR_(cloudabi_filetype_t)];
+};
+struct cloudabi_sys_fd_create2_args {
+   char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; 
char type_r_[PADR_(cloudabi_filetype_t)];
+};
+struct cloudabi_sys_fd_datasync_args {
+   char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char 
fd_r_[PADR_(cloudabi_fd_t)];
+};
+struct cloudabi_sys_fd_dup_args {
+   char from_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t from; char 
from_r_[PADR_(cloudabi_fd_t)];
+};
+struct cloudabi32_sys_fd_pread_args {
+   char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char 
fd_r_[PADR_(cloudabi_fd_t)];
+   char iov_l_[PADL_(const cloudabi32_iovec_t *)]; const 
cloudabi32_iovec_t * iov; char iov_r_[PADR_(const cloudabi32_iovec_t *)];
+   char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char 
iovcnt_r_[PADR_(size_t)];
+   char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; 
char offset_r_[PADR_(cloudabi_filesize_t)];
+};
+struct cloudabi32_sys_fd_pwrite_args {
+   char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char 
fd_r_[PADR_(cloudabi_fd_t)];
+   char iov_l_[PADL_(const cloudabi32_ciovec_t *)]; const 
cloudabi32_ciovec_t * iov; char iov_r_[PADR_(const cloudabi32_ciovec_t *)];
+   char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char 
iovcnt_r_[PADR_(size_t)];
+   char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; 
char offset_r_[PADR_(cloudabi_filesize_t)];
+};
+struct cloudabi32_sys_fd_read_args {
+   char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char 
fd_r_[PADR_(cloudabi_fd_t)];
+   char iov_l_[PADL_(const cloudabi32_iovec_t *)]; const 
cloudabi32_iovec_t * iov; char iov_r_[PADR_(const cloudabi32_iovec_t *)];
+   char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char 
iovcnt_r_[PADR_(size_t)];
+};
+struct cloudabi_sys_fd_replace_args {
+   char from_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t from; char 
from_r_[PADR_(cloudabi_fd_t)];
+   char to_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t to; char 
to_r_[PADR_(cloudabi_fd_t)];
+};
+struct cloudabi_sys_fd_seek_args {
+   char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char 
fd_r_[PADR_(cloudabi_fd_t)];
+  

svn commit: r304564 - in head/sys: compat/cloudabi32 conf

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 16:01:30 2016
New Revision: 304564
URL: https://svnweb.freebsd.org/changeset/base/304564

Log:
  Add CPU independent code for running 32-bits CloudABI executables.
  
  Essentially, this is a literal copy of the code in sys/compat/cloudabi64,
  except that it now makes use of 32-bits datatypes and limits. In
  sys/conf/files, we now need to take care to build the code in
  sys/compat/cloudabi if either COMPAT_CLOUDABI32 or COMPAT_CLOUDABI64 is
  turned on.
  
  This change does not yet include any of the CPU dependent bits. Right
  now I have implementations for running i386 binaries both on i386 and
  x86-64, which I will send out for review separately.

Added:
  head/sys/compat/cloudabi32/
  head/sys/compat/cloudabi32/Makefile
 - copied, changed from r304561, head/sys/compat/cloudabi64/Makefile
  head/sys/compat/cloudabi32/cloudabi32_fd.c
 - copied, changed from r304561, head/sys/compat/cloudabi64/cloudabi64_fd.c
  head/sys/compat/cloudabi32/cloudabi32_module.c
 - copied, changed from r304561, 
head/sys/compat/cloudabi64/cloudabi64_module.c
  head/sys/compat/cloudabi32/cloudabi32_poll.c
 - copied, changed from r304561, 
head/sys/compat/cloudabi64/cloudabi64_poll.c
  head/sys/compat/cloudabi32/cloudabi32_sock.c
 - copied, changed from r304561, 
head/sys/compat/cloudabi64/cloudabi64_sock.c
  head/sys/compat/cloudabi32/cloudabi32_thread.c
 - copied, changed from r304561, 
head/sys/compat/cloudabi64/cloudabi64_thread.c
  head/sys/compat/cloudabi32/cloudabi32_util.h
 - copied, changed from r304561, 
head/sys/compat/cloudabi64/cloudabi64_util.h
  head/sys/compat/cloudabi32/syscalls.conf
 - copied, changed from r304561, head/sys/compat/cloudabi64/syscalls.conf
Modified:
  head/sys/conf/files
  head/sys/conf/options

Copied and modified: head/sys/compat/cloudabi32/Makefile (from r304561, 
head/sys/compat/cloudabi64/Makefile)
==
--- head/sys/compat/cloudabi64/Makefile Sun Aug 21 15:41:19 2016
(r304561, copy source)
+++ head/sys/compat/cloudabi32/Makefile Sun Aug 21 16:01:30 2016
(r304564)
@@ -3,12 +3,12 @@
 all:
@echo "make sysent only"
 
-sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-cloudabi64_syscalls.c cloudabi64_systrace_args.c
+sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
+cloudabi32_syscalls.c cloudabi32_systrace_args.c
 
-cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-cloudabi64_syscalls.c cloudabi64_systrace_args.c: \
-../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
+cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
+cloudabi32_syscalls.c cloudabi32_systrace_args.c: \
+../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
 syscalls.conf
-   sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
+   sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
syscalls.conf

Copied and modified: head/sys/compat/cloudabi32/cloudabi32_fd.c (from r304561, 
head/sys/compat/cloudabi64/cloudabi64_fd.c)
==
--- head/sys/compat/cloudabi64/cloudabi64_fd.c  Sun Aug 21 15:41:19 2016
(r304561, copy source)
+++ head/sys/compat/cloudabi32/cloudabi32_fd.c  Sun Aug 21 16:01:30 2016
(r304564)
@@ -34,17 +34,17 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 
-#include 
-#include 
+#include 
+#include 
 
-/* Copies in 64-bit iovec structures from userspace. */
+/* Copies in 32-bit iovec structures from userspace. */
 static int
-cloudabi64_copyinuio(const cloudabi64_iovec_t *iovp, size_t iovcnt,
+cloudabi32_copyinuio(const cloudabi32_iovec_t *iovp, size_t iovcnt,
 struct uio **uiop)
 {
-   cloudabi64_iovec_t iovobj;
+   cloudabi32_iovec_t iovobj;
struct uio *uio;
struct iovec *iov;
size_t i;
@@ -73,7 +73,7 @@ cloudabi64_copyinuio(const cloudabi64_io
}
iov[i].iov_base = TO_PTR(iovobj.iov_base);
iov[i].iov_len = iovobj.iov_len;
-   if (iov[i].iov_len > INT64_MAX - uio->uio_resid) {
+   if (iov[i].iov_len > INT32_MAX - uio->uio_resid) {
free(uio, M_IOV);
return (EINVAL);
}
@@ -85,13 +85,13 @@ cloudabi64_copyinuio(const cloudabi64_io
 }
 
 int
-cloudabi64_sys_fd_pread(struct thread *td,
-struct cloudabi64_sys_fd_pread_args *uap)
+cloudabi32_sys_fd_pread(struct thread *td,
+struct cloudabi32_sys_fd_pread_args *uap)
 {
struct uio *uio;
int error;
 
-   error = cloudabi64_copyinuio(uap->iov, uap->iovcnt, );
+   error = cloudabi32_copyinuio(uap->iov, uap->iovcnt, );
if (error != 0)
return (error);
error = kern_preadv(td, uap->fd, uio, 

svn commit: r304563 - head/sys/contrib/cloudabi

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 15:56:19 2016
New Revision: 304563
URL: https://svnweb.freebsd.org/changeset/base/304563

Log:
  Fix s/64/32/ conversion errors in the system call table.
  
  We should pull in the 32 bit headers when using this system call table.

Modified:
  head/sys/contrib/cloudabi/syscalls32.master

Modified: head/sys/contrib/cloudabi/syscalls32.master
==
--- head/sys/contrib/cloudabi/syscalls32.master Sun Aug 21 15:45:12 2016
(r304562)
+++ head/sys/contrib/cloudabi/syscalls32.master Sun Aug 21 15:56:19 2016
(r304563)
@@ -30,9 +30,9 @@
 #include 
 #include 
 
-#include 
+#include 
 
-#include 
+#include 
 
 0  AUE_NULLSTD { cloudabi_timestamp_t \
cloudabi_sys_clock_res_get( \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304562 - stable/11/sys/arm/allwinner

2016-08-21 Thread Emmanuel Vadot
Author: manu
Date: Sun Aug 21 15:45:12 2016
New Revision: 304562
URL: https://svnweb.freebsd.org/changeset/base/304562

Log:
  MFC r304077:
  
  Correct the size of the softc in a10_ehci
  
  Reported by:  andrew

Modified:
  stable/11/sys/arm/allwinner/a10_ehci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_ehci.c
==
--- stable/11/sys/arm/allwinner/a10_ehci.c  Sun Aug 21 15:41:19 2016
(r304561)
+++ stable/11/sys/arm/allwinner/a10_ehci.c  Sun Aug 21 15:45:12 2016
(r304562)
@@ -360,7 +360,7 @@ static device_method_t ehci_methods[] = 
 static driver_t ehci_driver = {
.name = "ehci",
.methods = ehci_methods,
-   .size = sizeof(ehci_softc_t),
+   .size = sizeof(struct aw_ehci_softc),
 };
 
 static devclass_t ehci_devclass;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304561 - head/sys/contrib/cloudabi

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 15:41:19 2016
New Revision: 304561
URL: https://svnweb.freebsd.org/changeset/base/304561

Log:
  Import the 32-bit system call table and data types into the tree.
  
  Obtained from:https://github.com/NuxiNL/cloudabi

Added:
  head/sys/contrib/cloudabi/cloudabi32_types.h   (contents, props changed)
  head/sys/contrib/cloudabi/syscalls32.master   (contents, props changed)

Added: head/sys/contrib/cloudabi/cloudabi32_types.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/cloudabi/cloudabi32_types.hSun Aug 21 15:41:19 
2016(r304561)
@@ -0,0 +1,232 @@
+// Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
+//
+// 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.
+//
+// This file is automatically generated. Do not edit.
+//
+// Source: https://github.com/NuxiNL/cloudabi
+
+#ifndef CLOUDABI32_TYPES_H
+#define CLOUDABI32_TYPES_H
+
+#include "cloudabi_types_common.h"
+
+typedef struct {
+  _Alignas(4) cloudabi_auxtype_t a_type;
+  union {
+_Alignas(4) uint32_t a_val;
+_Alignas(4) uint32_t a_ptr;
+  };
+} cloudabi32_auxv_t;
+_Static_assert(offsetof(cloudabi32_auxv_t, a_type) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi32_auxv_t, a_val) == 4, "Incorrect layout");
+_Static_assert(offsetof(cloudabi32_auxv_t, a_ptr) == 4, "Incorrect layout");
+_Static_assert(sizeof(cloudabi32_auxv_t) == 8, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi32_auxv_t) == 4, "Incorrect layout");
+
+typedef struct {
+  _Alignas(4) uint32_t iov_base;
+  _Alignas(4) uint32_t iov_len;
+} cloudabi32_ciovec_t;
+_Static_assert(offsetof(cloudabi32_ciovec_t, iov_base) == 0, "Incorrect 
layout");
+_Static_assert(offsetof(cloudabi32_ciovec_t, iov_len) == 4, "Incorrect 
layout");
+_Static_assert(sizeof(cloudabi32_ciovec_t) == 8, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi32_ciovec_t) == 4, "Incorrect layout");
+
+typedef struct {
+  _Alignas(8) cloudabi_userdata_t userdata;
+  _Alignas(2) cloudabi_errno_t error;
+  _Alignas(1) cloudabi_eventtype_t type;
+  union {
+struct {
+  _Alignas(8) cloudabi_userdata_t identifier;
+} clock;
+struct {
+  _Alignas(4) uint32_t condvar;
+} condvar;
+struct {
+  _Alignas(8) cloudabi_filesize_t nbytes;
+  _Alignas(4) cloudabi_fd_t fd;
+  _Alignas(2) cloudabi_eventrwflags_t flags;
+} fd_readwrite;
+struct {
+  _Alignas(4) uint32_t lock;
+} lock;
+struct {
+  _Alignas(4) cloudabi_fd_t fd;
+  _Alignas(1) cloudabi_signal_t signal;
+  _Alignas(4) cloudabi_exitcode_t exitcode;
+} proc_terminate;
+  };
+} cloudabi32_event_t;
+_Static_assert(offsetof(cloudabi32_event_t, userdata) == 0, "Incorrect 
layout");
+_Static_assert(offsetof(cloudabi32_event_t, error) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi32_event_t, type) == 10, "Incorrect layout");
+_Static_assert(offsetof(cloudabi32_event_t, clock.identifier) == 16, 
"Incorrect layout");
+_Static_assert(offsetof(cloudabi32_event_t, condvar.condvar) == 16, "Incorrect 
layout");
+_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.nbytes) == 16, 
"Incorrect layout");
+_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.fd) == 24, "Incorrect 
layout");
+_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.flags) == 28, 
"Incorrect layout");
+_Static_assert(offsetof(cloudabi32_event_t, lock.lock) == 16, "Incorrect 
layout");
+_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.fd) == 16, 
"Incorrect layout");
+_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.signal) == 20, 
"Incorrect layout");

svn commit: r304560 - head/release/doc/en_US.ISO8859-1/hardware

2016-08-21 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Sun Aug 21 15:39:46 2016
New Revision: 304560
URL: https://svnweb.freebsd.org/changeset/base/304560

Log:
  Remove the ie(4) hardware list from the release documentation
  
  The driver was removed by jhb in r304513, and the  entity
  is no longer generated, causing the website build to fail.

Modified:
  head/release/doc/en_US.ISO8859-1/hardware/article.xml

Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- head/release/doc/en_US.ISO8859-1/hardware/article.xml   Sun Aug 21 
15:37:49 2016(r304559)
+++ head/release/doc/en_US.ISO8859-1/hardware/article.xml   Sun Aug 21 
15:39:46 2016(r304560)
@@ -836,8 +836,6 @@
 
   
 
-  
-
   
 
   
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304559 - head/sys/compat/cloudabi64

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 15:37:49 2016
New Revision: 304559
URL: https://svnweb.freebsd.org/changeset/base/304559

Log:
  Don't forget to define __ELF_WORD_SIZE.
  
  Without it, we only obtain the ELF types native to the system. In this
  we explicitly want the 64-bit versions.

Modified:
  head/sys/compat/cloudabi64/cloudabi64_util.h

Modified: head/sys/compat/cloudabi64/cloudabi64_util.h
==
--- head/sys/compat/cloudabi64/cloudabi64_util.hSun Aug 21 15:36:18 
2016(r304558)
+++ head/sys/compat/cloudabi64/cloudabi64_util.hSun Aug 21 15:37:49 
2016(r304559)
@@ -29,6 +29,7 @@
 #define_CLOUDABI64_UTIL_H_
 
 #include 
+#define__ELF_WORD_SIZE 64
 #include 
 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304558 - head/sys/compat/cloudabi64

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 15:36:18 2016
New Revision: 304558
URL: https://svnweb.freebsd.org/changeset/base/304558

Log:
  Add a utility macro for converting 64-bit pointers to native pointers.
  
  Right now we're casting uint64_t's to native pointers. This isn't
  causing any problems right now, but if we want to provide a 32-bit
  compatibility layer that works on 64-bit systems as well, this will
  cause problems. Casting a uint32_t to a 64-bit pointer throws a compiler
  error.
  
  Introduce a TO_PTR() macro that casts the value to uintptr_t before
  casting it to a pointer.

Modified:
  head/sys/compat/cloudabi64/cloudabi64_fd.c
  head/sys/compat/cloudabi64/cloudabi64_poll.c
  head/sys/compat/cloudabi64/cloudabi64_sock.c
  head/sys/compat/cloudabi64/cloudabi64_util.h

Modified: head/sys/compat/cloudabi64/cloudabi64_fd.c
==
--- head/sys/compat/cloudabi64/cloudabi64_fd.c  Sun Aug 21 15:14:06 2016
(r304557)
+++ head/sys/compat/cloudabi64/cloudabi64_fd.c  Sun Aug 21 15:36:18 2016
(r304558)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 /* Copies in 64-bit iovec structures from userspace. */
 static int
@@ -70,7 +71,7 @@ cloudabi64_copyinuio(const cloudabi64_io
free(uio, M_IOV);
return (error);
}
-   iov[i].iov_base = (void *)iovobj.iov_base;
+   iov[i].iov_base = TO_PTR(iovobj.iov_base);
iov[i].iov_len = iovobj.iov_len;
if (iov[i].iov_len > INT64_MAX - uio->uio_resid) {
free(uio, M_IOV);
@@ -105,8 +106,7 @@ cloudabi64_sys_fd_pwrite(struct thread *
struct uio *uio;
int error;
 
-   error = cloudabi64_copyinuio((const cloudabi64_iovec_t *)uap->iov,
-   uap->iovcnt, );
+   error = cloudabi64_copyinuio(TO_PTR(uap->iov), uap->iovcnt, );
if (error != 0)
return (error);
error = kern_pwritev(td, uap->fd, uio, uap->offset);
@@ -136,8 +136,7 @@ cloudabi64_sys_fd_write(struct thread *t
struct uio *uio;
int error;
 
-   error = cloudabi64_copyinuio((const cloudabi64_iovec_t *)uap->iov,
-   uap->iovcnt, );
+   error = cloudabi64_copyinuio(TO_PTR(uap->iov), uap->iovcnt, );
if (error != 0)
return (error);
error = kern_writev(td, uap->fd, uio);

Modified: head/sys/compat/cloudabi64/cloudabi64_poll.c
==
--- head/sys/compat/cloudabi64/cloudabi64_poll.cSun Aug 21 15:14:06 
2016(r304557)
+++ head/sys/compat/cloudabi64/cloudabi64_poll.cSun Aug 21 15:36:18 
2016(r304558)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 /* Converts a FreeBSD signal number to a CloudABI signal number. */
 static cloudabi_signal_t
@@ -98,7 +99,7 @@ cloudabi64_kevent_copyin(void *arg, stru
return (error);
 
memset(kevp, 0, sizeof(*kevp));
-   kevp->udata = (void *)sub.userdata;
+   kevp->udata = TO_PTR(sub.userdata);
switch (sub.type) {
case CLOUDABI_EVENTTYPE_CLOCK:
kevp->filter = EVFILT_TIMER;
@@ -264,9 +265,9 @@ cloudabi64_sys_poll(struct thread *td, s
ev.condvar.condvar = sub.condvar.condvar;
ev.error = cloudabi_convert_errno(
cloudabi_futex_condvar_wait(
-   td, (cloudabi_condvar_t *)sub.condvar.condvar,
+   td, TO_PTR(sub.condvar.condvar),
sub.condvar.condvar_scope,
-   (cloudabi_lock_t *)sub.condvar.lock,
+   TO_PTR(sub.condvar.lock),
sub.condvar.lock_scope,
CLOUDABI_CLOCK_MONOTONIC, UINT64_MAX, 0));
td->td_retval[0] = 1;
@@ -276,7 +277,7 @@ cloudabi64_sys_poll(struct thread *td, s
ev.lock.lock = sub.lock.lock;
ev.error = cloudabi_convert_errno(
cloudabi_futex_lock_rdlock(
-   td, (cloudabi_lock_t *)sub.lock.lock,
+   td, TO_PTR(sub.lock.lock),
sub.lock.lock_scope, CLOUDABI_CLOCK_MONOTONIC,
UINT64_MAX, 0));
td->td_retval[0] = 1;
@@ -286,7 +287,7 @@ cloudabi64_sys_poll(struct thread *td, s
ev.lock.lock = sub.lock.lock;
ev.error = cloudabi_convert_errno(
cloudabi_futex_lock_wrlock(
-   td, (cloudabi_lock_t *)sub.lock.lock,
+   td, 

svn commit: r304557 - in head/sys: compat/cloudabi compat/cloudabi64 conf modules/cloudabi64

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 15:14:06 2016
New Revision: 304557
URL: https://svnweb.freebsd.org/changeset/base/304557

Log:
  Move the linker script from cloudabi64/ to cloudabi/.
  
  It turns out that it works perfectly fine for generating 32-bits vDSOs
  as well. While there, get rid of the extraneous .s file extension.

Added:
  head/sys/compat/cloudabi/cloudabi_vdso.lds
 - copied, changed from r304556, 
head/sys/compat/cloudabi64/cloudabi64_vdso.lds.s
Deleted:
  head/sys/compat/cloudabi64/cloudabi64_vdso.lds.s
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.arm64
  head/sys/modules/cloudabi64/Makefile

Copied and modified: head/sys/compat/cloudabi/cloudabi_vdso.lds (from r304556, 
head/sys/compat/cloudabi64/cloudabi64_vdso.lds.s)
==
--- head/sys/compat/cloudabi64/cloudabi64_vdso.lds.sSun Aug 21 09:32:20 
2016(r304556, copy source)
+++ head/sys/compat/cloudabi/cloudabi_vdso.lds  Sun Aug 21 15:14:06 2016
(r304557)
@@ -1,5 +1,5 @@
 /*
- * Linker script for 64-bit vDSO for CloudABI.
+ * Linker script for the vDSO for CloudABI.
  * Based on sys/amd64/linux/linux_vdso.lds.s
  *
  * $FreeBSD$

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Sun Aug 21 09:32:20 2016(r304556)
+++ head/sys/conf/files.amd64   Sun Aug 21 15:14:06 2016(r304557)
@@ -10,7 +10,7 @@
 #
 cloudabi64_vdso.o  optionalcompat_cloudabi64   \
dependency  "$S/contrib/cloudabi/cloudabi_vdso_x86_64.S"\
-   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi64/cloudabi64_vdso.lds.s 
$S/contrib/cloudabi/cloudabi_vdso_x86_64.S -o ${.TARGET}" \
+   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi/cloudabi_vdso.lds 
$S/contrib/cloudabi/cloudabi_vdso_x86_64.S -o ${.TARGET}" \
no-obj no-implicit-rule \
clean   "cloudabi64_vdso.o"
 #

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Sun Aug 21 09:32:20 2016(r304556)
+++ head/sys/conf/files.arm64   Sun Aug 21 15:14:06 2016(r304557)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 cloudabi64_vdso.o  optionalcompat_cloudabi64   \
dependency  "$S/contrib/cloudabi/cloudabi_vdso_aarch64.S"   \
-   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi64/cloudabi64_vdso.lds.s 
$S/contrib/cloudabi/cloudabi_vdso_aarch64.S -o ${.TARGET}" \
+   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi/cloudabi_vdso.lds 
$S/contrib/cloudabi/cloudabi_vdso_aarch64.S -o ${.TARGET}" \
no-obj no-implicit-rule \
clean   "cloudabi64_vdso.o"
 #

Modified: head/sys/modules/cloudabi64/Makefile
==
--- head/sys/modules/cloudabi64/MakefileSun Aug 21 09:32:20 2016
(r304556)
+++ head/sys/modules/cloudabi64/MakefileSun Aug 21 15:14:06 2016
(r304557)
@@ -25,7 +25,7 @@ BINARY_ARCHITECTURE=i386
 
 cloudabi64_vdso.o: ${VDSO_SRCS}
${CC} -x assembler-with-cpp -shared -nostdinc -nostdlib \
-   -Wl,-T${SYSDIR}/compat/cloudabi64/cloudabi64_vdso.lds.s \
+   -Wl,-T${SYSDIR}/compat/cloudabi/cloudabi_vdso.lds \
${VDSO_SRCS} -o ${.TARGET}
 
 cloudabi64_vdso_blob.o: cloudabi64_vdso.o
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Slawa Olhovchenkov
On Sun, Aug 21, 2016 at 11:39:02PM +1000, Bruce Evans wrote:

> On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:
> 
> > On Sun, Aug 21, 2016 at 11:00:24PM +1000, Bruce Evans wrote:
> >
> >> On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:
> >>
> >>> On Sun, Aug 21, 2016 at 09:32:35PM +1000, Bruce Evans wrote:
> >>> ...
>  *(foo_t *)asks for alignment bugs.  We have already fixed lots of these
>  bugs for copying struct timevals in places like ping.c.  Compilers warn
>  about misalignment when certain warnings are enabled, but only on arches
>  where misalignment is more than a pessimization.  There is no reason why
>  td_retval would be always aligned on these arches.  Alignment of 64-bit
>  types on 32-bit arches is usually so unimportant that even int32_t is
>  not required to be aligned by the ABI, and there is no point in
>  aligning td_retval specially unless you also do it for a large fraction
>  of 64-bit integers in the kernel, and there are negative points for
>  doing that.
> >>>
> >>> For eliminate aligment bugs need to replace all assigment more then 1
> >>> bytes to *td_retval by memcpy?
> >>
> >> The copying must be of size 1 or 2 ints unless you are making even larger
> >> type puns than now.  1 int is obviously safe to just assign, and 2 ints
> >> should use memcpy().
> >
> > Why?
> 
> If it has size not 1 * sizeof(int) or 2 * sizeof(int) or is not an integer,
> than it is had to assign to a 2-byte array and might need more careful
> packing just to memcpy() it.

I am miss you point.

> > I am remeber about platforms with missaligment trap when
> > accessing int16 by odd address. Now platforms like this do not exist
> > anymore?
> 
> i386 still exists, and it supports trapping on misalignement for at least
> CPL 3 (not kernel CPL 0).  IIRC, amd64 drops support for this.

Someone enable and support this? I am don't see.
May be PPC trap on this?
Alpha trap on this, but support of Alpha is droped.


> >> There are also endianness problems.  The old version was even more broken
> >> on big endian systems.  The current version needs some magic to reverse
> >> the memcpy() of the bits.  We already depend on this for some 64-bit
> >> syscalls like lseek().
> >
> > Can you explain some more?
> > This is not transfer over network and don't read from external media.
> > Where is problem?
> 
> It is similar to a network transfer.  It needs a protocol to pass values
> to applications.  Type puns are fragile even within a single compilation
> unit.

Application ad kernel run with same byte order, not?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Bruce Evans

On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:


On Sun, Aug 21, 2016 at 11:00:24PM +1000, Bruce Evans wrote:


On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:


On Sun, Aug 21, 2016 at 09:32:35PM +1000, Bruce Evans wrote:
...

*(foo_t *)asks for alignment bugs.  We have already fixed lots of these
bugs for copying struct timevals in places like ping.c.  Compilers warn
about misalignment when certain warnings are enabled, but only on arches
where misalignment is more than a pessimization.  There is no reason why
td_retval would be always aligned on these arches.  Alignment of 64-bit
types on 32-bit arches is usually so unimportant that even int32_t is
not required to be aligned by the ABI, and there is no point in
aligning td_retval specially unless you also do it for a large fraction
of 64-bit integers in the kernel, and there are negative points for
doing that.


For eliminate aligment bugs need to replace all assigment more then 1
bytes to *td_retval by memcpy?


The copying must be of size 1 or 2 ints unless you are making even larger
type puns than now.  1 int is obviously safe to just assign, and 2 ints
should use memcpy().


Why?


If it has size not 1 * sizeof(int) or 2 * sizeof(int) or is not an integer,
than it is had to assign to a 2-byte array and might need more careful
packing just to memcpy() it.


I am remeber about platforms with missaligment trap when
accessing int16 by odd address. Now platforms like this do not exist
anymore?


i386 still exists, and it supports trapping on misalignement for at least
CPL 3 (not kernel CPL 0).  IIRC, amd64 drops support for this.


There are also endianness problems.  The old version was even more broken
on big endian systems.  The current version needs some magic to reverse
the memcpy() of the bits.  We already depend on this for some 64-bit
syscalls like lseek().


Can you explain some more?
This is not transfer over network and don't read from external media.
Where is problem?


It is similar to a network transfer.  It needs a protocol to pass values
to applications.  Type puns are fragile even within a single compilation
unit.

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


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Bruce Evans

On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:


On Sun, Aug 21, 2016 at 09:32:35PM +1000, Bruce Evans wrote:
...

*(foo_t *)asks for alignment bugs.  We have already fixed lots of these
bugs for copying struct timevals in places like ping.c.  Compilers warn
about misalignment when certain warnings are enabled, but only on arches
where misalignment is more than a pessimization.  There is no reason why
td_retval would be always aligned on these arches.  Alignment of 64-bit
types on 32-bit arches is usually so unimportant that even int32_t is
not required to be aligned by the ABI, and there is no point in
aligning td_retval specially unless you also do it for a large fraction
of 64-bit integers in the kernel, and there are negative points for
doing that.


For eliminate aligment bugs need to replace all assigment more then 1
bytes to *td_retval by memcpy?


The copying must be of size 1 or 2 ints unless you are making even larger
type puns than now.  1 int is obviously safe to just assign, and 2 ints
should use memcpy().

There are also endianness problems.  The old version was even more broken
on big endian systems.  The current version needs some magic to reverse
the memcpy() of the bits.  We already depend on this for some 64-bit
syscalls like lseek().

Hmm, lseek() uses different magic.  Instead of the memcpy(), we assign
to tdu_off in td_uretoff.  td_retval is really td_uretoff.tdu_retval
obfuscated like this for compatibilty.  This is slightly better than
the memcpy() since it makes tdu_off and also tdu_retval 64-bit aligned
if that is required for off_t.  The same magic still occurs in userland.
On normal 32-bit arches, the 2 integers arrive in 2 registers that have
to be combined in the right order to give a 64-bit value.  The magic is
just that things are arranged so that no code is needed to rearrange the
registers in the usual case where the application uses a similar ABI to
the kernel.  Not the same ABI, since the application might be 32 bits
and the kernel 64 bits.  This requires lots of conversions, but none for
register order for at least x86.

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


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Slawa Olhovchenkov
On Sun, Aug 21, 2016 at 11:00:24PM +1000, Bruce Evans wrote:

> On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:
> 
> > On Sun, Aug 21, 2016 at 09:32:35PM +1000, Bruce Evans wrote:
> >...
> >> *(foo_t *)asks for alignment bugs.  We have already fixed lots of these
> >> bugs for copying struct timevals in places like ping.c.  Compilers warn
> >> about misalignment when certain warnings are enabled, but only on arches
> >> where misalignment is more than a pessimization.  There is no reason why
> >> td_retval would be always aligned on these arches.  Alignment of 64-bit
> >> types on 32-bit arches is usually so unimportant that even int32_t is
> >> not required to be aligned by the ABI, and there is no point in
> >> aligning td_retval specially unless you also do it for a large fraction
> >> of 64-bit integers in the kernel, and there are negative points for
> >> doing that.
> >
> > For eliminate aligment bugs need to replace all assigment more then 1
> > bytes to *td_retval by memcpy?
> 
> The copying must be of size 1 or 2 ints unless you are making even larger
> type puns than now.  1 int is obviously safe to just assign, and 2 ints
> should use memcpy().

Why? I am remeber about platforms with missaligment trap when
accessing int16 by odd address. Now platforms like this do not exist
anymore?

> There are also endianness problems.  The old version was even more broken
> on big endian systems.  The current version needs some magic to reverse
> the memcpy() of the bits.  We already depend on this for some 64-bit
> syscalls like lseek().

Can you explain some more?
This is not transfer over network and don't read from external media.
Where is problem?

> Hmm, lseek() uses different magic.  Instead of the memcpy(), we assign
> to tdu_off in td_uretoff.  td_retval is really td_uretoff.tdu_retval
> obfuscated like this for compatibilty.  This is slightly better than
> the memcpy() since it makes tdu_off and also tdu_retval 64-bit aligned
> if that is required for off_t.  The same magic still occurs in userland.
> On normal 32-bit arches, the 2 integers arrive in 2 registers that have
> to be combined in the right order to give a 64-bit value.  The magic is
> just that things are arranged so that no code is needed to rearrange the
> registers in the usual case where the application uses a similar ABI to
> the kernel.  Not the same ABI, since the application might be 32 bits
> and the kernel 64 bits.  This requires lots of conversions, but none for
> register order for at least x86.
> 
> Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Slawa Olhovchenkov
On Sun, Aug 21, 2016 at 09:32:35PM +1000, Bruce Evans wrote:

> On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:
> 
> > On Sun, Aug 21, 2016 at 07:41:11AM +, Ed Schouten wrote:
> >> ...
> >> Log:
> >>   Use memcpy() to copy 64-bit timestamps into the syscall return values.
> >>
> >>   On 32-bit platforms, our 64-bit timestamps need to be split up across
> >>   two registers. A simple assignment to td_retval[0] will cause the top 32
> >>   bits to get lost. By using memcpy(), we will automatically either use 1
> >>   or 2 registers depending on the size of register_t.
> >> ..
> >> Modified: head/sys/compat/cloudabi/cloudabi_clock.c
> >> ==
> >> --- head/sys/compat/cloudabi/cloudabi_clock.c  Sun Aug 21 07:28:38 
> >> 2016(r304554)
> >> +++ head/sys/compat/cloudabi/cloudabi_clock.c  Sun Aug 21 07:41:11 
> >> 2016(r304555)
> >> @@ -117,7 +117,7 @@ cloudabi_sys_clock_res_get(struct thread
> >>error = cloudabi_convert_timespec(, );
> >>if (error != 0)
> >>return (error);
> >> -  td->td_retval[0] = cts;
> >> +  memcpy(td->td_retval, , sizeof(cts));
> >>return (0);
> >>  }
> >>
> >> @@ -129,6 +129,6 @@ cloudabi_sys_clock_time_get(struct threa
> >>int error;
> >>
> >>error = cloudabi_clock_time_get(td, uap->clock_id, );
> >> -  td->td_retval[0] = ts;
> >> +  memcpy(td->td_retval, , sizeof(ts));
> >>return (error);
> >
> > Why do not use more simple solution:
> 
> Because it doesn't work.
> 
> > *(cloudabi_timestamp_t *)td->td_retval = cts;
> >
> > This is eliminate call to memcpy and allow compiler to use most
> > effeicient way.
> 
> memcpy() is the most efficient way (except for the kernel pessimization
> of losing builtin memcpy with -ffreestanding 15 years ago and not bringing
> it back).

> *(foo_t *)asks for alignment bugs.  We have already fixed lots of these
> bugs for copying struct timevals in places like ping.c.  Compilers warn
> about misalignment when certain warnings are enabled, but only on arches
> where misalignment is more than a pessimization.  There is no reason why
> td_retval would be always aligned on these arches.  Alignment of 64-bit
> types on 32-bit arches is usually so unimportant that even int32_t is
> not required to be aligned by the ABI, and there is no point in
> aligning td_retval specially unless you also do it for a large fraction
> of 64-bit integers in the kernel, and there are negative points for
> doing that.

For eliminate aligment bugs need to replace all assigment more then 1
bytes to *td_retval by memcpy?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Bruce Evans

On Sun, 21 Aug 2016, Slawa Olhovchenkov wrote:


On Sun, Aug 21, 2016 at 07:41:11AM +, Ed Schouten wrote:

...
Log:
  Use memcpy() to copy 64-bit timestamps into the syscall return values.

  On 32-bit platforms, our 64-bit timestamps need to be split up across
  two registers. A simple assignment to td_retval[0] will cause the top 32
  bits to get lost. By using memcpy(), we will automatically either use 1
  or 2 registers depending on the size of register_t.
..
Modified: head/sys/compat/cloudabi/cloudabi_clock.c
==
--- head/sys/compat/cloudabi/cloudabi_clock.c   Sun Aug 21 07:28:38 2016
(r304554)
+++ head/sys/compat/cloudabi/cloudabi_clock.c   Sun Aug 21 07:41:11 2016
(r304555)
@@ -117,7 +117,7 @@ cloudabi_sys_clock_res_get(struct thread
error = cloudabi_convert_timespec(, );
if (error != 0)
return (error);
-   td->td_retval[0] = cts;
+   memcpy(td->td_retval, , sizeof(cts));
return (0);
 }

@@ -129,6 +129,6 @@ cloudabi_sys_clock_time_get(struct threa
int error;

error = cloudabi_clock_time_get(td, uap->clock_id, );
-   td->td_retval[0] = ts;
+   memcpy(td->td_retval, , sizeof(ts));
return (error);


Why do not use more simple solution:


Because it doesn't work.


*(cloudabi_timestamp_t *)td->td_retval = cts;

This is eliminate call to memcpy and allow compiler to use most
effeicient way.


memcpy() is the most efficient way (except for the kernel pessimization
of losing builtin memcpy with -ffreestanding 15 years ago and not bringing
it back).

*(foo_t *)asks for alignment bugs.  We have already fixed lots of these
bugs for copying struct timevals in places like ping.c.  Compilers warn
about misalignment when certain warnings are enabled, but only on arches
where misalignment is more than a pessimization.  There is no reason why
td_retval would be always aligned on these arches.  Alignment of 64-bit
types on 32-bit arches is usually so unimportant that even int32_t is
not required to be aligned by the ABI, and there is no point in
aligning td_retval specially unless you also do it for a large fraction
of 64-bit integers in the kernel, and there are negative points for
doing that.

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


Re: svn commit: r304555 - head/sys/compat/cloudabi

2016-08-21 Thread Slawa Olhovchenkov
On Sun, Aug 21, 2016 at 07:41:11AM +, Ed Schouten wrote:

> Author: ed
> Date: Sun Aug 21 07:41:11 2016
> New Revision: 304555
> URL: https://svnweb.freebsd.org/changeset/base/304555
> 
> Log:
>   Use memcpy() to copy 64-bit timestamps into the syscall return values.
>   
>   On 32-bit platforms, our 64-bit timestamps need to be split up across
>   two registers. A simple assignment to td_retval[0] will cause the top 32
>   bits to get lost. By using memcpy(), we will automatically either use 1
>   or 2 registers depending on the size of register_t.
> 
> Modified:
>   head/sys/compat/cloudabi/cloudabi_clock.c
> 
> Modified: head/sys/compat/cloudabi/cloudabi_clock.c
> ==
> --- head/sys/compat/cloudabi/cloudabi_clock.c Sun Aug 21 07:28:38 2016
> (r304554)
> +++ head/sys/compat/cloudabi/cloudabi_clock.c Sun Aug 21 07:41:11 2016
> (r304555)
> @@ -117,7 +117,7 @@ cloudabi_sys_clock_res_get(struct thread
>   error = cloudabi_convert_timespec(, );
>   if (error != 0)
>   return (error);
> - td->td_retval[0] = cts;
> + memcpy(td->td_retval, , sizeof(cts));
>   return (0);
>  }
>  
> @@ -129,6 +129,6 @@ cloudabi_sys_clock_time_get(struct threa
>   int error;
>  
>   error = cloudabi_clock_time_get(td, uap->clock_id, );
> - td->td_retval[0] = ts;
> + memcpy(td->td_retval, , sizeof(ts));
>   return (error);

Why do not use more simple solution:

*(cloudabi_timestamp_t *)td->td_retval = cts;

This is eliminate call to memcpy and allow compiler to use most
effeicient way.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304556 - head/sys/compat/cloudabi64

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 09:32:20 2016
New Revision: 304556
URL: https://svnweb.freebsd.org/changeset/base/304556

Log:
  Use the right _MAX constant.
  
  Though uio_resid is of type ssize_t, we need to take into account that
  this source file contains an implementation specific to a certain
  userspace pointer size. If this file provided 32-bit implementations,
  this should have used INT32_MAX, even when running a 64-bit kernel.
  
  This change has no effect, but is simply in preparation for adding
  support for running 32-bit CloudABI executables.

Modified:
  head/sys/compat/cloudabi64/cloudabi64_fd.c

Modified: head/sys/compat/cloudabi64/cloudabi64_fd.c
==
--- head/sys/compat/cloudabi64/cloudabi64_fd.c  Sun Aug 21 07:41:11 2016
(r304555)
+++ head/sys/compat/cloudabi64/cloudabi64_fd.c  Sun Aug 21 09:32:20 2016
(r304556)
@@ -72,7 +72,7 @@ cloudabi64_copyinuio(const cloudabi64_io
}
iov[i].iov_base = (void *)iovobj.iov_base;
iov[i].iov_len = iovobj.iov_len;
-   if (iov[i].iov_len > SSIZE_MAX - uio->uio_resid) {
+   if (iov[i].iov_len > INT64_MAX - uio->uio_resid) {
free(uio, M_IOV);
return (EINVAL);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 07:41:11 2016
New Revision: 304555
URL: https://svnweb.freebsd.org/changeset/base/304555

Log:
  Use memcpy() to copy 64-bit timestamps into the syscall return values.
  
  On 32-bit platforms, our 64-bit timestamps need to be split up across
  two registers. A simple assignment to td_retval[0] will cause the top 32
  bits to get lost. By using memcpy(), we will automatically either use 1
  or 2 registers depending on the size of register_t.

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

Modified: head/sys/compat/cloudabi/cloudabi_clock.c
==
--- head/sys/compat/cloudabi/cloudabi_clock.c   Sun Aug 21 07:28:38 2016
(r304554)
+++ head/sys/compat/cloudabi/cloudabi_clock.c   Sun Aug 21 07:41:11 2016
(r304555)
@@ -117,7 +117,7 @@ cloudabi_sys_clock_res_get(struct thread
error = cloudabi_convert_timespec(, );
if (error != 0)
return (error);
-   td->td_retval[0] = cts;
+   memcpy(td->td_retval, , sizeof(cts));
return (0);
 }
 
@@ -129,6 +129,6 @@ cloudabi_sys_clock_time_get(struct threa
int error;
 
error = cloudabi_clock_time_get(td, uap->clock_id, );
-   td->td_retval[0] = ts;
+   memcpy(td->td_retval, , sizeof(ts));
return (error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304554 - in head/sys: conf contrib/cloudabi modules/cloudabi64

2016-08-21 Thread Ed Schouten
Author: ed
Date: Sun Aug 21 07:28:38 2016
New Revision: 304554
URL: https://svnweb.freebsd.org/changeset/base/304554

Log:
  Rewrite the vDSOs for CloudABI in assembly.
  
  The reason why the old vDSOs were written in C using inline assembly was
  purely because they were embedded in the C library directly as static
  inline functions. This was practical during development, because it
  meant you could invoke system calls without any library dependencies.
  The vDSO was simply a copy of these functions.
  
  Now that we require the use of the vDSO, there is no longer any need for
  embedding them in C code directly. Rewriting them in assembly has the
  advantage that they are closer to ideal (less useless branching, less
  assumptions about registers remaining unclobbered by the kernel, etc).
  They are also easier to build, as they no longer depend on the C type
  information for CloudABI.
  
  Obtained from:https://github.com/NuxiNL/cloudabi

Added:
  head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S   (contents, props changed)
  head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S   (contents, props changed)
Deleted:
  head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.c
  head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.arm64
  head/sys/modules/cloudabi64/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Sun Aug 21 05:08:37 2016(r304553)
+++ head/sys/conf/files.amd64   Sun Aug 21 07:28:38 2016(r304554)
@@ -9,8 +9,8 @@
 #
 #
 cloudabi64_vdso.o  optionalcompat_cloudabi64   \
-   dependency  "$S/contrib/cloudabi/cloudabi_vdso_x86_64.c"\
-   compile-with"${CC} -shared -nostdinc -nostdlib 
-Wl,-T$S/compat/cloudabi64/cloudabi64_vdso.lds.s -D_KERNEL -I. -I$S 
-I$S/contrib/cloudabi -O2 -fomit-frame-pointer 
$S/contrib/cloudabi/cloudabi_vdso_x86_64.c -o ${.TARGET}" \
+   dependency  "$S/contrib/cloudabi/cloudabi_vdso_x86_64.S"\
+   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi64/cloudabi64_vdso.lds.s 
$S/contrib/cloudabi/cloudabi_vdso_x86_64.S -o ${.TARGET}" \
no-obj no-implicit-rule \
clean   "cloudabi64_vdso.o"
 #

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Sun Aug 21 05:08:37 2016(r304553)
+++ head/sys/conf/files.arm64   Sun Aug 21 07:28:38 2016(r304554)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 cloudabi64_vdso.o  optionalcompat_cloudabi64   \
-   dependency  "$S/contrib/cloudabi/cloudabi_vdso_aarch64.c"   \
-   compile-with"${CC} -shared -nostdinc -nostdlib 
-Wl,-T$S/compat/cloudabi64/cloudabi64_vdso.lds.s -D_KERNEL -I. -I$S 
-I$S/contrib/cloudabi -O2 -fomit-frame-pointer 
$S/contrib/cloudabi/cloudabi_vdso_aarch64.c -o ${.TARGET}" \
+   dependency  "$S/contrib/cloudabi/cloudabi_vdso_aarch64.S"   \
+   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi64/cloudabi64_vdso.lds.s 
$S/contrib/cloudabi/cloudabi_vdso_aarch64.S -o ${.TARGET}" \
no-obj no-implicit-rule \
clean   "cloudabi64_vdso.o"
 #

Added: head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S   Sun Aug 21 07:28:38 
2016(r304554)
@@ -0,0 +1,491 @@
+// Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
+//
+// 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,