|
|
24d93b |
From 87029b097c79483c8a03c68a065a78973e0456db Mon Sep 17 00:00:00 2001
|
|
|
24d93b |
From: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
|
|
|
24d93b |
Date: Tue, 10 Jan 2017 18:20:50 -0500
|
|
|
24d93b |
Subject: [PATCH 08/11] scsi: megaraid_sas: Enable or Disable Fast path based
|
|
|
24d93b |
on the PCI Threshold Bandwidth
|
|
|
24d93b |
|
|
|
24d93b |
Large SEQ IO workload should sent as non fast path commands
|
|
|
24d93b |
|
|
|
24d93b |
Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
|
|
|
24d93b |
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
|
|
|
24d93b |
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
|
|
|
24d93b |
---
|
|
|
24d93b |
drivers/scsi/megaraid/megaraid_sas.h | 8 +++++
|
|
|
24d93b |
drivers/scsi/megaraid/megaraid_sas_base.c | 48 +++++++++++++++++++++++++++++
|
|
|
24d93b |
drivers/scsi/megaraid/megaraid_sas_fp.c | 7 +++++
|
|
|
24d93b |
drivers/scsi/megaraid/megaraid_sas_fusion.c | 16 ++++++----
|
|
|
24d93b |
drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 +-
|
|
|
24d93b |
5 files changed, 74 insertions(+), 7 deletions(-)
|
|
|
24d93b |
|
|
|
24d93b |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
|
|
|
24d93b |
index d5205c4..f6ac1b2 100644
|
|
|
24d93b |
--- a/drivers/scsi/megaraid/megaraid_sas.h
|
|
|
24d93b |
+++ b/drivers/scsi/megaraid/megaraid_sas.h
|
|
|
24d93b |
@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {
|
|
|
24d93b |
#define MFI_1068_FW_HANDSHAKE_OFFSET 0x64
|
|
|
24d93b |
#define MFI_1068_FW_READY 0xDDDD0000
|
|
|
24d93b |
|
|
|
24d93b |
+#define MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL HZ
|
|
|
24d93b |
+
|
|
|
24d93b |
#define MR_MAX_REPLY_QUEUES_OFFSET 0X0000001F
|
|
|
24d93b |
#define MR_MAX_REPLY_QUEUES_EXT_OFFSET 0X003FC000
|
|
|
24d93b |
#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14
|
|
|
24d93b |
@@ -2101,6 +2103,10 @@ struct megasas_instance {
|
|
|
24d93b |
atomic_t ldio_outstanding;
|
|
|
24d93b |
atomic_t fw_reset_no_pci_access;
|
|
|
24d93b |
|
|
|
24d93b |
+ atomic64_t bytes_wrote; /* used for raid1 fast path enable or disable */
|
|
|
24d93b |
+ atomic_t r1_write_fp_capable;
|
|
|
24d93b |
+
|
|
|
24d93b |
+
|
|
|
24d93b |
struct megasas_instance_template *instancet;
|
|
|
24d93b |
struct tasklet_struct isr_tasklet;
|
|
|
24d93b |
struct work_struct work_init;
|
|
|
24d93b |
@@ -2143,6 +2149,7 @@ struct megasas_instance {
|
|
|
24d93b |
long reset_flags;
|
|
|
24d93b |
struct mutex reset_mutex;
|
|
|
24d93b |
struct timer_list sriov_heartbeat_timer;
|
|
|
24d93b |
+ struct timer_list r1_fp_hold_timer;
|
|
|
24d93b |
char skip_heartbeat_timer_del;
|
|
|
24d93b |
u8 requestorId;
|
|
|
24d93b |
char PlasmaFW111;
|
|
|
24d93b |
@@ -2159,6 +2166,7 @@ struct megasas_instance {
|
|
|
24d93b |
bool is_ventura;
|
|
|
24d93b |
bool msix_combined;
|
|
|
24d93b |
u16 max_raid_mapsize;
|
|
|
24d93b |
+ u64 pci_threshold_bandwidth; /* used to control the fp writes */
|
|
|
24d93b |
};
|
|
|
24d93b |
struct MR_LD_VF_MAP {
|
|
|
24d93b |
u32 size;
|
|
|
24d93b |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
|
|
|
24d93b |
index 8b0c686..cab3be8 100644
|
|
|
24d93b |
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
|
|
|
24d93b |
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
|
|
|
24d93b |
@@ -1959,6 +1959,9 @@ void megaraid_sas_kill_hba(struct megasas_instance *instance)
|
|
|
24d93b |
}
|
|
|
24d93b |
/* Complete outstanding ioctls when adapter is killed */
|
|
|
24d93b |
megasas_complete_outstanding_ioctls(instance);
|
|
|
24d93b |
+ if (instance->is_ventura)
|
|
|
24d93b |
+ del_timer_sync(&instance->r1_fp_hold_timer);
|
|
|
24d93b |
+
|
|
|
24d93b |
}
|
|
|
24d93b |
|
|
|
24d93b |
/**
|
|
|
24d93b |
@@ -2457,6 +2460,24 @@ void megasas_sriov_heartbeat_handler(unsigned long instance_addr)
|
|
|
24d93b |
}
|
|
|
24d93b |
}
|
|
|
24d93b |
|
|
|
24d93b |
+/*Handler for disabling/enabling raid 1 fast paths*/
|
|
|
24d93b |
+void megasas_change_r1_fp_status(unsigned long instance_addr)
|
|
|
24d93b |
+{
|
|
|
24d93b |
+ struct megasas_instance *instance =
|
|
|
24d93b |
+ (struct megasas_instance *)instance_addr;
|
|
|
24d93b |
+ if (atomic64_read(&instance->bytes_wrote) >=
|
|
|
24d93b |
+ instance->pci_threshold_bandwidth) {
|
|
|
24d93b |
+
|
|
|
24d93b |
+ atomic64_set(&instance->bytes_wrote, 0);
|
|
|
24d93b |
+ atomic_set(&instance->r1_write_fp_capable, 0);
|
|
|
24d93b |
+ } else {
|
|
|
24d93b |
+ atomic64_set(&instance->bytes_wrote, 0);
|
|
|
24d93b |
+ atomic_set(&instance->r1_write_fp_capable, 1);
|
|
|
24d93b |
+ }
|
|
|
24d93b |
+ mod_timer(&instance->r1_fp_hold_timer,
|
|
|
24d93b |
+ jiffies + MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL);
|
|
|
24d93b |
+}
|
|
|
24d93b |
+
|
|
|
24d93b |
/**
|
|
|
24d93b |
* megasas_wait_for_outstanding - Wait for all outstanding cmds
|
|
|
24d93b |
* @instance: Adapter soft state
|
|
|
24d93b |
@@ -5403,6 +5424,17 @@ static int megasas_init_fw(struct megasas_instance *instance)
|
|
|
24d93b |
instance->skip_heartbeat_timer_del = 1;
|
|
|
24d93b |
}
|
|
|
24d93b |
|
|
|
24d93b |
+ if (instance->is_ventura) {
|
|
|
24d93b |
+ atomic64_set(&instance->bytes_wrote, 0);
|
|
|
24d93b |
+ atomic_set(&instance->r1_write_fp_capable, 1);
|
|
|
24d93b |
+ megasas_start_timer(instance,
|
|
|
24d93b |
+ &instance->r1_fp_hold_timer,
|
|
|
24d93b |
+ megasas_change_r1_fp_status,
|
|
|
24d93b |
+ MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL);
|
|
|
24d93b |
+ dev_info(&instance->pdev->dev, "starting the raid 1 fp timer with interval %d\n",
|
|
|
24d93b |
+ MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL);
|
|
|
24d93b |
+ }
|
|
|
24d93b |
+
|
|
|
24d93b |
return 0;
|
|
|
24d93b |
|
|
|
24d93b |
fail_get_ld_pd_list:
|
|
|
24d93b |
@@ -6202,6 +6234,9 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state)
|
|
|
24d93b |
if (instance->requestorId && !instance->skip_heartbeat_timer_del)
|
|
|
24d93b |
del_timer_sync(&instance->sriov_heartbeat_timer);
|
|
|
24d93b |
|
|
|
24d93b |
+ if (instance->is_ventura)
|
|
|
24d93b |
+ del_timer_sync(&instance->r1_fp_hold_timer);
|
|
|
24d93b |
+
|
|
|
24d93b |
megasas_flush_cache(instance);
|
|
|
24d93b |
megasas_shutdown_controller(instance, MR_DCMD_HIBERNATE_SHUTDOWN);
|
|
|
24d93b |
|
|
|
24d93b |
@@ -6321,6 +6356,16 @@ megasas_resume(struct pci_dev *pdev)
|
|
|
24d93b |
megasas_setup_jbod_map(instance);
|
|
|
24d93b |
instance->unload = 0;
|
|
|
24d93b |
|
|
|
24d93b |
+ if (instance->is_ventura) {
|
|
|
24d93b |
+ atomic64_set(&instance->bytes_wrote, 0);
|
|
|
24d93b |
+ atomic_set(&instance->r1_write_fp_capable, 1);
|
|
|
24d93b |
+ megasas_start_timer(instance,
|
|
|
24d93b |
+ &instance->r1_fp_hold_timer,
|
|
|
24d93b |
+ megasas_change_r1_fp_status,
|
|
|
24d93b |
+ MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL);
|
|
|
24d93b |
+ }
|
|
|
24d93b |
+
|
|
|
24d93b |
+
|
|
|
24d93b |
/*
|
|
|
24d93b |
* Initiate AEN (Asynchronous Event Notification)
|
|
|
24d93b |
*/
|
|
|
24d93b |
@@ -6381,6 +6426,9 @@ static void megasas_detach_one(struct pci_dev *pdev)
|
|
|
24d93b |
if (instance->requestorId && !instance->skip_heartbeat_timer_del)
|
|
|
24d93b |
del_timer_sync(&instance->sriov_heartbeat_timer);
|
|
|
24d93b |
|
|
|
24d93b |
+ if (instance->is_ventura)
|
|
|
24d93b |
+ del_timer_sync(&instance->r1_fp_hold_timer);
|
|
|
24d93b |
+
|
|
|
24d93b |
if (instance->fw_crash_state != UNAVAILABLE)
|
|
|
24d93b |
megasas_free_host_crash_buffer(instance);
|
|
|
24d93b |
scsi_remove_host(instance->host);
|
|
|
24d93b |
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c
|
|
|
24d93b |
index e45affe..5cad7c6 100644
|
|
|
24d93b |
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
|
|
|
24d93b |
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
|
|
|
24d93b |
@@ -197,6 +197,9 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
|
|
|
24d93b |
|
|
|
24d93b |
if (instance->max_raid_mapsize) {
|
|
|
24d93b |
fw_map_dyn = fusion->ld_map[(instance->map_id & 1)];
|
|
|
24d93b |
+ if (fw_map_dyn->pci_threshold_bandwidth)
|
|
|
24d93b |
+ instance->pci_threshold_bandwidth =
|
|
|
24d93b |
+ le64_to_cpu(fw_map_dyn->pci_threshold_bandwidth);
|
|
|
24d93b |
#if VD_EXT_DEBUG
|
|
|
24d93b |
dev_dbg(&instance->pdev->dev, "raidMapSize 0x%x fw_map_dyn->descTableOffset 0x%x\n",
|
|
|
24d93b |
le32_to_cpu(fw_map_dyn->raid_map_size),
|
|
|
24d93b |
@@ -204,6 +207,8 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
|
|
|
24d93b |
dev_dbg(&instance->pdev->dev, "descTableSize 0x%x descTableNumElements 0x%x\n",
|
|
|
24d93b |
le32_to_cpu(fw_map_dyn->desc_table_size),
|
|
|
24d93b |
le32_to_cpu(fw_map_dyn->desc_table_num_elements));
|
|
|
24d93b |
+ dev_dbg(&instance->pdev->dev, "PCIThreasholdBandwidth %llu\n",
|
|
|
24d93b |
+ instance->pci_threshold_bandwidth);
|
|
|
24d93b |
dev_dbg(&instance->pdev->dev, "drv map %p ldCount %d\n",
|
|
|
24d93b |
drv_map, fw_map_dyn->ld_count);
|
|
|
24d93b |
#endif
|
|
|
24d93b |
@@ -434,6 +439,8 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
|
|
|
24d93b |
sizeof(struct MR_DEV_HANDLE_INFO) *
|
|
|
24d93b |
MAX_RAIDMAP_PHYSICAL_DEVICES);
|
|
|
24d93b |
}
|
|
|
24d93b |
+ if (instance->is_ventura && !instance->pci_threshold_bandwidth)
|
|
|
24d93b |
+ instance->pci_threshold_bandwidth = ULLONG_MAX;
|
|
|
24d93b |
}
|
|
|
24d93b |
|
|
|
24d93b |
/*
|
|
|
24d93b |
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
|
|
|
24d93b |
index 1802c57..5689a44 100644
|
|
|
24d93b |
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
|
|
|
24d93b |
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
|
|
|
24d93b |
@@ -95,6 +95,7 @@ extern unsigned int resetwaittime;
|
|
|
24d93b |
extern unsigned int dual_qdepth_disable;
|
|
|
24d93b |
static void megasas_free_rdpq_fusion(struct megasas_instance *instance);
|
|
|
24d93b |
static void megasas_free_reply_fusion(struct megasas_instance *instance);
|
|
|
24d93b |
+void megasas_change_r1_fp_status(unsigned long instance_addr);
|
|
|
24d93b |
|
|
|
24d93b |
|
|
|
24d93b |
|
|
|
24d93b |
@@ -2628,8 +2629,9 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
|
|
|
24d93b |
* to get new command
|
|
|
24d93b |
*/
|
|
|
24d93b |
if (cmd->is_raid_1_fp_write &&
|
|
|
24d93b |
- atomic_inc_return(&instance->fw_outstanding) >
|
|
|
24d93b |
- (instance->host->can_queue)) {
|
|
|
24d93b |
+ (atomic_inc_return(&instance->fw_outstanding) >
|
|
|
24d93b |
+ (instance->host->can_queue) ||
|
|
|
24d93b |
+ (!atomic_read(&instance->r1_write_fp_capable)))) {
|
|
|
24d93b |
megasas_fpio_to_ldio(instance, cmd, cmd->scmd);
|
|
|
24d93b |
atomic_dec(&instance->fw_outstanding);
|
|
|
24d93b |
} else if (cmd->is_raid_1_fp_write) {
|
|
|
24d93b |
@@ -2638,17 +2640,19 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
|
|
|
24d93b |
megasas_prepare_secondRaid1_IO(instance, cmd, r1_cmd);
|
|
|
24d93b |
}
|
|
|
24d93b |
|
|
|
24d93b |
-
|
|
|
24d93b |
/*
|
|
|
24d93b |
* Issue the command to the FW
|
|
|
24d93b |
*/
|
|
|
24d93b |
+ if (scmd->sc_data_direction == PCI_DMA_TODEVICE && instance->is_ventura)
|
|
|
24d93b |
+ atomic64_add(scsi_bufflen(scmd), &instance->bytes_wrote);
|
|
|
24d93b |
|
|
|
24d93b |
megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
|
|
|
24d93b |
|
|
|
24d93b |
- if (r1_cmd)
|
|
|
24d93b |
+ if (r1_cmd) {
|
|
|
24d93b |
+ atomic64_add(scsi_bufflen(scmd), &instance->bytes_wrote);
|
|
|
24d93b |
megasas_fire_cmd_fusion(instance, r1_cmd->request_desc,
|
|
|
24d93b |
- instance->is_ventura);
|
|
|
24d93b |
-
|
|
|
24d93b |
+ instance->is_ventura);
|
|
|
24d93b |
+ }
|
|
|
24d93b |
|
|
|
24d93b |
return 0;
|
|
|
24d93b |
}
|
|
|
24d93b |
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h
|
|
|
24d93b |
index b24262a..f7384c1 100644
|
|
|
24d93b |
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h
|
|
|
24d93b |
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h
|
|
|
24d93b |
@@ -977,7 +977,7 @@ struct MR_FW_RAID_MAP_DYNAMIC {
|
|
|
24d93b |
u32 desc_table_size; /* Total Size of desc table */
|
|
|
24d93b |
/* Total Number of elements in the desc table */
|
|
|
24d93b |
u32 desc_table_num_elements;
|
|
|
24d93b |
- u64 reserved1;
|
|
|
24d93b |
+ u64 pci_threshold_bandwidth;
|
|
|
24d93b |
u32 reserved2[3]; /*future use */
|
|
|
24d93b |
/* timeout value used by driver in FP IOs */
|
|
|
24d93b |
u8 fp_pd_io_timeout_sec;
|
|
|
24d93b |
--
|
|
|
24d93b |
1.8.3.1
|
|
|
24d93b |
|