svn commit: r269294 - stable/10/sys/cam/ctl

2014-07-30 Thread Alexander Motin
Author: mav
Date: Wed Jul 30 07:08:59 2014
New Revision: 269294
URL: http://svnweb.freebsd.org/changeset/base/269294

Log:
  MFC r269149:
  Fix several cases of NULL dereference when INQUIRY sent to absent LUN.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 04:48:56 2014(r269293)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:08:59 2014(r269294)
@@ -10041,7 +10041,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
STAILQ_FOREACH(port, softc-port_list, links) {
if ((port-status  CTL_PORT_STATUS_ONLINE) == 0)
continue;
-   if (ctl_map_lun_back(port-targ_port, lun-lun) =
+   if (lun != NULL 
+   ctl_map_lun_back(port-targ_port, lun-lun) =
CTL_MAX_LUNS)
continue;
num_target_ports++;
@@ -10095,7 +10096,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
STAILQ_FOREACH(port, softc-port_list, links) {
if ((port-status  CTL_PORT_STATUS_ONLINE) == 0)
continue;
-   if (ctl_map_lun_back(port-targ_port, lun-lun) =
+   if (lun != NULL 
+   ctl_map_lun_back(port-targ_port, lun-lun) =
CTL_MAX_LUNS)
continue;
p = port-targ_port % CTL_MAX_PORTS + g * CTL_MAX_PORTS;
@@ -10135,7 +10137,6 @@ ctl_inquiry_evpd_block_limits(struct ctl
int bs;
 
lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
-   bs = lun-be_lun-blocksize;
 
ctsio-kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | 
M_ZERO);
bl_ptr = (struct scsi_vpd_block_limits *)ctsio-kern_data_ptr;
@@ -10169,10 +10170,13 @@ ctl_inquiry_evpd_block_limits(struct ctl
scsi_ulto2b(sizeof(*bl_ptr), bl_ptr-page_length);
bl_ptr-max_cmp_write_len = 0xff;
scsi_ulto4b(0x, bl_ptr-max_txfer_len);
-   scsi_ulto4b(MAXPHYS / bs, bl_ptr-opt_txfer_len);
-   if (lun-be_lun-flags  CTL_LUN_FLAG_UNMAP) {
-   scsi_ulto4b(0x, bl_ptr-max_unmap_lba_cnt);
-   scsi_ulto4b(0x, bl_ptr-max_unmap_blk_cnt);
+   if (lun != NULL) {
+   bs = lun-be_lun-blocksize;
+   scsi_ulto4b(MAXPHYS / bs, bl_ptr-opt_txfer_len);
+   if (lun-be_lun-flags  CTL_LUN_FLAG_UNMAP) {
+   scsi_ulto4b(0x, bl_ptr-max_unmap_lba_cnt);
+   scsi_ulto4b(0x, bl_ptr-max_unmap_blk_cnt);
+   }
}
scsi_u64to8b(UINT64_MAX, bl_ptr-max_write_same_length);
 
@@ -10189,10 +10193,8 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio *
 {
struct scsi_vpd_logical_block_prov *lbp_ptr;
struct ctl_lun *lun;
-   int bs;
 
lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
-   bs = lun-be_lun-blocksize;
 
ctsio-kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | 
M_ZERO);
lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio-kern_data_ptr;
@@ -10223,7 +10225,7 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio *
lbp_ptr-device = (SID_QUAL_LU_OFFLINE  5) | T_DIRECT;
 
lbp_ptr-page_code = SVPD_LBP;
-   if (lun-be_lun-flags  CTL_LUN_FLAG_UNMAP)
+   if (lun != NULL  lun-be_lun-flags  CTL_LUN_FLAG_UNMAP)
lbp_ptr-flags = SVPD_LBP_UNMAP | SVPD_LBP_WS16 | SVPD_LBP_WS10;
 
ctsio-scsi_status = SCSI_STATUS_OK;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269295 - stable/10/sys/cam/ctl

2014-07-30 Thread Alexander Motin
Author: mav
Date: Wed Jul 30 07:16:08 2014
New Revision: 269295
URL: http://svnweb.freebsd.org/changeset/base/269295

Log:
  MFC r268581:
  Merge several equal serialization indexes.

Modified:
  stable/10/sys/cam/ctl/ctl_cmd_table.c
  stable/10/sys/cam/ctl/ctl_private.h
  stable/10/sys/cam/ctl/ctl_ser_table.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c
==
--- stable/10/sys/cam/ctl/ctl_cmd_table.c   Wed Jul 30 07:08:59 2014
(r269294)
+++ stable/10/sys/cam/ctl/ctl_cmd_table.c   Wed Jul 30 07:16:08 2014
(r269295)
@@ -66,7 +66,7 @@
 const struct ctl_cmd_entry ctl_cmd_table_5e[32] =
 {
 /* 00 READ KEYS */
-{ctl_persistent_reserve_in, CTL_SERIDX_PRES_IN, CTL_CMD_FLAG_ALLOW_ON_RESV |
+{ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV |
CTL_CMD_FLAG_OK_ON_BOTH |
CTL_CMD_FLAG_OK_ON_STOPPED |
CTL_CMD_FLAG_OK_ON_INOPERABLE |
@@ -77,7 +77,7 @@ const struct ctl_cmd_entry ctl_cmd_table
  10, { 0x00, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07}},
 
 /* 01 READ RESERVATION */
-{ctl_persistent_reserve_in, CTL_SERIDX_PRES_IN, CTL_CMD_FLAG_ALLOW_ON_RESV |
+{ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV |
CTL_CMD_FLAG_OK_ON_BOTH |
CTL_CMD_FLAG_OK_ON_STOPPED |
CTL_CMD_FLAG_OK_ON_INOPERABLE |
@@ -116,57 +116,57 @@ const struct ctl_cmd_entry ctl_cmd_table
 const struct ctl_cmd_entry ctl_cmd_table_5f[32] =
 {
 /* 00 REGISTER */
-{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV |
- CTL_CMD_FLAG_OK_ON_BOTH |
- CTL_CMD_FLAG_OK_ON_STOPPED |
- CTL_CMD_FLAG_OK_ON_INOPERABLE 
|
- CTL_CMD_FLAG_OK_ON_SECONDARY |
- CTL_FLAG_DATA_OUT |
- CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
+{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV |
+   CTL_CMD_FLAG_OK_ON_BOTH |
+   CTL_CMD_FLAG_OK_ON_STOPPED |
+   CTL_CMD_FLAG_OK_ON_INOPERABLE |
+   CTL_CMD_FLAG_OK_ON_SECONDARY |
+   CTL_FLAG_DATA_OUT |
+   CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
  CTL_LUN_PAT_NONE,
  10, { 0x00, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}},
 
 /* 01 RESERVE */
-{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV |
- CTL_CMD_FLAG_OK_ON_BOTH |
- CTL_CMD_FLAG_OK_ON_STOPPED |
- CTL_CMD_FLAG_OK_ON_INOPERABLE 
|
- CTL_CMD_FLAG_OK_ON_SECONDARY |
- CTL_FLAG_DATA_OUT |
- CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
+{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV |
+   CTL_CMD_FLAG_OK_ON_BOTH |
+   CTL_CMD_FLAG_OK_ON_STOPPED |
+   CTL_CMD_FLAG_OK_ON_INOPERABLE |
+   CTL_CMD_FLAG_OK_ON_SECONDARY |
+   CTL_FLAG_DATA_OUT |
+   CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
  CTL_LUN_PAT_NONE,
  10, { 0x01, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}},
 
 /* 02 RELEASE */
-{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV |
- CTL_CMD_FLAG_OK_ON_BOTH |
- CTL_CMD_FLAG_OK_ON_STOPPED |
- CTL_CMD_FLAG_OK_ON_INOPERABLE 
|
- CTL_CMD_FLAG_OK_ON_SECONDARY |
- CTL_FLAG_DATA_OUT |
- CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
+{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV |
+   CTL_CMD_FLAG_OK_ON_BOTH |
+   CTL_CMD_FLAG_OK_ON_STOPPED |
+   

svn commit: r269296 - in stable/10: sys/cam/ctl sys/cam/scsi sys/conf sys/modules/ctl usr.sbin/ctladm

2014-07-30 Thread Alexander Motin
Author: mav
Date: Wed Jul 30 07:18:32 2014
New Revision: 269296
URL: http://svnweb.freebsd.org/changeset/base/269296

Log:
  MFC r268767:
  Add support for VMWare dialect of EXTENDED COPY command, aka VAAI Clone.
  
  This allows to clone VMs and move them between LUNs inside one storage
  host without generating extra network traffic to the initiator and back,
  and without being limited by network bandwidth.
  
  LUNs participating in copy operation should have UNIQUE NAA or EUI IDs set.
  For LUNs without these IDs VMWare will use traditional copy operations.
  
  Beware: the above LUN IDs explicitly set to values non-unique from the VM
  cluster point of view may cause data corruption if wrong LUN is addressed!
  
  Sponsored by: iXsystems, Inc.

Added:
  stable/10/sys/cam/ctl/ctl_tpc.c
 - copied unchanged from r268767, head/sys/cam/ctl/ctl_tpc.c
  stable/10/sys/cam/ctl/ctl_tpc.h
 - copied unchanged from r268767, head/sys/cam/ctl/ctl_tpc.h
  stable/10/sys/cam/ctl/ctl_tpc_local.c
 - copied unchanged from r268767, head/sys/cam/ctl/ctl_tpc_local.c
Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_cmd_table.c
  stable/10/sys/cam/ctl/ctl_frontend.c
  stable/10/sys/cam/ctl/ctl_frontend.h
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
  stable/10/sys/cam/ctl/ctl_private.h
  stable/10/sys/cam/ctl/ctl_ser_table.c
  stable/10/sys/cam/ctl/scsi_ctl.c
  stable/10/sys/cam/scsi/scsi_all.h
  stable/10/sys/conf/files
  stable/10/sys/modules/ctl/Makefile
  stable/10/usr.sbin/ctladm/ctladm.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:16:08 2014(r269295)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:18:32 2014(r269296)
@@ -322,10 +322,10 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verb
 
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
- * SCSI Ports (0x88), Block limits (0xB0) and
+ * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0) and
  * Logical Block Provisioning (0xB2)
  */
-#define SCSI_EVPD_NUM_SUPPORTED_PAGES  6
+#define SCSI_EVPD_NUM_SUPPORTED_PAGES  7
 
 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event,
  int param);
@@ -351,8 +351,6 @@ static int ctl_ioctl_fill_ooa(struct ctl
  struct ctl_ooa_entry *kern_entries);
 static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
 struct thread *td);
-uint32_t ctl_get_resindex(struct ctl_nexus *nexus);
-uint32_t ctl_port_idx(int port_num);
 static uint32_t ctl_map_lun(int port_num, uint32_t lun);
 static uint32_t ctl_map_lun_back(int port_num, uint32_t lun);
 #ifdef unused
@@ -4600,6 +4598,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
TAILQ_INIT(lun-ooa_queue);
TAILQ_INIT(lun-blocked_queue);
STAILQ_INIT(lun-error_list);
+   ctl_tpc_init(lun);
 
/*
 * Initialize the mode page index.
@@ -4751,6 +4750,7 @@ ctl_free_lun(struct ctl_lun *lun)
atomic_subtract_int(lun-be_lun-be-num_luns, 1);
lun-be_lun-lun_shutdown(lun-be_lun-be_lun);
 
+   ctl_tpc_shutdown(lun);
mtx_destroy(lun-lun_lock);
free(lun-lun_devid, M_CTL);
if (lun-flags  CTL_LUN_MALLOCED)
@@ -9823,10 +9823,12 @@ ctl_inquiry_evpd_supported(struct ctl_sc
pages-page_list[2] = SVPD_DEVICE_ID;
/* SCSI Ports */
pages-page_list[3] = SVPD_SCSI_PORTS;
+   /* Third-party Copy */
+   pages-page_list[4] = SVPD_SCSI_TPC;
/* Block limits */
-   pages-page_list[4] = SVPD_BLOCK_LIMITS;
+   pages-page_list[5] = SVPD_BLOCK_LIMITS;
/* Logical Block Provisioning */
-   pages-page_list[5] = SVPD_LBP;
+   pages-page_list[6] = SVPD_LBP;
 
ctsio-scsi_status = SCSI_STATUS_OK;
 
@@ -10025,7 +10027,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
struct scsi_vpd_port_designation_cont *pdc;
struct ctl_lun *lun;
struct ctl_port *port;
-   int data_len, num_target_ports, id_len, g, pg, p;
+   int data_len, num_target_ports, iid_len, id_len, g, pg, p;
int num_target_port_groups, single;
 
lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
@@ -10036,6 +10038,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
else
num_target_port_groups = NUM_TARGET_PORT_GROUPS;
num_target_ports = 0;
+   iid_len = 0;
id_len = 0;
mtx_lock(softc-ctl_lock);
STAILQ_FOREACH(port, softc-port_list, links) {
@@ -10046,6 +10049,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
CTL_MAX_LUNS)
continue;
num_target_ports++;
+   if (port-init_devid)
+   iid_len += port-init_devid-len;
if (port-port_devid)
id_len 

svn commit: r269297 - stable/10/sys/cam/ctl

2014-07-30 Thread Alexander Motin
Author: mav
Date: Wed Jul 30 07:20:36 2014
New Revision: 269297
URL: http://svnweb.freebsd.org/changeset/base/269297

Log:
  MFC r268807:
  Reduce per-LUN memory usage from 18MB to 1.8MB.
  
  CTL never had use for CA support code since SPI has gone, and there is no
  even frontends supporting that.  But it still was reserving 256 bytes of
  memory per LUN per every possible initiator on every possible port.
  
  Wrap unused code with ifdef's in case somebody ever need it.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_private.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:18:32 2014(r269296)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:20:36 2014(r269297)
@@ -4609,7 +4609,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 * Set the poweron UA for all initiators on this LUN only.
 */
for (i = 0; i  CTL_MAX_INITIATORS; i++)
-   lun-pending_sense[i].ua_pending = CTL_UA_POWERON;
+   lun-pending_ua[i] = CTL_UA_POWERON;
 
/*
 * Now, before we insert this lun on the lun list, set the lun
@@ -4617,7 +4617,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 */
STAILQ_FOREACH(nlun, ctl_softc-lun_list, links) {
for (i = 0; i  CTL_MAX_INITIATORS; i++) {
-   nlun-pending_sense[i].ua_pending |= CTL_UA_LUN_CHANGE;
+   nlun-pending_ua[i] |= CTL_UA_LUN_CHANGE;
}
}
 
@@ -4758,7 +4758,7 @@ ctl_free_lun(struct ctl_lun *lun)
 
STAILQ_FOREACH(nlun, softc-lun_list, links) {
for (i = 0; i  CTL_MAX_INITIATORS; i++) {
-   nlun-pending_sense[i].ua_pending |= CTL_UA_LUN_CHANGE;
+   nlun-pending_ua[i] |= CTL_UA_LUN_CHANGE;
}
}
 
@@ -5137,7 +5137,7 @@ ctl_lun_capacity_changed(struct ctl_be_l
mtx_lock(lun-lun_lock);
 
for (i = 0; i  CTL_MAX_INITIATORS; i++) 
-   lun-pending_sense[i].ua_pending |= CTL_UA_CAPACITY_CHANGED;
+   lun-pending_ua[i] |= CTL_UA_CAPACITY_CHANGED;
 
mtx_unlock(lun-lun_lock);
 }
@@ -6239,8 +6239,7 @@ ctl_control_page_handler(struct ctl_scsi
if (i == initidx)
continue;
 
-   lun-pending_sense[i].ua_pending |=
-   CTL_UA_MODE_CHANGE;
+   lun-pending_ua[i] |= CTL_UA_MODE_CHANGE;
}
}
mtx_unlock(lun-lun_lock);
@@ -8005,12 +8004,11 @@ ctl_pro_preempt(struct ctl_softc *softc,
 
if (!persis_offset
  i CTL_MAX_INITIATORS)
-   lun-pending_sense[i].ua_pending |=
+   lun-pending_ua[i] |=
CTL_UA_REG_PREEMPT;
else if (persis_offset
   i = persis_offset)
-   lun-pending_sense[i-persis_offset
-   ].ua_pending |=
+   lun-pending_ua[i-persis_offset] |=
CTL_UA_REG_PREEMPT;
lun-per_res[i].registered = 0;
memset(lun-per_res[i].res_key, 0,
@@ -8092,13 +8090,10 @@ ctl_pro_preempt(struct ctl_softc *softc,
   sizeof(struct scsi_per_res_key));
lun-pr_key_count--;
 
-   if (!persis_offset
- i  CTL_MAX_INITIATORS)
-   lun-pending_sense[i].ua_pending |=
-   CTL_UA_REG_PREEMPT;
-   else if (persis_offset
-  i = persis_offset)
-   lun-pending_sense[i-persis_offset].ua_pending|=
+   if (!persis_offset  i  CTL_MAX_INITIATORS)
+   lun-pending_ua[i] |= CTL_UA_REG_PREEMPT;
+   else if (persis_offset  i = persis_offset)
+   lun-pending_ua[i-persis_offset] |=
CTL_UA_REG_PREEMPT;
}
if (!found) {
@@ -8189,27 +8184,23 @@ ctl_pro_preempt(struct ctl_softc *softc,
 
if (!persis_offset
  i  CTL_MAX_INITIATORS)
-   lun-pending_sense[i
-   ].ua_pending |=
+   lun-pending_ua[i] |=

svn commit: r269298 - stable/10/sys/cam/ctl

2014-07-30 Thread Alexander Motin
Author: mav
Date: Wed Jul 30 07:21:30 2014
New Revision: 269298
URL: http://svnweb.freebsd.org/changeset/base/269298

Log:
  MFC r268808:
  Increase maximal number of SCSI ports in CTL from 32 to 128.
  
  After I gave each iSCSI target its own port, the old limit appeared to be
  not so big.  This change almost proportionally increases per-LUN memory
  use, but it is still three times better then it was before r268807.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_io.h
  stable/10/sys/cam/ctl/ctl_ioctl.h
  stable/10/sys/cam/ctl/ctl_private.h
  stable/10/sys/cam/ctl/ctl_tpc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:20:36 2014(r269297)
+++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:21:30 2014(r269298)
@@ -8210,8 +8210,7 @@ ctl_pro_preempt(struct ctl_softc *softc,
  lun-res_type != SPR_TYPE_EX_AC_AR)
lun-pr_res_idx = residx;
else
-   lun-pr_res_idx =
-   CTL_PR_ALL_REGISTRANTS;
+   lun-pr_res_idx = CTL_PR_ALL_REGISTRANTS;
 
persis_io.hdr.nexus = ctsio-io_hdr.nexus;
persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION;

Modified: stable/10/sys/cam/ctl/ctl_io.h
==
--- stable/10/sys/cam/ctl/ctl_io.h  Wed Jul 30 07:20:36 2014
(r269297)
+++ stable/10/sys/cam/ctl/ctl_io.h  Wed Jul 30 07:21:30 2014
(r269298)
@@ -407,7 +407,7 @@ struct ctl_pr_info {
ctl_pr_actionaction;
uint8_t  sa_res_key[8];
uint8_t  res_type;
-   uint16_t residx;
+   uint32_t residx;
 };
 
 struct ctl_ha_msg_hdr {

Modified: stable/10/sys/cam/ctl/ctl_ioctl.h
==
--- stable/10/sys/cam/ctl/ctl_ioctl.h   Wed Jul 30 07:20:36 2014
(r269297)
+++ stable/10/sys/cam/ctl/ctl_ioctl.h   Wed Jul 30 07:21:30 2014
(r269298)
@@ -70,7 +70,7 @@
 /*
  * Maximum number of ports registered at one time.
  */
-#defineCTL_MAX_PORTS   32
+#defineCTL_MAX_PORTS   128
 
 /*
  * Maximum number of initiators we support.

Modified: stable/10/sys/cam/ctl/ctl_private.h
==
--- stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:20:36 2014
(r269297)
+++ stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:21:30 2014
(r269298)
@@ -355,8 +355,8 @@ struct ctl_per_res_info {
uint8_t  registered;
 };
 
-#define CTL_PR_ALL_REGISTRANTS  0x
-#define CTL_PR_NO_RESERVATION   0xFFF0
+#define CTL_PR_ALL_REGISTRANTS  0x
+#define CTL_PR_NO_RESERVATION   0xFFF0
 
 struct ctl_devid {
int len;
@@ -398,7 +398,7 @@ struct ctl_lun {
struct ctl_per_res_info per_res[2*CTL_MAX_INITIATORS];
unsigned intPRGeneration;
int pr_key_count;
-   uint16_tpr_res_idx;
+   uint32_tpr_res_idx;
uint8_t res_type;
uint8_t write_buffer[262144];
struct ctl_devid*lun_devid;

Modified: stable/10/sys/cam/ctl/ctl_tpc.c
==
--- stable/10/sys/cam/ctl/ctl_tpc.c Wed Jul 30 07:20:36 2014
(r269297)
+++ stable/10/sys/cam/ctl/ctl_tpc.c Wed Jul 30 07:21:30 2014
(r269298)
@@ -89,7 +89,7 @@ struct tpc_io {
 struct tpc_list {
uint8_t  service_action;
int  init_port;
-   uint16_t init_idx;
+   uint32_t init_idx;
uint32_t list_id;
uint8_t  flags;
uint8_t *params;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r269231 - head/usr.bin/m4/lib

2014-07-30 Thread Bjoern A. Zeeb

On 29 Jul 2014, at 09:46 , Baptiste Daroussin b...@freebsd.org wrote:

 Author: bapt
 Date: Tue Jul 29 09:46:08 2014
 New Revision: 269231
 URL: http://svnweb.freebsd.org/changeset/base/269231
 
 Log:
  Fix build with gcc
 

I fear that was not enough; this is on arm:

=== usr.bin/m4 (all)   

 
=== usr.bin/m4/tests (all) 

 
cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/usr.bin/m4/misc.c: In function 'm4errx':
/scratch/tmp/bz/head.svn/usr.bin/m4/misc.c:268: warning: declaration of 'eval' 
shadows a global declaration
/scratch/tmp/bz/head.svn/usr.bin/m4/extern.h:40: warning: shadowed declaration 
is here
--- misc.o ---
*** [misc.o] Error code 1   

 

bmake: stopped in /scratch/tmp/bz/head.svn/usr.bin/m4
cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c: In function 'ohash_remove':
/scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c:123: warning: cast discards 
qualifiers from pointer target type
/scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c: In function 'ohash_find':
/scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c:144: warning: cast discards 
qualifiers from pointer target type
/scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c: In function 'ohash_next':
/scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c:183: warning: cast discards 
qualifiers from pointer target type
--- ohash.o ---
*** [ohash.o] Error code 1  

  

bmake: stopped in /scratch/tmp/bz/head.svn/usr.bin/m4
--- all_subdir_m4 ---   

 
*** [all_subdir_m4] Error code 1

bmake: stopped in /scratch/tmp/bz/head.svn/usr.bin





 Modified:
  head/usr.bin/m4/lib/ohash.h
 
 Modified: head/usr.bin/m4/lib/ohash.h
 ==
 --- head/usr.bin/m4/lib/ohash.h   Tue Jul 29 09:36:48 2014
 (r269230)
 +++ head/usr.bin/m4/lib/ohash.h   Tue Jul 29 09:46:08 2014
 (r269231)
 @@ -58,8 +58,7 @@ void ohash_delete(struct ohash *);
 unsigned int ohash_lookup_interval(struct ohash *, const char *,
   const char *, uint32_t);
 unsigned int ohash_lookup_memory(struct ohash *, const char *,
 - size_t, uint32_t)
 - __attribute__ ((__bounded__(__string__,2,3)));
 + size_t, uint32_t);
 void *ohash_find(struct ohash *, unsigned int);
 void *ohash_remove(struct ohash *, unsigned int);
 void *ohash_insert(struct ohash *, unsigned int, void *);
 

— 
Bjoern A. Zeeb Come on. Learn, goddamn it., WarGames, 1983

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


svn commit: r269302 - head/usr.bin/sed

2014-07-30 Thread Jeremie Le Hen
Author: jlh
Date: Wed Jul 30 14:46:39 2014
New Revision: 269302
URL: http://svnweb.freebsd.org/changeset/base/269302

Log:
  Fix relative numerical addressing (addr,+N).
  
  As a bonus the patch untangles a bit the logic and makes the code
  easier to grasp.
  
  PR:   192108
  MFC after:1 week

Modified:
  head/usr.bin/sed/process.c

Modified: head/usr.bin/sed/process.c
==
--- head/usr.bin/sed/process.c  Wed Jul 30 12:39:49 2014(r269301)
+++ head/usr.bin/sed/process.c  Wed Jul 30 14:46:39 2014(r269302)
@@ -288,24 +288,32 @@ applies(struct s_command *cp)
r = 1;
else if (cp-a2)
if (cp-startline  0) {
-   if (MATCH(cp-a2)) {
-   cp-startline = 0;
-   lastaddr = 1;
-   r = 1;
-   } else if (linenum - cp-startline = cp-a2-u.l)
-   r = 1;
-   else if ((cp-a2-type == AT_LINE 
-  linenum  cp-a2-u.l) ||
-  (cp-a2-type == AT_RELLINE 
-  linenum - cp-startline  cp-a2-u.l)) {
-   /*
-* We missed the 2nd address due to a branch,
-* so just close the range and return false.
-*/
-   cp-startline = 0;
-   r = 0;
-   } else
-   r = 1;
+switch (cp-a2-type) {
+case AT_RELLINE:
+if (linenum - cp-startline = cp-a2-u.l)
+r = 1;
+else {
+   cp-startline = 0;
+   r = 0;
+}
+break;
+default:
+if (MATCH(cp-a2)) {
+cp-startline = 0;
+lastaddr = 1;
+r = 1;
+} else if (cp-a2-type == AT_LINE 
+linenum  cp-a2-u.l) {
+/*
+ * We missed the 2nd address due to a
+ * branch, so just close the range and
+ * return false.
+ */
+cp-startline = 0;
+r = 0;
+} else
+r = 1;
+}
} else if (MATCH(cp-a1)) {
/*
 * If the second address is a number less than or
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269303 - head/sbin/restore

2014-07-30 Thread Kirk McKusick
Author: mckusick
Date: Wed Jul 30 14:52:04 2014
New Revision: 269303
URL: http://svnweb.freebsd.org/changeset/base/269303

Log:
  When restoring a UFS dump onto a ZFS filesystem, an assertion in
  restore was failing because ZFS was reporting a blocksize that was
  not a multiple of 1024.  Replace restore's failed assertion with
  code that writes restored files in a blocksize that works for
  restore (a multiple of 1024) despite being non-optimal for ZFS.
  
  Submitted by: Dmitry Morozovsky
  Tested by:Dmitry Morozovsky
  MFC after:1 week

Modified:
  head/sbin/restore/tape.c

Modified: head/sbin/restore/tape.c
==
--- head/sbin/restore/tape.cWed Jul 30 14:46:39 2014(r269302)
+++ head/sbin/restore/tape.cWed Jul 30 14:52:04 2014(r269303)
@@ -260,9 +260,11 @@ setup(void)
fssize = TP_BSIZE;
if (stbuf.st_blksize = TP_BSIZE  stbuf.st_blksize = MAXBSIZE)
fssize = stbuf.st_blksize;
-   if (((fssize - 1)  fssize) != 0) {
-   fprintf(stderr, bad block size %ld\n, fssize);
-   done(1);
+   if (((TP_BSIZE - 1)  stbuf.st_blksize) != 0) {
+   fprintf(stderr, Warning: filesystem with non-multiple-of-%d 
+   blocksize (%d);\n, TP_BSIZE, stbuf.st_blksize);
+   fssize = roundup(fssize, TP_BSIZE);
+   fprintf(stderr, \twriting using blocksize %ld\n, fssize);
}
if (spcl.c_volume != 1) {
fprintf(stderr, Tape is not volume 1 of the dump\n);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269306 - head/sys/netinet6

2014-07-30 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul 30 15:08:12 2014
New Revision: 269306
URL: http://svnweb.freebsd.org/changeset/base/269306

Log:
  Add new rule to source address selection algorithm. It prefers address
  with better virtual status. Use ifa_preferred() to choose better address.
  
  PR:   187341
  Tested by:des
  MFC after:1 week

Modified:
  head/sys/netinet6/in6_src.c

Modified: head/sys/netinet6/in6_src.c
==
--- head/sys/netinet6/in6_src.c Wed Jul 30 15:01:32 2014(r269305)
+++ head/sys/netinet6/in6_src.c Wed Jul 30 15:08:12 2014(r269306)
@@ -444,6 +444,12 @@ in6_selectsrc(struct sockaddr_in6 *dstso
REPLACE(8);
 
/*
+* Rule 9: prefer address with better virtual status.
+*/
+   if (ifa_preferred(ia_best-ia_ifa, ia-ia_ifa))
+   REPLACE(9);
+
+   /*
 * Rule 14: Use longest matching prefix.
 * Note: in the address selection draft, this rule is
 * documented as Rule 8.  However, since it is also
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269307 - head/sys/conf

2014-07-30 Thread Ed Maste
Author: emaste
Date: Wed Jul 30 15:43:17 2014
New Revision: 269307
URL: http://svnweb.freebsd.org/changeset/base/269307

Log:
  files.mips: the kbd driver is used by vt(4) too
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/conf/files.mips

Modified: head/sys/conf/files.mips
==
--- head/sys/conf/files.mipsWed Jul 30 15:08:12 2014(r269306)
+++ head/sys/conf/files.mipsWed Jul 30 15:43:17 2014(r269307)
@@ -68,7 +68,7 @@ dev/cfe/cfe_env.c optionalcfe_env
 
 # syscons support
 dev/fb/fb.coptionalsc
-dev/kbd/kbd.c  optionalsc
+dev/kbd/kbd.c  optionalsc | vt
 dev/syscons/scgfbrndr.coptionalsc
 dev/syscons/scterm-teken.c optionalsc
 dev/syscons/scvtb.coptionalsc
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269308 - head/lib/libstand

2014-07-30 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul 30 16:08:16 2014
New Revision: 269308
URL: http://svnweb.freebsd.org/changeset/base/269308

Log:
  Provide a means for loaders to control which file system to use. This
  to counteract the default behaviour of always trying each and every
  file system until one succeeds, or the open fails. The problem with the
  loader is that we've implemented features based on this behavior. The
  handling of compressed files is a good example of this. However, it is
  in general highly undesirable to not have a one-time probe (or taste
  in the geom lingo), followed by something similar to a mount whenever
  we (first) read from a device. Everytime we go to the same device, we
  can reasonably assume it (still) has the same file system. For file
  systems that need to do far more that a trivial read of a super block,
  not having something similar to a mount operation is disastrous from
  a performance (and thus usability) perspective.
  
  But, again, since we've implemented features based on this stateless
  approach, things can get complicated quickly if and when we want to
  change this. And yet, we sometimes do need stateful behaviour.
  
  For this reason, this change simply introduces exclusive_file_system.
  When set to the fsops of the file system to use, the open call will
  only try this file system. Setting it to NULL restores the default
  behaviour. It's a low-cost (low-brow?) approach to provide enough
  control without re-implementing the guts of the loader.
  
  A good example of when this is useful is when we're trying to load
  files out of a container (say, a software packaga) that itself lives
  on a file system or is fetched over the network. While opening the
  container can be done in the normal stateless manner, once it is
  opened, subsequent opens should only consider the container.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/lib/libstand/open.c
  head/lib/libstand/stand.h

Modified: head/lib/libstand/open.c
==
--- head/lib/libstand/open.cWed Jul 30 15:43:17 2014(r269307)
+++ head/lib/libstand/open.cWed Jul 30 16:08:16 2014(r269308)
@@ -65,6 +65,8 @@ __FBSDID($FreeBSD$);
 
 #include stand.h
 
+struct fs_ops *exclusive_file_system;
+
 struct open_file files[SOPEN_MAX];
 
 static int
@@ -89,6 +91,7 @@ o_rainit(struct open_file *f)
 int
 open(const char *fname, int mode)
 {
+struct fs_ops  *fs;
 struct open_file   *f;
 intfd, i, error, besterror;
 const char *file;
@@ -105,6 +108,15 @@ open(const char *fname, int mode)
 f-f_offset = 0;
 f-f_devdata = NULL;
 file = (char *)0;
+
+if (exclusive_file_system != NULL) {
+   fs = exclusive_file_system;
+   error = (fs-fo_open)(fname, f);
+   if (error == 0)
+   goto ok;
+   goto fail;
+}
+
 error = devopen(f, fname, file);
 if (error ||
(((f-f_flags  F_NODEV) == 0)  f-f_dev == (struct devsw *)0))
@@ -120,20 +132,17 @@ open(const char *fname, int mode)
 /* pass file name to the different filesystem open routines */
 besterror = ENOENT;
 for (i = 0; file_system[i] != NULL; i++) {
-
-   error = ((*file_system[i]).fo_open)(file, f);
-   if (error == 0) {
-   
-   f-f_ops = file_system[i];
-   o_rainit(f);
-   return (fd);
-   }
+   fs = file_system[i];
+   error = (fs-fo_open)(file, f);
+   if (error == 0)
+   goto ok;
if (error != EINVAL)
besterror = error;
 }
 error = besterror;
 
-if ((f-f_flags  F_NODEV) == 0)
+ fail:
+if ((f-f_flags  F_NODEV) == 0  f-f_dev != NULL)
f-f_dev-dv_close(f);
 if (error)
devclose(f);
@@ -142,4 +151,9 @@ open(const char *fname, int mode)
 f-f_flags = 0;
 errno = error;
 return (-1);
+
+ ok:
+f-f_ops = fs;
+o_rainit(f);
+return (fd);
 }

Modified: head/lib/libstand/stand.h
==
--- head/lib/libstand/stand.h   Wed Jul 30 15:43:17 2014(r269307)
+++ head/lib/libstand/stand.h   Wed Jul 30 16:08:16 2014(r269308)
@@ -364,6 +364,7 @@ extern int  devopen(struct open_file *, 
 extern int devclose(struct open_file *f);
 extern voidpanic(const char *, ...) __dead2 __printflike(1, 2);
 extern struct fs_ops   *file_system[];
+extern struct fs_ops   *exclusive_file_system;
 extern struct devsw*devsw[];
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269309 - head

2014-07-30 Thread Xin LI
Author: delphij
Date: Wed Jul 30 17:19:11 2014
New Revision: 269309
URL: http://svnweb.freebsd.org/changeset/base/269309

Log:
  Follow up r269179 and remove the libsbuf.so.7 library.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul 30 16:08:16 2014(r269308)
+++ head/ObsoleteFiles.inc  Wed Jul 30 17:19:11 2014(r269309)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20140728: libsbuf restored to old version.
+OLD_LIBS+=lib/libsbuf.so.7
 # 20140728: Remove an obsolete man page
 OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz
 OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269314 - head/sys/dev/mps

2014-07-30 Thread Steven Hartland
Author: smh
Date: Wed Jul 30 17:58:17 2014
New Revision: 269314
URL: http://svnweb.freebsd.org/changeset/base/269314

Log:
  Bring in LSI's phase16 - phase18 changes
  * Implements Start Stop Unit for SATA direct-attach devices in IR mode to 
avoid
data corruption.
  * Use CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT and CAM_TID_INVALID
  
  Obtained from:LSI
  MFC after:2 weeks

Modified:
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mps_sas.h
  head/sys/dev/mps/mps_sas_lsi.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Wed Jul 30 17:57:36 2014(r269313)
+++ head/sys/dev/mps/mps.c  Wed Jul 30 17:58:17 2014(r269314)
@@ -140,6 +140,7 @@ mps_diag_reset(struct mps_softc *sc,int 
 {
uint32_t reg;
int i, error, tries = 0;
+   uint8_t first_wait_done = FALSE;
 
mps_dprint(sc, MPS_TRACE, %s\n, __func__);
 
@@ -182,15 +183,32 @@ mps_diag_reset(struct mps_softc *sc,int 
 
/* Wait up to 300 seconds in 50ms intervals */
error = ETIMEDOUT;
-   for (i = 0; i  6; i++) {
-   /* wait 50 msec */
-   if (mtx_owned(sc-mps_mtx)  sleep_flag == CAN_SLEEP)
-   msleep(sc-msleep_fake_chan, sc-mps_mtx, 0,
-   mpsdiag, hz/20);
-   else if (sleep_flag == CAN_SLEEP)
-   pause(mpsdiag, hz/20);
-   else
-   DELAY(50 * 1000);
+   for (i = 0; i  6000; i++) {
+   /*
+* Wait 50 msec. If this is the first time through, wait 256
+* msec to satisfy Diag Reset timing requirements.
+*/
+   if (first_wait_done) {
+   if (mtx_owned(sc-mps_mtx)  sleep_flag == CAN_SLEEP)
+   msleep(sc-msleep_fake_chan, sc-mps_mtx, 0,
+   mpsdiag, hz/20);
+   else if (sleep_flag == CAN_SLEEP)
+   pause(mpsdiag, hz/20);
+   else
+   DELAY(50 * 1000);
+   } else {
+   DELAY(256 * 1000);
+   first_wait_done = TRUE;
+   }
+   /*
+* Check for the RESET_ADAPTER bit to be cleared first, then
+* wait for the RESET state to be cleared, which takes a little
+* longer.
+*/
+   reg = mps_regread(sc, MPI2_HOST_DIAGNOSTIC_OFFSET);
+   if (reg  MPI2_DIAG_RESET_ADAPTER) {
+   continue;
+   }
reg = mps_regread(sc, MPI2_DOORBELL_OFFSET);
if ((reg  MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_RESET) {
error = 0;
@@ -236,7 +254,7 @@ mps_transition_ready(struct mps_softc *s
sleep_flags = (sc-mps_flags  MPS_FLAGS_ATTACH_DONE)
? CAN_SLEEP:NO_SLEEP;
error = 0;
-   while (tries++  5) {
+   while (tries++  1200) {
reg = mps_regread(sc, MPI2_DOORBELL_OFFSET);
mps_dprint(sc, MPS_INIT, Doorbell= 0x%x\n, reg);
 
@@ -656,6 +674,9 @@ int
 mps_reinit(struct mps_softc *sc)
 {
int error;
+   struct mpssas_softc *sassc;
+
+   sassc = sc-sassc;
 
MPS_FUNCTRACE(sc);
 
@@ -736,6 +757,8 @@ mps_reinit(struct mps_softc *sc)
mps_dprint(sc, MPS_INFO, %s finished sc %p post %u free %u\n, 
__func__, sc, sc-replypostindex, sc-replyfreeindex);
 
+   mpssas_release_simq_reinit(sassc);
+
return 0;
 }
 
@@ -2510,6 +2533,7 @@ int
 mps_request_polled(struct mps_softc *sc, struct mps_command *cm)
 {
int error, timeout = 0, rc;
+   struct timeval cur_time, start_time;
 
error = 0;
 
@@ -2517,22 +2541,33 @@ mps_request_polled(struct mps_softc *sc,
cm-cm_complete = NULL;
mps_map_command(sc, cm);
 
+   getmicrotime(start_time);
while ((cm-cm_flags  MPS_CM_FLAGS_COMPLETE) == 0) {
mps_intr_locked(sc);
 
-   DELAY(50 * 1000);
-   if (timeout++  1000) {
+   if (mtx_owned(sc-mps_mtx))
+   msleep(sc-msleep_fake_chan, sc-mps_mtx, 0,
+   mpspoll, hz/20);
+   else
+   pause(mpsdiag, hz/20);
+
+   /*
+* Check for real-time timeout and fail if more than 60 seconds.
+*/
+   getmicrotime(cur_time);
+   timeout = cur_time.tv_sec - start_time.tv_sec;
+   if (timeout  60) {
mps_dprint(sc, MPS_FAULT, polling failed\n);
error = ETIMEDOUT;
break;
}
}
-   
+
if (error) {
   

svn commit: r269316 - head/sys/dev/mps

2014-07-30 Thread Steven Hartland
Author: smh
Date: Wed Jul 30 18:21:06 2014
New Revision: 269316
URL: http://svnweb.freebsd.org/changeset/base/269316

Log:
  Bring in LSI's phase19 changes
  * Removed unused mpssas_discovery_timeout function.
  * Don't alter mapping boundaries if not raid firmware.
  * Check free_busaddr instead of post_busaddr (diff minimisation really)
  
  MFC after:2 weeks

Modified:
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_mapping.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Wed Jul 30 17:59:37 2014(r269315)
+++ head/sys/dev/mps/mps.c  Wed Jul 30 18:21:06 2014(r269316)
@@ -610,7 +610,7 @@ mps_iocfacts_free(struct mps_softc *sc)
 
mps_dprint(sc, MPS_TRACE, %s\n, __func__);
 
-   if (sc-post_busaddr != 0)
+   if (sc-free_busaddr != 0)
bus_dmamap_unload(sc-queues_dmat, sc-queues_map);
if (sc-free_queue != NULL)
bus_dmamem_free(sc-queues_dmat, sc-free_queue,

Modified: head/sys/dev/mps/mps_mapping.c
==
--- head/sys/dev/mps/mps_mapping.c  Wed Jul 30 17:59:37 2014
(r269315)
+++ head/sys/dev/mps/mps_mapping.c  Wed Jul 30 18:21:06 2014
(r269316)
@@ -336,12 +336,13 @@ _mapping_get_high_missing_mt_idx(struct 
end_idx = sc-max_devices;
if (ioc_pg8_flags  MPI2_IOCPAGE8_FLAGS_RESERVED_TARGETID_0)
start_idx = 1;
-   if (sc-ir_firmware)
+   if (sc-ir_firmware) {
_mapping_get_ir_maprange(sc, start_idx_ir, end_idx_ir);
-   if (start_idx == start_idx_ir)
-   start_idx = end_idx_ir + 1;
-   else
-   end_idx = start_idx_ir;
+   if (start_idx == start_idx_ir)
+   start_idx = end_idx_ir + 1;
+   else
+   end_idx = start_idx_ir;
+   }
mt_entry = sc-mapping_table[start_idx];
for (map_idx = start_idx; map_idx  end_idx; map_idx++, mt_entry++) {
if (mt_entry-missing_count  high_missing_count) {

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Wed Jul 30 17:59:37 2014(r269315)
+++ head/sys/dev/mps/mps_sas.c  Wed Jul 30 18:21:06 2014(r269316)
@@ -115,7 +115,6 @@ static uint8_t op_code_prot[256] = {
 
 MALLOC_DEFINE(M_MPSSAS, MPSSAS, MPS SAS memory);
 
-static void mpssas_discovery_timeout(void *data);
 static void mpssas_remove_device(struct mps_softc *, struct mps_command *);
 static void mpssas_remove_complete(struct mps_softc *, struct mps_command *);
 static void mpssas_action(struct cam_sim *sim, union ccb *ccb);
@@ -910,46 +909,6 @@ mpssas_discovery_end(struct mpssas_softc
 }
 
 static void
-mpssas_discovery_timeout(void *data)
-{
-   struct mpssas_softc *sassc = data;
-   struct mps_softc *sc;
-
-   sc = sassc-sc;
-   MPS_FUNCTRACE(sc);
-
-   mps_lock(sc);
-   mps_dprint(sc, MPS_INFO,
-   Timeout waiting for discovery, interrupts may not be working!\n);
-   sassc-flags = ~MPSSAS_DISCOVERY_TIMEOUT_PENDING;
-
-   /* Poll the hardware for events in case interrupts aren't working */
-   mps_intr_locked(sc);
-
-   mps_dprint(sassc-sc, MPS_INFO,
-   Finished polling after discovery timeout at %d\n, ticks);
-
-   if ((sassc-flags  MPSSAS_IN_DISCOVERY) == 0) {
-   mpssas_discovery_end(sassc);
-   } else {
-   if (sassc-discovery_timeouts  MPSSAS_MAX_DISCOVERY_TIMEOUTS) {
-   sassc-flags |= MPSSAS_DISCOVERY_TIMEOUT_PENDING;
-   callout_reset(sassc-discovery_callout,
-   MPSSAS_DISCOVERY_TIMEOUT * hz,
-   mpssas_discovery_timeout, sassc);
-   sassc-discovery_timeouts++;
-   } else {
-   mps_dprint(sassc-sc, MPS_FAULT,
-   Discovery timed out, continuing.\n);
-   sassc-flags = ~MPSSAS_IN_DISCOVERY;
-   mpssas_discovery_end(sassc);
-   }
-   }
-
-   mps_unlock(sc);
-}
-
-static void
 mpssas_action(struct cam_sim *sim, union ccb *ccb)
 {
struct mpssas_softc *sassc;

Modified: head/sys/dev/mps/mpsvar.h
==
--- head/sys/dev/mps/mpsvar.h   Wed Jul 30 17:59:37 2014(r269315)
+++ head/sys/dev/mps/mpsvar.h   Wed Jul 30 18:21:06 2014(r269316)
@@ -32,7 +32,7 @@
 #ifndef _MPSVAR_H
 #define _MPSVAR_H
 
-#define MPS_DRIVER_VERSION 18.00.00.00-fbsd
+#define MPS_DRIVER_VERSION 19.00.00.00-fbsd
 
 #define MPS_DB_MAX_WAIT2500
 
___
svn-src-all@freebsd.org 

svn commit: r269317 - head/usr.sbin/bhyve

2014-07-30 Thread Tycho Nightingale
Author: tychon
Date: Wed Jul 30 18:47:31 2014
New Revision: 269317
URL: http://svnweb.freebsd.org/changeset/base/269317

Log:
  Commands which encounter a fatal error shouldn't be marked as completed.
  Furthermore, provide an indication of the current command so it can be
  determined which one actually failed.
  
  Reviewed by:  grehan

Modified:
  head/usr.sbin/bhyve/pci_ahci.c

Modified: head/usr.sbin/bhyve/pci_ahci.c
==
--- head/usr.sbin/bhyve/pci_ahci.c  Wed Jul 30 18:21:06 2014
(r269316)
+++ head/usr.sbin/bhyve/pci_ahci.c  Wed Jul 30 18:47:31 2014
(r269317)
@@ -336,8 +336,9 @@ ahci_write_fis_d2h(struct ahci_port *p, 
fis[13] = cfis[13];
if (fis[2]  ATA_S_ERROR)
p-is |= AHCI_P_IX_TFE;
+   else
+   p-ci = ~(1  slot);
p-tfd = tfd;
-   p-ci = ~(1  slot);
ahci_write_fis(p, FIS_TYPE_REGD2H, fis);
 }
 
@@ -651,8 +652,8 @@ handle_identify(struct ahci_port *p, int
write_prdt(p, slot, cfis, (void *)buf, sizeof(buf));
p-tfd = ATA_S_DSC | ATA_S_READY;
p-is |= AHCI_P_IX_DP;
+   p-ci = ~(1  slot);
}
-   p-ci = ~(1  slot);
ahci_generate_intr(p-pr_sc);
 }
 
@@ -694,8 +695,8 @@ handle_atapi_identify(struct ahci_port *
write_prdt(p, slot, cfis, (void *)buf, sizeof(buf));
p-tfd = ATA_S_DSC | ATA_S_READY;
p-is |= AHCI_P_IX_DHR;
+   p-ci = ~(1  slot);
}
-   p-ci = ~(1  slot);
ahci_generate_intr(p-pr_sc);
 }
 
@@ -1298,7 +1299,6 @@ ahci_handle_cmd(struct ahci_port *p, int
if (!p-atapi) {
p-tfd = (ATA_E_ABORT  8) | ATA_S_READY | ATA_S_ERROR;
p-is |= AHCI_P_IX_TFE;
-   p-ci = ~(1  slot);
ahci_generate_intr(p-pr_sc);
} else
handle_packet_cmd(p, slot, cfis);
@@ -1307,7 +1307,6 @@ ahci_handle_cmd(struct ahci_port *p, int
WPRINTF(Unsupported cmd:%02x\n, cfis[2]);
p-tfd = (ATA_E_ABORT  8) | ATA_S_READY | ATA_S_ERROR;
p-is |= AHCI_P_IX_TFE;
-   p-ci = ~(1  slot);
ahci_generate_intr(p-pr_sc);
break;
}
@@ -1375,8 +1374,11 @@ ahci_handle_port(struct ahci_port *p)
 * are already in-flight.
 */
for (i = 0; (i  32)  p-ci; i++) {
-   if ((p-ci  (1  i))  !(p-pending  (1  i)))
+   if ((p-ci  (1  i))  !(p-pending  (1  i))) {
+   p-cmd = ~AHCI_P_CMD_CCS_MASK;
+   p-cmd |= i  AHCI_P_CMD_CCS_SHIFT;
ahci_handle_slot(p, i);
+   }
}
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Andreas Tobler

Hi Alan,

On 26.07.14 20:10, Alan Cox wrote:

Author: alc
Date: Sat Jul 26 18:10:18 2014
New Revision: 269134
URL: http://svnweb.freebsd.org/changeset/base/269134

Log:
   When unwiring a region of an address space, do not assume that the
   underlying physical pages are mapped by the pmap.  If, for example, the
   application has performed an mprotect(..., PROT_NONE) on any part of the
   wired region, then those pages will no longer be mapped by the pmap.
   So, using the pmap to lookup the wired pages in order to unwire them
   doesn't always work, and when it doesn't work wired pages are leaked.

   To avoid the leak, introduce and use a new function vm_object_unwire()
   that locates the wired pages by traversing the object and its backing
   objects.

   At the same time, switch from using pmap_change_wiring() to the recently
   introduced function pmap_unwire() for unwiring the region's mappings.
   pmap_unwire() is faster, because it operates a range of virtual addresses
   rather than a single virtual page at a time.  Moreover, by operating on
   a range, it is superpage friendly.  It doesn't waste time performing
   unnecessary demotions.

   Reported by: markj
   Reviewed by: kib
   Tested by:   pho, jmg (arm)
   Sponsored by:EMC / Isilon Storage Division


This commit brings my 32- and 64-bit PowerMac's into panic.
Unfortunately I'm not able to give you a backtrace in the form of a 
textdump nor of a core dump.


The only thing I have is this picture:

http://people.freebsd.org/~andreast/r269134_panic.jpg

Exactly this revision gives a panic and breaks the textdump/coredump 
facility.


How can I help debugging?

TIA,
Andreas


Modified:
   head/sys/vm/vm_extern.h
   head/sys/vm/vm_fault.c
   head/sys/vm/vm_map.c
   head/sys/vm/vm_object.c
   head/sys/vm/vm_object.h

Modified: head/sys/vm/vm_extern.h
==
--- head/sys/vm/vm_extern.h Sat Jul 26 17:59:25 2014(r269133)
+++ head/sys/vm/vm_extern.h Sat Jul 26 18:10:18 2014(r269134)
@@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse
  int fault_flags, vm_page_t *m_hold);
  int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len,
  vm_prot_t prot, vm_page_t *ma, int max_count);
-void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
  int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
  int vm_forkproc(struct thread *, struct proc *, struct thread *, struct 
vmspace *, int);
  void vm_waitproc(struct proc *);

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Sat Jul 26 17:59:25 2014(r269133)
+++ head/sys/vm/vm_fault.c  Sat Jul 26 18:10:18 2014(r269134)
@@ -106,6 +106,7 @@ __FBSDID($FreeBSD$);
  #define PFFOR 4

  static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, int *);
+static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);

  #define   VM_FAULT_READ_BEHIND8
  #define   VM_FAULT_READ_MAX   (1 + VM_FAULT_READ_AHEAD_MAX)
@@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t
   *
   *Unwire a range of virtual addresses in a map.
   */
-void
+static void
  vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end,
  boolean_t fictitious)
  {

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cSat Jul 26 17:59:25 2014(r269133)
+++ head/sys/vm/vm_map.cSat Jul 26 18:10:18 2014(r269134)
@@ -132,6 +132,7 @@ static void _vm_map_init(vm_map_t map, p
  vm_offset_t max);
  static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t 
system_map);
  static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry);
+static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry);
  #ifdef INVARIANTS
  static void vm_map_zdtor(void *mem, int size, void *arg);
  static void vmspace_zdtor(void *mem, int size, void *arg);
@@ -2393,16 +2394,10 @@ done:
(entry-eflags  MAP_ENTRY_USER_WIRED))) {
if (user_unwire)
entry-eflags = ~MAP_ENTRY_USER_WIRED;
-   entry-wired_count--;
-   if (entry-wired_count == 0) {
-   /*
-* Retain the map lock.
-*/
-   vm_fault_unwire(map, entry-start, entry-end,
-   entry-object.vm_object != NULL 
-   (entry-object.vm_object-flags 
-   OBJ_FICTITIOUS) != 0);
-   }
+   if (entry-wired_count == 1)
+   vm_map_entry_unwire(map, entry);
+   else

Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Alan Cox
On 07/30/2014 13:58, Andreas Tobler wrote:
 Hi Alan,

 On 26.07.14 20:10, Alan Cox wrote:
 Author: alc
 Date: Sat Jul 26 18:10:18 2014
 New Revision: 269134
 URL: http://svnweb.freebsd.org/changeset/base/269134

 Log:
When unwiring a region of an address space, do not assume that the
underlying physical pages are mapped by the pmap.  If, for
 example, the
application has performed an mprotect(..., PROT_NONE) on any part
 of the
wired region, then those pages will no longer be mapped by the pmap.
So, using the pmap to lookup the wired pages in order to unwire them
doesn't always work, and when it doesn't work wired pages are leaked.

To avoid the leak, introduce and use a new function
 vm_object_unwire()
that locates the wired pages by traversing the object and its backing
objects.

At the same time, switch from using pmap_change_wiring() to the
 recently
introduced function pmap_unwire() for unwiring the region's mappings.
pmap_unwire() is faster, because it operates a range of virtual
 addresses
rather than a single virtual page at a time.  Moreover, by
 operating on
a range, it is superpage friendly.  It doesn't waste time performing
unnecessary demotions.

Reported by:markj
Reviewed by:kib
Tested by:pho, jmg (arm)
Sponsored by:EMC / Isilon Storage Division

 This commit brings my 32- and 64-bit PowerMac's into panic.
 Unfortunately I'm not able to give you a backtrace in the form of a
 textdump nor of a core dump.

 The only thing I have is this picture:

 http://people.freebsd.org/~andreast/r269134_panic.jpg

 Exactly this revision gives a panic and breaks the textdump/coredump
 facility.

 How can I help debugging?



For now, that's all I need to know.




 Modified:
head/sys/vm/vm_extern.h
head/sys/vm/vm_fault.c
head/sys/vm/vm_map.c
head/sys/vm/vm_object.c
head/sys/vm/vm_object.h

 Modified: head/sys/vm/vm_extern.h
 ==

 --- head/sys/vm/vm_extern.hSat Jul 26 17:59:25 2014(r269133)
 +++ head/sys/vm/vm_extern.hSat Jul 26 18:10:18 2014(r269134)
 @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse
   int fault_flags, vm_page_t *m_hold);
   int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr,
 vm_size_t len,
   vm_prot_t prot, vm_page_t *ma, int max_count);
 -void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
   int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
   int vm_forkproc(struct thread *, struct proc *, struct thread *,
 struct vmspace *, int);
   void vm_waitproc(struct proc *);

 Modified: head/sys/vm/vm_fault.c
 ==

 --- head/sys/vm/vm_fault.cSat Jul 26 17:59:25 2014(r269133)
 +++ head/sys/vm/vm_fault.cSat Jul 26 18:10:18 2014(r269134)
 @@ -106,6 +106,7 @@ __FBSDID($FreeBSD$);
   #define PFFOR 4

   static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t
 *, int *);
 +static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t,
 boolean_t);

   #defineVM_FAULT_READ_BEHIND8
   #defineVM_FAULT_READ_MAX(1 + VM_FAULT_READ_AHEAD_MAX)
 @@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t
*
*Unwire a range of virtual addresses in a map.
*/
 -void
 +static void
   vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end,
   boolean_t fictitious)
   {

 Modified: head/sys/vm/vm_map.c
 ==

 --- head/sys/vm/vm_map.cSat Jul 26 17:59:25 2014(r269133)
 +++ head/sys/vm/vm_map.cSat Jul 26 18:10:18 2014(r269134)
 @@ -132,6 +132,7 @@ static void _vm_map_init(vm_map_t map, p
   vm_offset_t max);
   static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t
 system_map);
   static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry);
 +static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry);
   #ifdef INVARIANTS
   static void vm_map_zdtor(void *mem, int size, void *arg);
   static void vmspace_zdtor(void *mem, int size, void *arg);
 @@ -2393,16 +2394,10 @@ done:
   (entry-eflags  MAP_ENTRY_USER_WIRED))) {
   if (user_unwire)
   entry-eflags = ~MAP_ENTRY_USER_WIRED;
 -entry-wired_count--;
 -if (entry-wired_count == 0) {
 -/*
 - * Retain the map lock.
 - */
 -vm_fault_unwire(map, entry-start, entry-end,
 -entry-object.vm_object != NULL 
 -(entry-object.vm_object-flags 
 -OBJ_FICTITIOUS) != 0);
 -}
 +if (entry-wired_count == 1)
 +vm_map_entry_unwire(map, entry);
 +else
 +entry-wired_count--;
   }
   

Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Alan Cox
On 07/30/2014 13:58, Andreas Tobler wrote:
 Hi Alan,

 On 26.07.14 20:10, Alan Cox wrote:
 Author: alc
 Date: Sat Jul 26 18:10:18 2014
 New Revision: 269134
 URL: http://svnweb.freebsd.org/changeset/base/269134

 Log:
When unwiring a region of an address space, do not assume that the
underlying physical pages are mapped by the pmap.  If, for
 example, the
application has performed an mprotect(..., PROT_NONE) on any part
 of the
wired region, then those pages will no longer be mapped by the pmap.
So, using the pmap to lookup the wired pages in order to unwire them
doesn't always work, and when it doesn't work wired pages are leaked.

To avoid the leak, introduce and use a new function
 vm_object_unwire()
that locates the wired pages by traversing the object and its backing
objects.

At the same time, switch from using pmap_change_wiring() to the
 recently
introduced function pmap_unwire() for unwiring the region's mappings.
pmap_unwire() is faster, because it operates a range of virtual
 addresses
rather than a single virtual page at a time.  Moreover, by
 operating on
a range, it is superpage friendly.  It doesn't waste time performing
unnecessary demotions.

Reported by:markj
Reviewed by:kib
Tested by:pho, jmg (arm)
Sponsored by:EMC / Isilon Storage Division

 This commit brings my 32- and 64-bit PowerMac's into panic.
 Unfortunately I'm not able to give you a backtrace in the form of a
 textdump nor of a core dump.

 The only thing I have is this picture:

 http://people.freebsd.org/~andreast/r269134_panic.jpg

 Exactly this revision gives a panic and breaks the textdump/coredump
 facility.

 How can I help debugging?


It appears to me that moea64_pvo_enter() had a pre-existing bug that got
tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
the PVO_WIRED flag when an unwired mapping already exists.  It just
returns with the mapping still in an unwired state.  Consequently, when
pmap_unwire() finally runs, it doesn't find a wired mapping.

Try this:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) == pa 
(pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
/* Re-insert if spilled */
i = MOEA64_PTE_INSERT(mmu, ptegidx,



 Modified:
head/sys/vm/vm_extern.h
head/sys/vm/vm_fault.c
head/sys/vm/vm_map.c
head/sys/vm/vm_object.c
head/sys/vm/vm_object.h

 Modified: head/sys/vm/vm_extern.h
 ==

 --- head/sys/vm/vm_extern.hSat Jul 26 17:59:25 2014(r269133)
 +++ head/sys/vm/vm_extern.hSat Jul 26 18:10:18 2014(r269134)
 @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse
   int fault_flags, vm_page_t *m_hold);
   int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr,
 vm_size_t len,
   vm_prot_t prot, vm_page_t *ma, int max_count);
 -void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
   int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
   int vm_forkproc(struct thread *, struct proc *, struct thread *,
 struct vmspace *, int);
   void vm_waitproc(struct proc *);

 Modified: head/sys/vm/vm_fault.c
 ==

 --- head/sys/vm/vm_fault.cSat Jul 26 17:59:25 2014(r269133)
 +++ head/sys/vm/vm_fault.cSat Jul 26 18:10:18 2014(r269134)
 @@ -106,6 +106,7 @@ __FBSDID($FreeBSD$);
   #define PFFOR 4

   static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t
 *, int *);
 +static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t,
 boolean_t);

   #defineVM_FAULT_READ_BEHIND8
   #defineVM_FAULT_READ_MAX(1 + VM_FAULT_READ_AHEAD_MAX)
 @@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t
*
*Unwire a range of virtual addresses in a map.
*/
 -void
 +static void
   vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end,
   boolean_t fictitious)
   {

 Modified: head/sys/vm/vm_map.c
 ==

 --- head/sys/vm/vm_map.cSat Jul 26 17:59:25 2014(r269133)
 +++ head/sys/vm/vm_map.cSat Jul 26 18:10:18 2014

Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Alan Cox
On 07/30/2014 14:46, Alan Cox wrote:
 On 07/30/2014 13:58, Andreas Tobler wrote:
 Hi Alan,

 On 26.07.14 20:10, Alan Cox wrote:
 Author: alc
 Date: Sat Jul 26 18:10:18 2014
 New Revision: 269134
 URL: http://svnweb.freebsd.org/changeset/base/269134

 Log:
When unwiring a region of an address space, do not assume that the
underlying physical pages are mapped by the pmap.  If, for
 example, the
application has performed an mprotect(..., PROT_NONE) on any part
 of the
wired region, then those pages will no longer be mapped by the pmap.
So, using the pmap to lookup the wired pages in order to unwire them
doesn't always work, and when it doesn't work wired pages are leaked.

To avoid the leak, introduce and use a new function
 vm_object_unwire()
that locates the wired pages by traversing the object and its backing
objects.

At the same time, switch from using pmap_change_wiring() to the
 recently
introduced function pmap_unwire() for unwiring the region's mappings.
pmap_unwire() is faster, because it operates a range of virtual
 addresses
rather than a single virtual page at a time.  Moreover, by
 operating on
a range, it is superpage friendly.  It doesn't waste time performing
unnecessary demotions.

Reported by:markj
Reviewed by:kib
Tested by:pho, jmg (arm)
Sponsored by:EMC / Isilon Storage Division
 This commit brings my 32- and 64-bit PowerMac's into panic.
 Unfortunately I'm not able to give you a backtrace in the form of a
 textdump nor of a core dump.

 The only thing I have is this picture:

 http://people.freebsd.org/~andreast/r269134_panic.jpg

 Exactly this revision gives a panic and breaks the textdump/coredump
 facility.

 How can I help debugging?

 It appears to me that moea64_pvo_enter() had a pre-existing bug that got
 tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
 the PVO_WIRED flag when an unwired mapping already exists.  It just
 returns with the mapping still in an unwired state.  Consequently, when
 pmap_unwire() finally runs, it doesn't find a wired mapping.

 Try this:

 Index: powerpc/aim/mmu_oea64.c
 ===
 --- powerpc/aim/mmu_oea64.c (revision 269127)
 +++ powerpc/aim/mmu_oea64.c (working copy)
 @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
 if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
 if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) == pa 
 (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
 LPTE_PP))
 -   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
 +   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
 +   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
 if (!(pvo-pvo_pte.lpte.pte_hi 
 LPTE_VALID)) {
 /* Re-insert if spilled */
 i = MOEA64_PTE_INSERT(mmu, ptegidx,


The new conditional test needs to be inverted.  Try this instead:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) == pa 
(pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) == 0) {
if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
/* Re-insert if spilled */
i = MOEA64_PTE_INSERT(mmu, ptegidx,

 Modified:
head/sys/vm/vm_extern.h
head/sys/vm/vm_fault.c
head/sys/vm/vm_map.c
head/sys/vm/vm_object.c
head/sys/vm/vm_object.h

 Modified: head/sys/vm/vm_extern.h
 ==

 --- head/sys/vm/vm_extern.hSat Jul 26 17:59:25 2014(r269133)
 +++ head/sys/vm/vm_extern.hSat Jul 26 18:10:18 2014(r269134)
 @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse
   int fault_flags, vm_page_t *m_hold);
   int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr,
 vm_size_t len,
   vm_prot_t prot, vm_page_t *ma, int max_count);
 -void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
   int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
   int vm_forkproc(struct thread *, struct proc *, struct thread *,
 struct vmspace *, int);
   void vm_waitproc(struct proc *);

 Modified: head/sys/vm/vm_fault.c
 

Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Andreas Tobler

On 30.07.14 21:54, Alan Cox wrote:

On 07/30/2014 14:46, Alan Cox wrote:

On 07/30/2014 13:58, Andreas Tobler wrote:

Hi Alan,

On 26.07.14 20:10, Alan Cox wrote:

Author: alc
Date: Sat Jul 26 18:10:18 2014
New Revision: 269134
URL: http://svnweb.freebsd.org/changeset/base/269134

Log:
When unwiring a region of an address space, do not assume that the
underlying physical pages are mapped by the pmap.  If, for
example, the
application has performed an mprotect(..., PROT_NONE) on any part
of the
wired region, then those pages will no longer be mapped by the pmap.
So, using the pmap to lookup the wired pages in order to unwire them
doesn't always work, and when it doesn't work wired pages are leaked.

To avoid the leak, introduce and use a new function
vm_object_unwire()
that locates the wired pages by traversing the object and its backing
objects.

At the same time, switch from using pmap_change_wiring() to the
recently
introduced function pmap_unwire() for unwiring the region's mappings.
pmap_unwire() is faster, because it operates a range of virtual
addresses
rather than a single virtual page at a time.  Moreover, by
operating on
a range, it is superpage friendly.  It doesn't waste time performing
unnecessary demotions.

Reported by:markj
Reviewed by:kib
Tested by:pho, jmg (arm)
Sponsored by:EMC / Isilon Storage Division

This commit brings my 32- and 64-bit PowerMac's into panic.
Unfortunately I'm not able to give you a backtrace in the form of a
textdump nor of a core dump.

The only thing I have is this picture:

http://people.freebsd.org/~andreast/r269134_panic.jpg

Exactly this revision gives a panic and breaks the textdump/coredump
facility.

How can I help debugging?


It appears to me that moea64_pvo_enter() had a pre-existing bug that got
tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
the PVO_WIRED flag when an unwired mapping already exists.  It just
returns with the mapping still in an unwired state.  Consequently, when
pmap_unwire() finally runs, it doesn't find a wired mapping.

Try this:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
 if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
 if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) == pa 
 (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
 if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
 /* Re-insert if spilled */
 i = MOEA64_PTE_INSERT(mmu, ptegidx,



The new conditional test needs to be inverted.  Try this instead:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
 if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
 if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) == pa 
 (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) == 0) {
 if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
 /* Re-insert if spilled */
 i = MOEA64_PTE_INSERT(mmu, ptegidx,




The panic stays, but the message is different:

panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in 
moea64_pteg_table but valid in pvo.


Andreas

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


Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Alan Cox
On 07/30/2014 15:15, Andreas Tobler wrote:
 On 30.07.14 21:54, Alan Cox wrote:
 On 07/30/2014 14:46, Alan Cox wrote:
 On 07/30/2014 13:58, Andreas Tobler wrote:
 Hi Alan,

 On 26.07.14 20:10, Alan Cox wrote:
 Author: alc
 Date: Sat Jul 26 18:10:18 2014
 New Revision: 269134
 URL: http://svnweb.freebsd.org/changeset/base/269134

 Log:
 When unwiring a region of an address space, do not assume that
 the
 underlying physical pages are mapped by the pmap.  If, for
 example, the
 application has performed an mprotect(..., PROT_NONE) on any part
 of the
 wired region, then those pages will no longer be mapped by the
 pmap.
 So, using the pmap to lookup the wired pages in order to
 unwire them
 doesn't always work, and when it doesn't work wired pages are
 leaked.

 To avoid the leak, introduce and use a new function
 vm_object_unwire()
 that locates the wired pages by traversing the object and its
 backing
 objects.

 At the same time, switch from using pmap_change_wiring() to the
 recently
 introduced function pmap_unwire() for unwiring the region's
 mappings.
 pmap_unwire() is faster, because it operates a range of virtual
 addresses
 rather than a single virtual page at a time.  Moreover, by
 operating on
 a range, it is superpage friendly.  It doesn't waste time
 performing
 unnecessary demotions.

 Reported by:markj
 Reviewed by:kib
 Tested by:pho, jmg (arm)
 Sponsored by:EMC / Isilon Storage Division
 This commit brings my 32- and 64-bit PowerMac's into panic.
 Unfortunately I'm not able to give you a backtrace in the form of a
 textdump nor of a core dump.

 The only thing I have is this picture:

 http://people.freebsd.org/~andreast/r269134_panic.jpg

 Exactly this revision gives a panic and breaks the textdump/coredump
 facility.

 How can I help debugging?

 It appears to me that moea64_pvo_enter() had a pre-existing bug that
 got
 tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
 the PVO_WIRED flag when an unwired mapping already exists.  It just
 returns with the mapping still in an unwired state.  Consequently, when
 pmap_unwire() finally runs, it doesn't find a wired mapping.

 Try this:

 Index: powerpc/aim/mmu_oea64.c
 ===
 --- powerpc/aim/mmu_oea64.c (revision 269127)
 +++ powerpc/aim/mmu_oea64.c (working copy)
 @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
  if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
  if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
 == pa 
  (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
 LPTE_PP))
 -   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
 +   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
 +   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
  if (!(pvo-pvo_pte.lpte.pte_hi 
 LPTE_VALID)) {
  /* Re-insert if spilled */
  i = MOEA64_PTE_INSERT(mmu,
 ptegidx,


 The new conditional test needs to be inverted.  Try this instead:

 Index: powerpc/aim/mmu_oea64.c
 ===
 --- powerpc/aim/mmu_oea64.c (revision 269127)
 +++ powerpc/aim/mmu_oea64.c (working copy)
 @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
  if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
  if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
 == pa 
  (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
 LPTE_PP))
 -   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
 +   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
 +   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) ==
 0) {
  if (!(pvo-pvo_pte.lpte.pte_hi 
 LPTE_VALID)) {
  /* Re-insert if spilled */
  i = MOEA64_PTE_INSERT(mmu,
 ptegidx,



 The panic stays, but the message is different:

 panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in
 moea64_pteg_table but valid in pvo.


My attempted fix is doing something else wrong.  Do you have a stack trace?


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


Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Andreas Tobler

On 30.07.14 23:17, Alan Cox wrote:

On 07/30/2014 15:15, Andreas Tobler wrote:

On 30.07.14 21:54, Alan Cox wrote:

On 07/30/2014 14:46, Alan Cox wrote:

On 07/30/2014 13:58, Andreas Tobler wrote:

Hi Alan,

On 26.07.14 20:10, Alan Cox wrote:

Author: alc
Date: Sat Jul 26 18:10:18 2014
New Revision: 269134
URL: http://svnweb.freebsd.org/changeset/base/269134

Log:
 When unwiring a region of an address space, do not assume that
the
 underlying physical pages are mapped by the pmap.  If, for
example, the
 application has performed an mprotect(..., PROT_NONE) on any part
of the
 wired region, then those pages will no longer be mapped by the
pmap.
 So, using the pmap to lookup the wired pages in order to
unwire them
 doesn't always work, and when it doesn't work wired pages are
leaked.

 To avoid the leak, introduce and use a new function
vm_object_unwire()
 that locates the wired pages by traversing the object and its
backing
 objects.

 At the same time, switch from using pmap_change_wiring() to the
recently
 introduced function pmap_unwire() for unwiring the region's
mappings.
 pmap_unwire() is faster, because it operates a range of virtual
addresses
 rather than a single virtual page at a time.  Moreover, by
operating on
 a range, it is superpage friendly.  It doesn't waste time
performing
 unnecessary demotions.

 Reported by:markj
 Reviewed by:kib
 Tested by:pho, jmg (arm)
 Sponsored by:EMC / Isilon Storage Division

This commit brings my 32- and 64-bit PowerMac's into panic.
Unfortunately I'm not able to give you a backtrace in the form of a
textdump nor of a core dump.

The only thing I have is this picture:

http://people.freebsd.org/~andreast/r269134_panic.jpg

Exactly this revision gives a panic and breaks the textdump/coredump
facility.

How can I help debugging?


It appears to me that moea64_pvo_enter() had a pre-existing bug that
got
tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
the PVO_WIRED flag when an unwired mapping already exists.  It just
returns with the mapping still in an unwired state.  Consequently, when
pmap_unwire() finally runs, it doesn't find a wired mapping.

Try this:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
  if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
  if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
== pa 
  (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
  if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
  /* Re-insert if spilled */
  i = MOEA64_PTE_INSERT(mmu,
ptegidx,



The new conditional test needs to be inverted.  Try this instead:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
  if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
  if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
== pa 
  (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) ==
0) {
  if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
  /* Re-insert if spilled */
  i = MOEA64_PTE_INSERT(mmu,
ptegidx,




The panic stays, but the message is different:

panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in
moea64_pteg_table but valid in pvo.



My attempted fix is doing something else wrong.  Do you have a stack trace?


iPhone sei Dank:

http://people.freebsd.org/~andreast/r269134-1_panic.jpg

Thanks!
Andreas


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


svn commit: r269318 - head/contrib/subversion/subversion/svn

2014-07-30 Thread Glen Barber
Author: gjb
Date: Thu Jul 31 02:07:48 2014
New Revision: 269318
URL: http://svnweb.freebsd.org/changeset/base/269318

Log:
  Replace 'GNATS' with 'Bugzilla' in the base subversion commit template.
  
  Approved by:  peter
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/subversion/subversion/svn/util.c

Modified: head/contrib/subversion/subversion/svn/util.c
==
--- head/contrib/subversion/subversion/svn/util.c   Wed Jul 30 18:47:31 
2014(r269317)
+++ head/contrib/subversion/subversion/svn/util.c   Thu Jul 31 02:07:48 
2014(r269318)
@@ -419,7 +419,7 @@ svn_cl__get_log_message(const char **log
   svn_stringbuf_appendcstr(default_msg, EDITOR_EOF_PREFIX);
   svn_stringbuf_appendcstr(default_msg, APR_EOL_STR);
   svn_stringbuf_appendcstr(default_msg,  Description of fields to fill in 
above: 76 columns --| APR_EOL_STR);
-  svn_stringbuf_appendcstr(default_msg,  PR:If a GNATS PR is 
affected by the change. APR_EOL_STR);
+  svn_stringbuf_appendcstr(default_msg,  PR:If a Bugzilla PR is 
affected by the change. APR_EOL_STR);
   svn_stringbuf_appendcstr(default_msg,  Submitted by:  If someone else sent 
in the change. APR_EOL_STR);
   svn_stringbuf_appendcstr(default_msg,  Reviewed by:   If someone else 
reviewed your modification. APR_EOL_STR);
   svn_stringbuf_appendcstr(default_msg,  Approved by:   If you needed 
approval for this commit. APR_EOL_STR);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269319 - head/sys/dev/usb/net

2014-07-30 Thread Kevin Lo
Author: kevlo
Date: Thu Jul 31 03:34:25 2014
New Revision: 269319
URL: http://svnweb.freebsd.org/changeset/base/269319

Log:
  In copyright statement correct that the author is me, not Bill Paul.

Modified:
  head/sys/dev/usb/net/if_axgereg.h

Modified: head/sys/dev/usb/net/if_axgereg.h
==
--- head/sys/dev/usb/net/if_axgereg.h   Thu Jul 31 02:07:48 2014
(r269318)
+++ head/sys/dev/usb/net/if_axgereg.h   Thu Jul 31 03:34:25 2014
(r269319)
@@ -11,10 +11,10 @@
  *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 Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+ * 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 Bill Paul OR THE VOICES IN HIS HEAD
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD
  * 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
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269320 - head/usr.bin/gcore

2014-07-30 Thread Kevin Lo
Author: kevlo
Date: Thu Jul 31 03:36:03 2014
New Revision: 269320
URL: http://svnweb.freebsd.org/changeset/base/269320

Log:
  Remove an unsed variable.

Modified:
  head/usr.bin/gcore/elfcore.c

Modified: head/usr.bin/gcore/elfcore.c
==
--- head/usr.bin/gcore/elfcore.cThu Jul 31 03:34:25 2014
(r269319)
+++ head/usr.bin/gcore/elfcore.cThu Jul 31 03:36:03 2014
(r269320)
@@ -618,7 +618,7 @@ elf_note_thrmisc(void *arg, size_t *size
 static void *
 procstat_sysctl(void *arg, int what, size_t structsz, size_t *sizep)
 {
-   size_t len, oldlen;
+   size_t len;
pid_t pid;
int name[4], structsize;
void *buf, *p;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269321 - head/sys/arm/arm

2014-07-30 Thread Ian Lepore
Author: ian
Date: Thu Jul 31 03:59:00 2014
New Revision: 269321
URL: http://svnweb.freebsd.org/changeset/base/269321

Log:
  Switch to using counter(9) for the new 64-bit stats kept by armv6 busdma.

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cThu Jul 31 03:36:03 2014
(r269320)
+++ head/sys/arm/arm/busdma_machdep-v6.cThu Jul 31 03:59:00 2014
(r269321)
@@ -42,6 +42,7 @@ __FBSDID($FreeBSD$);
 #include sys/malloc.h
 #include sys/bus.h
 #include sys/busdma_bufalloc.h
+#include sys/counter.h
 #include sys/interrupt.h
 #include sys/kernel.h
 #include sys/ktr.h
@@ -141,38 +142,38 @@ static uint32_t tags_total;
 static uint32_t maps_total;
 static uint32_t maps_dmamem;
 static uint32_t maps_coherent;
-static uint64_t maploads_total;
-static uint64_t maploads_bounced;
-static uint64_t maploads_coherent;
-static uint64_t maploads_dmamem;
-static uint64_t maploads_mbuf;
-static uint64_t maploads_physmem;
+static counter_u64_t maploads_total;
+static counter_u64_t maploads_bounced;
+static counter_u64_t maploads_coherent;
+static counter_u64_t maploads_dmamem;
+static counter_u64_t maploads_mbuf;
+static counter_u64_t maploads_physmem;
 
 static STAILQ_HEAD(, bounce_zone) bounce_zone_list;
 
 SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, Busdma parameters);
 SYSCTL_UINT(_hw_busdma, OID_AUTO, tags_total, CTLFLAG_RD, tags_total, 0,
-  Number of active tags);
+   Number of active tags);
 SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_total, CTLFLAG_RD, maps_total, 0,
-  Number of active maps);
+   Number of active maps);
 SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_dmamem, CTLFLAG_RD, maps_dmamem, 0,
-  Number of active maps for bus_dmamem_alloc buffers);
+   Number of active maps for bus_dmamem_alloc buffers);
 SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_coherent, CTLFLAG_RD, maps_coherent, 0,
-  Number of active maps with BUS_DMA_COHERENT flag set);
-SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, 
maploads_total, 0,
-  Number of load operations performed);
-SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, 
maploads_bounced, 0,
-  Number of load operations that used bounce buffers);
-SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_coherent, CTLFLAG_RD, 
maploads_dmamem, 0,
-  Number of load operations on BUS_DMA_COHERENT memory);
-SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_dmamem, CTLFLAG_RD, 
maploads_dmamem, 0,
-  Number of load operations on bus_dmamem_alloc buffers);
-SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD, maploads_mbuf, 
0,
-  Number of load operations for mbufs);
-SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD, 
maploads_physmem, 0,
-  Number of load operations on physical buffers);
+   Number of active maps with BUS_DMA_COHERENT flag set);
+SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, 
+maploads_total, Number of load operations performed);
+SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD,
+maploads_bounced, Number of load operations that used bounce buffers);
+SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_coherent, CTLFLAG_RD,
+maploads_dmamem, Number of load operations on BUS_DMA_COHERENT memory);
+SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_dmamem, CTLFLAG_RD,
+maploads_dmamem, Number of load operations on bus_dmamem_alloc buffers);
+SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD,
+maploads_mbuf, Number of load operations for mbufs);
+SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD,
+maploads_physmem, Number of load operations on physical buffers);
 SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, total_bpages, 0,
-  Total bounce pages);
+   Total bounce pages);
 
 struct bus_dmamap {
struct bp_list bpages;
@@ -219,6 +220,13 @@ busdma_init(void *dummy)
 {
int uma_flags;
 
+   maploads_total= counter_u64_alloc(M_WAITOK);
+   maploads_bounced  = counter_u64_alloc(M_WAITOK);
+   maploads_coherent = counter_u64_alloc(M_WAITOK);
+   maploads_dmamem   = counter_u64_alloc(M_WAITOK);
+   maploads_mbuf = counter_u64_alloc(M_WAITOK);
+   maploads_physmem  = counter_u64_alloc(M_WAITOK);
+
uma_flags = 0;
 
/* Create a cache of buffers in standard (cacheable) memory. */
@@ -250,11 +258,11 @@ busdma_init(void *dummy)
 
 /*
  * This init historically used SI_SUB_VM, but now the init code requires
- * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by
- * SI_SUB_KMEM and SI_ORDER_THIRD, so we'll go right after that by using
- * SI_SUB_KMEM and SI_ORDER_FOURTH.
+ * malloc(9) using M_DEVBUF memory and the pcpu zones for counter(9), which get
+ * set up by 

Re: svn commit: r269134 - head/sys/vm

2014-07-30 Thread Alan Cox
On 07/30/2014 16:26, Andreas Tobler wrote:
 On 30.07.14 23:17, Alan Cox wrote:
 On 07/30/2014 15:15, Andreas Tobler wrote:
 On 30.07.14 21:54, Alan Cox wrote:
 On 07/30/2014 14:46, Alan Cox wrote:
 On 07/30/2014 13:58, Andreas Tobler wrote:
 Hi Alan,

 On 26.07.14 20:10, Alan Cox wrote:
 Author: alc
 Date: Sat Jul 26 18:10:18 2014
 New Revision: 269134
 URL: http://svnweb.freebsd.org/changeset/base/269134

 Log:
  When unwiring a region of an address space, do not assume that
 the
  underlying physical pages are mapped by the pmap.  If, for
 example, the
  application has performed an mprotect(..., PROT_NONE) on
 any part
 of the
  wired region, then those pages will no longer be mapped by the
 pmap.
  So, using the pmap to lookup the wired pages in order to
 unwire them
  doesn't always work, and when it doesn't work wired pages are
 leaked.

  To avoid the leak, introduce and use a new function
 vm_object_unwire()
  that locates the wired pages by traversing the object and its
 backing
  objects.

  At the same time, switch from using pmap_change_wiring() to
 the
 recently
  introduced function pmap_unwire() for unwiring the region's
 mappings.
  pmap_unwire() is faster, because it operates a range of
 virtual
 addresses
  rather than a single virtual page at a time.  Moreover, by
 operating on
  a range, it is superpage friendly.  It doesn't waste time
 performing
  unnecessary demotions.

  Reported by:markj
  Reviewed by:kib
  Tested by:pho, jmg (arm)
  Sponsored by:EMC / Isilon Storage Division
 This commit brings my 32- and 64-bit PowerMac's into panic.
 Unfortunately I'm not able to give you a backtrace in the form of a
 textdump nor of a core dump.

 The only thing I have is this picture:

 http://people.freebsd.org/~andreast/r269134_panic.jpg

 Exactly this revision gives a panic and breaks the textdump/coredump
 facility.

 How can I help debugging?

 It appears to me that moea64_pvo_enter() had a pre-existing bug that
 got
 tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
 the PVO_WIRED flag when an unwired mapping already exists.  It just
 returns with the mapping still in an unwired state.  Consequently,
 when
 pmap_unwire() finally runs, it doesn't find a wired mapping.

 Try this:

 Index: powerpc/aim/mmu_oea64.c
 ===
 --- powerpc/aim/mmu_oea64.c (revision 269127)
 +++ powerpc/aim/mmu_oea64.c (working copy)
 @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm,
 uma_zone_t
   if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
   if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
 == pa 
   (pvo-pvo_pte.lpte.pte_lo 
 (LPTE_NOEXEC |
 LPTE_PP))
 -   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
 +   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
 +   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
   if (!(pvo-pvo_pte.lpte.pte_hi 
 LPTE_VALID)) {
   /* Re-insert if spilled */
   i = MOEA64_PTE_INSERT(mmu,
 ptegidx,


 The new conditional test needs to be inverted.  Try this instead:

 Index: powerpc/aim/mmu_oea64.c
 ===
 --- powerpc/aim/mmu_oea64.c (revision 269127)
 +++ powerpc/aim/mmu_oea64.c (working copy)
 @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm,
 uma_zone_t
   if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
   if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
 == pa 
   (pvo-pvo_pte.lpte.pte_lo 
 (LPTE_NOEXEC |
 LPTE_PP))
 -   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
 +   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
 +   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) ==
 0) {
   if (!(pvo-pvo_pte.lpte.pte_hi 
 LPTE_VALID)) {
   /* Re-insert if spilled */
   i = MOEA64_PTE_INSERT(mmu,
 ptegidx,



 The panic stays, but the message is different:

 panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in
 moea64_pteg_table but valid in pvo.


 My attempted fix is doing something else wrong.  Do you have a stack
 trace?

 iPhone sei Dank:

 http://people.freebsd.org/~andreast/r269134-1_panic.jpg

Ok, this patch should fix both the original panic and the new one.  They
are two distinct problems.




Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -1090,6 +1090,7 @@ moea64_unwire(mmu_t mmu, pmap_t pm, vm_offset_t sv
  

svn commit: r269322 - head/sys/dev/usb/net

2014-07-30 Thread Kevin Lo
Author: kevlo
Date: Thu Jul 31 05:12:21 2014
New Revision: 269322
URL: http://svnweb.freebsd.org/changeset/base/269322

Log:
  Replace the whole license block with the standard one.
  
  Suggested by: emaste

Modified:
  head/sys/dev/usb/net/if_axgereg.h

Modified: head/sys/dev/usb/net/if_axgereg.h
==
--- head/sys/dev/usb/net/if_axgereg.h   Thu Jul 31 03:59:00 2014
(r269321)
+++ head/sys/dev/usb/net/if_axgereg.h   Thu Jul 31 05:12:21 2014
(r269322)
@@ -14,14 +14,14 @@
  * 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 THE VOICES IN HIS HEAD
- * 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.
+ * 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.
  *
  * $FreeBSD$
  */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269323 - head/usr.bin/m4

2014-07-30 Thread Baptiste Daroussin
Author: bapt
Date: Thu Jul 31 05:56:15 2014
New Revision: 269323
URL: http://svnweb.freebsd.org/changeset/base/269323

Log:
  lower warning level to fix build with gcc

Modified:
  head/usr.bin/m4/Makefile

Modified: head/usr.bin/m4/Makefile
==
--- head/usr.bin/m4/MakefileThu Jul 31 05:12:21 2014(r269322)
+++ head/usr.bin/m4/MakefileThu Jul 31 05:56:15 2014(r269323)
@@ -16,6 +16,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
 SRCS=  eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l
 .PATH: ${.CURDIR}/lib
 SRCS+= ohash.c
+WARNS= 3
 
 tokenizer.o: parser.h
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org