git: d1bc23490194 - stable/13 - cam: Relax callouts precisions.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 21 Jan 2022 01:59:39 UTC
The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d1bc23490194bd5a441b26fa1409717c267861f0 commit d1bc23490194bd5a441b26fa1409717c267861f0 Author: Alexander Motin <mav@FreeBSD.org> AuthorDate: 2022-01-07 17:49:21 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2022-01-21 01:59:34 +0000 cam: Relax callouts precisions. On large systems even relatively rare callouts may fire many times per second. This should allow them to aggregate better, since we do not require any precision when polling for media change, etc. MFC after: 2 weeks (cherry picked from commit 0e5c50bf60727a5a832da9ba9dac06c057307a76) --- sys/cam/ata/ata_da.c | 13 +++++++------ sys/cam/cam_xpt.c | 6 +++--- sys/cam/scsi/scsi_cd.c | 14 +++++++++----- sys/cam/scsi/scsi_da.c | 26 +++++++++++++++----------- sys/cam/scsi/scsi_enc.c | 4 ++-- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index 36d0416a65a4..d49ef81f6009 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -1937,9 +1937,9 @@ adaregister(struct cam_periph *periph, void *arg) * ordered tag to a device. */ callout_init_mtx(&softc->sendordered_c, cam_periph_mtx(periph), 0); - callout_reset(&softc->sendordered_c, - (ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL, - adasendorderedtag, softc); + callout_reset_sbt(&softc->sendordered_c, + SBT_1S / ADA_ORDEREDTAG_INTERVAL * ada_default_timeout, 0, + adasendorderedtag, softc, C_PREL(1)); if (ADA_RA >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) { softc->state = ADA_STATE_RAHEAD; @@ -3505,10 +3505,11 @@ adasendorderedtag(void *arg) softc->flags &= ~ADA_FLAG_WAS_OTAG; } } + /* Queue us up again */ - callout_reset(&softc->sendordered_c, - (ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL, - adasendorderedtag, softc); + callout_schedule_sbt(&softc->sendordered_c, + SBT_1S / ADA_ORDEREDTAG_INTERVAL * ada_default_timeout, 0, + C_PREL(1)); } /* diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 678d8e0b4f3d..184a6b69b488 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -3030,7 +3030,7 @@ call_sim: } callout_reset_sbt(&dev->callout, - SBT_1MS * crs->release_timeout, 0, + SBT_1MS * crs->release_timeout, SBT_1MS, xpt_release_devq_timeout, dev, 0); dev->flags |= CAM_DEV_REL_TIMEOUT_PENDING; @@ -5079,8 +5079,8 @@ xpt_ch_done(void *arg) { callout_init(&xsoftc.boot_callout, 1); - callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0, - xpt_boot_delay, NULL, 0); + callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, + SBT_1MS, xpt_boot_delay, NULL, 0); } SYSINIT(xpt_hw_delay, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, xpt_ch_done, NULL); diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 460b423e469e..b9d5d1a76b9c 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -745,9 +745,10 @@ cdregister(struct cam_periph *periph, void *arg) callout_init_mtx(&softc->mediapoll_c, cam_periph_mtx(periph), 0); if ((softc->flags & CD_FLAG_DISC_REMOVABLE) && (cgd->inq_flags & SID_AEN) == 0 && - cd_poll_period != 0) - callout_reset(&softc->mediapoll_c, cd_poll_period * hz, - cdmediapoll, periph); + cd_poll_period != 0) { + callout_reset_sbt(&softc->mediapoll_c, cd_poll_period * SBT_1S, + 0, cdmediapoll, periph, C_PREL(1)); + } xpt_schedule(periph, CAM_PRIORITY_DEV); return(CAM_REQ_CMP); @@ -3134,9 +3135,12 @@ cdmediapoll(void *arg) xpt_schedule(periph, CAM_PRIORITY_NORMAL); } } + /* Queue us up again */ - if (cd_poll_period != 0) - callout_schedule(&softc->mediapoll_c, cd_poll_period * hz); + if (cd_poll_period != 0) { + callout_schedule_sbt(&softc->mediapoll_c, + cd_poll_period * SBT_1S, 0, C_PREL(1)); + } } /* diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 034953494bf6..a5f0198468f5 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -2863,9 +2863,9 @@ daregister(struct cam_periph *periph, void *arg) * ordered tag to a device. */ callout_init_mtx(&softc->sendordered_c, cam_periph_mtx(periph), 0); - callout_reset(&softc->sendordered_c, - (da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, - dasendorderedtag, periph); + callout_reset_sbt(&softc->sendordered_c, + SBT_1S / DA_ORDEREDTAG_INTERVAL * da_default_timeout, 0, + dasendorderedtag, periph, C_PREL(1)); cam_periph_unlock(periph); /* @@ -2990,9 +2990,10 @@ daregister(struct cam_periph *periph, void *arg) callout_init_mtx(&softc->mediapoll_c, cam_periph_mtx(periph), 0); if ((softc->flags & DA_FLAG_PACK_REMOVABLE) && (cgd->inq_flags & SID_AEN) == 0 && - da_poll_period != 0) - callout_reset(&softc->mediapoll_c, da_poll_period * hz, - damediapoll, periph); + da_poll_period != 0) { + callout_reset_sbt(&softc->mediapoll_c, da_poll_period * SBT_1S, + 0, damediapoll, periph, C_PREL(1)); + } xpt_schedule(periph, CAM_PRIORITY_DEV); @@ -6021,9 +6022,12 @@ damediapoll(void *arg) daschedule(periph); } } + /* Queue us up again */ - if (da_poll_period != 0) - callout_schedule(&softc->mediapoll_c, da_poll_period * hz); + if (da_poll_period != 0) { + callout_schedule_sbt(&softc->mediapoll_c, + da_poll_period * SBT_1S, 0, C_PREL(1)); + } } static void @@ -6208,9 +6212,9 @@ dasendorderedtag(void *arg) } /* Queue us up again */ - callout_reset(&softc->sendordered_c, - (da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, - dasendorderedtag, periph); + callout_schedule_sbt(&softc->sendordered_c, + SBT_1S / DA_ORDEREDTAG_INTERVAL * da_default_timeout, 0, + C_PREL(1)); } /* diff --git a/sys/cam/scsi/scsi_enc.c b/sys/cam/scsi/scsi_enc.c index ad6c09c99f58..e01f613514fb 100644 --- a/sys/cam/scsi/scsi_enc.c +++ b/sys/cam/scsi/scsi_enc.c @@ -844,8 +844,8 @@ enc_daemon(void *arg) */ root_mount_rel(&enc->enc_rootmount); - callout_reset(&enc->status_updater, 60*hz, - enc_status_updater, enc); + callout_reset_sbt(&enc->status_updater, 60 * SBT_1S, 0, + enc_status_updater, enc, C_PREL(1)); cam_periph_sleep(enc->periph, enc->enc_daemon, PUSER, "idle", 0);