Skip to content

Commit 1caddfc

Browse files
Merge patch series "scsi: target: Allow userspace to config cmd submission"
Mike Christie <[email protected]> says: The following patches were made over Linus's tree but apply over Martin's branches. They allow userspace to configure how fabric drivers submit cmds to backend drivers. Right now loop and vhost use a worker thread, and the other drivers submit from the contexts they receive/process the cmd from. For multiple LUN cases where the target can queue more cmds than the backend can handle then deferring to a worker thread is safest because the backend driver can block when doing things like waiting for a free request/tag. Deferring also helps when the target has to handle transport level requests from the recv context. For cases where the backend devices can queue everything the target sends, then there is no need to defer to a workqueue and you can see a perf boost of up to 26% for small IO workloads. For a nvme device and vhost-scsi I can see with 4K IOs: fio jobs 1 2 4 8 10 -------------------------------------------------- workqueue submit 94K 190K 394K 770K 890K direct submit 128K 252K 488K 950K - Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 9f4c887 + 6dbc829 commit 1caddfc

21 files changed

+170
-76
lines changed

drivers/infiniband/ulp/srpt/ib_srpt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,6 +3867,9 @@ static const struct target_core_fabric_ops srpt_template = {
38673867
.tfc_discovery_attrs = srpt_da_attrs,
38683868
.tfc_wwn_attrs = srpt_wwn_attrs,
38693869
.tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs,
3870+
3871+
.default_submit_type = TARGET_DIRECT_SUBMIT,
3872+
.direct_submit_supp = 1,
38703873
};
38713874

38723875
/**

drivers/scsi/elx/efct/efct_lio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,8 @@ static const struct target_core_fabric_ops efct_lio_ops = {
16111611
.sess_get_initiator_sid = NULL,
16121612
.tfc_tpg_base_attrs = efct_lio_tpg_attrs,
16131613
.tfc_tpg_attrib_attrs = efct_lio_tpg_attrib_attrs,
1614+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1615+
.direct_submit_supp = 1,
16141616
};
16151617

16161618
static const struct target_core_fabric_ops efct_lio_npiv_ops = {
@@ -1646,6 +1648,9 @@ static const struct target_core_fabric_ops efct_lio_npiv_ops = {
16461648
.sess_get_initiator_sid = NULL,
16471649
.tfc_tpg_base_attrs = efct_lio_npiv_tpg_attrs,
16481650
.tfc_tpg_attrib_attrs = efct_lio_npiv_tpg_attrib_attrs,
1651+
1652+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1653+
.direct_submit_supp = 1,
16491654
};
16501655

16511656
int efct_scsi_tgt_driver_init(void)

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,6 +3975,9 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
39753975
.fabric_drop_tpg = ibmvscsis_drop_tpg,
39763976

39773977
.tfc_wwn_attrs = ibmvscsis_wwn_attrs,
3978+
3979+
.default_submit_type = TARGET_DIRECT_SUBMIT,
3980+
.direct_submit_supp = 1,
39783981
};
39793982

39803983
static void ibmvscsis_dev_release(struct device *dev) {};

drivers/scsi/qla2xxx/tcm_qla2xxx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,9 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
18221822
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
18231823
.tfc_tpg_base_attrs = tcm_qla2xxx_tpg_attrs,
18241824
.tfc_tpg_attrib_attrs = tcm_qla2xxx_tpg_attrib_attrs,
1825+
1826+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1827+
.direct_submit_supp = 1,
18251828
};
18261829

18271830
static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
@@ -1859,6 +1862,9 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
18591862
.fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl,
18601863

18611864
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
1865+
1866+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1867+
.direct_submit_supp = 1,
18621868
};
18631869

18641870
static int tcm_qla2xxx_register_configfs(void)

drivers/target/iscsi/iscsi_target.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,12 +1234,6 @@ int iscsit_setup_scsi_cmd(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
12341234
spin_lock_bh(&conn->cmd_lock);
12351235
list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list);
12361236
spin_unlock_bh(&conn->cmd_lock);
1237-
/*
1238-
* Check if we need to delay processing because of ALUA
1239-
* Active/NonOptimized primary access state..
1240-
*/
1241-
core_alua_check_nonop_delay(&cmd->se_cmd);
1242-
12431237
return 0;
12441238
}
12451239
EXPORT_SYMBOL(iscsit_setup_scsi_cmd);

drivers/target/iscsi/iscsi_target_configfs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,5 +1589,8 @@ const struct target_core_fabric_ops iscsi_ops = {
15891589
.tfc_tpg_nacl_auth_attrs = lio_target_nacl_auth_attrs,
15901590
.tfc_tpg_nacl_param_attrs = lio_target_nacl_param_attrs,
15911591

1592-
.write_pending_must_be_called = true,
1592+
.write_pending_must_be_called = 1,
1593+
1594+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1595+
.direct_submit_supp = 1,
15931596
};

drivers/target/iscsi/iscsi_target_erl1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ int iscsit_execute_cmd(struct iscsit_cmd *cmd, int ooo)
948948

949949
iscsit_set_unsolicited_dataout(cmd);
950950
}
951-
return transport_handle_cdb_direct(&cmd->se_cmd);
951+
return target_submit(&cmd->se_cmd);
952952

953953
case ISCSI_OP_NOOP_OUT:
954954
case ISCSI_OP_TEXT:

drivers/target/iscsi/iscsi_target_tmr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static int iscsit_task_reassign_complete_read(
318318
pr_debug("READ ITT: 0x%08x: t_state: %d never sent to"
319319
" transport\n", cmd->init_task_tag,
320320
cmd->se_cmd.t_state);
321-
transport_handle_cdb_direct(se_cmd);
321+
target_submit(se_cmd);
322322
return 0;
323323
}
324324

drivers/target/loopback/tcm_loop.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static void tcm_loop_target_queue_cmd(struct tcm_loop_cmd *tl_cmd)
154154
GFP_ATOMIC))
155155
return;
156156

157-
target_queue_submission(se_cmd);
157+
target_submit(se_cmd);
158158
return;
159159

160160
out_done:
@@ -1102,6 +1102,8 @@ static const struct target_core_fabric_ops loop_ops = {
11021102
.tfc_wwn_attrs = tcm_loop_wwn_attrs,
11031103
.tfc_tpg_base_attrs = tcm_loop_tpg_attrs,
11041104
.tfc_tpg_attrib_attrs = tcm_loop_tpg_attrib_attrs,
1105+
.default_submit_type = TARGET_QUEUE_SUBMIT,
1106+
.direct_submit_supp = 0,
11051107
};
11061108

11071109
static int __init tcm_loop_fabric_init(void)

drivers/target/sbp/sbp_target.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,6 +2278,9 @@ static const struct target_core_fabric_ops sbp_ops = {
22782278
.tfc_wwn_attrs = sbp_wwn_attrs,
22792279
.tfc_tpg_base_attrs = sbp_tpg_base_attrs,
22802280
.tfc_tpg_attrib_attrs = sbp_tpg_attrib_attrs,
2281+
2282+
.default_submit_type = TARGET_DIRECT_SUBMIT,
2283+
.direct_submit_supp = 1,
22812284
};
22822285

22832286
static int __init sbp_init(void)

0 commit comments

Comments
 (0)