RE: [PATCH trivial 1/3] megaraid_sas: Spelling s/intance/instance/
-Original Message- From: Geert Uytterhoeven [mailto:ge...@linux-m68k.org] Sent: Tuesday, March 25, 2014 2:07 AM To: Jiri Kosina Cc: linux-ker...@vger.kernel.org; Geert Uytterhoeven; DL-MegaRAID Linux; linux-scsi@vger.kernel.org Subject: [PATCH trivial 1/3] megaraid_sas: Spelling s/intance/instance/ From: Geert Uytterhoeven geert+rene...@glider.be Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be Cc: Neela Syam Kolli megaraidli...@lsi.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/megaraid/megaraid_sas_base.c |2 +- drivers/scsi/megaraid/megaraid_sas_fusion.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 3b7ad10497fe..10082678077c 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3865,7 +3865,7 @@ fail_ready_state: /** * megasas_release_mfi - Reverses the FW initialization - * @intance: Adapter soft state + * @instance: Adapter soft state */ static void megasas_release_mfi(struct megasas_instance *instance) { diff -- git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index f6555921fd7a..f7d68f65f974 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2164,7 +2164,7 @@ megasas_issue_dcmd_fusion(struct megasas_instance *instance, /** * megasas_release_fusion - Reverses the FW initialization - * @intance: Adapter soft state + * @instance: Adapter soft state */ void megasas_release_fusion(struct megasas_instance *instance) Acked-by: Sumit Saxena sumit.sax...@lsi.com -Sumit -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 29/55] scsi: Mark functions as static in megaraid/megaraid_sas_fusion.c
-Original Message- From: Rashika Kheria [mailto:rashika.khe...@gmail.com] Sent: Saturday, March 29, 2014 11:47 PM To: linux-ker...@vger.kernel.org Cc: DL-MegaRAID Linux; James E.J. Bottomley; linux-scsi@vger.kernel.org; j...@joshtriplett.org Subject: [PATCH 29/55] scsi: Mark functions as static in megaraid/megaraid_sas_fusion.c Mark functions as static in megaraid/megaraid_sas_fusion.c because they are not used outside this file. This eliminates the warnings of following type in megaraid/megaraid_sas_fusion.c: drivers/scsi/megaraid/megaraid_sas_fusion.c:91:1: warning: no previous prototype for ‘megasas_enable_intr_fusion’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria rashika.khe...@gmail.com Reviewed-by: Josh Triplett j...@joshtriplett.org --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 39 ++- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 2806d6d..ce6219c 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -74,7 +74,7 @@ extern int resetwaittime; * megasas_enable_intr_fusion - Enables interrupts * @regs: MFI register set */ -void +static void megasas_enable_intr_fusion(struct megasas_instance *instance) { struct megasas_register_set __iomem *regs; @@ -94,7 +94,7 @@ megasas_enable_intr_fusion(struct megasas_instance *instance) * megasas_disable_intr_fusion - Disables interrupt * @regs: MFI register set */ -void +static void megasas_disable_intr_fusion(struct megasas_instance *instance) { u32 mask = 0x; @@ -134,8 +134,8 @@ megasas_clear_intr_fusion(struct megasas_register_set __iomem *regs) * * Returns a free command from the pool */ -struct megasas_cmd_fusion *megasas_get_cmd_fusion(struct megasas_instance -*instance) +static struct megasas_cmd_fusion *megasas_get_cmd_fusion( +struct megasas_instance *instance) { unsigned long flags; struct fusion_context *fusion = @@ -363,7 +363,7 @@ static int megasas_create_frame_pool_fusion(struct megasas_instance *instance) * and is used as SMID of the cmd. * SMID value range is from 1 to max_fw_cmds. */ -int +static int megasas_alloc_cmds_fusion(struct megasas_instance *instance) { int i, j, count; @@ -919,7 +919,7 @@ megasas_display_intel_branding(struct megasas_instance *instance) * * This is the main function for initializing firmware. */ -u32 +static u32 megasas_init_adapter_fusion(struct megasas_instance *instance) { struct megasas_register_set __iomem *reg_set; @@ -1037,7 +1037,7 @@ fail_alloc_mfi_cmds: * @frame_count : Number of frames for the command * @regs :MFI register set */ -void +static void megasas_fire_cmd_fusion(struct megasas_instance *instance, dma_addr_t req_desc_lo, u32 req_desc_hi, @@ -1059,7 +1059,7 @@ megasas_fire_cmd_fusion(struct megasas_instance *instance, * @ext_status : ext status of cmd returned by FW */ -void +static void map_cmd_status(struct megasas_cmd_fusion *cmd, u8 status, u8 ext_status) { @@ -1199,7 +1199,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, * * Used to set the PD LBA in CDB for FP IOs */ -void +static void megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, struct IO_REQUEST_INFO *io_info, struct scsi_cmnd *scp, struct MR_FW_RAID_MAP_ALL *local_map_ptr, u32 ref_tag) @@ -1376,7 +1376,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, * Prepares the io_request and chain elements (sg_frame) for IO * The IO can be for PD (Fast Path) or LD */ -void +static void megasas_build_ldio_fusion(struct megasas_instance *instance, struct scsi_cmnd *scp, struct megasas_cmd_fusion *cmd) @@ -1678,7 +1678,7 @@ NonFastPath: * Invokes helper functions to prepare request frames * and sets flags appropriate for IO/Non-IO cmd */ -int +static int megasas_build_io_fusion(struct megasas_instance *instance, struct scsi_cmnd *scp, struct megasas_cmd_fusion *cmd) @@ -1749,7 +1749,7 @@ megasas_build_io_fusion(struct megasas_instance *instance, return 0; } -union MEGASAS_REQUEST_DESCRIPTOR_UNION * +static union MEGASAS_REQUEST_DESCRIPTOR_UNION * megasas_get_request_descriptor(struct megasas_instance *instance, u16 index) { u8 *p; @@ -1829,7 +1829,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance, * @instance: Adapter soft state * Completes all commands that is in reply descriptor queue */ -int +static int complete_cmd_fusion(struct
RE: [PATCH 30/55] scsi: Mark functions as static in megaraid/megaraid_sas_fp.c
-Original Message- From: Rashika Kheria [mailto:rashika.khe...@gmail.com] Sent: Saturday, March 29, 2014 11:48 PM To: linux-ker...@vger.kernel.org Cc: DL-MegaRAID Linux; James E.J. Bottomley; linux-scsi@vger.kernel.org; j...@joshtriplett.org Subject: [PATCH 30/55] scsi: Mark functions as static in megaraid/megaraid_sas_fp.c Mark functions as static in megaraid/megaraid_sas_fp.c because they are not used outside this file. This eliminates the following warning in megaraid/megaraid_sas_fp.c: drivers/scsi/megaraid/megaraid_sas_fp.c:80:5: warning: no previous prototype for ‘mega_mod64’ [-Wmissing-prototypes] drivers/scsi/megaraid/megaraid_sas_fp.c:98:5: warning: no previous prototype for ‘mega_div64_32’ [-Wmissing-prototypes] drivers/scsi/megaraid/megaraid_sas_fp.c:206:5: warning: no previous prototype for ‘MR_GetSpanBlock’ [-Wmissing-prototypes] drivers/scsi/megaraid/megaraid_sas_fp.c:341:5: warning: no previous prototype for ‘mr_spanset_get_span_block’ [-Wmissing-prototypes] drivers/scsi/megaraid/megaraid_sas_fp.c:582:4: warning: no previous prototype for ‘get_arm’ [-Wmissing-prototypes] drivers/scsi/megaraid/megaraid_sas_fp.c:705:4: warning: no previous prototype for ‘MR_GetPhyParams’ [-Wmissing-prototypes] drivers/scsi/megaraid/megaraid_sas_fp.c:1196:4: warning: no previous prototype for ‘megasas_get_best_arm’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria rashika.khe...@gmail.com Reviewed-by: Josh Triplett j...@joshtriplett.org --- drivers/scsi/megaraid/megaraid_sas_fp.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index e24b6eb..83d5f74 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -77,7 +77,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, static u64 get_row_from_strip(struct megasas_instance *instance, u32 ld, u64 strip, struct MR_FW_RAID_MAP_ALL *map); -u32 mega_mod64(u64 dividend, u32 divisor) +static u32 mega_mod64(u64 dividend, u32 divisor) { u64 d; u32 remainder; @@ -95,7 +95,7 @@ u32 mega_mod64(u64 dividend, u32 divisor) * * @return quotient **/ -u64 mega_div64_32(uint64_t dividend, uint32_t divisor) +static u64 mega_div64_32(uint64_t dividend, uint32_t divisor) { u32 remainder; u64 d; @@ -203,7 +203,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance) return 1; } -u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk, +static u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk, struct MR_FW_RAID_MAP_ALL *map) { struct MR_SPAN_BLOCK_INFO *pSpanBlock = MR_LdSpanInfoGet(ld, map); @@ -338,7 +338,7 @@ static int getSpanInfo(struct MR_FW_RAID_MAP_ALL *map, PLD_SPAN_INFO ldSpanInfo) *div_error - Devide error code. */ -u32 mr_spanset_get_span_block(struct megasas_instance *instance, +static u32 mr_spanset_get_span_block(struct megasas_instance *instance, u32 ld, u64 row, u64 *span_blk, struct MR_FW_RAID_MAP_ALL *map) { struct fusion_context *fusion = instance-ctrl_context; @@ -579,8 +579,8 @@ static u32 get_arm_from_strip(struct megasas_instance *instance, } /* This Function will return Phys arm */ -u8 get_arm(struct megasas_instance *instance, u32 ld, u8 span, u64 stripe, - struct MR_FW_RAID_MAP_ALL *map) +static u8 get_arm(struct megasas_instance *instance, u32 ld, u8 span, +u64 stripe, struct MR_FW_RAID_MAP_ALL *map) { struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); /* Need to check correct default value */ @@ -702,10 +702,11 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, *span - Span number *block - Absolute Block number in the physical disk */ -u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, - u16 stripRef, struct IO_REQUEST_INFO *io_info, - struct RAID_CONTEXT *pRAID_Context, - struct MR_FW_RAID_MAP_ALL *map) +static u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, +u64 stripRow, u16 stripRef, +struct IO_REQUEST_INFO *io_info, +struct RAID_CONTEXT *pRAID_Context, +struct MR_FW_RAID_MAP_ALL *map) { struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); u32 pd, arRef; @@ -1193,8 +1194,9 @@ mr_update_load_balance_params(struct MR_FW_RAID_MAP_ALL *map, } } -u8 megasas_get_best_arm(struct LD_LOAD_BALANCE_INFO *lbInfo, u8 arm, u64 block, - u32 count) +static u8 megasas_get_best_arm(struct LD_LOAD_BALANCE_INFO *lbInfo, u8 arm, + u64 block, + u32 count) { u16 pend0, pend1; u64 diff0, diff1; Acked-by: Sumit Saxena
RE: [PATCH 51/55] scsi: Move prototype declaration to header file megaraid/megaraid_sas_fusion.h from megaraid/megaraid_sas_base.c
-Original Message- From: Rashika Kheria [mailto:rashika.khe...@gmail.com] Sent: Sunday, March 30, 2014 12:18 AM To: linux-ker...@vger.kernel.org Cc: DL-MegaRAID Linux; James E.J. Bottomley; linux-scsi@vger.kernel.org; j...@joshtriplett.org Subject: [PATCH 51/55] scsi: Move prototype declaration to header file megaraid/megaraid_sas_fusion.h from megaraid/megaraid_sas_base.c Move prototype declarations of functions to header file megaraid/megaraid_sas_fusion.h from megaraid/megaraid_sas_base.c because they are used by more than one file. This eliminates the following type of warnings in megaraid/megaraid_sas_fusion.c: drivers/scsi/megaraid/megaraid_sas_fusion.c:2170:1: warning: no previous prototype for ‘megasas_release_fusion’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria rashika.khe...@gmail.com Reviewed-by: Josh Triplett j...@joshtriplett.org --- drivers/scsi/megaraid/megaraid_sas_base.c | 13 - drivers/scsi/megaraid/megaraid_sas_fusion.h | 14 ++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 9768deee..0ad386b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -160,21 +160,8 @@ u32 megasas_build_and_issue_cmd(struct megasas_instance *instance, struct scsi_cmnd *scmd); static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void -megasas_release_fusion(struct megasas_instance *instance); -int - megasas_ioc_init_fusion(struct megasas_instance *instance); -void - megasas_free_cmds_fusion(struct megasas_instance *instance); -u8 -megasas_get_map_info(struct megasas_instance *instance); -int - megasas_sync_map_info(struct megasas_instance *instance); int wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd); -void megasas_reset_reply_desc(struct megasas_instance *instance); -int megasas_reset_fusion(struct Scsi_Host *shost); -void megasas_fusion_ocr_wq(struct work_struct *work); static void megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd *cmd) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index 35a5139..01e5ab3 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -760,4 +760,18 @@ union desc_value { } u; }; +void +megasas_release_fusion(struct megasas_instance *instance); int +megasas_ioc_init_fusion(struct megasas_instance *instance); void +megasas_free_cmds_fusion(struct megasas_instance *instance); +u8 +megasas_get_map_info(struct megasas_instance *instance); int +megasas_sync_map_info(struct megasas_instance *instance); void +megasas_reset_reply_desc(struct megasas_instance *instance); int +megasas_reset_fusion(struct Scsi_Host *shost); void +megasas_fusion_ocr_wq(struct work_struct *work); + #endif /* _MEGARAID_SAS_FUSION_H_ */ Acked-by: Sumit Saxena sumit.sax...@lsi.com -Sumit -- 1.7.9.5
RE: [PATCH 52/55] scsi: Move prototype declaration to header file megaraid/megaraid_sas.h from megaraid/megaraid_sas_fusion.c
-Original Message- From: Rashika Kheria [mailto:rashika.khe...@gmail.com] Sent: Sunday, March 30, 2014 12:19 AM To: linux-ker...@vger.kernel.org Cc: DL-MegaRAID Linux; James E.J. Bottomley; linux-scsi@vger.kernel.org; j...@joshtriplett.org Subject: [PATCH 52/55] scsi: Move prototype declaration to header file megaraid/megaraid_sas.h from megaraid/megaraid_sas_fusion.c Move prototype declaration of function to header file megaraid/megaraid_sas.h from megaraid/megaraid_sas_fusion.c because it is used by more than one file. This eliminates the following warning in megaraid/megaraid_sas_fp.c: drivers/scsi/megaraid/megaraid_sas_fp.c:1223:5: warning: no previous prototype for ‘get_updated_dev_handle’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria rashika.khe...@gmail.com Reviewed-by: Josh Triplett j...@joshtriplett.org --- drivers/scsi/megaraid/megaraid_sas.h|3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.c |2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 3b0afb4..17fe706 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1737,6 +1737,9 @@ megasas_check_and_restore_queue_depth(struct megasas_instance *instance); void megasas_free_cmds(struct megasas_instance *instance); int megasas_alloc_cmds(struct megasas_instance *instance); +u16 get_updated_dev_handle(struct LD_LOAD_BALANCE_INFO *lbInfo, + struct IO_REQUEST_INFO *in_info); + u8 MR_BuildRaidContext(struct megasas_instance *instance, struct IO_REQUEST_INFO *io_info, diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index ce6219c..b3d79f4 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -63,8 +63,6 @@ wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd); int megasas_clear_intr_fusion(struct megasas_register_set __iomem *regs); -u16 get_updated_dev_handle(struct LD_LOAD_BALANCE_INFO *lbInfo, - struct IO_REQUEST_INFO *in_info); int megasas_transition_to_ready(struct megasas_instance *instance, int ocr); extern u32 megasas_dbg_lvl; Acked-by: Sumit Saxena sumit.sax...@lsi.com -Sumit -- 1.7.9.5 N�r��yb�X��ǧv�^�){.n�+{{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj��!�i
RE: [PATCH 1/2] megaraid_sas: fix a small problem when reading state value from hw
-Original Message- From: Minemoto, Shintaro [mailto:fj320...@aa.jp.fujitsu.com] Sent: Wednesday, March 05, 2014 12:06 PM To: linux-scsi@vger.kernel.org; the...@redhat.com Cc: Saxena, Sumit; aradf...@gmail.com; Tokunaga, Keiichirou; Ishii, Hideyuki; Minemoto, Shintaro Subject: Re: [PATCH 1/2] megaraid_sas: fix a small problem when reading state value from hw Hi Tomas, When the driver reads state values from the hw it might happen that different values are read in subsequent reads and this can cause problems, this may lead to a timeout in this function and a non working adapter. I reviewed your patch and it looks good to me. Reviewed-by: Shintaro Minemoto fj320...@aa.jp.fujitsu.com Patch looks good to me. Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit # I'm not in scsi-linux mailing list. Please cc me when you reply. Thanks, Shintaro Minemoto -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 13/22] megaraid: Use pci_enable_msix_range()
-Original Message- From: Alexander Gordeev [mailto:agord...@redhat.com] Sent: Tuesday, February 04, 2014 4:47 PM To: linux-ker...@vger.kernel.org Cc: Alexander Gordeev; DL-MegaRAID Linux; linux-scsi@vger.kernel.org; linux-...@vger.kernel.org Subject: [PATCH 13/22] megaraid: Use pci_enable_msix_range() As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Neela Syam Kolli megaraidli...@lsi.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/megaraid/megaraid_sas_base.c | 25 +++-- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 3b7ad10..90944f1 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3731,18 +3731,12 @@ static int megasas_init_fw(struct megasas_instance *instance) (unsigned int)num_online_cpus()); for (i = 0; i instance-msix_vectors; i++) instance-msixentry[i].entry = i; - i = pci_enable_msix(instance-pdev, instance-msixentry, - instance-msix_vectors); - if (i = 0) { - if (i) { - if (!pci_enable_msix(instance-pdev, - instance-msixentry, i)) - instance-msix_vectors = i; - else - instance-msix_vectors = 0; - } - } else + i = pci_enable_msix_range(instance-pdev, instance- msixentry, +1, instance-msix_vectors); + if (i 0) instance-msix_vectors = 0; + else + instance-msix_vectors = i; dev_info(instance-pdev-dev, [scsi%d]: FW supports %d MSIX vector,Online CPUs: %d, @@ -4667,9 +4661,11 @@ megasas_resume(struct pci_dev *pdev) goto fail_ready_state; /* Now re-enable MSI-X */ - if (instance-msix_vectors) - pci_enable_msix(instance-pdev, instance-msixentry, - instance-msix_vectors); + if (instance-msix_vectors + pci_enable_msix_range(instance-pdev, instance-msixentry, +instance-msix_vectors, +instance-msix_vectors) 0) + goto fail_reenable_msix; switch (instance-pdev-device) { case PCI_DEVICE_ID_LSI_FUSION: @@ -4756,6 +4752,7 @@ fail_init_mfi: fail_set_dma_mask: fail_ready_state: +fail_reenable_msix: pci_disable_device(pdev); Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit -- 1.7.7.6 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [patch] [SCSI] megaraid: missing bounds check in mimd_to_kioc()
-Original Message- From: Kees Cook [mailto:keesc...@google.com] Sent: Friday, January 10, 2014 12:05 AM To: Saxena, Sumit Cc: Dan Carpenter; DL-MegaRAID Linux; James E.J. Bottomley; linux- s...@vger.kernel.org; secur...@kernel.org; Nico Golde; Fabian Yamaguchi Subject: Re: [patch] [SCSI] megaraid: missing bounds check in mimd_to_kioc() On Wed, Jan 8, 2014 at 4:27 AM, Saxena, Sumit sumit.sax...@lsi.com wrote: -Original Message- From: Dan Carpenter [mailto:dan.carpen...@oracle.com] Sent: Wednesday, October 30, 2013 10:44 PM To: DL-MegaRAID Linux Cc: James E.J. Bottomley; linux-scsi@vger.kernel.org; secur...@kernel.org; Nico Golde; Fabian Yamaguchi Subject: [patch] [SCSI] megaraid: missing bounds check in mimd_to_kioc() pthru32-dataxferlen comes from the user so we need to check that it's not too large so we don't overflow the buffer. Reported-by: Nico Golde n...@ngolde.de Reported-by: Fabian Yamaguchi f...@goesec.de Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Please review this carefully because I have not tested it. diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index dfffd0f..a706927 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -486,6 +486,8 @@ mimd_to_kioc(mimd_t __user *umimd, mraid_mmadp_t *adp, uioc_t *kioc) pthru32-dataxferaddr = kioc-buf_paddr; if (kioc-data_dir UIOC_WR) { + if (pthru32-dataxferlen kioc-xferlen) + return -EINVAL; if (copy_from_user(kioc-buf_vaddr, kioc-user_data, pthru32-dataxferlen)) { return (-EFAULT); Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit Thanks for the Ack. Who normally picks patches for this area? -Kees James Bottomley(Linux SCSI subsystem maintainer) should pick this patch. Sumit -- Kees Cook Chrome OS Security
RE: [patch] [SCSI] megaraid: missing bounds check in mimd_to_kioc()
-Original Message- From: Dan Carpenter [mailto:dan.carpen...@oracle.com] Sent: Wednesday, October 30, 2013 10:44 PM To: DL-MegaRAID Linux Cc: James E.J. Bottomley; linux-scsi@vger.kernel.org; secur...@kernel.org; Nico Golde; Fabian Yamaguchi Subject: [patch] [SCSI] megaraid: missing bounds check in mimd_to_kioc() pthru32-dataxferlen comes from the user so we need to check that it's not too large so we don't overflow the buffer. Reported-by: Nico Golde n...@ngolde.de Reported-by: Fabian Yamaguchi f...@goesec.de Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Please review this carefully because I have not tested it. diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index dfffd0f..a706927 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -486,6 +486,8 @@ mimd_to_kioc(mimd_t __user *umimd, mraid_mmadp_t *adp, uioc_t *kioc) pthru32-dataxferaddr = kioc-buf_paddr; if (kioc-data_dir UIOC_WR) { + if (pthru32-dataxferlen kioc-xferlen) + return -EINVAL; if (copy_from_user(kioc-buf_vaddr, kioc-user_data, pthru32-dataxferlen)) { return (-EFAULT); Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] megaraid_sas: make the log message about rescanning more informative.
-Original Message- From: Jasper Spaans [mailto:spa...@fox-it.com] Sent: Friday, October 25, 2013 5:53 PM To: DL-MegaRAID Linux Cc: linux-scsi@vger.kernel.org Subject: [PATCH] megaraid_sas: make the log message about rescanning more informative. Hi, I was working on one of our servers, and saw the following interesting message in dmesg: [20961024.720972] scanning ... This scared me somewhat. Please find a patch to make it easier to see where this message is coming from. Cheers, Jasper --- drivers/scsi/megaraid/megaraid_sas_base.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 1f0ca68..3457289 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5461,7 +5461,7 @@ megasas_aen_polling(struct work_struct *work) } if (doscan) { - printk(KERN_INFO scanning ...\n); + printk(KERN_INFO Rescanning MegaRAID devices ...\n); megasas_get_pd_list(instance); for (i = 0; i MEGASAS_MAX_PD_CHANNELS; i++) { for (j = 0; j MEGASAS_MAX_DEV_PER_CHANNEL; j++) { -- 1.7.9.5 Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit -- /\/\ ir. Jasper Spaans // Lead Developer www.FoxDetACT.com \ (_)/ Fox-IT - For a more secure society! \XT: +31-15-2847999 \ / \ M: +31-6-41588725 \/ KvK Haaglanden 27301624 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] [SCSI] megaraid: use GFP_ATOMIC under spin lock
-Original Message- From: Wei Yongjun [mailto:weiyj...@gmail.com] Sent: Friday, December 20, 2013 8:38 AM To: DL-MegaRAID Linux; jbottom...@parallels.com; simon.pu...@gmail.com; jkos...@suse.cz Cc: yongjun_...@trendmicro.com.cn; linux-scsi@vger.kernel.org Subject: [PATCH] [SCSI] megaraid: use GFP_ATOMIC under spin lock From: Wei Yongjun yongjun_...@trendmicro.com.cn A spin lock is taken here so we should use GFP_ATOMIC. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- drivers/scsi/megaraid/megaraid_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index a706927..99fa5d3 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -570,7 +570,7 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen) kioc-pool_index= right_pool; kioc-free_buf = 1; - kioc-buf_vaddr = pci_pool_alloc(pool-handle, GFP_KERNEL, + kioc-buf_vaddr = pci_pool_alloc(pool-handle, GFP_ATOMIC, kioc-buf_paddr); spin_unlock_irqrestore(pool-lock, flags); Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] megaraid: Use resource_size_t for PCI resources, not long
-Original Message- From: Saxena, Sumit Sent: Friday, September 13, 2013 10:40 PM To: Ben Collins; linux-scsi Cc: DL-MegaRAID Linux Subject: RE: [PATCH] megaraid: Use resource_size_t for PCI resources, not long -Original Message- From: Ben Collins [mailto:be...@servergy.com] Sent: Friday, September 13, 2013 10:17 PM To: linux-scsi Cc: Saxena, Sumit; DL-MegaRAID Linux Subject: [PATCH] megaraid: Use resource_size_t for PCI resources, not long The assumption that sizeof(long) = sizeof(resource_size_t) can lead to truncation of the PCI resource address, meaning this driver didn't work on 32-bit systems with 64-bit PCI adressing ranges. Signed-off-by: Ben Collins be...@servergy.com Cc: Sumit Saxena sumit.sax...@lsi.com Cc: DL-MegaRAID Linux megaraidli...@lsi.com --- drivers/scsi/megaraid/megaraid_sas.h | 1 - drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 04a42a5..2f58758 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1460,7 +1460,6 @@ struct megasas_instance { u32 *reply_queue; dma_addr_t reply_queue_h; - unsigned long base_addr; struct megasas_register_set __iomem *reg_set; u32 *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 1f0ca68..5df5522 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3498,6 +3498,7 @@ static int megasas_init_fw(struct megasas_instance *instance) u32 max_sectors_1; u32 max_sectors_2; u32 tmp_sectors, msix_enable, scratch_pad_2; + resource_size_t base_addr; struct megasas_register_set __iomem *reg_set; struct megasas_ctrl_info *ctrl_info; unsigned long bar_list; @@ -3506,14 +3507,14 @@ static int megasas_init_fw(struct megasas_instance *instance) /* Find first memory bar */ bar_list = pci_select_bars(instance-pdev, IORESOURCE_MEM); instance-bar = find_first_bit(bar_list, sizeof(unsigned long)); - instance-base_addr = pci_resource_start(instance-pdev, instance- bar); if (pci_request_selected_regions(instance-pdev, instance-bar, megasas: LSI)) { printk(KERN_DEBUG megasas: IO memory region busy!\n); return -EBUSY; } - instance-reg_set = ioremap_nocache(instance-base_addr, 8192); + base_addr = pci_resource_start(instance-pdev, instance-bar); + instance-reg_set = ioremap_nocache(base_addr, 8192); if (!instance-reg_set) { printk(KERN_DEBUG megasas: Failed to map IO mem\n); -- 1.8.3.2 -- Ben Collins - Principal Architect Servergy, Inc. - www.servergy.com Acked-by: Sumit Saxena sumit.sax...@lsi.com James, It's gentle ping. Please consider this patch. It's critical for 32-bit systems with 64-bit PCI addressing range. Sumit -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH][SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path
-Original Message- From: Tomas Henzl [mailto:the...@redhat.com] Sent: Thursday, October 17, 2013 7:35 PM To: Saxena, Sumit; linux-scsi@vger.kernel.org Cc: jbottom...@parallels.com; Desai, Kashyap; aradf...@gmail.com Subject: Re: [PATCH][SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path On 10/16/2013 01:34 PM, sumit.sax...@lsi.com wrote: There is syncronization problem between sysPD IO path and AEN path. Driver maintains instance-pd_list[] array, which will get updated(by calling function megasas_get_pd_list[]), whenever any of below events occurs- Hi Sumit, - I'm a bit confused here- there are two threads which might access the same array, but the problem is still there when the second thread accesses the array during the final memcpy, I have expected that you will add some locking, but maybe I'm missing something. - now the code zeroes the pd_list even when the (ret == 0 (ci-count (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) is not true. This is I think new - is that intentional? Tomas, Having lock to synchronize this will be a good choice, but will need changes in multiple places. Without this patch: driver memsets instance-pd_list[] array to zero, same array will be accessed in sysPD IO path, that creates problem. To resolve this issue, we introduced a new array instance-local_pd_list[] array, which we will be filling from Firmware DMAed data and then finally memcpy that array to the instance-pd_list[]. Since instance-pd_list is accessed in IO path, then no problem in memset zero here(memset is on instance-local_pd_list). Final Memcpy operation is not saved with locking, reason is: instance-pd_list array is of type struct megasas_pd_list, which is of 32-bit, so single entry in instance-local_pd_list array will be copied in one CPU cycle, and with current MR FW design, it will not be a problem even if IO path (or any other thread) is accessing old instance-pd_list[]. so we are safe here in memcpy() here. Adding lock will add overhead in IO path, which could be avoided is main reason to resolve this issue with this fix. Thanks, Sumit Thanks, Tomas MR_EVT_PD_INSERTED MR_EVT_PD_REMOVED MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED MR_EVT_FOREIGN_CFG_IMPORTED At same time running sysPD IO will be accessing the same array instance-pd_list[], which is getting updated in AEN path, because of this IO may not get correct PD info from instance-pd_list[] array. Signed-off-by: Adam Radford adam.radf...@lsi.com Signed-off-by: Sumit Saxena sumit.sax...@lsi.com --- diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 0c73ba4..e9e543c 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1531,6 +1531,7 @@ struct megasas_instance { struct megasas_register_set __iomem *reg_set; u32 *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; +struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD]; u8 ld_ids[MEGASAS_MAX_LD_IDS]; s8 init_id; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index e62ff02..83ebc75 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3194,21 +3194,23 @@ megasas_get_pd_list(struct megasas_instance *instance) (le32_to_cpu(ci-count) (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) { -memset(instance-pd_list, 0, +memset(instance-local_pd_list, 0, MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)); for (pd_index = 0; pd_index le32_to_cpu(ci-count); pd_index++) { -instance-pd_list[le16_to_cpu(pd_addr-deviceId)].tid = +instance-local_pd_list[le16_to_cpu(pd_addr- deviceId)].tid= le16_to_cpu(pd_addr-deviceId); -instance-pd_list[le16_to_cpu(pd_addr- deviceId)].driveType = +instance-local_pd_list[le16_to_cpu(pd_addr- deviceId)].driveType = pd_addr-scsiDevType; -instance-pd_list[le16_to_cpu(pd_addr- deviceId)].driveState = +instance-local_pd_list[le16_to_cpu(pd_addr- deviceId)].driveState = MR_PD_STATE_SYSTEM; pd_addr++; } } +memcpy(instance-pd_list, instance-local_pd_list, +sizeof(instance-pd_list)); pci_free_consistent(instance-pdev, MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), ci, ci_h); -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org
RE: [PATCH][SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path
-Original Message- From: Tomas Henzl [mailto:the...@redhat.com] Sent: Thursday, October 17, 2013 9:18 PM To: Saxena, Sumit; linux-scsi@vger.kernel.org Cc: jbottom...@parallels.com; Desai, Kashyap; aradf...@gmail.com Subject: Re: [PATCH][SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path On 10/17/2013 05:10 PM, Saxena, Sumit wrote: -Original Message- From: Tomas Henzl [mailto:the...@redhat.com] Sent: Thursday, October 17, 2013 7:35 PM To: Saxena, Sumit; linux-scsi@vger.kernel.org Cc: jbottom...@parallels.com; Desai, Kashyap; aradf...@gmail.com Subject: Re: [PATCH][SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path On 10/16/2013 01:34 PM, sumit.sax...@lsi.com wrote: There is syncronization problem between sysPD IO path and AEN path. Driver maintains instance-pd_list[] array, which will get updated(by calling function megasas_get_pd_list[]), whenever any of below events occurs- Hi Sumit, - I'm a bit confused here- there are two threads which might access the same array, but the problem is still there when the second thread accesses the array during the final memcpy, I have expected that you will add some locking, but maybe I'm missing something. - now the code zeroes the pd_list even when the (ret == 0 (ci-count (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) is not true. This is I think new - is that intentional? Tomas, Having lock to synchronize this will be a good choice, but will need changes in multiple places. Without this patch: driver memsets instance-pd_list[] array to zero, same array will be accessed in sysPD IO path, that creates problem. To resolve this issue, we introduced a new array instance- local_pd_list[] array, which we will be filling from Firmware DMAed data and then finally memcpy that array to the instance-pd_list[]. Since instance-pd_list is accessed in IO path, then no problem in memset zero here(memset is on instance-local_pd_list). Final Memcpy operation is not saved with locking, reason is: instance-pd_list array is of type struct megasas_pd_list, which is of 32-bit, so single entry in instance-local_pd_list array will be copied in one CPU cycle, and with current MR FW design, it will not be a problem even if IO path (or any other thread) is accessing old instance- pd_list[]. so we are safe here in memcpy() here. Adding lock will add overhead in IO path, which could be avoided is main reason to resolve this issue with this fix. Thanks, what remains is my second question - now the code zeroes the pd_list even when the (ret == 0 (ci-count (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) is not true. This is I think new - is that intentional? Thanks for pointing this out, it's unintentional and memcpy() should be done only when (ret == 0 (ci-count (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) is true, it did not cause problem because if (ret == 0 (ci-count (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) is not true, still driver will memcpy instance-local_pd_list to instance-pd_list, inspite of both arrays being same(extra overhead of memcpy, which is not needed). I will send out the updated patch. Thanks, Sumit Thanks, Tomas MR_EVT_PD_INSERTED MR_EVT_PD_REMOVED MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED MR_EVT_FOREIGN_CFG_IMPORTED At same time running sysPD IO will be accessing the same array instance-pd_list[], which is getting updated in AEN path, because of this IO may not get correct PD info from instance-pd_list[] array. Signed-off-by: Adam Radford adam.radf...@lsi.com Signed-off-by: Sumit Saxena sumit.sax...@lsi.com --- diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 0c73ba4..e9e543c 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1531,6 +1531,7 @@ struct megasas_instance { struct megasas_register_set __iomem *reg_set; u32 *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; + struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD]; u8 ld_ids[MEGASAS_MAX_LD_IDS]; s8 init_id; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index e62ff02..83ebc75 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3194,21 +3194,23 @@ megasas_get_pd_list(struct megasas_instance *instance) (le32_to_cpu(ci-count) (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) { - memset(instance-pd_list, 0, + memset(instance-local_pd_list, 0, MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)); for (pd_index = 0; pd_index le32_to_cpu(ci-count); pd_index++) { - instance-pd_list[le16_to_cpu(pd_addr-deviceId)].tid
RE: [PATCH][SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path
-Original Message- From: James Bottomley [mailto:jbottom...@parallels.com] Sent: Thursday, October 17, 2013 3:15 AM To: Saxena, Sumit Cc: linux-scsi@vger.kernel.org; Desai, Kashyap; aradf...@gmail.com Subject: Re: [PATCH][SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path On Wed, 2013-10-16 at 17:04 +0530, sumit.sax...@lsi.com wrote: There is syncronization problem between sysPD IO path and AEN path. Driver maintains instance-pd_list[] array, which will get updated(by calling function megasas_get_pd_list[]), whenever any of below events occurs- MR_EVT_PD_INSERTED MR_EVT_PD_REMOVED MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED MR_EVT_FOREIGN_CFG_IMPORTED At same time running sysPD IO will be accessing the same array instance-pd_list[], which is getting updated in AEN path, because of this IO may not get correct PD info from instance-pd_list[] array. Signed-off-by: Adam Radford adam.radf...@lsi.com Signed-off-by: Sumit Saxena sumit.sax...@lsi.com Explain the signoff chain: is this a joinly authored patch? Yes, it's jointly authored patch. Originally, this patch is authored by Adam Radford, and then modified by me(Sumit Saxena). James -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: SCSI's heuristics for enabling WRITE SAME still need work [was: dm mpath: disable WRITE SAME if it fails]
-Original Message- From: Douglas Gilbert [mailto:dgilb...@interlog.com] Sent: Thursday, September 26, 2013 9:17 PM To: Martin K. Petersen; Bernd Schubert Cc: Mike Snitzer; Hannes Reinecke; emi...@redhat.com; device-mapper development; linux-scsi@vger.kernel.org; Saxena, Sumit Subject: Re: SCSI's heuristics for enabling WRITE SAME still need work [was: dm mpath: disable WRITE SAME if it fails] On 13-09-26 10:42 AM, Martin K. Petersen wrote: Bernd == Bernd Schubert bernd.schub...@fastmail.fm writes: Bernd, Bernd Both types of systems we have in-house neither block limits vpd Bernd nor READ_CAP16 return anything that would indicate discard is Bernd supported. But UNMAP and WRITE SAME unmap(*) just work fine. I have a collection of different SSDs in a tray connected to an LSI SAS2008 ASIC. The 510 is the only drive that does not have LBPME=1. Chances are it's because DRAT and RZAT are not set but it could also be that the 510 is blacklisted. Bernd I certainly don't want to cause any more write-same trouble, Bernd but as all layers initially have to assume write same is Bernd supported anyway and need to dynamically disable it if it Bernd fails, can't we also enable discard by default with WRITE SAME16 unmap? No thanks :) But you can force discards on by doing a: # echo -n unmap /sys/class/scsi_disk/x:y:z:n/provisioning_mode or # echo -n writesame_16 /sys/class/scsi_disk/x:y:z:n/provisioning_mode Create a udev rule if you like. In any case I wouldn't recommend using TRIM on that drive... Bernd PS: LSI SATL with FWv17 seems to have an unmap bug - I cannot Bernd unmap the last sector: Yes, it appears there's an off-by-one bug in the UNMAP translation. Sumit, is this something you guys can look into? Hi Sumit, While you are looking at the HBA firmware could you fix this minor annoyance: Thibash, Can you please look at this? Sumit # lsscsi -H -t . [6]mpt3sas sas:0x500605b006d3b510 # smp_rep_general /dev/mpt3ctl -s 0x500605b006d3b510 Report general response: expander change count: 0 expander route indexes: 0 long response: 0 number of phys: 0 zone configuring: 0 self configuring: 0 externally configurable route table: 0 initiates SSP close: 0 enclosure logical identifier (hex): b005065010b5d306 So that is a SMP REPORT GENERAL (RG) directed at the HBA itself. So either my code is incorrectly decoding the enclosure logical identifier or ... . That field was defined in SAS 1.1 so no excuses on that front. 0x0 would be better than a shuffled version of the HBA's own SAS address. Same bug/feature in all versions of SAS-2 and now SAS-3 firmware that I have tried. Doug Gilbert BTW The bsg driver can send a RG to the HBA like this: smp_rep_general /dev/bsg/sas_host6 So the intent is clearer and the response is the same. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] megaraid: Use resource_size_t for PCI resources, not long
-Original Message- From: Ben Collins [mailto:be...@servergy.com] Sent: Friday, September 13, 2013 10:17 PM To: linux-scsi Cc: Saxena, Sumit; DL-MegaRAID Linux Subject: [PATCH] megaraid: Use resource_size_t for PCI resources, not long The assumption that sizeof(long) = sizeof(resource_size_t) can lead to truncation of the PCI resource address, meaning this driver didn't work on 32-bit systems with 64-bit PCI adressing ranges. Signed-off-by: Ben Collins be...@servergy.com Cc: Sumit Saxena sumit.sax...@lsi.com Cc: DL-MegaRAID Linux megaraidli...@lsi.com --- drivers/scsi/megaraid/megaraid_sas.h | 1 - drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 04a42a5..2f58758 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1460,7 +1460,6 @@ struct megasas_instance { u32 *reply_queue; dma_addr_t reply_queue_h; - unsigned long base_addr; struct megasas_register_set __iomem *reg_set; u32 *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 1f0ca68..5df5522 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3498,6 +3498,7 @@ static int megasas_init_fw(struct megasas_instance *instance) u32 max_sectors_1; u32 max_sectors_2; u32 tmp_sectors, msix_enable, scratch_pad_2; + resource_size_t base_addr; struct megasas_register_set __iomem *reg_set; struct megasas_ctrl_info *ctrl_info; unsigned long bar_list; @@ -3506,14 +3507,14 @@ static int megasas_init_fw(struct megasas_instance *instance) /* Find first memory bar */ bar_list = pci_select_bars(instance-pdev, IORESOURCE_MEM); instance-bar = find_first_bit(bar_list, sizeof(unsigned long)); - instance-base_addr = pci_resource_start(instance-pdev, instance- bar); if (pci_request_selected_regions(instance-pdev, instance-bar, megasas: LSI)) { printk(KERN_DEBUG megasas: IO memory region busy!\n); return -EBUSY; } - instance-reg_set = ioremap_nocache(instance-base_addr, 8192); + base_addr = pci_resource_start(instance-pdev, instance-bar); + instance-reg_set = ioremap_nocache(base_addr, 8192); if (!instance-reg_set) { printk(KERN_DEBUG megasas: Failed to map IO mem\n); -- 1.8.3.2 -- Ben Collins - Principal Architect Servergy, Inc. - www.servergy.com Acked-by: Sumit Saxena sumit.sax...@lsi.com -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH][SCSI] megaraid_sas: addded support for big endian architecture
-Original Message- From: James Bottomley [mailto:jbottom...@parallels.com] Sent: Wednesday, September 11, 2013 3:42 AM To: Saxena, Sumit Cc: linux-scsi@vger.kernel.org; Desai, Kashyap; aradf...@gmail.com Subject: Re: [PATCH][SCSI] megaraid_sas: addded support for big endian architecture On Fri, 2013-09-06 at 15:50 +0530, sumit.sax...@lsi.com wrote: This patch will add big endian architecture support to megaraid_sas driver. The support added is for LSI MegaRAID all generation controllers- (3Gb/s, 6Gb/s and 12 Gb/s controllers). This patch will be applied on top of recently submitted patch for High Avaibility support- http://marc.info/?l=linux-scsim=137799326426659w=2 We have done basic sanity test @ppc64 arch and @x86_64. Additional testing/observations are welcome. Well, no it won't actually; it gives a rejection here: --- drivers/scsi/megaraid/megaraid_sas_base.c +++ drivers/scsi/megaraid/megaraid_sas_base.c @@ -5097,8 +5142,9 @@ for (i = 0; i ioc-sge_count kbuff_arr[i]; i++) { dma_free_coherent(instance-pdev-dev, -kern_sge32[i].length, -kbuff_arr[i], kern_sge32[i].phys_addr); + le32_to_cpu(kern_sge32[i].length), + kbuff_arr[i], + le32_to_cpu(kern_sge32[i].phys_addr)); } megasas_return_cmd(instance, cmd); Because you didn't take into account this patch: Author: Bjørn Mork bj...@mork.no Date: Wed Nov 21 09:54:48 2012 +0100 [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries I fixed it up this time, but could you please work against the misc branch of the scsi git repo to prevent this type of problem in future? Sorry for inconvenience. In future, I will take care of this. Thanks, James Thanks, Sumit -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: State of big-endian for MegaRAID SAS driver
-Original Message- From: Ben Collins [mailto:be...@servergy.com] Sent: Monday, August 19, 2013 10:55 PM To: Saxena, Sumit Cc: Martin K. Petersen; DL-MegaRAID Linux; linux-scsi; aradf...@gmail.com Subject: Re: State of big-endian for MegaRAID SAS driver On Aug 19, 2013, at 7:16 AM, Saxena, Sumit sumit.sax...@lsi.com wrote: This patch: Big endian support for megaraid_sas driver is not complete. In few areas, we need to do changes like this patch does not have changes for Thunderbolt/invader/Fury controllers(file: megaraid_sas_fusion.c), and needs few changes in file: megaraid_sas_fp.c(while host reads some member of raidmap, it needs endianness change there also).. LSI has megaraid_sas driver with big endian support for driver version 06.506.00.00. But to add big endian support for latest upstream megaraid_sas driver (06.600.18.00), we need to make some more changes. We will get back with big endian support patch on top of latest upstream megaraid_sas driver. Is this work-in-progress available somewhere? What is the time frame you expect to have this supported by LSI directly? Based on the fact that big-endian support in megaraid_sas is 8 years in the making, forgive me if I'm a little skeptical of progress in the near term. We are conferring with Marketing and Product Management on direction wrt Big endian support for megaraid_sas driver. Our goal is to gain clear direction within two weeks. I realize that the big-endian patch from Martin isn't complete for fusion, but it is for other cards. Given that our company has a POWER based product using MegaRAID LSI SAS due on the market in a matter of months, I'd like to have stock kernels supporting it sooner rather than later. Since this patch has zero effect on currently supported platforms (little-endian), I don't see the harm in letting it through, since it actually does work, and more importantly, works right now. Martin's patch does not have few changes needed in function megasas_init_fw()(inside file: megaraid_sas_base.c), so for consistency and driver's maintenance point of view- big endian support should be committed with complete set of changes, which works for all generation controllers. -Original Message- From: Martin K. Petersen [mailto:martin.peter...@oracle.com] Sent: Friday, August 16, 2013 6:42 AM To: Ben Collins Cc: Martin K. Petersen; DL-MegaRAID Linux; linux-scsi; aradf...@gmail.com Subject: Re: State of big-endian for MegaRAID SAS driver Ben == Ben Collins be...@servergy.com writes: Ben, Ben Considering your patch has had two success stories (I suspect Ben yours was on SPARC, so that would even make two different Ben platforms) and low likelihood of regression on little endian, I Ben think it's pretty safe. I ordered a MegaRAID card today so I can test on x86 just to be sure. Ben The only thing I think that could make it better is to annotate Ben the structures in megaraid_sas.h as __le32 where applicable. I have an older patch that does just that. And another one that gets rid of the 32-bit DMA limitations on large systems. But I didn't want to clutter the initial submission. -- Martin K. Petersen Oracle Linux Engineering -- Benjamin M. Collins | Principal Architect Servergy, Inc. | Save Energy. Work Smart. (r) m (757) 243-7557 | e be...@servergy.com L LinkedIn | T twitter.com/Servergy www.servergy.com CONFIDENTIALITY NOTICE: This communication contains privileged and/or confidential information to be maintained with the strictest confidence. It is intended solely for the use of the person or entity in which it is addressed. If you are not the intended recipient, you are STRICTLY PROHIBITED from disclosing, copying, distributing or using any of this information. If you received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. Email may contain forward looking comments that are based on managements best-faith estimates which are subject to change. For information only. Not an offer, or solicitation of any offer to buy or sell any security, investment or other product. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X capability find
-Original Message- From: Yijing Wang [mailto:wangyij...@huawei.com] Sent: Thursday, August 08, 2013 6:38 PM To: James E.J. Bottomley Cc: Hanjun Guo; jiang@huawei.com; Yijing Wang; DL-MegaRAID Linux; linux-scsi@vger.kernel.org Subject: [PATCH 05/16] megaraid: clean up unnecessary MSI/MSI-X capability find PCI core will initialize device MSI/MSI-X capability in pci_msi_init_pci_dev(). So device driver should use pci_dev- msi_cap/msix_cap to determine whether the device support MSI/MSI-X instead of using pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX). Access to PCIe device config space again will consume more time. Signed-off-by: Yijing Wang wangyij...@huawei.com Cc: Neela Syam Kolli megaraidli...@lsi.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/megaraid/megaraid_sas_base.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 0177295..ad8fc44 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4072,21 +4072,20 @@ fail_set_dma_mask: static int megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) { - int rval, pos, i, j; + int rval, i, j; struct Scsi_Host *host; struct megasas_instance *instance; u16 control = 0; /* Reset MSI-X in the kdump kernel */ if (reset_devices) { - pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); - if (pos) { - pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, + if (pdev-msix_cap) { + pci_read_config_word(pdev, pdev-msix_cap + PCI_MSIX_FLAGS, control); if (control PCI_MSIX_FLAGS_ENABLE) { dev_info(pdev-dev, resetting MSI-X\n); pci_write_config_word(pdev, -pos + PCI_MSIX_FLAGS, +pdev-msix_cap + PCI_MSIX_FLAGS, control ~PCI_MSIX_FLAGS_ENABLE); } -- 1.7.1 Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH V2 4/8] [SCSI] megaraid: add missing __iomem annotation
-Original Message- From: Jingoo Han [mailto:jg1@samsung.com] Sent: Thursday, August 08, 2013 6:46 AM To: 'James Bottomley' Cc: DL-MegaRAID Linux; 'James Bottomley'; linux-scsi@vger.kernel.org; Jingoo Han Subject: [PATCH V2 4/8] [SCSI] megaraid: add missing __iomem annotation Added missing __iomem annotation in order to fix the following sparse warnings: drivers/scsi/megaraid.c:4595:26: warning: incorrect type in argument 1 (different address spaces) drivers/scsi/megaraid.c:4595:26:expected void volatile [noderef] asn:2*addr drivers/scsi/megaraid.c:4595:26:got void *noident drivers/scsi/megaraid.c:4653:26: warning: incorrect type in argument 1 (different address spaces) drivers/scsi/megaraid.c:4653:26:expected void volatile [noderef] asn:2*addr drivers/scsi/megaraid.c:4653:26:got void *noident Signed-off-by: Jingoo Han jg1@samsung.com --- No changes since v1: drivers/scsi/megaraid.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 90c95a3..a395207 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -4592,7 +4592,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) scsi_host_put(host); out_iounmap: if (flag BOARD_MEMMAP) - iounmap((void *)mega_baseport); + iounmap((void __iomem *)mega_baseport); out_release_region: if (flag BOARD_MEMMAP) release_mem_region(tbase, 128); @@ -4650,7 +4650,7 @@ megaraid_remove_one(struct pci_dev *pdev) /* Free our resources */ if (adapter-flag BOARD_MEMMAP) { - iounmap((void *)adapter-base); + iounmap((void __iomem *)adapter-base); release_mem_region(adapter-host-base, 128); } else release_region(adapter-base, 16); -- 1.7.10.4 Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [patch] [SCSI] megaraid_sas: fix a bug for 64 bit arches
-Original Message- From: Dan Carpenter [mailto:dan.carpen...@oracle.com] Sent: Saturday, June 29, 2013 2:51 AM To: DL-MegaRAID Linux; Saxena, Sumit Cc: James E.J. Bottomley; linux-scsi@vger.kernel.org; kernel- janit...@vger.kernel.org Subject: [patch] [SCSI] megaraid_sas: fix a bug for 64 bit arches On 64 bit then -1UL and -1U are not equal, so these conditions don't work as intended and it breaks error handling. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index 8056eac..4f401f7 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -585,7 +585,7 @@ u8 get_arm(struct megasas_instance *instance, u32 ld, u8 span, u64 stripe, case 1: /* start with logical arm */ arm = get_arm_from_strip(instance, ld, stripe, map); - if (arm != -1UL) + if (arm != -1U) arm *= 2; break; } @@ -637,7 +637,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, if (raid-level == 6) { logArm = get_arm_from_strip(instance, ld, stripRow, map); - if (logArm == -1UL) + if (logArm == -1U) return FALSE; rowMod = mega_mod64(row, SPAN_ROW_SIZE(map, ld, span)); armQ = SPAN_ROW_SIZE(map, ld, span) - 1 - rowMod; Acked-by: Sumit Saxena sumit.sax...@lsi.com Sumit -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html