Skip to contentSkip to conversation

scan_work improvement

PATCH Superseded Tokunori Ikegami 2 participants 7 messages Apr 22 – Apr 25

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover scan_work improvement

By the scan_work ns_list is scanned then updated to latest NS state. For the ns_attach and ns_mgmt commands ns_list update needed always. Then initialize known effects to set ns_mgmt NCC and ns_attach NIC.

Tokunori Ikegami (2):
nvme: delete unnecessary empty lines
nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC

 drivers/nvme/host/apple.c | 3 +--
 drivers/nvme/host/core.c  | 9 ++++-----
 drivers/nvme/host/ioctl.c | 1 -
 3 files changed, 5 insertions(+), 8 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH v2 1/2 nvme: delete unnecessary empty lines

Also fix incorrect indentation errors.

---
Changes since v1:
- Fix the incorrect indentation for the continuation of the condition.

 drivers/nvme/host/apple.c | 3 +--
 drivers/nvme/host/core.c  | 5 +----
 drivers/nvme/host/ioctl.c | 1 -
 3 files changed, 2 insertions(+), 7 deletions(-)
drivers/nvme/host/apple.c +1 -2
index ed61b97fde59..8e583ef05d53 100644
@@ -1060,8 +1060,7 @@ static void apple_nvme_reset_work(struct work_struct *work)
 	 * or the previous stage shut it down cleanly.
 	 */
 	if (!(readl(anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL) &
-		APPLE_ANS_COPROC_CPU_CONTROL_RUN)) {
-
+	    APPLE_ANS_COPROC_CPU_CONTROL_RUN)) {
 		ret = reset_control_assert(anv->reset);
 		if (ret)
 			goto out;
drivers/nvme/host/core.c +1 -4
index 1e33af94c24b..1f973d88c830 100644
@@ -1774,7 +1774,6 @@ static void nvme_enable_aen(struct nvme_ctrl *ctrl)
 
 static int nvme_ns_open(struct nvme_ns *ns)
 {
-
 	/* should never be called due to GENHD_FL_HIDDEN */
 	if (WARN_ON_ONCE(nvme_ns_head_multipath(ns->head)))
 		goto fail;
@@ -1793,7 +1792,6 @@ static int nvme_ns_open(struct nvme_ns *ns)
 
 static void nvme_ns_release(struct nvme_ns *ns)
 {
-
 	module_put(ns->ctrl->ops->module);
 	nvme_put_ns(ns);
 }
@@ -4684,14 +4682,13 @@ static void nvme_async_event_work(struct work_struct *work)
 	 * The transport drivers must guarantee AER submission here is safe by
 	 * flushing ctrl async_event_work after changing the controller state
 	 * from LIVE and before freeing the admin queue.
-	*/
+	 */
 	if (nvme_ctrl_state(ctrl) == NVME_CTRL_LIVE)
 		ctrl->ops->submit_async_event(ctrl);
 }
 
 static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)
 {
-
 	u32 csts;
 
 	if (ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, &csts))
drivers/nvme/host/ioctl.c +0 -1
index 9597a87cf05d..a5545dab70a8 100644
@@ -638,7 +638,6 @@ long nvme_ns_chr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 static int nvme_uring_cmd_checks(unsigned int issue_flags)
 {
-
 	/* NVMe passthrough requires big SQE/CQE support */
 	if ((issue_flags & (IO_URING_F_SQE128|IO_URING_F_CQE32)) !=
 	    (IO_URING_F_SQE128|IO_URING_F_CQE32))
Signature · 1 line
2.51.0
#2 lore raw

PATCH v2 2/2 nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC

In reply to Tokunori Ikegami

This is to make sure scan_work done for the commands. Since nvme_passthru_end called when effects set. Also scan_work is flushed when NIC or NCC effects set.

---
 drivers/nvme/host/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +3 -1
index 1f973d88c830..1ed1fc866f3f 100644
@@ -3448,8 +3448,10 @@ static int nvme_init_effects_log(struct nvme_ctrl *ctrl,
 
 static void nvme_init_known_nvm_effects(struct nvme_ctrl *ctrl)
 {
-	struct nvme_effects_log	*log = ctrl->effects;
+	struct nvme_effects_log *log = ctrl->effects;
 
+	log->acs[nvme_admin_ns_mgmt] |= cpu_to_le32(NVME_CMD_EFFECTS_NCC);
+	log->acs[nvme_admin_ns_attach] |= cpu_to_le32(NVME_CMD_EFFECTS_NIC);
 	log->acs[nvme_admin_format_nvm] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC |
 						NVME_CMD_EFFECTS_NCC |
 						NVME_CMD_EFFECTS_CSE_MASK);
Signature · 1 line
2.51.0
#3 lore raw

Re: [PATCH v2 2/2] nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC

Quoted 3 lines · Tokunori Ikegami

This is to make sure scan_work done for the commands. Since nvme_passthru_end called when effects set. Also scan_work is flushed when NIC or NCC effects set.

Can you explain the rational a little better here? Do you have a device that does not have these entries? And what problems does that cause for you for which workload?

#4 lore raw

Re: [PATCH v2 2/2] nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC

Quoted 3 lines · Christoph Hellwig

Can you explain the rational a little better here? Do you have a device that does not have these entries? And what problems does that cause for you for which workload?

The change is just an idea to improvement the scan_work to make sure as always do scan for the ns_mgmt and ns_attach commands.
Actually I do not have the device as I have only a drive these entries as NCC for ns_mgmt and NIC for ns_attach.
(Another drive I have but does not support both ns_attach and ns_mgmt then does not have these entries. Also third drive broken then I can not confirm it for now.) All drives supporting ns_mgmt and ns_attach should have the entries but I do not think the driver side not needed to be depended on it as always do scan. I tried to fix the issue below with the changes at first but the issue was caused by the test script then currently resolved already.
  <https://github.com/linux-nvme/nvme-cli/issues/3251>
So no need this change for now for the issue but in future still I think we can reduce related issue or its investigation by the change.

#5 lore raw

Re: [PATCH v2 2/2] nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC

Quoted 5 lines · Tokunori Ikegami
Quoted 3 lines · Christoph Hellwig

Can you explain the rational a little better here? Do you have a device that does not have these entries? And what problems does that cause for you for which workload?

Quoted 9 lines

The change is just an idea to improvement the scan_work to make sure as always do scan for the ns_mgmt and ns_attach commands.
Actually I do not have the device as I have only a drive these entries as NCC for ns_mgmt and NIC for ns_attach.
(Another drive I have but does not support both ns_attach and ns_mgmt then does not have these entries. Also third drive broken then I can not confirm it for now.)
All drives supporting ns_mgmt and ns_attach should have the entries but I do not think the driver side not needed to be depended on it as always do scan.

Please document this very clearly in the commit message, and maybe also in code comments.

Quoted 3 lines

I tried to fix the issue below with the changes at first but the issue was caused by the test script then currently resolved already.
  <https://github.com/linux-nvme/nvme-cli/issues/3251>

I don't really understand how this is related.

#6 lore raw

Re: [PATCH v2 2/2] nvme: initialize known effects to set ns_mgmt NCC and ns_attach NIC

Quoted 2 lines · Christoph Hellwig

Please document this very clearly in the commit message, and maybe also in code comments.

Just send v3 patches fixed for the comment. Thank you.

Quoted 1 line

I don't really understand how this is related.

Actually not related this to the nvme-cli issue as a result.
(The issue was failed ns_attach on the test.
Then at first seemed caused by the ns_attach delay from the test log for me.
Also from the nvme driver implementation investigation looked the scan_work is possible to be delayed. But the issue caused was found as the failure caused by the test environment configuration. So the issue resolved for now but still the scan_work is possible to be delay I think.)