Skip to content

Commit a2d5a00

Browse files
mwilckmartinkpetersen
authored andcommitted
scsi: smartpqi: Use is_kdump_kernel() to check for kdump
The smartpqi driver checks the reset_devices variable to determine whether special adjustments need to be made for kdump. This has the effect that after a regular kexec reboot, some driver parameters such as max_transfer_size are much lower than usual. More importantly, kexec reboot tests have revealed memory corruption caused by the driver log being written to system memory after a kexec. Fix this by testing is_kdump_kernel() rather than reset_devices where appropriate. Fixes: 058311b ("scsi: smartpqi: Add fw log to kdump") Signed-off-by: Martin Wilck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Randy Wright <[email protected]> Acked-by: Don Brace <[email protected]> Tested-by: Don Brace <[email protected]> Reviewed-by: Lee Duncan <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f7b705c commit a2d5a00

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/scsi/smartpqi/smartpqi_init.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/bcd.h>
2020
#include <linux/reboot.h>
2121
#include <linux/cciss_ioctl.h>
22+
#include <linux/crash_dump.h>
2223
#include <scsi/scsi_host.h>
2324
#include <scsi/scsi_cmnd.h>
2425
#include <scsi/scsi_device.h>
@@ -5246,7 +5247,7 @@ static void pqi_calculate_io_resources(struct pqi_ctrl_info *ctrl_info)
52465247
ctrl_info->error_buffer_length =
52475248
ctrl_info->max_io_slots * PQI_ERROR_BUFFER_ELEMENT_LENGTH;
52485249

5249-
if (reset_devices)
5250+
if (is_kdump_kernel())
52505251
max_transfer_size = min(ctrl_info->max_transfer_size,
52515252
PQI_MAX_TRANSFER_SIZE_KDUMP);
52525253
else
@@ -5275,7 +5276,7 @@ static void pqi_calculate_queue_resources(struct pqi_ctrl_info *ctrl_info)
52755276
u16 num_elements_per_iq;
52765277
u16 num_elements_per_oq;
52775278

5278-
if (reset_devices) {
5279+
if (is_kdump_kernel()) {
52795280
num_queue_groups = 1;
52805281
} else {
52815282
int num_cpus;
@@ -8288,12 +8289,12 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info)
82888289
u32 product_id;
82898290

82908291
if (reset_devices) {
8291-
if (pqi_is_fw_triage_supported(ctrl_info)) {
8292+
if (is_kdump_kernel() && pqi_is_fw_triage_supported(ctrl_info)) {
82928293
rc = sis_wait_for_fw_triage_completion(ctrl_info);
82938294
if (rc)
82948295
return rc;
82958296
}
8296-
if (sis_is_ctrl_logging_supported(ctrl_info)) {
8297+
if (is_kdump_kernel() && sis_is_ctrl_logging_supported(ctrl_info)) {
82978298
sis_notify_kdump(ctrl_info);
82988299
rc = sis_wait_for_ctrl_logging_completion(ctrl_info);
82998300
if (rc)
@@ -8344,7 +8345,7 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info)
83448345
ctrl_info->product_id = (u8)product_id;
83458346
ctrl_info->product_revision = (u8)(product_id >> 8);
83468347

8347-
if (reset_devices) {
8348+
if (is_kdump_kernel()) {
83488349
if (ctrl_info->max_outstanding_requests >
83498350
PQI_MAX_OUTSTANDING_REQUESTS_KDUMP)
83508351
ctrl_info->max_outstanding_requests =
@@ -8480,7 +8481,7 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info)
84808481
if (rc)
84818482
return rc;
84828483

8483-
if (ctrl_info->ctrl_logging_supported && !reset_devices) {
8484+
if (ctrl_info->ctrl_logging_supported && !is_kdump_kernel()) {
84848485
pqi_host_setup_buffer(ctrl_info, &ctrl_info->ctrl_log_memory, PQI_CTRL_LOG_TOTAL_SIZE, PQI_CTRL_LOG_MIN_SIZE);
84858486
pqi_host_memory_update(ctrl_info, &ctrl_info->ctrl_log_memory, PQI_VENDOR_GENERAL_CTRL_LOG_MEMORY_UPDATE);
84868487
}

0 commit comments

Comments
 (0)