[PATCH 0/6] cxlflash: Miscellaneous fixes
This patch set contains miscellaneous fixes in the device cleanup and EEH recovery paths. One of the patches simplifies the WWPN assignment routine. There are a couple of fixes that resolve regressions introduced by Commit 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash cards") and Commit 888baf069f49 ("scsi: cxlflash: Add kref to context") This series is based upon mkp's 4.9/scsi-queue and is bisectable. Matthew R. Ochs (4): cxlflash: Fix to avoid EEH and host reset collisions cxlflash: Improve EEH recovery time cxlflash: Refactor WWPN setup cxlflash: Fix context reference tracking on detach Uma Krishnan (2): cxlflash: Scan host only after the port is ready for I/O cxlflash: Remove the device cleanly in the system shutdown path drivers/scsi/cxlflash/main.c | 81 +-- drivers/scsi/cxlflash/superpipe.c | 3 +- 2 files changed, 37 insertions(+), 47 deletions(-) -- 2.1.0 -- 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
[PATCH 6/6] cxlflash: Fix context reference tracking on detach
From: "Matthew R. Ochs" Commit 888baf069f49 ("scsi: cxlflash: Add kref to context") introduced a kref to the context. In particular, the detach routine was updated to use the kref services for managing the removal and destruction of a context. As part of this change, the tracking mechanism internal to the detach handler was refactored. This introduced a bug that can cause the tracking state to be lost. This can lead to a situation where exclusive access to a context is prematurely [and unknowingly] relinquished for the executing thread. To remedy, only update the tracking state when the kref operation indicates the context was removed. Fixes: 888baf069f49 ("scsi: cxlflash: Add kref to context") Signed-off-by: Matthew R. Ochs --- drivers/scsi/cxlflash/superpipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c index c91fe6f..9636970 100644 --- a/drivers/scsi/cxlflash/superpipe.c +++ b/drivers/scsi/cxlflash/superpipe.c @@ -912,7 +912,8 @@ static int _cxlflash_disk_detach(struct scsi_device *sdev, * Release the context reference and the sdev reference that * bound this LUN to the context. */ - put_ctx = !kref_put(&ctxi->kref, remove_context); + if (kref_put(&ctxi->kref, remove_context)) + put_ctx = false; scsi_device_put(sdev); out: if (put_ctx) -- 2.1.0 -- 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
[PATCH 5/6] cxlflash: Refactor WWPN setup
From: "Matthew R. Ochs" Commit 964497b3bf3f ("cxlflash: Remove dual port online dependency") logically removed the ability for the WWPN setup routine afu_set_wwpn() to return a non-success value. This routine can safely be made a void to simplify the code as there is no longer a need to report a failure. Signed-off-by: Matthew R. Ochs --- drivers/scsi/cxlflash/main.c | 40 +--- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 42970a4..b301655 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -1093,42 +1093,25 @@ static int wait_port_offline(__be64 __iomem *fc_regs, u32 delay_us, u32 nretry) * online. This toggling action can cause this routine to delay up to a few * seconds. When configured to use the internal LUN feature of the AFU, a * failure to come online is overridden. - * - * Return: - * 0 when the WWPN is successfully written and the port comes back online - * -1 when the port fails to go offline or come back up online */ -static int afu_set_wwpn(struct afu *afu, int port, __be64 __iomem *fc_regs, - u64 wwpn) +static void afu_set_wwpn(struct afu *afu, int port, __be64 __iomem *fc_regs, +u64 wwpn) { - int rc = 0; - set_port_offline(fc_regs); - if (!wait_port_offline(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US, FC_PORT_STATUS_RETRY_CNT)) { pr_debug("%s: wait on port %d to go offline timed out\n", __func__, port); - rc = -1; /* but continue on to leave the port back online */ } - if (rc == 0) - writeq_be(wwpn, &fc_regs[FC_PNAME / 8]); - - /* Always return success after programming WWPN */ - rc = 0; + writeq_be(wwpn, &fc_regs[FC_PNAME / 8]); set_port_online(fc_regs); - if (!wait_port_online(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US, FC_PORT_STATUS_RETRY_CNT)) { - pr_err("%s: wait on port %d to go online timed out\n", - __func__, port); + pr_debug("%s: wait on port %d to go online timed out\n", +__func__, port); } - - pr_debug("%s: returning rc=%d\n", __func__, rc); - - return rc; } /** @@ -1629,15 +1612,10 @@ static int init_global(struct cxlflash_cfg *cfg) [FC_CRC_THRESH / 8]); /* Set WWPNs. If already programmed, wwpn[i] is 0 */ - if (wwpn[i] != 0 && - afu_set_wwpn(afu, i, -&afu->afu_map->global.fc_regs[i][0], -wwpn[i])) { - dev_err(dev, "%s: failed to set WWPN on port %d\n", - __func__, i); - rc = -EIO; - goto out; - } + if (wwpn[i] != 0) + afu_set_wwpn(afu, i, +&afu->afu_map->global.fc_regs[i][0], +wwpn[i]); /* Programming WWPN back to back causes additional * offline/online transitions and a PLOGI */ -- 2.1.0 -- 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
[PATCH 4/6] cxlflash: Improve EEH recovery time
From: "Matthew R. Ochs" When an EEH occurs during device initialization, the port timeout logic can cause excessive delays as MMIO reads will fail. Depending on where they are experienced, these delays can lead to a prolonged reset, causing an unnecessary triggering of other timeout logic in the SCSI stack or user applications. To expedite recovery, the port timeout logic is updated to decay the timeout at a much faster rate when in the presence of a likely EEH frozen event. Signed-off-by: Matthew R. Ochs --- drivers/scsi/cxlflash/main.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 4ef5235..42970a4 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -1040,6 +1040,8 @@ static int wait_port_online(__be64 __iomem *fc_regs, u32 delay_us, u32 nretry) do { msleep(delay_us / 1000); status = readq_be(&fc_regs[FC_MTIP_STATUS / 8]); + if (status == U64_MAX) + nretry /= 2; } while ((status & FC_MTIP_STATUS_MASK) != FC_MTIP_STATUS_ONLINE && nretry--); @@ -1071,6 +1073,8 @@ static int wait_port_offline(__be64 __iomem *fc_regs, u32 delay_us, u32 nretry) do { msleep(delay_us / 1000); status = readq_be(&fc_regs[FC_MTIP_STATUS / 8]); + if (status == U64_MAX) + nretry /= 2; } while ((status & FC_MTIP_STATUS_MASK) != FC_MTIP_STATUS_OFFLINE && nretry--); -- 2.1.0 -- 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
[PATCH 3/6] cxlflash: Fix to avoid EEH and host reset collisions
From: "Matthew R. Ochs" The EEH reset handler is ignorant to the current state of the driver when processing a frozen event and initiating a device reset. This can be an issue if an EEH event occurs while a user or stack initiated reset is executing. More specifically, if an EEH occurs while the SCSI host reset handler is active, the reset initiated by the EEH thread will likely collide with the host reset thread. This can leave the device in an inconsistent state, or worse, cause a system crash. As a remedy, the EEH handler is updated to evaluate the device state and take appropriate action (proceed, wait, or disconnect host). The host reset handler is also updated to handle situations where an EEH occurred during a host reset. In such situations, the host reset handler will delay reporting back a success to give the EEH reset an opportunity to complete. Signed-off-by: Matthew R. Ochs --- drivers/scsi/cxlflash/main.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 4c2559a..4ef5235 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -2042,6 +2042,11 @@ retry: * cxlflash_eh_host_reset_handler() - reset the host adapter * @scp: SCSI command from stack identifying host. * + * Following a reset, the state is evaluated again in case an EEH occurred + * during the reset. In such a scenario, the host reset will either yield + * until the EEH recovery is complete or return success or failure based + * upon the current device state. + * * Return: * SUCCESS as defined in scsi/scsi.h * FAILED as defined in scsi/scsi.h @@ -2074,7 +2079,8 @@ static int cxlflash_eh_host_reset_handler(struct scsi_cmnd *scp) } else cfg->state = STATE_NORMAL; wake_up_all(&cfg->reset_waitq); - break; + ssleep(1); + /* fall through */ case STATE_RESET: wait_event(cfg->reset_waitq, cfg->state != STATE_RESET); if (cfg->state == STATE_NORMAL) @@ -2590,6 +2596,9 @@ out_remove: * @pdev: PCI device struct. * @state: PCI channel state. * + * When an EEH occurs during an active reset, wait until the reset is + * complete and then take action based upon the device state. + * * Return: PCI_ERS_RESULT_NEED_RESET or PCI_ERS_RESULT_DISCONNECT */ static pci_ers_result_t cxlflash_pci_error_detected(struct pci_dev *pdev, @@ -2603,6 +2612,10 @@ static pci_ers_result_t cxlflash_pci_error_detected(struct pci_dev *pdev, switch (state) { case pci_channel_io_frozen: + wait_event(cfg->reset_waitq, cfg->state != STATE_RESET); + if (cfg->state == STATE_FAILTERM) + return PCI_ERS_RESULT_DISCONNECT; + cfg->state = STATE_RESET; scsi_block_requests(cfg->host); drain_ioctls(cfg); -- 2.1.0 -- 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
[PATCH 2/6] cxlflash: Remove the device cleanly in the system shutdown path
Commit 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash cards") was recently introduced to notify the AFU when a system is going down. Due to the position of the cxlflash driver in the device stack, cxlflash devices are _always_ removed during a reboot/shutdown. This can lead to a crash if the cxlflash shutdown hook is invoked _after_ the shutdown hook for the owning virtual PHB. Furthermore, the current implementation of shutdown/remove hooks for cxlflash are not tolerant to being invoked when the device is not enabled. This can also lead to a crash in situations where the remove hook is invoked after the device has been removed via the vPHBs shutdown hook. An example of this scenario would be an EEH reset failure while a reboot/shutdown is in progress. To solve both problems, the shutdown hook for cxlflash is updated to simply remove the device. This path already includes the AFU notification and thus this solution will continue to perform the original intent. At the same time, the remove hook is updated to protect against being called when the device is not enabled. Fixes: 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash cards") Signed-off-by: Uma Krishnan --- drivers/scsi/cxlflash/main.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index b063c41..4c2559a 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -823,17 +823,6 @@ static void notify_shutdown(struct cxlflash_cfg *cfg, bool wait) } /** - * cxlflash_shutdown() - shutdown handler - * @pdev: PCI device associated with the host. - */ -static void cxlflash_shutdown(struct pci_dev *pdev) -{ - struct cxlflash_cfg *cfg = pci_get_drvdata(pdev); - - notify_shutdown(cfg, false); -} - -/** * cxlflash_remove() - PCI entry point to tear down host * @pdev: PCI device associated with the host. * @@ -844,6 +833,11 @@ static void cxlflash_remove(struct pci_dev *pdev) struct cxlflash_cfg *cfg = pci_get_drvdata(pdev); ulong lock_flags; + if (!pci_is_enabled(pdev)) { + pr_debug("%s: Device is disabled\n", __func__); + return; + } + /* If a Task Management Function is active, wait for it to complete * before continuing with remove. */ @@ -2685,7 +2679,7 @@ static struct pci_driver cxlflash_driver = { .id_table = cxlflash_pci_table, .probe = cxlflash_probe, .remove = cxlflash_remove, - .shutdown = cxlflash_shutdown, + .shutdown = cxlflash_remove, .err_handler = &cxlflash_err_handler, }; -- 2.1.0 -- 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
[PATCH 1/6] cxlflash: Scan host only after the port is ready for I/O
When a port link is established, the AFU sends a 'link up' interrupt. After the link is up, corresponding initialization steps are performed on the card. Following that, when the card is ready for I/O, the AFU sends 'login succeeded' interrupt. Today, cxlflash invokes scsi_scan_host() upon receipt of both interrupts. SCSI commands sent to the port prior to the 'login succeeded' interrupt will fail with 'port not available' error. This is not desirable. Moreover, when async_scan is active for the host, subsequent scan calls are terminated with error. Due to this, the scsi_scan_host() call performed after 'login succeeded' interrupt could portentially return error and the devices may not be scanned properly. To avoid this problem, scsi_scan_host() should be called only after the 'login succeeded' interrupt. Signed-off-by: Uma Krishnan --- drivers/scsi/cxlflash/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 661bb94..b063c41 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -1187,7 +1187,7 @@ static const struct asyc_intr_info ainfo[] = { {SISL_ASTATUS_FC0_LOGI_F, "login failed", 0, CLR_FC_ERROR}, {SISL_ASTATUS_FC0_LOGI_S, "login succeeded", 0, SCAN_HOST}, {SISL_ASTATUS_FC0_LINK_DN, "link down", 0, 0}, - {SISL_ASTATUS_FC0_LINK_UP, "link up", 0, SCAN_HOST}, + {SISL_ASTATUS_FC0_LINK_UP, "link up", 0, 0}, {SISL_ASTATUS_FC1_OTHER, "other error", 1, CLR_FC_ERROR | LINK_RESET}, {SISL_ASTATUS_FC1_LOGO, "target initiated LOGO", 1, 0}, {SISL_ASTATUS_FC1_CRC_T, "CRC threshold exceeded", 1, LINK_RESET}, @@ -1195,7 +1195,7 @@ static const struct asyc_intr_info ainfo[] = { {SISL_ASTATUS_FC1_LOGI_F, "login failed", 1, CLR_FC_ERROR}, {SISL_ASTATUS_FC1_LOGI_S, "login succeeded", 1, SCAN_HOST}, {SISL_ASTATUS_FC1_LINK_DN, "link down", 1, 0}, - {SISL_ASTATUS_FC1_LINK_UP, "link up", 1, SCAN_HOST}, + {SISL_ASTATUS_FC1_LINK_UP, "link up", 1, 0}, {0x0, "", 0, 0} /* terminator */ }; -- 2.1.0 -- 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 1/2] wd719x: Remove last declaration using DEFINE_PCI_DEVICE_TABLE
> "Andrew" == Andrew Morton writes: Andrew> That creates an ordering dependency between the scsi tree and Andrew> -mm's "treewide: remove references to the now unnecessary Andrew> DEFINE_PCI_DEVICE_TABLE". Andrew> So an ack would be preferred, please. OK. I was assuming that a subsequent patch would remove the macro. I'll just drop the patch then. -- Martin K. Petersen Oracle Linux Engineering -- 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 00/15] smartpqi update
> "Don" == Don Brace writes: Don, Don> Thank you for doing the tweaking. I notice that the MAINTAINERS Don> file got updated with the Documentation/scsi/smartpqi.txt, but Don> smartpqi.txt was not added. Peculiar. Will fix. -- Martin K. Petersen Oracle Linux Engineering -- 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 1/2] wd719x: Remove last declaration using DEFINE_PCI_DEVICE_TABLE
On Fri, 02 Sep 2016 06:36:05 -0400 "Martin K. Petersen" wrote: > > "Joe" == Joe Perches writes: > > Joe> Convert it to the preferred const struct pci_device_id instead. > > Applied to 4.9/scsi-queue. That creates an ordering dependency between the scsi tree and -mm's "treewide: remove references to the now unnecessary DEFINE_PCI_DEVICE_TABLE". So an ack would be preferred, please. -- 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: linux-next: Tree for Jun 6 (scsi_debug.c)
On 08/23/16 16:22, Masanari Iida wrote: > This one still exist on linus's tree (as of v4.8-rc3). > > CALLscripts/checksyscalls.sh > CHK kernel/config_data.h > Building modules, stage 2. > MODPOST 720 modules > ERROR: "ip_compute_csum" [drivers/scsi/scsi_debug.ko] undefined! > scripts/Makefile.modpost:91: recipe for target '__modpost' failed > make[1]: *** [__modpost] Error 1 > Makefile:1178: recipe for target 'modules' failed > make: *** [modules] Error 2 > > Masanari Hi, Do you have the kernel .config file that causes this? I can no longer reproduce it. What $arch did you build on? Thanks. > On Tue, Jun 7, 2016 at 12:10 PM, Randy Dunlap wrote: >> On 06/05/16 21:20, Stephen Rothwell wrote: >>> Hi all, >>> >>> Changes since 20160603: >> >> on x86_64: >> >> ERROR: "ip_compute_csum" [drivers/scsi/scsi_debug.ko] undefined! >> >> CONFIG_GENERIC_CSUM doesn't seem to exist for x86, so lib/checksum.o is not >> built. >> >> >> -- >> ~Randy -- ~Randy -- 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] iscsi-target: fix spelling mistake "Unsolicitied" -> "Unsolicited"
On 09/02/2016 07:32 AM, Colin King wrote: Trivial fix to spelling mistakes in pr_debug message and comments Reviewed-by: Bart Van Assche -- 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 00/15] smartpqi update
Thank you for doing the tweaking. I notice that the MAINTAINERS file got updated with the Documentation/scsi/smartpqi.txt, but smartpqi.txt was not added. Wondering what I need to do to resolve this. Thanks, Don Brace ESC - Smart Storage Microsemi Corporation > -Original Message- > From: Martin K. Petersen [mailto:martin.peter...@oracle.com] > Sent: Friday, September 02, 2016 5:31 AM > To: Don Brace > Cc: j...@linux.vnet.ibm.com; John Hall; Kevin Barnett; Mahesh > Rajashekhara; h...@infradead.org; Scott Teel; Viswas G; Justin Lindley; Scott > Benesh; elli...@hpe.com; linux-scsi@vger.kernel.org > Subject: Re: [PATCH V2 00/15] smartpqi update > > EXTERNAL EMAIL > > > > "Don" == Don Brace writes: > > Don, > > Don> These changes are based on Linus's tree The changes are: > > Please make sure you submit patches against my tree. Had to tweak a few > things by hand. > > Applied series to 4.9/scsi-queue. > > -- > Martin K. Petersen Oracle Linux Engineering -- 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
[PATCH] iscsi-target: fix spelling mistake "Unsolicitied" -> "Unsolicited"
From: Colin Ian King Trivial fix to spelling mistakes in pr_debug message and comments Signed-off-by: Colin Ian King --- drivers/target/iscsi/iscsi_target.c | 2 +- drivers/target/iscsi/iscsi_target_login.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 39b928c..1aaf1f3 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -2982,7 +2982,7 @@ iscsit_build_nopin_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, pr_debug("Built NOPIN %s Response ITT: 0x%08x, TTT: 0x%08x," " StatSN: 0x%08x, Length %u\n", (nopout_response) ? - "Solicitied" : "Unsolicitied", cmd->init_task_tag, + "Solicited" : "Unsolicited", cmd->init_task_tag, cmd->targ_xfer_tag, cmd->stat_sn, cmd->buf_ptr_size); } EXPORT_SYMBOL(iscsit_build_nopin_rsp); diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index e1b4caf..78b0d5e 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c @@ -434,7 +434,7 @@ static int iscsi_login_zero_tsih_s2( /* * Make MaxRecvDataSegmentLength PAGE_SIZE aligned for -* Immediate Data + Unsolicitied Data-OUT if necessary.. +* Immediate Data + Unsolicited Data-OUT if necessary.. */ param = iscsi_find_param_from_key("MaxRecvDataSegmentLength", conn->param_list); @@ -646,7 +646,7 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn) { struct iscsi_session *sess = conn->sess; /* -* FIXME: Unsolicitied NopIN support for ISER +* FIXME: Unsolicited NopIN support for ISER */ if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) return; -- 2.9.3 -- 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: Block-level access
My access is almost purely sequential and primarily writing, so read-ahead doesn't help me. What's problematic with pread/pwrite is the lack of error channel from media errors. BSG looks very interesting. I'll look further into that today. On Thu, Sep 1, 2016 at 5:16 PM, Bart Van Assche wrote: > On 09/01/2016 02:48 PM, Alex Austin wrote: >> >> CC'ing linux-scsi and linux-block. >> >> Also, please CC me in replies. >> >> On Thu, Sep 1, 2016 at 4:43 PM, Alex Austin >> wrote: >>> >>> Hello, >>> What is the most performant way to directly interface with an attached >>> hard >>> drive? I've so far used read()/write() on /dev/sd_ but I find error >>> handling >>> exceedingly difficult, as I don't always even get errors reported, even >>> if the >>> open() call includes O_DIRECT. I've also used ioctl(SG_IO), but find that >>> it's >>> extremely slow due to the lack of queuing support in the API. Is there a >>> mid-level API that will get me decent error handling while allowing >>> command >>> queuing, or do I just need to make multiple threads all doing separate >>> SG_IO >>> ioctls? > > > What the most efficient way is to interface is with a hard drive depends on > the I/O pattern. Are you aware that buffered I/O performs read-ahead? Have > you already tried to tune the read-ahead setting (blockdev --getra / > blockdev --setra)? > > BTW, if you need an example of how to queue SG_IO, you are welcome to have a > look at the fio source code. You will probably be interested in the bsg API. > See e.g. https://lwn.net/Articles/174469/. > > Bart. -- Intelligence is knowing that a tomoato is a fruit; wisdom is knowing that it doesn't go in a fruit salad; charisma is selling a tomato-based fruit salad. -- 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
Need some pointers to debug a target hang
Hi Nick et al, I'm having a "interesting" problem with the kernel's iSCSI target and could use a debug hint. My target uses an iblock backstore on a dm-linear target. When I now get I/O form the initiator (I used a simple dd if=/dev/sda of=/dev/null) and call 'dmsetup suspend $backstore' it'll take about 15 seconds for the iscsi_ttx kernel thread to disapear, the iscsi_trx and iscsi_np threads are hanging in 'D'. >From iscsi_trx's stack I see it's waiting in __transport_wait_for_tasks(). The last thing I see in dmesg is the 'ABORT_TASK: Found referenced %s task_tag: %llu' printk but the 'ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %llu" printk is missing from core_tmr_abort_task(). As there's a transport_wait_for_tasks() call in between I _think_ it is stuck in aborting this one task and none of the complete(se_cmd->t_transport_stop_comp) callers is called. What puzzels me a bit is that right after transport_wait_for_tasks() in core_tmr_abort_task() there's a call to transport_cmd_finish_abort() which in turn calls transport_cmd_check_stop_to_fabric() -> transport_cmd_check_stop() -> complete_all(&cmd->t_transport_stop_comp). Doing --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2739,7 +2739,7 @@ __transport_wait_for_tasks(struct se_cmd spin_unlock_irqrestore(&cmd->t_state_lock, *flags); - wait_for_completion(&cmd->t_transport_stop_comp); + wait_for_completion_interruptible(&cmd->t_transport_stop_comp, 5 * HZ); spin_lock_irqsave(&cmd->t_state_lock, *flags); cmd->transport_state &= ~(CMD_T_ACTIVE | CMD_T_STOP); "resolves" the bug, but I don't think this is correct. This is all easily reproducible with v4.8-rc4 in qemu (for instance). Any advice is aprechiated. Thanks in advance, Johannes -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- 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: ufs: add missing header dependencies for tc-dwc-g210
> "Baoyou" == Baoyou Xie writes: Baoyou> We get 2 warnings when build kernel with W=1: Baoyou> drivers/scsi/ufs/tc-dwc-g210.c:261:5: warning: no previous Baoyou> prototype for 'tc_dwc_g210_config_40_bit' [-Wmissing-prototypes] Baoyou> drivers/scsi/ufs/tc-dwc-g210.c:293:5: warning: no previous Baoyou> prototype for 'tc_dwc_g210_config_20_bit' [-Wmissing-prototypes] Baoyou> In fact, these functions are declared in ufs/tc-dwc-g210.h, so Baoyou> this patch add missing header dependencies Applied to 4.9/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- 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: constify sr_pm_ops structure
> "Julia" == Julia Lawall writes: Julia> sr_pm_ops, of type struct dev_pm_ops, is never modified, so Julia> declare it as const. Applied to 4.9/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- 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: ufs: add missing declaration in ufshcd.h
> "Baoyou" == Baoyou Xie writes: Baoyou> We get 1 warning about global functions without a declaration in Baoyou> the scsi ufshcd driver when building with W=1: Baoyou> drivers/scsi/ufs/ufshcd.c:1991:5: warning: no previous prototype Baoyou> for 'ufshcd_query_descriptor_retry' [-Wmissing-prototypes] Baoyou> in fact, this function is implemented in ufshcd.c and exported Baoyou> but need to be declared in header file. ufshcd_query_descriptor_retry doesn't appear to be used outside of ufshcd.c. -- Martin K. Petersen Oracle Linux Engineering -- 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] fix:pmcraid: mark symbols static where possible
> "Baoyou" == Baoyou Xie writes: Baoyou> We get 4 warnings about global functions without a declaration Baoyou> in the scsi pmcraid driver when building with W=1: Baoyou> drivers/scsi/pmcraid.c:309:6: warning: no previous prototype for Baoyou> 'pmcraid_init_cmdblk' [-Wmissing-prototypes] Baoyou> drivers/scsi/pmcraid.c:404:6: warning: no previous prototype for Baoyou> 'pmcraid_return_cmd' [-Wmissing-prototypes] Baoyou> drivers/scsi/pmcraid.c:1713:6: warning: no previous prototype Baoyou> for 'pmcraid_ioasc_logger' [-Wmissing-prototypes] Baoyou> drivers/scsi/pmcraid.c:3141:1: warning: no previous prototype Baoyou> for 'pmcraid_init_ioadls' [-Wmissing-prototypes] Baoyou> In fact, these functions are only used in the file in which it Baoyou> is declared and don't need a declaration, but can be made Baoyou> static. so this patch marks it 'static'. Applied to 4.9/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- 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 v1 0/3] Ibmvscsis fixes and code cleanup
> "Bryant" == Bryant G Ly writes: Bryant, Bryant> Here are some small fixes and cleanups for Ibmvscsis Target Bryant> Driver. The only one of significance is the first one where Bryant> there is a possibility of a kernel crash due to inproper Bryant> deregister of target session since we didn't sync up work and Bryant> didn't deregister_configfs. Applied to 4.9/scsi-queue. I did patch 2 by hand. It didn't apply to neither my tree, nor Nic's. -- Martin K. Petersen Oracle Linux Engineering -- 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 1/2] wd719x: Remove last declaration using DEFINE_PCI_DEVICE_TABLE
> "Joe" == Joe Perches writes: Joe> Convert it to the preferred const struct pci_device_id instead. Applied to 4.9/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- 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 00/15] smartpqi update
> "Don" == Don Brace writes: Don, Don> These changes are based on Linus's tree The changes are: Please make sure you submit patches against my tree. Had to tweak a few things by hand. Applied series to 4.9/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- 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 0/2] fusion: Remove deprecated create_singlethread_workqueue
> "Bhaktipriya" == Bhaktipriya Shridhar writes: Bhaktipriya> This patch set removes deprecated Bhaktipriya> create_singlethread_workqueue instances from Bhaktipriya> drivers/message Applied to 4.9/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering -- 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] bfa: do not dereference port before it is null checked
> "Colin" == Colin King writes: Colin> port is deferenced before it is null sanity checked, hence we Colin> potentially have a null pointer dereference bug. Instead, Colin> initialise trl_enabled from port->fcs->bfa after we are sure port Colin> is not null. Applied to 4.9/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- 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] qla4xxx: mark symbols static where possible
> "Baoyou" == Baoyou Xie writes: Baoyou> We get 1 warning when build kernel with W=1: Baoyou> drivers/scsi/qla4xxx/ql4_nx.c:1846:10: warning: no previous Baoyou> prototype for 'ql4_84xx_ipmdio_rd_reg' [-Wmissing-prototypes] Baoyou> In fact, this function is only used in the file in which it is Baoyou> declared and don't need a declaration, but can be made static. Baoyou> so this patch marks this function with 'static'. Applied to 4.9/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- 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