From owner-svn-src-all@FreeBSD.ORG Fri Apr 26 16:48:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BCBC947A for ; Fri, 26 Apr 2013 16:48:00 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vb0-x22c.google.com (mail-vb0-x22c.google.com [IPv6:2607:f8b0:400c:c02::22c]) by mx1.freebsd.org (Postfix) with ESMTP id 770601246 for ; Fri, 26 Apr 2013 16:48:00 +0000 (UTC) Received: by mail-vb0-f44.google.com with SMTP id e13so1365003vbg.17 for ; Fri, 26 Apr 2013 09:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=kDnHV1vpwlrnD5lyybTismnl7NTDlR3jjjPyL12DhBA=; b=dxL1aMCzOEK+fyCQ6qVYwmZRXHCNEUtD2+UtrH8OToF8w7QbsGhb151q1zptJdSvFn zM4jiBBmN0NfsjxfvBjR6BT4mXQuaN5T7UU3Z5mFtT9FEKoeeUIzejqQyMIAlVZ3ZNHE 0wI8mUHKI5AOaEo5dfkYjNUZIgSaEmoRyKCn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=kDnHV1vpwlrnD5lyybTismnl7NTDlR3jjjPyL12DhBA=; b=XsUTm0wre9fWAGiQBwNIgVIQjWQhk26kZ5jlL8ZPwV0TvMFb7509h6Te/RYegC99ZI Ag2SCw7Zg4XnTD6UzIL6f/g+5ZLy8ZB+mnJ0uWMSwE6c68frXwDcJ//thAOlY0VaHPX5 zRqsPlXKsz2+ONxtd103ZHPGTCMdU+4WHPZBdPSzKjNGYjow4u/P2t6o3TUUsf8Pcq/7 q3CocsanlZ7aZ4wbuu6V2XvCqeZOpGhwiqjVqY8EYNIjhzGZFzKEyEAc+9hEr6Bzn9R5 rgsdwX+JXOyE2XlDeC1DO2PgBkc64oH51Aj1V/aHTm1wuB17EmyH6N694Nt7YzrcHqT8 4TtA== MIME-Version: 1.0 X-Received: by 10.58.28.144 with SMTP id b16mr20822141veh.43.1366994879834; Fri, 26 Apr 2013 09:47:59 -0700 (PDT) Received: by 10.220.215.70 with HTTP; Fri, 26 Apr 2013 09:47:59 -0700 (PDT) In-Reply-To: <201304180944.r3I9i05t093967@svn.freebsd.org> References: <201304180944.r3I9i05t093967@svn.freebsd.org> Date: Fri, 26 Apr 2013 09:47:59 -0700 Message-ID: Subject: Re: svn commit: r249611 - in stable/9/sys/cam: ata scsi From: Peter Wemm To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmKrwHsmiThlmhI+jlKY7cL/11uI36KpzH+cKjs756/ASYKoNCDZA/XGrDo3INvnOrkvn0Q Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Apr 2013 16:48:00 -0000 On Thu, Apr 18, 2013 at 2:44 AM, Alexander Motin wrote: > Author: mav > Date: Thu Apr 18 09:44:00 2013 > New Revision: 249611 > URL: http://svnweb.freebsd.org/changeset/base/249611 > > Log: > MFC r248872, r249048: > Make pre-shutdown flush and spindown routines to not use xpt_polled_action(), > but execute the commands in regular way. There is no any reason to cook CPU > while the system is still fully operational. After this change polling in > CAM is used only for kernel dumping. FYI, this causes some drivers to deadlock when you attempt to cleanly reboot the machine. eg: mpt based systems. Adding new assumptions about interrupt-driven hooks continuing to work after the post-sync shutdown hooks don't seem like a -stable candidate. This breaks a number of machines in the freebsd.org cluster. I have to back out both of these changes to get them to reboot. > Modified: > stable/9/sys/cam/ata/ata_da.c > stable/9/sys/cam/scsi/scsi_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 Thu Apr 18 09:40:34 2013 (r249610) > +++ stable/9/sys/cam/ata/ata_da.c Thu Apr 18 09:44:00 2013 (r249611) > @@ -1825,11 +1825,10 @@ adaflush(void) > { > struct cam_periph *periph; > struct ada_softc *softc; > + union ccb *ccb; > int error; > > CAM_PERIPH_FOREACH(periph, &adadriver) { > - union ccb ccb; > - > /* If we paniced with lock held - not recurse here. */ > if (cam_periph_owned(periph)) > continue; > @@ -1845,10 +1844,8 @@ adaflush(void) > continue; > } > > - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); > - > - ccb.ccb_h.ccb_state = ADA_CCB_DUMP; > - cam_fill_ataio(&ccb.ataio, > + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); > + cam_fill_ataio(&ccb->ataio, > 0, > adadone, > CAM_DIR_NONE, > @@ -1856,20 +1853,17 @@ adaflush(void) > NULL, > 0, > ada_default_timeout*1000); > - > if (softc->flags & ADA_FLAG_CAN_48BIT) > - ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0); > + ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE48, 0, 0, 0); > else > - ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); > - xpt_polled_action(&ccb); > + ata_28bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); > > - error = cam_periph_error(&ccb, > - 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); > - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) > - cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, > - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); > + error = cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, > + /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, > + softc->disk->d_devstat); > if (error != 0) > xpt_print(periph->path, "Synchronize cache failed\n"); > + xpt_release_ccb(ccb); > cam_periph_unlock(periph); > } > } > @@ -1879,11 +1873,10 @@ adaspindown(uint8_t cmd, int flags) > { > struct cam_periph *periph; > struct ada_softc *softc; > + union ccb *ccb; > int error; > > CAM_PERIPH_FOREACH(periph, &adadriver) { > - union ccb ccb; > - > /* If we paniced with lock held - not recurse here. */ > if (cam_periph_owned(periph)) > continue; > @@ -1900,10 +1893,8 @@ adaspindown(uint8_t cmd, int flags) > if (bootverbose) > xpt_print(periph->path, "spin-down\n"); > > - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); > - > - ccb.ccb_h.ccb_state = ADA_CCB_DUMP; > - cam_fill_ataio(&ccb.ataio, > + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); > + cam_fill_ataio(&ccb->ataio, > 0, > adadone, > CAM_DIR_NONE | flags, > @@ -1911,17 +1902,14 @@ adaspindown(uint8_t cmd, int flags) > NULL, > 0, > ada_default_timeout*1000); > + ata_28bit_cmd(&ccb->ataio, cmd, 0, 0, 0); > > - ata_28bit_cmd(&ccb.ataio, cmd, 0, 0, 0); > - xpt_polled_action(&ccb); > - > - error = cam_periph_error(&ccb, > - 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); > - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) > - cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, > - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); > + error = cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, > + /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, > + softc->disk->d_devstat); > if (error != 0) > xpt_print(periph->path, "Spin-down disk failed\n"); > + xpt_release_ccb(ccb); > cam_periph_unlock(periph); > } > } > > Modified: stable/9/sys/cam/scsi/scsi_da.c > ============================================================================== > --- stable/9/sys/cam/scsi/scsi_da.c Thu Apr 18 09:40:34 2013 (r249610) > +++ stable/9/sys/cam/scsi/scsi_da.c Thu Apr 18 09:44:00 2013 (r249611) > @@ -2834,11 +2834,10 @@ dashutdown(void * arg, int howto) > { > struct cam_periph *periph; > struct da_softc *softc; > + union ccb *ccb; > int error; > > CAM_PERIPH_FOREACH(periph, &dadriver) { > - union ccb ccb; > - > cam_periph_lock(periph); > softc = (struct da_softc *)periph->softc; > > @@ -2852,10 +2851,8 @@ dashutdown(void * arg, int howto) > continue; > } > > - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); > - > - ccb.ccb_h.ccb_state = DA_CCB_DUMP; > - scsi_synchronize_cache(&ccb.csio, > + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); > + scsi_synchronize_cache(&ccb->csio, > /*retries*/0, > /*cbfcnp*/dadone, > MSG_SIMPLE_Q_TAG, > @@ -2864,15 +2861,12 @@ dashutdown(void * arg, int howto) > SSD_FULL_SIZE, > 60 * 60 * 1000); > > - xpt_polled_action(&ccb); > - > - error = cam_periph_error(&ccb, > - 0, SF_NO_RECOVERY | SF_NO_RETRY | SF_QUIET_IR, NULL); > - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) > - cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, > - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); > + error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0, > + /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY | SF_QUIET_IR, > + softc->disk->d_devstat); > if (error != 0) > xpt_print(periph->path, "Synchronize cache failed\n"); > + xpt_release_ccb(ccb); > cam_periph_unlock(periph); > } > } -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV