summaryrefslogtreecommitdiff
path: root/include/target
diff options
context:
space:
mode:
authorMike Christie <michael.christie@oracle.com>2021-02-27 10:59:57 -0600
committerMartin K. Petersen <martin.petersen@oracle.com>2021-03-04 17:37:02 -0500
commiteb44ce8c8c7d3b45f9204c7f34577960c00d5919 (patch)
tree25db69f2e729f3a9a11ed38281d4502394f40be5 /include/target
parent08694199477da412baf1852c6d1bf5fedbd40c7e (diff)
downloadlinux-rpi-eb44ce8c8c7d3b45f9204c7f34577960c00d5919.tar.gz
linux-rpi-eb44ce8c8c7d3b45f9204c7f34577960c00d5919.tar.bz2
linux-rpi-eb44ce8c8c7d3b45f9204c7f34577960c00d5919.zip
scsi: target: core: Add workqueue based cmd submission
loop and vhost/scsi do their target cmd submission from driver workqueues. This allows them to avoid an issue where the backend may block waiting for resources like tags/requests, mem/locks, etc and that ends up blocking their entire submission path and for the case of vhost-scsi both the submission and completion path. This patch adds a helper drivers can use to submit from a LIO workqueue. This code will then be extended in the next patches to fix the plugging of backend devices. We are only converting vhost/loop initially, but the workqueue based submission will work for other drivers and have similar benefits where the main target loops will not end up blocking one some backend resource. Link: https://lore.kernel.org/r/20210227170006.5077-17-michael.christie@oracle.com Tested-by: Laurence Oberman <loberman@redhat.com> Reviewed-by: Bodo Stroesser <bostroesser@gmail.com> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/target')
-rw-r--r--include/target/target_core_base.h8
-rw-r--r--include/target/target_core_fabric.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 54dcc0eb25fa..ec5a10d2d843 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -488,7 +488,7 @@ struct se_cmd {
/* Only used for internal passthrough and legacy TCM fabric modules */
struct se_session *se_sess;
struct se_tmr_req *se_tmr_req;
- struct list_head se_cmd_list;
+ struct llist_node se_cmd_list;
struct completion *free_compl;
struct completion *abrt_compl;
const struct target_core_fabric_ops *se_tfo;
@@ -765,9 +765,15 @@ struct se_dev_stat_grps {
struct config_group scsi_lu_group;
};
+struct se_cmd_queue {
+ struct llist_head cmd_list;
+ struct work_struct work;
+};
+
struct se_device_queue {
struct list_head state_list;
spinlock_t lock;
+ struct se_cmd_queue sq;
};
struct se_device {
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 0543ab107723..3c5ade7a04a6 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -165,6 +165,8 @@ sense_reason_t target_cmd_init_cdb(struct se_cmd *se_cmd, unsigned char *cdb,
sense_reason_t target_cmd_parse_cdb(struct se_cmd *);
void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
unsigned char *, u64, u32, int, int, int);
+void target_queue_submission(struct se_cmd *se_cmd);
+
int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
unsigned char *sense, u64 unpacked_lun,
void *fabric_tmr_ptr, unsigned char tm_type,