RE: [GIT PULL] SCSI fixes for 4.17-rc2
James, The mpt3sas should be changed to mptsas. Just responding back to have record on this problem is with old mptsas and not with mpt3sas managed controllers. Thanks Sathya -Original Message- From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-ow...@vger.kernel.org] On Behalf Of James Bottomley Sent: Wednesday, April 25, 2018 2:44 PM To: Andrew Morton; Linus Torvalds Cc: linux-scsi; linux-kernel Subject: [GIT PULL] SCSI fixes for 4.17-rc2 8 bug fixes, one spelling update and one tracepoint addition. The most serious is probably the mpt3sas write same fix because it means anyone using these controllers sees errors when modern filesystems try to issue discards (if the drive supports the WRITE SAME variant). The patch is available here: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes The short changelog is: Bart Van Assche (1): scsi: sd_zbc: Avoid that resetting a zone fails sporadically Chris Leech (1): scsi: iscsi: respond to netlink with unicast when appropriate Colin Ian King (1): scsi: fnic: fix spelling mistake in fnic stats "Abord" -> "Abort" Douglas Gilbert (1): scsi: scsi_debug: IMMED related delay adjustments John Pittman (1): scsi: core: remove reference to scsi_show_extd_sense() Mahesh Rajashekhara (1): scsi: sd: Defer spinning up drive while SANITIZE is in progress Martin K. Petersen (1): scsi: mptsas: Disable WRITE SAME Ming Lei (1): scsi: target: fix crash with iscsi target and dvd Ohad Sharabi (1): scsi: ufs: add trace event for ufs upiu Vinson Lee (1): scsi: megaraid_sas: Do not log an error if FW successfully initializes. And the diffstat: drivers/message/fusion/mptsas.c | 1 + drivers/scsi/fnic/fnic_trace.c | 2 +- drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +- drivers/scsi/scsi_debug.c | 33 +-- drivers/scsi/scsi_transport_iscsi.c | 29 +++--- drivers/scsi/sd.c | 2 + drivers/scsi/sd_zbc.c | 140 drivers/scsi/ufs/ufshcd.c | 40 drivers/target/target_core_pscsi.c | 2 + include/linux/blkdev.h | 5 + include/scsi/scsi_dbg.h | 2 - include/trace/events/ufs.h | 27 ++ 12 files changed, 205 insertions(+), 84 deletions(-) With full diff below James --- diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 231f3a1e27bf..86503f60468f 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -1994,6 +1994,7 @@ static struct scsi_host_template mptsas_driver_template = { .cmd_per_lun= 7, .use_clustering = ENABLE_CLUSTERING, .shost_attrs= mptscsih_host_attrs, + .no_write_same = 1, }; static int mptsas_get_linkerrors(struct sas_phy *phy) diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index abddde11982b..98597b59c12a 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c @@ -296,7 +296,7 @@ int fnic_get_stats_data(struct stats_debug_info *debug, "Number of Abort FW Timeouts: %lld\n" "Number of Abort IO NOT Found: %lld\n" - "Abord issued times: \n" + "Abort issued times: \n" "< 6 sec : %lld\n" " 6 sec - 20 sec : %lld\n" "20 sec - 30 sec : %lld\n" diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index ce97cde3b41c..f4d988dd1e9d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1124,12 +1124,12 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) goto fail_fw_init; } - ret = 0; + return 0; fail_fw_init: dev_err(>pdev->dev, - "Init cmd return status %s for SCSI host %d\n", - ret ? "FAILED" : "SUCCESS", instance->host->host_no); + "Init cmd return status FAILED for SCSI host %d\n", + instance->host->host_no); return ret; } diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9ef5e3b810f6..656c98e116a9 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -234,11 +234,13 @@ static const char *sdebug_version_date = "20180128"; #define F_INV_OP 0x200 #define F_FAKE_RW 0x400 #define F_M_ACCESS 0x800 /* media access */ -#define F_LONG_DELAY 0x1000 +#define F_SSU_DELAY0x1000 +#define F_SYNC_DELAY 0x2000 #define FF_RESPOND (F_RL_WLUN_OK | F_SKIP_UA | F_DELAY_OVERR) #define FF_MEDIA_IO (F_M_ACCESS | F_FAKE_RW) #define FF_SA (F_SA_HIGH |
RE: [GIT PULL] SCSI fixes for 4.17-rc2
James, The mpt3sas should be changed to mptsas. Just responding back to have record on this problem is with old mptsas and not with mpt3sas managed controllers. Thanks Sathya -Original Message- From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-ow...@vger.kernel.org] On Behalf Of James Bottomley Sent: Wednesday, April 25, 2018 2:44 PM To: Andrew Morton; Linus Torvalds Cc: linux-scsi; linux-kernel Subject: [GIT PULL] SCSI fixes for 4.17-rc2 8 bug fixes, one spelling update and one tracepoint addition. The most serious is probably the mpt3sas write same fix because it means anyone using these controllers sees errors when modern filesystems try to issue discards (if the drive supports the WRITE SAME variant). The patch is available here: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes The short changelog is: Bart Van Assche (1): scsi: sd_zbc: Avoid that resetting a zone fails sporadically Chris Leech (1): scsi: iscsi: respond to netlink with unicast when appropriate Colin Ian King (1): scsi: fnic: fix spelling mistake in fnic stats "Abord" -> "Abort" Douglas Gilbert (1): scsi: scsi_debug: IMMED related delay adjustments John Pittman (1): scsi: core: remove reference to scsi_show_extd_sense() Mahesh Rajashekhara (1): scsi: sd: Defer spinning up drive while SANITIZE is in progress Martin K. Petersen (1): scsi: mptsas: Disable WRITE SAME Ming Lei (1): scsi: target: fix crash with iscsi target and dvd Ohad Sharabi (1): scsi: ufs: add trace event for ufs upiu Vinson Lee (1): scsi: megaraid_sas: Do not log an error if FW successfully initializes. And the diffstat: drivers/message/fusion/mptsas.c | 1 + drivers/scsi/fnic/fnic_trace.c | 2 +- drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +- drivers/scsi/scsi_debug.c | 33 +-- drivers/scsi/scsi_transport_iscsi.c | 29 +++--- drivers/scsi/sd.c | 2 + drivers/scsi/sd_zbc.c | 140 drivers/scsi/ufs/ufshcd.c | 40 drivers/target/target_core_pscsi.c | 2 + include/linux/blkdev.h | 5 + include/scsi/scsi_dbg.h | 2 - include/trace/events/ufs.h | 27 ++ 12 files changed, 205 insertions(+), 84 deletions(-) With full diff below James --- diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 231f3a1e27bf..86503f60468f 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -1994,6 +1994,7 @@ static struct scsi_host_template mptsas_driver_template = { .cmd_per_lun= 7, .use_clustering = ENABLE_CLUSTERING, .shost_attrs= mptscsih_host_attrs, + .no_write_same = 1, }; static int mptsas_get_linkerrors(struct sas_phy *phy) diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index abddde11982b..98597b59c12a 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c @@ -296,7 +296,7 @@ int fnic_get_stats_data(struct stats_debug_info *debug, "Number of Abort FW Timeouts: %lld\n" "Number of Abort IO NOT Found: %lld\n" - "Abord issued times: \n" + "Abort issued times: \n" "< 6 sec : %lld\n" " 6 sec - 20 sec : %lld\n" "20 sec - 30 sec : %lld\n" diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index ce97cde3b41c..f4d988dd1e9d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1124,12 +1124,12 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) goto fail_fw_init; } - ret = 0; + return 0; fail_fw_init: dev_err(>pdev->dev, - "Init cmd return status %s for SCSI host %d\n", - ret ? "FAILED" : "SUCCESS", instance->host->host_no); + "Init cmd return status FAILED for SCSI host %d\n", + instance->host->host_no); return ret; } diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9ef5e3b810f6..656c98e116a9 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -234,11 +234,13 @@ static const char *sdebug_version_date = "20180128"; #define F_INV_OP 0x200 #define F_FAKE_RW 0x400 #define F_M_ACCESS 0x800 /* media access */ -#define F_LONG_DELAY 0x1000 +#define F_SSU_DELAY0x1000 +#define F_SYNC_DELAY 0x2000 #define FF_RESPOND (F_RL_WLUN_OK | F_SKIP_UA | F_DELAY_OVERR) #define FF_MEDIA_IO (F_M_ACCESS | F_FAKE_RW) #define FF_SA (F_SA_HIGH |
RE: [PATCH] mpt3sas: fix dma_addr_t casts
Acked-by: Sathya Prakash Veerichetty <sathya.prak...@broadcom.com> -Original Message- From: Arnd Bergmann [mailto:a...@arndb.de] Sent: Monday, November 6, 2017 6:35 AM To: Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; James E.J. Bottomley; Martin K. Petersen Cc: Arnd Bergmann; Tomas Henzl; Sreekanth Reddy; Hannes Reinecke; Romain Perier; James Bottomley; Bart Van Assche; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org Subject: [PATCH] mpt3sas: fix dma_addr_t casts The newly added base_make_prp_nvme function triggers a build warning on some 32-bit configurations: drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'base_make_prp_nvme': drivers/scsi/mpt3sas/mpt3sas_base.c:1664:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] msg_phys = (dma_addr_t)mpt3sas_base_get_pcie_sgl_dma(ioc, smid); After taking a closer look, I found that the problem is that the new code mixes up pointers and dma_addr_t values unnecessarily. This changes it to use the correct types consistently, which lets us get rid of a lot of type casts in the process. I'm also renaming some variables to avoid confusion between physical and dma address spaces that are often distinct. Fixes: 016d5c35e278 ("scsi: mpt3sas: SGL to PRP Translation for I/Os to NVMe devices") Signed-off-by: Arnd Bergmann <a...@arndb.de> --- drivers/scsi/mpt3sas/mpt3sas_base.c | 62 + drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 7a3f4d14f260..8027de465d47 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1437,11 +1437,11 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, size_t data_in_sz) { int prp_size = NVME_PRP_SIZE; - __le64 *prp_entry, *prp1_entry, *prp2_entry, *prp_entry_phys; - __le64 *prp_page, *prp_page_phys; + __le64 *prp_entry, *prp1_entry, *prp2_entry; + __le64 *prp_page; + dma_addr_t prp_entry_dma, prp_page_dma, dma_addr; u32 offset, entry_len; u32 page_mask_result, page_mask; - dma_addr_t paddr; size_t length; /* @@ -1465,7 +1465,7 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, * contiguous memory. */ prp_page = (__le64 *)mpt3sas_base_get_pcie_sgl(ioc, smid); - prp_page_phys = (__le64 *)mpt3sas_base_get_pcie_sgl_dma(ioc, smid); + prp_page_dma = mpt3sas_base_get_pcie_sgl_dma(ioc, smid); /* * Check if we are within 1 entry of a page boundary we don't @@ -1476,21 +1476,21 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, if (!page_mask_result) { /* Bump up to next page boundary. */ prp_page = (__le64 *)((u8 *)prp_page + prp_size); - prp_page_phys = (__le64 *)((u8 *)prp_page_phys + prp_size); + prp_page_dma = prp_page_dma + prp_size; } /* * Set PRP physical pointer, which initially points to the current PRP * DMA memory page. */ - prp_entry_phys = prp_page_phys; + prp_entry_dma = prp_page_dma; /* Get physical address and length of the data buffer. */ if (data_in_sz) { - paddr = data_in_dma; + dma_addr = data_in_dma; length = data_in_sz; } else { - paddr = data_out_dma; + dma_addr = data_out_dma; length = data_out_sz; } @@ -1500,8 +1500,7 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, * Check if we need to put a list pointer here if we are at * page boundary - prp_size (8 bytes). */ - page_mask_result = - (uintptr_t)((u8 *)prp_entry_phys + prp_size) & page_mask; + page_mask_result = (prp_entry_dma + prp_size) & page_mask; if (!page_mask_result) { /* * This is the last entry in a PRP List, so we need to @@ -1515,13 +1514,13 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, * contiguous, no need to get a new page - it's * just the next address. */ - prp_entry_phys++; - *prp_entry = cpu_to_le64((uintptr_t)prp_entry_phys); + prp_entry_dma++; + *prp_entry = cpu_to_le64(prp_entry_dma); prp_entry++; } /* Need to handle if entry will be part of a page. */ - o
RE: [PATCH] mpt3sas: fix dma_addr_t casts
Acked-by: Sathya Prakash Veerichetty -Original Message- From: Arnd Bergmann [mailto:a...@arndb.de] Sent: Monday, November 6, 2017 6:35 AM To: Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; James E.J. Bottomley; Martin K. Petersen Cc: Arnd Bergmann; Tomas Henzl; Sreekanth Reddy; Hannes Reinecke; Romain Perier; James Bottomley; Bart Van Assche; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org Subject: [PATCH] mpt3sas: fix dma_addr_t casts The newly added base_make_prp_nvme function triggers a build warning on some 32-bit configurations: drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'base_make_prp_nvme': drivers/scsi/mpt3sas/mpt3sas_base.c:1664:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] msg_phys = (dma_addr_t)mpt3sas_base_get_pcie_sgl_dma(ioc, smid); After taking a closer look, I found that the problem is that the new code mixes up pointers and dma_addr_t values unnecessarily. This changes it to use the correct types consistently, which lets us get rid of a lot of type casts in the process. I'm also renaming some variables to avoid confusion between physical and dma address spaces that are often distinct. Fixes: 016d5c35e278 ("scsi: mpt3sas: SGL to PRP Translation for I/Os to NVMe devices") Signed-off-by: Arnd Bergmann --- drivers/scsi/mpt3sas/mpt3sas_base.c | 62 + drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 7a3f4d14f260..8027de465d47 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1437,11 +1437,11 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, size_t data_in_sz) { int prp_size = NVME_PRP_SIZE; - __le64 *prp_entry, *prp1_entry, *prp2_entry, *prp_entry_phys; - __le64 *prp_page, *prp_page_phys; + __le64 *prp_entry, *prp1_entry, *prp2_entry; + __le64 *prp_page; + dma_addr_t prp_entry_dma, prp_page_dma, dma_addr; u32 offset, entry_len; u32 page_mask_result, page_mask; - dma_addr_t paddr; size_t length; /* @@ -1465,7 +1465,7 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, * contiguous memory. */ prp_page = (__le64 *)mpt3sas_base_get_pcie_sgl(ioc, smid); - prp_page_phys = (__le64 *)mpt3sas_base_get_pcie_sgl_dma(ioc, smid); + prp_page_dma = mpt3sas_base_get_pcie_sgl_dma(ioc, smid); /* * Check if we are within 1 entry of a page boundary we don't @@ -1476,21 +1476,21 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, if (!page_mask_result) { /* Bump up to next page boundary. */ prp_page = (__le64 *)((u8 *)prp_page + prp_size); - prp_page_phys = (__le64 *)((u8 *)prp_page_phys + prp_size); + prp_page_dma = prp_page_dma + prp_size; } /* * Set PRP physical pointer, which initially points to the current PRP * DMA memory page. */ - prp_entry_phys = prp_page_phys; + prp_entry_dma = prp_page_dma; /* Get physical address and length of the data buffer. */ if (data_in_sz) { - paddr = data_in_dma; + dma_addr = data_in_dma; length = data_in_sz; } else { - paddr = data_out_dma; + dma_addr = data_out_dma; length = data_out_sz; } @@ -1500,8 +1500,7 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, * Check if we need to put a list pointer here if we are at * page boundary - prp_size (8 bytes). */ - page_mask_result = - (uintptr_t)((u8 *)prp_entry_phys + prp_size) & page_mask; + page_mask_result = (prp_entry_dma + prp_size) & page_mask; if (!page_mask_result) { /* * This is the last entry in a PRP List, so we need to @@ -1515,13 +1514,13 @@ _base_build_nvme_prp(struct MPT3SAS_ADAPTER *ioc, u16 smid, * contiguous, no need to get a new page - it's * just the next address. */ - prp_entry_phys++; - *prp_entry = cpu_to_le64((uintptr_t)prp_entry_phys); + prp_entry_dma++; + *prp_entry = cpu_to_le64(prp_entry_dma); prp_entry++; } /* Need to handle if entry will be part of a page. */ - offset = (u32)paddr & page_mask; + offset
RE: [PATCH 3.10 141/319] scsi: mpt3sas: Fix secure erase premature termination
Willy, I think this patch had a problem and later modified to a different blocking mechanism. Could you please pull in the latest change for this? Thanks Sathya -Original Message- From: Willy Tarreau [mailto:w...@1wt.eu] Sent: Sunday, February 05, 2017 12:19 PM To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; li...@roeck-us.net Cc: Andrey Grodzovsky; linux-s...@vger.kernel.org; Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; Sreekanth Reddy; Hannes Reinecke; Martin K . Petersen; Willy Tarreau Subject: [PATCH 3.10 141/319] scsi: mpt3sas: Fix secure erase premature termination From: Andrey Grodzovskycommit 18f6084a989ba1b38702f9af37a2e4049a924be6 upstream. This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming secure erase. Due to the very long time the operation takes, commands issued during the erase will time out and will trigger execution of the abort hook. Even though the abort hook is called for the specific command which timed out, this leads to entire device halt (scsi_state terminated) and premature termination of the secure erase. Set device state to busy while ATA passthrough commands are in progress. [mkp: hand applied to 4.9/scsi-fixes, tweaked patch description] Signed-off-by: Andrey Grodzovsky Acked-by: Sreekanth Reddy Cc: Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani Cc: Sreekanth Reddy Cc: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Willy Tarreau --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index f8c4b85..e414b71 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -3515,6 +3515,10 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status) SAM_STAT_CHECK_CONDITION; } +static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd) { + return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16); } /** * _scsih_qcmd_lck - main scsi request entry point @@ -3543,6 +3547,13 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) scsi_print_command(scmd); #endif + /* +* Lock the device for any subsequent command until command is +* done. +*/ + if (ata_12_16_cmd(scmd)) + scsi_internal_device_block(scmd->device); + scmd->scsi_done = done; sas_device_priv_data = scmd->device->hostdata; if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { @@ -4046,6 +4057,9 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) if (scmd == NULL) return 1; + if (ata_12_16_cmd(scmd)) + scsi_internal_device_unblock(scmd->device, SDEV_RUNNING); + mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); if (mpi_reply == NULL) { -- 2.8.0.rc2.1.gbe9624a
RE: [PATCH 3.10 141/319] scsi: mpt3sas: Fix secure erase premature termination
Willy, I think this patch had a problem and later modified to a different blocking mechanism. Could you please pull in the latest change for this? Thanks Sathya -Original Message- From: Willy Tarreau [mailto:w...@1wt.eu] Sent: Sunday, February 05, 2017 12:19 PM To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; li...@roeck-us.net Cc: Andrey Grodzovsky; linux-s...@vger.kernel.org; Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; Sreekanth Reddy; Hannes Reinecke; Martin K . Petersen; Willy Tarreau Subject: [PATCH 3.10 141/319] scsi: mpt3sas: Fix secure erase premature termination From: Andrey Grodzovsky commit 18f6084a989ba1b38702f9af37a2e4049a924be6 upstream. This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming secure erase. Due to the very long time the operation takes, commands issued during the erase will time out and will trigger execution of the abort hook. Even though the abort hook is called for the specific command which timed out, this leads to entire device halt (scsi_state terminated) and premature termination of the secure erase. Set device state to busy while ATA passthrough commands are in progress. [mkp: hand applied to 4.9/scsi-fixes, tweaked patch description] Signed-off-by: Andrey Grodzovsky Acked-by: Sreekanth Reddy Cc: Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani Cc: Sreekanth Reddy Cc: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Willy Tarreau --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index f8c4b85..e414b71 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -3515,6 +3515,10 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status) SAM_STAT_CHECK_CONDITION; } +static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd) { + return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16); } /** * _scsih_qcmd_lck - main scsi request entry point @@ -3543,6 +3547,13 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) scsi_print_command(scmd); #endif + /* +* Lock the device for any subsequent command until command is +* done. +*/ + if (ata_12_16_cmd(scmd)) + scsi_internal_device_block(scmd->device); + scmd->scsi_done = done; sas_device_priv_data = scmd->device->hostdata; if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { @@ -4046,6 +4057,9 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) if (scmd == NULL) return 1; + if (ata_12_16_cmd(scmd)) + scsi_internal_device_unblock(scmd->device, SDEV_RUNNING); + mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); if (mpi_reply == NULL) { -- 2.8.0.rc2.1.gbe9624a
RE: [PATCH v4 2/4] fusion: remove iopriority handling
By removing the code below, we put all the commands for all the types of devices (SAS/SATA) as simple-Q (requeue as the device require) and I am not sure whether it is the intention of this change. -Original Message- From: Adam Manzanares [mailto:adam.manzana...@hgst.com] Sent: Thursday, October 13, 2016 1:54 PM To: ax...@kernel.dk; t...@kernel.org; dan.j.willi...@intel.com; h...@suse.de; martin.peter...@oracle.com; mchri...@redhat.com; toshi.k...@hpe.com; ming@canonical.com; sathya.prak...@broadcom.com; chaitra.basa...@broadcom.com; suganath-prabu.subram...@broadcom.com Cc: linux-bl...@vger.kernel.org; linux-...@vger.kernel.org; linux-kernel@vger.kernel.org; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; Adam Manzanares; Adam Manzanares Subject: [PATCH v4 2/4] fusion: remove iopriority handling The request priority is now by default coming from the ioc. It was not clear what this code was trying to do based upon the iopriority class or data. The driver should check that a device supports priorities and use them according to the specificiations of ioprio. Signed-off-by: Adam Manzanares--- drivers/message/fusion/mptscsih.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 6c9fc11..4740bb6 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1369,11 +1369,6 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt) if ((vdevice->vtarget->tflags & MPT_TARGET_FLAGS_Q_YES) && (SCpnt->device->tagged_supported)) { scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ; - if (SCpnt->request && SCpnt->request->ioprio) { - if (((SCpnt->request->ioprio & 0x7) == 1) || - !(SCpnt->request->ioprio & 0x7)) - scsictl |= MPI_SCSIIO_CONTROL_HEADOFQ; - } } else scsictl = scsidir | MPI_SCSIIO_CONTROL_UNTAGGED; -- 2.1.4 Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer: This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
RE: [PATCH v4 2/4] fusion: remove iopriority handling
By removing the code below, we put all the commands for all the types of devices (SAS/SATA) as simple-Q (requeue as the device require) and I am not sure whether it is the intention of this change. -Original Message- From: Adam Manzanares [mailto:adam.manzana...@hgst.com] Sent: Thursday, October 13, 2016 1:54 PM To: ax...@kernel.dk; t...@kernel.org; dan.j.willi...@intel.com; h...@suse.de; martin.peter...@oracle.com; mchri...@redhat.com; toshi.k...@hpe.com; ming@canonical.com; sathya.prak...@broadcom.com; chaitra.basa...@broadcom.com; suganath-prabu.subram...@broadcom.com Cc: linux-bl...@vger.kernel.org; linux-...@vger.kernel.org; linux-kernel@vger.kernel.org; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; Adam Manzanares; Adam Manzanares Subject: [PATCH v4 2/4] fusion: remove iopriority handling The request priority is now by default coming from the ioc. It was not clear what this code was trying to do based upon the iopriority class or data. The driver should check that a device supports priorities and use them according to the specificiations of ioprio. Signed-off-by: Adam Manzanares --- drivers/message/fusion/mptscsih.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 6c9fc11..4740bb6 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1369,11 +1369,6 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt) if ((vdevice->vtarget->tflags & MPT_TARGET_FLAGS_Q_YES) && (SCpnt->device->tagged_supported)) { scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ; - if (SCpnt->request && SCpnt->request->ioprio) { - if (((SCpnt->request->ioprio & 0x7) == 1) || - !(SCpnt->request->ioprio & 0x7)) - scsictl |= MPI_SCSIIO_CONTROL_HEADOFQ; - } } else scsictl = scsidir | MPI_SCSIIO_CONTROL_UNTAGGED; -- 2.1.4 Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer: This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
RE: [PATCH] mpt3sas: Do scsi_remove_host() before deleting SAS PHY objects
Our understanding is the relationship between the SCSI host and SAS end devices is a parent-child and before ripping of SCSI host we need to rip of all the children. Why the enclosure ends up trying to re-parent the SCSI device from the enclosure to the SAS PHY even after we remove the SAS Phy?. Doesn't this need to be taken care in enclosure_removal? -Original Message- From: Calvin Owens [mailto:calvinow...@fb.com] Sent: Monday, May 16, 2016 2:25 PM To: Elliott, Robert (Persistent Memory) Cc: Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; James E.J. Bottomley; Martin K. Petersen; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-t...@fb.com; calvinow...@fb.com Subject: Re: [PATCH] mpt3sas: Do scsi_remove_host() before deleting SAS PHY objects On Friday 05/13 at 21:17 +, Elliott, Robert (Persistent Memory) wrote: > > > > -Original Message- > > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > > ow...@vger.kernel.org] On Behalf Of Calvin Owens > > Sent: Friday, May 13, 2016 3:28 PM > ... > > Subject: [PATCH] mpt3sas: Do scsi_remove_host() before deleting SAS > > PHY objects > > > ... > > The issue is that enclosure_remove_device() expects to be able to > > re-add the device that was previously enclosured: so with SES > > running, the order we unwind things matters in a way it otherwise > > wouldn't. > > > > Since mpt3sas deletes the SAS objects before the SCSI hosts, > > enclosure ends up trying to re-parent the SCSI device from the > > enclosure to the SAS PHY which has already been deleted. This obviously > > ends in sadness. > > > > The fix appears to be simple: just call scsi_remove_host() before we > > call > > sas_port_delete() and/or sas_remove_host(). > > > ... > > diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c > > @@ -8149,6 +8149,8 @@ void scsih_remove(struct pci_dev *pdev) > > _scsih_raid_device_remove(ioc, raid_device); > > } > > > > + scsi_remove_host(shost); > > + > > /* free ports attached to the sas_host */ > > list_for_each_entry_safe(mpt3sas_port, next_port, > >>sas_hba.sas_port_list, port_list) { @@ -8172,7 +8174,6 @@ > > void scsih_remove(struct pci_dev *pdev) > > } > > > > sas_remove_host(shost); > > - scsi_remove_host(shost); > > mpt3sas_base_detach(ioc); > > spin_lock(_lock); > > list_del(>list); > > That change matches the pattern of all other drivers calling > sas_remove_host, except for one: > drivers/message/fusion/mptsas.c > > That consensus means this comment in drivers/scsi/scsi_transport_sas.c > is wrong: > > /** > * sas_remove_host - tear down a Scsi_Host's SAS data structures > * @shost: Scsi Host that is torn down > * > * Removes all SAS PHYs and remote PHYs for a given Scsi_Host. > * Must be called just before scsi_remove_host for SAS HBAs. > */ Yes, exactly: that comment appears to be backwards, and as you say most drivers appear to do the opposite (I looked at HPSA at least, which calls sas_port_delete() before scsi_remove_host()). I suppose I should send a patch to fix the comment as well? It'd be nice to get some testing to be certain I'm not breaking somebody else's setup by fixing mine though... Thanks, Calvin
RE: [PATCH] mpt3sas: Do scsi_remove_host() before deleting SAS PHY objects
Our understanding is the relationship between the SCSI host and SAS end devices is a parent-child and before ripping of SCSI host we need to rip of all the children. Why the enclosure ends up trying to re-parent the SCSI device from the enclosure to the SAS PHY even after we remove the SAS Phy?. Doesn't this need to be taken care in enclosure_removal? -Original Message- From: Calvin Owens [mailto:calvinow...@fb.com] Sent: Monday, May 16, 2016 2:25 PM To: Elliott, Robert (Persistent Memory) Cc: Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; James E.J. Bottomley; Martin K. Petersen; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-t...@fb.com; calvinow...@fb.com Subject: Re: [PATCH] mpt3sas: Do scsi_remove_host() before deleting SAS PHY objects On Friday 05/13 at 21:17 +, Elliott, Robert (Persistent Memory) wrote: > > > > -Original Message- > > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > > ow...@vger.kernel.org] On Behalf Of Calvin Owens > > Sent: Friday, May 13, 2016 3:28 PM > ... > > Subject: [PATCH] mpt3sas: Do scsi_remove_host() before deleting SAS > > PHY objects > > > ... > > The issue is that enclosure_remove_device() expects to be able to > > re-add the device that was previously enclosured: so with SES > > running, the order we unwind things matters in a way it otherwise > > wouldn't. > > > > Since mpt3sas deletes the SAS objects before the SCSI hosts, > > enclosure ends up trying to re-parent the SCSI device from the > > enclosure to the SAS PHY which has already been deleted. This obviously > > ends in sadness. > > > > The fix appears to be simple: just call scsi_remove_host() before we > > call > > sas_port_delete() and/or sas_remove_host(). > > > ... > > diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c > > @@ -8149,6 +8149,8 @@ void scsih_remove(struct pci_dev *pdev) > > _scsih_raid_device_remove(ioc, raid_device); > > } > > > > + scsi_remove_host(shost); > > + > > /* free ports attached to the sas_host */ > > list_for_each_entry_safe(mpt3sas_port, next_port, > >>sas_hba.sas_port_list, port_list) { @@ -8172,7 +8174,6 @@ > > void scsih_remove(struct pci_dev *pdev) > > } > > > > sas_remove_host(shost); > > - scsi_remove_host(shost); > > mpt3sas_base_detach(ioc); > > spin_lock(_lock); > > list_del(>list); > > That change matches the pattern of all other drivers calling > sas_remove_host, except for one: > drivers/message/fusion/mptsas.c > > That consensus means this comment in drivers/scsi/scsi_transport_sas.c > is wrong: > > /** > * sas_remove_host - tear down a Scsi_Host's SAS data structures > * @shost: Scsi Host that is torn down > * > * Removes all SAS PHYs and remote PHYs for a given Scsi_Host. > * Must be called just before scsi_remove_host for SAS HBAs. > */ Yes, exactly: that comment appears to be backwards, and as you say most drivers appear to do the opposite (I looked at HPSA at least, which calls sas_port_delete() before scsi_remove_host()). I suppose I should send a patch to fix the comment as well? It'd be nice to get some testing to be certain I'm not breaking somebody else's setup by fixing mine though... Thanks, Calvin
RE: [PATCH] mptsas: fix checks for dma mapping errors
Please consider this patch as Ack-by: Sathya Prakash Veerichetty<sathya.prak...@broadcom.com> PS: We don't have test environment to test this patch as this is for an old controller. So ACKing based on code review and similar mpt3sas driver code. -Original Message- From: Martin K. Petersen [mailto:martin.peter...@oracle.com] Sent: Wednesday, April 27, 2016 7:18 PM To: Alexey Khoroshilov Cc: Sreekanth Reddy; Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; ldv-proj...@linuxtesting.org Subject: Re: [PATCH] mptsas: fix checks for dma mapping errors >>>>> "Alexey" == Alexey Khoroshilov <khoroshi...@ispras.ru> writes: Alexey> mptsas_smp_handler() checks for dma mapping errors by comparison Alexey> returned address with zero, while pci_dma_mapping_error() should Alexey> be used. Broadcom folks, please review! -- Martin K. Petersen Oracle Linux Engineering
RE: [PATCH] mptsas: fix checks for dma mapping errors
Please consider this patch as Ack-by: Sathya Prakash Veerichetty PS: We don't have test environment to test this patch as this is for an old controller. So ACKing based on code review and similar mpt3sas driver code. -Original Message- From: Martin K. Petersen [mailto:martin.peter...@oracle.com] Sent: Wednesday, April 27, 2016 7:18 PM To: Alexey Khoroshilov Cc: Sreekanth Reddy; Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; ldv-proj...@linuxtesting.org Subject: Re: [PATCH] mptsas: fix checks for dma mapping errors >>>>> "Alexey" == Alexey Khoroshilov writes: Alexey> mptsas_smp_handler() checks for dma mapping errors by comparison Alexey> returned address with zero, while pci_dma_mapping_error() should Alexey> be used. Broadcom folks, please review! -- Martin K. Petersen Oracle Linux Engineering
RE: [PATCH] mpt3sas: Remove usage of 'struct timeval'
Hi, Please consider this patch as Ack-by: Sathya PrakashThanks, Sathya -Original Message- From: mpt-fusionlinux@broadcom.com [mailto:mpt-fusionlinux@broadcom.com] On Behalf Of Martin K. Petersen Sent: Thursday, April 14, 2016 8:48 PM To: Tina Ruchandani Cc: mpt-fusionlinux@broadcom.com; Arnd Bergmann; y2...@lists.linaro.org; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; j...@linux.vnet.ibm.com; suganath-prabu.subram...@avagotech.com; Chaitra P B; Sreekanth Reddy Subject: Re: [PATCH] mpt3sas: Remove usage of 'struct timeval' > "Tina" == Tina Ruchandani writes: Tina> 'struct timeval' will have its tv_sec value overflow on 32-bit Tina> systems in year 2038 and beyond. This patch replaces the use of Tina> struct timeval for computing mpi_request.TimeStamp, and instead Tina> uses ktime_t which provides 64-bit seconds value. The timestamp Tina> computed remains unaffected (milliseconds since Unix epoch). Broadcom folks, please review. -- Martin K. Petersen Oracle Linux Engineering
RE: [PATCH] mpt3sas: Remove usage of 'struct timeval'
Hi, Please consider this patch as Ack-by: Sathya Prakash Thanks, Sathya -Original Message- From: mpt-fusionlinux@broadcom.com [mailto:mpt-fusionlinux@broadcom.com] On Behalf Of Martin K. Petersen Sent: Thursday, April 14, 2016 8:48 PM To: Tina Ruchandani Cc: mpt-fusionlinux@broadcom.com; Arnd Bergmann; y2...@lists.linaro.org; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; j...@linux.vnet.ibm.com; suganath-prabu.subram...@avagotech.com; Chaitra P B; Sreekanth Reddy Subject: Re: [PATCH] mpt3sas: Remove usage of 'struct timeval' > "Tina" == Tina Ruchandani writes: Tina> 'struct timeval' will have its tv_sec value overflow on 32-bit Tina> systems in year 2038 and beyond. This patch replaces the use of Tina> struct timeval for computing mpi_request.TimeStamp, and instead Tina> uses ktime_t which provides 64-bit seconds value. The timestamp Tina> computed remains unaffected (milliseconds since Unix epoch). Broadcom folks, please review. -- Martin K. Petersen Oracle Linux Engineering
RE: [PATCH] mpt3sas: fix possible NULL dereference
We need to do some more changes in this. The concept is first pool alloc and then memory alloc in the pool, so the memory has to be freed if the memory is allocated in the pool and irrespective of memory allocated or not the pool has to be destroyed if it is created. We will work internally and provide a complete patch. Thanks Sathya -Original Message- From: Martin K. Petersen [mailto:martin.peter...@oracle.com] Sent: Thursday, April 14, 2016 8:44 PM To: Sudip Mukherjee Cc: Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; James E.J. Bottomley; Martin K. Petersen; linux-kernel@vger.kernel.org; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org Subject: Re: [PATCH] mpt3sas: fix possible NULL dereference > "Sudip" == Sudip Mukherjeewrites: Sudip> We are dereferencing ioc->sense_dma_pool in pci_pool_free() and Sudip> after that we are checking if it is NULL, before calling Sudip> pci_pool_destroy(). Lets check if it is NULL before calling both Sudip> pci_pool_free() and pci_pool_destroy(). Broadcom folks, please review. -- Martin K. Petersen Oracle Linux Engineering
RE: [PATCH] mpt3sas: fix possible NULL dereference
We need to do some more changes in this. The concept is first pool alloc and then memory alloc in the pool, so the memory has to be freed if the memory is allocated in the pool and irrespective of memory allocated or not the pool has to be destroyed if it is created. We will work internally and provide a complete patch. Thanks Sathya -Original Message- From: Martin K. Petersen [mailto:martin.peter...@oracle.com] Sent: Thursday, April 14, 2016 8:44 PM To: Sudip Mukherjee Cc: Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; James E.J. Bottomley; Martin K. Petersen; linux-kernel@vger.kernel.org; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org Subject: Re: [PATCH] mpt3sas: fix possible NULL dereference > "Sudip" == Sudip Mukherjee writes: Sudip> We are dereferencing ioc->sense_dma_pool in pci_pool_free() and Sudip> after that we are checking if it is NULL, before calling Sudip> pci_pool_destroy(). Lets check if it is NULL before calling both Sudip> pci_pool_free() and pci_pool_destroy(). Broadcom folks, please review. -- Martin K. Petersen Oracle Linux Engineering