Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: target: Have drivers report if they support direct submissions

In some cases, like with multiple LUN targets or where the target has to
respond to transport level requests from the receiving context it can be
better to defer cmd submission to a helper thread. If the backend driver
blocks on something like request/tag allocation it can block the entire
target submission path and other LUs and transport IO on that session.

In other cases like single LUN targets with storage that can support all
the commands that the target can queue, then it's best to submit the cmd
to the backend from the target's cmd receiving context.

Subsequent commits will allow the user to config what they prefer, but
drivers like loop can't directly submit because they can be called from a
context that can't sleep. And, drivers like vhost-scsi can support direct
submission, but need to keep their default behavior of deferring execution
to avoid possible regressions where the backend can block.

Make the drivers tell LIO core if they support direct submissions and their
current default, so we can prevent users from misconfiguring the system and
initialize devices correctly.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230928020907.5730-2-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
194605d4 40ddd6df

+55
+3
drivers/infiniband/ulp/srpt/ib_srpt.c
··· 3867 3867 .tfc_discovery_attrs = srpt_da_attrs, 3868 3868 .tfc_wwn_attrs = srpt_wwn_attrs, 3869 3869 .tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs, 3870 + 3871 + .default_submit_type = TARGET_DIRECT_SUBMIT, 3872 + .direct_submit_supp = 1, 3870 3873 }; 3871 3874 3872 3875 /**
+5
drivers/scsi/elx/efct/efct_lio.c
··· 1611 1611 .sess_get_initiator_sid = NULL, 1612 1612 .tfc_tpg_base_attrs = efct_lio_tpg_attrs, 1613 1613 .tfc_tpg_attrib_attrs = efct_lio_tpg_attrib_attrs, 1614 + .default_submit_type = TARGET_DIRECT_SUBMIT, 1615 + .direct_submit_supp = 1, 1614 1616 }; 1615 1617 1616 1618 static const struct target_core_fabric_ops efct_lio_npiv_ops = { ··· 1648 1646 .sess_get_initiator_sid = NULL, 1649 1647 .tfc_tpg_base_attrs = efct_lio_npiv_tpg_attrs, 1650 1648 .tfc_tpg_attrib_attrs = efct_lio_npiv_tpg_attrib_attrs, 1649 + 1650 + .default_submit_type = TARGET_DIRECT_SUBMIT, 1651 + .direct_submit_supp = 1, 1651 1652 }; 1652 1653 1653 1654 int efct_scsi_tgt_driver_init(void)
+3
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
··· 3975 3975 .fabric_drop_tpg = ibmvscsis_drop_tpg, 3976 3976 3977 3977 .tfc_wwn_attrs = ibmvscsis_wwn_attrs, 3978 + 3979 + .default_submit_type = TARGET_DIRECT_SUBMIT, 3980 + .direct_submit_supp = 1, 3978 3981 }; 3979 3982 3980 3983 static void ibmvscsis_dev_release(struct device *dev) {};
+6
drivers/scsi/qla2xxx/tcm_qla2xxx.c
··· 1822 1822 .tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs, 1823 1823 .tfc_tpg_base_attrs = tcm_qla2xxx_tpg_attrs, 1824 1824 .tfc_tpg_attrib_attrs = tcm_qla2xxx_tpg_attrib_attrs, 1825 + 1826 + .default_submit_type = TARGET_DIRECT_SUBMIT, 1827 + .direct_submit_supp = 1, 1825 1828 }; 1826 1829 1827 1830 static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { ··· 1862 1859 .fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl, 1863 1860 1864 1861 .tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs, 1862 + 1863 + .default_submit_type = TARGET_DIRECT_SUBMIT, 1864 + .direct_submit_supp = 1, 1865 1865 }; 1866 1866 1867 1867 static int tcm_qla2xxx_register_configfs(void)
+3
drivers/target/iscsi/iscsi_target_configfs.c
··· 1590 1590 .tfc_tpg_nacl_param_attrs = lio_target_nacl_param_attrs, 1591 1591 1592 1592 .write_pending_must_be_called = 1, 1593 + 1594 + .default_submit_type = TARGET_DIRECT_SUBMIT, 1595 + .direct_submit_supp = 1, 1593 1596 };
+2
drivers/target/loopback/tcm_loop.c
··· 1102 1102 .tfc_wwn_attrs = tcm_loop_wwn_attrs, 1103 1103 .tfc_tpg_base_attrs = tcm_loop_tpg_attrs, 1104 1104 .tfc_tpg_attrib_attrs = tcm_loop_tpg_attrib_attrs, 1105 + .default_submit_type = TARGET_QUEUE_SUBMIT, 1106 + .direct_submit_supp = 0, 1105 1107 }; 1106 1108 1107 1109 static int __init tcm_loop_fabric_init(void)
+3
drivers/target/sbp/sbp_target.c
··· 2278 2278 .tfc_wwn_attrs = sbp_wwn_attrs, 2279 2279 .tfc_tpg_base_attrs = sbp_tpg_base_attrs, 2280 2280 .tfc_tpg_attrib_attrs = sbp_tpg_attrib_attrs, 2281 + 2282 + .default_submit_type = TARGET_DIRECT_SUBMIT, 2283 + .direct_submit_supp = 1, 2281 2284 }; 2282 2285 2283 2286 static int __init sbp_init(void)
+3
drivers/target/tcm_fc/tfc_conf.c
··· 432 432 433 433 .tfc_wwn_attrs = ft_wwn_attrs, 434 434 .tfc_tpg_nacl_base_attrs = ft_nacl_base_attrs, 435 + 436 + .default_submit_type = TARGET_DIRECT_SUBMIT, 437 + .direct_submit_supp = 1, 435 438 }; 436 439 437 440 static struct notifier_block ft_notifier = {
+3
drivers/usb/gadget/function/f_tcm.c
··· 1687 1687 1688 1688 .tfc_wwn_attrs = usbg_wwn_attrs, 1689 1689 .tfc_tpg_base_attrs = usbg_base_attrs, 1690 + 1691 + .default_submit_type = TARGET_DIRECT_SUBMIT, 1692 + .direct_submit_supp = 1, 1690 1693 }; 1691 1694 1692 1695 /* Start gadget.c code */
+3
drivers/vhost/scsi.c
··· 2598 2598 .tfc_wwn_attrs = vhost_scsi_wwn_attrs, 2599 2599 .tfc_tpg_base_attrs = vhost_scsi_tpg_attrs, 2600 2600 .tfc_tpg_attrib_attrs = vhost_scsi_tpg_attrib_attrs, 2601 + 2602 + .default_submit_type = TARGET_QUEUE_SUBMIT, 2603 + .direct_submit_supp = 1, 2601 2604 }; 2602 2605 2603 2606 static int __init vhost_scsi_init(void)
+3
drivers/xen/xen-scsiback.c
··· 1832 1832 .tfc_wwn_attrs = scsiback_wwn_attrs, 1833 1833 .tfc_tpg_base_attrs = scsiback_tpg_attrs, 1834 1834 .tfc_tpg_param_attrs = scsiback_param_attrs, 1835 + 1836 + .default_submit_type = TARGET_DIRECT_SUBMIT, 1837 + .direct_submit_supp = 1, 1835 1838 }; 1836 1839 1837 1840 static const struct xenbus_device_id scsiback_ids[] = {
+9
include/target/target_core_base.h
··· 108 108 #define SE_MODE_PAGE_BUF 512 109 109 #define SE_SENSE_BUF 96 110 110 111 + enum target_submit_type { 112 + /* Use the fabric driver's default submission type */ 113 + TARGET_FABRIC_DEFAULT_SUBMIT, 114 + /* Submit from the calling context */ 115 + TARGET_DIRECT_SUBMIT, 116 + /* Defer submission to the LIO workqueue */ 117 + TARGET_QUEUE_SUBMIT, 118 + }; 119 + 111 120 /* struct se_hba->hba_flags */ 112 121 enum hba_flags_table { 113 122 HBA_FLAGS_INTERNAL_USE = 0x01,
+9
include/target/target_core_fabric.h
··· 118 118 * its entirety before a command is aborted. 119 119 */ 120 120 unsigned int write_pending_must_be_called:1; 121 + /* 122 + * Set this if the driver supports submitting commands to the backend 123 + * from target_submit/target_submit_cmd. 124 + */ 125 + unsigned int direct_submit_supp:1; 126 + /* 127 + * Set this to a target_submit_type value. 128 + */ 129 + u8 default_submit_type; 121 130 }; 122 131 123 132 int target_register_template(const struct target_core_fabric_ops *fo);