Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: smartpqi: Resolve delay issue with PQI_HZ value

Change PQI_HZ to HZ.

PQI_HZ macro was set to 1000 when HZ value is less than 1000. By default,
PQI_HZ will result into a delay of 10 seconds(for kernel, which has HZ =
100). So in this case when firmware raises an event, rescan worker will be
scheduled after a delay of (10 x PQI_HZ) = 100 seconds instead of 10
seconds.

Also driver uses PQI_HZ at many instances, which might result in some other
issues with respect to delay.

Link: https://lore.kernel.org/r/164375210825.440833.15510172447583227486.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Balsundar P <balsundar.p@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Balsundar P and committed by
Martin K. Petersen
42dc0426 9e98e60b

+20 -26
-6
drivers/scsi/smartpqi/smartpqi.h
··· 96 96 struct pqi_device_registers pqi_registers; /* 4000h */ 97 97 }; 98 98 99 - #if ((HZ) < 1000) 100 - #define PQI_HZ 1000 101 - #else 102 - #define PQI_HZ (HZ) 103 - #endif 104 - 105 99 #define PQI_DEVICE_REGISTERS_OFFSET 0x4000 106 100 107 101 /* shutdown reasons for taking the controller offline */
+16 -16
drivers/scsi/smartpqi/smartpqi_init.c
··· 376 376 377 377 displayed_warning = false; 378 378 start_jiffies = jiffies; 379 - warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * PQI_HZ) + start_jiffies; 379 + warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * HZ) + start_jiffies; 380 380 381 381 while (atomic_read(&ctrl_info->num_busy_threads) > 382 382 atomic_read(&ctrl_info->num_blocked_threads)) { ··· 385 385 "waiting %u seconds for driver activity to quiesce\n", 386 386 jiffies_to_msecs(jiffies - start_jiffies) / 1000); 387 387 displayed_warning = true; 388 - warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * PQI_HZ) + jiffies; 388 + warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * HZ) + jiffies; 389 389 } 390 390 usleep_range(1000, 2000); 391 391 } ··· 462 462 pqi_schedule_rescan_worker_with_delay(ctrl_info, 0); 463 463 } 464 464 465 - #define PQI_RESCAN_WORK_DELAY (10 * PQI_HZ) 465 + #define PQI_RESCAN_WORK_DELAY (10 * HZ) 466 466 467 467 static inline void pqi_schedule_rescan_worker_delayed(struct pqi_ctrl_info *ctrl_info) 468 468 { ··· 1038 1038 return rc; 1039 1039 } 1040 1040 1041 - #define PQI_UPDATE_TIME_WORK_INTERVAL (24UL * 60 * 60 * PQI_HZ) 1041 + #define PQI_UPDATE_TIME_WORK_INTERVAL (24UL * 60 * 60 * HZ) 1042 1042 1043 1043 static void pqi_update_time_worker(struct work_struct *work) 1044 1044 { ··· 3045 3045 u8 status; 3046 3046 3047 3047 pqi_registers = ctrl_info->pqi_registers; 3048 - timeout = (PQI_MODE_READY_TIMEOUT_SECS * PQI_HZ) + jiffies; 3048 + timeout = (PQI_MODE_READY_TIMEOUT_SECS * HZ) + jiffies; 3049 3049 3050 3050 while (1) { 3051 3051 signature = readq(&pqi_registers->signature); ··· 3539 3539 u8 status; 3540 3540 unsigned long timeout; 3541 3541 3542 - timeout = (PQI_SOFT_RESET_STATUS_TIMEOUT_SECS * PQI_HZ) + jiffies; 3542 + timeout = (PQI_SOFT_RESET_STATUS_TIMEOUT_SECS * HZ) + jiffies; 3543 3543 3544 3544 while (1) { 3545 3545 status = pqi_read_soft_reset_status(ctrl_info); ··· 3717 3717 pqi_ctrl_unbusy(ctrl_info); 3718 3718 } 3719 3719 3720 - #define PQI_HEARTBEAT_TIMER_INTERVAL (10 * PQI_HZ) 3720 + #define PQI_HEARTBEAT_TIMER_INTERVAL (10 * HZ) 3721 3721 3722 3722 static void pqi_heartbeat_timer_handler(struct timer_list *t) 3723 3723 { ··· 4264 4264 return 0; 4265 4265 } 4266 4266 4267 - #define PQI_ADMIN_QUEUE_CREATE_TIMEOUT_JIFFIES PQI_HZ 4267 + #define PQI_ADMIN_QUEUE_CREATE_TIMEOUT_JIFFIES HZ 4268 4268 #define PQI_ADMIN_QUEUE_CREATE_POLL_INTERVAL_MSECS 1 4269 4269 4270 4270 static int pqi_create_admin_queues(struct pqi_ctrl_info *ctrl_info) ··· 4358 4358 admin_queues = &ctrl_info->admin_queues; 4359 4359 oq_ci = admin_queues->oq_ci_copy; 4360 4360 4361 - timeout = (PQI_ADMIN_REQUEST_TIMEOUT_SECS * PQI_HZ) + jiffies; 4361 + timeout = (PQI_ADMIN_REQUEST_TIMEOUT_SECS * HZ) + jiffies; 4362 4362 4363 4363 while (1) { 4364 4364 oq_pi = readl(admin_queues->oq_pi); ··· 4473 4473 4474 4474 while (1) { 4475 4475 if (wait_for_completion_io_timeout(wait, 4476 - PQI_WAIT_FOR_COMPLETION_IO_TIMEOUT_SECS * PQI_HZ)) { 4476 + PQI_WAIT_FOR_COMPLETION_IO_TIMEOUT_SECS * HZ)) { 4477 4477 rc = 0; 4478 4478 break; 4479 4479 } ··· 6065 6065 6066 6066 displayed_warning = false; 6067 6067 start_jiffies = jiffies; 6068 - warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * PQI_HZ) + start_jiffies; 6068 + warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * HZ) + start_jiffies; 6069 6069 6070 6070 while (1) { 6071 6071 queued_io_count = pqi_queued_io_count(ctrl_info); ··· 6080 6080 "waiting %u seconds for queued I/O to drain (queued I/O count: %u; non-empty inbound queue count: %u)\n", 6081 6081 jiffies_to_msecs(jiffies - start_jiffies) / 1000, queued_io_count, nonempty_inbound_queue_count); 6082 6082 displayed_warning = true; 6083 - warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * PQI_HZ) + jiffies; 6083 + warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * HZ) + jiffies; 6084 6084 } 6085 6085 usleep_range(1000, 2000); 6086 6086 } ··· 6148 6148 unsigned long msecs_waiting; 6149 6149 6150 6150 start_jiffies = jiffies; 6151 - warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * PQI_HZ) + start_jiffies; 6151 + warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * HZ) + start_jiffies; 6152 6152 6153 6153 while ((cmds_outstanding = atomic_read(&device->scsi_cmds_outstanding)) > 0) { 6154 6154 pqi_check_ctrl_health(ctrl_info); ··· 6167 6167 "scsi %d:%d:%d:%d: waiting %lu seconds for %d outstanding command(s)\n", 6168 6168 ctrl_info->scsi_host->host_no, device->bus, device->target, 6169 6169 device->lun, msecs_waiting / 1000, cmds_outstanding); 6170 - warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * PQI_HZ) + jiffies; 6170 + warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * HZ) + jiffies; 6171 6171 } 6172 6172 usleep_range(1000, 2000); 6173 6173 } ··· 6196 6196 6197 6197 while (1) { 6198 6198 if (wait_for_completion_io_timeout(wait, 6199 - PQI_LUN_RESET_POLL_COMPLETION_SECS * PQI_HZ)) { 6199 + PQI_LUN_RESET_POLL_COMPLETION_SECS * HZ)) { 6200 6200 rc = 0; 6201 6201 break; 6202 6202 } ··· 7994 7994 return rc; 7995 7995 } 7996 7996 sis_soft_reset(ctrl_info); 7997 - msleep(PQI_POST_RESET_DELAY_SECS * PQI_HZ); 7997 + ssleep(PQI_POST_RESET_DELAY_SECS); 7998 7998 } else { 7999 7999 rc = pqi_force_sis_mode(ctrl_info); 8000 8000 if (rc)
+4 -4
drivers/scsi/smartpqi/smartpqi_sis.c
··· 92 92 unsigned long timeout; 93 93 u32 status; 94 94 95 - timeout = (timeout_secs * PQI_HZ) + jiffies; 95 + timeout = (timeout_secs * HZ) + jiffies; 96 96 97 97 while (1) { 98 98 status = readl(&ctrl_info->registers->sis_firmware_status); ··· 209 209 * the top of the loop in order to give the controller time to start 210 210 * processing the command before we start polling. 211 211 */ 212 - timeout = (SIS_CMD_COMPLETE_TIMEOUT_SECS * PQI_HZ) + jiffies; 212 + timeout = (SIS_CMD_COMPLETE_TIMEOUT_SECS * HZ) + jiffies; 213 213 while (1) { 214 214 msleep(SIS_CMD_COMPLETE_POLL_INTERVAL_MSECS); 215 215 doorbell = readl(&registers->sis_ctrl_to_host_doorbell); ··· 355 355 u32 doorbell_register; 356 356 unsigned long timeout; 357 357 358 - timeout = (SIS_DOORBELL_BIT_CLEAR_TIMEOUT_SECS * PQI_HZ) + jiffies; 358 + timeout = (SIS_DOORBELL_BIT_CLEAR_TIMEOUT_SECS * HZ) + jiffies; 359 359 360 360 while (1) { 361 361 doorbell_register = ··· 452 452 enum sis_fw_triage_status status; 453 453 unsigned long timeout; 454 454 455 - timeout = (SIS_FW_TRIAGE_STATUS_TIMEOUT_SECS * PQI_HZ) + jiffies; 455 + timeout = (SIS_FW_TRIAGE_STATUS_TIMEOUT_SECS * HZ) + jiffies; 456 456 while (1) { 457 457 status = sis_read_firmware_triage_status(ctrl_info); 458 458 if (status == FW_TRIAGE_COND_INVALID) {