megaraid_sas: Updates for scsi-next
Subsystems (3)
Sumit Saxena
maintainercover megaraid_sas: Updates for scsi-next
Sumit Saxena (7):
megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for
30secs before reset
megaraid_sas: Send correct PhysArm to FW for R1 VD downgrade
megaraid_sas: Do not fire DCMDs during PCI shutdown/detach
megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
megaraid_sas: driver version upgrade
MAINTAINERS: Update megaraid maintainers list
megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which
does not support JBOD sequence map
MAINTAINERS | 10 ++--- drivers/scsi/megaraid/megaraid_sas.h | 7 +++- drivers/scsi/megaraid/megaraid_sas_base.c | 60 +++++++++++++++++++++++++---- drivers/scsi/megaraid/megaraid_sas_fp.c | 6 ++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 21 ++++++---- drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 + 6 files changed, 82 insertions(+), 24 deletions(-)
Signature · 1 line
1.8.3.1
Sumit Saxena
maintainerPATCH 1/7 megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset
For SRIOV enabled firmware, if there is a OCR(online controller reset) possibility driver set the convert flag to 1, which is not happening if there are outstanding commands even after 180 seconds.
As driver does not set convert flag to 1 and still making the OCR to run, VF(Virtual function) driver is directly writing on to the register instead of waiting for 30 seconds. Setting convert flag to 1 will cause VF driver will wait for 30 secs before going for reset.
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/megaraid/megaraid_sas_fusion.c +1 -0
@@ -2823,6 +2823,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,dev_err (&instance->pdev->dev,"pending commands remain after waiting, " "will reset adapter scsi%d.\n" , instance->host->host_no); + *convert =1 ; retval =1 ; } out:
Signature · 1 line
1.8.3.1
Re: [PATCH 1/7] megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset
Quoted 21 lines · Sumit Saxena
For SRIOV enabled firmware, if there is a OCR(online controller reset) possibility driver set the convert flag to 1, which is not happening if there are outstanding commands even after 180 seconds.
As driver does not set convert flag to 1 and still making the OCR to run, VF(Virtual function) driver is directly writing on to the register instead of waiting for 30 seconds. Setting convert flag to 1 will cause VF driver will wait for 30 secs before going for reset.Signed-off-by Kiran Kumar Kasturi <[email protected]>Signed-off-by Sumit Saxena <[email protected]>--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 + 1 file changed, 1 insertion(+)drivers/scsi/megaraid/megaraid_sas_fusion.c +0
-0
drivers/scsi/megaraid/megaraid_sas_fusion.c int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance, · line 2829
Quoted 7 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0@@ -2823,6 +2823,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,dev_err (&instance->pdev->dev,"pending commands remain after waiting, " "will reset adapter scsi%d.\n" , instance->host->host_no); + *convert =1 ; retval =1 ; } out:
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH 1/7] megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset
In reply to Sumit SaxenaQuoted 11 lines · Sumit Saxena
For SRIOV enabled firmware, if there is a OCR(online controller reset) possibility driver set the convert flag to 1, which is not happening if there are outstanding commands even after 180 seconds.
As driver does not set convert flag to 1 and still making the OCR to run, VF(Virtual function) driver is directly writing on to the register instead of waiting for 30 seconds. Setting convert flag to 1 will cause VF driver will wait for 30 secs before going for reset.Signed-off-by Kiran Kumar Kasturi <[email protected]>Signed-off-by Sumit Saxena <[email protected]>
Tomas
Sumit Saxena
maintainerPATCH 2/7 megaraid_sas: Send correct PhysArm to FW for R1 VD downgrade
In reply to Sumit SaxenaThis patch fixes the issue of wrong PhysArm was sent to firmware for R1 VD downgrade.
--- drivers/scsi/megaraid/megaraid_sas_fp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fp.c +4 -2
@@ -782,7 +782,8 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, (raid->regTypeReqOnRead != REGION_TYPE_UNUSED)))) pRAID_Context->regLockFlags =REGION_TYPE_EXCLUSIVE ; else if (raid->level == 1) { - pd =MR_ArPdGet (arRef, physArm +1 , map); + physArm = physArm +1 ; + pd =MR_ArPdGet (arRef, physArm, map);if (pd !=MR_PD_INVALID ) *pDevHandle =MR_PdDevHandleGet (pd, map); }
@@ -879,7 +880,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, pRAID_Context->regLockFlags =REGION_TYPE_EXCLUSIVE ; else if (raid->level == 1) {/* Get alternate Pd. */ - pd =MR_ArPdGet (arRef, physArm +1 , map); + physArm = physArm +1 ; + pd =MR_ArPdGet (arRef, physArm, map);if (pd !=MR_PD_INVALID )/* Get dev handle from Pd */ *pDevHandle =MR_PdDevHandleGet (pd, map);
Signature · 1 line
1.8.3.1
Re: [PATCH 2/7] megaraid_sas: Send correct PhysArm to FW for R1 VD downgrade
Quoted 25 lines · Sumit Saxena
This patch fixes the issue of wrong PhysArm was sent to firmware for R1 VD downgrade.
Signed-off-by Kiran Kumar Kasturi <[email protected]>Signed-off-by Sumit Saxena <[email protected]>--- drivers/scsi/megaraid/megaraid_sas_fp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/scsi/megaraid/megaraid_sas_fp.c +2
-1@@ -782,7 +782,8 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, (raid->regTypeReqOnRead != REGION_TYPE_UNUSED)))) pRAID_Context->regLockFlags =REGION_TYPE_EXCLUSIVE ; else if (raid->level == 1) { - pd =MR_ArPdGet (arRef, physArm +1 , map); + physArm = physArm +1 ; + pd =MR_ArPdGet (arRef, physArm, map);if (pd !=MR_PD_INVALID ) *pDevHandle =MR_PdDevHandleGet (pd, map); }
drivers/scsi/megaraid/megaraid_sas_fp.c u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, · line 887
Quoted 9 lines
drivers/scsi/megaraid/megaraid_sas_fp.c +2
-1@@ -879,7 +880,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, pRAID_Context->regLockFlags =REGION_TYPE_EXCLUSIVE ; else if (raid->level == 1) {/* Get alternate Pd. */ - pd =MR_ArPdGet (arRef, physArm +1 , map); + physArm = physArm +1 ; + pd =MR_ArPdGet (arRef, physArm, map);if (pd !=MR_PD_INVALID )/* Get dev handle from Pd */ *pDevHandle =MR_PdDevHandleGet (pd, map);
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH 2/7] megaraid_sas: Send correct PhysArm to FW for R1 VD downgrade
In reply to Sumit SaxenaQuoted 5 lines · Sumit Saxena
This patch fixes the issue of wrong PhysArm was sent to firmware for R1 VD downgrade.
Signed-off-by Kiran Kumar Kasturi <[email protected]>Signed-off-by Sumit Saxena <[email protected]>
Tomas
Sumit Saxena
maintainerPATCH 3/7 megaraid_sas: Do not fire DCMDs during PCI shutdown/detach
In reply to Sumit SaxenaThis patch addresses the issue of driver firing DCMDs in PCI shutdown/detach path irrespective of firmware state.
Driver will check for whether firmware is operational state or not before firing DCMDs. If firmware is in unrecoverbale
state or does not become operational within specfied time, driver will skip firing DCMDs.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 46 +++++++++++++++++++++++++++++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 ++++-- 2 files changed, 52 insertions(+), 3 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +46 -0
@@ -6248,6 +6248,32 @@ fail_reenable_msix:#define megasas_resume NULL#endif +static inline int +megasas_wait_for_adapter_operational (struct megasas_instance *instance) +{ +int wait_time =MEGASAS_RESET_WAIT_TIME *2 ; +int i; + +for (i =0 ; i < wait_time; i++) { +if (atomic_read (&instance->adprecovery) + ==MEGASAS_HBA_OPERATIONAL ) +break ; + +if (!(i %MEGASAS_RESET_NOTICE_INTERVAL )) +dev_notice (&instance->pdev->dev,"waiting for controller reset to finish\n" ); + +msleep (1000 ); + } + +if (atomic_read (&instance->adprecovery) !=MEGASAS_HBA_OPERATIONAL ) { +dev_info (&instance->pdev->dev,"%s timed out while waiting for HBA to recover.\n" , + __func__); +return 1 ; + } + +return 0 ; +} +/** * megasas_detach_one - PCI hot"un"plug entry point * @pdev: PCI device structure
@@ -6272,9 +6298,18 @@ static void megasas_detach_one(struct pci_dev *pdev)if (instance->fw_crash_state !=UNAVAILABLE )megasas_free_host_crash_buffer (instance);scsi_remove_host (instance->host); + +msleep (1000 ); +if ((atomic_read (&instance->adprecovery) ==MEGASAS_HW_CRITICAL_ERROR ) + || ((atomic_read (&instance->adprecovery) + !=MEGASAS_HBA_OPERATIONAL ) && +megasas_wait_for_adapter_operational (instance))) + goto skip_firing_dcmds; +megasas_flush_cache (instance);megasas_shutdown_controller (instance,MR_DCMD_CTRL_SHUTDOWN ); +skip_firing_dcmds:/* cancel the delayed work if this work still in queue*/ if (instance->ev !=NULL ) {struct megasas_aen_event *ev = instance->ev;
@@ -6388,8 +6423,19 @@ static void megasas_shutdown(struct pci_dev *pdev)struct megasas_instance *instance =pci_get_drvdata (pdev); instance->unload =1 ; + +msleep (1000 ); + +if ((atomic_read (&instance->adprecovery) ==MEGASAS_HW_CRITICAL_ERROR ) + || ((atomic_read (&instance->adprecovery) + !=MEGASAS_HBA_OPERATIONAL ) + &&megasas_wait_for_adapter_operational (instance))) + goto skip_firing_dcmds; +megasas_flush_cache (instance);megasas_shutdown_controller (instance,MR_DCMD_CTRL_SHUTDOWN ); + +skip_firing_dcmds: instance->instancet->disable_intr (instance);megasas_destroy_irqs (instance);
drivers/scsi/megaraid/megaraid_sas_fusion.c +6 -3
@@ -2463,12 +2463,15 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)/* Start collecting crash, if DMA bit is done */ if ((fw_state ==MFI_STATE_FAULT ) && dma_state)schedule_work (&instance->crash_init); -else if (fw_state ==MFI_STATE_FAULT ) -schedule_work (&instance->work_init); +else if (fw_state ==MFI_STATE_FAULT ) { +if (instance->unload ==0 ) +schedule_work (&instance->work_init); + } }else if (fw_state ==MFI_STATE_FAULT ) {dev_warn (&instance->pdev->dev,"Iop2SysDoorbellInt" "for scsi%d\n" , instance->host->host_no); -schedule_work (&instance->work_init); +if (instance->unload ==0 ) +schedule_work (&instance->work_init); } }
Signature · 1 line
1.8.3.1
Re: [PATCH 3/7] megaraid_sas: Do not fire DCMDs during PCI shutdown/detach
Quoted 59 lines · Sumit Saxena
This patch addresses the issue of driver firing DCMDs in PCI shutdown/detach path irrespective of firmware state.
Driver will check for whether firmware is operational state or not before firing DCMDs. If firmware is in unrecoverbale
state or does not become operational within specfied time, driver will skip firing DCMDs.Signed-off-by Sumit Saxena <[email protected]>--- drivers/scsi/megaraid/megaraid_sas_base.c | 46 +++++++++++++++++++++++++++++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 ++++-- 2 files changed, 52 insertions(+), 3 deletions(-)drivers/scsi/megaraid/megaraid_sas_base.c +31
-0@@ -6248,6 +6248,32 @@ fail_reenable_msix:#define megasas_resume NULL#endif +static inline int +megasas_wait_for_adapter_operational (struct megasas_instance *instance) +{ +int wait_time =MEGASAS_RESET_WAIT_TIME *2 ; +int i; + +for (i =0 ; i < wait_time; i++) { +if (atomic_read (&instance->adprecovery) + ==MEGASAS_HBA_OPERATIONAL ) +break ; + +if (!(i %MEGASAS_RESET_NOTICE_INTERVAL )) +dev_notice (&instance->pdev->dev,"waiting for controller reset to finish\n" ); + +msleep (1000 ); + } + +if (atomic_read (&instance->adprecovery) !=MEGASAS_HBA_OPERATIONAL ) { +dev_info (&instance->pdev->dev,"%s timed out while waiting for HBA to recover.\n" , + __func__); +return 1 ; + } + +return 0 ; +} +/** * megasas_detach_one - PCI hot"un"plug entry point * @pdev: PCI device structure @@ -6272,9 +6298,18 @@ static void megasas_detach_one(struct pci_dev *pdev)if (instance->fw_crash_state !=UNAVAILABLE )megasas_free_host_crash_buffer (instance);scsi_remove_host (instance->host); + +msleep (1000 ); + if ((atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) + || ((atomic_read(&instance->adprecovery) + != MEGASAS_HBA_OPERATIONAL) &&
drivers/scsi/megaraid/megaraid_sas_base.c static void megasas_detach_one(struct pci_dev *pdev) · line 6315
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +4
-0+ megasas_wait_for_adapter_operational(instance))) + goto skip_firing_dcmds; +megasas_flush_cache (instance);megasas_shutdown_controller (instance,MR_DCMD_CTRL_SHUTDOWN ); +skip_firing_dcmds:/* cancel the delayed work if this work still in queue*/ if (instance->ev !=NULL ) {struct megasas_aen_event *ev = instance->ev;
Why not move the 'msleep' and 'atomic_read' into the call to megasas_wait_for_adapter_operational?
Plus I'm not sure if the unconditional 'msleep' is a good idea here; maybe one should read 'adprecovery' first and _then_ call msleep if required?
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Sumit Saxena
maintainerRE: [PATCH 3/7] megaraid_sas: Do not fire DCMDs during PCI shutdown/detach
Quoted 5 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Monday, October 17, 2016 5:01 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected];
Quoted 42 lines
[email protected]
Subject: Re: [PATCH 3/7]megaraid_sas: Do not fire DCMDs during PCI shutdown/detachQuoted 10 lines · Sumit Saxena
This patch addresses the issue of driver firing DCMDs in PCI shutdown/detach path irrespective of firmware state.
Driver will check for whether firmware is operational state or not before firing DCMDs. If firmware is in unrecoverbale state or does not become operational within specfied time, driver will skip firing DCMDs.Signed-off-by Sumit Saxena <[email protected]>--- drivers/scsi/megaraid/megaraid_sas_base.c | 46+++++++++++++++++++++++++++++
Quoted 15 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 ++++-- 2 files changed, 52 insertions(+), 3 deletions(-)drivers/scsi/megaraid/megaraid_sas_base.c +3
-0@@ -6248,6 +6248,32 @@ fail_reenable_msix:#define megasas_resume NULL#endif +static inline int +megasas_wait_for_adapter_operational (struct megasas_instance +*instance) {drivers/scsi/megaraid/megaraid_sas_base.c fail_reenable_msix: · line 6263
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +10
-0+int wait_time =MEGASAS_RESET_WAIT_TIME *2 ; +int i; + +for (i =0 ; i < wait_time; i++) { +if (atomic_read (&instance->adprecovery) + ==MEGASAS_HBA_OPERATIONAL ) +break ; + +if (!(i %MEGASAS_RESET_NOTICE_INTERVAL )) + dev_notice(&instance->pdev->dev, "waiting forcontroller reset to
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c fail_reenable_msix:
Quoted 6 lines
drivers/scsi/megaraid/megaraid_sas_base.c +6
-0+finish\n"); + + msleep(1000 ); + } + + if (atomic_read(&instance->adprecovery) !=
MEGASAS_HBA_OPERATIONAL) {drivers/scsi/megaraid/megaraid_sas_base.c fail_reenable_msix: · line 6270
Quoted 1 line
drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+ dev_info(&instance->pdev->dev, "%s timed out while waiting
for
Quoted 29 lines
HBA to recover.\n",
drivers/scsi/megaraid/megaraid_sas_base.c static void megasas_detach_one(struct pci_dev
Quoted 11 lines
drivers/scsi/megaraid/megaraid_sas_base.c +7
-0+ __func__); +return 1 ; + } + +return 0 ; +} +/** * megasas_detach_one - PCI hot"un"plug entry point * @pdev: PCI device structure @@ -6272,9 +6298,18 @@ static void megasas_detach_one(struct pci_dev*pdev)
drivers/scsi/megaraid/megaraid_sas_base.c static void megasas_detach_one(struct pci_dev *pdev)
Quoted 6 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0if (instance->fw_crash_state !=UNAVAILABLE )megasas_free_host_crash_buffer (instance);scsi_remove_host (instance->host); + +msleep (1000 ); + if ((atomic_read(&instance->adprecovery) ==
MEGASAS_HW_CRITICAL_ERROR)drivers/scsi/megaraid/megaraid_sas_base.c static void megasas_detach_one(struct pci_dev *pdev)
Quoted 7 lines
drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+ || ((atomic_read(&instance->adprecovery) + != MEGASAS_HBA_OPERATIONAL) && + megasas_wait_for_adapter_operational(instance))) + goto skip_firing_dcmds; +megasas_flush_cache (instance); megasas_shutdown_controller(instance,
MR_DCMD_CTRL_SHUTDOWN);Quoted 1 line
Quoted 6 lines
drivers/scsi/megaraid/megaraid_sas_base.c static void megasas_detach_one(struct pci_dev *pdev) · line 6315
Quoted 4 lines
drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+skip_firing_dcmds:/* cancel the delayed work if this work still in queue*/ if (instance->ev !=NULL ) {struct megasas_aen_event *ev = instance->ev;Why not move the 'msleep' and '
atomic_read' into the call tomegasas_wait_for_adapter_operational?
I will rectify this in next version of this patch.
Quoted 1 line
Plus I'm not sure if the unconditional 'msleep' is a good idea here;
maybe one
Quoted 1 line
should read 'adprecovery' first and _then_ call msleep if required?
Agreed.. I will cleanup this and resend the patch.
Thanks,
Sumit
Quoted 9 lines
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB
21284 (AG
Quoted 1 line
Nürnberg)
Sumit Saxena
maintainerPATCH 4/7 megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to Sumit Saxenamegaraid_sas driver returns SYNCHRONIZE_CACHE command back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrt SYNCHRONIZE_CACHE handling. If underlying firmware has support to handle the SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handle SYNCHORNIZE_CACHE for both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset 0x00B4) will be set.
This behavior can be controlled via module parameter and user can fallback to old behavior of returning SYNCHRONIZE_CACHE by driver only without sending it to firmware.
--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +3 -0
@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers
@@ -2140,6 +2142,7 @@ struct megasas_instance {u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;
drivers/scsi/megaraid/megaraid_sas_base.c +6 -8
@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;module_param (scmd_timeout, int,S_IRUGO );MODULE_PARM_DESC (scmd_timeout,"scsi command timeout (10-90s), default 90s. See megasas_reset_timer." ); +bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC (block_sync_cache,"Block SYNC CACHE by driver Default: 0(Send it to firmware)" ); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );
@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd (instance, scmd);
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -0
@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,
drivers/scsi/megaraid/megaraid_sas_fusion.h +2 -0
@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */
Signature · 1 line
1.8.3.1
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 98 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +3
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct megasas_instance {u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +6
-8@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;module_param (scmd_timeout, int,S_IRUGO );MODULE_PARM_DESC (scmd_timeout,"scsi command timeout (10-90s), default 90s. See megasas_reset_timer." ); +bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC (block_sync_cache,"Block SYNC CACHE by driver Default: 0(Send it to firmware)" ); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +3
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0
drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */
Be extra careful with that.
SYNCHRONIZE_CACHE has (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is using SYNCHRONIZE_CACHE as a per device setting, ie it assumes that the effects of a cache flush is restricted to the device in question.
If this is _not_ the case I'd rather not enable it.
Have you checked that enabling this functionality doesn't have negative performance impact?
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Sumit Saxena
maintainerRE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 5 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Monday, October 17, 2016 5:04 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected];
Quoted 7 lines
[email protected]
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 2 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing
cache.
Quoted 1 line
Quoted 1 line
This patch will change the driver behavior wrt
SYNCHRONIZE_CACHE
handling.
Quoted 113 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host
Quoted 61 lines
If underlying firmware has support to handle the
SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct
megasas_instance{drivers/scsi/megaraid/megaraid_sas.h +1
-0u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; module_param(scmd_timeout, int,
S_IRUGO); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver +Default: 0(Send it to firmware)"); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host*shost, struct
scsi_cmnd*scmd)drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_ioc_init_fusion(struct megasas_instance
Quoted 24 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-8goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +0
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance*instance)
Quoted 16 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +3
-0ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
Quoted 3 lines
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie it assumes
that the
Quoted 1 line
effects of a cache flush is restricted to the device in question.
Yes, cache flush will be done per device only.
Quoted 4 lines
If this is _not_ the case I'd rather not enable it.
Have you checked that enabling this functionality doesn't have negative performance impact?
Yes, there will be negative performance impact on wrokloads where SYNCHRONIZE_CACHE is fired very frequently.
We have provided a module parameter to fallback to older behavior, if anyone sees negative performance impact because of this
and there is external power to drive.
This change is done for deployment where there is no external power to drive and abrupt shutdown may cause data loss
as cache may not be flushed to disk.
Thanks,
Sumit
Quoted 9 lines
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB
21284 (AG
Quoted 1 line
Nürnberg)
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to Hannes ReineckeQuoted 114 lines · Hannes Reinecke
Quoted 98 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +3
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct megasas_instance {u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +6
-8@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;module_param (scmd_timeout, int,S_IRUGO );MODULE_PARM_DESC (scmd_timeout,"scsi command timeout (10-90s), default 90s. See megasas_reset_timer." ); +bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC (block_sync_cache,"Block SYNC CACHE by driver Default: 0(Send it to firmware)" ); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +3
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie it assumes that the effects of a cache flush is restricted to the device in question.
Quoted 7 lines
If this is _not_ the case I'd rather not enable it.
Have you checked that enabling this functionality doesn't have negative performance impact?Cheers,
Hannes
This must go in - without this fix, there is no data integrity for any file system.
In effect, this driver by default has been throwing away SYNCHRONIZE_CACHE commands even when acting in JBOD/non-RAID mode.
Of course, actually doing a SYNCHRONIZE_CACHE to drives will be slower than throwing it away, but this is not optional.
We really need to have some ways to validate that our IO stack is properly and safely configured.
I would love to see a couple of things:
* having T10 & T13 report the existence of a volatile write cache - this is different than WCE set, some devices have a write cache and are battery/flash backed.
* having a robust tool to test over power failure/disconnect that our assumptions are true - any write is durable after a SYNCHRONIZE_CACHE or CACHE_FLUSH_EXT is sent and ack'ed
Regards,
Ric
Sumit Saxena
maintainerRE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 5 lines
-----Original Message-----
From: Ric Wheeler [mailto:[email protected]]
Sent: Monday, October 17, 2016 6:31 PM
To: Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected];
Quoted 9 lines
[email protected]; Christoph Hellwig; Martin K. Petersen; Jeff Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 3 lines · Hannes Reinecke
Quoted 2 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of
flushing cache.
Quoted 1 line
Quoted 1 line
Quoted 1 line
This patch will change the driver behavior wrt
SYNCHRONIZE_CACHE
handling.
Quoted 80 lines
Quoted 40 lines
Quoted 40 lines
If underlying firmware has support to handle the
SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct
megasas_instance{
u8is_imr;
u8is_rdpq;
booldev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c unsigned int scmd_timeout =
Quoted 8 lines
struct MR_LD_VF_MAP { u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =
MEGASAS_DEFAULT_CMD_TIMEOUT;Quoted 4 lines
Quoted 4 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer.");Quoted 9 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host
Quoted 9 lines
drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver +Default: 0(Send it to firmware)"); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host*shost, struct
scsi_cmnd*scmd)Quoted 17 lines
Quoted 17 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-8goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }
Quoted 38 lines
Quoted 7 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_ioc_init_fusion(struct megasas_instance
Quoted 7 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0return instance->instancet->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +0
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance*instance)
Quoted 30 lines
Quoted 16 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +3
-0ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie it assumes that the effects of a cache flush is restricted to the device
in question.
Quoted 10 lines
Quoted 8 lines
If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have negative performance impact?
Cheers,
Hannes
This must go in - without this fix, there is no data integrity for any
file system.
Quoted 2 lines
In effect, this driver by default has been throwing away
SYNCHRONIZE_CACHE
Quoted 1 line
commands even when acting in JBOD/non-RAID mode.
For JBOD mode, we are planning to send SYNCHRONIZE_CACHE unconditionally for all generation
Controllers and FW. Since there is single driver for all generation controllers so we are doing some
Testing that opening SYNCHRONIZE_CACHE should not break any controller. I will be sending follow up patch for the same as soon as I am done.
Quoted 2 lines
Of course, actually doing a
SYNCHRONIZE_CACHEto drives will be slower
than
Quoted 3 lines
throwing it away, but this is not optional.
We really need to have some ways to validate that our IO stack is
properly and
Quoted 5 lines
safely configured.
I would love to see a couple of things:
* having T10 & T13 report the existence of a volatile write cache - this
is different
Quoted 1 line
than WCE set, some devices have a write cache and are battery/flash
backed.
Quoted 2 lines
* having a robust tool to test over power failure/disconnect that our
assumptions
Quoted 7 lines
are true - any write is durable after a
SYNCHRONIZE_CACHEorCACHE_FLUSH_EXTis sent and ack'edRegards,
Ric
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to Ric WheelerQuoted 1 line · Ric Wheeler
This must go in - without this fix, there is no data integrity for any file system.
megaraid always had odd ideas on cache flushing, and this might be a opportunity to write down all the assumptions and document them.
Quoted 2 lines
In effect, this driver by default has been throwing away
SYNCHRONIZE_CACHEcommands even when acting in JBOD/non-RAID mode.
That would explain some issues we've seen with megaraid hardware, but it seems a bit too shocking to be true.
Looking over the patch I disagree with the module option - we must do the right thing by default, which is sending SYNCHRONIZE_CACHE commands if the WCE bit is set. If there are controllers where this is harmful for RAID mode and we can't fix the firmware in time we'll need to make special exceptions for this case in the driver based on the PCI ID and knowing what we talk to instead of leaving it to the user.
Quoted 3 lines
* having T10 & T13 report the existence of a volatile write cache - this is different than WCE set, some devices have a write cache and are battery/flash backed.
T10 is pretty clear now the WCE should only be set for a non-voltile cache. For a while they had odd NV bits to allow flushing a non-volatile cache, but in the latest revisions all that is gone.
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 10 lines · Christoph Hellwig
Quoted 1 line · Ric Wheeler
This must go in - without this fix, there is no data integrity for any file system.
megaraid always had odd ideas on cache flushing, and this might be a opportunity to write down all the assumptions and document them.
Quoted 2 lines
In effect, this driver by default has been throwing away
SYNCHRONIZE_CACHEcommands even when acting in JBOD/non-RAID mode.That would explain some issues we've seen with megaraid hardware, but it seems a bit too shocking to be true.
Quoted 6 lines
Looking over the patch I disagree with the module option - we must do the right thing by default, which is sending
SYNCHRONIZE_CACHEcommands if the WCE bit is set. If there are controllers where this is harmful for RAID mode and we can't fix the firmware in time we'll need to make special exceptions for this case in the driver based on the PCI ID and knowing what we talk to instead of leaving it to the user.
I do agree - having users be able to disable this easily is asking for trouble. It will be slower, but slower because the cache flush actually is effective.
Quoted 7 lines
Quoted 4 lines
* having T10 & T13 report the existence of a volatile write cache - this is different than WCE set, some devices have a write cache and are battery/flash backed.
T10 is pretty clear now the WCE should only be set for a non-voltile cache. For a while they had odd NV bits to allow flushing a non-volatile cache, but in the latest revisions all that is gone.
If T10 has clarity on this, then the actual fix would be to have the driver advertise WCE enabled only for the pass through/non-RAID luns (assuming the drive's write cache was enabled) and then we would leave WCE disabled for the targets that the firmware handles cache destaging for.
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 18 lines · Ric Wheeler
Quoted 10 lines · Christoph Hellwig
Quoted 1 line · Ric Wheeler
This must go in - without this fix, there is no data integrity for any file system.
megaraid always had odd ideas on cache flushing, and this might be a opportunity to write down all the assumptions and document them.
Quoted 2 lines
In effect, this driver by default has been throwing away
SYNCHRONIZE_CACHEcommands even when acting in JBOD/non-RAID mode.That would explain some issues we've seen with megaraid hardware, but it seems a bit too shocking to be true.
Quoted 6 lines
Looking over the patch I disagree with the module option - we must do the right thing by default, which is sending
SYNCHRONIZE_CACHEcommands if the WCE bit is set. If there are controllers where this is harmful for RAID mode and we can't fix the firmware in time we'll need to make special exceptions for this case in the driver based on the PCI ID and knowing what we talk to instead of leaving it to the user.
Quoted 2 lines
I do agree - having users be able to disable this easily is asking for trouble. It will be slower, but slower because the cache flush actually is effective.
Absolutely. It is a bad idea to allow users to disable correct behavior in order to achieve better performance, you will always get people who will do this and then pay the price eventually when they get corruption.
Quoted 15 lines
Quoted 8 lines
Quoted 5 lines
* having T10 & T13 report the existence of a volatile write cache - this is different than WCE set, some devices have a write cache and are battery/flash backed.
T10 is pretty clear now the WCE should only be set for a non-voltile cache. For a while they had odd NV bits to allow flushing a non-volatile cache, but in the latest revisions all that is gone.
If T10 has clarity on this, then the actual fix would be to have the driver advertise WCE enabled only for the pass through/non-RAID luns (assuming the drive's write cache was enabled) and then we would leave WCE disabled for the targets that the firmware handles cache destaging for.
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to Ric WheelerQuoted 133 lines · Ric Wheeler
Quoted 132 lines · Hannes Reinecke
Quoted 111 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +1
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000
drivers/scsi/megaraid/megaraid_sas.h +2
-0+/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct megasas_instance {u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +4
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer."); +bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver Default: 0(Send it to firmware)"); +MODULE_LICENSE("GPL"); MODULE_VERSION(MEGASAS_VERSION); MODULE_AUTHOR("[email protected]");drivers/scsi/megaraid/megaraid_sas_base.c +2
-8@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return
instance->instancet
->build_and_issue_cmd(instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2&
drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 :0;
IOCInitMessage =
dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie it assumes that the effects of a cache flush is restricted to the device in question.If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have negative performance impact?
Quoted 6 lines
Quoted 3 lines
Cheers,
Hannes
This must go in - without this fix, there is no data integrity for any file system.
That's not what I get from the change log. What it says to me is that the caches are currently firmware managed. Barring firmware bugs, that means that we currently don't have any integrity issues.
Quoted 2 lines
In effect, this driver by default has been throwing away
SYNCHRONIZE_CACHEcommands even when acting in JBOD/non-RAID mode.
That's not what the changelog says. It says the cache flushing has been managed by the firmware only. Meaning the firmware decides when to flush the cache. Barring firmware bugs, this should mean that integrity is preserved in either mode.
Quoted 2 lines
Of course, actually doing a
SYNCHRONIZE_CACHEto drives will be slower than throwing it away, but this is not optional.
What Hannes means is that we need to know that turning over cache management to Linux is a) safe and b) not a performance regression.
Given that there aren't any integrity issues, that's a reasonable
request.
Quoted 8 lines
We really need to have some ways to validate that our IO stack is properly and safely configured.
I would love to see a couple of things:
* having T10 & T13 report the existence of a volatile write cache - this is different than WCE set, some devices have a write cache and are battery/flash backed.
That's the non-volatile cache log page.
James
Quoted 15 lines
* having a robust tool to test over power failure/disconnect that our assumptions are true - any write is durable after a
SYNCHRONIZE_CACHEorCACHE_FLUSH_EXTis sent and ack'edRegards,
Ric
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 134 lines · James Bottomley
Quoted 133 lines · Ric Wheeler
Quoted 132 lines · Hannes Reinecke
Quoted 111 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +1
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000
drivers/scsi/megaraid/megaraid_sas.h +2
-0+/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct megasas_instance {u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +4
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer."); +bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver Default: 0(Send it to firmware)"); +MODULE_LICENSE("GPL"); MODULE_VERSION(MEGASAS_VERSION); MODULE_AUTHOR("[email protected]");drivers/scsi/megaraid/megaraid_sas_base.c +2
-8@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd(instance, scmd);
drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2&
drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 :0; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie it assumes that the effects of a cache flush is restricted to the device in question.If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have negative performance impact?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Cheers,
Hannes
This must go in - without this fix, there is no data integrity for any file system.
That's not what I get from the change log. What it says to me is that the caches are currently firmware managed. Barring firmware bugs, that means that we currently don't have any integrity issues.
Your understanding (or the change log) is incorrect.
The issue here is for devices that are non-RAID or pass through - this is a real issue and has been seen in practice.
Ric
Quoted 43 lines
Quoted 3 lines
In effect, this driver by default has been throwing away
SYNCHRONIZE_CACHEcommands even when acting in JBOD/non-RAID mode.That's not what the changelog says. It says the cache flushing has been managed by the firmware only. Meaning the firmware decides when to flush the cache. Barring firmware bugs, this should mean that integrity is preserved in either mode.
Quoted 2 lines
Of course, actually doing a
SYNCHRONIZE_CACHEto drives will be slower than throwing it away, but this is not optional.What Hannes means is that we need to know that turning over cache management to Linux is a) safe and b) not a performance regression.
Given that there aren't any integrity issues, that's a reasonable
request.Quoted 8 lines
We really need to have some ways to validate that our IO stack is properly and safely configured.
I would love to see a couple of things:
* having T10 & T13 report the existence of a volatile write cache - this is different than WCE set, some devices have a write cache and are battery/flash backed.
That's the non-volatile cache log page.
James
Quoted 15 lines
* having a robust tool to test over power failure/disconnect that our assumptions are true - any write is durable after a
SYNCHRONIZE_CACHEorCACHE_FLUSH_EXTis sent and ack'edRegards,
Ric
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 160 lines · Ric Wheeler
Quoted 159 lines · James Bottomley
Quoted 158 lines · Ric Wheeler
Quoted 157 lines · Hannes Reinecke
Quoted 134 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care
of flushing cache. This patch will change the driver behavior
wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for
firmware otherwise complete it back to SCSI layer with SUCCESS
immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD
and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can
fallback to old behavior of returningSYNCHRONIZE_CACHEby driver
only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0X010
0000
0drivers/scsi/megaraid/megaraid_sas.h +2
-0+/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct megasas_instance {u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +3
-1@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10 -90s), default 90s. See megasas_reset_timer."); +bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE bydriver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_Host
*shost, structscsi_cmnd*scmd)goto out_done; }drivers/scsi/megaraid/megaraid_sas_base.c +2
-9-switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1:
0; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000 6C) +extern bool block_sync_cache; +/* Quoted 3 lines
* Raid context flags
*/Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might
be an array-wide cache, and a cache flush would affect the entire
cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie
it assumes that the effects of a cache flush is restricted to the
device in question.If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have negative performance impact?
Cheers,
Hannes
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
This must go in - without this fix, there is no data integrity for
any file system.That's not what I get from the change log. What it says to me is that the caches are currently firmware managed. Barring firmware bugs, that means that we currently don't have any integrity issues.
Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of flushing cache" to mean its inverse, so the changelog needs updating to explain that firmware does *not* take care of cache flushing, so effectively nothing does and we'll need a cc to stable if the problem is that nothing takes care of flushing the drive caches.
James
Quoted 2 lines
The issue here is for devices that are non-RAID or pass through - this is a real issue and has been seen in practice.
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 4 lines · James Bottomley
Quoted 4 lines
Quoted 4 lines
That's not what I get from the change log. What it says to me is
Quoted 2 lines
Quoted 2 lines
that the caches are currently firmware managed. Barring firmware bugs, that means that we currently don't have any integrity issues.
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of flushing cache" to mean its inverse, so the changelog needs updating to explain that firmware does*not* take care of cache flushing, so effectively nothing does and we'll need a cc to stable if the problem is that nothing takes care of flushing the drive caches.
James
I agree that the changelog should be fixed, but the code itself is clearly broken in how is discards synchronize_cache commands. I assume Sumit will update that for use.
The specific situation is this:
* when using devices in RAID mode, the firmware does handle cache flushes (I assume it disables the back end disk write caches and handles its HBA write cache as you would expect).
* when using devices in non-RAID mode or pass through mode where the backend disks have write cache enabled, dropping the "SYNCHRONIZE_CACHE" commands in the driver is *never* correct for any disk with a volatile write cache
* there is no standard way to distinguish devices that have WCE set and have non-volatile write caches, so we have to assume the worst.
Regards,
Ric
Kashyap Desai
maintainerRE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to James BottomleyQuoted 176 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 65 lines · Ric Wheeler
Quoted 64 lines · James Bottomley
Quoted 63 lines · Ric Wheeler
Quoted 62 lines · Hannes Reinecke
Quoted 61 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6 +2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-1@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10 -90s), default 90s. See megasas_reset_timer.");Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE bydriver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 71 lines
Quoted 71 lines
Quoted 71 lines
Quoted 71 lines
Quoted 54 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-8*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd(instance, scmd);
drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000 6C) +extern bool block_sync_cache; +/* Quoted 3 lines
* Raid context flags
*/Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie it assumes that the effects of a cache flush is restricted to the device in question.If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have negative performance impact?
Cheers,
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Hannes
This must go in - without this fix, there is no data integrity for any file system.
That's not what I get from the change log. What it says to me is that the caches are currently firmware managed. Barring firmware bugs, that means that we currently don't have any integrity issues.
Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of flushing cache" to mean its inverse, so the changelog needs updating to explain
that firmware does *not* take care of cache flushing, so effectively nothing
does and we'll need a cc to stable if the problem is that nothing takes care of
flushing the drive caches.
Quoted 1 line
James
Sorry for confusion. More accurate to say -
Current megaraid_sas driver returns SYNCHRONIZE_CACHE command back to SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown.
Because of above FW rule driver coded wrongly and it added bug that SYNCHRONIZE_CACHE is not passed to FW for JBOD as well. (MR Firmware wanted OS to manage SYNCHRONIZE_CACHE and pass the same to the Firmware. ). We figure out that even for VD, why driver should send back SYNC_CACHE command...let's have the same in FW (giving all control in FW)
New behavior described -
IF application requests SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sends SYNCH_CACHE command to the FW
IF 'VirtualDisk'
FW does not send SYNCH_CACHE to drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sends SYNCH_CACHE to drive
FW obtains status from drive and returns same status back to driver
ENDIF
Fixing this is robust if FW and driver changes are inline. See below for more detail.
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is not reply correct for SYNCH_CACHE.
This was handled in past and carry forward (in driver + FW ) to all new
generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue( mainly to avoid this FW checks and module
parameters etc..). But now it looks like to make generic fix (Device ID
based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manage SYNC_CACHE, so we managed to figure out which are the new FW using FW capability bit.
E.g Liberator/Thunderbolt MR FW SYNC_CACHE is write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).
If we remove module parameter, we can ask customer to disable WCE on drive to get similar impact.
` Kashyap
Quoted 6 lines
Quoted 4 lines
The issue here is for devices that are non-RAID or pass through - this is a real issue and has been seen in practice.
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 252 lines · Kashyap Desai
Quoted 207 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff
Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand
to firmwareQuoted 78 lines · Ric Wheeler
Quoted 77 lines · James Bottomley
Quoted 76 lines · Ric Wheeler
Quoted 75 lines · Hannes Reinecke
Quoted 74 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to
SCSI layer without sending it to firmware as firmware takes
care of flushing cache. This patch will change the driver
behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver
will send it for firmware otherwise complete it back to SCSI
layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache"
bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user
can fallback to old behavior of returningSYNCHRONIZE_CACHEby
driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800
000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0
X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6
+2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout(10
-90s), default 90s. Seemegasas_reset_timer.");Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE bydriver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 71 lines
Quoted 55 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-4*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own
drivers/scsi/megaraid/megaraid_sas_base.c +2
-5-* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET)? 1
:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000
6C)drivers/scsi/megaraid/megaraid_sas_fusion.h
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there
might be an array-wide cache, and a cache flush would affect the
entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device
setting, ie it assumes that the effects of a cache flush is restricted to the device in question.Quoted 8 lines
If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have
negative performance impact?Cheers,
Hannes
This must go in - without this fix, there is no data integrity for
any file system.Quoted 8 lines
Quoted 6 lines
That's not what I get from the change log. What it says to me is
that the caches are currently firmware managed. Barring firmware
bugs, that means that we currently don't have any integrity issues.Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of
flushing cache" to mean its inverse, so the changelog needs updating to
explain
that firmware does *not* take care of cache flushing, so effectively
nothing
does and we'll need a cc to stable if the problem is that nothing takes
care of
flushing the drive caches.Quoted 1 line
James
Sorry for confusion. More accurate to say -
Current
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown. Because of above FW rule driver coded wrongly and it added bug thatSYNCHRONIZE_CACHEis not passed to FW for JBOD as well. (MR Firmware wanted OS to manageSYNCHRONIZE_CACHEand pass the same to the Firmware. ). We figure out that even for VD, why driver should send backSYNC_CACHEcommand...let's have the same in FW (giving all control in FW)New behavior described -
IF application requests
SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sendsSYNCH_CACHEcommand to the FW
IF 'VirtualDisk'
FW does not sendSYNCH_CACHEto drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sendsSYNCH_CACHEto drive
FW obtains status from drive and returns same status back to
driver
ENDIFFixing this is robust if FW and driver changes are inline. See below for more detail.
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is not reply correct forSYNCH_CACHE. This was handled in past and carry forward (in driver + FW ) to all new generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue(mainly to avoid this FW checks and module parameters etc..). But now it looks like to make generic fix (Device ID based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manageSYNC_CACHE, so we managed to figure out which are the new FW using FW capability bit.
Quoted 3 lines
E.g Liberator/Thunderbolt MR FW
SYNC_CACHEis write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.
That's a better description ... what you're saying is that the patch doesn't actually fix the bug Ric is worrying about.
Quoted 6 lines
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).
OK, but we really need this ASAP. As Ric said, data integrity is at risk until this is fixed. Can you also reference the commit that introduced the problem so we know how far to do the sable backports?
Quoted 2 lines
If we remove module parameter, we can ask customer to disable WCE on drive to get similar impact.
Thanks,
James
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Hi,
similar suspicious code path can be found in the queuecommand functions in other drivers too these are -pmcraid.carcmsr_hba.c
cc-ing maintainers -
(but both drivers seem to be unmaintained for a while -
I've added Ching for arcmsr and Raghava for pmcraid)
please read this thread and verify that your driver and firmware is safe.
It is expected that a raid card controls the disk write cache (switches it off) but this might not be true for all modes of operation a raid adapter handles
- pass through/non-RAID etc. In such case when disk write cache is enabled and your driver skips the SYNCHRONIZE_CACHE command a FS corruption is very much possible during unexpected power loss or even a clean shutdown.
tomash
Quoted 276 lines · James Bottomley
Quoted 249 lines · Kashyap Desai
Quoted 205 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff
Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand
to firmwareQuoted 78 lines · Ric Wheeler
Quoted 77 lines · James Bottomley
Quoted 76 lines · Ric Wheeler
Quoted 75 lines · Hannes Reinecke
Quoted 74 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to
SCSI layer without sending it to firmware as firmware takes
care of flushing cache. This patch will change the driver
behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver
will send it for firmware otherwise complete it back to SCSI
layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache"
bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user
can fallback to old behavior of returningSYNCHRONIZE_CACHEby
driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800
000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0
X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6
+2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout(10
-90s), default 90s. Seemegasas_reset_timer.");Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE bydriver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 71 lines
Quoted 55 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-4*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own
drivers/scsi/megaraid/megaraid_sas_base.c +2
-5-* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET)? 1
:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000
6C)drivers/scsi/megaraid/megaraid_sas_fusion.h
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there
might be an array-wide cache, and a cache flush would affect the
entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device
setting, ie it assumes that the effects of a cache flush is restricted to the device in question.Quoted 8 lines
If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have
negative performance impact?Cheers,
Hannes
This must go in - without this fix, there is no data integrity for
any file system.Quoted 7 lines
Quoted 6 lines
That's not what I get from the change log. What it says to me is
that the caches are currently firmware managed. Barring firmware
bugs, that means that we currently don't have any integrity issues.Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of
flushing cache" to mean its inverse, so the changelog needs updating to
explain
that firmware does *not* take care of cache flushing, so effectively
nothing
does and we'll need a cc to stable if the problem is that nothing takes
care of
flushing the drive caches.Quoted 1 line
James
Sorry for confusion. More accurate to say -
Current
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown. Because of above FW rule driver coded wrongly and it added bug thatSYNCHRONIZE_CACHEis not passed to FW for JBOD as well. (MR Firmware wanted OS to manageSYNCHRONIZE_CACHEand pass the same to the Firmware. ). We figure out that even for VD, why driver should send backSYNC_CACHEcommand...let's have the same in FW (giving all control in FW)New behavior described -
IF application requests
SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sendsSYNCH_CACHEcommand to the FW
IF 'VirtualDisk'
FW does not sendSYNCH_CACHEto drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sendsSYNCH_CACHEto drive
FW obtains status from drive and returns same status back to
driver
ENDIFFixing this is robust if FW and driver changes are inline. See below for more detail.
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is not reply correct forSYNCH_CACHE. This was handled in past and carry forward (in driver + FW ) to all new generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue(mainly to avoid this FW checks and module parameters etc..). But now it looks like to make generic fix (Device ID based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manageSYNC_CACHE, so we managed to figure out which are the new FW using FW capability bit.Quoted 3 lines
E.g Liberator/Thunderbolt MR FW
SYNC_CACHEis write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.That's a better description ... what you're saying is that the patch doesn't actually fix the bug Ric is worrying about.
Quoted 6 lines
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).OK, but we really need this ASAP. As Ric said, data integrity is at risk until this is fixed. Can you also reference the commit that introduced the problem so we know how far to do the sable backports?
Quoted 2 lines
If we remove module parameter, we can ask customer to disable WCE on drive to get similar impact.
Thanks,
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Hi Tomas,
SCSI command checking in queuecommand function of arcmsr can be removed safely. Now driver can pass all scsi command to controller firmware.
drivers/scsi/arcmsr/arcmsr_hba.c +0 -7
@@ -2623,13 +2623,6 @@ static int arcmsr_queue_command_lck(stru cmd->scsi_done = done; cmd->host_scribble =NULL ; cmd->result =0 ; -if ((scsicmd ==SYNCHRONIZE_CACHE ) ||(scsicmd ==SEND_DIAGNOSTIC )){ -if (acb->devstate[target][lun] ==ARECA_RAID_GONE ) { - cmd->result = (DID_NO_CONNECT <<16 ); - } - cmd->scsi_done (cmd); -return 0 ; - }if (target ==16 ) {/* virtual device for iop message transfer */ arcmsr_handle_virtual_command (acb, cmd);
Thanks
Ching
Quoted 299 lines · Tomas Henzl
Hi,
similar suspicious code path can be found in the queuecommand functions in other drivers too these are -
pmcraid.carcmsr_hba.c
cc-ing maintainers -
(but both drivers seem to be unmaintained for a while -
I've added Ching for arcmsr and Raghava for pmcraid)please read this thread and verify that your driver and firmware is safe.
It is expected that a raid card controls the disk write cache (switches it off) but this might not be true for all modes of operation a raid adapter handles
- pass through/non-RAID etc. In such case when disk write cache is enabled and your driver skips theSYNCHRONIZE_CACHEcommand a FS corruption is very much possible during unexpected power loss or even a clean shutdown.tomash
Quoted 276 lines · James Bottomley
Quoted 249 lines · Kashyap Desai
Quoted 205 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff
Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand
to firmwareQuoted 78 lines · Ric Wheeler
Quoted 77 lines · James Bottomley
Quoted 76 lines · Ric Wheeler
Quoted 75 lines · Hannes Reinecke
Quoted 74 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to
SCSI layer without sending it to firmware as firmware takes
care of flushing cache. This patch will change the driver
behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver
will send it for firmware otherwise complete it back to SCSI
layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache"
bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user
can fallback to old behavior of returningSYNCHRONIZE_CACHEby
driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800
000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0
X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6
+2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout(10
-90s), default 90s. Seemegasas_reset_timer.");Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE bydriver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 71 lines
Quoted 55 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-4*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own
drivers/scsi/megaraid/megaraid_sas_base.c +2
-5-* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET)? 1
:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000
6C)drivers/scsi/megaraid/megaraid_sas_fusion.h
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there
might be an array-wide cache, and a cache flush would affect the
entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device
setting, ie it assumes that the effects of a cache flush is restricted to the device in question.Quoted 8 lines
If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have
negative performance impact?Cheers,
Hannes
This must go in - without this fix, there is no data integrity for
any file system.Quoted 7 lines
Quoted 6 lines
That's not what I get from the change log. What it says to me is
that the caches are currently firmware managed. Barring firmware
bugs, that means that we currently don't have any integrity issues.Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of
flushing cache" to mean its inverse, so the changelog needs updating to
explain
that firmware does *not* take care of cache flushing, so effectively
nothing
does and we'll need a cc to stable if the problem is that nothing takes
care of
flushing the drive caches.Quoted 1 line
James
Sorry for confusion. More accurate to say -
Current
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown. Because of above FW rule driver coded wrongly and it added bug thatSYNCHRONIZE_CACHEis not passed to FW for JBOD as well. (MR Firmware wanted OS to manageSYNCHRONIZE_CACHEand pass the same to the Firmware. ). We figure out that even for VD, why driver should send backSYNC_CACHEcommand...let's have the same in FW (giving all control in FW)New behavior described -
IF application requests
SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sendsSYNCH_CACHEcommand to the FW
IF 'VirtualDisk'
FW does not sendSYNCH_CACHEto drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sendsSYNCH_CACHEto drive
FW obtains status from drive and returns same status back to
driver
ENDIFFixing this is robust if FW and driver changes are inline. See below for more detail.
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is not reply correct forSYNCH_CACHE. This was handled in past and carry forward (in driver + FW ) to all new generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue(mainly to avoid this FW checks and module parameters etc..). But now it looks like to make generic fix (Device ID based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manageSYNC_CACHE, so we managed to figure out which are the new FW using FW capability bit.Quoted 3 lines
E.g Liberator/Thunderbolt MR FW
SYNC_CACHEis write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.That's a better description ... what you're saying is that the patch doesn't actually fix the bug Ric is worrying about.
Quoted 6 lines
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).OK, but we really need this ASAP. As Ric said, data integrity is at risk until this is fixed. Can you also reference the commit that introduced the problem so we know how far to do the sable backports?
Quoted 2 lines
If we remove module parameter, we can ask customer to disable WCE on drive to get similar impact.
Thanks,
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 4 lines · Ching Huang
Hi Tomas,
SCSI command checking in queuecommand function of arcmsr can be removed safely. Now driver can pass all scsi command to controller firmware.
thanks for your quick reply. Is this (passing the SYNCHRONIZE_CACHE command to firmware) safe for all arcmsr cards, even the oldest?
Please start with your patch a new thread and add your 'Signed-off-by:' line.
Quoted 321 lines
diff -uprN
a/drivers/scsi/arcmsr/arcmsr_hba.cb/drivers/scsi/arcmsr/arcmsr_hba.cdrivers/scsi/arcmsr/arcmsr_hba.c +0
-7@@ -2623,13 +2623,6 @@ static int arcmsr_queue_command_lck(stru cmd->scsi_done = done; cmd->host_scribble =NULL ; cmd->result =0 ; -if ((scsicmd ==SYNCHRONIZE_CACHE ) ||(scsicmd ==SEND_DIAGNOSTIC )){ -if (acb->devstate[target][lun] ==ARECA_RAID_GONE ) { - cmd->result = (DID_NO_CONNECT <<16 ); - } - cmd->scsi_done (cmd); -return 0 ; - }if (target ==16 ) {/* virtual device for iop message transfer */ arcmsr_handle_virtual_command (acb, cmd);Thanks
ChingQuoted 298 lines · Tomas Henzl
Hi,
similar suspicious code path can be found in the queuecommand functions in other drivers too these are -
pmcraid.carcmsr_hba.c
cc-ing maintainers -
(but both drivers seem to be unmaintained for a while -
I've added Ching for arcmsr and Raghava for pmcraid)please read this thread and verify that your driver and firmware is safe.
It is expected that a raid card controls the disk write cache (switches it off) but this might not be true for all modes of operation a raid adapter handles
- pass through/non-RAID etc. In such case when disk write cache is enabled and your driver skips theSYNCHRONIZE_CACHEcommand a FS corruption is very much possible during unexpected power loss or even a clean shutdown.tomash
Quoted 276 lines · James Bottomley
Quoted 249 lines · Kashyap Desai
Quoted 205 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff
Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand
to firmwareQuoted 78 lines · Ric Wheeler
Quoted 77 lines · James Bottomley
Quoted 76 lines · Ric Wheeler
Quoted 75 lines · Hannes Reinecke
Quoted 74 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to
SCSI layer without sending it to firmware as firmware takes
care of flushing cache. This patch will change the driver
behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver
will send it for firmware otherwise complete it back to SCSI
layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache"
bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user
can fallback to old behavior of returningSYNCHRONIZE_CACHEby
driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800
000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0
X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6
+2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout(10
-90s), default 90s. Seemegasas_reset_timer.");Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE bydriver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 71 lines
Quoted 55 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-4*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own
drivers/scsi/megaraid/megaraid_sas_base.c +2
-5-* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET)? 1
:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000
6C)drivers/scsi/megaraid/megaraid_sas_fusion.h
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there
might be an array-wide cache, and a cache flush would affect the
entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device
setting, ie it assumes that the effects of a cache flush is restricted to the device in question.Quoted 8 lines
If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have
negative performance impact?Cheers,
Hannes
This must go in - without this fix, there is no data integrity for
any file system.Quoted 7 lines
Quoted 6 lines
That's not what I get from the change log. What it says to me is
that the caches are currently firmware managed. Barring firmware
bugs, that means that we currently don't have any integrity issues.Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of
flushing cache" to mean its inverse, so the changelog needs updating to
explain
that firmware does *not* take care of cache flushing, so effectively
nothing
does and we'll need a cc to stable if the problem is that nothing takes
care of
flushing the drive caches.Quoted 1 line
James
Sorry for confusion. More accurate to say -
Current
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown. Because of above FW rule driver coded wrongly and it added bug thatSYNCHRONIZE_CACHEis not passed to FW for JBOD as well. (MR Firmware wanted OS to manageSYNCHRONIZE_CACHEand pass the same to the Firmware. ). We figure out that even for VD, why driver should send backSYNC_CACHEcommand...let's have the same in FW (giving all control in FW)New behavior described -
IF application requests
SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sendsSYNCH_CACHEcommand to the FW
IF 'VirtualDisk'
FW does not sendSYNCH_CACHEto drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sendsSYNCH_CACHEto drive
FW obtains status from drive and returns same status back to
driver
ENDIFFixing this is robust if FW and driver changes are inline. See below for more detail.
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is not reply correct forSYNCH_CACHE. This was handled in past and carry forward (in driver + FW ) to all new generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue(mainly to avoid this FW checks and module parameters etc..). But now it looks like to make generic fix (Device ID based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manageSYNC_CACHE, so we managed to figure out which are the new FW using FW capability bit.Quoted 3 lines
E.g Liberator/Thunderbolt MR FW
SYNC_CACHEis write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.That's a better description ... what you're saying is that the patch doesn't actually fix the bug Ric is worrying about.
Quoted 6 lines
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).OK, but we really need this ASAP. As Ric said, data integrity is at risk until this is fixed. Can you also reference the commit that introduced the problem so we know how far to do the sable backports?
Quoted 2 lines
If we remove module parameter, we can ask customer to disable WCE on drive to get similar impact.
Thanks,
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Hi Tomas,
Quoted 50 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Wednesday, October 19, 2016 5:56 AM
To: Ching Huang
Cc: James Bottomley; Kashyap Desai; Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff Moyer; Gris Ge; Ewan Milne; Jens Axboe; Raghava Aditya Renukunta
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareEXTERNAL EMAIL
Quoted 3 lines · Ching Huang
Hi Tomas,
SCSI command checking in queuecommand function of arcmsr can be
removed safely.
Quoted 1 line
Now driver can pass all scsi command to controller firmware.
thanks for your quick reply. Is this (passing the
SYNCHRONIZE_CACHEcommand
to firmware) safe for all arcmsr cards, even the oldest?Please start with your patch a new thread and add your 'Signed-off-by:' line.
Quoted 2 lines
diff -uprN
a/drivers/scsi/arcmsr/arcmsr_hba.c
b/drivers/scsi/arcmsr/arcmsr_hba.cQuoted 1 line
---
a/drivers/scsi/arcmsr/arcmsr_hba.c2016-10-19 16:18:45.000000000+0800
Quoted 1 line
+++
b/drivers/scsi/arcmsr/arcmsr_hba.c2016-10-19 16:31:59.665524699+0800
drivers/scsi/arcmsr/arcmsr_hba.c static int arcmsr_queue_command_lck(stru · line 2626
Quoted 5 lines
drivers/scsi/arcmsr/arcmsr_hba.c +0
-1@@ -2623,13 +2623,6 @@ static int arcmsr_queue_command_lck(stru cmd->scsi_done = done; cmd->host_scribble =NULL ; cmd->result =0 ; - if ((scsicmd == SYNCHRONIZE_CACHE) ||(scsicmd ==SEND_DIAGNOSTIC)){
Quoted 10 lines
drivers/scsi/arcmsr/arcmsr_hba.c +0
-6-if (acb->devstate[target][lun] ==ARECA_RAID_GONE ) { - cmd->result = (DID_NO_CONNECT <<16 ); - } - cmd->scsi_done (cmd); -return 0 ; - }if (target ==16 ) {/* virtual device for iop message transfer */ arcmsr_handle_virtual_command (acb, cmd);
Quoted 13 lines
Quoted 6 lines
Thanks
ChingQuoted 3 lines · Tomas Henzl
Hi,
similar suspicious code path can be found in the queuecommand
functions in other drivers too
Quoted 6 lines
Quoted 6 lines
these are -
pmcraid.carcmsr_hba.c
cc-ing maintainers -
(but both drivers seem to be unmaintained for a while - I've added Ching for arcmsr and Raghava for pmcraid)
We do not support this card anymore nor do we have the hardware to test it out, but let me try and procure the hardware for testing although chances are very slim.
Regards,
Raghava Aditya
Quoted 303 lines
Quoted 4 lines
Quoted 4 lines
please read this thread and verify that your driver and firmware is safe.
It is expected that a raid card controls the disk write cache (switches it off) but this might not be true for all modes of operation a raid adapter
handles
Quoted 1 line
Quoted 1 line
- pass through/non-RAID etc. In such case when disk write cache is
enabled
Quoted 2 lines
Quoted 2 lines
and your driver skips the
SYNCHRONIZE_CACHEcommand a FS corruption is very much possible during unexpected power loss or even a cleanshutdown.
Quoted 4 lines
Quoted 4 lines
tomash
On 17.10.2016 19:51, James Bottomley wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Kashyap Desai
Quoted 7 lines
Quoted 7 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K.Petersen;
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Jeff
Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand
to firmwareQuoted 21 lines · Ric Wheeler
Quoted 20 lines · James Bottomley
Quoted 19 lines · Ric Wheeler
Quoted 18 lines · Hannes Reinecke
Quoted 17 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to
SCSI layer without sending it to firmware as firmware takes
care of flushing cache. This patch will change the driver
behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver
will send it for firmware otherwise complete it back to SCSI
layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache"
bit in scratch pad register(offset0x00B4) will be set.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
This behavior can be controlled via module parameter and user
can fallback to old behavior of returningSYNCHRONIZE_CACHEby
driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap DesaiQuoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800
000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0
X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6
+2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;(quoted diff) +0
-0Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c unsigned int scmd_timeout = · line 106
Quoted 8 lines
b/drivers/scsi/megaraid/megaraid_sas_base.cindex 092387f..a4a8e2f 100644drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi commandtimeout
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/megaraid/megaraid_sas_base.c
Quoted 6 lines
(10
-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHEby
Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 7 lines
driver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 71 lines
Quoted 55 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-4*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own
drivers/scsi/megaraid/megaraid_sas_base.c +2
-5-* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&
+MR_CAN_HANDLE_SYNC_CACHE_OFFSET)
? 1
:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000
6C)drivers/scsi/megaraid/megaraid_sas_fusion.h
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there
might be an array-wide cache, and a cache flush would affect the
entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device
setting, ie it assumes that the effects of a cache flush is restricted to the device in question.Quoted 8 lines
If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have
negative performance impact?Cheers,
Hannes
This must go in - without this fix, there is no data integrity for
any file system.Quoted 7 lines
Quoted 6 lines
That's not what I get from the change log. What it says to me is
that the caches are currently firmware managed. Barring firmware
bugs, that means that we currently don't have any integrity issues.Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of
flushing cache" to mean its inverse, so the changelog needs updating to
explain
that firmware does *not* take care of cache flushing, so effectively
nothing
does and we'll need a cc to stable if the problem is that nothing takes
care of
flushing the drive caches.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
James
Sorry for confusion. More accurate to say -
Current
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommandback to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown. Because of above FW rule driver coded
wrongly
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and it added bug that
SYNCHRONIZE_CACHEis not passed to FW forJBOD
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
as well. (MR Firmware wanted OS to manage
SYNCHRONIZE_CACHEand pass
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
the same to the Firmware. ). We figure out that even for VD, why driver should send back
SYNC_CACHEcommand...let's have the samein
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
FW (giving all control in FW)
New behavior described -
IF application requests
SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sendsSYNCH_CACHEcommand to the FW
IF 'VirtualDisk'
FW does not sendSYNCH_CACHEto drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sendsSYNCH_CACHEto drive
FW obtains status from drive and returns same status back to
driver
ENDIFFixing this is robust if FW and driver changes are inline. See below for more detail.
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is notQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
reply correct for
SYNCH_CACHE. This was handled in past and carry forward (in driver + FW ) to all new generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue(mainly to avoid this FW checks and module parameters etc..). But now it looks like to make generic fix (Device ID based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manageSYNC_CACHE, so we managed tofigure
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
out which are the new FW using FW capability bit.
E.g Liberator/Thunderbolt MR FW
SYNC_CACHEis write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.That's a better description ... what you're saying is that the patch doesn't actually fix the bug Ric is worrying about.
Quoted 6 lines
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
OK, but we really need this ASAP. As Ric said, data integrity is at risk until this is fixed. Can you also reference the commit that introduced the problem so we know how far to do the sable backports?
Quoted 1 line
If we remove module parameter, we can ask customer to disable WCE
on
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
drive to get similar impact.
Thanks,
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 63 lines · Raghava Aditya Renukunta
Hi Tomas,
Quoted 48 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Wednesday, October 19, 2016 5:56 AM
To: Ching Huang
Cc: James Bottomley; Kashyap Desai; Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff Moyer; Gris Ge; Ewan Milne; Jens Axboe; Raghava Aditya Renukunta
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareEXTERNAL EMAIL
Quoted 3 lines · Ching Huang
Hi Tomas,
SCSI command checking in queuecommand function of arcmsr can be
removed safely.
Quoted 1 line
Now driver can pass all scsi command to controller firmware.
thanks for your quick reply. Is this (passing the
SYNCHRONIZE_CACHEcommand
to firmware) safe for all arcmsr cards, even the oldest?Please start with your patch a new thread and add your 'Signed-off-by:' line.
Quoted 1 line
diff -uprN
a/drivers/scsi/arcmsr/arcmsr_hba.c
b/drivers/scsi/arcmsr/arcmsr_hba.cQuoted 1 line
---
a/drivers/scsi/arcmsr/arcmsr_hba.c2016-10-19 16:18:45.000000000+0800
Quoted 1 line
+++
b/drivers/scsi/arcmsr/arcmsr_hba.c2016-10-19 16:31:59.665524699+0800
drivers/scsi/arcmsr/arcmsr_hba.c static int arcmsr_queue_command_lck(stru · line 2626
Quoted 5 lines
drivers/scsi/arcmsr/arcmsr_hba.c +0
-1@@ -2623,13 +2623,6 @@ static int arcmsr_queue_command_lck(stru cmd->scsi_done = done; cmd->host_scribble =NULL ; cmd->result =0 ; - if ((scsicmd == SYNCHRONIZE_CACHE) ||(scsicmd ==SEND_DIAGNOSTIC)){
Quoted 10 lines
drivers/scsi/arcmsr/arcmsr_hba.c +0
-6-if (acb->devstate[target][lun] ==ARECA_RAID_GONE ) { - cmd->result = (DID_NO_CONNECT <<16 ); - } - cmd->scsi_done (cmd); -return 0 ; - }if (target ==16 ) {/* virtual device for iop message transfer */ arcmsr_handle_virtual_command (acb, cmd);Quoted 13 lines
Quoted 6 lines
Thanks
ChingQuoted 3 lines · Tomas Henzl
Hi,
similar suspicious code path can be found in the queuecommand
functions in other drivers too
Quoted 6 lines
Quoted 6 lines
these are -
pmcraid.carcmsr_hba.c
cc-ing maintainers -
(but both drivers seem to be unmaintained for a while - I've added Ching for arcmsr and Raghava for pmcraid)
Quoted 3 lines
We do not support this card anymore nor do we have the hardware to test it out, but let me try and procure the hardware for testing although chances are very slim.
Thanks for looking into this even though the driver is no more supported.
Quoted 298 lines
Regards,
Raghava AdityaQuoted 294 lines
Quoted 4 lines
Quoted 4 lines
please read this thread and verify that your driver and firmware is safe.
It is expected that a raid card controls the disk write cache (switches it off) but this might not be true for all modes of operation a raid adapter
handles
Quoted 1 line
Quoted 1 line
- pass through/non-RAID etc. In such case when disk write cache is
enabled
Quoted 2 lines
Quoted 2 lines
and your driver skips the
SYNCHRONIZE_CACHEcommand a FS corruption is very much possible during unexpected power loss or even a cleanshutdown.
Quoted 11 lines
Quoted 11 lines
tomash
Quoted 8 lines · James Bottomley
Quoted 7 lines · Kashyap Desai
Quoted 7 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K.Petersen;
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Jeff
Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand
to firmwareQuoted 21 lines · Ric Wheeler
Quoted 20 lines · James Bottomley
Quoted 19 lines · Ric Wheeler
Quoted 18 lines · Hannes Reinecke
Quoted 17 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to
SCSI layer without sending it to firmware as firmware takes
care of flushing cache. This patch will change the driver
behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver
will send it for firmware otherwise complete it back to SCSI
layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache"
bit in scratch pad register(offset0x00B4) will be set.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
This behavior can be controlled via module parameter and user
can fallback to old behavior of returningSYNCHRONIZE_CACHEby
driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap DesaiQuoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800
000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0
X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6
+2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;(quoted diff) +0
-0Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c unsigned int scmd_timeout = · line 106
Quoted 8 lines
b/drivers/scsi/megaraid/megaraid_sas_base.cindex 092387f..a4a8e2f 100644drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi commandtimeout
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/megaraid/megaraid_sas_base.c
Quoted 6 lines
(10
-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHEby
Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 7 lines
driver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 71 lines
Quoted 55 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-4*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own
drivers/scsi/megaraid/megaraid_sas_base.c +2
-5-* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&
+MR_CAN_HANDLE_SYNC_CACHE_OFFSET)
? 1
:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000
6C)drivers/scsi/megaraid/megaraid_sas_fusion.h
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there
might be an array-wide cache, and a cache flush would affect the
entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device
setting, ie it assumes that the effects of a cache flush is restricted to the device in question.Quoted 8 lines
If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have
negative performance impact?Cheers,
Hannes
This must go in - without this fix, there is no data integrity for
any file system.Quoted 7 lines
Quoted 6 lines
That's not what I get from the change log. What it says to me is
that the caches are currently firmware managed. Barring firmware
bugs, that means that we currently don't have any integrity issues.Your understanding (or the change log) is incorrect.
There's no current way in English of construing "as firmware takes care of
flushing cache" to mean its inverse, so the changelog needs updating to
explain
that firmware does *not* take care of cache flushing, so effectively
nothing
does and we'll need a cc to stable if the problem is that nothing takes
care of
flushing the drive caches.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
James
Sorry for confusion. More accurate to say -
Current
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommandback to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown. Because of above FW rule driver coded
wrongly
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and it added bug that
SYNCHRONIZE_CACHEis not passed to FW forJBOD
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
as well. (MR Firmware wanted OS to manage
SYNCHRONIZE_CACHEand pass
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
the same to the Firmware. ). We figure out that even for VD, why driver should send back
SYNC_CACHEcommand...let's have the samein
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
FW (giving all control in FW)
New behavior described -
IF application requests
SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sendsSYNCH_CACHEcommand to the FW
IF 'VirtualDisk'
FW does not sendSYNCH_CACHEto drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sendsSYNCH_CACHEto drive
FW obtains status from drive and returns same status back to
driver
ENDIFFixing this is robust if FW and driver changes are inline. See below for more detail.
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is notQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
reply correct for
SYNCH_CACHE. This was handled in past and carry forward (in driver + FW ) to all new generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue(mainly to avoid this FW checks and module parameters etc..). But now it looks like to make generic fix (Device ID based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manageSYNC_CACHE, so we managed tofigure
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
out which are the new FW using FW capability bit.
E.g Liberator/Thunderbolt MR FW
SYNC_CACHEis write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.That's a better description ... what you're saying is that the patch doesn't actually fix the bug Ric is worrying about.
Quoted 6 lines
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
OK, but we really need this ASAP. As Ric said, data integrity is at risk until this is fixed. Can you also reference the commit that introduced the problem so we know how far to do the sable backports?
Quoted 1 line
If we remove module parameter, we can ask customer to disable WCE
on
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
drive to get similar impact.
Thanks,
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlN�����r��y���b�X��ǧv�^�){.n�+����{���"�{ay�
ʇڙ�,j��f���h���z�
�w���
���j:+v���w�j�m��������zZ+�����ݢj"��!tml=
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to Tomas HenzlQuoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Tomas" == Tomas Henzl <[email protected]> writes:
SCSI command checking in queuecommand function of arcmsr can be removed safely. Now driver can pass all scsi command to controller firmware.
Tomas> Is this (passing the SYNCHRONIZE_CACHE command to firmware) safe Tomas> for all arcmsr cards, even the oldest?
Ching?
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
A message that is not in the archive (sent off-list or not yet received): CAKiknE_MM88eVON1g_qy7wbb2fkxdAs6O0SRSzN-RbQqSvx1eA@mail.gmail.com
Martin K. Petersen
AppliedRe: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"ching" == 黃清隆 <[email protected]> writes:
ching,
ching> Yes. Passing SYNCHRONIZE_CACHE command to firmware is safe for ching> all Areca Raid controllers, even the oldest.
I applied your patch to 4.9/scsi-fixes.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Sumit Saxena
maintainerRE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to James BottomleyQuoted 258 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 11:22 PM
To: Kashyap Desai; Ric Wheeler; Hannes Reinecke; Sumit Saxena; linux- [email protected]
Cc: [email protected]; [email protected]; Christoph Hellwig; Martin
K. Petersen; Jeff Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 231 lines · Kashyap Desai
Quoted 179 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Monday, October 17, 2016 10:50 PM
To: Ric Wheeler; Hannes Reinecke; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Christoph Hellwig; Martin K. Petersen; Jeff Moyer; Gris Ge; Ewan Milne; Jens Axboe
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 72 lines · Ric Wheeler
Quoted 71 lines · James Bottomley
Quoted 70 lines · Ric Wheeler
Quoted 69 lines · Hannes Reinecke
Quoted 68 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately. If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache"
bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++--- ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800
000
+#defineMR_CAN_HANDLE_SYNC_CACHE_OFFSET0
X010
0000
0
+
/*
* register set for both 1068 and 1078 controllers
* structure extended for 1078 registers @@ -2140,6
+2142,7@@ struct megasas_instance { u8 is_imr; u8 is_rdpq; bool dev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout =MEGASAS_DEFAULT_CMD_TIMEOUT ;module_param (scmd_timeout, int,S_IRUGO ); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout(10
-90s), default 90s. Seemegasas_reset_timer.");Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE bydriver
Default: 0(Send it to firmware)");drivers/scsi/megaraid/megaraid_sas_base.c +1
-0+MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct
Scsi_HostQuoted 75 lines
Quoted 75 lines
Quoted 75 lines
Quoted 75 lines
Quoted 55 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-4*shost, struct scsi_cmnd *scmd) goto out_done; } -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own
drivers/scsi/megaraid/megaraid_sas_base.c +2
-5-* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) { scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet ->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support =(
scratch_pad_2
&drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-0+ MR_CAN_HANDLE_SYNC_CACHE_OFFSET)? 1
:
0;IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x000000
6C)drivers/scsi/megaraid/megaraid_sas_fusion.h
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ Be extra careful with that.
SYNCHRONIZE_CACHEhas (potentially) a global scope, as there might be an array-wide cache, and a cache flush would affect the entire cache. Linux is usingSYNCHRONIZE_CACHEas a per device setting, ie it assumes that the effects of a cache flush is restricted to the device in question.If this is _not_ the case I'd rather not enable it. Have you checked that enabling this functionality doesn't have negative performance impact?
Cheers,
Hannes
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This must go in - without this fix, there is no data integrity for any file system.
That's not what I get from the change log. What it says to me is that the caches are currently firmware managed. Barring firmware bugs, that means that we currently don't have any integrity issues.
Your understanding (or the change log) is incorrect.
Quoted 8 lines
There's no current way in English of construing "as firmware takes care of flushing cache" to mean its inverse, so the changelog needs updating to explain that firmware does *not* take care of cache flushing, so effectively nothing does and we'll need a cc to stable if the problem is that nothing takes care of flushing the drive caches.
James
Sorry for confusion. More accurate to say -
Current
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it down to firmware as firmware supposed to takes care of flushing cache for all Virtual Disk at the time of system reboot/shutdown. Because of above FW rule driver coded wrongly and it added bug thatSYNCHRONIZE_CACHEis not passed to FW for JBOD as well. (MR Firmware wanted OS to manageSYNCHRONIZE_CACHEand pass the same to the Firmware. ). We figure out that even for VD, why driver should send backSYNC_CACHEcommand...let's have the same in FW (giving all control in FW)New behavior described -
IF application requests
SYNCH_CACHE
IF any FW which supports new API bit called canHandleSyncCache
Driver sendsSYNCH_CACHEcommand to the FW
IF 'VirtualDisk'
FW does not sendSYNCH_CACHEto drives
FW returns SUCCESS
ELSE IF 'JBOD'
FW sendsSYNCH_CACHEto drive
FW obtains status from drive and returns same status back to
driver
ENDIFFixing this is robust if FW and driver changes are inline. See below for more detail.
Case - 1
This patch is attempt to fix one level problem where Virtual Disks are not managed correctly in MR FW. There are some MR FW (E.a Gen2 and Gen2.5 FW), which set WCE bit for Virtual Disk but FW is not reply correct forSYNCH_CACHE. This was handled in past and carry forward (in driver + FW ) to all new generation products as well. We tried to collect all possible details why it was handled such way to provide better driver fix for this issue(mainly to avoid this FW checks and module parameters etc..). But now it looks like to make generic fix (Device ID based etc..)is even risky, so went with this protective approach. It is very risky to find out which Device ID and FW has capability to manageSYNC_CACHE, so we managed to figure out which are the new FW using FW capability bit.Quoted 3 lines
E.g Liberator/Thunderbolt MR FW
SYNC_CACHEis write Unsupported command (this is a firmware bug) and immediately it will be failed to SML. This will cause File system to go Read-only.That's a better description ... what you're saying is that the patch doesn't actually
fix the bug Ric is worrying about.Quoted 6 lines
Case -2
One more thing which we are trying and known driver can send "SYNC_CACHE" unconditionally to all generation of FW. For this we are doing more unit testing on various controllers/FW and planning to provide another patch to fix JBOD path for any FW. (It will not be based on FW capability/module parameter).
Quoted 4 lines
OK, but we really need this ASAP. As Ric said, data integrity is at risk until this is
fixed. Can you also reference the commit that introduced the problem so we know how far to do the sable backports?
Commit- " 02b01e0 [SCSI] megaraid_sas: return sync cache call with success" added the code
in driver to return SYNCHRONIZE_CACHE without sending it to firmware long back in 2007.
This was then added for RAID volumes as then supported controller firmwares did not have
support for SYNCHRONIZE_CACHE. This was mistakenly carried forward for non RAID(JBODs)
which was wrong. I will be sending a consolidated patch which will address all issues pertaining to SYNCHRONIZE_CACHE for RAID volumes and non RAID(JBOD) disks.
Quoted 7 lines
Quoted 3 lines
If we remove module parameter, we can ask customer to disable WCE on drive to get similar impact.
Thanks,
James
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to James BottomleyQuoted 13 lines · James Bottomley
Quoted 8 lines
We really need to have some ways to validate that our IO stack is
Quoted 7 lines
properly and safely configured.
I would love to see a couple of things:
* having T10 & T13 report the existence of a volatile write cache - this is different than WCE set, some devices have a write cache and are battery/flash backed.
That's the non-volatile cache log page.
James
That is not how the vendors implement this unfortunately. I dug into this non-volatile cache log page with several disk vendors last year and they were consistently not setting this to reflect that state.
Ric
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to Sumit SaxenaQuoted 61 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing cache. This patch will change the driver behavior wrtSYNCHRONIZE_CACHEhandling. If underlying firmware has support to handle theSYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +3
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct megasas_instance {u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +4
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;module_param (scmd_timeout, int,S_IRUGO );MODULE_PARM_DESC (scmd_timeout,"scsi command timeout (10-90s), default 90s. See megasas_reset_timer." ); +bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC (block_sync_cache,"Block SYNC CACHE by driver Default: 0(Send it to firmware)" ); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) goto out_done;
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · line 1708
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-6} -switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) {
Maybe I'm wrong, but isn't the logic inverted?
when fw_sync_cache_support is true it means that there is a flash cache or a battery and we don't have to send the command down ?
tomash
Quoted 34 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-2scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +3
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */
Sumit Saxena
maintainerRE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 9 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Monday, October 17, 2016 6:44 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmware
Quoted 3 lines
Quoted 2 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushing
cache.
Quoted 1 line
Quoted 1 line
This patch will change the driver behavior wrt
SYNCHRONIZE_CACHE
handling.
Quoted 65 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host
Quoted 61 lines
If underlying firmware has support to handle the
SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct
megasas_instance{drivers/scsi/megaraid/megaraid_sas.h +1
-0u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; module_param(scmd_timeout, int,
S_IRUGO); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver +Default: 0(Send it to firmware)"); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host*shost, struct
scsi_cmnd*scmd)Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0goto out_done; }
Quoted 11 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · line 1708
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-6-switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) {Maybe I'm wrong, but isn't the logic inverted?
whenfw_sync_cache_supportis true it means that there is a flash cache
or a
Quoted 2 lines
battery and we don't have to send the command down ?
If "instance->fw_sync_cache_support" is set to true, it means driver can send SYNCHRONIZE_CACHE to firmware(firmware has infrastructure to support SYNCHRONIZE_CACHE).
If "instance->fw_sync_cache_support" is set to false, it means FW does not support to handle SYNCHRONIZE_CACHE and FW will flush cache during shutdown.
Quoted 40 lines
tomash
drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_ioc_init_fusion(struct megasas_instance
Quoted 13 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-2scmd->result =DID_OK <<16 ; goto out_done; -default : -break ; }return instance->instancet->build_and_issue_cmd (instance, scmd);drivers/scsi/megaraid/megaraid_sas_fusion.c +0
-0@@ -747,6 +747,9 @@ megasas_ioc_init_fusion(struct megasas_instance*instance)
Quoted 23 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +3
-0ret =1 ; goto fail_fw_init; } +if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ; IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 91 lines · Sumit Saxena
Quoted 9 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Monday, October 17, 2016 6:44 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 3 lines
Quoted 2 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushingcache.
Quoted 1 line
Quoted 1 line
This patch will change the driver behavior wrt
SYNCHRONIZE_CACHEhandling.
Quoted 65 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host
Quoted 61 lines
If underlying firmware has support to handle the
SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct
megasas_instance{drivers/scsi/megaraid/megaraid_sas.h +1
-0u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; module_param(scmd_timeout, int,
S_IRUGO); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver +Default: 0(Send it to firmware)"); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host*shost, struct
scsi_cmnd*scmd)Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0goto out_done; }Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · line 1708
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-6-switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) {Maybe I'm wrong, but isn't the logic inverted?
whenfw_sync_cache_supportis true it means that there is a flash cacheor a
Quoted 8 lines
Quoted 2 lines
battery and we don't have to send the command down ?
If "
instance->fw_sync_cache_support" is set to true, it means driver can sendSYNCHRONIZE_CACHEtofirmware(firmware has infrastructure to support SYNCHRONIZE_CACHE).
If "instance->fw_sync_cache_support" is set to false, it means FW does not support to handleSYNCHRONIZE_CACHEand FW will flush cache during shutdown.
Thanks, in that case it is correct.
Quoted 3 lines
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host · line 1711
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ;
Please add a warning or log the state of the synchronise cache command on the controller.
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C)Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ --
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Sumit Saxena
maintainerRE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 114 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Monday, October 17, 2016 7:27 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; Kashyap Desai
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 7 lines · Sumit Saxena
Quoted 7 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Monday, October 17, 2016 6:44 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand
Quoted 86 lines
Quoted 6 lines
to firmware
Quoted 3 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushingcache.
Quoted 1 line
Quoted 1 line
This patch will change the driver behavior wrt
SYNCHRONIZE_CACHEhandling.
Quoted 65 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host
Quoted 61 lines
If underlying firmware has support to handle the
SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct
megasas_instance{drivers/scsi/megaraid/megaraid_sas.h +1
-0u8 is_imr;u8 is_rdpq;bool dev_handle; +bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; module_param(scmd_timeout, int,
S_IRUGO); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver +Default: 0(Send it to firmware)"); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host*shost, struct
scsi_cmnd*scmd)Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0goto out_done; }Quoted 11 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · line 1708
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-6-switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) {Maybe I'm wrong, but isn't the logic inverted?
whenfw_sync_cache_supportis true it means that there is a flash cacheor a
Quoted 8 lines
Quoted 2 lines
battery and we don't have to send the command down ?
If "
instance->fw_sync_cache_support" is set to true, it means driver can sendSYNCHRONIZE_CACHEtofirmware(firmware has infrastructure to support SYNCHRONIZE_CACHE).
If "instance->fw_sync_cache_support" is set to false, it means FW does not support to handleSYNCHRONIZE_CACHEand FW will flush cache during shutdown.Thanks, in that case it is correct.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host · line 1711
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ;Please add a warning or log the state of the synchronise cache command on the
controller.
Ok. thanks for pointing it out. I will add a print for the same.
Quoted 23 lines
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +0
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C)Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h line 79
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0+extern bool block_sync_cache; +/* * Raid context flags */ --
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
In reply to Tomas HenzlQuoted 100 lines · Tomas Henzl
Quoted 91 lines · Sumit Saxena
Quoted 9 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Monday, October 17, 2016 6:44 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 3 lines
Quoted 2 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushingcache.
Quoted 1 line
Quoted 1 line
This patch will change the driver behavior wrt
SYNCHRONIZE_CACHEhandling.
Quoted 65 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host
Quoted 61 lines
If underlying firmware has support to handle the
SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct
megasas_instance{
u8is_imr;
u8is_rdpq;
booldev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; module_param(scmd_timeout, int,
S_IRUGO); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver +Default: 0(Send it to firmware)"); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host*shost, struct
scsi_cmnd*scmd)Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0goto out_done; }Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · line 1708
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-6-switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) {Maybe I'm wrong, but isn't the logic inverted?
whenfw_sync_cache_supportis true it means that there is a flash cacheor a
Quoted 8 lines
Quoted 2 lines
battery and we don't have to send the command down ?
If "
instance->fw_sync_cache_support" is set to true, it means driver can sendSYNCHRONIZE_CACHEtofirmware(firmware has infrastructure to support SYNCHRONIZE_CACHE).
If "instance->fw_sync_cache_support" is set to false, it means FW does not support to handleSYNCHRONIZE_CACHEand FW will flush cache during shutdown.
Quoted 7 lines
Thanks, in that case it is correct.
Quoted 3 lines
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host · line 1711
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ;Please add a warning or log the state of the synchronise cache command on the controller.
Any logging should be limited to once per device - say when the device is opened. Note that synchronize_cache commands are extremely common, we don't want to fill the log with this.
thanks!
Ric
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */
Sumit Saxena
maintainerRE: [PATCH 4/7] megaraid_sas: Send SYNCHRONIZE_CACHE command to firmware
Quoted 119 lines
-----Original Message-----
From: Ric Wheeler [mailto:[email protected]]
Sent: Tuesday, October 18, 2016 6:38 PM
To: Tomas Henzl; Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; Kashyap Desai
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 102 lines · Tomas Henzl
Quoted 93 lines · Sumit Saxena
Quoted 9 lines
-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Monday, October 17, 2016 6:44 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 4/7]megaraid_sas: SendSYNCHRONIZE_CACHEcommand to firmwareQuoted 4 lines
Quoted 3 lines · Sumit Saxena
megaraid_sasdriver returnsSYNCHRONIZE_CACHEcommand back to SCSI layer without sending it to firmware as firmware takes care of flushingcache.
Quoted 1 line
Quoted 1 line
This patch will change the driver behavior wrt
SYNCHRONIZE_CACHEhandling.
Quoted 65 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host
Quoted 61 lines
If underlying firmware has support to handle the
SYNCHORNIZE_CACHE, driver will send it for firmware otherwise complete it back to SCSI layer with SUCCESS immediately.
If Firmware handleSYNCHORNIZE_CACHEfor both VD and JBOD "canHandleSyncCache" bit in scratch pad register(offset0x00B4) will be set.This behavior can be controlled via module parameter and user can fallback to old behavior of returning
SYNCHRONIZE_CACHEby driver only without sending it to firmware.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-0@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14#define MR_MAX_MSIX_REG_ARRAY 16#define MR_RDPQ_MODE_OFFSET 0X00800000 +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +/* * register set for both 1068 and 1078 controllers * structure extended for 1078 registers @@ -2140,6 +2142,7 @@ struct
megasas_instance{
u8is_imr;
u8is_rdpq;
booldev_handle;drivers/scsi/megaraid/megaraid_sas.h +1
-0+bool fw_sync_cache_support; };struct MR_LD_VF_MAP {u32 size;drivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -104,6 +104,10 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; module_param(scmd_timeout, int,
S_IRUGO); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. Seemegasas_reset_timer.");drivers/scsi/megaraid/megaraid_sas_base.c +5
-0+bool block_sync_cache; +module_param (block_sync_cache, bool,S_IRUGO ); +MODULE_PARM_DESC(block_sync_cache, "Block SYNC CACHE by driver +Default: 0(Send it to firmware)"); +MODULE_LICENSE ("GPL" );MODULE_VERSION (MEGASAS_VERSION );MODULE_AUTHOR ("[email protected]" );@@ -1700,16 +1704,10 @@ megasas_queue_command(struct Scsi_Host*shost, struct
scsi_cmnd*scmd)Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0goto out_done; }Quoted 11 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · line 1708
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c +2
-6-switch (scmd->cmnd[0 ]) { -case SYNCHRONIZE_CACHE : -/* -* FW takes care of flush cache on its own -* No need to send it down -*/ +if ((scmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) && + (!instance->fw_sync_cache_support)) {Maybe I'm wrong, but isn't the logic inverted?
whenfw_sync_cache_supportis true it means that there is a flash cacheor a
Quoted 8 lines
Quoted 2 lines
battery and we don't have to send the command down ?
If "
instance->fw_sync_cache_support" is set to true, it means driver can sendSYNCHRONIZE_CACHEtofirmware(firmware has infrastructure to support SYNCHRONIZE_CACHE).
If "instance->fw_sync_cache_support" is set to false, it means FW does not support to handleSYNCHRONIZE_CACHEand FW will flush cache during shutdown.Quoted 7 lines
Thanks, in that case it is correct.
Quoted 3 lines
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c megasas_queue_command(struct Scsi_Host · line 1711
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-0+if (!block_sync_cache) + instance->fw_sync_cache_support = (scratch_pad_2 & +MR_CAN_HANDLE_SYNC_CACHE_OFFSET ) ?1 :0 ;Please add a warning or log the state of the synchronise cache command on the controller.
Quoted 4 lines
Any logging should be limited to once per device - say when the device is opened.
Note thatsynchronize_cachecommands are extremely common, we don't want to fill the log with this.
This print is not per device but per MegaRAID controller. This print will state the controller firmware's capability whether SYNCHRONIZE_CACHE coming from OS for RAID volumes can be handled by firmware or not.
For non RAID(JBODs), SYNCHRONIZE_CACHE will be always sent to all MegaRAID firmware irrespective of firmware capability.
Thanks,
Sumit
Quoted 23 lines
thanks!
Ric
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-0IOCInitMessage = dma_alloc_coherent(&instance->pdev->dev,drivers/scsi/megaraid/megaraid_sas_fusion.h +2
-0@@ -72,6 +72,8 @@#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C)#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +extern bool block_sync_cache; +/* * Raid context flags */
Sumit Saxena
maintainerPATCH 5/7 megaraid_sas: driver version upgrade
In reply to Sumit SaxenaUpgrade driver version.
--- drivers/scsi/megaraid/megaraid_sas.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +2 -2
@@ -35,8 +35,8 @@/* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION "06.811.02.00-rc1" -#define MEGASAS_RELDATE "April 12, 2016" +#define MEGASAS_VERSION "06.812.06.00-rc1" +#define MEGASAS_RELDATE "August 22, 2016"/* * Device IDs
Signature · 1 line
1.8.3.1
Re: [PATCH 5/7] megaraid_sas: driver version upgrade
Quoted 13 lines · Sumit Saxena
Upgrade driver version.
Signed-off-by Sumit Saxena <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +0
-0
drivers/scsi/megaraid/megaraid_sas.h line 42
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas.h +2
-2@@ -35,8 +35,8 @@/* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION "06.811.02.00-rc1" -#define MEGASAS_RELDATE "April 12, 2016" +#define MEGASAS_VERSION "06.812.06.00-rc1" +#define MEGASAS_RELDATE "August 22, 2016"/* * Device IDs
Please move this patch to the end of the series. Otherwise it's impossible to tell if the following patches should be part of the new version or not.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Sumit Saxena
maintainerRE: [PATCH 5/7] megaraid_sas: driver version upgrade
Quoted 5 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Monday, October 17, 2016 5:05 PM
To: Sumit Saxena; [email protected]
Cc: [email protected]; [email protected];
Quoted 25 lines
[email protected]
Subject: Re: [PATCH 5/7]megaraid_sas: driver version upgradeQuoted 21 lines · Sumit Saxena
Upgrade driver version.
Signed-off-by Sumit Saxena <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +2
-2@@ -35,8 +35,8 @@/* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION "06.811.02.00-rc1" -#define MEGASAS_RELDATE "April 12, 2016" +#define MEGASAS_VERSION "06.812.06.00-rc1" +#define MEGASAS_RELDATE "August 22, 2016"
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas.h line 42
Quoted 3 lines
drivers/scsi/megaraid/megaraid_sas.h +0
-0/* * Device IDs Please move this patch to the end of the series.
Otherwise it's impossible to tell if the following patches should be part
of the new
Quoted 1 line
version or not.
Sure..I will rectify and resend the patches.
Quoted 9 lines
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB
21284 (AG
Quoted 1 line
Nürnberg)
Sumit Saxena
maintainerPATCH 6/7 MAINTAINERS: Update megaraid maintainers list
In reply to Sumit SaxenaUpdate MEGARAID drivers maintainers list.
--- MAINTAINERS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
MAINTAINERS +5 -5
@@ -7612,12 +7612,12 @@ S: Maintained F: drivers/net/wireless/mediatek/mt7601u/ MEGARAID SCSI/SAS DRIVERS -M: Kashyap Desai <[email protected]> -M: Sumit Saxena <[email protected]> -M: Uday Lingala <[email protected]> -L: [email protected] +M: Kashyap Desai <[email protected]> +M: Sumit Saxena <[email protected]> +M: Shivasharan S <[email protected]> +L: [email protected] L: [email protected] -W: http://www.lsi.com +W: http://www.avagotech.com/support/ S: Maintained F: Documentation/scsi/megaraid.txt F: drivers/scsi/megaraid.*
Signature · 1 line
1.8.3.1
Re: [PATCH 6/7] MAINTAINERS: Update megaraid maintainers list
Quoted 20 lines · Sumit Saxena
Update MEGARAID drivers maintainers list.
Signed-off-by Sumit Saxena <[email protected]>--- MAINTAINERS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)MAINTAINERS +0
-4@@ -7612,12 +7612,12 @@ S: Maintained F: drivers/net/wireless/mediatek/mt7601u/ MEGARAID SCSI/SAS DRIVERS -M: Kashyap Desai <[email protected]> -M: Sumit Saxena <[email protected]> -M: Uday Lingala <[email protected]> -L: [email protected]
MAINTAINERS S: Maintained · line 7623
Quoted 10 lines
MAINTAINERS +5
-1+M: Kashyap Desai <[email protected]> +M: Sumit Saxena <[email protected]> +M: Shivasharan S <[email protected]> +L: [email protected] L: [email protected] -W: http://www.lsi.com +W: http://www.avagotech.com/support/ S: Maintained F: Documentation/scsi/megaraid.txt F: drivers/scsi/megaraid.*
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Sumit Saxena
maintainerPATCH 7/7 megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map
In reply to Sumit SaxenaDo not set MPI2_TYPE_CUDA for JBOD fastpath IOs for firmware which does not support JBOD sequence map.
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +4 -4
@@ -2003,6 +2003,8 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, io_request->DevHandle = pd_sync->seq[pd_index].devHandle; pRAID_Context->regLockFlags |= (MR_RL_FLAGS_SEQ_NUM_ENABLE |MR_RL_FLAGS_GRANT_DESTINATION_CUDA ); + pRAID_Context->Type =MPI2_TYPE_CUDA ; + pRAID_Context->nseg =0x1 ; }else if (fusion->fast_path_io) { pRAID_Context->VirtualDiskTgtId =cpu_to_le16 (device_id); pRAID_Context->configSeqNum =0 ;
@@ -2038,12 +2040,10 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, pRAID_Context->timeoutValue =cpu_to_le16 ((os_timeout_value > timeout_limit) ? timeout_limit : os_timeout_value); -if (fusion->adapter_type ==INVADER_SERIES ) { - pRAID_Context->Type =MPI2_TYPE_CUDA ; - pRAID_Context->nseg =0x1 ; +if (fusion->adapter_type ==INVADER_SERIES ) io_request->IoFlags |=cpu_to_le16 (MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH ); - } + cmd->request_desc->SCSIIO.RequestFlags = (MPI2_REQ_DESCRIPT_FLAGS_FP_IO <<MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT );
Signature · 1 line
1.8.3.1
Re: [PATCH 7/7] megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map
Quoted 29 lines · Sumit Saxena
Do not set
MPI2_TYPE_CUDAfor JBOD fastpath IOs for firmware which does not support JBOD sequence map.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-1@@ -2003,6 +2003,8 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, io_request->DevHandle = pd_sync->seq[pd_index].devHandle; pRAID_Context->regLockFlags |= (MR_RL_FLAGS_SEQ_NUM_ENABLE |MR_RL_FLAGS_GRANT_DESTINATION_CUDA ); + pRAID_Context->Type =MPI2_TYPE_CUDA ; + pRAID_Context->nseg =0x1 ; }else if (fusion->fast_path_io) { pRAID_Context->VirtualDiskTgtId =cpu_to_le16 (device_id); pRAID_Context->configSeqNum =0 ;@@ -2038,12 +2040,10 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, pRAID_Context->timeoutValue =cpu_to_le16 ((os_timeout_value > timeout_limit) ? timeout_limit : os_timeout_value); -if (fusion->adapter_type ==INVADER_SERIES ) {
drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_build_syspd_fusion(struct megasas_instance *instance, · line 2049
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-3- pRAID_Context->Type =MPI2_TYPE_CUDA ; - pRAID_Context->nseg =0x1 ; +if (fusion->adapter_type ==INVADER_SERIES ) io_request->IoFlags |=cpu_to_le16 (MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH ); - } + cmd->request_desc->SCSIIO.RequestFlags = (MPI2_REQ_DESCRIPT_FLAGS_FP_IO <<MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT );
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH 7/7] megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map
In reply to Sumit SaxenaQuoted 6 lines · Sumit Saxena
Do not set
MPI2_TYPE_CUDAfor JBOD fastpath IOs for firmware which does not support JBOD sequence map.Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>
Tomas