From owner-svn-src-head@freebsd.org Wed Dec 6 23:05:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EDC4E8F6D1; Wed, 6 Dec 2017 23:05:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F2FA6728B; Wed, 6 Dec 2017 23:05:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB6N5Ge7065469; Wed, 6 Dec 2017 23:05:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB6N5GJv065466; Wed, 6 Dec 2017 23:05:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201712062305.vB6N5GJv065466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 6 Dec 2017 23:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326644 - in head/sys/cam: ata nvme scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/cam: ata nvme scsi X-SVN-Commit-Revision: 326644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Dec 2017 23:05:17 -0000 Author: imp Date: Wed Dec 6 23:05:15 2017 New Revision: 326644 URL: https://svnweb.freebsd.org/changeset/base/326644 Log: Now that cam_periph_runccb() can be called from situations where the kernel scheduler is stopped, replace the by hand calling of xpt_polled_action() with it. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13388 Modified: head/sys/cam/ata/ata_da.c head/sys/cam/nvme/nvme_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Wed Dec 6 23:05:07 2017 (r326643) +++ head/sys/cam/ata/ata_da.c Wed Dec 6 23:05:15 2017 (r326644) @@ -1088,13 +1088,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical ata_28bit_cmd(&ccb.ataio, ATA_WRITE_DMA, 0, lba, count); } - xpt_polled_action(&ccb); - - error = adaerror(&ccb, - 0, SF_NO_RECOVERY | SF_NO_RETRY); - 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, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) printf("Aborting dump due to I/O error.\n"); @@ -1124,13 +1119,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical 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); - - error = adaerror(&ccb, - 0, SF_NO_RECOVERY | SF_NO_RETRY); - 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, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); } @@ -3510,32 +3500,9 @@ adaspindown(uint8_t cmd, int flags) 0, ada_default_timeout*1000); ata_28bit_cmd(&local_ccb, cmd, 0, 0, 0); - - if (!SCHEDULER_STOPPED()) { - /* - * Not panicing, can just do the normal runccb - * XXX should make cam_periph_runccb work while - * XXX panicing... later - */ - error = cam_periph_runccb((union ccb *)&local_ccb, adaerror, - /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, - softc->disk->d_devstat); - } else { - /* - * Panicing, so we have to do this by hand: do - * xpt_polled_action to run the request through the SIM, - * extract the error, and if the queue was frozen, - * unfreeze it. cam_periph_runccb takes care of these - * details, but xpt_polled_action doesn't. - */ - xpt_polled_action((union ccb *)&local_ccb); - error = adaerror((union ccb *)&local_ccb, 0, - SF_NO_RECOVERY | SF_NO_RETRY); - if ((local_ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(local_ccb.ccb_h.path, - /*relsim_flags*/0, /*reduction*/0, - /*timeout*/0, /*getcount_only*/0); - } + error = cam_periph_runccb((union ccb *)&local_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"); cam_periph_unlock(periph); Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Wed Dec 6 23:05:07 2017 (r326643) +++ head/sys/cam/nvme/nvme_da.c Wed Dec 6 23:05:15 2017 (r326644) @@ -404,17 +404,12 @@ ndadump(void *arg, void *virtual, vm_offset_t physical xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); - xpt_polled_action((union ccb *)&nvmeio); - - error = cam_periph_error((union ccb *)&nvmeio, - 0, SF_NO_RECOVERY | SF_NO_RETRY); - if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0, - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) - printf("Aborting dump due to I/O error.\n"); - + printf("Aborting dump due to I/O error %d.\n", error); cam_periph_unlock(periph); + return (error); } @@ -423,13 +418,8 @@ ndadump(void *arg, void *virtual, vm_offset_t physical nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; nda_nvme_flush(softc, &nvmeio); - xpt_polled_action((union ccb *)&nvmeio); - - error = cam_periph_error((union ccb *)&nvmeio, - 0, SF_NO_RECOVERY | SF_NO_RETRY); - if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0, - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) xpt_print(periph->path, "flush cmd failed\n"); cam_periph_unlock(periph); Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Dec 6 23:05:07 2017 (r326643) +++ head/sys/cam/scsi/scsi_da.c Wed Dec 6 23:05:15 2017 (r326644) @@ -1673,13 +1673,8 @@ dadump(void *arg, void *virtual, vm_offset_t physical, /*dxfer_len*/length, /*sense_len*/SSD_FULL_SIZE, da_default_timeout * 1000); - xpt_polled_action((union ccb *)&csio); - - error = cam_periph_error((union ccb *)&csio, - 0, SF_NO_RECOVERY | SF_NO_RETRY); - if ((csio.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(csio.ccb_h.path, /*relsim_flags*/0, - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + error = cam_periph_runccb((union ccb *)&csio, cam_periph_error, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) printf("Aborting dump due to I/O error.\n"); cam_periph_unlock(periph); @@ -1701,13 +1696,8 @@ dadump(void *arg, void *virtual, vm_offset_t physical, /*lb_count*/0, SSD_FULL_SIZE, 5 * 1000); - xpt_polled_action((union ccb *)&csio); - - error = cam_periph_error((union ccb *)&csio, - 0, SF_NO_RECOVERY | SF_NO_RETRY | SF_QUIET_IR); - if ((csio.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(csio.ccb_h.path, /*relsim_flags*/0, - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + error = cam_periph_runccb((union ccb *)&csio, cam_periph_error, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); }