svn commit: r212616 - head/sys/dev/mps
Author: ken Date: Tue Sep 14 17:22:06 2010 New Revision: 212616 URL: http://svn.freebsd.org/changeset/base/212616 Log: MFp4: (//depot/projects/mps/...) Report data overruns properly. Submitted by: scottl Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Tue Sep 14 16:22:22 2010(r212615) +++ head/sys/dev/mps/mps_sas.c Tue Sep 14 17:22:06 2010(r212616) @@ -1219,11 +1219,9 @@ mpssas_scsiio_complete(struct mps_softc ccb->ccb_h.status = CAM_REQ_CMP; break; case MPI2_IOCSTATUS_SCSI_DATA_OVERRUN: - /* -* XXX any way to report this? -*/ + /* resid is ignored for this condition */ ccb->csio.resid = 0; - ccb->ccb_h.status = CAM_REQ_CMP; + ccb->ccb_h.status = CAM_DATA_RUN_ERR; break; case MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE: case MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE: ___ 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: r212624 - head/share/man/man4
Author: ken Date: Tue Sep 14 21:40:29 2010 New Revision: 212624 URL: http://svn.freebsd.org/changeset/base/212624 Log: MFp4 (//depot/projects/mps/...) Add a man page for the mps(4) driver, and reference it in the mpt(4) driver man page. Sponsored by: Spectra Logic Corporation Added: head/share/man/man4/mps.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/mpt.4 Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileTue Sep 14 20:55:25 2010 (r212623) +++ head/share/man/man4/MakefileTue Sep 14 21:40:29 2010 (r212624) @@ -219,6 +219,7 @@ MAN=aac.4 \ mmcsd.4 \ mn.4 \ mouse.4 \ + mps.4 \ mpt.4 \ msk.4 \ mtio.4 \ Added: head/share/man/man4/mps.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/mps.4 Tue Sep 14 21:40:29 2010(r212624) @@ -0,0 +1,159 @@ +.\" +.\" Copyright (c) 2010 Spectra Logic Corporation +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions, and the following disclaimer, +.\"without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\"substantially similar to the "NO WARRANTY" disclaimer below +.\"("Disclaimer") and any redistribution must be conditioned upon +.\"including a substantially similar Disclaimer requirement for further +.\"binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" mps driver man page. +.\" +.\" Author: Ken Merry +.\" +.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#1 $ +.\" $FreeBSD$ +.\" +.Dd September 13, 2010 +.Dt MPS 4 +.Os +.Sh NAME +.Nm mps +.Nd LSI Fusion-MPT 2 Serial Attached SCSI driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device scbus" +.Cd "device mps" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +mpt_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for LSI Logic Fusion-MPT 2 +.Tn SAS +controllers. +.Sh HARDWARE +The following controllers are supported by the +.Nm +driver +.Pp +.Bl -bullet -compact +.It +LSI Logic SAS2004 (4 Port +.Tn SAS ) +.It +LSI Logic SAS2008 (8 Port +.Tn SAS ) +.It +LSI Logic SAS2108 (8 Port +.Tn SAS ) +.It +LSI Logic SAS2116 (16 Port +.Tn SAS ) +.It +LSI Logic SAS2208 (8 Port +.Tn SAS ) +.El +.Sh CONFIGURATION +To disable MSI interrupts for all +.Nm +driver instances, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mps.disable_msi=1 +.Ed +.Pp +To disable MSI-X interrupts for all +.Nm +driver instances, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mps.disable_msix=1 +.Ed +.Sh DEBUGGING +To enable debugging prints from the +.Nm +driver, set the +.Bd -literal -offset indent +hw.mps.X.debug_level +.Ed +.Pp +variable, where X is the adapter number, either in +.Xr loader.conf 5 +or via +.Xr sysctl 8 . +The following bits have the described effects: +.Bl -tag -offset indent +.It 0x01 +Enable informational prints. +.It 0x02 +Enable tracing prints. +.It 0x04 +Enable prints for driver faults. +.It 0x08 +Enable prints for controller events. +.El +.Sh SEE ALSO +.Xr cd 4 , +.Xr ch 4 , +.Xr da 4 , +.Xr mpt 4 , +.Xr pci 4 , +.Xr sa 4 , +.Xr scsi 4 , +.Xr targ 4 +.Sh BUGS +This driver is still in development, it has only been tested on the amd64 +architecture and has some known shortcomings: +.Bl -bullet -compact +.It +No IR (Integrated RAID) support. +.It +No userland utility support (e.g. +.Xr mptutil 8). +.It +Sometimes the driver gets into a state where devices arrive and depart multiple +ti
svn commit: r212669 - head/share/man/man4
Author: ken Date: Wed Sep 15 16:05:51 2010 New Revision: 212669 URL: http://svn.freebsd.org/changeset/base/212669 Log: MFp4 (//depot/projects/mps/...) Fix a typo. Submitted by: pluknet at gmail dot com Modified: head/share/man/man4/mps.4 Modified: head/share/man/man4/mps.4 == --- head/share/man/man4/mps.4 Wed Sep 15 16:05:40 2010(r212668) +++ head/share/man/man4/mps.4 Wed Sep 15 16:05:51 2010(r212669) @@ -51,7 +51,7 @@ place the following lines in your kernel Or, to load the driver as a module at boot, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -mpt_load="YES" +mps_load="YES" .Ed .Sh DESCRIPTION The ___ 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: r212772 - head/sys/dev/mps
Author: ken Date: Thu Sep 16 22:54:56 2010 New Revision: 212772 URL: http://svn.freebsd.org/changeset/base/212772 Log: MFp4 (//depot/projects/mps/...): According to the MPT2 spec, task management commands are serialized, and so no I/O should start while task management commands are active. So, to comply with that, freeze the SIM queue before we send any task management commands (abort, target reset, etc.) down to the IOC. We unfreeze the queue once the task management command completes. It isn't clear from the spec whether multiple simultaneous task management commands are supported. Right now it is possible to have multiple outstanding task management commands, especially in the abort case. Multiple outstanding aborts do complete successfully, so it may be supported. We also don't yet have any recovery mechanism (e.g. reset the IOC) if the task management command fails. Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Thu Sep 16 22:38:27 2010(r212771) +++ head/sys/dev/mps/mps_sas.c Thu Sep 16 22:54:56 2010(r212772) @@ -438,6 +438,7 @@ mpssas_prepare_remove(struct mpssas_soft cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_complete = mpssas_remove_device; cm->cm_targ = targ; + xpt_freeze_simq(sc->sassc->sim, 1); mps_map_command(sc, cm); } @@ -453,6 +454,7 @@ mpssas_remove_device(struct mps_softc *s reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)cm->cm_reply; handle = cm->cm_targ->handle; + xpt_release_simq(sc->sassc->sim, 1); if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) { mps_printf(sc, "Failure 0x%x reseting device 0x%04x\n", reply->IOCStatus, handle); @@ -983,6 +985,11 @@ mpssas_abort_complete(struct mps_softc * mps_printf(sc, "%s: abort request on handle %#04x SMID %d " "complete\n", __func__, req->DevHandle, req->TaskMID); + /* +* Release the SIM queue, we froze it when we sent the abort. +*/ + xpt_release_simq(sc->sassc->sim, 1); + mps_free_command(sc, cm); } @@ -1013,10 +1020,19 @@ mpssas_recovery(struct mps_softc *sc, st cm->cm_data = NULL; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; + /* +* Freeze the SIM queue while we issue the abort. According to the +* Fusion-MPT 2.0 spec, task management requests are serialized, +* and so the host should not send any I/O requests while task +* management requests are pending. +*/ + xpt_freeze_simq(sc->sassc->sim, 1); + error = mps_map_command(sc, cm); if (error != 0) { mps_printf(sc, "%s: error mapping abort request!\n", __func__); + xpt_release_simq(sc->sassc->sim, 1); } #if 0 error = mpssas_reset(sc, targ, &resetcm); @@ -1361,7 +1377,13 @@ mpssas_resetdev(struct mpssas_softc *sas cm->cm_data = NULL; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; + xpt_freeze_simq(sassc->sim, 1); + error = mps_map_command(sassc->sc, cm); + + if (error != 0) + xpt_release_simq(sassc->sim, 1); + return (error); } @@ -1385,6 +1407,9 @@ mpssas_resetdev_complete(struct mps_soft ccb->ccb_h.status = CAM_REQ_CMP_ERR; mps_free_command(sc, cm); + + xpt_release_simq(sc->sassc->sim, 1); + xpt_done(ccb); } ___ 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: r212802 - head/sys/dev/mps
Author: ken Date: Fri Sep 17 21:53:56 2010 New Revision: 212802 URL: http://svn.freebsd.org/changeset/base/212802 Log: Fix a couple of mps problems. When the driver is completely saturated with commands (1024 in the case of the SAS2008 in my test system), I/O stops. If we tell CAM that we have one less command slot than we have actually allocated, everything works fine. We also need a few extra command slots to allow for aborts and other task management commands to be sent down. This needs more investigation to determine the root cause, but for now this fixes things in my testing. mps.c:Change a printf() to mps_printf(). mps_sas.c:Subtract 5 command slots when we tell CAM how many commands we can handle. Add some commented-out logic to print the contents the CDBs for timed-out commands. This can help in debugging devices that are timing out. This will be uncommented once I bring some CAM changes in. Reported by: Andrew Boyer Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps.c == --- head/sys/dev/mps/mps.c Fri Sep 17 19:20:39 2010(r212801) +++ head/sys/dev/mps/mps.c Fri Sep 17 21:53:56 2010(r212802) @@ -1416,7 +1416,7 @@ mps_data_cb(void *arg, bus_dma_segment_t chain = mps_alloc_chain(sc); if (chain == NULL) { /* Resource shortage, roll back! */ - printf("out of chain frames\n"); + mps_printf(sc, "out of chain frames\n"); return; } Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Fri Sep 17 19:20:39 2010(r212801) +++ head/sys/dev/mps/mps_sas.c Fri Sep 17 21:53:56 2010(r212802) @@ -596,6 +596,7 @@ mps_attach_sas(struct mps_softc *sc) { struct mpssas_softc *sassc; int error = 0; + int num_sim_reqs; mps_dprint(sc, MPS_TRACE, "%s\n", __func__); @@ -605,15 +606,30 @@ mps_attach_sas(struct mps_softc *sc) sc->sassc = sassc; sassc->sc = sc; - if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) { + /* +* Tell CAM that we can handle 5 fewer requests than we have +* allocated. If we allow the full number of requests, all I/O +* will halt when we run out of resources. Things work fine with +* just 1 less request slot given to CAM than we have allocated. +* We also need a couple of extra commands so that we can send down +* abort, reset, etc. requests when commands time out. Otherwise +* we could wind up in a situation with sc->num_reqs requests down +* on the card and no way to send an abort. +* +* XXX KDM need to figure out why I/O locks up if all commands are +* used. +*/ + num_sim_reqs = sc->num_reqs - 5; + + if ((sassc->devq = cam_simq_alloc(num_sim_reqs)) == NULL) { mps_dprint(sc, MPS_FAULT, "Cannot allocate SIMQ\n"); error = ENOMEM; goto out; } sassc->sim = cam_sim_alloc(mpssas_action, mpssas_poll, "mps", sassc, - device_get_unit(sc->mps_dev), &sc->mps_mtx, sc->num_reqs, sc->num_reqs, - sassc->devq); + device_get_unit(sc->mps_dev), &sc->mps_mtx, num_sim_reqs, + num_sim_reqs, sassc->devq); if (sassc->sim == NULL) { mps_dprint(sc, MPS_FAULT, "Cannot allocate SIM\n"); error = EINVAL; @@ -930,6 +946,9 @@ mpssas_scsiio_timeout(void *data) struct mps_softc *sc; struct mps_command *cm; struct mpssas_target *targ; +#if 0 + char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; +#endif cm = (struct mps_command *)data; sc = cm->cm_sc; @@ -954,6 +973,22 @@ mpssas_scsiio_timeout(void *data) xpt_print(ccb->ccb_h.path, "SCSI command timeout on device handle " "0x%04x SMID %d\n", targ->handle, cm->cm_desc.Default.SMID); + /* +* XXX KDM this is useful for debugging purposes, but the existing +* scsi_op_desc() implementation can't handle a NULL value for +* inq_data. So this will remain commented out until I bring in +* those changes as well. +*/ +#if 0 + xpt_print(ccb->ccb_h.path, "Timed out command: %s. CDB %s\n", + scsi_op_desc((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->csio.cdb_io.cdb_ptr[0] : + ccb->csio.cdb_io.cdb_bytes[0], NULL), + scsi_cdb_string((ccb->ccb_h.flags & CAM_CDB_POINTER) ? +
svn commit: r213535 - in head: share/man/man4 sys/dev/mps
Author: ken Date: Thu Oct 7 21:56:10 2010 New Revision: 213535 URL: http://svn.freebsd.org/changeset/base/213535 Log: Turn on serialization of task management commands going down to the controller, but make it optional. After a problem report from Andrew Boyer, it looks like the LSI chip may have issues (the watchdog timer fired) if too many aborts are sent down to the chip at the same time. We know that task management commands are serialized, and although the manual doesn't say it, it may be a good idea to just send one at a time. But, since I'm not certain that this is necessary, add a tunable and sysctl variable (hw.mps.%d.allow_multiple_tm_cmds) to control the driver's behavior. mps.c:Add support for the sysctl and tunable, and add a comment about the possible return values to mps_map_command(). mps_sas.c:Run all task management commands through two new routines, mpssas_issue_tm_request() and mpssas_complete_tm_request(). This allows us to optionally serialize task management commands. Also, change things so that the response to a task management command always comes back through the callback. (Before it could come via the callback or the return value.) mpsvar.h: Add softc variables for the list of active task management commands, the number of active commands, and whether we should allow multiple active task management commands. Add an active command flag. mps.4:Describe the new sysctl/loader tunable variable. Sponsored by: Spectra Logic Corporation Modified: head/share/man/man4/mps.4 head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mpsvar.h Modified: head/share/man/man4/mps.4 == --- head/share/man/man4/mps.4 Thu Oct 7 20:31:07 2010(r213534) +++ head/share/man/man4/mps.4 Thu Oct 7 21:56:10 2010(r213535) @@ -31,7 +31,7 @@ .\" .\" Author: Ken Merry .\" -.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#1 $ +.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#4 $ .\" $FreeBSD$ .\" .Dd September 13, 2010 @@ -97,6 +97,20 @@ driver instances, set the following tuna .Bd -literal -offset indent hw.mps.disable_msix=1 .Ed +.Pp +To allow the driver to send multiple task management commands (like abort, +LUN reset, etc.), set the following variable: +.Bd -literal -offset indent +hw.mps.X.allow_multiple_tm_cmds=1 +.Ed +.Pp +via +.Xr loader.conf 5 +or +.Xr sysctl 8 , +where X is the adapter number. +By default the driver only sends one task management command at a time, to +avoid causing a potential controller lock-up. .Sh DEBUGGING To enable debugging prints from the .Nm Modified: head/sys/dev/mps/mps.c == --- head/sys/dev/mps/mps.c Thu Oct 7 20:31:07 2010(r213534) +++ head/sys/dev/mps/mps.c Thu Oct 7 21:56:10 2010(r213535) @@ -805,6 +805,9 @@ mps_attach(struct mps_softc *sc) snprintf(tmpstr, sizeof(tmpstr), "hw.mps.%d.debug_level", device_get_unit(sc->mps_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->mps_debug); + snprintf(tmpstr, sizeof(tmpstr), "hw.mps.%d.allow_multiple_tm_cmds", + device_get_unit(sc->mps_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->allow_multiple_tm_cmds); mps_dprint(sc, MPS_TRACE, "%s\n", __func__); @@ -831,6 +834,11 @@ mps_attach(struct mps_softc *sc) OID_AUTO, "debug_level", CTLFLAG_RW, &sc->mps_debug, 0, "mps debug level"); + SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), + OID_AUTO, "allow_multiple_tm_cmds", CTLFLAG_RW, + &sc->allow_multiple_tm_cmds, 0, + "allow multiple simultaneous task management cmds"); + if ((error = mps_transition_ready(sc)) != 0) return (error); @@ -873,6 +881,7 @@ mps_attach(struct mps_softc *sc) sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; TAILQ_INIT(&sc->req_list); TAILQ_INIT(&sc->chain_list); + TAILQ_INIT(&sc->tm_list); if (((error = mps_alloc_queues(sc)) != 0) || ((error = mps_alloc_replies(sc)) != 0) || @@ -1470,6 +1479,10 @@ mps_data_cb(void *arg, bus_dma_segment_t return; } +/* + * Note that the only error path here is from bus_dmamap_load(), which can + * return EINPROGRESS if it is waiting for resources. + */ int mps_map_command(struct mps_softc *sc, struct mps_command *cm) { Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Thu Oct 7 20:31:07 2010(r213534) +++ head/sys/dev/mps/mps_sas.c T
svn commit: r216088 - in head: lib/libcam sbin/camcontrol sys/cam sys/cam/scsi sys/conf sys/dev/mps sys/sys
Author: ken Date: Tue Nov 30 22:39:46 2010 New Revision: 216088 URL: http://svn.freebsd.org/changeset/base/216088 Log: Add Serial Management Protocol (SMP) passthrough support to CAM. This includes support in the kernel, camcontrol(8), libcam and the mps(4) driver for SMP passthrough. The CAM SCSI probe code has been modified to fetch Inquiry VPD page 0x00 to determine supported pages, and will now fetch page 0x83 in addition to page 0x80 if supported. Add two new CAM CCBs, XPT_SMP_IO, and XPT_GDEV_ADVINFO. The SMP CCB is intended for SMP requests and responses. The ADVINFO is currently used to fetch cached VPD page 0x83 data from the transport layer, but is intended to be extensible to fetch other types of device-specific data. SMP-only devices are not currently represented in the CAM topology, and so the current semantics are that the SIM will route SMP CCBs to either the addressed device, if it contains an SMP target, or its parent, if it contains an SMP target. (This is noted in cam_ccb.h, since it will change later once we have the ability to have SMP-only devices in CAM's topology.) smp_all.c, smp_all.h:New helper routines for SMP. This includes SMP request building routines, response parsing routines, error decoding routines, and structure definitions for a number of SMP commands. libcam/Makefile: Add smp_all.c to libcam, so that SMP functionality is available to userland applications. camcontrol.8, camcontrol.c: Add smp passthrough support to camcontrol. Several new subcommands are now available: 'smpcmd' functions much like 'cmd', except that it allows the user to send generic SMP commands. 'smprg' sends the SMP report general command, and displays the decoded output. It will automatically fetch extended output if it is available. 'smppc' sends the SMP phy control command, with any number of potential options. Among other things, this allows the user to reset a phy on a SAS expander, or disable a phy on an expander. 'smpmaninfo' sends the SMP report manufacturer information and displays the decoded output. 'smpphylist' displays a list of phys on an expander, and the CAM devices attached to those phys, if any. cam.h, cam.c:Add a status value for SMP errors (CAM_SMP_STATUS_ERROR). Add a missing description for CAM_SCSI_IT_NEXUS_LOST. Add support for SMP commands to cam_error_string(). cam_ccb.h:Rename the CAM_DIR_RESV flag to CAM_DIR_BOTH. SMP commands are by nature bi-directional, and we may need to support bi-directional SCSI commands later. Add the XPT_SMP_IO CCB. Since SMP commands are bi-directional, there are pointers for both the request and response. Add a fill routine for SMP CCBs. Add the XPT_GDEV_ADVINFO CCB. This is currently used to fetch cached page 0x83 data from the transport later, but is extensible to fetch many other types of data. cam_periph.c: Add support in cam_periph_mapmem() for XPT_SMP_IO and XPT_GDEV_ADVINFO CCBs. cam_xpt.c:Add support for executing XPT_SMP_IO CCBs. cam_xpt_internal.h: Add fields for VPD pages 0x00 and 0x83 in struct cam_ed. scsi_all.c: Add scsi_get_sas_addr(), a function that parses VPD page 0x83 data and pulls out a SAS address. scsi_all.h: Add VPD page 0x00 and 0x83 structures, and a prototype for scsi_get_sas_addr(). scsi_pass.c: Add support for mapping buffers in XPT_SMP_IO and XPT_GDEV_ADVINFO CCBs. scsi_xpt.c: In the SCSI probe code, first ask the device for VPD page 0x00. If any VPD pages are supported, that page is required to be implemented. Based on the response, we may probe for the serial number (page 0x80) or device id (page 0x83). Add support for the XPT_GDEV_ADVINFO CCB. sys/conf/files: Add smp_all.c. mps.c:Add support for passing in a
svn commit: r216093 - head/sys/modules/cam
Author: ken Date: Wed Dec 1 05:39:02 2010 New Revision: 216093 URL: http://svn.freebsd.org/changeset/base/216093 Log: Add smp_all.c to the cam module build to un-break it. Reported by: jkim Modified: head/sys/modules/cam/Makefile Modified: head/sys/modules/cam/Makefile == --- head/sys/modules/cam/Makefile Wed Dec 1 05:24:29 2010 (r216092) +++ head/sys/modules/cam/Makefile Wed Dec 1 05:39:02 2010 (r216093) @@ -25,6 +25,7 @@ SRCS+=scsi_ses.c SRCS+= scsi_sg.c SRCS+= scsi_targ_bh.c scsi_target.c SRCS+= scsi_xpt.c +SRCS+= smp_all.c SRCS+= ata_all.c SRCS+= ata_xpt.c SRCS+= ata_da.c ___ 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: r216361 - in head: sbin/camcontrol sys/cam sys/cam/scsi
Author: ken Date: Fri Dec 10 21:38:51 2010 New Revision: 216361 URL: http://svn.freebsd.org/changeset/base/216361 Log: Fix a few issues related to the XPT_GDEV_ADVINFO CCB. camcontrol.c: In buildbusdevlist(), don't attempt to get call getdevid() for an unconfigured device, even when the verbose flag is set. The cam_open_btl() call will almost certainly fail. Probe for the buffer size when issuing the XPT_GDEV_ADVINFO CCB. Probing for the buffer size first helps us avoid allocating the maximum buffer size when it really may not be necessary. This also helps avoid errors from cam_periph_mapmem() if we attempt to map more than MAXPHYS. cam_periph.c: In cam_periph_mapmem(), if the XPT_GDEV_ADVINFO CCB shows a bufsiz of 0, we don't have anything to map, so just return. Also, set the maximum mapping size to MAXPHYS instead of DFLTPHYS for XPT_GDEV_ADVINFO CCBs, since they don't actually go down to the hardware. scsi_pass.c: Don't bother mapping the buffer in XPT_GDEV_ADVINFO CCBs if bufsiz is 0. Modified: head/sbin/camcontrol/camcontrol.c head/sys/cam/cam_periph.c head/sys/cam/scsi/scsi_pass.c Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Fri Dec 10 20:27:50 2010 (r216360) +++ head/sbin/camcontrol/camcontrol.c Fri Dec 10 21:38:51 2010 (r216361) @@ -5026,14 +5026,7 @@ getdevid(struct cam_devitem *item) goto bailout; } - item->device_id_len = CAM_SCSI_DEVID_MAXLEN; - item->device_id = malloc(item->device_id_len); - if (item->device_id == NULL) { - warn("%s: unable to allocate %d bytes", __func__, -item->device_id_len); - retval = 1; - goto bailout; - } + item->device_id_len = 0; ccb = cam_getccb(dev); if (ccb == NULL) { @@ -5044,12 +5037,19 @@ getdevid(struct cam_devitem *item) bzero(&(&ccb->ccb_h)[1], sizeof(union ccb) - sizeof(struct ccb_hdr)); + + /* +* On the first try, we just probe for the size of the data, and +* then allocate that much memory and try again. +*/ +retry: ccb->ccb_h.func_code = XPT_GDEV_ADVINFO; ccb->ccb_h.flags = CAM_DIR_IN; ccb->cgdai.flags = CGDAI_FLAG_PROTO; ccb->cgdai.buftype = CGDAI_TYPE_SCSI_DEVID; ccb->cgdai.bufsiz = item->device_id_len; - ccb->cgdai.buf = (uint8_t *)item->device_id; + if (item->device_id_len != 0) + ccb->cgdai.buf = (uint8_t *)item->device_id; if (cam_send_ccb(dev, ccb) < 0) { warn("%s: error sending XPT_GDEV_ADVINFO CCB", __func__); @@ -5063,6 +5063,29 @@ getdevid(struct cam_devitem *item) goto bailout; } + if (item->device_id_len == 0) { + /* +* This is our first time through. Allocate the buffer, +* and then go back to get the data. +*/ + if (ccb->cgdai.provsiz == 0) { + warnx("%s: invalid .provsiz field returned with " +"XPT_GDEV_ADVINFO CCB", __func__); + retval = 1; + goto bailout; + } + item->device_id_len = ccb->cgdai.provsiz; + item->device_id = malloc(item->device_id_len); + if (item->device_id == NULL) { + warn("%s: unable to allocate %d bytes", __func__, +item->device_id_len); + retval = 1; + goto bailout; + } + ccb->ccb_h.status = CAM_REQ_INPROG; + goto retry; + } + bailout: if (dev != NULL) cam_close_device(dev); @@ -5158,9 +5181,8 @@ buildbusdevlist(struct cam_devlist *devl dev_result = &ccb.cdm.matches[i].result.device_result; - if ((dev_result->flags -& DEV_RESULT_UNCONFIGURED) -&& ((arglist & CAM_ARG_VERBOSE) == 0)) { + if (dev_result->flags & + DEV_RESULT_UNCONFIGURED) { skip_device = 1; break; } else Modified: head/sys/cam/cam_periph.c == --- head/sys/cam/cam_periph.c Fri Dec 10 20:27:50 2010(r216360) +++ head/sys/cam/cam_periph.c Fri Dec
svn commit: r216363 - head/sys/dev/mps
Author: ken Date: Fri Dec 10 21:45:10 2010 New Revision: 216363 URL: http://svn.freebsd.org/changeset/base/216363 Log: Fix an event handling bug with the mps(4) driver. This bug manifested itself after repeated device arrivals and departures. The root of the problem was that the last entry in the reply array wasn't initialized/allocated. So every time we got around to that event, we had a bogus address. There were a couple more problems with the code that are also fixed: - The reply mechanism was being treated as sequential (indexed by sc->replycurindex) even though the spec says that the driver should use the ReplyFrameAddress field of the post queue descriptor to figure out where the reply is. There is no guarantee that the reply descriptors will be used in sequential order. - The second word of the reply post queue descriptor wasn't being checked in mps_intr_locked() to make sure that it wasn't 0x. So the driver could potentially come across a partially DMAed descriptor. - The number of replies allocated was one less than the actual size of the queue. Instead, it was the size of the number of replies that can be used at one time. (Which is one less than the size of the queue.) mps.c:When initializing the entries in the reply free queue, make sure we initialize the full number that we tell the chip we have (sc->fqdepth), not the number that can be used at any one time (sc->num_replies). When allocating replies, make sure we allocate the number of replies that we've told the chip exist, not just the number that can be used simultaneously. Use the ReplyFrameAddress field of the post queue descriptor to figure out which reply is being referenced. This is what the spec says to do, and the spec doesn't guarantee that the replies will be used in order. Put a check in to verify that the reply address passed back from the card is valid. (Panic if it isn't, we'll panic when we try to deference the reply pointer in any case.) In mps_intr_locked(), verify that the second word of the post queue descriptor is not 0x in addition to verifying that the unused flag is not set, so we can make sure we didn't get a partially DMAed descriptor. Remove references to sc->replycurindex, it isn't needed now. mpsvar.h: Remove replycurindex from the softc, it isn't needed now. Reviewed by: scottl Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mps/mps.c == --- head/sys/dev/mps/mps.c Fri Dec 10 21:43:20 2010(r216362) +++ head/sys/dev/mps/mps.c Fri Dec 10 21:45:10 2010(r216363) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -607,9 +608,16 @@ mps_alloc_queues(struct mps_softc *sc) static int mps_alloc_replies(struct mps_softc *sc) { - int rsize; + int rsize, num_replies; - rsize = sc->facts->ReplyFrameSize * sc->num_replies * 4; + /* +* sc->num_replies should be one less than sc->fqdepth. We need to +* allocate space for sc->fqdepth replies, but only sc->num_replies +* replies can be used at once. +*/ + num_replies = max(sc->fqdepth, sc->num_replies); + + rsize = sc->facts->ReplyFrameSize * num_replies * 4; if (bus_dma_tag_create( sc->mps_parent_dmat,/* parent */ 4, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ @@ -782,11 +790,19 @@ mps_init_queues(struct mps_softc *sc) memset((uint8_t *)sc->post_queue, 0xff, sc->pqdepth * 8); + /* +* According to the spec, we need to use one less reply than we +* have space for on the queue. So sc->num_replies (the number we +* use) should be less than sc->fqdepth (allocated size). +*/ if (sc->num_replies >= sc->fqdepth) return (EINVAL); - for (i = 0; i < sc->num_replies; i++) - sc->free_queue[i] = sc->reply_busaddr + i * sc->facts->ReplyFrameSize * 4; + /* +* Initialize all of the free queue entries. +*/ + for (i = 0; i < sc->fqdepth; i++) + sc->free_queue[i] = sc->reply_busaddr + (i * sc->facts->ReplyFrameSize * 4); sc->replyfreeindex = sc->num_replies; return (0); @@ -907,7 +923,6 @@ mps_attach(struct mps_softc *sc) * replies. */ sc-
svn commit: r216368 - head/sys/dev/mps
Author: ken Date: Sat Dec 11 00:36:35 2010 New Revision: 216368 URL: http://svn.freebsd.org/changeset/base/216368 Log: Fix setting LUN numbers in the mps(4) driver. Prior to this change, the addressing method wasn't getting set, and so the LUN field could be set incorrectly in some instances. This fix should allow for LUN numbers up to 16777215 (and return an error for anything larger, which wouldn't fit into the flat addressing model). Submitted by: scottl (in part) Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Fri Dec 10 23:57:55 2010(r216367) +++ head/sys/dev/mps/mps_sas.c Sat Dec 11 00:36:35 2010(r216368) @@ -121,6 +121,7 @@ struct mpssas_devprobe { MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); +static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc *, struct mpssas_target *); static struct mpssas_target * mpssas_find_target(struct mpssas_softc *, int, @@ -163,6 +164,43 @@ static void mpssas_resetdev_complete(str static void mpssas_freeze_device(struct mpssas_softc *, struct mpssas_target *); static void mpssas_unfreeze_device(struct mpssas_softc *, struct mpssas_target *) __unused; +/* + * Abstracted so that the driver can be backwards and forwards compatible + * with future versions of CAM that will provide this functionality. + */ +#define MPS_SET_LUN(lun, ccblun) \ + mpssas_set_lun(lun, ccblun) + +static __inline int +mpssas_set_lun(uint8_t *lun, u_int ccblun) +{ + uint64_t *newlun; + + newlun = (uint64_t *)lun; + *newlun = 0; + if (ccblun <= 0xff) { + /* Peripheral device address method, LUN is 0 to 255 */ + lun[1] = ccblun; + } else if (ccblun <= 0x3fff) { + /* Flat space address method, LUN is <= 16383 */ + scsi_ulto2b(ccblun, lun); + lun[0] |= 0x40; + } else if (ccblun <= 0xff) { + /* Extended flat space address method, LUN is <= 16777215 */ + scsi_ulto3b(ccblun, &lun[1]); + /* Extended Flat space address method */ + lun[0] = 0xc0; + /* Length = 1, i.e. LUN is 3 bytes long */ + lun[0] |= 0x10; + /* Extended Address Method */ + lun[0] |= 0x02; + } else { + return (EINVAL); + } + + return (0); +} + static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc *sassc, struct mpssas_target *probe) { @@ -1366,14 +1404,12 @@ mpssas_action_scsiio(struct mpssas_softc break; } - /* XXX Need to handle multi-level LUNs */ - if (csio->ccb_h.target_lun > 255) { + if (MPS_SET_LUN(req->LUN, csio->ccb_h.target_lun) != 0) { mps_free_command(sc, cm); ccb->ccb_h.status = CAM_LUN_INVALID; xpt_done(ccb); return; } - req->LUN[1] = csio->ccb_h.target_lun; if (csio->ccb_h.flags & CAM_CDB_POINTER) bcopy(csio->cdb_io.cdb_ptr, &req->CDB.CDB32[0], csio->cdb_len); ___ 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: r197208 - head/sys/cam
Author: ken Date: Tue Sep 15 00:15:24 2009 New Revision: 197208 URL: http://svn.freebsd.org/changeset/base/197208 Log: Fix some instances where CAM rescans get hung up or take a long time to complete. Also, allow xpt_rescan() to rescan a LUN instead of a full bus. MFC after:3 days Sponsored by: Copan Systems, Inc. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c == --- head/sys/cam/cam_xpt.c Mon Sep 14 23:46:40 2009(r197207) +++ head/sys/cam/cam_xpt.c Tue Sep 15 00:15:24 2009(r197208) @@ -794,8 +794,9 @@ xpt_scanner_thread(void *dummy) * processed. */ xpt_lock_buses(); - msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO, - "ccb_scanq", 0); + if (TAILQ_EMPTY(&xsoftc.ccb_scanq)) + msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO, + "ccb_scanq", 0); TAILQ_INIT(&queue); TAILQ_CONCAT(&queue, &xsoftc.ccb_scanq, sim_links.tqe); xpt_unlock_buses(); @@ -806,9 +807,12 @@ xpt_scanner_thread(void *dummy) sim = ccb->ccb_h.path->bus->sim; CAM_SIM_LOCK(sim); - ccb->ccb_h.func_code = XPT_SCAN_BUS; + if( ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD ) + ccb->ccb_h.func_code = XPT_SCAN_BUS; + else + ccb->ccb_h.func_code = XPT_SCAN_LUN; ccb->ccb_h.cbfcnp = xptdone; - xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 5); + xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 1); cam_periph_runccb(ccb, NULL, 0, 0, NULL); xpt_free_path(ccb->ccb_h.path); xpt_free_ccb(ccb); @@ -828,6 +832,7 @@ xpt_rescan(union ccb *ccb) xpt_lock_buses(); TAILQ_FOREACH(hdr, &xsoftc.ccb_scanq, sim_links.tqe) { if (xpt_path_comp(hdr->path, ccb->ccb_h.path) == 0) { + wakeup(&xsoftc.ccb_scanq); xpt_unlock_buses(); xpt_print(ccb->ccb_h.path, "rescan already queued\n"); xpt_free_path(ccb->ccb_h.path); ___ 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: r197318 - in stable/8/sys: . amd64/include/xen cam cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci
Author: ken Date: Fri Sep 18 20:35:05 2009 New Revision: 197318 URL: http://svn.freebsd.org/changeset/base/197318 Log: Merge change r197208 from head to stable/8: Fix some instances where CAM rescans get hung up or take a long time to complete. Also, allow xpt_rescan() to rescan a LUN instead of a full bus. Sponsored by: Copan Systems, Inc. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/cam_xpt.c stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ciss/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/cam_xpt.c == --- stable/8/sys/cam/cam_xpt.c Fri Sep 18 17:09:33 2009(r197317) +++ stable/8/sys/cam/cam_xpt.c Fri Sep 18 20:35:05 2009(r197318) @@ -794,8 +794,9 @@ xpt_scanner_thread(void *dummy) * processed. */ xpt_lock_buses(); - msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO, - "ccb_scanq", 0); + if (TAILQ_EMPTY(&xsoftc.ccb_scanq)) + msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO, + "ccb_scanq", 0); TAILQ_INIT(&queue); TAILQ_CONCAT(&queue, &xsoftc.ccb_scanq, sim_links.tqe); xpt_unlock_buses(); @@ -806,9 +807,12 @@ xpt_scanner_thread(void *dummy) sim = ccb->ccb_h.path->bus->sim; CAM_SIM_LOCK(sim); - ccb->ccb_h.func_code = XPT_SCAN_BUS; + if( ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD ) + ccb->ccb_h.func_code = XPT_SCAN_BUS; + else + ccb->ccb_h.func_code = XPT_SCAN_LUN; ccb->ccb_h.cbfcnp = xptdone; - xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 5); + xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 1); cam_periph_runccb(ccb, NULL, 0, 0, NULL); xpt_free_path(ccb->ccb_h.path); xpt_free_ccb(ccb); @@ -828,6 +832,7 @@ xpt_rescan(union ccb *ccb) xpt_lock_buses(); TAILQ_FOREACH(hdr, &xsoftc.ccb_scanq, sim_links.tqe) { if (xpt_path_comp(hdr->path, ccb->ccb_h.path) == 0) { + wakeup(&xsoftc.ccb_scanq); xpt_unlock_buses(); xpt_print(ccb->ccb_h.path, "rescan already queued\n"); xpt_free_path(ccb->ccb_h.path); ___ 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: r224973 - head/sys/dev/mps
Author: ken Date: Thu Aug 18 16:07:41 2011 New Revision: 224973 URL: http://svn.freebsd.org/changeset/base/224973 Log: Set the max_lun field in the path inquiry CCB for the mps(4) driver to 8. This allows LUNs greater than 0 to be probed. The value can be increased later if need be. Approved by: re (kib) Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Thu Aug 18 16:00:32 2011(r224972) +++ head/sys/dev/mps/mps_sas.c Thu Aug 18 16:07:41 2011(r224973) @@ -925,7 +925,7 @@ mpssas_action(struct cam_sim *sim, union cpi->hba_misc = PIM_NOBUSRESET; cpi->hba_eng_cnt = 0; cpi->max_target = sassc->sc->facts->MaxTargets - 1; - cpi->max_lun = 0; + cpi->max_lun = 8; cpi->initiator_id = 255; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "LSILogic", HBA_IDLEN); ___ 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: r225950 - in head: sbin/camcontrol share/examples/scsi_target share/misc sys/cam sys/cam/scsi sys/dev/ciss sys/dev/firewire sys/dev/iir sys/dev/iscsi/initiator sys/dev/isp sys/dev/mly s...
Author: ken Date: Mon Oct 3 20:32:55 2011 New Revision: 225950 URL: http://svn.freebsd.org/changeset/base/225950 Log: Add descriptor sense support to CAM, and honor sense residuals properly in CAM. Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes. This change adds a number of new functions to scsi_all.c (and therefore libcam) that abstract out most access to sense data. This includes a bump of CAM_VERSION, because the CCB ABI has changed. Userland programs that use the CAM pass(4) driver will need to be recompiled. camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly. scsi_modes: Update the control mode page to the latest version (SPC-4). scsi_cmds.c, scsi_target.c:Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data. ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually. cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly. cam_ccb.h:Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches. scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense data scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len() version takes a l
svn commit: r226067 - in stable/9: sbin/camcontrol share/examples/scsi_target share/misc sys/cam sys/cam/scsi sys/dev/ciss sys/dev/firewire sys/dev/iir sys/dev/iscsi/initiator sys/dev/isp sys/dev/m...
Author: ken Date: Thu Oct 6 19:15:51 2011 New Revision: 226067 URL: http://svn.freebsd.org/changeset/base/226067 Log: MFC r225950: Add descriptor sense support to CAM, and honor sense residuals properly in CAM. Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes. This change adds a number of new functions to scsi_all.c (and therefore libcam) that abstract out most access to sense data. This includes a bump of CAM_VERSION, because the CCB ABI has changed. Userland programs that use the CAM pass(4) driver will need to be recompiled. camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly. scsi_modes: Update the control mode page to the latest version (SPC-4). scsi_cmds.c, scsi_target.c:Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data. ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually. cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly. cam_ccb.h:Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches. scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense data scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len()
svn commit: r217016 - head/sbin/camcontrol
Author: ken Date: Wed Jan 5 18:27:38 2011 New Revision: 217016 URL: http://svn.freebsd.org/changeset/base/217016 Log: The camcontrol smppc option to clear a PHY error log is 'clearerrlog', not 'clearerrorlog'. Modified: head/sbin/camcontrol/camcontrol.8 Modified: head/sbin/camcontrol/camcontrol.8 == --- head/sbin/camcontrol/camcontrol.8 Wed Jan 5 17:10:10 2011 (r217015) +++ head/sbin/camcontrol/camcontrol.8 Wed Jan 5 18:27:38 2011 (r217016) @@ -677,7 +677,7 @@ Send the HARD RESET command to the phy. .It disable Send the DISABLE command to the phy. Note that the LINK RESET or HARD RESET commands should re-enable the phy. -.It clearerrorlog +.It clearerrlog Send the CLEAR ERROR LOG command. This clears the error log counters for the specified phy. .It clearaffiliation ___ 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: r218810 - in stable/8/sys: amd64/conf conf dev/bwn dev/mps dev/siba dev/sis mips/mips modules modules/mps
Author: ken Date: Fri Feb 18 16:29:38 2011 New Revision: 218810 URL: http://svn.freebsd.org/changeset/base/218810 Log: MFC: 212420, 212616, 212772, 212802, 213535, 213702, 213704, 213707, 213708, 213743, 213839, 213840, 213882, 213898, 216088, 216227, 216363, 216368: Merge the mps(4) driver into stable/8. This is currently only included in GENERIC on amd64, since that is the only architecture it has been tested on. Added: stable/8/sys/dev/mps/ - copied from r212420, head/sys/dev/mps/ stable/8/sys/modules/mps/ - copied from r212420, head/sys/modules/mps/ Modified: stable/8/sys/amd64/conf/GENERIC stable/8/sys/conf/files stable/8/sys/dev/bwn/if_bwn.c stable/8/sys/dev/mps/mps.c stable/8/sys/dev/mps/mps_ioctl.h stable/8/sys/dev/mps/mps_pci.c stable/8/sys/dev/mps/mps_sas.c stable/8/sys/dev/mps/mps_user.c stable/8/sys/dev/mps/mpsvar.h stable/8/sys/dev/siba/siba_bwn.c stable/8/sys/dev/sis/if_sisreg.h stable/8/sys/mips/mips/mp_machdep.c stable/8/sys/modules/Makefile stable/8/sys/modules/mps/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/conf/GENERIC == --- stable/8/sys/amd64/conf/GENERIC Fri Feb 18 16:21:09 2011 (r218809) +++ stable/8/sys/amd64/conf/GENERIC Fri Feb 18 16:29:38 2011 (r218810) @@ -114,6 +114,7 @@ device hptiop # Highpoint RocketRaid 3 device isp # Qlogic family #deviceispfw # Firmware for QLogic HBAs- normally a module device mpt # LSI-Logic MPT-Fusion +device mps # LSI-Logic MPT-Fusion 2 #devicencr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') device trm # Tekram DC395U/UW/F DC315U adapters Modified: stable/8/sys/conf/files == --- stable/8/sys/conf/files Fri Feb 18 16:21:09 2011(r218809) +++ stable/8/sys/conf/files Fri Feb 18 16:29:38 2011(r218810) @@ -1303,6 +1303,11 @@ dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.mstandard dev/mmc/mmcsd.coptional mmcsd dev/mn/if_mn.c optional mn pci +dev/mps/mps.c optional mps +dev/mps/mps_pci.c optional mps pci +dev/mps/mps_sas.c optional mps +dev/mps/mps_table.coptional mps +dev/mps/mps_user.c optional mps dev/mpt/mpt.c optional mpt dev/mpt/mpt_cam.c optional mpt dev/mpt/mpt_debug.coptional mpt Modified: stable/8/sys/dev/bwn/if_bwn.c == --- stable/8/sys/dev/bwn/if_bwn.c Fri Feb 18 16:21:09 2011 (r218809) +++ stable/8/sys/dev/bwn/if_bwn.c Fri Feb 18 16:29:38 2011 (r218810) @@ -2882,7 +2882,7 @@ bwn_set_channel(struct ieee80211com *ic) error = bwn_switch_band(sc, ic->ic_curchan); if (error) - goto fail;; + goto fail; bwn_mac_suspend(mac); bwn_set_txretry(mac, BWN_RETRY_SHORT, BWN_RETRY_LONG); chan = ieee80211_chan2ieee(ic, ic->ic_curchan); @@ -8260,7 +8260,7 @@ bwn_switch_band(struct bwn_softc *sc, st device_printf(sc->sc_dev, "switching to %s-GHz band\n", IEEE80211_IS_CHAN_2GHZ(chan) ? "2" : "5"); - down_dev = sc->sc_curmac;; + down_dev = sc->sc_curmac; status = down_dev->mac_status; if (status >= BWN_MAC_STATUS_STARTED) bwn_core_stop(down_dev); Modified: stable/8/sys/dev/mps/mps.c == --- head/sys/dev/mps/mps.c Fri Sep 10 15:03:56 2010(r212420) +++ stable/8/sys/dev/mps/mps.c Fri Feb 18 16:29:38 2011(r218810) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -380,7 +381,7 @@ mps_request_sync(struct mps_softc *sc, v return (0); } -static void +void mps_enqueue_request(struct mps_softc *sc, struct mps_command *cm) { @@ -607,9 +608,16 @@ mps_alloc_queues(struct mps_softc *sc) static int mps_alloc_replies(struct mps_softc *sc) { - int rsize; + int rsize, num_replies; + + /* +* sc->num_replies should be one less than sc->fqdepth. We need to +* allocate space for sc->fqdepth replies, but only sc->num_replies +* replies can be used at once. +*/ + num_replies = max(sc->fqdepth, sc->num_replies);
svn commit: r218811 - head/sys/dev/mps
Author: ken Date: Fri Feb 18 17:01:57 2011 New Revision: 218811 URL: http://svn.freebsd.org/changeset/base/218811 Log: In the MPS driver, during device removal processing, don't assume that the controller firmware will return all of our commands. Instead, keep track of outstanding I/Os and return them to CAM once device removal processing completes. mpsvar.h: Declare the new "io_list" in the mps_softc. mps.c:Initialize the new "io_list" in the mps softc. mps_sas.c:o Track SCSI I/O requests on the io_list from the time of mpssas_action() through mpssas_scsiio_complete(). o Zero out the request structures used for device removal commands prior to filling them out. o Once the target reset task management function completes during device removal processing, assume any SCSI I/O commands that are still oustanding will never return from the controller, and process them manually. Submitted by: gibbs MFC after:3 days Modified: head/sys/dev/mps/mps.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 Fri Feb 18 16:29:38 2011(r218810) +++ head/sys/dev/mps/mps.c Fri Feb 18 17:01:57 2011(r218811) @@ -898,6 +898,7 @@ mps_attach(struct mps_softc *sc) TAILQ_INIT(&sc->req_list); TAILQ_INIT(&sc->chain_list); TAILQ_INIT(&sc->tm_list); + TAILQ_INIT(&sc->io_list); if (((error = mps_alloc_queues(sc)) != 0) || ((error = mps_alloc_replies(sc)) != 0) || Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Fri Feb 18 16:29:38 2011(r218810) +++ head/sys/dev/mps/mps_sas.c Fri Feb 18 17:01:57 2011(r218811) @@ -486,7 +486,10 @@ mpssas_prepare_remove(struct mpssas_soft return; } + mps_dprint(sc, MPS_INFO, "Preparing to remove target %d\n", targ->tid); + req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; + memset(req, 0, sizeof(*req)); req->DevHandle = targ->handle; req->Function = MPI2_FUNCTION_SCSI_TASK_MGMT; req->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET; @@ -507,6 +510,7 @@ mpssas_remove_device(struct mps_softc *s MPI2_SCSI_TASK_MANAGE_REPLY *reply; MPI2_SAS_IOUNIT_CONTROL_REQUEST *req; struct mpssas_target *targ; + struct mps_command *next_cm; uint16_t handle; mps_dprint(sc, MPS_TRACE, "%s\n", __func__); @@ -523,11 +527,13 @@ mpssas_remove_device(struct mps_softc *s return; } - mps_printf(sc, "Reset aborted %d commands\n", reply->TerminationCount); + mps_dprint(sc, MPS_INFO, "Reset aborted %u commands\n", + reply->TerminationCount); mps_free_reply(sc, cm->cm_reply_data); /* Reuse the existing command */ req = (MPI2_SAS_IOUNIT_CONTROL_REQUEST *)cm->cm_req; + memset(req, 0, sizeof(*req)); req->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL; req->Operation = MPI2_SAS_OP_REMOVE_DEVICE; req->DevHandle = handle; @@ -539,6 +545,17 @@ mpssas_remove_device(struct mps_softc *s mps_map_command(sc, cm); mps_dprint(sc, MPS_INFO, "clearing target handle 0x%04x\n", handle); + TAILQ_FOREACH_SAFE(cm, &sc->io_list, cm_link, next_cm) { + union ccb *ccb; + + if (cm->cm_targ->handle != handle) + continue; + + mps_dprint(sc, MPS_INFO, "Completing missed command %p\n", cm); + ccb = cm->cm_complete_data; + ccb->ccb_h.status = CAM_DEV_NOT_THERE; + mpssas_scsiio_complete(sc, cm); + } targ = mpssas_find_target(sc->sassc, 0, handle); if (targ != NULL) { targ->handle = 0x0; @@ -1430,6 +1447,7 @@ mpssas_action_scsiio(struct mpssas_softc cm->cm_complete_data = ccb; cm->cm_targ = targ; + TAILQ_INSERT_TAIL(&sc->io_list, cm, cm_link); callout_reset(&cm->cm_callout, (ccb->ccb_h.timeout * hz) / 1000, mpssas_scsiio_timeout, cm); @@ -1449,6 +1467,7 @@ mpssas_scsiio_complete(struct mps_softc mps_dprint(sc, MPS_TRACE, "%s\n", __func__); callout_stop(&cm->cm_callout); + TAILQ_REMOVE(&sc->io_list, cm, cm_link); sassc = sc->sassc; ccb = cm->cm_complete_data; @@ -1470,8 +1489,10 @@ mpssas_scsiio_complete(struct mps_softc /* Take the fast path to completion */ if (cm->cm_reply == NULL) { - ccb->ccb_h.status = CAM_REQ_CMP; - ccb->csio.scsi_status = SCSI_STATUS_OK; + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) { +
svn commit: r218812 - head/sys/dev/mps
Author: ken Date: Fri Feb 18 17:06:06 2011 New Revision: 218812 URL: http://svn.freebsd.org/changeset/base/218812 Log: Fix several issues with the mps(4) driver. When the driver ran out of DMA chaining buffers, it kept the timeout for the I/O, and I/O would stall. The driver was not freezing the device queue on errors. mps.c:Pull command completion logic into a separate function, and call the callback/wakeup for commands that are never sent due to lack of chain buffers. Add a number of extra diagnostic sysctl variables. Handle pre-hardware errors for configuration I/O. This doesn't panic the system, but it will fail the configuration I/O and there is no retry mechanism. So the device probe will not succeed. This should be a very uncommon situation, however. mps_sas.c:Freeze the SIM queue when we run out of chain buffers, and unfreeze it when more commands complete. Freeze the device queue when errors occur, so that CAM can insure proper command ordering. Report pre-hardware errors for task management commands. In general, that shouldn't be possible because task management commands don't have S/G lists, and that is currently the only error path before we get to the hardware. Handle pre-hardware errors (like out of chain elements) for SMP requests. That shouldn't happen either, since we should have enough space for two S/G elements in the standard request. For commands that end with MPI2_IOCSTATUS_SCSI_IOC_TERMINATED and MPI2_IOCSTATUS_SCSI_EXT_TERMINATED, return them with CAM_REQUEUE_REQ to retry them unconditionally. These seem to be related to back end, transport related problems that are hopefully transient. We don't want to go through the retry count for something that is not a permanent error. Keep track of the number of outstanding I/Os. mpsvar.h: Track the number of free chain elements. Add variables for the number of outstanding I/Os, and I/O high water mark. Add variables to track the number of free chain buffers and the chain low water mark, as well as the number of chain allocation failures. Add I/O state flags and an attach done flag. MFC after:3 days Modified: head/sys/dev/mps/mps.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 Fri Feb 18 17:01:57 2011(r218811) +++ head/sys/dev/mps/mps.c Fri Feb 18 17:06:06 2011(r218812) @@ -62,6 +62,7 @@ static void mps_startup(void *arg); static void mps_startup_complete(struct mps_softc *sc, struct mps_command *cm); static int mps_send_iocinit(struct mps_softc *sc); static int mps_attach_log(struct mps_softc *sc); +static __inline void mps_complete_command(struct mps_command *cm); static void mps_dispatch_event(struct mps_softc *sc, uintptr_t data, MPI2_EVENT_NOTIFICATION_REPLY *reply); static void mps_config_complete(struct mps_softc *sc, struct mps_command *cm); static void mps_periodic(void *); @@ -387,6 +388,15 @@ mps_enqueue_request(struct mps_softc *sc mps_dprint(sc, MPS_TRACE, "%s\n", __func__); + if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE) + mtx_assert(&sc->mps_mtx, MA_OWNED); + + if ((cm->cm_desc.Default.SMID < 1) +|| (cm->cm_desc.Default.SMID >= sc->num_reqs)) { + mps_printf(sc, "%s: invalid SMID %d, desc %#x %#x\n", + __func__, cm->cm_desc.Default.SMID, + cm->cm_desc.Words.High, cm->cm_desc.Words.Low); + } mps_regwrite(sc, MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET, cm->cm_desc.Words.Low); mps_regwrite(sc, MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET, @@ -732,6 +742,7 @@ mps_alloc_requests(struct mps_softc *sc) chain->chain_busaddr = sc->chain_busaddr + i * sc->facts->IOCRequestFrameSize * 4; mps_free_chain(sc, chain); + sc->chain_free_lowwater++; } /* XXX Need to pick a more precise value */ @@ -855,6 +866,26 @@ mps_attach(struct mps_softc *sc) &sc->allow_multiple_tm_cmds, 0, "allow multiple simultaneous task management cmds"); + SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), + OID_AUTO, "io_cmds_active", CTLFLAG_RD, +
svn commit: r218921 - stable/8/sys/dev/mps
Author: ken Date: Mon Feb 21 16:55:53 2011 New Revision: 218921 URL: http://svn.freebsd.org/changeset/base/218921 Log: MFC: r218811: In the MPS driver, during device removal processing, don't assume that the controller firmware will return all of our commands. Instead, keep track of outstanding I/Os and return them to CAM once device removal processing completes. mpsvar.h: Declare the new "io_list" in the mps_softc. mps.c:Initialize the new "io_list" in the mps softc. mps_sas.c:o Track SCSI I/O requests on the io_list from the time of mpssas_action() through mpssas_scsiio_complete(). o Zero out the request structures used for device removal commands prior to filling them out. o Once the target reset task management function completes during device removal processing, assume any SCSI I/O commands that are still oustanding will never return from the controller, and process them manually. Submitted by: gibbs Modified: stable/8/sys/dev/mps/mps.c stable/8/sys/dev/mps/mps_sas.c stable/8/sys/dev/mps/mpsvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mps/mps.c == --- stable/8/sys/dev/mps/mps.c Mon Feb 21 16:33:01 2011(r218920) +++ stable/8/sys/dev/mps/mps.c Mon Feb 21 16:55:53 2011(r218921) @@ -898,6 +898,7 @@ mps_attach(struct mps_softc *sc) TAILQ_INIT(&sc->req_list); TAILQ_INIT(&sc->chain_list); TAILQ_INIT(&sc->tm_list); + TAILQ_INIT(&sc->io_list); if (((error = mps_alloc_queues(sc)) != 0) || ((error = mps_alloc_replies(sc)) != 0) || Modified: stable/8/sys/dev/mps/mps_sas.c == --- stable/8/sys/dev/mps/mps_sas.c Mon Feb 21 16:33:01 2011 (r218920) +++ stable/8/sys/dev/mps/mps_sas.c Mon Feb 21 16:55:53 2011 (r218921) @@ -486,7 +486,10 @@ mpssas_prepare_remove(struct mpssas_soft return; } + mps_dprint(sc, MPS_INFO, "Preparing to remove target %d\n", targ->tid); + req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; + memset(req, 0, sizeof(*req)); req->DevHandle = targ->handle; req->Function = MPI2_FUNCTION_SCSI_TASK_MGMT; req->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET; @@ -507,6 +510,7 @@ mpssas_remove_device(struct mps_softc *s MPI2_SCSI_TASK_MANAGE_REPLY *reply; MPI2_SAS_IOUNIT_CONTROL_REQUEST *req; struct mpssas_target *targ; + struct mps_command *next_cm; uint16_t handle; mps_dprint(sc, MPS_TRACE, "%s\n", __func__); @@ -523,11 +527,13 @@ mpssas_remove_device(struct mps_softc *s return; } - mps_printf(sc, "Reset aborted %d commands\n", reply->TerminationCount); + mps_dprint(sc, MPS_INFO, "Reset aborted %u commands\n", + reply->TerminationCount); mps_free_reply(sc, cm->cm_reply_data); /* Reuse the existing command */ req = (MPI2_SAS_IOUNIT_CONTROL_REQUEST *)cm->cm_req; + memset(req, 0, sizeof(*req)); req->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL; req->Operation = MPI2_SAS_OP_REMOVE_DEVICE; req->DevHandle = handle; @@ -539,6 +545,17 @@ mpssas_remove_device(struct mps_softc *s mps_map_command(sc, cm); mps_dprint(sc, MPS_INFO, "clearing target handle 0x%04x\n", handle); + TAILQ_FOREACH_SAFE(cm, &sc->io_list, cm_link, next_cm) { + union ccb *ccb; + + if (cm->cm_targ->handle != handle) + continue; + + mps_dprint(sc, MPS_INFO, "Completing missed command %p\n", cm); + ccb = cm->cm_complete_data; + ccb->ccb_h.status = CAM_DEV_NOT_THERE; + mpssas_scsiio_complete(sc, cm); + } targ = mpssas_find_target(sc->sassc, 0, handle); if (targ != NULL) { targ->handle = 0x0; @@ -1430,6 +1447,7 @@ mpssas_action_scsiio(struct mpssas_softc cm->cm_complete_data = ccb; cm->cm_targ = targ; + TAILQ_INSERT_TAIL(&sc->io_list, cm, cm_link); callout_reset(&cm->cm_callout, (ccb->ccb_h.timeout * hz) / 1000, mpssas_scsiio_timeout, cm); @@ -1449,6 +1467,7 @@ mpssas_scsiio_complete(struct mps_softc mps_dprint(sc, MPS_TRACE, "%s\n", __func__); callout_stop(&cm->cm_callout); + TAILQ_REMOVE(&sc->io_list, cm, cm_link); sassc = sc->sassc; ccb = cm->cm_complete_data; @@ -1470,8 +1489,10 @@ mpssas_scsiio
svn commit: r218922 - stable/8/sys/dev/mps
Author: ken Date: Mon Feb 21 18:11:56 2011 New Revision: 218922 URL: http://svn.freebsd.org/changeset/base/218922 Log: MFC: r218812 Fix several issues with the mps(4) driver. When the driver ran out of DMA chaining buffers, it kept the timeout for the I/O, and I/O would stall. The driver was not freezing the device queue on errors. mps.c:Pull command completion logic into a separate function, and call the callback/wakeup for commands that are never sent due to lack of chain buffers. Add a number of extra diagnostic sysctl variables. Handle pre-hardware errors for configuration I/O. This doesn't panic the system, but it will fail the configuration I/O and there is no retry mechanism. So the device probe will not succeed. This should be a very uncommon situation, however. mps_sas.c:Freeze the SIM queue when we run out of chain buffers, and unfreeze it when more commands complete. Freeze the device queue when errors occur, so that CAM can insure proper command ordering. Report pre-hardware errors for task management commands. In general, that shouldn't be possible because task management commands don't have S/G lists, and that is currently the only error path before we get to the hardware. Handle pre-hardware errors (like out of chain elements) for SMP requests. That shouldn't happen either, since we should have enough space for two S/G elements in the standard request. For commands that end with MPI2_IOCSTATUS_SCSI_IOC_TERMINATED and MPI2_IOCSTATUS_SCSI_EXT_TERMINATED, return them with CAM_REQUEUE_REQ to retry them unconditionally. These seem to be related to back end, transport related problems that are hopefully transient. We don't want to go through the retry count for something that is not a permanent error. Keep track of the number of outstanding I/Os. mpsvar.h: Track the number of free chain elements. Add variables for the number of outstanding I/Os, and I/O high water mark. Add variables to track the number of free chain buffers and the chain low water mark, as well as the number of chain allocation failures. Add I/O state flags and an attach done flag. Modified: stable/8/sys/dev/mps/mps.c stable/8/sys/dev/mps/mps_sas.c stable/8/sys/dev/mps/mpsvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mps/mps.c == --- stable/8/sys/dev/mps/mps.c Mon Feb 21 16:55:53 2011(r218921) +++ stable/8/sys/dev/mps/mps.c Mon Feb 21 18:11:56 2011(r218922) @@ -62,6 +62,7 @@ static void mps_startup(void *arg); static void mps_startup_complete(struct mps_softc *sc, struct mps_command *cm); static int mps_send_iocinit(struct mps_softc *sc); static int mps_attach_log(struct mps_softc *sc); +static __inline void mps_complete_command(struct mps_command *cm); static void mps_dispatch_event(struct mps_softc *sc, uintptr_t data, MPI2_EVENT_NOTIFICATION_REPLY *reply); static void mps_config_complete(struct mps_softc *sc, struct mps_command *cm); static void mps_periodic(void *); @@ -387,6 +388,15 @@ mps_enqueue_request(struct mps_softc *sc mps_dprint(sc, MPS_TRACE, "%s\n", __func__); + if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE) + mtx_assert(&sc->mps_mtx, MA_OWNED); + + if ((cm->cm_desc.Default.SMID < 1) +|| (cm->cm_desc.Default.SMID >= sc->num_reqs)) { + mps_printf(sc, "%s: invalid SMID %d, desc %#x %#x\n", + __func__, cm->cm_desc.Default.SMID, + cm->cm_desc.Words.High, cm->cm_desc.Words.Low); + } mps_regwrite(sc, MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET, cm->cm_desc.Words.Low); mps_regwrite(sc, MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET, @@ -732,6 +742,7 @@ mps_alloc_requests(struct mps_softc *sc) chain->chain_busaddr = sc->chain_busaddr + i * sc->facts->IOCRequestFrameSize * 4; mps_free_chain(sc, chain); + sc->chain_free_lowwater++; } /* XXX Need to pick a more precise value */ @@ -855,6 +866,26 @@ mps_att
svn commit: r219036 - head/sys/dev/mps
Author: ken Date: Fri Feb 25 17:30:25 2011 New Revision: 219036 URL: http://svn.freebsd.org/changeset/base/219036 Log: Silence 'out of chain frames' warnings and bump the number of frames. mps.c:Hide the 'out of chain frames' warning behind MPS_INFO. mps_sas.c:Hide the SIM queue freeze/unfreeze messages behind MPS_INFO. mpsvar.h: Bump the number of chain frames from 1024 to 2048. From testing, it looks like this makes it less likely that we'll run out of chain frames, and it doesn't cost much memory (32K). MFC after:3 days Modified: head/sys/dev/mps/mps.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 Fri Feb 25 16:08:31 2011(r219035) +++ head/sys/dev/mps/mps.c Fri Feb 25 17:30:25 2011(r219036) @@ -1705,7 +1705,7 @@ mps_data_cb(void *arg, bus_dma_segment_t sflags, nsegs - i); if (error != 0) { /* Resource shortage, roll back! */ - mps_printf(sc, "out of chain frames\n"); + mps_dprint(sc, MPS_INFO, "out of chain frames\n"); cm->cm_flags |= MPS_CM_FLAGS_CHAIN_FAILED; mps_complete_command(cm); return; Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Fri Feb 25 16:08:31 2011(r219035) +++ head/sys/dev/mps/mps_sas.c Fri Feb 25 17:30:25 2011(r219036) @@ -1542,8 +1542,8 @@ mpssas_scsiio_complete(struct mps_softc if ((sassc->flags & MPSSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPSSAS_QUEUE_FROZEN; - mps_printf(sc, "Error sending command, freezing " - "SIM queue\n"); + mps_dprint(sc, MPS_INFO, "Error sending command, " + "freezing SIM queue\n"); } } @@ -1556,7 +1556,8 @@ mpssas_scsiio_complete(struct mps_softc if (sassc->flags & MPSSAS_QUEUE_FROZEN) { ccb->ccb_h.status |= CAM_RELEASE_SIMQ; sassc->flags &= ~MPSSAS_QUEUE_FROZEN; - mps_printf(sc, "Unfreezing SIM queue\n"); + mps_dprint(sc, MPS_INFO, + "Unfreezing SIM queue\n"); } } else { ccb->ccb_h.status |= CAM_DEV_QFRZN; Modified: head/sys/dev/mps/mpsvar.h == --- head/sys/dev/mps/mpsvar.h Fri Feb 25 16:08:31 2011(r219035) +++ head/sys/dev/mps/mpsvar.h Fri Feb 25 17:30:25 2011(r219036) @@ -34,7 +34,7 @@ #define MPS_REQ_FRAMES 1024 #define MPS_EVT_REPLY_FRAMES 32 #define MPS_REPLY_FRAMES MPS_REQ_FRAMES -#define MPS_CHAIN_FRAMES 1024 +#define MPS_CHAIN_FRAMES 2048 #define MPS_SENSE_LEN SSD_FULL_SIZE #define MPS_MSI_COUNT 1 #define MPS_SGE64_SIZE 12 ___ 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: r223062 - head/sys/kern
Author: ken Date: Mon Jun 13 22:08:24 2011 New Revision: 223062 URL: http://svn.freebsd.org/changeset/base/223062 Log: Instead of using an atomic operation to determine whether the devstat(9) device node has been created, pass MAKEDEV_CHECKNAME in so that the devfs code will do the check. Use a regular static variable as before, that's good enough to keep us from calling into devfs most of the time. Suggested by: kib MFC after:1 week Sponsored by: Spectra Logic Corporation Modified: head/sys/kern/subr_devstat.c Modified: head/sys/kern/subr_devstat.c == --- head/sys/kern/subr_devstat.cMon Jun 13 21:21:02 2011 (r223061) +++ head/sys/kern/subr_devstat.cMon Jun 13 22:08:24 2011 (r223062) @@ -470,9 +470,11 @@ devstat_alloc(void) static int once; mtx_assert(&devstat_mutex, MA_NOTOWNED); - if (!once && atomic_cmpset_int(&once, 0, 1)) { - make_dev_credf(MAKEDEV_ETERNAL, &devstat_cdevsw, 0, NULL, - UID_ROOT, GID_WHEEL, 0400, DEVSTAT_DEVICE_NAME); + if (!once) { + make_dev_credf(MAKEDEV_ETERNAL | MAKEDEV_CHECKNAME, + &devstat_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, + DEVSTAT_DEVICE_NAME); + once = 1; } spp2 = NULL; mtx_lock(&devstat_mutex); ___ 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: r223061 - head/sys/kern
On Tue, Jun 14, 2011 at 00:31:50 +0300, Kostik Belousov wrote: > On Mon, Jun 13, 2011 at 09:21:02PM +, Justin T. Gibbs wrote: > > Author: gibbs > > Date: Mon Jun 13 21:21:02 2011 > > New Revision: 223061 > > URL: http://svn.freebsd.org/changeset/base/223061 > > > > Log: > > Fix a couple of race conditions in devstat(9) initialization. > > > > In devstat_new_entry(), there is no need to initialize the queue > > and the mutex in this function. There are ways to do static > > initialization on both, so use STAILQ_HEAD_INITIALIZER and > > MTX_SYSINIT to initialize the queue and the mutex. > > > > In devstat_alloc(), use an atomic test and set routine to guard > > making our entry in /dev. Using just a plain static variable > > creates a race condition on multiprocessor machines. If you > > attempt to create a second entry in devfs, the kernel will panic. > Devfs returns an error if MAKEDEV_CHECKNAME flag is supplied and > attempt is made to create the existing node. The static guard is > still useful, since make_dev() call is costly, but you can remove > the atomic, since the race should be of limited scope. Done, thanks for the suggestion! Ken -- Kenneth Merry k...@freebsd.org ___ 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: r219099 - stable/8/sys/dev/mps
Author: ken Date: Mon Feb 28 16:39:15 2011 New Revision: 219099 URL: http://svn.freebsd.org/changeset/base/219099 Log: MFC: r219036 Silence 'out of chain frames' warnings and bump the number of frames. mps.c:Hide the 'out of chain frames' warning behind MPS_INFO. mps_sas.c:Hide the SIM queue freeze/unfreeze messages behind MPS_INFO. mpsvar.h: Bump the number of chain frames from 1024 to 2048. From testing, it looks like this makes it less likely that we'll run out of chain frames, and it doesn't cost much memory (32K). Modified: stable/8/sys/dev/mps/mps.c stable/8/sys/dev/mps/mps_sas.c stable/8/sys/dev/mps/mpsvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mps/mps.c == --- stable/8/sys/dev/mps/mps.c Mon Feb 28 15:58:30 2011(r219098) +++ stable/8/sys/dev/mps/mps.c Mon Feb 28 16:39:15 2011(r219099) @@ -1705,7 +1705,7 @@ mps_data_cb(void *arg, bus_dma_segment_t sflags, nsegs - i); if (error != 0) { /* Resource shortage, roll back! */ - mps_printf(sc, "out of chain frames\n"); + mps_dprint(sc, MPS_INFO, "out of chain frames\n"); cm->cm_flags |= MPS_CM_FLAGS_CHAIN_FAILED; mps_complete_command(cm); return; Modified: stable/8/sys/dev/mps/mps_sas.c == --- stable/8/sys/dev/mps/mps_sas.c Mon Feb 28 15:58:30 2011 (r219098) +++ stable/8/sys/dev/mps/mps_sas.c Mon Feb 28 16:39:15 2011 (r219099) @@ -1542,8 +1542,8 @@ mpssas_scsiio_complete(struct mps_softc if ((sassc->flags & MPSSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPSSAS_QUEUE_FROZEN; - mps_printf(sc, "Error sending command, freezing " - "SIM queue\n"); + mps_dprint(sc, MPS_INFO, "Error sending command, " + "freezing SIM queue\n"); } } @@ -1556,7 +1556,8 @@ mpssas_scsiio_complete(struct mps_softc if (sassc->flags & MPSSAS_QUEUE_FROZEN) { ccb->ccb_h.status |= CAM_RELEASE_SIMQ; sassc->flags &= ~MPSSAS_QUEUE_FROZEN; - mps_printf(sc, "Unfreezing SIM queue\n"); + mps_dprint(sc, MPS_INFO, + "Unfreezing SIM queue\n"); } } else { ccb->ccb_h.status |= CAM_DEV_QFRZN; Modified: stable/8/sys/dev/mps/mpsvar.h == --- stable/8/sys/dev/mps/mpsvar.h Mon Feb 28 15:58:30 2011 (r219098) +++ stable/8/sys/dev/mps/mpsvar.h Mon Feb 28 16:39:15 2011 (r219099) @@ -34,7 +34,7 @@ #define MPS_REQ_FRAMES 1024 #define MPS_EVT_REPLY_FRAMES 32 #define MPS_REPLY_FRAMES MPS_REQ_FRAMES -#define MPS_CHAIN_FRAMES 1024 +#define MPS_CHAIN_FRAMES 2048 #define MPS_SENSE_LEN SSD_FULL_SIZE #define MPS_MSI_COUNT 1 #define MPS_SGE64_SIZE 12 ___ 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: r219678 - stable/8/share/man/man4
Author: ken Date: Tue Mar 15 21:34:10 2011 New Revision: 219678 URL: http://svn.freebsd.org/changeset/base/219678 Log: MFC: 212624, 212669, 213535 Merge the mps(4) man page. r212624 | ken | 2010-09-14 15:40:29 -0600 (Tue, 14 Sep 2010) | 7 lines MFp4 (//depot/projects/mps/...) Add a man page for the mps(4) driver, and reference it in the mpt(4) driver man page. Sponsored by: Spectra Logic Corporation r212669 | ken | 2010-09-15 10:05:51 -0600 (Wed, 15 Sep 2010) | 6 lines MFp4 (//depot/projects/mps/...) Fix a typo. Submitted by: pluknet at gmail dot com r213535 | ken | 2010-10-07 15:56:10 -0600 (Thu, 07 Oct 2010) | 36 lines Turn on serialization of task management commands going down to the controller, but make it optional. After a problem report from Andrew Boyer, it looks like the LSI chip may have issues (the watchdog timer fired) if too many aborts are sent down to the chip at the same time. We know that task management commands are serialized, and although the manual doesn't say it, it may be a good idea to just send one at a time. But, since I'm not certain that this is necessary, add a tunable and sysctl variable (hw.mps.%d.allow_multiple_tm_cmds) to control the driver's behavior. mps.c: Add support for the sysctl and tunable, and add a comment about the possible return values to mps_map_command(). mps_sas.c: Run all task management commands through two new routines, mpssas_issue_tm_request() and mpssas_complete_tm_request(). This allows us to optionally serialize task management commands. Also, change things so that the response to a task management command always comes back through the callback. (Before it could come via the callback or the return value.) mpsvar.h: Add softc variables for the list of active task management commands, the number of active commands, and whether we should allow multiple active task management commands. Add an active command flag. mps.4: Describe the new sysctl/loader tunable variable. Sponsored by: Spectra Logic Corporation Reminded by: Hubert Tournier Added: stable/8/share/man/man4/mps.4 - copied, changed from r212624, head/share/man/man4/mps.4 Modified: stable/8/share/man/man4/Makefile stable/8/share/man/man4/mpt.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/Makefile == --- stable/8/share/man/man4/MakefileTue Mar 15 20:24:21 2011 (r219677) +++ stable/8/share/man/man4/MakefileTue Mar 15 21:34:10 2011 (r219678) @@ -218,6 +218,7 @@ MAN=aac.4 \ mmcsd.4 \ mn.4 \ mouse.4 \ + mps.4 \ mpt.4 \ msk.4 \ mtio.4 \ Copied and modified: stable/8/share/man/man4/mps.4 (from r212624, head/share/man/man4/mps.4) == --- head/share/man/man4/mps.4 Tue Sep 14 21:40:29 2010(r212624, copy source) +++ stable/8/share/man/man4/mps.4 Tue Mar 15 21:34:10 2011 (r219678) @@ -31,7 +31,7 @@ .\" .\" Author: Ken Merry .\" -.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#1 $ +.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#4 $ .\" $FreeBSD$ .\" .Dd September 13, 2010 @@ -51,7 +51,7 @@ place the following lines in your kernel Or, to load the driver as a module at boot, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -mpt_load="YES" +mps_load="YES" .Ed .Sh DESCRIPTION The @@ -97,6 +97,20 @@ driver instances, set the following tuna .Bd -literal -offset indent hw.mps.disable_msix=1 .Ed +.Pp +To allow the driver to send multiple task management commands (like abort, +LUN reset, etc.), set the following variable: +.Bd -literal -offset indent +hw.mps.X.allow_multiple_tm_cmds=1 +.Ed +.Pp +via +.Xr loader.conf 5 +or +.Xr sysctl 8 , +where X is the adapter number. +By default the driver only sends one task management command at a time, to +avoid causing a potential controller lock-up. .Sh DEBUGGING To enable debugging prints from the .Nm Modified: stable/8/share/man/man4/mpt.4 == --- stable/8/share/man/man4/mpt.4 Tue Mar 15 20:24:21 2011 (r219677) +++ stable/8/share/man/man4/mpt.4 Tue Mar 15 21:34:10 2011 (r219678) @@ -152,6 +152,7 @@ can take on - no separate compilation is .Xr cd 4 , .Xr ch 4 , .Xr da 4 , +.Xr mps 4 , .Xr pci 4 , .Xr sa 4 , .Xr scsi 4 , ___ svn-src-all@freebsd.org ma
svn commit: r222537 - in head/sys: kern sys
Author: ken Date: Tue May 31 17:29:58 2011 New Revision: 222537 URL: http://svn.freebsd.org/changeset/base/222537 Log: Fix apparent garbage in the message buffer. While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix scrambled console output, the message buffer and syslog were still getting log messages one character at a time. While all of the characters still made it into the log (courtesy of atomic operations), they were often interleaved when there were multiple threads writing to the buffer at the same time. This fixes message buffer accesses to use buffering logic as well, so that strings that are less than PRINTF_BUFR_SIZE will be put into the message buffer atomically. So now dmesg output should look the same as console output. subr_msgbuf.c:Convert most message buffer calls to use a new spin lock instead of atomic variables in some places. Add a new routine, msgbuf_addstr(), that adds a NUL-terminated string to a message buffer. This takes a priority argument, which allows us to eliminate some races (at least in the the string at a time case) that are present in the implementation of msglogchar(). (dangling and lastpri are static variables, and are subject to races when multiple callers are present.) msgbuf_addstr() also allows the caller to request that carriage returns be stripped out of the string. This matches the behavior of msglogchar(), but in testing so far it doesn't appear that any newlines are being stripped out. So the carriage return removal functionality may be a candidate for removal later on if further analysis shows that it isn't necessary. subr_prf.c: Add a new msglogstr() routine that calls msgbuf_logstr(). Rename putcons() to putbuf(). This now handles buffered output to the message log as well as the console. Also, remove the logic in putcons() (now putbuf()) that added a carriage return before a newline. The console path was the only path that needed it, and cnputc() (called by cnputs()) already adds a carriage return. So this duplication resulted in kernel-generated console output lines ending in '\r''\r''\n'. Refactor putchar() to handle the new buffering scheme. Add buffering to log(). Change log_console() to use msglogstr() instead of msglogchar(). Don't add extra newlines by default in log_console(). Hide that behavior behind a tunable/sysctl (kern.log_console_add_linefeed) for those who would like the old behavior. The old behavior led to the insertion of extra newlines for log output for programs that print out a string, and then a trailing newline on a separate write. (This is visible with dmesg -a.) msgbuf.h: Add a prototype for msgbuf_addstr(). Add three new fields to struct msgbuf, msg_needsnl, msg_lastpri and msg_lock. The first two are needed for log message functionality previously handled by msglogchar(). (Which is still active if buffering isn't enabled.) Include sys/lock.h and sys/mutex.h for the new mutex. Reviewed by: gibbs Modified: head/sys/kern/subr_msgbuf.c head/sys/kern/subr_prf.c head/sys/sys/msgbuf.h Modified: head/sys/kern/subr_msgbuf.c == --- head/sys/kern/subr_msgbuf.c Tue May 31 17:24:18 2011(r222536) +++ head/sys/kern/subr_msgbuf.c Tue May 31 17:29:58 2011(r222537) @@ -31,8 +31,16 @@ #include #include +#include +#include #include +/* + * Maximum number conversion buffer length: uintmax_t in base 2, plus <> + * around the priority, and a terminating NUL. + */ +#defineMAXPRIBUF (sizeof(intmax_t) * NBBY + 3) + /* Read/write sequence numbers are modulo a multiple of the buffer size. */ #define SEQMOD(size) ((size) * 16) @@ -51,6 +59,9 @@ msgbuf_init(struct msgbuf *mbp, void *pt mbp->msg_s
Re: svn commit: r222537 - in head/sys: kern sys
On Tue, May 31, 2011 at 14:00:18 -0700, m...@freebsd.org wrote: > On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wrote: > > Author: ken > > Date: Tue May 31 17:29:58 2011 > > New Revision: 222537 > > URL: http://svn.freebsd.org/changeset/base/222537 > > > > Log: > > ?Fix apparent garbage in the message buffer. > > > > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix > > ?scrambled console output, the message buffer and syslog were still getting > > ?log messages one character at a time. ?While all of the characters still > > ?made it into the log (courtesy of atomic operations), they were often > > ?interleaved when there were multiple threads writing to the buffer at the > > ?same time. > > This seems to panic my box with "lock "msgbuf" 0xfe0127e0 > already initialized". > > Unfortunately, though I booted with a fresh CURRENT this morning > successfully, both /boot/kernel and /boot/kernel.old give this panic. > To add insult to injury, when the kernel drops into the debugger, my > keyboard input no longer works so I can't get a stack, etc. Uh-oh! > So: > > 1) Is there anything else I can do to help debug this? > 2) how can I resurrect this box without a reinstall? > > I will try to repro on a virtual machine so I have a snapshot to come back to. My guess is that this is an issue with the message buffer reinitialization path. lock_init() (called by mtx_init()) has an assert to make sure that the lock is initialized, and that is just a flag check. Since the spin lock is part of the message buffer structure, if it is held over from a previous boot, the LO_INITIALIZED flag may still be set. Try power cycling the machine. If it is an issue with re-initialization, that should clear the memory and allow you to boot. My testing has been with VMs (under Xen), so the reinit path has probably not been tested as fully as it should have been. Sorry about that! As for the debugger, that's another issue altogether. It does work for me, but then again if the spin lock initialization is broken for the message buffer that may affect things. Try a cold boot and see if that helps. If so, I think we can probably just bzero the mutex in msgbuf_reinit() and that will fix things. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r222537 - in head/sys: kern sys
On Tue, May 31, 2011 at 15:02:37 -0700, m...@freebsd.org wrote: > On Tue, May 31, 2011 at 2:46 PM, Kenneth D. Merry wrote: > > On Tue, May 31, 2011 at 14:00:18 -0700, m...@freebsd.org wrote: > >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry > >> wrote: > >> > Author: ken > >> > Date: Tue May 31 17:29:58 2011 > >> > New Revision: 222537 > >> > URL: http://svn.freebsd.org/changeset/base/222537 > >> > > >> > Log: > >> > ?Fix apparent garbage in the message buffer. > >> > > >> > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix > >> > ?scrambled console output, the message buffer and syslog were still > >> > getting > >> > ?log messages one character at a time. ?While all of the characters still > >> > ?made it into the log (courtesy of atomic operations), they were often > >> > ?interleaved when there were multiple threads writing to the buffer at > >> > the > >> > ?same time. > >> > >> This seems to panic my box with "lock "msgbuf" 0xfe0127e0 > >> already initialized". > >> > >> Unfortunately, though I booted with a fresh CURRENT this morning > >> successfully, both /boot/kernel and /boot/kernel.old give this panic. > >> To add insult to injury, when the kernel drops into the debugger, my > >> keyboard input no longer works so I can't get a stack, etc. > > > > Uh-oh! > > > >> So: > >> > >> 1) Is there anything else I can do to help debug this? > >> 2) how can I resurrect this box without a reinstall? > >> > >> I will try to repro on a virtual machine so I have a snapshot to come back > >> to. > > > > My guess is that this is an issue with the message buffer reinitialization > > path. ?lock_init() (called by mtx_init()) has an assert to make sure that > > the lock is initialized, and that is just a flag check. > > > > Since the spin lock is part of the message buffer structure, if it is held > > over from a previous boot, the LO_INITIALIZED flag may still be set. > > > > Try power cycling the machine. ?If it is an issue with re-initialization, > > that should clear the memory and allow you to boot. > > Hmm, apparently my previous presses of the power button weren't long > enough. I let it sit off for 20 seconds and it boots okay now. Okay, so it probably is the re-initialization code. Can you try this patch and see if it survives a warm boot? I also changed the initialization path, so we don't get tripped up by garbage left in memory. Also, does the debugger work now that it has booted successfully? Thanks, Ken -- Kenneth Merry k...@freebsd.org Index: subr_msgbuf.c === --- subr_msgbuf.c (revision 222537) +++ subr_msgbuf.c (working copy) @@ -61,6 +61,7 @@ mbp->msg_magic = MSG_MAGIC; mbp->msg_lastpri = -1; mbp->msg_needsnl = 0; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } @@ -95,6 +96,7 @@ mbp->msg_lastpri = -1; /* Assume that the old message buffer didn't end in a newline. */ mbp->msg_needsnl = 1; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } ___ 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: r222550 - head/sys/kern
Author: ken Date: Tue May 31 22:39:32 2011 New Revision: 222550 URL: http://svn.freebsd.org/changeset/base/222550 Log: Fix a bug introduced in revision 222537. In msgbuf_reinit() and msgbuf_init(), we weren't initializing the mutex. Depending on the contents of memory, the LO_INITIALIZED flag might be set on the mutex (either due to a warm reboot, and the message buffer remaining in place, or due to garbage in memory) and in that case, with INVARIANTS turned on, we would trigger an assertion that the mutex had already been initialized. Fix this by bzeroing the message buffer mutex for the _init() and _reinit() paths. Reported by: mdf Modified: head/sys/kern/subr_msgbuf.c Modified: head/sys/kern/subr_msgbuf.c == --- head/sys/kern/subr_msgbuf.c Tue May 31 21:42:34 2011(r222549) +++ head/sys/kern/subr_msgbuf.c Tue May 31 22:39:32 2011(r222550) @@ -61,6 +61,7 @@ msgbuf_init(struct msgbuf *mbp, void *pt mbp->msg_magic = MSG_MAGIC; mbp->msg_lastpri = -1; mbp->msg_needsnl = 0; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } @@ -95,6 +96,7 @@ msgbuf_reinit(struct msgbuf *mbp, void * mbp->msg_lastpri = -1; /* Assume that the old message buffer didn't end in a newline. */ mbp->msg_needsnl = 1; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } ___ 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: r222537 - in head/sys: kern sys
On Tue, May 31, 2011 at 15:16:05 -0700, m...@freebsd.org wrote: > On Tue, May 31, 2011 at 3:11 PM, Kenneth D. Merry wrote: > > On Tue, May 31, 2011 at 15:02:37 -0700, m...@freebsd.org wrote: > >> On Tue, May 31, 2011 at 2:46 PM, Kenneth D. Merry wrote: > >> > On Tue, May 31, 2011 at 14:00:18 -0700, m...@freebsd.org wrote: > >> >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry > >> >> wrote: > >> >> > Author: ken > >> >> > Date: Tue May 31 17:29:58 2011 > >> >> > New Revision: 222537 > >> >> > URL: http://svn.freebsd.org/changeset/base/222537 > >> >> > > >> >> > Log: > >> >> > ?Fix apparent garbage in the message buffer. > >> >> > > >> >> > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to > >> >> > fix > >> >> > ?scrambled console output, the message buffer and syslog were still > >> >> > getting > >> >> > ?log messages one character at a time. ?While all of the characters > >> >> > still > >> >> > ?made it into the log (courtesy of atomic operations), they were often > >> >> > ?interleaved when there were multiple threads writing to the buffer > >> >> > at the > >> >> > ?same time. > >> >> > >> >> This seems to panic my box with "lock "msgbuf" 0xfe0127e0 > >> >> already initialized". > >> >> > >> >> Unfortunately, though I booted with a fresh CURRENT this morning > >> >> successfully, both /boot/kernel and /boot/kernel.old give this panic. > >> >> To add insult to injury, when the kernel drops into the debugger, my > >> >> keyboard input no longer works so I can't get a stack, etc. > >> > > >> > Uh-oh! > >> > > >> >> So: > >> >> > >> >> 1) Is there anything else I can do to help debug this? > >> >> 2) how can I resurrect this box without a reinstall? > >> >> > >> >> I will try to repro on a virtual machine so I have a snapshot to come > >> >> back to. > >> > > >> > My guess is that this is an issue with the message buffer > >> > reinitialization > >> > path. ?lock_init() (called by mtx_init()) has an assert to make sure that > >> > the lock is initialized, and that is just a flag check. > >> > > >> > Since the spin lock is part of the message buffer structure, if it is > >> > held > >> > over from a previous boot, the LO_INITIALIZED flag may still be set. > >> > > >> > Try power cycling the machine. ?If it is an issue with re-initialization, > >> > that should clear the memory and allow you to boot. > >> > >> Hmm, apparently my previous presses of the power button weren't long > >> enough. ?I let it sit off for 20 seconds and it boots okay now. > > > > Okay, so it probably is the re-initialization code. ?Can you try this patch > > and see if it survives a warm boot? ?I also changed the initialization > > path, so we don't get tripped up by garbage left in memory. > > This patch survived a warm reboot (shutdown -r now). Cool! I just checked in the patch. > > Also, does the debugger work now that it has booted successfully? > > The debugger (or rather, my keyboard in the debugger) works on a > successful boot. I used sysctl debug.kdb.enter=1 to test it. Ahh, glad things are working there too. Let me know if you (or anyone else) run into any more issues. Thanks for testing this! Ken -- Kenneth Merry k...@freebsd.org ___ 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: r222537 - in head/sys: kern sys
On Wed, Jun 01, 2011 at 20:07:31 +1000, Bruce Evans wrote: > On Wed, 1 Jun 2011, Andriy Gapon wrote: > > >on 31/05/2011 20:29 Kenneth D. Merry said the following: > >>+ mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > > > >Sorry that I didn't gather myself together for a review before this change > >got > >actually committed. > >Do you see any reason not to make this spinlock recursive? > > I see reasons why it must not exist. The message buffer code cannot use > any normal locking, and was carefully written to avoid doing so. > > >I am a little bit worried about "exotic" situations like receiving an NMI > >in the > >middle of printing and wanting to print in the NMI context, or similar > >things > >that penetrate contexts with disabled interrupts - e.g. Machine Check > >Exception. > >Also it's not clear to me if there won't any bigger damage in the > >situations > >like those described above. > > > >P.S. I have been thinking about fixing the problem in a different fashion, > >via > >reserving portions of dmesg buffer for a whole message using CAS: > >http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html > > Something like this might work. > > PRINTF_BUFR size should not exist either, especially now that it is > much more complicated and broken. Here is some of my old mail about > adding (necessarily not normal) locking to to printf. No one replied, > so I never finished this :-(. That particular solution doesn't lock the normal kernel printf path, and so won't fix what we're trying to fix. (We've got lots of disks in each system, and when there are various SES events and disks arriving and departing, there are multiple kernel contexts doing printfs simultaneously, and that results in scrambled dmesg output.) I think the goals should be: - console output, syslog output, and dmesg output are not scrambled. (i.e. individual kernel printfs make it out atomically, or at least with a certain granularity, like PRINTF_BUFR_SIZE.) - Can be called by any kernel routine (i.e. doesn't sleep) - Offers a string at a time interface. - Does the right thing for log messages (priority, etc.) It looks like we should add "does not use normal locking" to the list as well. As Justin mentioned, we started off down the path of using atomic operations, and then figured out that wouldn't fully work. Then we discussed doing a per-CPU message buffer, with each message tagged with a sequence number, and having the reader re-serialize the messages in the right order. The complexity started to get large enough that we decided that using a spin lock would be a much easier approach. cnputs() already uses a spinlock, so we're no worse off than before from a locking standpoint. We could perhaps make the message buffer mutex recursive and set the MTX_NOWITNESS flag as well, that might make things a little better from a side effect standpoint. If we can come up with a solution that meets the above goals, Justin and I would be happy to help implement it. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r222537 - in head/sys: kern sys
On Fri, Jun 03, 2011 at 20:47:00 +1000, Bruce Evans wrote: > On Thu, 2 Jun 2011, Kenneth D. Merry wrote: > > >On Wed, Jun 01, 2011 at 20:07:31 +1000, Bruce Evans wrote: > >>On Wed, 1 Jun 2011, Andriy Gapon wrote: > >> > >>>on 31/05/2011 20:29 Kenneth D. Merry said the following: > >>>>+ mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > >>> > >>>Sorry that I didn't gather myself together for a review before this > >>>change > >>>got > >>>actually committed. > >>>Do you see any reason not to make this spinlock recursive? > > It does need to be recursive to avoid deadlock (as I described), but this > prevents it actually working as a lock. I think the new code needs it to > work as a lock. Yes, it does. > >>I see reasons why it must not exist. The message buffer code cannot use > >>any normal locking, and was carefully written to avoid doing so. > >> > >>>I am a little bit worried about "exotic" situations like receiving an NMI > >>>in the > >>>middle of printing and wanting to print in the NMI context, or similar > >>>things > >>>that penetrate contexts with disabled interrupts - e.g. Machine Check > >>>Exception. > >>>Also it's not clear to me if there won't any bigger damage in the > >>>situations > >>>like those described above. > >>> > >>>P.S. I have been thinking about fixing the problem in a different > >>>fashion, > >>>via > >>>reserving portions of dmesg buffer for a whole message using CAS: > >>>http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html > >> > >>Something like this might work. > >> > >>PRINTF_BUFR size should not exist either, especially now that it is > >>much more complicated and broken. Here is some of my old mail about > >>adding (necessarily not normal) locking to to printf. No one replied, > >>so I never finished this :-(. > > > >That particular solution doesn't lock the normal kernel printf path, and so > >won't fix what we're trying to fix. (We've got lots of disks in each > >system, and when there are various SES events and disks arriving and > >departing, there are multiple kernel contexts doing printfs simultaneously, > >and that results in scrambled dmesg output.) > > But it does. PRINTF_BUFR_SIZE (at least used to) only be applied to > vprintf(), but my printf_lock() is applied to all calls to kvprintf() > that set TOLOG. (If I missed some, this takes 2 lines each to fix.) > The calls in tprintf() and log() have comments saying that this is > intentional "to serialize msgbuf", though I fear this might not be safe > for at least tprintf(), since it may block unboundedly. But even when > it blocks unboundedly, nothing really bad happens: the output just > becomes very slow due to everything waiting for the timeout until the > blockage clears, and may be interleaved. Recursion gives similar > behaviour, except it takes unrecursing to clear the blockage. I > consider the very slow output to be a feature. Unbounded blockages > and recursion are bugs and the slow output makes them more obvious. Ahh. It wasn't 100% clear from looking at the patch which calls had the lock applied. In this case at least, it's skipping the lock when the priority is -1. Is this tprintf()? % /* % * Warn that a system table is full. % @@ -198,5 +221,9 @@ % pca.flags = flags; % va_start(ap, fmt); % + if (pri != -1) % + printf_lock(); /* To serialize msgbuf. XXX: long-held lock? */ % kvprintf(fmt, putchar, &pca, 10, ap); % + if (pri != -1) % + printf_unlock(); % va_end(ap); % if (sess != NULL) % > >I think the goals should be: > > > >- console output, syslog output, and dmesg output are not scrambled. > > (i.e. individual kernel printfs make it out atomically, or at least > > with a certain granularity, like PRINTF_BUFR_SIZE.) > > Console output includes debugger output. This must be able to break into > any otherwise-atomic kernel printf. Possibly similarly for NMIs (if they > print. They really shouldn't print, but they at least used to get this > horribly wrong from the beginning on i386). Similarly for certain (non > maskable) traps. These really shouldn't happen while we're printing, but > if they do then they may need to panic and then print for things like > machine check exceptions. > > Debugger output is the easiest way of showing why prin
svn commit: r222804 - head/sys/kern
Author: ken Date: Tue Jun 7 05:04:37 2011 New Revision: 222804 URL: http://svn.freebsd.org/changeset/base/222804 Log: Set pca.p_bufr to NULL when we haven't allocated a buffer. Otherwise, p_bufr is set to garbage on the stack, and if that garbage happens to be non-NULL, and the TOLOG or TOCONS flag is set, putbuf() will get called and attempt to fill the non-existent buffer. This is really only relevant for tprintf() (and only when the priority is not -1), but set it in uprintf() and ttyprintf() for completeness. The next step, to avoid log buffer scrambling, would be to add the PRINTF_BUFR_SIZE code to tprintf(), but this should prevent panics. Submitted by: rmacklem Found by: pho Modified: head/sys/kern/subr_prf.c Modified: head/sys/kern/subr_prf.c == --- head/sys/kern/subr_prf.cTue Jun 7 04:38:33 2011(r222803) +++ head/sys/kern/subr_prf.cTue Jun 7 05:04:37 2011(r222804) @@ -163,6 +163,7 @@ uprintf(const char *fmt, ...) goto out; } pca.flags = TOTTY; + pca.p_bufr = NULL; va_start(ap, fmt); tty_lock(pca.tty); retval = kvprintf(fmt, putchar, &pca, 10, ap); @@ -206,6 +207,7 @@ tprintf(struct proc *p, int pri, const c pca.pri = pri; pca.tty = tp; pca.flags = flags; + pca.p_bufr = NULL; va_start(ap, fmt); if (pca.tty != NULL) tty_lock(pca.tty); @@ -234,6 +236,7 @@ ttyprintf(struct tty *tp, const char *fm va_start(ap, fmt); pca.tty = tp; pca.flags = TOTTY; + pca.p_bufr = NULL; retval = kvprintf(fmt, putchar, &pca, 10, ap); va_end(ap); return (retval); ___ 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: r222883 - head/sbin/rtsol
Author: ken Date: Wed Jun 8 21:59:07 2011 New Revision: 222883 URL: http://svn.freebsd.org/changeset/base/222883 Log: Add dump.c to the rtsol build. It is needed now that sec2str is non-static and used in rtsold.c. Modified: head/sbin/rtsol/Makefile Modified: head/sbin/rtsol/Makefile == --- head/sbin/rtsol/MakefileWed Jun 8 21:58:19 2011(r222882) +++ head/sbin/rtsol/MakefileWed Jun 8 21:59:07 2011(r222883) @@ -19,7 +19,7 @@ SRCDIR= ${.CURDIR}/../../usr.sbin/rtsold .PATH: ${SRCDIR} PROG= rtsol -SRCS= rtsold.c rtsol.c if.c probe.c rtsock.c +SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c NO_MAN= WARNS?=3 ___ 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: r265236 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/mpr sys/dev/mpr/mpi sys/i386/conf sys/ia64/conf sys/mips/conf sys/modules sys/modules/mpr sys/sparc64/conf
Author: ken Date: Fri May 2 20:25:09 2014 New Revision: 265236 URL: http://svnweb.freebsd.org/changeset/base/265236 Log: Bring in the mpr(4) driver for LSI's MPT3 12Gb SAS controllers. This is derived from the mps(4) driver, but it supports only the 12Gb IT and IR hardware including the SAS 3004, SAS 3008 and SAS 3108. Some notes about this driver: o The 12Gb hardware can do "FastPath" I/O, and that capability is included in this driver. o WarpDrive functionality has been removed, since it isn't supported in the 12Gb driver interface. o The Scatter/Gather list handling code is significantly different between the 6Gb and 12Gb hardware. The 12Gb boards support IEEE Scatter/Gather lists. Thanks to LSI for developing and testing this driver for FreeBSD. share/man/man4/mpr.4: mpr(4) man page. sys/dev/mpr/*: mpr(4) driver files. sys/modules/Makefile, sys/modules/mpr/Makefile: Add a module Makefile for the mpr(4) driver. sys/conf/files: Add the mpr(4) driver. sys/amd64/conf/GENERIC, sys/i386/conf/GENERIC, sys/mips/conf/OCTEON1, sys/sparc64/conf/GENERIC: Add the mpr(4) driver to all config files that currently have the mps(4) driver. sys/ia64/conf/GENERIC: Add the mps(4) and mpr(4) drivers to the ia64 GENERIC config file. sys/i386/conf/XEN: Exclude the mpr module from building here. Submitted by: Steve McConnell MFC after:3 days Tested by:Chris Reeves Sponsored by: LSI, Spectra Logic Relnotes: LSI 12Gb SAS driver mpr(4) added Added: head/share/man/man4/mpr.4 (contents, props changed) head/sys/dev/mpr/ head/sys/dev/mpr/mpi/ head/sys/dev/mpr/mpi/mpi2.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_cnfg.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_hbd.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_history.txt (contents, props changed) head/sys/dev/mpr/mpi/mpi2_init.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_ioc.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_ra.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_raid.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_sas.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_targ.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_tool.h (contents, props changed) head/sys/dev/mpr/mpi/mpi2_type.h (contents, props changed) head/sys/dev/mpr/mpr.c (contents, props changed) head/sys/dev/mpr/mpr_config.c (contents, props changed) head/sys/dev/mpr/mpr_ioctl.h (contents, props changed) head/sys/dev/mpr/mpr_mapping.c (contents, props changed) head/sys/dev/mpr/mpr_mapping.h (contents, props changed) head/sys/dev/mpr/mpr_pci.c (contents, props changed) head/sys/dev/mpr/mpr_sas.c (contents, props changed) head/sys/dev/mpr/mpr_sas.h (contents, props changed) head/sys/dev/mpr/mpr_sas_lsi.c (contents, props changed) head/sys/dev/mpr/mpr_table.c (contents, props changed) head/sys/dev/mpr/mpr_table.h (contents, props changed) head/sys/dev/mpr/mpr_user.c (contents, props changed) head/sys/dev/mpr/mprvar.h (contents, props changed) head/sys/modules/mpr/ head/sys/modules/mpr/Makefile (contents, props changed) Modified: head/sys/amd64/conf/GENERIC head/sys/conf/files head/sys/i386/conf/GENERIC head/sys/i386/conf/XEN head/sys/ia64/conf/GENERIC head/sys/mips/conf/OCTEON1 head/sys/modules/Makefile head/sys/sparc64/conf/GENERIC Added: head/share/man/man4/mpr.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/mpr.4 Fri May 2 20:25:09 2014(r265236) @@ -0,0 +1,226 @@ +.\" +.\" Copyright (c) 2010 Spectra Logic Corporation +.\" Copyright (c) 2014 LSI Corp +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions, and the following disclaimer, +.\"without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\"substantially similar to the "NO WARRANTY" disclaimer below +.\"("Disclaimer") and any redistribution must be conditioned upon +.\"including a substantially similar Disclaimer requirement for further +.\"binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLAR
svn commit: r265237 - head/share/man/man4
Author: ken Date: Fri May 2 20:36:20 2014 New Revision: 265237 URL: http://svnweb.freebsd.org/changeset/base/265237 Log: Add the mpr(4) man page to the man4 Makefile. This should have been included in r265236. Submitted by: Steve McConnell MFC after:3 days Sponsored by: LSI, Spectra Logic Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileFri May 2 20:25:09 2014 (r265236) +++ head/share/man/man4/MakefileFri May 2 20:36:20 2014 (r265237) @@ -262,6 +262,7 @@ MAN=aac.4 \ mod_cc.4 \ mos.4 \ mouse.4 \ + mpr.4 \ mps.4 \ mpt.4 \ msk.4 \ ___ 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: r265386 - head/sys/dev/mpr
Author: ken Date: Mon May 5 19:53:03 2014 New Revision: 265386 URL: http://svnweb.freebsd.org/changeset/base/265386 Log: Adjust #if statements inside mprsas_send_smpcmd() to more accurately reflect when unmapped I/O support was added. For FreeBSD 10, it arrived just prior to __FreeBSD_version 128. For FreeBSD 9, it arrived just prior to __FreeBSD_version 902001. Also, fix compiler warnings in mprsas_send_smpcmd() that happen in the i386 PAE build for non-unmapped I/O builds. These were fixed in mps(4) in revision 241145, but didn't make it into the mpr(4) driver. This change should only affect FreeBSD versions outside the above revisions, and thus doesn't affect head. MFC after:3 days Sponsored by: Spectra Logic Corporation Modified: head/sys/dev/mpr/mpr_sas.c Modified: head/sys/dev/mpr/mpr_sas.c == --- head/sys/dev/mpr/mpr_sas.c Mon May 5 19:38:29 2014(r265385) +++ head/sys/dev/mpr/mpr_sas.c Mon May 5 19:53:03 2014(r265386) @@ -2501,7 +2501,8 @@ mprsas_send_smpcmd(struct mprsas_softc * sg = NULL; error = 0; -#if __FreeBSD_version >= 129 +#if (__FreeBSD_version >= 128) || \ +((__FreeBSD_version >= 902001) && (__FreeBSD_version < 100)) switch (ccb->ccb_h.flags & CAM_DATA_MASK) { case CAM_DATA_PADDR: case CAM_DATA_SG_PADDR: @@ -2561,7 +2562,7 @@ mprsas_send_smpcmd(struct mprsas_softc * xpt_done(ccb); return; } -#else //__FreeBSD_version < 129 +#else /* __FreeBSD_version < 128 */ /* * XXX We don't yet support physical addresses here. */ @@ -2604,7 +2605,7 @@ mprsas_send_smpcmd(struct mprsas_softc * bus_dma_segment_t *req_sg; req_sg = (bus_dma_segment_t *)ccb->smpio.smp_request; - request = (uint8_t *)req_sg[0].ds_addr; + request = (uint8_t *)(uintptr_t)req_sg[0].ds_addr; } else request = ccb->smpio.smp_request; @@ -2612,14 +2613,14 @@ mprsas_send_smpcmd(struct mprsas_softc * bus_dma_segment_t *rsp_sg; rsp_sg = (bus_dma_segment_t *)ccb->smpio.smp_response; - response = (uint8_t *)rsp_sg[0].ds_addr; + response = (uint8_t *)(uintptr_t)rsp_sg[0].ds_addr; } else response = ccb->smpio.smp_response; } else { request = ccb->smpio.smp_request; response = ccb->smpio.smp_response; } -#endif //__FreeBSD_version >= 129 +#endif /* __FreeBSD_version < 128 */ cm = mpr_alloc_command(sc); if (cm == NULL) { ___ 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: r265388 - in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/mpr sys/i386/conf sys/ia64/conf sys/mips/conf sys/modules sys/modules/mpr sys/sparc64/conf
Author: ken Date: Mon May 5 20:35:35 2014 New Revision: 265388 URL: http://svnweb.freebsd.org/changeset/base/265388 Log: MFC the mpr(4) driver for LSI's 12Gb SAS cards. This includes r265236, r265237, r265241 and r265261: r265236 | ken | 2014-05-02 14:25:09 -0600 (Fri, 02 May 2014) | 51 lines Bring in the mpr(4) driver for LSI's MPT3 12Gb SAS controllers. This is derived from the mps(4) driver, but it supports only the 12Gb IT and IR hardware including the SAS 3004, SAS 3008 and SAS 3108. Some notes about this driver: o The 12Gb hardware can do "FastPath" I/O, and that capability is included in this driver. o WarpDrive functionality has been removed, since it isn't supported in the 12Gb driver interface. o The Scatter/Gather list handling code is significantly different between the 6Gb and 12Gb hardware. The 12Gb boards support IEEE Scatter/Gather lists. Thanks to LSI for developing and testing this driver for FreeBSD. share/man/man4/mpr.4: mpr(4) man page. sys/dev/mpr/*: mpr(4) driver files. sys/modules/Makefile, sys/modules/mpr/Makefile: Add a module Makefile for the mpr(4) driver. sys/conf/files: Add the mpr(4) driver. sys/amd64/conf/GENERIC, sys/i386/conf/GENERIC, sys/mips/conf/OCTEON1, sys/sparc64/conf/GENERIC: Add the mpr(4) driver to all config files that currently have the mps(4) driver. sys/ia64/conf/GENERIC: Add the mps(4) and mpr(4) drivers to the ia64 GENERIC config file. sys/i386/conf/XEN: Exclude the mpr module from building here. Submitted by: Steve McConnell Tested by: Chris Reeves Sponsored by: LSI, Spectra Logic Relnotes: LSI 12Gb SAS driver mpr(4) added r265237 | ken | 2014-05-02 14:36:20 -0600 (Fri, 02 May 2014) | 8 lines Add the mpr(4) man page to the man4 Makefile. This should have been included in r265236. Submitted by: Steve McConnell MFC after: 3 days Sponsored by: LSI, Spectra Logic r265241 | brueffer | 2014-05-02 15:14:28 -0600 (Fri, 02 May 2014) | 2 lines Use our standard SYNOPSIS wording; perform some cleanup while here. r265261 | brueffer | 2014-05-03 05:15:28 -0600 (Sat, 03 May 2014) | 2 lines Add a missing colon. Submitted by: Steve McConnell Tested by:Chris Reeves Sponsored by: LSI, Spectra Logic Relnotes: LSI 12Gb SAS driver mpr(4) added Added: stable/10/share/man/man4/mpr.4 - copied, changed from r265236, head/share/man/man4/mpr.4 stable/10/sys/dev/mpr/ - copied from r265236, head/sys/dev/mpr/ stable/10/sys/modules/mpr/ - copied from r265236, head/sys/modules/mpr/ Modified: stable/10/share/man/man4/Makefile stable/10/sys/amd64/conf/GENERIC stable/10/sys/conf/files stable/10/sys/i386/conf/GENERIC stable/10/sys/i386/conf/XEN stable/10/sys/ia64/conf/GENERIC stable/10/sys/mips/conf/OCTEON1 stable/10/sys/modules/Makefile stable/10/sys/sparc64/conf/GENERIC Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile == --- stable/10/share/man/man4/Makefile Mon May 5 20:13:25 2014 (r265387) +++ stable/10/share/man/man4/Makefile Mon May 5 20:35:35 2014 (r265388) @@ -259,6 +259,7 @@ MAN=aac.4 \ mod_cc.4 \ mos.4 \ mouse.4 \ + mpr.4 \ mps.4 \ mpt.4 \ msk.4 \ Copied and modified: stable/10/share/man/man4/mpr.4 (from r265236, head/share/man/man4/mpr.4) == --- head/share/man/man4/mpr.4 Fri May 2 20:25:09 2014(r265236, copy source) +++ stable/10/share/man/man4/mpr.4 Mon May 5 20:35:35 2014 (r265388) @@ -36,7 +36,7 @@ .\" $Id$ .\" $FreeBSD$ .\" -.Dd Apr 28, 2014 +.Dd May 2, 2014 .Dt MPR 4 .Os .Sh NAME @@ -51,7 +51,8 @@ kernel configuration file: .Cd "device mpr" .Ed .Pp -Or, to load the driver as a module at boot, place the following line in +Alternatively, to load the driver as a +module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset i
svn commit: r265424 - head/sys/dev/mpr
Author: ken Date: Tue May 6 06:18:43 2014 New Revision: 265424 URL: http://svnweb.freebsd.org/changeset/base/265424 Log: Fix a problem with async notifications in the mpr(4) driver. This problem only occurs on versions of FreeBSD prior to the recent CAM locking changes. (i.e. stable/9 and older versions of stable/10) This change should be a no-op for head and stable/10. If a path isn't specified, xpt_register_async() will create a fully wildcarded path and acquire a lock (the XPT lock in older versions, and via xpt_path_lock() in newer versions) to call xpt_action() for the XPT_SASYNC_CB CCB. It will then drop the lock and if the requested event includes AC_FOUND_DEVICE or AC_PATH_REGISTERED, it will get the caller up to date with any device arrivals or path registrations. The issue is that before the locking changes, each SIM lock would get acquired in turn during the EDT tree traversal process. If a path is specified for xpt_register_async(), it won't acquire and drop its own lock, but instead expects the caller to hold its own SIM lock. That works for the first part of xpt_register_async(), but causes a recursive lock acquisition once the EDT traversal happens and it comes to the SIM in question. And it isn't possible to call xpt_action() without holding a SIM lock. The locking changes fix this by using the XPT topology lock for EDT traversal, so it is no longer an issue to hold the SIM lock while calling xpt_register_async(). The solution for FreeBSD versions before the locking changes is to request notification of all device arrivals (so we pass a NULL path into xpt_register_async()) and then filter out the arrivals that are not ours. MFC After:3 days Sponsored by: Spectra Logic Corporation Modified: head/sys/dev/mpr/mpr_sas.c Modified: head/sys/dev/mpr/mpr_sas.c == --- head/sys/dev/mpr/mpr_sas.c Tue May 6 04:22:37 2014(r265423) +++ head/sys/dev/mpr/mpr_sas.c Tue May 6 06:18:43 2014(r265424) @@ -813,8 +813,49 @@ mpr_attach_sas(struct mpr_softc *sc) #else event = AC_FOUND_DEVICE; #endif + + /* +* Prior to the CAM locking improvements, we can't call +* xpt_register_async() with a particular path specified. +* +* If a path isn't specified, xpt_register_async() will +* generate a wildcard path and acquire the XPT lock while +* it calls xpt_action() to execute the XPT_SASYNC_CB CCB. +* It will then drop the XPT lock once that is done. +* +* If a path is specified for xpt_register_async(), it will +* not acquire and drop the XPT lock around the call to +* xpt_action(). xpt_action() asserts that the caller +* holds the SIM lock, so the SIM lock has to be held when +* calling xpt_register_async() when the path is specified. +* +* But xpt_register_async calls xpt_for_all_devices(), +* which calls xptbustraverse(), which will acquire each +* SIM lock. When it traverses our particular bus, it will +* necessarily acquire the SIM lock, which will lead to a +* recursive lock acquisition. +* +* The CAM locking changes fix this problem by acquiring +* the XPT topology lock around bus traversal in +* xptbustraverse(), so the caller can hold the SIM lock +* and it does not cause a recursive lock acquisition. +* +* These __FreeBSD_version values are approximate, especially +* for stable/10, which is two months later than the actual +* change. +*/ + +#if (__FreeBSD_version < 1000703) || \ +((__FreeBSD_version >= 110) && (__FreeBSD_version < 112)) + mpr_unlock(sc); + status = xpt_register_async(event, mprsas_async, sc, + NULL); + mpr_lock(sc); +#else status = xpt_register_async(event, mprsas_async, sc, sassc->path); +#endif + if (status != CAM_REQ_CMP) { mpr_dprint(sc, MPR_ERROR, "Error %#x registering async handler for " @@ -2988,6 +3029,18 @@ mprsas_async(void *callback_arg, uint32_ break; /* +* See the comment in mpr_attach_sas() for a detailed +* explanation. In these versions of FreeBSD we register +* for all events and filter out the events that don't +* apply to us. +*/ +#if (__FreeBSD_version < 1000703)
svn commit: r265473 - head/sys/dev/mpr
Author: ken Date: Tue May 6 22:13:38 2014 New Revision: 265473 URL: http://svnweb.freebsd.org/changeset/base/265473 Log: Change the device name for mpr(4) from /dev/mpr_N to /dev/mprN. This is more consistent with the existing mps(4) behavior. Reviewed by: Steve McConnell MFC after:3 days Modified: head/sys/dev/mpr/mpr_user.c Modified: head/sys/dev/mpr/mpr_user.c == --- head/sys/dev/mpr/mpr_user.c Tue May 6 22:06:39 2014(r265472) +++ head/sys/dev/mpr/mpr_user.c Tue May 6 22:13:38 2014(r265473) @@ -212,7 +212,7 @@ mpr_attach_user(struct mpr_softc *sc) unit = device_get_unit(sc->mpr_dev); sc->mpr_cdev = make_dev(&mpr_cdevsw, unit, UID_ROOT, GID_OPERATOR, - 0640, "mpr_%d", unit); + 0640, "mpr%d", unit); if (sc->mpr_cdev == NULL) { return (ENOMEM); } ___ 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: r265484 - head/sys/dev/mpr
Author: ken Date: Wed May 7 05:11:16 2014 New Revision: 265484 URL: http://svnweb.freebsd.org/changeset/base/265484 Log: Remove some debugging code. Submitted by: Steve McConnell MFC after:3 days Modified: head/sys/dev/mpr/mpr.c Modified: head/sys/dev/mpr/mpr.c == --- head/sys/dev/mpr/mpr.c Wed May 7 05:06:55 2014(r265483) +++ head/sys/dev/mpr/mpr.c Wed May 7 05:11:16 2014(r265484) @@ -2182,8 +2182,6 @@ mpr_add_chain(struct mpr_command *cm, in * code other than 0. */ if (cm->cm_flags & MPR_CM_FLAGS_SGE_SIMPLE) { -//SLM-test -printf("Trying to add a chain element to an MPI SGL\n"); mpr_dprint(sc, MPR_ERROR, "A chain element cannot be added to " "an MPI SGL.\n"); return(ENOBUFS); ___ 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: r265485 - head/sys/dev/mpr
Author: ken Date: Wed May 7 05:14:48 2014 New Revision: 265485 URL: http://svnweb.freebsd.org/changeset/base/265485 Log: Hold the SIM lock when calling xpt_create_path() and xpt_action() in mprsas_SSU_to_SATA_devices(). This fixes an assertion on shutdown with INVARIANTS enabled with SATA drives present on an IR firmware controller. Reviewed by: Steve McConnell . MFC after:3 days Modified: head/sys/dev/mpr/mpr_sas_lsi.c Modified: head/sys/dev/mpr/mpr_sas_lsi.c == --- head/sys/dev/mpr/mpr_sas_lsi.c Wed May 7 05:11:16 2014 (r265484) +++ head/sys/dev/mpr/mpr_sas_lsi.c Wed May 7 05:14:48 2014 (r265485) @@ -1026,6 +1026,8 @@ mprsas_SSU_to_SATA_devices(struct mpr_so char path_str[64]; struct timeval cur_time, start_time; + mpr_lock(sc); + /* * For each LUN of each target, issue a StartStopUnit command to stop * the device. @@ -1041,6 +1043,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_so SLIST_FOREACH(lun, &target->luns, lun_link) { ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { + mpr_unlock(sc); mpr_dprint(sc, MPR_FAULT, "Unable to alloc " "CCB to stop unit.\n"); return; @@ -1057,6 +1060,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_so mpr_dprint(sc, MPR_FAULT, "Unable to " "create LUN path to stop unit.\n"); xpt_free_ccb(ccb); + mpr_unlock(sc); return; } xpt_path_string(ccb->ccb_h.path, path_str, @@ -1092,6 +1096,8 @@ mprsas_SSU_to_SATA_devices(struct mpr_so } } + mpr_unlock(sc); + /* * Wait until all of the SSU commands have completed or time has * expired (60 seconds). pause for 100ms each time through. If any ___ 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: r265584 - svnadmin/conf
Author: ken Date: Wed May 7 18:22:30 2014 New Revision: 265584 URL: http://svnweb.freebsd.org/changeset/base/265584 Log: Add Steve McConnell (slm) as a src committer. Steve works for LSI (which is now Avago) and will be maintaing drivers for LSI's SAS and RAID products (mps(4), mpr(4), mrsas(4)). scottl, ambrisko and ken will be his mentors. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access == --- svnadmin/conf/accessWed May 7 18:21:38 2014(r265583) +++ svnadmin/conf/accessWed May 7 18:22:30 2014(r265584) @@ -197,6 +197,7 @@ se silby simon sjg +slm smh sobomax stas Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Wed May 7 18:21:38 2014(r265583) +++ svnadmin/conf/mentors Wed May 7 18:22:30 2014(r265584) @@ -28,6 +28,7 @@ monthadar adrian odeds jhb Co-mentor: alfred peterj jhb Co-mentor: grog royger gibbs +slmken Co-mentor: scottl, ambrisko snbdwmalone tychon neelCo-mentor: grehan versus gavin Co-mentor: fjoe ___ 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: r252214 - in stable/9: bin/chio sys/cam/scsi sys/sys
Author: ken Date: Tue Jun 25 21:43:49 2013 New Revision: 252214 URL: http://svnweb.freebsd.org/changeset/base/252214 Log: MFC: 249658, 249701 Update chio(1) and ch(4) to support reporting element designators. This allows mapping a tape drive in a changer (as reported by 'chio status') to a sa(4) driver instance by comparing the serial numbers. The designators can be ASCII (which is printed out directly), binary (which is printed in hex format) or UTF-8, which is printed in either native UTF-8 format if the terminal can support it, or in %XX notation for non-ASCII characters. Thanks to Hiroki Sato for the explanation and example UTF-8 printing code. chio.h: Modify the changer_element_status structure to add new fields and definitions from the SMC3r16 spec. Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and define a new CHIOGSTATUS ioctl. Clean up some tab/space issues. chio.c: For the 'status' subcommand, print the designator field if it is supplied by a device. scsi_ch.h:Add new flags for DVCID and CURDATA to the READ ELEMENT STATUS command structure. Add a read_element_status_device_id structure for the data fields in the new standard. Add new unions, dt_or_obsolete and voltage_devid, to hold and address data from either SCSI-2 or newer devices. scsi_ch.c:Implement support for fetching device IDs with READ ELEMENT STATUS data. Add new arguments to scsi_read_element_status() to allow the user to request the DVCID and CURDATA bits. This isn't compiled into libcam (it's only an internal kernel interface), so we don't need any special handling for the API change. If the user issues the new CHIOGSTATUS ioctl, copy all of the available element status data out. If he issues the OCHIOGSTATUS ioctl, we don't copy the new fields in the structure. Fix a bug in chopen() that would result in the peripheral never getting unheld if chgetparams() failed. Sponsored by: Spectra Logic Submitted by: Po-Li Soong Modified: stable/9/bin/chio/chio.c stable/9/sys/cam/scsi/scsi_ch.c stable/9/sys/cam/scsi/scsi_ch.h stable/9/sys/sys/chio.h Directory Properties: stable/9/ (props changed) stable/9/bin/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/bin/chio/chio.c == --- stable/9/bin/chio/chio.cTue Jun 25 21:34:21 2013(r252213) +++ stable/9/bin/chio/chio.cTue Jun 25 21:43:49 2013(r252214) @@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "defs.h" #include "pathnames.h" @@ -81,6 +83,7 @@ staticint do_status(const char *, int, static int do_ielem(const char *, int, char **); static int do_return(const char *, int, char **); static int do_voltag(const char *, int, char **); +static void print_designator(const char *, u_int8_t, u_int8_t); #ifndef CHET_VT #defineCHET_VT 10 /* Completely Arbitrary */ @@ -723,6 +726,10 @@ do_status(const char *cname, int argc, c putchar('?'); putchar('>'); } + if (ces->ces_designator_length > 0) + print_designator(ces->ces_designator, +ces->ces_code_set, +ces->ces_designator_length); putchar('\n'); } @@ -1177,3 +1184,66 @@ usage(void) "arg1 arg2 [arg3 [...]]\n", getprogname()); exit(1); } + +#defineUTF8CODESET "UTF-8" + +static void +print_designator(const char *designator, u_int8_t code_set, +u_int8_t designator_length) +{ + printf(" serial number: <"); + switch (code_set) { + case CES_CODE_SET_ASCII: { + /* +* The driver insures that the string is always NUL terminated. +*/ + printf("%s", designator); + break; + } + case CES_CODE_SET_UTF_8: { + char *cs_native; + + setlocale(LC_ALL, ""); + cs_native = nl_langinfo(CODESET); + + /* See if we can natively print UTF-8 */ + if (strcmp(cs_native, UTF8CODESET) == 0) + cs_native = NULL; + + if (cs_native == NULL) { + /* We can natively print UTF-8, so use printf. */ +
Re: svn commit: r252214 - in stable/9: bin/chio sys/cam/scsi sys/sys
On Tue, Jul 02, 2013 at 07:53:33 +0200, Andre Albsmeier wrote: > On Tue, 25-Jun-2013 at 23:43:50 +0200, Kenneth D. Merry wrote: > > Author: ken > > Date: Tue Jun 25 21:43:49 2013 > > New Revision: 252214 > > URL: http://svnweb.freebsd.org/changeset/base/252214 > > Hi Ken, > > > Log: > > MFC: 249658, 249701 > > > > Update chio(1) and ch(4) to support reporting element designators. > > > > This allows mapping a tape drive in a changer (as reported by > > 'chio status') to a sa(4) driver instance by comparing the > > serial numbers. > > > > The designators can be ASCII (which is printed out directly), binary > > (which is printed in hex format) or UTF-8, which is printed in either > > native UTF-8 format if the terminal can support it, or in %XX notation > > for non-ASCII characters. Thanks to Hiroki Sato for the > > explanation and example UTF-8 printing code. > > > > chio.h: Modify the changer_element_status structure to add > > new > > fields and definitions from the SMC3r16 spec. > > > > Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and > > define a new CHIOGSTATUS ioctl. > > > > Clean up some tab/space issues. > > > > chio.c: For the 'status' subcommand, print the designator field > > if it is supplied by a device. > > > > scsi_ch.h:Add new flags for DVCID and CURDATA to the READ > > ELEMENT STATUS command structure. > > > > Add a read_element_status_device_id structure > > for the data fields in the new standard. Add new > > unions, dt_or_obsolete and voltage_devid, to hold > > and address data from either SCSI-2 or newer devices. > > > > scsi_ch.c:Implement support for fetching device IDs with READ > > ELEMENT STATUS data. > > > > Add new arguments to scsi_read_element_status() to > > allow the user to request the DVCID and CURDATA bits. > > This broke "chio status" when talking to my QUALSTAR TLS-8211 library: > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): READ ELEMENT > STATUS. CDB: b8 10 fd e8 00 01 03 00 04 00 00 00 > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): CAM status: SCSI > Status Error > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): SCSI status: > Check Condition > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): SCSI sense: > ILLEGAL REQUEST asc:24,0 (Invalid field in CDB) > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): Command byte 6 > is invalid > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): Error 22, > Unretryable error > > scsi_cmd->flags (Byte 6) must be zero for this library so I had to use > this workaround to make it work again until a better solution is available: > > --- sys/cam/scsi/scsi_ch.c.ORI2013-06-26 13:38:54.0 +0200 > +++ sys/cam/scsi/scsi_ch.c2013-07-02 07:42:24.0 +0200 > @@ -1245,8 +1245,8 @@ >/* tag_action */ MSG_SIMPLE_Q_TAG, >/* voltag */ want_voltags, >/* sea */ softc->sc_firsts[chet], > - /* dvcid */ 1, > - /* curdata */ 1, > + /* dvcid */ 0, > + /* curdata */ 0, >/* count */ 1, >/* data_ptr */ data, >/* dxfer_len */ 1024, > @@ -1284,8 +1284,8 @@ >/* voltag */ want_voltags, >/* sea */ softc->sc_firsts[chet] >+ cesr->cesr_element_base, > - /* dvcid */ 1, > - /* curdata */ 1, > + /* dvcid */ 0, > + /* curdata */ 0, >/* count */ cesr->cesr_element_count, >/* data_ptr */ data, >/* dxfer_len */ size, > > -Andre Oops, sorry. We need to check the SCSI version to see whether to set those bits, and also fall back in case it doesn't work. I am on vacation and have very spotty net access. I can't do anything about it until I get back next week. Justin and Alan (CCed) can work on the fix, though. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r252214 - in stable/9: bin/chio sys/cam/scsi sys/sys
On Wed, Jul 03, 2013 at 07:43:49 +0200, Andre Albsmeier wrote: > On Wed, 03-Jul-2013 at 07:22:36 +0200, Kenneth D. Merry wrote: > > On Tue, Jul 02, 2013 at 07:53:33 +0200, Andre Albsmeier wrote: > > > On Tue, 25-Jun-2013 at 23:43:50 +0200, Kenneth D. Merry wrote: > > > > Author: ken > > > > Date: Tue Jun 25 21:43:49 2013 > > > > New Revision: 252214 > > > > URL: http://svnweb.freebsd.org/changeset/base/252214 > > > > > > Hi Ken, > > > > > > > Log: > > > > MFC: 249658, 249701 > > > > > > > > Update chio(1) and ch(4) to support reporting element designators. > > > > > > > > This allows mapping a tape drive in a changer (as reported by > > > > 'chio status') to a sa(4) driver instance by comparing the > > > > serial numbers. > > > > > > > > The designators can be ASCII (which is printed out directly), binary > > > > (which is printed in hex format) or UTF-8, which is printed in either > > > > native UTF-8 format if the terminal can support it, or in %XX notation > > > > for non-ASCII characters. Thanks to Hiroki Sato for the > > > > explanation and example UTF-8 printing code. > > > > > > > > chio.h: Modify the changer_element_status structure to > > > > add new > > > > fields and definitions from the SMC3r16 spec. > > > > > > > > Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and > > > > define a new CHIOGSTATUS ioctl. > > > > > > > > Clean up some tab/space issues. > > > > > > > > chio.c: For the 'status' subcommand, print the designator field > > > > if it is supplied by a device. > > > > > > > > scsi_ch.h:Add new flags for DVCID and CURDATA to the READ > > > > ELEMENT STATUS command structure. > > > > > > > > Add a read_element_status_device_id structure > > > > for the data fields in the new standard. Add new > > > > unions, dt_or_obsolete and voltage_devid, to hold > > > > and address data from either SCSI-2 or newer devices. > > > > > > > > scsi_ch.c:Implement support for fetching device IDs with READ > > > > ELEMENT STATUS data. > > > > > > > > Add new arguments to scsi_read_element_status() to > > > > allow the user to request the DVCID and CURDATA bits. > > > > > > This broke "chio status" when talking to my QUALSTAR TLS-8211 library: > > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): READ ELEMENT > > > STATUS. CDB: b8 10 fd e8 00 01 03 00 04 00 00 00 > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): CAM status: > > > SCSI Status Error > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): SCSI status: > > > Check Condition > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): SCSI sense: > > > ILLEGAL REQUEST asc:24,0 (Invalid field in CDB) > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): Command byte > > > 6 is invalid > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): Error 22, > > > Unretryable error > > > > > > scsi_cmd->flags (Byte 6) must be zero for this library so I had to use > > > this workaround to make it work again until a better solution is > > > available: > > > > > > --- sys/cam/scsi/scsi_ch.c.ORI2013-06-26 13:38:54.0 +0200 > > > +++ sys/cam/scsi/scsi_ch.c2013-07-02 07:42:24.0 +0200 > > > @@ -1245,8 +1245,8 @@ > > >/* tag_action */ MSG_SIMPLE_Q_TAG, > > >/* voltag */ want_voltags, > > >/* sea */ softc->sc_firsts[chet], > > > - /* dvcid */ 1, > > > - /* curdata */ 1, > > > + /* dvcid */ 0, > > > + /* curdata */ 0, > > >/* count */ 1, > > >/* data_ptr */ data, > > >/* dxfer_len */ 1024, > > > @@ -1284,8 +1284,8 @@ > > >/* voltag */ want
Re: svn commit: r252214 - in stable/9: bin/chio sys/cam/scsi sys/sys
On Wed, Jul 10, 2013 at 20:58:33 +0200, Andre Albsmeier wrote: > On Wed, 10-Jul-2013 at 20:49:15 +0200, Kenneth D. Merry wrote: > > On Wed, Jul 03, 2013 at 07:43:49 +0200, Andre Albsmeier wrote: > > > On Wed, 03-Jul-2013 at 07:22:36 +0200, Kenneth D. Merry wrote: > > > > On Tue, Jul 02, 2013 at 07:53:33 +0200, Andre Albsmeier wrote: > > > > > On Tue, 25-Jun-2013 at 23:43:50 +0200, Kenneth D. Merry wrote: > > > > > > Author: ken > > > > > > Date: Tue Jun 25 21:43:49 2013 > > > > > > New Revision: 252214 > > > > > > URL: http://svnweb.freebsd.org/changeset/base/252214 > > > > > > > > > > Hi Ken, > > > > > > > > > > > Log: > > > > > > MFC: 249658, 249701 > > > > > > > > > > > > Update chio(1) and ch(4) to support reporting element designators. > > > > > > > > > > > > This allows mapping a tape drive in a changer (as reported by > > > > > > 'chio status') to a sa(4) driver instance by comparing the > > > > > > serial numbers. > > > > > > > > > > > > The designators can be ASCII (which is printed out directly), > > > > > > binary > > > > > > (which is printed in hex format) or UTF-8, which is printed in > > > > > > either > > > > > > native UTF-8 format if the terminal can support it, or in %XX > > > > > > notation > > > > > > for non-ASCII characters. Thanks to Hiroki Sato for the > > > > > > explanation and example UTF-8 printing code. > > > > > > > > > > > > chio.h: Modify the changer_element_status structure > > > > > > to add new > > > > > > fields and definitions from the SMC3r16 spec. > > > > > > > > > > > > Rename the original CHIOGSTATUS ioctl to > > > > > > OCHIOGTATUS and > > > > > > define a new CHIOGSTATUS ioctl. > > > > > > > > > > > > Clean up some tab/space issues. > > > > > > > > > > > > chio.c: For the 'status' subcommand, print the designator > > > > > > field > > > > > > if it is supplied by a device. > > > > > > > > > > > > scsi_ch.h:Add new flags for DVCID and CURDATA to the READ > > > > > > ELEMENT STATUS command structure. > > > > > > > > > > > > Add a read_element_status_device_id structure > > > > > > for the data fields in the new standard. Add new > > > > > > unions, dt_or_obsolete and voltage_devid, to hold > > > > > > and address data from either SCSI-2 or newer > > > > > > devices. > > > > > > > > > > > > scsi_ch.c:Implement support for fetching device IDs with READ > > > > > > ELEMENT STATUS data. > > > > > > > > > > > > Add new arguments to scsi_read_element_status() to > > > > > > allow the user to request the DVCID and CURDATA > > > > > > bits. > > > > > > > > > > This broke "chio status" when talking to my QUALSTAR TLS-8211 library: > > > > > > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): READ > > > > > ELEMENT STATUS. CDB: b8 10 fd e8 00 01 03 00 04 00 00 00 > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): CAM > > > > > status: SCSI Status Error > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): SCSI > > > > > status: Check Condition > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): SCSI > > > > > sense: ILLEGAL REQUEST asc:24,0 (Invalid field in CDB) > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): Command > > > > > byte 6 is invalid > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): Error > > > > > 22, Unretryable error > > > > > > > > > > scsi_cmd->flags (Byte 6) must be zero for this library so I had to u
Re: svn commit: r252214 - in stable/9: bin/chio sys/cam/scsi sys/sys
On Thu, Jul 11, 2013 at 14:53:32 -0600, Kenneth D. Merry wrote: > On Wed, Jul 10, 2013 at 20:58:33 +0200, Andre Albsmeier wrote: > > On Wed, 10-Jul-2013 at 20:49:15 +0200, Kenneth D. Merry wrote: > > > On Wed, Jul 03, 2013 at 07:43:49 +0200, Andre Albsmeier wrote: > > > > On Wed, 03-Jul-2013 at 07:22:36 +0200, Kenneth D. Merry wrote: > > > > > On Tue, Jul 02, 2013 at 07:53:33 +0200, Andre Albsmeier wrote: > > > > > > On Tue, 25-Jun-2013 at 23:43:50 +0200, Kenneth D. Merry wrote: > > > > > > > Author: ken > > > > > > > Date: Tue Jun 25 21:43:49 2013 > > > > > > > New Revision: 252214 > > > > > > > URL: http://svnweb.freebsd.org/changeset/base/252214 > > > > > > > > > > > > Hi Ken, > > > > > > > > > > > > > Log: > > > > > > > MFC: 249658, 249701 > > > > > > > > > > > > > > Update chio(1) and ch(4) to support reporting element > > > > > > > designators. > > > > > > > > > > > > > > This allows mapping a tape drive in a changer (as reported by > > > > > > > 'chio status') to a sa(4) driver instance by comparing the > > > > > > > serial numbers. > > > > > > > > > > > > > > The designators can be ASCII (which is printed out directly), > > > > > > > binary > > > > > > > (which is printed in hex format) or UTF-8, which is printed in > > > > > > > either > > > > > > > native UTF-8 format if the terminal can support it, or in %XX > > > > > > > notation > > > > > > > for non-ASCII characters. Thanks to Hiroki Sato for the > > > > > > > explanation and example UTF-8 printing code. > > > > > > > > > > > > > > chio.h: Modify the changer_element_status > > > > > > > structure to add new > > > > > > > fields and definitions from the SMC3r16 spec. > > > > > > > > > > > > > > Rename the original CHIOGSTATUS ioctl to > > > > > > > OCHIOGTATUS and > > > > > > > define a new CHIOGSTATUS ioctl. > > > > > > > > > > > > > > Clean up some tab/space issues. > > > > > > > > > > > > > > chio.c: For the 'status' subcommand, print the designator > > > > > > > field > > > > > > > if it is supplied by a device. > > > > > > > > > > > > > > scsi_ch.h:Add new flags for DVCID and CURDATA to the READ > > > > > > > ELEMENT STATUS command structure. > > > > > > > > > > > > > > Add a read_element_status_device_id structure > > > > > > > for the data fields in the new standard. Add new > > > > > > > unions, dt_or_obsolete and voltage_devid, to hold > > > > > > > and address data from either SCSI-2 or newer > > > > > > > devices. > > > > > > > > > > > > > > scsi_ch.c:Implement support for fetching device IDs with > > > > > > > READ > > > > > > > ELEMENT STATUS data. > > > > > > > > > > > > > > Add new arguments to scsi_read_element_status() to > > > > > > > allow the user to request the DVCID and CURDATA > > > > > > > bits. > > > > > > > > > > > > This broke "chio status" when talking to my QUALSTAR TLS-8211 > > > > > > library: > > > > > > > > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): READ > > > > > > ELEMENT STATUS. CDB: b8 10 fd e8 00 01 03 00 04 00 00 00 > > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): CAM > > > > > > status: SCSI Status Error > > > > > > Jul 2 07:08:22 server kernel: (ch0:ahd3:0:1:0): SCSI > > > > > > status: Check Condition > > > > > > Jul 2 07:08:22 server ker
svn commit: r253274 - head/sys/cam/scsi
Author: ken Date: Fri Jul 12 17:09:50 2013 New Revision: 253274 URL: http://svnweb.freebsd.org/changeset/base/253274 Log: Fix a problem with READ ELEMENT STATUS that occurs on some changers that don't support the DVCID and CURDATA bits that were introduced in the SMC spec. These changers will return an Illegal Request type error if the bits are set. This causes "chio status" to fail. The fix is two-fold. First, for changers that claim to be SCSI-2 or older, don't set the DVCID and CURDATA bits for READ ELEMENT STATUS. For newer changers (SCSI-3 and newer), we default to setting the new bits, but back off and try the READ ELEMENT STATUS without the bits if we get an Illegal Request type error. This has been tested on a Qualstar TLS-8211, which is a SCSI-2 changer that does not support the new bits, and a Spectra T-380, which is a SCSI-3 changer that does support the new bits. In the absence of a SCSI-3 changer that does not support the bits, I tested that with some error injection code. (The SMC spec says that support for CURDATA is mandatory, and DVCID is optional.) scsi_ch.c:Add a new quirk, CH_Q_NO_DVCID that gets set for SCSI-2 and older libraries, or newer libraries that report errors when the DVCID/CURDATA bits are set. In chgetelemstatus(), use the new quirk to determine whether or not to set DVCID and CURDATA. If we get an error with the bits set, back off and try without the bits. Set the quirk flag if the read element status succeeds without the bits set. Increase the READ ELEMENT STATUS timeout to 60 seconds after testing with a Spectra T-380. The previous value was 10 seconds, and too short for the T-380. This may be decreased later after some additional testing and investigation. Tested by:Andre Albsmeier Sponsored by: Spectra Logic MFC after:3 days Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c == --- head/sys/cam/scsi/scsi_ch.c Fri Jul 12 16:41:58 2013(r253273) +++ head/sys/cam/scsi/scsi_ch.c Fri Jul 12 17:09:50 2013(r253274) @@ -102,7 +102,7 @@ static const u_int32_t CH_TIMEOUT_MODE_S static const u_int32_t CH_TIMEOUT_MOVE_MEDIUM = 10; static const u_int32_t CH_TIMEOUT_EXCHANGE_MEDIUM = 10; static const u_int32_t CH_TIMEOUT_POSITION_TO_ELEMENT = 10; -static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS = 1; +static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS = 6; static const u_int32_t CH_TIMEOUT_SEND_VOLTAG = 1; static const u_int32_t CH_TIMEOUT_INITIALIZE_ELEMENT_STATUS = 50; @@ -122,12 +122,14 @@ typedef enum { typedef enum { CH_Q_NONE = 0x00, - CH_Q_NO_DBD = 0x01 + CH_Q_NO_DBD = 0x01, + CH_Q_NO_DVCID = 0x02 } ch_quirks; #define CH_Q_BIT_STRING\ "\020" \ - "\001NO_DBD" + "\001NO_DBD"\ + "\002NO_DVCID" #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -396,6 +398,14 @@ chregister(struct cam_periph *periph, vo periph->softc = softc; softc->quirks = CH_Q_NONE; + /* +* The DVCID and CURDATA bits were not introduced until the SMC +* spec. If this device claims SCSI-2 or earlier support, then it +* very likely does not support these bits. +*/ + if (cgd->inq_data.version <= SCSI_REV_2) + softc->quirks |= CH_Q_NO_DVCID; + bzero(&cpi, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cpi.ccb_h.func_code = XPT_PATH_INQ; @@ -1208,6 +1218,8 @@ chgetelemstatus(struct cam_periph *perip caddr_t data = NULL; size_t size, desclen; int avail, i, error = 0; + int curdata, dvcid, sense_flags; + int try_no_dvcid = 0; struct changer_element_status *user_data = NULL; struct ch_softc *softc; union ccb *ccb; @@ -1239,14 +1251,31 @@ chgetelemstatus(struct cam_periph *perip cam_periph_lock(periph); ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); + sense_flags = SF_RETRY_UA; + if (softc->quirks & CH_Q_NO_DVCID) { + dvcid = 0; + curdata = 0; + } else { + dvcid = 1; + curdata = 1; + /* +* Don't print anything for an Illegal Request, because +* these flags can cause some changers to complain. We'll +* retry without them if we get an error. +*/ + sense_flags |= SF_QUIET_IR; + } + +retry_einval: + scsi_read_element_status(&cc
Re: svn commit: r252214 - in stable/9: bin/chio sys/cam/scsi sys/sys
On Fri, Jul 12, 2013 at 07:39:50 +0200, Andre Albsmeier wrote: > On Fri, 12-Jul-2013 at 00:02:11 +0200, Kenneth D. Merry wrote: > > On Thu, Jul 11, 2013 at 14:53:32 -0600, Kenneth D. Merry wrote: > > > On Wed, Jul 10, 2013 at 20:58:33 +0200, Andre Albsmeier wrote: > > > > On Wed, 10-Jul-2013 at 20:49:15 +0200, Kenneth D. Merry wrote: > > > > > On Wed, Jul 03, 2013 at 07:43:49 +0200, Andre Albsmeier wrote: > > > > > > On Wed, 03-Jul-2013 at 07:22:36 +0200, Kenneth D. Merry wrote: > > > > > > > On Tue, Jul 02, 2013 at 07:53:33 +0200, Andre Albsmeier wrote: > > > > > > > > On Tue, 25-Jun-2013 at 23:43:50 +0200, Kenneth D. Merry wrote: > > > > > > > > > Author: ken > > > > > > > > > Date: Tue Jun 25 21:43:49 2013 > > > > > > > > > New Revision: 252214 > > > > > > > > > URL: http://svnweb.freebsd.org/changeset/base/252214 > > > > > > > > > > > > > > > > Hi Ken, > > > > > > > > > > > > > > > > > Log: > > > > > > > > > MFC: 249658, 249701 > > > > > > > > > > > > > > > > > > Update chio(1) and ch(4) to support reporting element > > > > > > > > > designators. > > > > > > > > > > > > > > > > > > This allows mapping a tape drive in a changer (as reported > > > > > > > > > by > > > > > > > > > 'chio status') to a sa(4) driver instance by comparing the > > > > > > > > > serial numbers. > > > > > > > > > > > > > > > > > > The designators can be ASCII (which is printed out > > > > > > > > > directly), binary > > > > > > > > > (which is printed in hex format) or UTF-8, which is printed > > > > > > > > > in either > > > > > > > > > native UTF-8 format if the terminal can support it, or in > > > > > > > > > %XX notation > > > > > > > > > for non-ASCII characters. Thanks to Hiroki Sato for > > > > > > > > > the > > > > > > > > > explanation and example UTF-8 printing code. > > > > > > > > > > > > > > > > > > chio.h: Modify the changer_element_status > > > > > > > > > structure to add new > > > > > > > > > fields and definitions from the SMC3r16 spec. > > > > > > > > > > > > > > > > > > Rename the original CHIOGSTATUS ioctl to > > > > > > > > > OCHIOGTATUS and > > > > > > > > > define a new CHIOGSTATUS ioctl. > > > > > > > > > > > > > > > > > > Clean up some tab/space issues. > > > > > > > > > > > > > > > > > > chio.c: For the 'status' subcommand, print the > > > > > > > > > designator field > > > > > > > > > if it is supplied by a device. > > > > > > > > > > > > > > > > > > scsi_ch.h:Add new flags for DVCID and CURDATA to the > > > > > > > > > READ > > > > > > > > > ELEMENT STATUS command structure. > > > > > > > > > > > > > > > > > > Add a read_element_status_device_id structure > > > > > > > > > for the data fields in the new standard. Add > > > > > > > > > new > > > > > > > > > unions, dt_or_obsolete and voltage_devid, to > > > > > > > > > hold > > > > > > > > > and address data from either SCSI-2 or newer > > > > > > > > > devices. > > > > > > > > > > > > > > > > > > scsi_ch.c:Implement support for fetching device IDs > > > > > > > > > with READ > > > > > > > > > ELEMENT STATUS data. > > > > > >
svn commit: r253368 - head/sys/cam/scsi
Author: ken Date: Mon Jul 15 16:38:48 2013 New Revision: 253368 URL: http://svnweb.freebsd.org/changeset/base/253368 Log: Fix an argument reversal in calls to scsi_read_element_status(). Reported by: Ulrich Spoerlein MFC after:3 days Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c == --- head/sys/cam/scsi/scsi_ch.c Mon Jul 15 15:40:57 2013(r253367) +++ head/sys/cam/scsi/scsi_ch.c Mon Jul 15 16:38:48 2013(r253368) @@ -1274,8 +1274,8 @@ retry_einval: /* tag_action */ MSG_SIMPLE_Q_TAG, /* voltag */ want_voltags, /* sea */ softc->sc_firsts[chet], -/* dvcid */ dvcid, /* curdata */ curdata, +/* dvcid */ dvcid, /* count */ 1, /* data_ptr */ data, /* dxfer_len */ 1024, @@ -1342,8 +1342,8 @@ retry_einval: /* voltag */ want_voltags, /* sea */ softc->sc_firsts[chet] + cesr->cesr_element_base, -/* dvcid */ dvcid, /* curdata */ curdata, +/* dvcid */ dvcid, /* count */ cesr->cesr_element_count, /* data_ptr */ data, /* dxfer_len */ size, ___ 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: r253274 - head/sys/cam/scsi
On Mon, Jul 15, 2013 at 17:14:00 +0200, Ulrich Sp??rlein wrote: > On Fri, 2013-07-12 at 17:09:50 +0000, Kenneth D. Merry wrote: > > Author: ken > > Date: Fri Jul 12 17:09:50 2013 > > New Revision: 253274 > > URL: http://svnweb.freebsd.org/changeset/base/253274 > > > > Log: > > Fix a problem with READ ELEMENT STATUS that occurs on some > > changers that don't support the DVCID and CURDATA bits that were > > introduced in the SMC spec. > > > > These changers will return an Illegal Request type error if the > > bits are set. This causes "chio status" to fail. > > > > The fix is two-fold. First, for changers that claim to be SCSI-2 > > or older, don't set the DVCID and CURDATA bits for READ ELEMENT > > STATUS. For newer changers (SCSI-3 and newer), we default to > > setting the new bits, but back off and try the READ ELEMENT STATUS > > without the bits if we get an Illegal Request type error. > > > > This has been tested on a Qualstar TLS-8211, which is a SCSI-2 > > changer that does not support the new bits, and a Spectra T-380, > > which is a SCSI-3 changer that does support the new bits. In the > > absence of a SCSI-3 changer that does not support the bits, I > > tested that with some error injection code. (The SMC spec says > > that support for CURDATA is mandatory, and DVCID is optional.) > > > > scsi_ch.c:Add a new quirk, CH_Q_NO_DVCID that gets set for > > SCSI-2 and older libraries, or newer libraries that > > report errors when the DVCID/CURDATA bits are set. > > > > In chgetelemstatus(), use the new quirk to > > determine whether or not to set DVCID and CURDATA. > > If we get an error with the bits set, back off and > > try without the bits. Set the quirk flag if the > > read element status succeeds without the bits set. > > > > Increase the READ ELEMENT STATUS timeout to 60 > > seconds after testing with a Spectra T-380. The > > previous value was 10 seconds, and too short for > > the T-380. This may be decreased later after > > some additional testing and investigation. > > > > Tested by:Andre Albsmeier > > Sponsored by: Spectra Logic > > MFC after:3 days > > > > Modified: > > head/sys/cam/scsi/scsi_ch.c > > > > Modified: head/sys/cam/scsi/scsi_ch.c > > == > > --- head/sys/cam/scsi/scsi_ch.c Fri Jul 12 16:41:58 2013 > > (r253273) > > +++ head/sys/cam/scsi/scsi_ch.c Fri Jul 12 17:09:50 2013 > > (r253274) > > @@ -1284,8 +1342,8 @@ chgetelemstatus(struct cam_periph *perip > > /* voltag */ want_voltags, > > /* sea */ softc->sc_firsts[chet] > > + cesr->cesr_element_base, > > -/* dvcid */ 1, > > -/* curdata */ 1, > > +/* dvcid */ dvcid, > > +/* curdata */ curdata, > > /* count */ cesr->cesr_element_count, > > /* data_ptr */ data, > > /* dxfer_len */ size, > > Are you sure? Coverity flags this as being in the wrong argument order > (there's no CID for this yet). > > CID null (#2 of 2): Arguments in wrong order (SWAPPED_ARGUMENTS) > swapped_arguments: The positions of arguments curdata and dvcid are > inconsistent with the positions of the corresponding parameters for > "scsi_read_element_status(struct ccb_scsiio *, u_int32_t, void (*)(struct > cam_periph *, union ccb *), u_int8_t, int, u_int32_t, int, int, u_int32_t, > u_int8_t *, u_int32_t, u_int8_t, u_int32_t)". [show details] > 1338scsi_read_element_status(&ccb->csio, > 1339 /* retries */ 1, > 1340 /* cbfcnp */ chdone, > 1341 /* tag_action */ MSG_SIMPLE_Q_TAG, > 1342 /* voltag */ want_voltags, > 1343 /* sea */ softc->sc_firsts[chet] > 1344 + cesr->cesr_element_base, > 1345 /* dvcid */ dvcid, > 1346 /* curdata */ curdata, > 1347
svn commit: r253369 - stable/9/sys/cam/scsi
Author: ken Date: Mon Jul 15 18:02:26 2013 New Revision: 253369 URL: http://svnweb.freebsd.org/changeset/base/253369 Log: MFC r253274 and r253368: r253274 | ken | 2013-07-12 11:09:50 -0600 (Fri, 12 Jul 2013) | 40 lines Fix a problem with READ ELEMENT STATUS that occurs on some changers that don't support the DVCID and CURDATA bits that were introduced in the SMC spec. These changers will return an Illegal Request type error if the bits are set. This causes "chio status" to fail. The fix is two-fold. First, for changers that claim to be SCSI-2 or older, don't set the DVCID and CURDATA bits for READ ELEMENT STATUS. For newer changers (SCSI-3 and newer), we default to setting the new bits, but back off and try the READ ELEMENT STATUS without the bits if we get an Illegal Request type error. This has been tested on a Qualstar TLS-8211, which is a SCSI-2 changer that does not support the new bits, and a Spectra T-380, which is a SCSI-3 changer that does support the new bits. In the absence of a SCSI-3 changer that does not support the bits, I tested that with some error injection code. (The SMC spec says that support for CURDATA is mandatory, and DVCID is optional.) scsi_ch.c: Add a new quirk, CH_Q_NO_DVCID that gets set for SCSI-2 and older libraries, or newer libraries that report errors when the DVCID/CURDATA bits are set. In chgetelemstatus(), use the new quirk to determine whether or not to set DVCID and CURDATA. If we get an error with the bits set, back off and try without the bits. Set the quirk flag if the read element status succeeds without the bits set. Increase the READ ELEMENT STATUS timeout to 60 seconds after testing with a Spectra T-380. The previous value was 10 seconds, and too short for the T-380. This may be decreased later after some additional testing and investigation. Tested by: Andre Albsmeier Sponsored by: Spectra Logic r253368 | ken | 2013-07-15 10:38:48 -0600 (Mon, 15 Jul 2013) | 5 lines Fix an argument reversal in calls to scsi_read_element_status(). Reported by:Ulrich Spoerlein Approved by: re (kib) Modified: stable/9/sys/cam/scsi/scsi_ch.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_ch.c == --- stable/9/sys/cam/scsi/scsi_ch.c Mon Jul 15 16:38:48 2013 (r253368) +++ stable/9/sys/cam/scsi/scsi_ch.c Mon Jul 15 18:02:26 2013 (r253369) @@ -102,7 +102,7 @@ static const u_int32_t CH_TIMEOUT_MODE_S static const u_int32_t CH_TIMEOUT_MOVE_MEDIUM = 10; static const u_int32_t CH_TIMEOUT_EXCHANGE_MEDIUM = 10; static const u_int32_t CH_TIMEOUT_POSITION_TO_ELEMENT = 10; -static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS = 1; +static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS = 6; static const u_int32_t CH_TIMEOUT_SEND_VOLTAG = 1; static const u_int32_t CH_TIMEOUT_INITIALIZE_ELEMENT_STATUS = 50; @@ -122,12 +122,14 @@ typedef enum { typedef enum { CH_Q_NONE = 0x00, - CH_Q_NO_DBD = 0x01 + CH_Q_NO_DBD = 0x01, + CH_Q_NO_DVCID = 0x02 } ch_quirks; #define CH_Q_BIT_STRING\ "\020" \ - "\001NO_DBD" + "\001NO_DBD"\ + "\002NO_DVCID" #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -396,6 +398,14 @@ chregister(struct cam_periph *periph, vo periph->softc = softc; softc->quirks = CH_Q_NONE; + /* +* The DVCID and CURDATA bits were not introduced until the SMC +* spec. If this device claims SCSI-2 or earlier support, then it +* very likely does not support these bits. +*/ + if (cgd->inq_data.version <= SCSI_REV_2) + softc->quirks |= CH_Q_NO_DVCID; + bzero(&cpi, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cpi.ccb_h.func_code = XPT_PATH_INQ; @@ -1208,6 +1218,8 @@ chgetelemstatus(struct cam_periph *perip caddr_t data = NULL; size_t size, desclen; int avail, i, error = 0; + int curdata, dvcid, sense_flags; + int try_no_dvcid = 0; struct changer_element_status *user_data = NULL; struct ch_softc *softc; union ccb *ccb; @@ -1239,14 +1251,31 @@ chgetelemstatus(struct cam_periph *perip cam_periph_lock(periph); ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); + sense_flags = SF_RETRY_UA; + if (softc->
svn commit: r253550 - head/sys/dev/mps
Author: ken Date: Mon Jul 22 18:41:53 2013 New Revision: 253550 URL: http://svnweb.freebsd.org/changeset/base/253550 Log: Merge in phase 14+ -> 16 mps driver fixes from LSI: --- System panics during a Port reset with ouststanding I/O --- It is possible to call mps_mapping_free_memory after this memory is already freed, causing a panic. Removed this extra call to mps_mappiing_free_memory and call mps_mapping_exit in place of the mps_mapping_free_memory call so that any outstanding mapping items can be flushed before memory is freed. --- Correct memory leak during a Port reset with ouststanding I/O --- In mps_reinit function, the mapping memory was not being freed before being re-allocated. Added line to call the memory free function for mapping memory. --- Use CAM_SIM_QUEUED flag in Driver IO path. --- This flag informs the XPT that successful abort of a CCB requires an abort ccb to be issued to the SIM. While processing SCSI IO's, set the CAM_SIM_QUEUED flag in the status for the IO. When the command completes, clear this flag. --- Check for CAM_REQ_INPROG in I/O path. --- Added a check in mpssas_action_scsiio for the In Progress status for the IO. If this flag is set, the IO has already been aborted by the upper layer (before CAM_SIM_QUEUED was set) and there is no need to send the IO. The request will be completed without error. --- Improve "doorbell handshake method" for mps_get_iocfacts --- Removed call to get Port Facts since this information is not used currently. Added mps_iocfacts_allocate function to allocate memory that is based on IOC Facts data. Added mps_iocfacts_free function to free memory that is based on IOC Facts data. Both of the functions are used when a Diag Reset is performed or when the driver is attached/detached. This is needed in case IOC Facts changes after a Diag Reset, which could happen if FW is upgraded. Moved call of mps_bases_static_config_pages from the attach routine to after the IOC is ready to process accesses based on the new memory allocations (instead of polling through the Doorbell). --- Set TimeStamp in INIT message in millisecond format Set the IOC --- --- Prefer mps_wait_command to mps_request_polled --- Instead of using mps_request_polled, call mps_wait_command whenever possible. Change the mps_wait_command function to check the current context and either use interrupt context or poll if required by using the pause or DELAY function. Added a check after waiting 50mSecs to see if the command has timed out. This is only done if polliing, the msleep command will automatically timeout if the command has taken too long to complete. --- Integrated RAID: Volume Activation Failed error message is displayed though the volume has been activated. --- Instead of failing an IOCTL request that does not have a large enough buffer to hold the complete reply, copy as much data from the reply as possible into the user's buffer and log a message saying that the user's buffer was smaller than the returned data. --- mapping_add_new_device failure due to persistent table FULL --- When a new device is added, if it is determined that the device persistent table is being used and is full, instead of displaying a message for this condition every time, only log a message if the MPS_INFO bit is set in the debug_flags. Submitted by: LSI MFC after:1 week Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_config.c head/sys/dev/mps/mps_mapping.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mps_user.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mps/mps.c == --- head/sys/dev/mps/mps.c Mon Jul 22 18:37:07
svn commit: r253549 - in head/sys: cam dev/mps sys
Author: ken Date: Mon Jul 22 18:37:07 2013 New Revision: 253549 URL: http://svnweb.freebsd.org/changeset/base/253549 Log: CAM and mps(4) driver scanning changes. Add a PIM_NOSCAN flag to the CAM path inquiry CCB. This tells CAM not to perform a rescan on a bus when it is registered. We now use this flag in the mps(4) driver. Since it knows what devices it has attached, it is more efficient for it to just issue a target rescan on the targets that are attached. Also, remove the private rescan thread from the mps(4) driver in favor of the rescan thread already built into CAM. Without this change, but with the change above, the MPS scanner could run before or during CAM's initial setup, which would cause duplicate device reprobes and announcements. sys/param.h: Bump __FreeBSD_version to 139 for the inclusion of the PIM_RESCAN CAM path inquiry flag. sys/cam/cam_ccb.h: sys/cam/cam_xpt.c: Added a PIM_NOSCAN flag. If a SIM sets this in the path inquiry ccb, then CAM won't rescan the bus in xpt_bus_regsister. sys/dev/mps/mps_sas.c For versions of FreeBSD that have the PIM_NOSCAN path inquiry flag, don't freeze the sim queue during scanning, because CAM won't be scanning this bus. Instead, hold up the boot. Don't call mpssas_rescan_target in mpssas_startup_decrement; it's redundant and I don't know why it was in there. Set PIM_NOSCAN in path inquiry CCBs. Remove methods related to the internal rescan daemon. Always use async events to trigger a probe for EEDP support. In older versions of FreeBSD where AC_ADVINFO_CHANGED is not available, use AC_FOUND_DEVICE and issue the necessary READ CAPACITY manually. Provide a path to xpt_register_async() so that we only receive events for our own SCSI domain. Improve error reporting in cases where setup for EEDP detection fails. sys/dev/mps/mps_sas.h: Remove softc flags and data related to the scanner thread. sys/dev/mps/mps_sas_lsi.c: Unconditionally rescan the target whenever a device is added. Sponsored by: Spectra Logic MFC after:1 week Modified: head/sys/cam/cam_ccb.h head/sys/cam/cam_xpt.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/sys/param.h Modified: head/sys/cam/cam_ccb.h == --- head/sys/cam/cam_ccb.h Mon Jul 22 18:18:21 2013(r253548) +++ head/sys/cam/cam_ccb.h Mon Jul 22 18:37:07 2013(r253549) @@ -571,6 +571,7 @@ typedef enum { PIM_NO_6_BYTE = 0x08, /* Do not send 6-byte commands */ PIM_SEQSCAN = 0x04, /* Do bus scans sequentially, not in parallel */ PIM_UNMAPPED= 0x02, + PIM_NOSCAN = 0x01 /* SIM does its own scanning */ } pi_miscflag; /* Path Inquiry CCB */ Modified: head/sys/cam/cam_xpt.c == --- head/sys/cam/cam_xpt.c Mon Jul 22 18:18:21 2013(r253548) +++ head/sys/cam/cam_xpt.c Mon Jul 22 18:37:07 2013(r253549) @@ -3895,18 +3895,23 @@ xpt_bus_register(struct cam_sim *sim, de /* Notify interested parties */ if (sim->path_id != CAM_XPT_PATH_ID) { - union ccb *scan_ccb; xpt_async(AC_PATH_REGISTERED, path, &cpi); - /* Initiate bus rescan. */ - scan_ccb = xpt_alloc_ccb_nowait(); - if (scan_ccb != NULL) { - scan_ccb->ccb_h.path = path; - scan_ccb->ccb_h.func_code = XPT_SCAN_BUS; - scan_ccb->crcn.flags = 0; - xpt_rescan(scan_ccb); + if ((cpi.hba_misc & PIM_NOSCAN) == 0) { + union ccb *scan_ccb; + + /* Initiate bus rescan. */ + scan_ccb = xpt_alloc_ccb_nowait(); + if (scan_ccb != NULL) { + scan_ccb->ccb_h.path = path; + scan_ccb->ccb_h.func_code = XPT_SCAN_BUS; + scan_ccb->crcn.flags = 0; + xpt_rescan(scan_ccb); + } else + xpt_print(path, + "Can't allocate CCB to scan bus\n"); } else - xpt_print(path, "Can't allocate CCB to scan bus\n"); + xpt_free_path(path); } else xpt_free_path(path); return (CAM_SUCCESS); Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Mon Jul 22 18:18:21 2013(r253548) +++ head/
Re: svn commit: r247814 - in head: . sys/amd64/conf sys/cam/ctl sys/conf sys/i386/conf
On Wed, Mar 13, 2013 at 22:09:51 +0100, Pawel Jakub Dawidek wrote: > On Wed, Mar 13, 2013 at 11:08:26AM -0400, John Baldwin wrote: > > On Tuesday, March 12, 2013 5:09:21 pm Pawel Jakub Dawidek wrote: > > > On Mon, Mar 04, 2013 at 09:18:45PM +, Kenneth D. Merry wrote: > > > > Author: ken > > > > Date: Mon Mar 4 21:18:45 2013 > > > > New Revision: 247814 > > > > URL: http://svnweb.freebsd.org/changeset/base/247814 > > > > > > > > Log: > > > > Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL > > > > disable > > > > tunable by default. > > > > > > > > This will allow GENERIC configurations to boot on small memory boxes, > > > > but > > > > not require end users who want to use CTL to recompile their kernel. > > > > They > > > > can simply set kern.cam.ctl.disable=0 in loader.conf. > > > > > > Could you rename it to kern.cam.ctl.enable(d)? There was discussion at > > > some point about sysctl/tunable names and the consensus was, AFAIR, to > > > use positive(?) names as they are more obvious. > > > > Except that all the hints we use for devices are hint.foo.X.disable=1 :) > > Well we have many sysctls too, but would be nice not to introduce new ones. This particular sysctl/tunable is not new. It was in 9.1. My concern with changing it is that it will lead to surprises for users who already have it set. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r248916 - svnadmin/conf
Author: ken Date: Fri Mar 29 21:09:00 2013 New Revision: 248916 URL: http://svnweb.freebsd.org/changeset/base/248916 Log: Release Will into the wild. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Fri Mar 29 21:08:20 2013(r248915) +++ svnadmin/conf/mentors Fri Mar 29 21:09:00 2013(r248916) @@ -33,4 +33,3 @@ peterjjhb Co-mentor: grog smhpjd Co-mentor: avg snbdwmalone versus gavin Co-mentor: fjoe -will ken ___ 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: r249025 - head/sys/kern
Author: ken Date: Tue Apr 2 16:49:49 2013 New Revision: 249025 URL: http://svnweb.freebsd.org/changeset/base/249025 Log: Add support for XPT_CONT_TARGET_IO CCBs in _bus_dmamap_load_ccb(). Declare CCB types in their respective switch blocks. Sponsored by: Spectra Logic Modified: head/sys/kern/subr_bus_dma.c Modified: head/sys/kern/subr_bus_dma.c == --- head/sys/kern/subr_bus_dma.cTue Apr 2 14:27:44 2013 (r249024) +++ head/sys/kern/subr_bus_dma.cTue Apr 2 16:49:49 2013 (r249025) @@ -158,8 +158,6 @@ static int _bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb, int *nsegs, int flags) { - struct ccb_ataio *ataio; - struct ccb_scsiio *csio; struct ccb_hdr *ccb_h; void *data_ptr; int error; @@ -169,18 +167,33 @@ _bus_dmamap_load_ccb(bus_dma_tag_t dmat, error = 0; ccb_h = &ccb->ccb_h; switch (ccb_h->func_code) { - case XPT_SCSI_IO: + case XPT_SCSI_IO: { + struct ccb_scsiio *csio; + csio = &ccb->csio; data_ptr = csio->data_ptr; dxfer_len = csio->dxfer_len; sglist_cnt = csio->sglist_cnt; break; - case XPT_ATA_IO: + } + case XPT_CONT_TARGET_IO: { + struct ccb_scsiio *ctio; + + ctio = &ccb->ctio; + data_ptr = ctio->data_ptr; + dxfer_len = ctio->dxfer_len; + sglist_cnt = ctio->sglist_cnt; + break; + } + case XPT_ATA_IO: { + struct ccb_ataio *ataio; + ataio = &ccb->ataio; data_ptr = ataio->data_ptr; dxfer_len = ataio->dxfer_len; sglist_cnt = 0; break; + } default: panic("_bus_dmamap_load_ccb: Unsupported func code %d", ccb_h->func_code); ___ 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: r249028 - head/sys/cam/ctl
Author: ken Date: Tue Apr 2 17:29:17 2013 New Revision: 249028 URL: http://svnweb.freebsd.org/changeset/base/249028 Log: Fix sending virtual scatter/gather lists from the CTL CAM frontend peripheral. Sponsored by: Spectra Logic Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c == --- head/sys/cam/ctl/scsi_ctl.c Tue Apr 2 17:11:07 2013(r249027) +++ head/sys/cam/ctl/scsi_ctl.c Tue Apr 2 17:29:17 2013(r249028) @@ -916,7 +916,7 @@ ctlfestart(struct cam_periph *periph, un if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR) flags |= CAM_DATA_SG_PADDR; else - flags &= ~CAM_DATA_SG; + flags |= CAM_DATA_SG; data_ptr = (uint8_t *)cam_sglist; dxfer_len = io->scsiio.kern_data_len; } else { @@ -938,6 +938,10 @@ ctlfestart(struct cam_periph *periph, un data_ptr = sglist[*ti].addr; dxfer_len = sglist[*ti].len; csio->sglist_cnt = 0; + if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR) + flags |= CAM_DATA_PADDR; + else + flags |= CAM_DATA_VADDR; cmd_info->flags |= CTLFE_CMD_PIECEWISE; (*ti)++; } ___ 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: r249167 - stable/9/sys/cam/ctl
Author: ken Date: Fri Apr 5 19:33:31 2013 New Revision: 249167 URL: http://svnweb.freebsd.org/changeset/base/249167 Log: MFC r244052 and r245288: r244052 | ken | 2012-12-09 12:53:21 -0700 (Sun, 09 Dec 2012) | 20 lines Fix a couple of CTL locking issues and clean up some duplicated code. ctl_frontend_cam_sim.c: Coalesce cfcs_online() and cfcs_offline() into a single function since these were identical except for one line. Make sure we hold the SIM lock around path creation, and calling xpt_rescan(). scsi_ctl.c: In ctlfe_onoffline(), make sure we hold the SIM lock around path creation and free calls, as well as xpt_action(). In ctlfe_lun_enable(), hold the SIM lock around path and peripheral operations that require it. Sponsored by: Spectra Logic Corporation MFC after: 1 week r245228 | ken | 2013-01-09 10:02:08 -0700 (Wed, 09 Jan 2013) | 43 lines Make CTL work a little better with loading and unloading drivers. Previously CTL would leave individual LUNs enabled in the target driver, whether or not the port as a whole was enabled. It would also leave the wildcard LUN enabled indefinitely. This change means that CTL will enable and disable any active LUNs, as well as the wildcard LUN, when enabling and disabling a port. Also, fix a bug that could crop up due to an uninitialized CCB type. ctl.c: Before calling ctl_frontend_online(), run through the LUN list and enable all active LUNs. After calling ctl_frontend_offline(), run through the LUN list and disble all active LUNs. scsi_ctl.c: Before bringing a port online, allocate the wildcard peripheral for that bus. And after taking a port offline, invalidate the wildcard peripheral for that bus. Make sure that we hold the SIM lock around all calls to xpt_action() and other transport layer interfaces that require it. Use CAM_SIM_{LOCK|UNLOCK} consistently to acquire and release the SIM lock. Update a number of outdated comments. Some of these should have been fixed long ago. Actually do LUN disbables now. The newer drivers in the tree work correctly for this as far as I know. Initialize the CCB type to CTLFE_CCB_DEFAULT to avoid a panic due to uninitialized memory. Submitted by: Chuck Tuffli (partially) MFC after: 1 week Modified: stable/9/sys/cam/ctl/ctl.c stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c stable/9/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/ctl.c == --- stable/9/sys/cam/ctl/ctl.c Fri Apr 5 18:09:43 2013(r249166) +++ stable/9/sys/cam/ctl/ctl.c Fri Apr 5 19:33:31 2013(r249167) @@ -2263,11 +2263,31 @@ ctl_ioctl(struct cdev *dev, u_long cmd, */ mtx_unlock(&softc->ctl_lock); - if (cmd == CTL_ENABLE_PORT) + if (cmd == CTL_ENABLE_PORT) { + struct ctl_lun *lun; + + STAILQ_FOREACH(lun, &softc->lun_list, + links) { + fe->lun_enable(fe->targ_lun_arg, + lun->target, + lun->lun); + } + ctl_frontend_online(fe); - else if (cmd == CTL_DISABLE_PORT) + } else if (cmd == CTL_DISABLE_PORT) { + struct ctl_lun *lun; + ctl_frontend_offline(fe); + STAILQ_FOREACH(lun, &softc->lun_list, + links) { + fe->lun_disable( + fe->targ_lun_arg, + lun->target, + lun->lun); + } + } + mtx_lock(&
svn commit: r249256 - head/sys/cam/ctl
Author: ken Date: Mon Apr 8 15:36:26 2013 New Revision: 249256 URL: http://svnweb.freebsd.org/changeset/base/249256 Log: Fix a memory leak that showed up when we delete LUNs. The memory used for the LUN was never freed. ctl.c:Adjust ctl_alloc_lun() to make sure we don't clear the CTL_LUN_MALLOCED flag. Reported by: Sreenivasa Honnur Sponsored by: Spectra Logic MFC after:3 days Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Mon Apr 8 15:13:15 2013(r249255) +++ head/sys/cam/ctl/ctl.c Mon Apr 8 15:36:26 2013(r249256) @@ -4223,7 +4223,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft { struct ctl_lun *nlun, *lun; struct ctl_frontend *fe; - int lun_number, i; + int lun_number, i, lun_malloced; if (be_lun == NULL) return (EINVAL); @@ -4245,11 +4245,15 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft } if (ctl_lun == NULL) { lun = malloc(sizeof(*lun), M_CTL, M_WAITOK); - lun->flags = CTL_LUN_MALLOCED; - } else + lun_malloced = 1; + } else { + lun_malloced = 0; lun = ctl_lun; + } memset(lun, 0, sizeof(*lun)); + if (lun_malloced) + lun->flags = CTL_LUN_MALLOCED; mtx_lock(&ctl_softc->ctl_lock); /* @@ -4301,7 +4305,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft * The processor LUN is always enabled. Disk LUNs come on line * disabled, and must be enabled by the backend. */ - lun->flags = CTL_LUN_DISABLED; + lun->flags |= CTL_LUN_DISABLED; lun->backend = be_lun->be; be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; ___ 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: r249334 - head/usr.bin/ctlstat
Author: ken Date: Wed Apr 10 16:01:45 2013 New Revision: 249334 URL: http://svnweb.freebsd.org/changeset/base/249334 Log: Fix a time calculation error in ctlstat_standard(). ctlstat.c:When converting a timeval to a floating point number in ctlstat_standard(), cast the nanoseconds calculation to a long double, so we don't lose precision. Without the cast, we wind up with a time in whole seconds only. Sponsored by: Spectra Logic MFC after:3 days Modified: head/usr.bin/ctlstat/ctlstat.c Modified: head/usr.bin/ctlstat/ctlstat.c == --- head/usr.bin/ctlstat/ctlstat.c Wed Apr 10 11:26:30 2013 (r249333) +++ head/usr.bin/ctlstat/ctlstat.c Wed Apr 10 16:01:45 2013 (r249334) @@ -416,9 +416,10 @@ ctlstat_standard(struct ctlstat_context if (F_CPU(ctx) && (getcpu(&ctx->cur_cpu) != 0)) errx(1, "error returned from getcpu()"); - cur_secs = ctx->cur_time.tv_sec + (ctx->cur_time.tv_nsec / 10); + cur_secs = ctx->cur_time.tv_sec + + ((long double)ctx->cur_time.tv_nsec / 10); prev_secs = ctx->prev_time.tv_sec + -(ctx->prev_time.tv_nsec / 10); +((long double)ctx->prev_time.tv_nsec / 10); etime = cur_secs - prev_secs; ___ 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: r249347 - head/sys/cam/ata
Author: ken Date: Wed Apr 10 22:12:21 2013 New Revision: 249347 URL: http://svnweb.freebsd.org/changeset/base/249347 Log: Add a callback to the ada(4) driver so that it knows when GEOM has released references to it. This is the functional equivalent to change r237518, which added this functionality to the cd(4) and da(4) drivers. This fix prevents a panic caused by GEOM calling adaopen() while the device is going away. We now keep the device around until GEOM has finished cleaning up its state. ata_da.c: In adaregister(), add a d_gone callback to the GEOM disk structure registered for the ada driver. Increment the peripheral reference count for GEOM. Add a new callback, adadiskgonecb(), that GEOM calls when it is done with its resources. This callback releases the reference acquired in adaregister(). Submitted by: Po-Li Soong Sponsored by: Spectra Logic MFC After:5 days Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Wed Apr 10 20:38:15 2013(r249346) +++ head/sys/cam/ata/ata_da.c Wed Apr 10 22:12:21 2013(r249347) @@ -801,6 +801,20 @@ adainit(void) } } +/* + * Callback from GEOM, called when it has finished cleaning up its + * resources. + */ +static void +adadiskgonecb(struct disk *dp) +{ + struct cam_periph *periph; + + periph = (struct cam_periph *)dp->d_drv1; + + cam_periph_release(periph); +} + static void adaoninvalidate(struct cam_periph *periph) { @@ -1157,6 +1171,7 @@ adaregister(struct cam_periph *periph, v softc->disk->d_strategy = adastrategy; softc->disk->d_getattr = adagetattr; softc->disk->d_dump = adadump; + softc->disk->d_gone = adadiskgonecb; softc->disk->d_name = "ada"; softc->disk->d_drv1 = periph; maxio = cpi.maxio; /* Honor max I/O size of SIM */ @@ -1222,6 +1237,17 @@ adaregister(struct cam_periph *periph, v } } else legacy_id = -1; + /* +* Acquire a reference to the periph before we register with GEOM. +* We'll release this reference once GEOM calls us back (via +* adadiskgonecb()) telling us that our provider has been freed. +*/ + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + cam_periph_lock(periph); + return (CAM_REQ_CMP_ERR); + } disk_create(softc->disk, DISK_VERSION); cam_periph_lock(periph); cam_periph_unhold(periph); ___ 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: r249384 - head/usr.bin/ctlstat
Author: ken Date: Thu Apr 11 21:18:04 2013 New Revision: 249384 URL: http://svnweb.freebsd.org/changeset/base/249384 Log: Fix bugs in the elapsed time calculation in ctlstat_standard() pointed out by bde: - Casting to long double isn't needed. - The division isn't needed, multiplication can be used. "When 1 nanosecond is in a floating point literal, the whole expression is automatically promoted correctly." - non-KNF indentation (1 tab) for the newly split line - different non-KNF indentation (5 spaces) for the previously split line - exessive parentheses around the division operation - bogus blank line which splits up the etime initialization - general verboseness from the above. Submitted by: bde MFC after:3 days Modified: head/usr.bin/ctlstat/ctlstat.c Modified: head/usr.bin/ctlstat/ctlstat.c == --- head/usr.bin/ctlstat/ctlstat.c Thu Apr 11 21:17:49 2013 (r249383) +++ head/usr.bin/ctlstat/ctlstat.c Thu Apr 11 21:18:04 2013 (r249384) @@ -404,7 +404,7 @@ ctlstat_json(struct ctlstat_context *ctx static void ctlstat_standard(struct ctlstat_context *ctx) { - long double cur_secs, prev_secs, etime; + long double etime; uint64_t delta_jiffies, delta_idle; uint32_t port; long double cpu_percentage; @@ -416,12 +416,8 @@ ctlstat_standard(struct ctlstat_context if (F_CPU(ctx) && (getcpu(&ctx->cur_cpu) != 0)) errx(1, "error returned from getcpu()"); - cur_secs = ctx->cur_time.tv_sec + - ((long double)ctx->cur_time.tv_nsec / 10); - prev_secs = ctx->prev_time.tv_sec + -((long double)ctx->prev_time.tv_nsec / 10); - - etime = cur_secs - prev_secs; + etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec + + (ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9; if (F_CPU(ctx)) { ctx->prev_total_jiffies = ctx->cur_total_jiffies; ___ 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: r249334 - head/usr.bin/ctlstat
On Thu, Apr 11, 2013 at 17:06:44 +1000, Bruce Evans wrote: > On Wed, 10 Apr 2013, Kenneth D. Merry wrote: > > >Log: > > Fix a time calculation error in ctlstat_standard(). > > > > ctlstat.c: When converting a timeval to a floating point > > number in ctlstat_standard(), cast the nanoseconds > > calculation to a long double, so we don't lose > > precision. Without the cast, we wind up with a > > time in whole seconds only. > >... > >Modified: head/usr.bin/ctlstat/ctlstat.c > >== > >--- head/usr.bin/ctlstat/ctlstat.c Wed Apr 10 11:26:30 2013 (r249333) > >+++ head/usr.bin/ctlstat/ctlstat.c Wed Apr 10 16:01:45 2013 (r249334) > >@@ -416,9 +416,10 @@ ctlstat_standard(struct ctlstat_context > > if (F_CPU(ctx) && (getcpu(&ctx->cur_cpu) != 0)) > > errx(1, "error returned from getcpu()"); > > > >-cur_secs = ctx->cur_time.tv_sec + (ctx->cur_time.tv_nsec / > >10); > >+cur_secs = ctx->cur_time.tv_sec + > >+((long double)ctx->cur_time.tv_nsec / 10); > > prev_secs = ctx->prev_time.tv_sec + > >- (ctx->prev_time.tv_nsec / 10); > >+ ((long double)ctx->prev_time.tv_nsec / 10); > > > > etime = cur_secs - prev_secs; > > long double is rarely necessary. It mainly asks for slowness (10-50%) > on i386 and extreme slowness (hundreds of times slower) on space64. > Double precision is plenty. Many arches in FreeBSD have long double == > double, so you can't depend on long double being more precise than double, > and statistics utilities are especially not in need of much precision. > (Float precision would be enough here. It would be accurate to 1/16 > of a microsecond. Not to 1 nanosecond, but you don't need that. The > integer division was only accurate to 1/4 second, so ist error was > noticeable.) > > There is no need for any casts. There is no need for any divisions. > Simply multiply by 1 nanosecond. This must be in floating point, since > integers can't represent 1 nanosecond (neither can floating, but the > error of ~2**-53 nanosecnds for double precision is neglogible). When > 1 nanosecond is in a floating point literal, the whole expression is > automatically promoted correctly. > > Other style bugs in the above: > - non-KNF indentation (1 tab) for the newly split line > - different non-KNF indentation (5 spaces) for the previously split line > - exessive parentheses around the division operation > - bogus blank line which splits up the etime initialization > - general verboseness from the above. > > Fixing these gives: > > cur_secs = ctx->cur_time.tv_sec + ctx->cur_time.tv_nsec * 1e-9; > prev_secs = ctx->prev_time.tv_sec + ctx->prev_time.tv_nsec * 1e-9 > etime = cur_secs - prev_secs; > > It is now clear that this is still too verbose, since cur_secs and prev_secs > are not used except to initialize etime. Simplifying this gives: > > etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec + > (ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9; > > This might need casting to double of ctx->cur_time.tv_sec, in case time_t > is unsigned and the time went backwards. Otherwise, this should be the > usual expression for subtracting timespecs. The time can't go backwards in this case, because it is the system uptime. Using wall clock time causes problems measuring performance when NTP decides that the system time needs to change. I have a local patch to dd to fix instances of bogus performance numbers due to its using wall clock time to measure elapsed time. This should be fixed now, thanks for the review! Ken -- Kenneth Merry k...@freebsd.org ___ 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: r249592 - in head/sys: conf fs/nfs fs/nfsclient fs/nfsserver modules/nfsd modules/nfsserver nfsserver
Author: ken Date: Wed Apr 17 21:00:22 2013 New Revision: 249592 URL: http://svnweb.freebsd.org/changeset/base/249592 Log: Revamp the old NFS server's File Handle Affinity (FHA) code so that it will work with either the old or new server. The FHA code keeps a cache of currently active file handles for NFSv2 and v3 requests, so that read and write requests for the same file are directed to the same group of threads (reads) or thread (writes). It does not currently work for NFSv4 requests. They are more complex, and will take more work to support. This improves read-ahead performance, especially with ZFS, if the FHA tuning parameters are configured appropriately. Without the FHA code, concurrent reads that are part of a sequential read from a file will be directed to separate NFS threads. This has the effect of confusing the ZFS zfetch (prefetch) code and makes sequential reads significantly slower with clients like Linux that do a lot of prefetching. The FHA code has also been updated to direct write requests to nearby file offsets to the same thread in the same way it batches reads, and the FHA code will now also send writes to multiple threads when needed. This improves sequential write performance in ZFS, because writes to a file are now more ordered. Since NFS writes (generally less than 64K) are smaller than the typical ZFS record size (usually 128K), out of order NFS writes to the same block can trigger a read in ZFS. Sending them down the same thread increases the odds of their being in order. In order for multiple write threads per file in the FHA code to be useful, writes in the NFS server have been changed to use a LK_SHARED vnode lock, and upgrade that to LK_EXCLUSIVE if the filesystem doesn't allow multiple writers to a file at once. ZFS is currently the only filesystem that allows multiple writers to a file, because it has internal file range locking. This change does not affect the NFSv4 code. This improves random write performance to a single file in ZFS, since we can now have multiple writers inside ZFS at one time. I have changed the default tuning parameters to a 22 bit (4MB) window size (from 256K) and unlimited commands per thread as a result of my benchmarking with ZFS. The FHA code has been updated to allow configuring the tuning parameters from loader tunable variables in addition to sysctl variables. The read offset window calculation has been slightly modified as well. Instead of having separate bins, each file handle has a rolling window of bin_shift size. This minimizes glitches in throughput when shifting from one bin to another. sys/conf/files: Add nfs_fha_new.c and nfs_fha_old.c. Compile nfs_fha.c when either the old or the new NFS server is built. sys/fs/nfs/nfsport.h, sys/fs/nfs/nfs_commonport.c: Bring in changes from Rick Macklem to newnfs_realign that allow it to operate in blocking (M_WAITOK) or non-blocking (M_NOWAIT) mode. sys/fs/nfs/nfs_commonsubs.c, sys/fs/nfs/nfs_var.h: Bring in a change from Rick Macklem to allow telling nfsm_dissect() whether or not to wait for mallocs. sys/fs/nfs/nfsm_subs.h: Bring in changes from Rick Macklem to create a new nfsm_dissect_nonblock() inline function and NFSM_DISSECT_NONBLOCK() macro. sys/fs/nfs/nfs_commonkrpc.c, sys/fs/nfsclient/nfs_clkrpc.c: Add the malloc wait flag to a newnfs_realign() call. sys/fs/nfsserver/nfs_nfsdkrpc.c: Setup the new NFS server's RPC thread pool so that it will call the FHA code. Add the malloc flag argument to newnfs_realign(). Unstaticize newnfs_nfsv3_procid[] so that we can use it in the FHA code. sys/fs/nfsserver/nfs_nfsdsocket.c: In nfsrvd_dorpc(), add NFSPROC_WRITE to the list of RPC types that use the LK_SHARED lock type. sys/fs/nfsserver/nfs_nfsdport.c: In nfsd_fhtovp(), if we're starting a write, check to see whether the underlying filesystem supports shared writes. If not, upgrade the lock type from LK_SHARED to LK_EXCLUSIVE. sys/nfsserver/nfs_fha.c: Remove all code that is specific to the NFS server implementation. Anything that is server-specific is now accessed through a callback supplied by that server's FHA shim in the new softc. There are now separate sysctls and tunables for the FHA implementations for the old and new NFS servers. The new NFS server has its tunables under vfs.nfsd.fha, the old NFS server's tunables are under vfs.nfsrv.fha as before. In fha_extract_info(), use callouts for all server-specific code. Getting file handles and offsets is now done in the individual server's shim module. In fha_hash_entry_choose_thread(), change the way w
svn commit: r249596 - in head/sys: conf fs/nfsserver modules/nfsd modules/nfsserver nfs nfsserver
Author: ken Date: Wed Apr 17 22:42:43 2013 New Revision: 249596 URL: http://svnweb.freebsd.org/changeset/base/249596 Log: Move the NFS FHA (File Handle Affinity) code from sys/nfsserver to sys/nfs, since it is now shared by the two NFS servers. Suggested by: rmacklem Sponsored by: Spectra Logic MFC after:2 weeks Added: head/sys/nfs/nfs_fha.c - copied, changed from r249595, head/sys/nfsserver/nfs_fha.c head/sys/nfs/nfs_fha.h - copied unchanged from r249595, head/sys/nfsserver/nfs_fha.h Deleted: head/sys/nfsserver/nfs_fha.c head/sys/nfsserver/nfs_fha.h Modified: head/sys/conf/files head/sys/fs/nfsserver/nfs_fha_new.c head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/modules/nfsd/Makefile head/sys/modules/nfsserver/Makefile head/sys/nfsserver/nfs_fha_old.c head/sys/nfsserver/nfs_srvkrpc.c Modified: head/sys/conf/files == --- head/sys/conf/files Wed Apr 17 21:21:27 2013(r249595) +++ head/sys/conf/files Wed Apr 17 22:42:43 2013(r249596) @@ -3203,6 +3203,7 @@ nfs/bootp_subr.c optional bootp nfsclie nfs/krpc_subr.coptional bootp nfsclient | bootp nfscl nfs/nfs_common.c optional nfsclient | nfsserver nfs/nfs_diskless.c optional nfsclient nfs_root | nfscl nfs_root +nfs/nfs_fha.c optional nfsserver | nfsd nfs/nfs_lock.c optional nfsclient | nfscl | nfslockd | nfsd nfsclient/nfs_bio.coptional nfsclient nfsclient/nfs_node.c optional nfsclient @@ -3211,7 +3212,6 @@ nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient nfsclient/nfs_vfsops.c optional nfsclient nfsclient/nfs_vnops.c optional nfsclient -nfsserver/nfs_fha.coptional nfsserver | nfsd nfsserver/nfs_fha_old.coptional nfsserver nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.coptional nfsserver Modified: head/sys/fs/nfsserver/nfs_fha_new.c == --- head/sys/fs/nfsserver/nfs_fha_new.c Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/fs/nfsserver/nfs_fha_new.c Wed Apr 17 22:42:43 2013 (r249596) @@ -30,11 +30,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include -#include #include static void fhanew_init(void *foo); Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c == --- head/sys/fs/nfsserver/nfs_nfsdkrpc.cWed Apr 17 21:21:27 2013 (r249595) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.cWed Apr 17 22:42:43 2013 (r249596) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: head/sys/modules/nfsd/Makefile == --- head/sys/modules/nfsd/Makefile Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/modules/nfsd/Makefile Wed Apr 17 22:42:43 2013 (r249596) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../fs/nfsserver ${.CURDIR}/../../nfsserver +.PATH: ${.CURDIR}/../../fs/nfsserver ${.CURDIR}/../../nfs KMOD= nfsd SRCS= vnode_if.h \ nfs_fha.c \ Modified: head/sys/modules/nfsserver/Makefile == --- head/sys/modules/nfsserver/Makefile Wed Apr 17 21:21:27 2013 (r249595) +++ head/sys/modules/nfsserver/Makefile Wed Apr 17 22:42:43 2013 (r249596) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../nfsserver +.PATH: ${.CURDIR}/../../nfsserver ${.CURDIR}/../../nfs KMOD= nfsserver SRCS= vnode_if.h \ nfs_fha.c nfs_fha_old.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \ Copied and modified: head/sys/nfs/nfs_fha.c (from r249595, head/sys/nfsserver/nfs_fha.c) == --- head/sys/nfsserver/nfs_fha.cWed Apr 17 21:21:27 2013 (r249595, copy source) +++ head/sys/nfs/nfs_fha.c Wed Apr 17 22:42:43 2013(r249596) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA"); Copied: head/sys/nfs/nfs_fha.h (from r249595, head/sys/nfsserver/nfs_fha.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/nfs/nfs_fha.h Wed Apr 17 22:42:43 2013(r249596, copy of r249595, head/sys/nfsserver/nfs_fha.h) @@ -0,0 +1,112 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are per
svn commit: r249632 - stable/9/usr.bin/ctlstat
Author: ken Date: Fri Apr 19 03:55:54 2013 New Revision: 249632 URL: http://svnweb.freebsd.org/changeset/base/249632 Log: MFC r249334 and r249384: r249334 | ken | 2013-04-10 10:01:45 -0600 (Wed, 10 Apr 2013) | 11 lines Fix a time calculation error in ctlstat_standard(). ctlstat.c: When converting a timeval to a floating point number in ctlstat_standard(), cast the nanoseconds calculation to a long double, so we don't lose precision. Without the cast, we wind up with a time in whole seconds only. Sponsored by: Spectra Logic r249384 | ken | 2013-04-11 15:18:04 -0600 (Thu, 11 Apr 2013) | 17 lines Fix bugs in the elapsed time calculation in ctlstat_standard() pointed out by bde: - Casting to long double isn't needed. - The division isn't needed, multiplication can be used. "When 1 nanosecond is in a floating point literal, the whole expression is automatically promoted correctly." - non-KNF indentation (1 tab) for the newly split line - different non-KNF indentation (5 spaces) for the previously split line - exessive parentheses around the division operation - bogus blank line which splits up the etime initialization - general verboseness from the above. Submitted by: bde Sponsored by: Spectra Logic Modified: stable/9/usr.bin/ctlstat/ctlstat.c Directory Properties: stable/9/usr.bin/ctlstat/ (props changed) Modified: stable/9/usr.bin/ctlstat/ctlstat.c == --- stable/9/usr.bin/ctlstat/ctlstat.c Fri Apr 19 00:30:52 2013 (r249631) +++ stable/9/usr.bin/ctlstat/ctlstat.c Fri Apr 19 03:55:54 2013 (r249632) @@ -404,7 +404,7 @@ ctlstat_json(struct ctlstat_context *ctx static void ctlstat_standard(struct ctlstat_context *ctx) { - long double cur_secs, prev_secs, etime; + long double etime; uint64_t delta_jiffies, delta_idle; uint32_t port; long double cpu_percentage; @@ -416,11 +416,8 @@ ctlstat_standard(struct ctlstat_context if (F_CPU(ctx) && (getcpu(&ctx->cur_cpu) != 0)) errx(1, "error returned from getcpu()"); - cur_secs = ctx->cur_time.tv_sec + (ctx->cur_time.tv_nsec / 10); - prev_secs = ctx->prev_time.tv_sec + -(ctx->prev_time.tv_nsec / 10); - - etime = cur_secs - prev_secs; + etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec + + (ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9; if (F_CPU(ctx)) { ctx->prev_total_jiffies = ctx->cur_total_jiffies; ___ 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: r249658 - in head: bin/chio sys/cam/scsi sys/sys
Author: ken Date: Fri Apr 19 20:03:51 2013 New Revision: 249658 URL: http://svnweb.freebsd.org/changeset/base/249658 Log: Update chio(1) and ch(4) to support reporting element designators. This allows mapping a tape drive in a changer (as reported by 'chio status') to a sa(4) driver instance by comparing the serial numbers. The designators can be ASCII (which is printed out directly), binary (which is printed in hex format) or UTF-8, which is printed in either native UTF-8 format if the terminal can support it, or in %XX notation for non-ASCII characters. Thanks to Hiroki Sato for the explaining UTF-8 printing and example UTF-8 printing code. chio.h: Modify the changer_element_status structure to add new fields and definitions from the SMC3r16 spec. Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and define a new CHIOGSTATUS ioctl. Clean up some tab/space issues. chio.c: For the 'status' subcommand, print the designator field if it is supplied by a device. scsi_ch.h:Add new flags for DVCID and CURDATA to the READ ELEMENT STATUS command structure. Add a read_element_status_device_id structure for the data fields in the new standard. Add new unions, dt_or_obsolete and voltage_devid, to hold and address data from either SCSI-2 or newer devices. scsi_ch.c:Implement support for fetching device IDs with READ ELEMENT STATUS data. Add new arguments to scsi_read_element_status() to allow the user to request the DVCID and CURDATA bits. This isn't compiled into libcam (it's only an internal kernel interface), so we don't need any special handling for the API change. If the user issues the new CHIOGSTATUS ioctl, copy all of the available element status data out. If he issues the OCHIOGSTATUS ioctl, we don't copy the new fields in the structure. Fix a bug in chopen() that would result in the peripheral never getting unheld if chgetparams() failed. Sponsored by: Spectra Logic Submitted by: Po-Li Soong MFC After:1 week Modified: head/bin/chio/chio.c head/sys/cam/scsi/scsi_ch.c head/sys/cam/scsi/scsi_ch.h head/sys/sys/chio.h Modified: head/bin/chio/chio.c == --- head/bin/chio/chio.cFri Apr 19 19:45:00 2013(r249657) +++ head/bin/chio/chio.cFri Apr 19 20:03:51 2013(r249658) @@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "defs.h" #include "pathnames.h" @@ -81,6 +83,7 @@ staticint do_status(const char *, int, static int do_ielem(const char *, int, char **); static int do_return(const char *, int, char **); static int do_voltag(const char *, int, char **); +static void print_designator(const char *, u_int8_t, u_int8_t); #ifndef CHET_VT #defineCHET_VT 10 /* Completely Arbitrary */ @@ -723,6 +726,10 @@ do_status(const char *cname, int argc, c putchar('?'); putchar('>'); } + if (ces->ces_designator_length > 0) + print_designator(ces->ces_designator, +ces->ces_code_set, +ces->ces_designator_length); putchar('\n'); } @@ -1177,3 +1184,66 @@ usage(void) "arg1 arg2 [arg3 [...]]\n", getprogname()); exit(1); } + +#defineUTF8CODESET "UTF-8" + +static void +print_designator(const char *designator, u_int8_t code_set, +u_int8_t designator_length) +{ + printf(" serial number: <"); + switch (code_set) { + case CES_CODE_SET_ASCII: { + /* +* The driver insures that the string is always NUL terminated. +*/ + printf("%s", designator); + break; + } + case CES_CODE_SET_UTF_8: { + char *cs_native; + + setlocale(LC_ALL, ""); + cs_native = nl_langinfo(CODESET); + + /* See if we can natively print UTF-8 */ + if (strcmp(cs_native, UTF8CODESET) == 0) + cs_native = NULL; + + if (cs_native == NULL) { + /* We can natively print UTF-8, so use printf. */ + printf("%s", designator); + } else { + int i; + + /* +* We can't nati
svn commit: r249661 - stable/9/sys/cam/ata
Author: ken Date: Fri Apr 19 21:09:27 2013 New Revision: 249661 URL: http://svnweb.freebsd.org/changeset/base/249661 Log: MFC r249347: r249347 | ken | 2013-04-10 16:12:21 -0600 (Wed, 10 Apr 2013) | 22 lines Add a callback to the ada(4) driver so that it knows when GEOM has released references to it. This is the functional equivalent to change r237518, which added this functionality to the cd(4) and da(4) drivers. This fix prevents a panic caused by GEOM calling adaopen() while the device is going away. We now keep the device around until GEOM has finished cleaning up its state. ata_da.c: In adaregister(), add a d_gone callback to the GEOM disk structure registered for the ada driver. Increment the peripheral reference count for GEOM. Add a new callback, adadiskgonecb(), that GEOM calls when it is done with its resources. This callback releases the reference acquired in adaregister(). Submitted by: Po-Li Soong Sponsored by: Spectra Logic Modified: stable/9/sys/cam/ata/ata_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c == --- stable/9/sys/cam/ata/ata_da.c Fri Apr 19 21:08:56 2013 (r249660) +++ stable/9/sys/cam/ata/ata_da.c Fri Apr 19 21:09:27 2013 (r249661) @@ -792,6 +792,20 @@ adainit(void) } } +/* + * Callback from GEOM, called when it has finished cleaning up its + * resources. + */ +static void +adadiskgonecb(struct disk *dp) +{ + struct cam_periph *periph; + + periph = (struct cam_periph *)dp->d_drv1; + + cam_periph_release(periph); +} + static void adaoninvalidate(struct cam_periph *periph) { @@ -1131,6 +1145,7 @@ adaregister(struct cam_periph *periph, v softc->disk->d_strategy = adastrategy; softc->disk->d_getattr = adagetattr; softc->disk->d_dump = adadump; + softc->disk->d_gone = adadiskgonecb; softc->disk->d_name = "ada"; softc->disk->d_drv1 = periph; maxio = cpi.maxio; /* Honor max I/O size of SIM */ @@ -1194,6 +1209,17 @@ adaregister(struct cam_periph *periph, v } } else legacy_id = -1; + /* +* Acquire a reference to the periph before we register with GEOM. +* We'll release this reference once GEOM calls us back (via +* adadiskgonecb()) telling us that our provider has been freed. +*/ + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + cam_periph_lock(periph); + return (CAM_REQ_CMP_ERR); + } disk_create(softc->disk, DISK_VERSION); cam_periph_lock(periph); cam_periph_unhold(periph); ___ 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: r249701 - head/sys/cam/scsi
Author: ken Date: Sat Apr 20 14:33:55 2013 New Revision: 249701 URL: http://svnweb.freebsd.org/changeset/base/249701 Log: Fix compilation. Pointy hat to:ken Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c == --- head/sys/cam/scsi/scsi_ch.c Sat Apr 20 14:01:22 2013(r249700) +++ head/sys/cam/scsi/scsi_ch.c Sat Apr 20 14:33:55 2013(r249701) @@ -1147,15 +1147,11 @@ copy_element_status(struct ch_softc *sof ces->ces_designator_length = devid->designator_length; /* * Make sure we are always NUL terminated. The -* buffer should be sized for the maximum -* designator length plus 1, but this will make sure -* there is always a NUL at the end. This won't -* matter for the binary code set, since the user -* will only pay attention to the length field. +* This won't matter for the binary code set, +* since the user will only pay attention to the +* length field. */ - ces->ces_designator[ - MIN(sizeof(ces->ces_designator) - 1, - devid->designator_length)]= '\0'; + ces->ces_designator[devid->designator_length]= '\0'; } if (devid->piv_assoc_designator_type & READ_ELEMENT_STATUS_PIV_SET) { ___ 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: r249658 - in head: bin/chio sys/cam/scsi sys/sys
On Sat, Apr 20, 2013 at 05:45:43 -0600, Warner Losh wrote: > Hey Ken, > > this change doesn't compile for me. See below > > Warner > > On Apr 19, 2013, at 2:03 PM, Kenneth D. Merry wrote: [ ...] > > + ces->ces_designator_length = devid->designator_length; > > + /* > > +* Make sure we are always NUL terminated. The > > +* buffer should be sized for the maximum > > +* designator length plus 1, but this will make sure > > +* there is always a NUL at the end. This won't > > +* matter for the binary code set, since the user > > +* will only pay attention to the length field. > > +*/ > > + ces->ces_designator[ > > + MIN(sizeof(ces->ces_designator) - 1, > > + devid->designator_length)]= '\0'; > > compiler complains here that this comparison is always false due to data > ranges. I hacked it in my copy by always using devid->designator_length, but > I know that's a lame fix. Can you look into it? > Not sure what happened there. Different warns levels on different architectures? In any case, I put in the same fix you did until I can figure out a better way to do it. (Hard to type with a toddler on your lap. :) Ken -- Kenneth Merry k...@freebsd.org ___ 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: r249861 - svnadmin/conf
Author: ken Date: Wed Apr 24 22:48:21 2013 New Revision: 249861 URL: http://svnweb.freebsd.org/changeset/base/249861 Log: Add Alan Somers (asomers) as a new src committer. Alan works for Spectra Logic and will be working on ZFS, zfsd, and lots of other bug fixes. gibbs, will and I will be his mentors. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access == --- svnadmin/conf/accessWed Apr 24 21:41:24 2013(r249860) +++ svnadmin/conf/accessWed Apr 24 22:48:21 2013(r249861) @@ -32,6 +32,7 @@ andrew antoine ariff art +asomers attilio avatar avg Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Wed Apr 24 21:41:24 2013(r249860) +++ svnadmin/conf/mentors Wed Apr 24 22:48:21 2013(r249861) @@ -13,6 +13,7 @@ achim scottl Co-mentor: emaste anchie bz artavg Co-mentor: marcel +asomersken Co-mentor: gibbs, will benl philip Co-mentor: simon bgray cognet carl jimharris ___ 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: r249862 - head/share/misc
Author: ken Date: Wed Apr 24 23:32:47 2013 New Revision: 249862 URL: http://svnweb.freebsd.org/changeset/base/249862 Log: Add myself to the committers list. Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Wed Apr 24 22:48:21 2013 (r249861) +++ head/share/misc/committers-src.dot Wed Apr 24 23:32:47 2013 (r249862) @@ -194,6 +194,7 @@ jwd [label="John De Boskey\njwd@FreeBSD. kaiw [label="Kai Wang\nk...@freebsd.org\n2007/09/26"] kan [label="Alexander Kabaev\n...@freebsd.org\n2002/07/21"] kargl [label="Steven G. Kargl\nka...@freebsd.org\n2011/01/17"] +ken [label="Ken Merry\n...@freebsd.org\n1998/09/08"] kensmith [label="Ken Smith\nkensm...@freebsd.org\n2004/01/23"] kevlo [label="Kevin Lo\nke...@freebsd.org\n2006/07/23"] kib [label="Konstantin Belousov\n...@freebsd.org\n2006/06/03"] ___ 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: r262575 - head/sys/dev/mps
On Thu, Feb 27, 2014 at 21:48:34 +, Alexander Motin wrote: > Author: mav > Date: Thu Feb 27 21:48:34 2014 > New Revision: 262575 > URL: http://svnweb.freebsd.org/changeset/base/262575 > > Log: > Restore SIM freeze/release match, broken at r253549. > > This fixes problem with SIM left in frozen state after reinit, for example, > after firmware update. Oops! Thanks for fixing it! Ken -- Kenneth Merry k...@freebsd.org ___ 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: r253550 - head/sys/dev/mps
On Sat, Aug 10, 2013 at 22:14:54 +0400, Slawa Olhovchenkov wrote: > On Mon, Jul 22, 2013 at 06:41:54PM +0000, Kenneth D. Merry wrote: > > > Author: ken > > Date: Mon Jul 22 18:41:53 2013 > > New Revision: 253550 > > URL: http://svnweb.freebsd.org/changeset/base/253550 > > > > Log: > > Merge in phase 14+ -> 16 mps driver fixes from LSI: > > Submitted by: LSI > > MFC after:1 week > > Not done? I was waiting for the stable/9 freeze to end. Now that it's done, I hope to merge that change to stable/9 this week. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r254372 - head/sys/dev/isp
Author: ken Date: Thu Aug 15 16:41:27 2013 New Revision: 254372 URL: http://svnweb.freebsd.org/changeset/base/254372 Log: Export the maxio field in the CAM XPT_PATH_INQ CCB in the isp(4) driver. This tells consumers up the stack the maximum I/O size that the controller can handle. The I/O size is bounded by the number of scatter/gather segments the controller can handle and the page size. For an amd64 system, it works out to around 5MB. Reviewed by: mjacob MFC after:3 days Sponsored by: Spectra Logic Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c == --- head/sys/dev/isp/isp_freebsd.c Thu Aug 15 16:03:09 2013 (r254371) +++ head/sys/dev/isp/isp_freebsd.c Thu Aug 15 16:41:27 2013 (r254372) @@ -5445,6 +5445,11 @@ isp_action(struct cam_sim *sim, union cc cpi->max_target = ISP_MAX_TARGETS(isp) - 1; cpi->max_lun = ISP_MAX_LUNS(isp) - 1; cpi->bus_id = cam_sim_bus(sim); + if (isp->isp_osinfo.sixtyfourbit) + cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; + else + cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE; + bus = cam_sim_bus(xpt_path_sim(cpi->ccb_h.path)); if (IS_FC(isp)) { fcparam *fcp = FCPARAM(isp, bus); ___ 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: r254389 - in head/sys: dev/nvme geom kern sys
Author: ken Date: Thu Aug 15 22:52:39 2013 New Revision: 254389 URL: http://svnweb.freebsd.org/changeset/base/254389 Log: Change the way that unmapped I/O capability is advertised. The previous method was to set the D_UNMAPPED_IO flag in the cdevsw for the driver. The problem with this is that in many cases (e.g. sa(4)) there may be some instances of the driver that can handle unmapped I/O and some that can't. The isp(4) driver can handle unmapped I/O, but the esp(4) driver currently cannot. The cdevsw is shared among all driver instances. So instead of setting a flag on the cdevsw, set a flag on the cdev. This allows drivers to indicate support for unmapped I/O on a per-instance basis. sys/conf.h: Remove the D_UNMAPPED_IO cdevsw flag and replace it with an SI_UNMAPPED cdev flag. kern_physio.c:Look at the cdev SI_UNMAPPED flag to determine whether or not a particular driver can handle unmapped I/O. geom_dev.c: Set the SI_UNMAPPED flag for all GEOM cdevs. Since GEOM will create a temporary mapping when needed, setting SI_UNMAPPED unconditionally will work. Remove the D_UNMAPPED_IO flag. nvme_ns.c:Set the SI_UNMAPPED flag on cdevs created here if NVME_UNMAPPED_BIO_SUPPORT is enabled. vfs_aio.c:In aio_qphysio(), check the SI_UNMAPPED flag on a cdev instead of the D_UNMAPPED_IO flag on the cdevsw. sys/param.h: Bump __FreeBSD_version to 145 for the switch from setting the D_UNMAPPED_IO flag in the cdevsw to setting SI_UNMAPPED in the cdev. Reviewed by: kib, jimharris MFC after:1 week Sponsored by: Spectra Logic Modified: head/sys/dev/nvme/nvme_ns.c head/sys/geom/geom_dev.c head/sys/kern/kern_physio.c head/sys/kern/vfs_aio.c head/sys/sys/conf.h head/sys/sys/param.h Modified: head/sys/dev/nvme/nvme_ns.c == --- head/sys/dev/nvme/nvme_ns.c Thu Aug 15 22:33:27 2013(r254388) +++ head/sys/dev/nvme/nvme_ns.c Thu Aug 15 22:52:39 2013(r254389) @@ -133,11 +133,7 @@ nvme_ns_strategy(struct bio *bp) static struct cdevsw nvme_ns_cdevsw = { .d_version =D_VERSION, -#ifdef NVME_UNMAPPED_BIO_SUPPORT - .d_flags = D_DISK | D_UNMAPPED_IO, -#else .d_flags = D_DISK, -#endif .d_read = physread, .d_write = physwrite, .d_open = nvme_ns_open, @@ -348,6 +344,9 @@ nvme_ns_construct(struct nvme_namespace NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d", device_get_unit(ctrlr->dev), ns->id); #endif +#ifdef NVME_UNMAPPED_BIO_SUPPORT + ns->cdev->si_flags |= SI_UNMAPPED; +#endif if (ns->cdev != NULL) ns->cdev->si_drv1 = ns; Modified: head/sys/geom/geom_dev.c == --- head/sys/geom/geom_dev.cThu Aug 15 22:33:27 2013(r254388) +++ head/sys/geom/geom_dev.cThu Aug 15 22:52:39 2013(r254389) @@ -79,7 +79,7 @@ static struct cdevsw g_dev_cdevsw = { .d_ioctl = g_dev_ioctl, .d_strategy = g_dev_strategy, .d_name = "g_dev", - .d_flags = D_DISK | D_TRACKCLOSE | D_UNMAPPED_IO, + .d_flags = D_DISK | D_TRACKCLOSE, }; static g_taste_t g_dev_taste; @@ -237,6 +237,7 @@ g_dev_taste(struct g_class *mp, struct g g_free(sc); return (NULL); } + dev->si_flags |= SI_UNMAPPED; sc->sc_dev = dev; /* Search for device alias name and create it if found. */ @@ -251,6 +252,7 @@ g_dev_taste(struct g_class *mp, struct g freeenv(val); make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &adev, dev, "%s", buf); + adev->si_flags |= SI_UNMAPPED; break; } } Modified: head/sys/kern/kern_physio.c == --- head/sys/kern/kern_physio.c Thu Aug 15 22:33:27 2013(r254388) +++ head/sys/kern/kern_physio.c Thu Aug 15 22:52:39 2013(r254389) @@ -93,8 +93,7 @@ physio(struct cdev *dev, struct uio *uio csw = dev->si_devsw; if (uio->uio_segflg == UIO_USERSPACE) { - if (csw != NULL && -(csw->d_flags & D_UNMAPPED_IO) != 0) + if (dev->si_flags & SI_UNMAPPED) mapped = 0; else mapped = 1; Modified: head/sys/kern/vfs_aio.c
svn commit: r254416 - head/sys/cam/scsi
Author: ken Date: Fri Aug 16 16:14:32 2013 New Revision: 254416 URL: http://svnweb.freebsd.org/changeset/base/254416 Log: Add unmapped I/O and larger I/O support to the sa(4) driver. We now pay attention to the maxio field in the XPT_PATH_INQ CCB, and if it is set, propagate it up to physio via the si_iosize_max field in the cdev structure. We also now pay attention to the PIM_UNMAPPED capability bit in the XPT_PATH_INQ CCB, and set the new SI_UNMAPPED cdev flag when the underlying SIM supports unmapped I/O. scsi_sa.c:Add unmapped I/O support and propagate the SIM's maximum I/O size up. Adjust scsi_tape_read_write() in the same way that scsi_read_write() was changed to support unmapped I/O. We overload the readop parameter with bits that tell us whether it's an unmapped I/O, and we need to set the CAM_DATA_BIO CCB flag. This change should be backwards compatible in source and binary forms. MFC after:1 week Sponsored by: Spectra Logic Modified: head/sys/cam/scsi/scsi_sa.c Modified: head/sys/cam/scsi/scsi_sa.c == --- head/sys/cam/scsi/scsi_sa.c Fri Aug 16 14:22:20 2013(r254415) +++ head/sys/cam/scsi/scsi_sa.c Fri Aug 16 16:14:32 2013(r254416) @@ -212,6 +212,7 @@ struct sa_softc { sa_statestate; sa_flagsflags; sa_quirks quirks; + u_int si_flags; struct bio_queue_head bio_queue; int queue_count; struct devstat *device_stats; @@ -221,6 +222,7 @@ struct sa_softc { int blk_shift; u_int32_t max_blk; u_int32_t min_blk; + u_int32_t maxio; u_int32_t comp_algorithm; u_int32_t saved_comp_algorithm; u_int32_t media_blksize; @@ -447,7 +449,7 @@ static struct cdevsw sa_cdevsw = { .d_ioctl = saioctl, .d_strategy = sastrategy, .d_name = "sa", - .d_flags = D_TAPE | D_NEEDGIANT, + .d_flags = D_TAPE, }; static int @@ -1506,10 +1508,29 @@ saregister(struct cam_periph *periph, vo DEVSTAT_BS_UNAVAILABLE, SID_TYPE(&cgd->inq_data) | XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_TAPE); + /* +* If maxio isn't set, we fall back to DFLTPHYS. If it is set, we +* take it whether or not it's larger than MAXPHYS. physio will +* break it down into pieces small enough to fit in a buffer. +*/ + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; + else + softc->maxio = cpi.maxio; + + /* +* If the SIM supports unmapped I/O, let physio know that we can +* handle unmapped buffers. +*/ + if (cpi.hba_misc & PIM_UNMAPPED) + softc->si_flags = SI_UNMAPPED; + softc->devs.ctl_dev = make_dev(&sa_cdevsw, SAMINOR(SA_CTLDEV, 0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR, 0660, "%s%d.ctl", periph->periph_name, periph->unit_number); softc->devs.ctl_dev->si_drv1 = periph; + softc->devs.ctl_dev->si_iosize_max = softc->maxio; + softc->devs.ctl_dev->si_flags |= softc->si_flags; for (i = 0; i < SA_NUM_MODES; i++) { @@ -1518,18 +1539,24 @@ saregister(struct cam_periph *periph, vo UID_ROOT, GID_OPERATOR, 0660, "%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].r_dev->si_drv1 = periph; + softc->devs.mode_devs[i].r_dev->si_iosize_max = softc->maxio; + softc->devs.mode_devs[i].r_dev->si_flags |= softc->si_flags; softc->devs.mode_devs[i].nr_dev = make_dev(&sa_cdevsw, SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_NR), UID_ROOT, GID_OPERATOR, 0660, "n%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].nr_dev->si_drv1 = periph; + softc->devs.mode_devs[i].nr_dev->si_iosize_max = softc->maxio; + softc->devs.mode_devs[i].nr_dev->si_flags |= softc->si_flags; softc->devs.mode_devs[i].er_dev = make_dev(&sa_cdevsw, SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_ER), UID_ROOT, GID_OPERATOR, 0660, "e%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].er_dev->si_drv1 = periph; + softc->devs.mode_devs[i].er_dev->si_iosize_max = softc->maxio; + softc->devs.mode_devs[i].er_dev->si_flags |= softc->si_flags; /* * Make the (well known) aliases for the first mode. @@ -1540,12 +1567,20 @@ saregister(struct cam_periph *
svn commit: r254615 - head/sys/dev/mps
Author: ken Date: Wed Aug 21 21:30:56 2013 New Revision: 254615 URL: http://svnweb.freebsd.org/changeset/base/254615 Log: Fix mps(4) driver breakage that came in in change 253550 that manifested itself in out of chain frame conditions. When the driver ran out of chain frames, the request in question would get completed early, and go through mpssas_scsiio_complete(). In mpssas_scsiio_complete(), the negation of the CAM status values (CAM_STATUS_MASK | CAM_SIM_QUEUED) was ORed in instead of being ANDed in. This resulted in a bogus CAM CCB status value. This didn't show up in the non-error case, because the status was reset to something valid (e.g. CAM_REQ_CMP) later on in the function. But in the error case, such as when the driver ran out of chain frames, the CAM_REQUEUE_REQ status was ORed in to the bogus status value. This led to the CAM transport layer repeatedly releasing the SIM queue, because it though that the CAM_RELEASE_SIMQ flag had been set. The symptom was messages like this on the console when INVARIANTS were enabled: xpt_release_simq: requested 1 > present 0 xpt_release_simq: requested 1 > present 0 xpt_release_simq: requested 1 > present 0 mps_sas.c:In mpssas_scsiio_complete(), use &= to take status bits out. |= adds them in. In the error case in mpssas_scsiio_complete(), set the status to CAM_REQUEUE_REQ, don't OR it in. MFC after:3 days Sponsored by: Spectra Logic Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Wed Aug 21 21:30:06 2013(r254614) +++ head/sys/dev/mps/mps_sas.c Wed Aug 21 21:30:56 2013(r254615) @@ -2103,7 +2103,7 @@ mpssas_scsiio_complete(struct mps_softc cm->cm_targ->completed++; cm->cm_targ->outstanding--; TAILQ_REMOVE(&cm->cm_targ->commands, cm, cm_link); - ccb->ccb_h.status |= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); + ccb->ccb_h.status &= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); @@ -2145,7 +2145,7 @@ mpssas_scsiio_complete(struct mps_softc * because there can be no reply when we haven't actually * gone out to the hardware. */ - ccb->ccb_h.status |= CAM_REQUEUE_REQ; + ccb->ccb_h.status = CAM_REQUEUE_REQ; /* * Currently the only error included in the mask is ___ 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: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys sys/ufs/ufs
Author: ken Date: Wed Aug 21 23:04:48 2013 New Revision: 254627 URL: http://svnweb.freebsd.org/changeset/base/254627 Log: Expand the use of stat(2) flags to allow storing some Windows/DOS and CIFS file attributes as BSD stat(2) flags. This work is intended to be compatible with ZFS, the Solaris CIFS server's interaction with ZFS, somewhat compatible with MacOS X, and of course compatible with Windows. The Windows attributes that are implemented were chosen based on the attributes that ZFS already supports. The summary of the flags is as follows: UF_SYSTEM:Command line name: "system" or "usystem" ZFS name: XAT_SYSTEM, ZFS_SYSTEM Windows: FILE_ATTRIBUTE_SYSTEM This flag means that the file is used by the operating system. FreeBSD does not enforce any special handling when this flag is set. UF_SPARSE:Command line name: "sparse" or "usparse" ZFS name: XAT_SPARSE, ZFS_SPARSE Windows: FILE_ATTRIBUTE_SPARSE_FILE This flag means that the file is sparse. Although ZFS may modify this in some situations, there is not generally any special handling for this flag. UF_OFFLINE: Command line name: "offline" or "uoffline" ZFS name: XAT_OFFLINE, ZFS_OFFLINE Windows: FILE_ATTRIBUTE_OFFLINE This flag means that the file has been moved to offline storage. FreeBSD does not have any special handling for this flag. UF_REPARSE: Command line name: "reparse" or "ureparse" ZFS name: XAT_REPARSE, ZFS_REPARSE Windows: FILE_ATTRIBUTE_REPARSE_POINT This flag means that the file is a Windows reparse point. ZFS has special handling code for reparse points, but we don't currently have the other supporting infrastructure for them. UF_HIDDEN:Command line name: "hidden" or "uhidden" ZFS name: XAT_HIDDEN, ZFS_HIDDEN Windows: FILE_ATTRIBUTE_HIDDEN This flag means that the file may be excluded from a directory listing if the application honors it. FreeBSD has no special handling for this flag. The name and bit definition for UF_HIDDEN are identical to the definition in MacOS X. UF_READONLY: Command line name: "urdonly", "rdonly", "readonly" ZFS name: XAT_READONLY, ZFS_READONLY Windows: FILE_ATTRIBUTE_READONLY This flag means that the file may not written or appended, but its attributes may be changed. ZFS currently enforces this flag, but Illumos developers have discussed disabling enforcement. The behavior of this flag is different than MacOS X. MacOS X uses UF_IMMUTABLE to represent the DOS readonly permission, but that flag has a stronger meaning than the semantics of DOS readonly permissions. UF_ARCHIVE: Command line name: "uarch", "uarchive" ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE Windows name: FILE_ATTRIBUTE_ARCHIVE The UF_ARCHIVED flag means that the file has changed and needs to be archived. The meaning is same as the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute. msdosfs and ZFS have special handling for this flag. i.e. they will set it when the file changes. sys/param.h: Bump __FreeBSD_version to 147 for the addition of new stat(2) flags. chflags.1:Document the new command line flag names (e.g. "system", "hidden") available to the user. ls.1: Reference chflags(1) for a list of file flags and their meanings. strtofflags.c:Implement the mapping between the new command line flag names and new stat(2) flags. chflags.2:Document all of the new stat(2) flags, and explain the intended behavior in a little more detail. Explain how they map to Windows file attributes. Different filesystems behave differently with respect to flags, so warn the application developer to take care when using them. zfs_vnops.c: Add support for getting and setting the UF_ARCHIVE, UF_READONLY, UF_SYSTEM, UF_HIDDEN, UF_REPARSE, UF
Re: svn commit: r254615 - head/sys/dev/mps
On Thu, Aug 22, 2013 at 16:42:41 +0400, Dmitry Morozovsky wrote: > Ken, > > On Wed, 21 Aug 2013, Kenneth D. Merry wrote: > > > Author: ken > > Date: Wed Aug 21 21:30:56 2013 > > New Revision: 254615 > > URL: http://svnweb.freebsd.org/changeset/base/254615 > > > > Log: > > Fix mps(4) driver breakage that came in in change 253550 that > > manifested itself in out of chain frame conditions. > > > > When the driver ran out of chain frames, the request in question > > would get completed early, and go through mpssas_scsiio_complete(). > > > > In mpssas_scsiio_complete(), the negation of the CAM status values > > (CAM_STATUS_MASK | CAM_SIM_QUEUED) was ORed in instead of being > > ANDed in. This resulted in a bogus CAM CCB status value. This > > didn't show up in the non-error case, because the status was reset > > to something valid (e.g. CAM_REQ_CMP) later on in the function. > > > > But in the error case, such as when the driver ran out of chain > > frames, the CAM_REQUEUE_REQ status was ORed in to the bogus status > > value. This led to the CAM transport layer repeatedly releasing > > the SIM queue, because it though that the CAM_RELEASE_SIMQ flag had > > been set. The symptom was messages like this on the console when > > INVARIANTS were enabled: > > > > xpt_release_simq: requested 1 > present 0 > > xpt_release_simq: requested 1 > present 0 > > xpt_release_simq: requested 1 > present 0 > > what is real impact of the bug? Your system will essentially hang, certainly as far as anything connected to the controller in question. > > > > mps_sas.c:In mpssas_scsiio_complete(), use &= to take status > > bits out. |= adds them in. > > > > In the error case in mpssas_scsiio_complete(), set > > the status to CAM_REQUEUE_REQ, don't OR it in. > > > > MFC after:3 days > > This patch does not apply cleanly as r253550 had not been merged, and the > first > masking does not occur on contemporary stable/9. Comments? As far as I know, this is not a problem on the version of the driver in stable/9. But then again, I have not tested the out of chain frames code since early 2011 when I last fixed it. If you want to verify the behavior is correct in stable/9, do this: 1. enable INVARIANTS 2. In /boot/loader.conf: hw.mps.max_chains=32 3. Use up most of your memory. If you're using ZFS, just do a sequential write to a file so that the ARC starts filling up with cached data. Look at the free memory in top to see how much you've used. This will cause enough fragmentation to lead to more scatter/gather segments getting used in the driver. 4. Do something like this: ((i=0)); while [ $i -lt 60 ]; do dd if=/dev/da0 of=/dev/null bs=1m & ((i++)); done 5. Look for an out of chain frames message on the console. To see how far you are towards using the chain frames, run 'sysctl dev.mps'. You can see how many chain frames you have free, and how many requests have failed. This change just needs to be merged along with the other changes to avoid having the regression in stable. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r254760 - in head: share/man/man4 sys/cam/scsi sys/kern sys/sys
Author: ken Date: Sat Aug 24 04:52:22 2013 New Revision: 254760 URL: http://svnweb.freebsd.org/changeset/base/254760 Log: Add support to physio(9) for devices that don't want I/O split and configure sa(4) to request no I/O splitting by default. For tape devices, the user needs to be able to clearly understand what blocksize is actually being used when writing to a tape device. The previous behavior of physio(9) was that it would split up any I/O that was too large for the device, or too large to fit into MAXPHYS. This means that if, for instance, the user wrote a 1MB block to a tape device, and MAXPHYS was 128KB, the 1MB write would be split into 8 128K chunks. This would be done without informing the user. This has suboptimal effects, especially when trying to communicate status to the user. In the event of an error writing to a tape (e.g. physical end of tape) in the middle of a 1MB block that has been split into 8 pieces, the user could have the first two 128K pieces written successfully, the third returned with an error, and the last 5 returned with 0 bytes written. If the user is using a standard write(2) system call, all he will see is the ENOSPC error. He won't have a clue how much actually got written. (With a writev(2) system call, he should be able to determine how much got written in addition to the error.) The solution is to prevent physio(9) from splitting the I/O. The new cdev flag, SI_NOSPLIT, tells physio that the driver does not want I/O to be split beforehand. Although the sa(4) driver now enables SI_NOSPLIT by default, that can be disabled by two loader tunables for now. It will not be configurable starting in FreeBSD 11.0. kern.cam.sa.allow_io_split allows the user to configure I/O splitting for all sa(4) driver instances. kern.cam.sa.%d.allow_io_split allows the user to configure I/O splitting for a specific sa(4) instance. There are also now three sa(4) driver sysctl variables that let the users see some sa(4) driver values. kern.cam.sa.%d.allow_io_split shows whether I/O splitting is turned on. kern.cam.sa.%d.maxio shows the maximum I/O size allowed by kernel configuration parameters (e.g. MAXPHYS, DFLTPHYS) and the capabilities of the controller. kern.cam.sa.%d.cpi_maxio shows the maximum I/O size supported by the controller. Note that a better long term solution would be to implement support for chaining buffers, so that that MAXPHYS is no longer a limiting factor for I/O size to tape and disk devices. At that point, the controller and the tape drive would become the limiting factors. sys/conf.h: Add a new cdev flag, SI_NOSPLIT, that allows a driver to tell physio not to split up I/O. sys/param.h: Bump __FreeBSD_version to 149 for the addition of the SI_NOSPLIT cdev flag. kern_physio.c:If the SI_NOSPLIT flag is set on the cdev, return any I/O that is larger than si_iosize_max or MAXPHYS, has more than one segment, or would have to be split because of misalignment with EFBIG. (File too large). In the event of an error, print a console message to give the user a clue about what happened. scsi_sa.c:Set the SI_NOSPLIT cdev flag on the devices created for the sa(4) driver by default. Add tunables to control whether we allow I/O splitting in physio(9). Explain in the comments that allowing I/O splitting will be deprecated for the sa(4) driver in FreeBSD 11.0. Add sysctl variables to display the maximum I/O size we can do (which could be further limited by read block limits) and the maximum I/O size that the controller can do. Limit our maximum I/O size (recorded in the cdev's si_iosize_max) by MAXPHYS. This isn't strictly necessary, because physio(9) will limit it to MAXPHYS, but it will provide some clarity for the application. Record the controller's maximum I/O size reported in the Path Inquiry CCB. sa.4: Document the block size behavior, and explain that the option of allowing physio(9) to split the I/O will disappear in FreeBSD 11.0. Sponsored by: Spectra Logic Modified: head/share/man/man4/sa.4 head/sys/cam/scsi/scsi_sa.c head/sys/kern/kern_physio.c head/sys/sys/conf.h head/sys/sys/param.h Modified: head/share/man/man4/sa.4 == --- head/share/man/man4/sa.4Sat Aug 24 01:50:31 2013(r254759) +++ head/share/man/man4/sa.4Sat Aug 24 04:52:22 2013(r254760) @@ -25,7 +25,7
svn commit: r254802 - head/sys/kern
Author: ken Date: Sat Aug 24 19:02:36 2013 New Revision: 254802 URL: http://svnweb.freebsd.org/changeset/base/254802 Log: Fix a printf format warning on 32-bit mips and powerpc. Reported by: bde, gjb Pointy hat to:ken Modified: head/sys/kern/kern_physio.c Modified: head/sys/kern/kern_physio.c == --- head/sys/kern/kern_physio.c Sat Aug 24 17:45:42 2013(r254801) +++ head/sys/kern/kern_physio.c Sat Aug 24 19:02:36 2013(r254802) @@ -117,10 +117,10 @@ physio(struct cdev *dev, struct uio *uio * This device does not want I/O to be split. */ if (dev->si_flags & SI_NOSPLIT) { - printf("%s: request ptr %#jx is not " + printf("%s: request ptr %p is not " "on a page boundary, cannot split " "request\n", devtoname(dev), - (uintmax_t)bp->b_data); + bp->b_data); error = EFBIG; goto doerror; } ___ 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: r254760 - in head: share/man/man4 sys/cam/scsi sys/kern sys/sys
On Sat, Aug 24, 2013 at 12:44:46 -0400, Glen Barber wrote: > On Sat, Aug 24, 2013 at 04:52:22AM +0000, Kenneth D. Merry wrote: > > Author: ken > > Date: Sat Aug 24 04:52:22 2013 > > New Revision: 254760 > > URL: http://svnweb.freebsd.org/changeset/base/254760 > > > > > [...] > > > @@ -83,6 +113,17 @@ physio(struct cdev *dev, struct uio *uio > > */ > > iolen = ((vm_offset_t) bp->b_data) & PAGE_MASK; > > if ((bp->b_bcount + iolen) > bp->b_kvasize) { > > + /* > > +* This device does not want I/O to be split. > > +*/ > > + if (dev->si_flags & SI_NOSPLIT) { > > + printf("%s: request ptr %#jx is not " > > + "on a page boundary, cannot split " > > + "request\n", devtoname(dev), > > + (uintmax_t)bp->b_data); > > This breaks LINT for at least powerpc. > > cc1: warnings being treated as errors > /src/sys/kern/kern_physio.c: In function 'physio': > /src/sys/kern/kern_physio.c:123: warning: cast from pointer to integer of > different size [-Wpointer-to-int-cast] > *** Error code 1 > > > http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-powerpc-powerpc.full Oops, sorry about that! Fixed. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r254938 - in stable/9/sys: cam dev/mps sys
Author: ken Date: Mon Aug 26 21:34:43 2013 New Revision: 254938 URL: http://svnweb.freebsd.org/changeset/base/254938 Log: MFC mps(4) driver changes 253460, 253549, 253550 and 254615. There are some slight changes here from the version in head. __FreeBSD_version has been bumped to 902502 for the inclusion of the PIM_RESCAN CAM path inquiry flag. The ifdefs in the mps(4) driver have been changed accordingly. In head, the TDP_NOSLEEPING thread flag has been removed but it still exists in stable/9. r253460 | scottl | 2013-07-18 18:12:41 -0600 (Thu, 18 Jul 2013) | 5 lines Overhaul error, information, and debug logging. Obtained from: Netflix r253549 | ken | 2013-07-22 12:37:07 -0600 (Mon, 22 Jul 2013) | 57 lines CAM and mps(4) driver scanning changes. Add a PIM_NOSCAN flag to the CAM path inquiry CCB. This tells CAM not to perform a rescan on a bus when it is registered. We now use this flag in the mps(4) driver. Since it knows what devices it has attached, it is more efficient for it to just issue a target rescan on the targets that are attached. Also, remove the private rescan thread from the mps(4) driver in favor of the rescan thread already built into CAM. Without this change, but with the change above, the MPS scanner could run before or during CAM's initial setup, which would cause duplicate device reprobes and announcements. sys/param.h: Bump __FreeBSD_version to 139 for the inclusion of the PIM_RESCAN CAM path inquiry flag. sys/cam/cam_ccb.h: sys/cam/cam_xpt.c: Added a PIM_NOSCAN flag. If a SIM sets this in the path inquiry ccb, then CAM won't rescan the bus in xpt_bus_regsister. sys/dev/mps/mps_sas.c For versions of FreeBSD that have the PIM_NOSCAN path inquiry flag, don't freeze the sim queue during scanning, because CAM won't be scanning this bus. Instead, hold up the boot. Don't call mpssas_rescan_target in mpssas_startup_decrement; it's redundant and I don't know why it was in there. Set PIM_NOSCAN in path inquiry CCBs. Remove methods related to the internal rescan daemon. Always use async events to trigger a probe for EEDP support. In older versions of FreeBSD where AC_ADVINFO_CHANGED is not available, use AC_FOUND_DEVICE and issue the necessary READ CAPACITY manually. Provide a path to xpt_register_async() so that we only receive events for our own SCSI domain. Improve error reporting in cases where setup for EEDP detection fails. sys/dev/mps/mps_sas.h: Remove softc flags and data related to the scanner thread. sys/dev/mps/mps_sas_lsi.c: Unconditionally rescan the target whenever a device is added. Sponsored by: Spectra Logic r253550 | ken | 2013-07-22 12:41:53 -0600 (Mon, 22 Jul 2013) | 93 lines Merge in phase 14+ -> 16 mps driver fixes from LSI: --- System panics during a Port reset with ouststanding I/O --- It is possible to call mps_mapping_free_memory after this memory is already freed, causing a panic. Removed this extra call to mps_mappiing_free_memory and call mps_mapping_exit in place of the mps_mapping_free_memory call so that any outstanding mapping items can be flushed before memory is freed. --- Correct memory leak during a Port reset with ouststanding I/O --- In mps_reinit function, the mapping memory was not being freed before being re-allocated. Added line to call the memory free function for mapping memory. --- Use CAM_SIM_QUEUED flag in Driver IO path. --- This flag informs the XPT that successful abort of a CCB requires an abort ccb to be issued to the SIM. While processing SCSI IO's, set the CAM_SIM_QUEUED flag in the status for the IO. When the command completes, clear this flag. --- Check for CAM_REQ_INPROG in I/O path. --- Added a check in mpssas_action_scsiio for the In Progress status for the IO. If this flag is set, the IO has already been aborted by the upper laye
Re: svn commit: r253550 - head/sys/dev/mps
On Tue, Aug 13, 2013 at 19:30:29 +0400, Slawa Olhovchenkov wrote: > On Mon, Aug 12, 2013 at 01:02:29PM -0600, Kenneth D. Merry wrote: > > > If you really want one now, I've attached a patch from stable/9 on June > > 27th. It may or may not apply now. > > Its apply witch litle edit. > > > > > Now that it's done, I hope to merge that change to stable/9 this week. > > > > > > Also, I see strange behaviour of LSI 9211-8i -- after some activity > > > got timeout and HBA put in looped reset. > > > > That's not good. Try with the newer driver and see whether if affects the > > behavior. > > Witch this driver I got same behavior: after intesive i/o got timeout, > driver try re-init controller without success. On all HDD activity LED > ON w/o blinking at this moment. Do you have any logs or dmesg output showing the problem? I have merged the latest driver changes to stable/9, including a bug fix for out of chain frame handling. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r253550 - head/sys/dev/mps
On Tue, Aug 27, 2013 at 02:25:26 +0400, Slawa Olhovchenkov wrote: > On Mon, Aug 26, 2013 at 03:40:27PM -0600, Kenneth D. Merry wrote: > > > On Tue, Aug 13, 2013 at 19:30:29 +0400, Slawa Olhovchenkov wrote: > > > On Mon, Aug 12, 2013 at 01:02:29PM -0600, Kenneth D. Merry wrote: > > > > > > > If you really want one now, I've attached a patch from stable/9 on June > > > > 27th. It may or may not apply now. > > > > > > Its apply witch litle edit. > > > > > > > > > Now that it's done, I hope to merge that change to stable/9 this > > > > > > week. > > > > > > > > > > Also, I see strange behaviour of LSI 9211-8i -- after some activity > > > > > got timeout and HBA put in looped reset. > > > > > > > > That's not good. Try with the newer driver and see whether if affects > > > > the > > > > behavior. > > > > > > Witch this driver I got same behavior: after intesive i/o got timeout, > > > driver try re-init controller without success. On all HDD activity LED > > > ON w/o blinking at this moment. > > > > Do you have any logs or dmesg output showing the problem? > > Currenly not awailable, but simmilar as here > http://lists.freebsd.org/pipermail/freebsd-current/2013-May/041943.html That one is relatively recent, but all it shows is timeouts. There are lots of potential causes. Without dmesg output, we don't know what firmware version he's running, and that could be an issue. As can SATA drives behind an expander. > or here http://forums.freebsd.org/showthread.php?t=28252. This one shows lots of IOC terminated errors, but it looks like his problem was solved by upgrading his SSD firmware. > At the time of problem -- no any messages in the log or concole, just > stopping all operations. After some time (aprox 30-60 seconds) -- > circular messages about timeout, reset and massive 'SCSI command > timeout'. What was your topology? i.e. mps(4) controller connected directly to the drives, or via an expander? SAS or SATA drives? > > I have merged the latest driver changes to stable/9, including a bug fix > > for out of chain frame handling. > > Now I can't test anymore -- controller replaced to asr. An asr(4) controller? Ken -- Kenneth Merry k...@freebsd.org ___ 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: r254970 - head/sys/cam/scsi
Author: ken Date: Tue Aug 27 19:47:03 2013 New Revision: 254970 URL: http://svnweb.freebsd.org/changeset/base/254970 Log: If a drive returns ASC/ASCQ 0x04,0x11 "Logical unit not ready, notify (enable spinup) required", instead of doing the normal retries, poll for a change in status. We will poll every half second for a minute for the status to change. Hitachi drives (and likely other SAS drives) return that ASC/ASCQ when they are waiting to spin up. What it means is that they are waiting for the SAS expander to send them the SAS NOTIFY (ENABLE SPINUP) primitive. That primitive is the mechanism expanders/enclosures use to sequence drive spinup to avoid overloading power supplies. Sponsored by: Spectra Logic MFC after:3 days Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c == --- head/sys/cam/scsi/scsi_all.cTue Aug 27 19:46:56 2013 (r254969) +++ head/sys/cam/scsi/scsi_all.cTue Aug 27 19:47:03 2013 (r254970) @@ -1118,7 +1118,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x11, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY, "Logical unit not ready, notify (enable spinup) required") }, /*MV */ { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ ___ 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: r254971 - stable/9/sys/dev/isp
Author: ken Date: Tue Aug 27 20:34:11 2013 New Revision: 254971 URL: http://svnweb.freebsd.org/changeset/base/254971 Log: MFC 254372: Export the maxio field in the CAM XPT_PATH_INQ CCB in the isp(4) driver. This tells consumers up the stack the maximum I/O size that the controller can handle. The I/O size is bounded by the number of scatter/gather segments the controller can handle and the page size. For an amd64 system, it works out to around 5MB. Reviewed by: mjacob Sponsored by: Spectra Logic Modified: stable/9/sys/dev/isp/isp_freebsd.c Modified: stable/9/sys/dev/isp/isp_freebsd.c == --- stable/9/sys/dev/isp/isp_freebsd.c Tue Aug 27 19:47:03 2013 (r254970) +++ stable/9/sys/dev/isp/isp_freebsd.c Tue Aug 27 20:34:11 2013 (r254971) @@ -5447,6 +5447,11 @@ isp_action(struct cam_sim *sim, union cc cpi->max_target = ISP_MAX_TARGETS(isp) - 1; cpi->max_lun = ISP_MAX_LUNS(isp) - 1; cpi->bus_id = cam_sim_bus(sim); + if (isp->isp_osinfo.sixtyfourbit) + cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; + else + cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE; + bus = cam_sim_bus(xpt_path_sim(cpi->ccb_h.path)); if (IS_FC(isp)) { fcparam *fcp = FCPARAM(isp, bus); ___ 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: r254972 - in stable/9/sys: . dev dev/isp
Author: ken Date: Tue Aug 27 20:43:27 2013 New Revision: 254972 URL: http://svnweb.freebsd.org/changeset/base/254972 Log: Properly record mergeinfo for the merge of revision 254372 from head into stable/9. This should have been done in change 254971. Pointy hat to:ken Modified: Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/isp/ (props changed) ___ 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: r254979 - in stable/9/sys: dev/nvme geom kern sys
Author: ken Date: Tue Aug 27 23:02:20 2013 New Revision: 254979 URL: http://svnweb.freebsd.org/changeset/base/254979 Log: MFC change 254389: There are some slight differences from the version in FreeBSD/head. __FreeBSD_version has been bumped to 902503 for the availability of the SI_UNMAPPED cdev flag, and the D_UNMAPPED_IO cdevsw flag remains in place. D_UNMAPPED_IO no longer does anything. Drivers that use that flag will just wind up having mapped I/O by default. The impact will only be on performance, not functionality. Change the way that unmapped I/O capability is advertised. The previous method was to set the D_UNMAPPED_IO flag in the cdevsw for the driver. The problem with this is that in many cases (e.g. sa(4)) there may be some instances of the driver that can handle unmapped I/O and some that can't. The isp(4) driver can handle unmapped I/O, but the esp(4) driver currently cannot. The cdevsw is shared among all driver instances. So instead of setting a flag on the cdevsw, set a flag on the cdev. This allows drivers to indicate support for unmapped I/O on a per-instance basis. sys/conf.h: Remove the D_UNMAPPED_IO cdevsw flag and replace it with an SI_UNMAPPED cdev flag. kern_physio.c: Look at the cdev SI_UNMAPPED flag to determine whether or not a particular driver can handle unmapped I/O. geom_dev.c: Set the SI_UNMAPPED flag for all GEOM cdevs. Since GEOM will create a temporary mapping when needed, setting SI_UNMAPPED unconditionally will work. Remove the D_UNMAPPED_IO flag. nvme_ns.c: Set the SI_UNMAPPED flag on cdevs created here if NVME_UNMAPPED_BIO_SUPPORT is enabled. vfs_aio.c: In aio_qphysio(), check the SI_UNMAPPED flag on a cdev instead of the D_UNMAPPED_IO flag on the cdevsw. sys/param.h:Bump __FreeBSD_version to 145 for the switch from setting the D_UNMAPPED_IO flag in the cdevsw to setting SI_UNMAPPED in the cdev. Reviewed by:kib, jimharris Sponsored by: Spectra Logic Modified: stable/9/sys/dev/nvme/nvme_ns.c stable/9/sys/geom/geom_dev.c stable/9/sys/kern/kern_physio.c stable/9/sys/kern/vfs_aio.c stable/9/sys/sys/conf.h stable/9/sys/sys/param.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/dev/nvme/nvme_ns.c == --- stable/9/sys/dev/nvme/nvme_ns.c Tue Aug 27 22:37:29 2013 (r254978) +++ stable/9/sys/dev/nvme/nvme_ns.c Tue Aug 27 23:02:20 2013 (r254979) @@ -133,11 +133,7 @@ nvme_ns_strategy(struct bio *bp) static struct cdevsw nvme_ns_cdevsw = { .d_version =D_VERSION, -#ifdef NVME_UNMAPPED_BIO_SUPPORT - .d_flags = D_DISK | D_UNMAPPED_IO, -#else .d_flags = D_DISK, -#endif .d_read = physread, .d_write = physwrite, .d_open = nvme_ns_open, @@ -348,6 +344,9 @@ nvme_ns_construct(struct nvme_namespace NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d", device_get_unit(ctrlr->dev), ns->id); #endif +#ifdef NVME_UNMAPPED_BIO_SUPPORT + ns->cdev->si_flags |= SI_UNMAPPED; +#endif if (ns->cdev != NULL) ns->cdev->si_drv1 = ns; Modified: stable/9/sys/geom/geom_dev.c == --- stable/9/sys/geom/geom_dev.cTue Aug 27 22:37:29 2013 (r254978) +++ stable/9/sys/geom/geom_dev.cTue Aug 27 23:02:20 2013 (r254979) @@ -79,7 +79,7 @@ static struct cdevsw g_dev_cdevsw = { .d_ioctl = g_dev_ioctl, .d_strategy = g_dev_strategy, .d_name = "g_dev", - .d_flags = D_DISK | D_TRACKCLOSE | D_UNMAPPED_IO, + .d_flags = D_DISK | D_TRACKCLOSE, }; static g_taste_t g_dev_taste; @@ -237,6 +237,7 @@ g_dev_taste(struct g_class *mp, struct g g_free(sc); return (NULL); } + dev->si_flags |= SI_UNMAPPED; sc->sc_dev = dev; /* Search for device alias name and create it if found. */ @@ -251,6 +252,7 @@ g_dev_taste(struct g_class *mp, struct g freeenv(val); make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &adev, dev, "%s", buf); + adev->si_flags |= SI_UNMAPPED; break; } } Modified: stable/9/sys/kern/kern_physio.c == --- stable/9/sys/kern/kern_physio.c Tue Aug 27 22:37:29 2013 (r254978) +++ stable/9/s
svn commit: r255000 - stable/9/sys/cam/scsi
Author: ken Date: Wed Aug 28 19:22:09 2013 New Revision: 255000 URL: http://svnweb.freebsd.org/changeset/base/255000 Log: MFC 254416: r254416 | ken | 2013-08-16 10:14:32 -0600 (Fri, 16 Aug 2013) | 24 lines Add unmapped I/O and larger I/O support to the sa(4) driver. We now pay attention to the maxio field in the XPT_PATH_INQ CCB, and if it is set, propagate it up to physio via the si_iosize_max field in the cdev structure. We also now pay attention to the PIM_UNMAPPED capability bit in the XPT_PATH_INQ CCB, and set the new SI_UNMAPPED cdev flag when the underlying SIM supports unmapped I/O. scsi_sa.c: Add unmapped I/O support and propagate the SIM's maximum I/O size up. Adjust scsi_tape_read_write() in the same way that scsi_read_write() was changed to support unmapped I/O. We overload the readop parameter with bits that tell us whether it's an unmapped I/O, and we need to set the CAM_DATA_BIO CCB flag. This change should be backwards compatible in source and binary forms. Sponsored by: Spectra Logic Modified: stable/9/sys/cam/scsi/scsi_sa.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_sa.c == --- stable/9/sys/cam/scsi/scsi_sa.c Wed Aug 28 19:06:22 2013 (r254999) +++ stable/9/sys/cam/scsi/scsi_sa.c Wed Aug 28 19:22:09 2013 (r255000) @@ -212,6 +212,7 @@ struct sa_softc { sa_statestate; sa_flagsflags; sa_quirks quirks; + u_int si_flags; struct bio_queue_head bio_queue; int queue_count; struct devstat *device_stats; @@ -221,6 +222,7 @@ struct sa_softc { int blk_shift; u_int32_t max_blk; u_int32_t min_blk; + u_int32_t maxio; u_int32_t comp_algorithm; u_int32_t saved_comp_algorithm; u_int32_t media_blksize; @@ -447,7 +449,7 @@ static struct cdevsw sa_cdevsw = { .d_ioctl = saioctl, .d_strategy = sastrategy, .d_name = "sa", - .d_flags = D_TAPE | D_NEEDGIANT, + .d_flags = D_TAPE, }; static int @@ -1506,10 +1508,29 @@ saregister(struct cam_periph *periph, vo DEVSTAT_BS_UNAVAILABLE, SID_TYPE(&cgd->inq_data) | XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_TAPE); + /* +* If maxio isn't set, we fall back to DFLTPHYS. If it is set, we +* take it whether or not it's larger than MAXPHYS. physio will +* break it down into pieces small enough to fit in a buffer. +*/ + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; + else + softc->maxio = cpi.maxio; + + /* +* If the SIM supports unmapped I/O, let physio know that we can +* handle unmapped buffers. +*/ + if (cpi.hba_misc & PIM_UNMAPPED) + softc->si_flags = SI_UNMAPPED; + softc->devs.ctl_dev = make_dev(&sa_cdevsw, SAMINOR(SA_CTLDEV, 0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR, 0660, "%s%d.ctl", periph->periph_name, periph->unit_number); softc->devs.ctl_dev->si_drv1 = periph; + softc->devs.ctl_dev->si_iosize_max = softc->maxio; + softc->devs.ctl_dev->si_flags |= softc->si_flags; for (i = 0; i < SA_NUM_MODES; i++) { @@ -1518,18 +1539,24 @@ saregister(struct cam_periph *periph, vo UID_ROOT, GID_OPERATOR, 0660, "%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].r_dev->si_drv1 = periph; + softc->devs.mode_devs[i].r_dev->si_iosize_max = softc->maxio; + softc->devs.mode_devs[i].r_dev->si_flags |= softc->si_flags; softc->devs.mode_devs[i].nr_dev = make_dev(&sa_cdevsw, SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_NR), UID_ROOT, GID_OPERATOR, 0660, "n%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].nr_dev->si_drv1 = periph; + softc->devs.mode_devs[i].nr_dev->si_iosize_max = softc->maxio; + softc->devs.mode_devs[i].nr_dev->si_flags |= softc->si_flags; softc->devs.mode_devs[i].er_dev = make_dev(&sa_cdevsw, SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_ER), UID_ROOT, GID_OPERATOR, 0660, "e%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].er_dev->si_drv1 = periph; + softc->devs.mode_devs[i].er_dev
Re: svn commit: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys sys/ufs/ufs
On Wed, Aug 28, 2013 at 15:54:18 -0500, Bryan Drewery wrote: > On 2013-08-21 18:04, Kenneth D. Merry wrote: > >Author: ken > >Date: Wed Aug 21 23:04:48 2013 > >New Revision: 254627 > >URL: http://svnweb.freebsd.org/changeset/base/254627 > > > >Log: > > Expand the use of stat(2) flags to allow storing some Windows/DOS > > and CIFS file attributes as BSD stat(2) flags. > > > > This work is intended to be compatible with ZFS, the Solaris CIFS > > server's interaction with ZFS, somewhat compatible with MacOS X, > > and of course compatible with Windows. > > > > The Windows attributes that are implemented were chosen based on > > the attributes that ZFS already supports. > > > > The summary of the flags is as follows: > [...] > > > > UF_ARCHIVE:Command line name: "uarch", "uarchive" > > ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE > > Windows name: FILE_ATTRIBUTE_ARCHIVE > > > > The UF_ARCHIVED flag means that the file has changed and > > needs to be archived. The meaning is same as > > the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and > > the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute. > > > > msdosfs and ZFS have special handling for this flag. > > i.e. they will set it when the file changes. > > Is it intended that this flag is automatically added to all new and > existing ZFS files? Yes, that is intentional. ZFS already has the flag internally, this just exposes it to FreeBSD. With ZFS at least, it is set any time a file changes. If an application clears it on files it has archived, it will know when the file has changed and it needs to archive the file again. This is the inverse (more or less) of the SF_ARCHIVED flag. With UFS, the flag is just passed through and stored. One application for this is to support CIFS servers that need to store DOS/CIFS/Windows attributes on a FreeBSD server. > # touch test > # ls -alo test > -rw-r--r--- 1 root wheel uarch 0 Aug 28 15:46 test > > This breaks 'cp -p' to tmpfs as tmpfs does not allow this flag. > > # mkdir /tmp/tmpfs > # mount -t tmpfs tmpfs /tmp/tmpfs > # cp -f test /tmp/tmpfs > cp: test: Operation not supported Right. For some filesystems, like UFS and probably tmpfs, the right answer may be to just pass through most all of the file flags, and reject specific flags that it doesn't support. For some filesystems, like smbfs, the right answer seems to be to just ignore flags that are set that aren't supported. Other filesystems, like msdosfs, support a small number of flags and reject any that aren't supported. In other words, this isn't a new problem, and it would have cropped up if you tried to copy a file with the SF_IMMUTABLE flag set from UFS to msdosfs with cp -p. > [...] > >Modified: head/sys/ufs/ufs/ufs_vnops.c > >== > >--- head/sys/ufs/ufs/ufs_vnops.c Wed Aug 21 22:57:29 2013 (r254626) > >+++ head/sys/ufs/ufs/ufs_vnops.c Wed Aug 21 23:04:48 2013 (r254627) > >@@ -528,9 +528,11 @@ ufs_setattr(ap) > > return (EINVAL); > > } > > if (vap->va_flags != VNOVAL) { > >-if ((vap->va_flags & ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | > >-UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | > >-SF_APPEND | SF_NOUNLINK | SF_SNAPSHOT)) != 0) > >+if ((vap->va_flags & ~(SF_APPEND | SF_ARCHIVED | > >SF_IMMUTABLE | > >+SF_NOUNLINK | SF_SNAPSHOT | UF_APPEND | UF_ARCHIVE | > >+UF_HIDDEN | UF_IMMUTABLE | UF_NODUMP | UF_NOUNLINK | > >+UF_OFFLINE | UF_OPAQUE | UF_READONLY | UF_REPARSE | > >+UF_SPARSE | UF_SYSTEM)) != 0) > > return (EOPNOTSUPP); > > if (vp->v_mount->mnt_flag & MNT_RDONLY) > > return (EROFS); > > Seems a similar change is needed in tmpfs_subr.c:tmpfs_chflags() > (antoine pointed this out) Sure, I can fix tmpfs. Ken -- Kenneth Merry k...@freebsd.org ___ 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: r255008 - head/sys/fs/tmpfs
Author: ken Date: Wed Aug 28 22:12:56 2013 New Revision: 255008 URL: http://svnweb.freebsd.org/changeset/base/255008 Log: Support storing 7 additional file flags in tmpfs: UF_SYSTEM, UF_SPARSE, UF_OFFLINE, UF_REPARSE, UF_ARCHIVE, UF_READONLY, and UF_HIDDEN. Sort the file flags tmpfs supports alphabetically. tmpfs now supports the same flags as UFS, with the exception of SF_SNAPSHOT. Reported by: bdrewery, antoine Sponsored by: Spectra Logic Modified: head/sys/fs/tmpfs/tmpfs_subr.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c == --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Aug 28 21:10:37 2013 (r255007) +++ head/sys/fs/tmpfs/tmpfs_subr.c Wed Aug 28 22:12:56 2013 (r255008) @@ -1433,9 +1433,10 @@ tmpfs_chflags(struct vnode *vp, u_long f node = VP_TO_TMPFS_NODE(vp); - if ((flags & ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | UF_OPAQUE | - UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | SF_APPEND | - SF_NOUNLINK)) != 0) + if ((flags & ~(SF_APPEND | SF_ARCHIVED | SF_IMMUTABLE | SF_NOUNLINK | + UF_APPEND | UF_ARCHIVE | UF_HIDDEN | UF_IMMUTABLE | UF_NODUMP | + UF_NOUNLINK | UF_OFFLINE | UF_OPAQUE | UF_READONLY | UF_REPARSE | + UF_SPARSE | UF_SYSTEM)) != 0) return (EOPNOTSUPP); /* Disallow this operation if the file system is mounted read-only. */ ___ 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: r255032 - head/sys/kern
Author: ken Date: Thu Aug 29 16:41:40 2013 New Revision: 255032 URL: http://svnweb.freebsd.org/changeset/base/255032 Log: Fix some issues in change 254760 pointed out by Bruce Evans: - Remove excessive parenthesis - Use KNF continuation indentation - Cut down on excessive continuation lines - More consistent style in messages - Use uprintf() instead of printf() Submitted by: bde Modified: head/sys/kern/kern_physio.c Modified: head/sys/kern/kern_physio.c == --- head/sys/kern/kern_physio.c Thu Aug 29 16:26:04 2013(r255031) +++ head/sys/kern/kern_physio.c Thu Aug 29 16:41:40 2013(r255032) @@ -58,25 +58,22 @@ physio(struct cdev *dev, struct uio *uio * If the driver does not want I/O to be split, that means that we * need to reject any requests that will not fit into one buffer. */ - if ((dev->si_flags & SI_NOSPLIT) && - ((uio->uio_resid > dev->si_iosize_max) || -(uio->uio_resid > MAXPHYS) || -(uio->uio_iovcnt > 1))) { + if (dev->si_flags & SI_NOSPLIT && + (uio->uio_resid > dev->si_iosize_max || uio->uio_resid > MAXPHYS || + uio->uio_iovcnt > 1)) { /* * Tell the user why his I/O was rejected. */ if (uio->uio_resid > dev->si_iosize_max) - printf("%s: request size %zd > si_iosize_max=%d, " + uprintf("%s: request size=%zd > si_iosize_max=%d; " "cannot split request\n", devtoname(dev), uio->uio_resid, dev->si_iosize_max); - if (uio->uio_resid > MAXPHYS) - printf("%s: request size %zd > MAXPHYS=%d, " + uprintf("%s: request size=%zd > MAXPHYS=%d; " "cannot split request\n", devtoname(dev), uio->uio_resid, MAXPHYS); - if (uio->uio_iovcnt > 1) - printf("%s: request vectors=%d > 1, " + uprintf("%s: request vectors=%d > 1; " "cannot split request\n", devtoname(dev), uio->uio_iovcnt); @@ -117,8 +114,8 @@ physio(struct cdev *dev, struct uio *uio * This device does not want I/O to be split. */ if (dev->si_flags & SI_NOSPLIT) { - printf("%s: request ptr %p is not " - "on a page boundary, cannot split " + uprintf("%s: request ptr %p is not " + "on a page boundary; cannot split " "request\n", devtoname(dev), bp->b_data); error = EFBIG; ___ 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: r255043 - head/sys/cam/scsi
Author: ken Date: Thu Aug 29 21:25:27 2013 New Revision: 255043 URL: http://svnweb.freebsd.org/changeset/base/255043 Log: Bump up the default timeouts for move commands in the ch(4) driver to 15 minutes, and 5 minutes for things like READ ELEMENT STATUS. This is needed to account for the worst case scenarios on at least some Spectra Logic tape libraries. Sponsored by: Spectra Logic MFC after:3 days Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c == --- head/sys/cam/scsi/scsi_ch.c Thu Aug 29 20:51:12 2013(r255042) +++ head/sys/cam/scsi/scsi_ch.c Thu Aug 29 21:25:27 2013(r255043) @@ -99,10 +99,10 @@ __FBSDID("$FreeBSD$"); */ static const u_int32_t CH_TIMEOUT_MODE_SENSE= 6000; -static const u_int32_t CH_TIMEOUT_MOVE_MEDIUM = 10; -static const u_int32_t CH_TIMEOUT_EXCHANGE_MEDIUM = 10; -static const u_int32_t CH_TIMEOUT_POSITION_TO_ELEMENT = 10; -static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS = 6; +static const u_int32_t CH_TIMEOUT_MOVE_MEDIUM = 15 * 60 * 1000; +static const u_int32_t CH_TIMEOUT_EXCHANGE_MEDIUM = 15 * 60 * 1000; +static const u_int32_t CH_TIMEOUT_POSITION_TO_ELEMENT = 15 * 60 * 1000; +static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS = 5 * 60 * 1000; static const u_int32_t CH_TIMEOUT_SEND_VOLTAG = 1; static const u_int32_t CH_TIMEOUT_INITIALIZE_ELEMENT_STATUS = 50; ___ 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: r255501 - head/sys/dev/mps
Author: ken Date: Thu Sep 12 22:06:12 2013 New Revision: 255501 URL: http://svnweb.freebsd.org/changeset/base/255501 Log: Fix an issue that caused Integrated RAID volumes on LSI mps(4) controllers to not get scanned on boot. The problem originated in change 253549. With the change to the mps(4) driver to scan only targets that it knows it has (as opposed to scanning the entire bus), scanning RAID volumes on boot was omitted. So, for versions of FreeBSD that have the scanning changes (__FreeBSD_version 139 and higher), scan RAID volumes that are added whether or not we're booting. PR: kern/181784 Reported by: Xiguang Wang Tested by:Dennis Glatting Sponsored by: Spectra Logic Approved by: re (delphij) MFC After:3 days Modified: head/sys/dev/mps/mps_sas_lsi.c Modified: head/sys/dev/mps/mps_sas_lsi.c == --- head/sys/dev/mps/mps_sas_lsi.c Thu Sep 12 21:24:59 2013 (r255500) +++ head/sys/dev/mps/mps_sas_lsi.c Thu Sep 12 22:06:12 2013 (r255501) @@ -898,7 +898,9 @@ mpssas_volume_add(struct mps_softc *sc, free(lun, M_MPT2); } SLIST_INIT(&targ->luns); +#if __FreeBSD_version < 139 if ((sassc->flags & MPSSAS_IN_STARTUP) == 0) +#endif mpssas_rescan_target(sc, targ); mps_dprint(sc, MPS_MAPPING, "RAID target id %d added (WWID = 0x%jx)\n", targ->tid, wwid); ___ 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"